| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "vk/GrVkBackendContext.h" | 8 #include "vk/GrVkBackendContext.h" |
| 9 #include "vk/GrVkExtensions.h" | 9 #include "vk/GrVkExtensions.h" |
| 10 #include "vk/GrVkInterface.h" | 10 #include "vk/GrVkInterface.h" |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 } | 160 } |
| 161 #endif | 161 #endif |
| 162 if (extensions.hasDeviceExtension("VK_NV_glsl_shader")) { | 162 if (extensions.hasDeviceExtension("VK_NV_glsl_shader")) { |
| 163 deviceExtensionNames.push_back("VK_NV_glsl_shader"); | 163 deviceExtensionNames.push_back("VK_NV_glsl_shader"); |
| 164 extensionFlags |= kNV_glsl_shader_GrVkExtensionFlag; | 164 extensionFlags |= kNV_glsl_shader_GrVkExtensionFlag; |
| 165 } | 165 } |
| 166 | 166 |
| 167 // query to get the physical device properties | 167 // query to get the physical device properties |
| 168 VkPhysicalDeviceFeatures deviceFeatures; | 168 VkPhysicalDeviceFeatures deviceFeatures; |
| 169 vkGetPhysicalDeviceFeatures(physDev, &deviceFeatures); | 169 vkGetPhysicalDeviceFeatures(physDev, &deviceFeatures); |
| 170 // this looks like it would slow things down, | 170 // this looks like it would slow things down, |
| 171 // and we can't depend on it on all platforms | 171 // and we can't depend on it on all platforms |
| 172 deviceFeatures.robustBufferAccess = VK_FALSE; | 172 deviceFeatures.robustBufferAccess = VK_FALSE; |
| 173 | 173 |
| 174 uint32_t featureFlags = 0; | 174 uint32_t featureFlags = 0; |
| 175 if (deviceFeatures.geometryShader) { | 175 if (deviceFeatures.geometryShader) { |
| 176 featureFlags |= kGeometryShader_GrVkFeatureFlag; | 176 featureFlags |= kGeometryShader_GrVkFeatureFlag; |
| 177 } | 177 } |
| 178 if (deviceFeatures.dualSrcBlend) { | 178 if (deviceFeatures.dualSrcBlend) { |
| 179 featureFlags |= kDualSrcBlend_GrVkFeatureFlag; | 179 featureFlags |= kDualSrcBlend_GrVkFeatureFlag; |
| 180 } | 180 } |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 GrVkBackendContext* ctx = new GrVkBackendContext(); | 218 GrVkBackendContext* ctx = new GrVkBackendContext(); |
| 219 ctx->fInstance = inst; | 219 ctx->fInstance = inst; |
| 220 ctx->fPhysicalDevice = physDev; | 220 ctx->fPhysicalDevice = physDev; |
| 221 ctx->fDevice = device; | 221 ctx->fDevice = device; |
| 222 ctx->fQueue = queue; | 222 ctx->fQueue = queue; |
| 223 ctx->fQueueFamilyIndex = graphicsQueueIndex; | 223 ctx->fQueueFamilyIndex = graphicsQueueIndex; |
| 224 ctx->fMinAPIVersion = kGrVkMinimumVersion; | 224 ctx->fMinAPIVersion = kGrVkMinimumVersion; |
| 225 ctx->fExtensions = extensionFlags; | 225 ctx->fExtensions = extensionFlags; |
| 226 ctx->fFeatures = featureFlags; | 226 ctx->fFeatures = featureFlags; |
| 227 ctx->fInterface.reset(GrVkCreateInterface(inst, device, extensionFlags)); | 227 ctx->fInterface.reset(GrVkCreateInterface(inst, device, extensionFlags)); |
| 228 | 228 |
| 229 return ctx; | 229 return ctx; |
| 230 } | 230 } |
| 231 | 231 |
| 232 GrVkBackendContext::~GrVkBackendContext() { | 232 GrVkBackendContext::~GrVkBackendContext() { |
| 233 vkDestroyDevice(fDevice, nullptr); | 233 vkDestroyDevice(fDevice, nullptr); |
| 234 fDevice = VK_NULL_HANDLE; | 234 fDevice = VK_NULL_HANDLE; |
| 235 vkDestroyInstance(fInstance, nullptr); | 235 vkDestroyInstance(fInstance, nullptr); |
| 236 fInstance = VK_NULL_HANDLE; | 236 fInstance = VK_NULL_HANDLE; |
| 237 } | 237 } |
| OLD | NEW |