aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu
diff options
context:
space:
mode:
authorGravatar jvanverth <jvanverth@google.com>2016-09-27 03:33:05 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-09-27 03:33:07 -0700
commite78d4872cf2a0914752cdc99c4ec4a499cfd4e2c (patch)
tree5db1ff4df2556af86159b0892e7b08d558637f05 /src/gpu
parent403d154591275b631464854e63c6050adf083686 (diff)
Clamp Vulkan caps to INT_MAX
AMD sets some Vulkan caps values to 0xffffffff as a uint32_t, which overflows our int values and causes merry havok. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2371923002 Review-Url: https://codereview.chromium.org/2371923002
Diffstat (limited to 'src/gpu')
-rwxr-xr-xsrc/gpu/glsl/GrGLSLCaps.h8
-rw-r--r--src/gpu/vk/GrVkCaps.cpp16
2 files changed, 13 insertions, 11 deletions
diff --git a/src/gpu/glsl/GrGLSLCaps.h b/src/gpu/glsl/GrGLSLCaps.h
index d8145e729d..ac409a36ba 100755
--- a/src/gpu/glsl/GrGLSLCaps.h
+++ b/src/gpu/glsl/GrGLSLCaps.h
@@ -217,10 +217,10 @@ private:
const char* fFBFetchColorName;
const char* fFBFetchExtensionString;
- uint32_t fMaxVertexSamplers;
- uint32_t fMaxGeometrySamplers;
- uint32_t fMaxFragmentSamplers;
- uint32_t fMaxCombinedSamplers;
+ int fMaxVertexSamplers;
+ int fMaxGeometrySamplers;
+ int fMaxFragmentSamplers;
+ int fMaxCombinedSamplers;
AdvBlendEqInteraction fAdvBlendEqInteraction;
diff --git a/src/gpu/vk/GrVkCaps.cpp b/src/gpu/vk/GrVkCaps.cpp
index 1d735aa8d6..be25c889e3 100644
--- a/src/gpu/vk/GrVkCaps.cpp
+++ b/src/gpu/vk/GrVkCaps.cpp
@@ -112,11 +112,11 @@ void GrVkCaps::initSampleCount(const VkPhysicalDeviceProperties& properties) {
void GrVkCaps::initGrCaps(const VkPhysicalDeviceProperties& properties,
const VkPhysicalDeviceMemoryProperties& memoryProperties,
uint32_t featureFlags) {
- fMaxVertexAttributes = properties.limits.maxVertexInputAttributes;
+ fMaxVertexAttributes = SkTMin(properties.limits.maxVertexInputAttributes, (uint32_t)INT_MAX);
// We could actually query and get a max size for each config, however maxImageDimension2D will
// give the minimum max size across all configs. So for simplicity we will use that for now.
- fMaxRenderTargetSize = properties.limits.maxImageDimension2D;
- fMaxTextureSize = properties.limits.maxImageDimension2D;
+ fMaxRenderTargetSize = SkTMin(properties.limits.maxImageDimension2D, (uint32_t)INT_MAX);
+ fMaxTextureSize = SkTMin(properties.limits.maxImageDimension2D, (uint32_t)INT_MAX);
this->initSampleCount(properties);
@@ -187,10 +187,12 @@ void GrVkCaps::initGLSLCaps(const VkPhysicalDeviceProperties& properties,
glslCaps->fMaxVertexSamplers =
glslCaps->fMaxGeometrySamplers =
- glslCaps->fMaxFragmentSamplers = SkTMin(properties.limits.maxPerStageDescriptorSampledImages,
- properties.limits.maxPerStageDescriptorSamplers);
- glslCaps->fMaxCombinedSamplers = SkTMin(properties.limits.maxDescriptorSetSampledImages,
- properties.limits.maxDescriptorSetSamplers);
+ glslCaps->fMaxFragmentSamplers = SkTMin(SkTMin(properties.limits.maxPerStageDescriptorSampledImages,
+ properties.limits.maxPerStageDescriptorSamplers),
+ (uint32_t)INT_MAX);
+ glslCaps->fMaxCombinedSamplers = SkTMin(SkTMin(properties.limits.maxDescriptorSetSampledImages,
+ properties.limits.maxDescriptorSetSamplers),
+ (uint32_t)INT_MAX);
}
bool stencil_format_supported(const GrVkInterface* interface,