mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-01 03:48:06 +02:00
main: don't always clamp pixels read from snorm buffers
From the OpenGL 4.6 spec, section 18.2.8: "For a signed normalized fixed-point color buffer, each component is clamped to [0,1] if read color clamping is enabled, or if type represents un- signed integer components; otherwise type represents signed integer components, and each component is clamped to [−1,1]." Signed-off-by: Italo Nicola <italonicola@collabora.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12749>
This commit is contained in:
parent
dda0bb0b32
commit
5d02cbfcb5
1 changed files with 7 additions and 0 deletions
|
|
@ -120,6 +120,13 @@ _mesa_get_readpixels_transfer_ops(const struct gl_context *ctx,
|
|||
type != GL_UNSIGNED_INT_10F_11F_11F_REV)) {
|
||||
transferOps |= IMAGE_CLAMP_BIT;
|
||||
}
|
||||
|
||||
/* For SNORM formats we only clamp if `type` is signed and clamp is `true` */
|
||||
if (!_mesa_get_clamp_read_color(ctx, ctx->ReadBuffer) &&
|
||||
_mesa_get_format_datatype(texFormat) == GL_SIGNED_NORMALIZED &&
|
||||
(type == GL_BYTE || type == GL_SHORT || type == GL_INT)) {
|
||||
transferOps &= ~IMAGE_CLAMP_BIT;
|
||||
}
|
||||
}
|
||||
|
||||
/* If the format is unsigned normalized, we can ignore clamping
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue