Generate an error when trying to clear an incomplete Framebuffer
Calling ClearBuffer* on an incomplete framebuffer was crashing
because a depth clear assumes 4 bytes per pixel and the type of
an incomplete framebuffer could be anything, which is potentially
smaller than 4 bytes, so memory was written out of bounds.
ClearBuffer* now also checks for completeness, just like clear
already does.
From the OpenGL ES 3.0 spec, section 4.4.4.4
"Effects of Framebuffer Completeness on Framebuffer Operations
Attempting to render to or read from a framebuffer which is not
framebuffer complete will generate an INVALID_FRAMEBUFFER_OPERATION
error. This means that rendering commands (see section 2.6) ...
will generate the error INVALID_FRAMEBUFFER_OPERATION if called
while the framebuffer is not framebuffer complete"
And from the OpenGL ES 3.0 spec, section 2.6 Rendering Commands
"GL commands performing rendering into a framebuffer are called
rendering commands, and include the drawing commands Draw* ...,
as well as these additional commands:
• BlitFramebuffer
• Clear
• ClearBuffer*"
Bug b/117048995
Change-Id: I01fd2ad2829b4c9e0aac817620f65c789b11356e
Reviewed-on: https://swiftshader-review.googlesource.com/c/22048Tested-by:
Alexis Hétu <sugoi@google.com>
Reviewed-by:
Nicolas Capens <nicolascapens@google.com>
Showing
Please
register
or
sign in
to comment