Increase maximum framebuffer size
Legacy SwiftShader GL has a maximum framebuffer size of 8192 width
and height. SwiftShader Vulkan's maximum framebuffer size was 4096,
but this CL increases it to 8192. An issue was hit by using Chromium
with SwANGLE on an iMac Pro 5k screen, where the 4096 limit was
insufficient and causing a crash.
The viewport max dimensions and bounds range had to be adjusted
accordingly.
According to the spec:
"viewportBoundsRange[2] is the [minimum, maximum] range
that the corners of a viewport must be contained in. This
range must be at least [-2 × size, 2 × size - 1], where
size = max(maxViewportDimensions[0], maxViewportDimensions[1])."
Bug: chromium:1209250
Change-Id: I0ef15ccf2433aea348fd7946319ffb3406174873
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/55008
Tested-by: Alexis Hétu <sugoi@google.com>
Commit-Queue: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
diff --git a/src/Device/Config.hpp b/src/Device/Config.hpp
index 2d232b1..8f5adef 100644
--- a/src/Device/Config.hpp
+++ b/src/Device/Config.hpp
@@ -31,6 +31,8 @@
MAX_TEXTURE_LOD = MIPMAP_LEVELS - 2, // Trilinear accesses lod+1
RENDERTARGETS = 8,
MAX_INTERFACE_COMPONENTS = 32 * 4, // Must be multiple of 4 for 16-byte alignment.
+ MAX_FRAMEBUFFER_DIM = OUTLINE_RESOLUTION,
+ MAX_VIEWPORT_DIM = MAX_FRAMEBUFFER_DIM,
};
} // namespace sw
diff --git a/src/Vulkan/VkPhysicalDevice.cpp b/src/Vulkan/VkPhysicalDevice.cpp
index 1a14680..5493ea4 100644
--- a/src/Vulkan/VkPhysicalDevice.cpp
+++ b/src/Vulkan/VkPhysicalDevice.cpp
@@ -495,8 +495,10 @@
vk::MAX_SAMPLER_LOD_BIAS, // maxSamplerLodBias
16, // maxSamplerAnisotropy
16, // maxViewports
- { 4096, 4096 }, // maxViewportDimensions[2]
- { -8192, 8191 }, // viewportBoundsRange[2]
+ { sw::MAX_VIEWPORT_DIM,
+ sw::MAX_VIEWPORT_DIM }, // maxViewportDimensions[2]
+ { -2 * sw::MAX_VIEWPORT_DIM,
+ 2 * sw::MAX_VIEWPORT_DIM - 1 }, // viewportBoundsRange[2]
0, // viewportSubPixelBits
64, // minMemoryMapAlignment
vk::MIN_TEXEL_BUFFER_OFFSET_ALIGNMENT, // minTexelBufferOffsetAlignment
@@ -509,8 +511,8 @@
-0.5, // minInterpolationOffset
0.5, // maxInterpolationOffset
4, // subPixelInterpolationOffsetBits
- 4096, // maxFramebufferWidth
- 4096, // maxFramebufferHeight
+ sw::MAX_FRAMEBUFFER_DIM, // maxFramebufferWidth
+ sw::MAX_FRAMEBUFFER_DIM, // maxFramebufferHeight
256, // maxFramebufferLayers
sampleCounts, // framebufferColorSampleCounts
sampleCounts, // framebufferDepthSampleCounts