Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/gpu/vk/GrVkCaps.cpp

Issue 2371923002: Clamp Vulkan caps to INT_MAX (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/glsl/GrGLSLCaps.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 VkSampleCountFlags colorSamples = properties.limits.framebufferColorSampleCo unts; 105 VkSampleCountFlags colorSamples = properties.limits.framebufferColorSampleCo unts;
106 VkSampleCountFlags stencilSamples = properties.limits.framebufferStencilSamp leCounts; 106 VkSampleCountFlags stencilSamples = properties.limits.framebufferStencilSamp leCounts;
107 107
108 fMaxColorSampleCount = get_max_sample_count(colorSamples); 108 fMaxColorSampleCount = get_max_sample_count(colorSamples);
109 fMaxStencilSampleCount = get_max_sample_count(stencilSamples); 109 fMaxStencilSampleCount = get_max_sample_count(stencilSamples);
110 } 110 }
111 111
112 void GrVkCaps::initGrCaps(const VkPhysicalDeviceProperties& properties, 112 void GrVkCaps::initGrCaps(const VkPhysicalDeviceProperties& properties,
113 const VkPhysicalDeviceMemoryProperties& memoryProperti es, 113 const VkPhysicalDeviceMemoryProperties& memoryProperti es,
114 uint32_t featureFlags) { 114 uint32_t featureFlags) {
115 fMaxVertexAttributes = properties.limits.maxVertexInputAttributes; 115 fMaxVertexAttributes = SkTMin(properties.limits.maxVertexInputAttributes, (u int32_t)INT_MAX);
116 // We could actually query and get a max size for each config, however maxIm ageDimension2D will 116 // We could actually query and get a max size for each config, however maxIm ageDimension2D will
117 // give the minimum max size across all configs. So for simplicity we will u se that for now. 117 // give the minimum max size across all configs. So for simplicity we will u se that for now.
118 fMaxRenderTargetSize = properties.limits.maxImageDimension2D; 118 fMaxRenderTargetSize = SkTMin(properties.limits.maxImageDimension2D, (uint32 _t)INT_MAX);
119 fMaxTextureSize = properties.limits.maxImageDimension2D; 119 fMaxTextureSize = SkTMin(properties.limits.maxImageDimension2D, (uint32_t)IN T_MAX);
120 120
121 this->initSampleCount(properties); 121 this->initSampleCount(properties);
122 122
123 // Assuming since we will always map in the end to upload the data we might as well just map 123 // Assuming since we will always map in the end to upload the data we might as well just map
124 // from the get go. There is no hard data to suggest this is faster or slowe r. 124 // from the get go. There is no hard data to suggest this is faster or slowe r.
125 fBufferMapThreshold = 0; 125 fBufferMapThreshold = 0;
126 126
127 fMapBufferFlags = kCanMap_MapFlag | kSubset_MapFlag; 127 fMapBufferFlags = kCanMap_MapFlag | kSubset_MapFlag;
128 128
129 fStencilWrapOpsSupport = true; 129 fStencilWrapOpsSupport = true;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 auto& mediump = glslCaps->fFloatPrecisions[s][kMedium_GrSLPrecision]; 180 auto& mediump = glslCaps->fFloatPrecisions[s][kMedium_GrSLPrecision];
181 mediump.fLogRangeLow = mediump.fLogRangeHigh = 14; 181 mediump.fLogRangeLow = mediump.fLogRangeHigh = 14;
182 mediump.fBits = 10; 182 mediump.fBits = 10;
183 183
184 glslCaps->fFloatPrecisions[s][kLow_GrSLPrecision] = mediump; 184 glslCaps->fFloatPrecisions[s][kLow_GrSLPrecision] = mediump;
185 } 185 }
186 glslCaps->initSamplerPrecisionTable(); 186 glslCaps->initSamplerPrecisionTable();
187 187
188 glslCaps->fMaxVertexSamplers = 188 glslCaps->fMaxVertexSamplers =
189 glslCaps->fMaxGeometrySamplers = 189 glslCaps->fMaxGeometrySamplers =
190 glslCaps->fMaxFragmentSamplers = SkTMin(properties.limits.maxPerStageDescrip torSampledImages, 190 glslCaps->fMaxFragmentSamplers = SkTMin(SkTMin(properties.limits.maxPerStage DescriptorSampledImages,
191 properties.limits.maxPerStageDescrip torSamplers); 191 properties.limits.maxPerStage DescriptorSamplers),
192 glslCaps->fMaxCombinedSamplers = SkTMin(properties.limits.maxDescriptorSetSa mpledImages, 192 (uint32_t)INT_MAX);
193 properties.limits.maxDescriptorSetSa mplers); 193 glslCaps->fMaxCombinedSamplers = SkTMin(SkTMin(properties.limits.maxDescript orSetSampledImages,
194 properties.limits.maxDescript orSetSamplers),
195 (uint32_t)INT_MAX);
194 } 196 }
195 197
196 bool stencil_format_supported(const GrVkInterface* interface, 198 bool stencil_format_supported(const GrVkInterface* interface,
197 VkPhysicalDevice physDev, 199 VkPhysicalDevice physDev,
198 VkFormat format) { 200 VkFormat format) {
199 VkFormatProperties props; 201 VkFormatProperties props;
200 memset(&props, 0, sizeof(VkFormatProperties)); 202 memset(&props, 0, sizeof(VkFormatProperties));
201 GR_VK_CALL(interface, GetPhysicalDeviceFormatProperties(physDev, format, &pr ops)); 203 GR_VK_CALL(interface, GetPhysicalDeviceFormatProperties(physDev, format, &pr ops));
202 return SkToBool(VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT & props.optim alTilingFeatures); 204 return SkToBool(VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT & props.optim alTilingFeatures);
203 } 205 }
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 255
254 void GrVkCaps::ConfigInfo::init(const GrVkInterface* interface, 256 void GrVkCaps::ConfigInfo::init(const GrVkInterface* interface,
255 VkPhysicalDevice physDev, 257 VkPhysicalDevice physDev,
256 VkFormat format) { 258 VkFormat format) {
257 VkFormatProperties props; 259 VkFormatProperties props;
258 memset(&props, 0, sizeof(VkFormatProperties)); 260 memset(&props, 0, sizeof(VkFormatProperties));
259 GR_VK_CALL(interface, GetPhysicalDeviceFormatProperties(physDev, format, &pr ops)); 261 GR_VK_CALL(interface, GetPhysicalDeviceFormatProperties(physDev, format, &pr ops));
260 InitConfigFlags(props.linearTilingFeatures, &fLinearFlags); 262 InitConfigFlags(props.linearTilingFeatures, &fLinearFlags);
261 InitConfigFlags(props.optimalTilingFeatures, &fOptimalFlags); 263 InitConfigFlags(props.optimalTilingFeatures, &fOptimalFlags);
262 } 264 }
OLDNEW
« no previous file with comments | « src/gpu/glsl/GrGLSLCaps.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698