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 "GrVkCaps.h" | 8 #include "GrVkCaps.h" |
9 | 9 |
10 #include "GrVkUtil.h" | 10 #include "GrVkUtil.h" |
11 #include "glsl/GrGLSLCaps.h" | 11 #include "glsl/GrGLSLCaps.h" |
12 #include "vk/GrVkInterface.h" | 12 #include "vk/GrVkInterface.h" |
13 #include "vk/GrVkBackendContext.h" | 13 #include "vk/GrVkBackendContext.h" |
14 | 14 |
15 GrVkCaps::GrVkCaps(const GrContextOptions& contextOptions, const GrVkInterface*
vkInterface, | 15 GrVkCaps::GrVkCaps(const GrContextOptions& contextOptions, const GrVkInterface*
vkInterface, |
16 VkPhysicalDevice physDev, uint32_t featureFlags) : INHERITED(
contextOptions) { | 16 VkPhysicalDevice physDev, uint32_t featureFlags, uint32_t ext
ensionFlags) |
| 17 : INHERITED(contextOptions) { |
| 18 fCanUseGLSLForShaderModule = false; |
| 19 |
17 /************************************************************************** | 20 /************************************************************************** |
18 * GrDrawTargetCaps fields | 21 * GrDrawTargetCaps fields |
19 **************************************************************************/ | 22 **************************************************************************/ |
20 fMipMapSupport = false; //TODO: figure this out | 23 fMipMapSupport = false; //TODO: figure this out |
21 fNPOTTextureTileSupport = false; //TODO: figure this out | 24 fNPOTTextureTileSupport = false; //TODO: figure this out |
22 fTwoSidedStencilSupport = false; //TODO: figure this out | 25 fTwoSidedStencilSupport = false; //TODO: figure this out |
23 fStencilWrapOpsSupport = false; //TODO: figure this out | 26 fStencilWrapOpsSupport = false; //TODO: figure this out |
24 fDiscardRenderTargetSupport = false; //TODO: figure this out | 27 fDiscardRenderTargetSupport = false; //TODO: figure this out |
25 fReuseScratchTextures = true; //TODO: figure this out | 28 fReuseScratchTextures = true; //TODO: figure this out |
26 fGpuTracingSupport = false; //TODO: figure this out | 29 fGpuTracingSupport = false; //TODO: figure this out |
27 fCompressedTexSubImageSupport = false; //TODO: figure this out | 30 fCompressedTexSubImageSupport = false; //TODO: figure this out |
28 fOversizedStencilSupport = false; //TODO: figure this out | 31 fOversizedStencilSupport = false; //TODO: figure this out |
29 | 32 |
30 fUseDrawInsteadOfClear = false; //TODO: figure this out | 33 fUseDrawInsteadOfClear = false; //TODO: figure this out |
31 | 34 |
32 fMapBufferFlags = kNone_MapFlags; //TODO: figure this out | 35 fMapBufferFlags = kNone_MapFlags; //TODO: figure this out |
33 fBufferMapThreshold = SK_MaxS32; //TODO: figure this out | 36 fBufferMapThreshold = SK_MaxS32; //TODO: figure this out |
34 | 37 |
35 fMaxRenderTargetSize = 4096; // minimum required by spec | 38 fMaxRenderTargetSize = 4096; // minimum required by spec |
36 fMaxTextureSize = 4096; // minimum required by spec | 39 fMaxTextureSize = 4096; // minimum required by spec |
37 fMaxColorSampleCount = 4; // minimum required by spec | 40 fMaxColorSampleCount = 4; // minimum required by spec |
38 fMaxStencilSampleCount = 4; // minimum required by spec | 41 fMaxStencilSampleCount = 4; // minimum required by spec |
39 | 42 |
40 | 43 |
41 fShaderCaps.reset(new GrGLSLCaps(contextOptions)); | 44 fShaderCaps.reset(new GrGLSLCaps(contextOptions)); |
42 | 45 |
43 this->init(contextOptions, vkInterface, physDev, featureFlags); | 46 this->init(contextOptions, vkInterface, physDev, featureFlags, extensionFlag
s); |
44 } | 47 } |
45 | 48 |
46 void GrVkCaps::init(const GrContextOptions& contextOptions, const GrVkInterface*
vkInterface, | 49 void GrVkCaps::init(const GrContextOptions& contextOptions, const GrVkInterface*
vkInterface, |
47 VkPhysicalDevice physDev, uint32_t featureFlags) { | 50 VkPhysicalDevice physDev, uint32_t featureFlags, uint32_t ex
tensionFlags) { |
48 | 51 |
49 VkPhysicalDeviceProperties properties; | 52 VkPhysicalDeviceProperties properties; |
50 GR_VK_CALL(vkInterface, GetPhysicalDeviceProperties(physDev, &properties)); | 53 GR_VK_CALL(vkInterface, GetPhysicalDeviceProperties(physDev, &properties)); |
51 | 54 |
52 VkPhysicalDeviceMemoryProperties memoryProperties; | 55 VkPhysicalDeviceMemoryProperties memoryProperties; |
53 GR_VK_CALL(vkInterface, GetPhysicalDeviceMemoryProperties(physDev, &memoryPr
operties)); | 56 GR_VK_CALL(vkInterface, GetPhysicalDeviceMemoryProperties(physDev, &memoryPr
operties)); |
54 | 57 |
55 this->initGrCaps(properties, memoryProperties, featureFlags); | 58 this->initGrCaps(properties, memoryProperties, featureFlags); |
56 this->initGLSLCaps(properties, featureFlags); | 59 this->initGLSLCaps(properties, featureFlags); |
57 this->initConfigTexturableTable(vkInterface, physDev); | 60 this->initConfigTexturableTable(vkInterface, physDev); |
58 this->initConfigRenderableTable(vkInterface, physDev); | 61 this->initConfigRenderableTable(vkInterface, physDev); |
59 this->initStencilFormats(vkInterface, physDev); | 62 this->initStencilFormats(vkInterface, physDev); |
60 | 63 |
61 | 64 if (SkToBool(extensionFlags & kNV_glsl_shader_GrVkExtensionFlag)) { |
| 65 fCanUseGLSLForShaderModule = true; |
| 66 } |
62 | 67 |
63 this->applyOptionsOverrides(contextOptions); | 68 this->applyOptionsOverrides(contextOptions); |
64 // need to friend GrVkCaps in GrGLSLCaps.h | 69 GrGLSLCaps* glslCaps = static_cast<GrGLSLCaps*>(fShaderCaps.get()); |
65 // GrGLSLCaps* glslCaps = static_cast<GrGLSLCaps*>(fShaderCaps.get()); | 70 glslCaps->applyOptionsOverrides(contextOptions); |
66 // glslCaps->applyOptionsOverrides(contextOptions); | |
67 } | 71 } |
68 | 72 |
69 int get_max_sample_count(VkSampleCountFlags flags) { | 73 int get_max_sample_count(VkSampleCountFlags flags) { |
70 SkASSERT(flags & VK_SAMPLE_COUNT_1_BIT); | 74 SkASSERT(flags & VK_SAMPLE_COUNT_1_BIT); |
71 if (!(flags & VK_SAMPLE_COUNT_2_BIT)) { | 75 if (!(flags & VK_SAMPLE_COUNT_2_BIT)) { |
72 return 0; | 76 return 0; |
73 } | 77 } |
74 if (!(flags & VK_SAMPLE_COUNT_4_BIT)) { | 78 if (!(flags & VK_SAMPLE_COUNT_4_BIT)) { |
75 return 2; | 79 return 2; |
76 } | 80 } |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 // internal Format stencil bits total bits
packed? | 274 // internal Format stencil bits total bits
packed? |
271 gS8 = { VK_FORMAT_S8_UINT, 8, 8,
false }, | 275 gS8 = { VK_FORMAT_S8_UINT, 8, 8,
false }, |
272 gD24S8 = { VK_FORMAT_D24_UNORM_S8_UINT, 8, 32,
true }; | 276 gD24S8 = { VK_FORMAT_D24_UNORM_S8_UINT, 8, 32,
true }; |
273 | 277 |
274 // I'm simply assuming that these two will be supported since they are used
in example code. | 278 // I'm simply assuming that these two will be supported since they are used
in example code. |
275 // TODO: Actaully figure this out | 279 // TODO: Actaully figure this out |
276 SET_CONFIG_CAN_STENCIL(gS8); | 280 SET_CONFIG_CAN_STENCIL(gS8); |
277 SET_CONFIG_CAN_STENCIL(gD24S8); | 281 SET_CONFIG_CAN_STENCIL(gD24S8); |
278 } | 282 } |
279 | 283 |
OLD | NEW |