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" |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 VkFormat format) { | 182 VkFormat format) { |
183 VkFormatProperties props; | 183 VkFormatProperties props; |
184 memset(&props, 0, sizeof(VkFormatProperties)); | 184 memset(&props, 0, sizeof(VkFormatProperties)); |
185 GR_VK_CALL(interface, GetPhysicalDeviceFormatProperties(physDev, format, &pr
ops)); | 185 GR_VK_CALL(interface, GetPhysicalDeviceFormatProperties(physDev, format, &pr
ops)); |
186 return SkToBool(VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT & props.optim
alTilingFeatures); | 186 return SkToBool(VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT & props.optim
alTilingFeatures); |
187 } | 187 } |
188 | 188 |
189 void GrVkCaps::initStencilFormat(const GrVkInterface* interface, VkPhysicalDevic
e physDev) { | 189 void GrVkCaps::initStencilFormat(const GrVkInterface* interface, VkPhysicalDevic
e physDev) { |
190 // List of legal stencil formats (though perhaps not supported on | 190 // List of legal stencil formats (though perhaps not supported on |
191 // the particular gpu/driver) from most preferred to least. We are guarantee
d to have either | 191 // the particular gpu/driver) from most preferred to least. We are guarantee
d to have either |
192 // VK_FORMAT_D24_UNORM_S8_UINT or VK_FORMAT_D24_SFLOAT_S8_UINT. VK_FORMAT_D3
2_SFLOAT_S8_UINT | 192 // VK_FORMAT_D24_UNORM_S8_UINT or VK_FORMAT_D32_SFLOAT_S8_UINT. VK_FORMAT_D3
2_SFLOAT_S8_UINT |
193 // can optionally have 24 unused bits at the end so we assume the total bits
is 64. | 193 // can optionally have 24 unused bits at the end so we assume the total bits
is 64. |
194 static const StencilFormat | 194 static const StencilFormat |
195 // internal Format stencil bits total bits
packed? | 195 // internal Format stencil bits total bits
packed? |
196 gS8 = { VK_FORMAT_S8_UINT, 8, 8,
false }, | 196 gS8 = { VK_FORMAT_S8_UINT, 8, 8,
false }, |
197 gD24S8 = { VK_FORMAT_D24_UNORM_S8_UINT, 8, 32,
true }, | 197 gD24S8 = { VK_FORMAT_D24_UNORM_S8_UINT, 8, 32,
true }, |
198 gD32S8 = { VK_FORMAT_D32_SFLOAT_S8_UINT, 8, 64,
true }; | 198 gD32S8 = { VK_FORMAT_D32_SFLOAT_S8_UINT, 8, 64,
true }; |
199 | 199 |
200 if (stencil_format_supported(interface, physDev, VK_FORMAT_S8_UINT)) { | 200 if (stencil_format_supported(interface, physDev, VK_FORMAT_S8_UINT)) { |
201 fPreferedStencilFormat = gS8; | 201 fPreferedStencilFormat = gS8; |
202 } else if (stencil_format_supported(interface, physDev, VK_FORMAT_D24_UNORM_
S8_UINT)) { | 202 } else if (stencil_format_supported(interface, physDev, VK_FORMAT_D24_UNORM_
S8_UINT)) { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 | 237 |
238 void GrVkCaps::ConfigInfo::init(const GrVkInterface* interface, | 238 void GrVkCaps::ConfigInfo::init(const GrVkInterface* interface, |
239 VkPhysicalDevice physDev, | 239 VkPhysicalDevice physDev, |
240 VkFormat format) { | 240 VkFormat format) { |
241 VkFormatProperties props; | 241 VkFormatProperties props; |
242 memset(&props, 0, sizeof(VkFormatProperties)); | 242 memset(&props, 0, sizeof(VkFormatProperties)); |
243 GR_VK_CALL(interface, GetPhysicalDeviceFormatProperties(physDev, format, &pr
ops)); | 243 GR_VK_CALL(interface, GetPhysicalDeviceFormatProperties(physDev, format, &pr
ops)); |
244 InitConfigFlags(props.linearTilingFeatures, &fLinearFlags); | 244 InitConfigFlags(props.linearTilingFeatures, &fLinearFlags); |
245 InitConfigFlags(props.optimalTilingFeatures, &fOptimalFlags); | 245 InitConfigFlags(props.optimalTilingFeatures, &fOptimalFlags); |
246 } | 246 } |
OLD | NEW |