From 724afe8b2da2cd32394921096d5c738519b5a51e Mon Sep 17 00:00:00 2001 From: Adrienne Walker Date: Tue, 15 May 2018 11:36:26 -0700 Subject: [PATCH] Driver bug workaround: max_texture_size_limit_4096 Bug: chromium: 829614 Change-Id: I127157fa04df2ec6505411aa42f1232910e251d4 Reviewed-on: https://skia-review.googlesource.com/126608 Commit-Queue: Adrienne Walker Reviewed-by: Brian Salomon --- include/gpu/GrDriverBugWorkaroundsAutogen.h | 2 ++ src/gpu/gl/GrGLCaps.cpp | 5 +++++ src/gpu/gpu_workaround_list.txt | 1 + src/gpu/vk/GrVkCaps.cpp | 6 ++++++ 4 files changed, 14 insertions(+) diff --git a/include/gpu/GrDriverBugWorkaroundsAutogen.h b/include/gpu/GrDriverBugWorkaroundsAutogen.h index feda01bfcf..f8018c8cc7 100644 --- a/include/gpu/GrDriverBugWorkaroundsAutogen.h +++ b/include/gpu/GrDriverBugWorkaroundsAutogen.h @@ -10,4 +10,6 @@ disable_blend_equation_advanced) \ GPU_OP(DISABLE_DISCARD_FRAMEBUFFER, \ disable_discard_framebuffer) \ + GPU_OP(MAX_TEXTURE_SIZE_LIMIT_4096, \ + max_texture_size_limit_4096) \ // The End diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp index 2acc7ca91f..a20e049329 100644 --- a/src/gpu/gl/GrGLCaps.cpp +++ b/src/gpu/gl/GrGLCaps.cpp @@ -489,6 +489,11 @@ void GrGLCaps::init(const GrContextOptions& contextOptions, } GR_GL_GetIntegerv(gli, GR_GL_MAX_TEXTURE_SIZE, &fMaxTextureSize); + + if (fDriverBugWorkarounds.max_texture_size_limit_4096) { + fMaxTextureSize = SkTMin(fMaxTextureSize, 4096); + } + GR_GL_GetIntegerv(gli, GR_GL_MAX_RENDERBUFFER_SIZE, &fMaxRenderTargetSize); // Our render targets are always created with textures as the color // attachment, hence this min: diff --git a/src/gpu/gpu_workaround_list.txt b/src/gpu/gpu_workaround_list.txt index dbded3f11c..c9867a6b22 100644 --- a/src/gpu/gpu_workaround_list.txt +++ b/src/gpu/gpu_workaround_list.txt @@ -1,2 +1,3 @@ disable_blend_equation_advanced disable_discard_framebuffer +max_texture_size_limit_4096 diff --git a/src/gpu/vk/GrVkCaps.cpp b/src/gpu/vk/GrVkCaps.cpp index 1c36a1494c..76a1417ff8 100644 --- a/src/gpu/vk/GrVkCaps.cpp +++ b/src/gpu/vk/GrVkCaps.cpp @@ -317,6 +317,12 @@ void GrVkCaps::initGrCaps(const VkPhysicalDeviceProperties& properties, // give the minimum max size across all configs. So for simplicity we will use that for now. fMaxRenderTargetSize = SkTMin(properties.limits.maxImageDimension2D, (uint32_t)INT_MAX); fMaxTextureSize = SkTMin(properties.limits.maxImageDimension2D, (uint32_t)INT_MAX); + if (fDriverBugWorkarounds.max_texture_size_limit_4096) { + fMaxTextureSize = SkTMin(fMaxTextureSize, 4096); + } + // Our render targets are always created with textures as the color + // attachment, hence this min: + fMaxRenderTargetSize = SkTMin(fMaxTextureSize, fMaxRenderTargetSize); // TODO: check if RT's larger than 4k incur a performance cost on ARM. fMaxPreferredRenderTargetSize = fMaxRenderTargetSize;