mirror of
https://github.com/godotengine/godot-angle-static.git
synced 2026-01-06 02:09:55 +03:00
Clamp the max Framebuffer width and height to 16 bit
GraphicsDriverUniforms struct packs framebuffer width and height into a 32 bit uint, meaning the maximum width and height supported are 16 bit each. We should make sure below values do not exceed the maximum value of a 16-bit uint: caps.maxFramebufferWidth caps.maxFramebufferHeight caps.maxRenderbufferSize so that the application won't try to create a FBO with width/height exceeding 16-bit. We have clamped the caps.max2DTextureSize to 32768, it makes sense to clamp the FBO width and height to the same value. Bug: b/286921997 Change-Id: Iae598b37215c58d1a0f6a50bba9f391d4d23d1f2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4671327 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
This commit is contained in:
@@ -80,6 +80,10 @@ enum
|
||||
IMPLEMENTATION_MAX_ACTIVE_TEXTURES = 96,
|
||||
IMPLEMENTATION_MAX_IMAGE_UNITS = IMPLEMENTATION_MAX_ACTIVE_TEXTURES,
|
||||
|
||||
// Maximum framebuffer and renderbuffer size supported.
|
||||
IMPLEMENTATION_MAX_FRAMEBUFFER_SIZE = 32768,
|
||||
IMPLEMENTATION_MAX_RENDERBUFFER_SIZE = 32768,
|
||||
|
||||
// Maximum number of slots allocated for atomic counter buffers.
|
||||
IMPLEMENTATION_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS = 8,
|
||||
|
||||
|
||||
@@ -4118,6 +4118,9 @@ void Context::initCaps()
|
||||
|
||||
// Apply/Verify implementation limits
|
||||
ANGLE_LIMIT_CAP(caps->maxDrawBuffers, IMPLEMENTATION_MAX_DRAW_BUFFERS);
|
||||
ANGLE_LIMIT_CAP(caps->maxFramebufferWidth, IMPLEMENTATION_MAX_FRAMEBUFFER_SIZE);
|
||||
ANGLE_LIMIT_CAP(caps->maxFramebufferHeight, IMPLEMENTATION_MAX_FRAMEBUFFER_SIZE);
|
||||
ANGLE_LIMIT_CAP(caps->maxRenderbufferSize, IMPLEMENTATION_MAX_RENDERBUFFER_SIZE);
|
||||
ANGLE_LIMIT_CAP(caps->maxColorAttachments, IMPLEMENTATION_MAX_DRAW_BUFFERS);
|
||||
ANGLE_LIMIT_CAP(caps->maxVertexAttributes, MAX_VERTEX_ATTRIBS);
|
||||
ANGLE_LIMIT_CAP(caps->maxVertexAttribStride,
|
||||
|
||||
@@ -6793,7 +6793,9 @@ angle::Result ContextVk::handleDirtyGraphicsDriverUniforms(DirtyBits::Iterator *
|
||||
{
|
||||
FramebufferVk *drawFramebufferVk = getDrawFramebuffer();
|
||||
|
||||
static_assert(gl::IMPLEMENTATION_MAX_2D_TEXTURE_SIZE <= 0xFFFF,
|
||||
static_assert(gl::IMPLEMENTATION_MAX_FRAMEBUFFER_SIZE <= 0xFFFF,
|
||||
"Not enough bits for render area");
|
||||
static_assert(gl::IMPLEMENTATION_MAX_RENDERBUFFER_SIZE <= 0xFFFF,
|
||||
"Not enough bits for render area");
|
||||
uint16_t renderAreaWidth, renderAreaHeight;
|
||||
SetBitField(renderAreaWidth, drawFramebufferVk->getState().getDimensions().width);
|
||||
|
||||
Reference in New Issue
Block a user