mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-27 06:10:13 +01:00
mesa: Clamp some depth values in glClearBufferfi
OpenGL 3.0 spec, section 4.2.3 "Clearing the Buffers": depth and stencil are the values to clear the depth and stencil buffers to, respectively. Clamping and type conversion for fixed-point depth buffers are performed in the same fashion as for ClearDepth. Enables iris to pass the clearbuffer-depth-stencil piglit test. Cc: mesa-stable Reviewed-by: Eric Anholt <eric@anholt.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7410>
This commit is contained in:
parent
1bf539b3a2
commit
2e713313a2
1 changed files with 14 additions and 2 deletions
|
|
@ -738,8 +738,20 @@ clear_bufferfi(struct gl_context *ctx, GLenum buffer, GLint drawbuffer,
|
|||
const GLclampd clearDepthSave = ctx->Depth.Clear;
|
||||
const GLuint clearStencilSave = ctx->Stencil.Clear;
|
||||
|
||||
/* set new clear values */
|
||||
ctx->Depth.Clear = depth;
|
||||
/* set new clear values
|
||||
*
|
||||
* Page 263 (page 279 of the PDF) of the OpenGL 3.0 spec says:
|
||||
*
|
||||
* "depth and stencil are the values to clear the depth and stencil
|
||||
* buffers to, respectively. Clamping and type conversion for
|
||||
* fixed-point depth buffers are performed in the same fashion as
|
||||
* for ClearDepth."
|
||||
*/
|
||||
const struct gl_renderbuffer *rb =
|
||||
ctx->DrawBuffer->Attachment[BUFFER_DEPTH].Renderbuffer;
|
||||
const bool has_float_depth = rb &&
|
||||
_mesa_has_depth_float_channel(rb->InternalFormat);
|
||||
ctx->Depth.Clear = has_float_depth ? depth : SATURATE(depth);
|
||||
ctx->Stencil.Clear = stencil;
|
||||
|
||||
/* clear buffers */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue