vrend: make sure color read from a buffer is always unclamped

Tipically mesa handles CLAMP_READ_COLOR in gallium frontend, and the
default value for CLAMP_READ_COLOR as defined by the GL spec is
GL_FIXED_ONLY.
As CLAMP_READ_COLOR is really only used for reading pixel color values
from a buffer, there's no problem always returning unclamped colors and
letting the guest mesa clamp it if it wants.
On the other hand, if we clamp it on the host, as we do now, then the
guest mesa only has clamped values to work with, which needless to say,
can't be "unclamped".
Unfortunaly, this fix doesn't work for the GL ES backend, because in
GL ES the colors read with glReadPixels are always clamped.

Fixes piglit's fbo-blending-snorm tests.

Signed-off-by: Italo Nicola <italonicola@collabora.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
macos/master
Italo Nicola 3 years ago committed by Gert Wollny
parent e1e6d3cb0a
commit 0d84775435
  1. 5
      src/vrend_renderer.c

@ -5775,6 +5775,11 @@ static void vrend_hw_emit_rs(struct vrend_context *ctx)
report_core_warn(ctx, CORE_PROFILE_WARN_CLAMP); report_core_warn(ctx, CORE_PROFILE_WARN_CLAMP);
} }
/* read-color-clamping is handled in the mesa frontend */
if (!vrend_state.use_gles) {
glClampColor(GL_CLAMP_READ_COLOR_ARB, GL_FALSE);
}
if (has_feature(feat_multisample)) { if (has_feature(feat_multisample)) {
if (has_feature(feat_sample_mask)) { if (has_feature(feat_sample_mask)) {
if (state->multisample) if (state->multisample)

Loading…
Cancel
Save