From 5d2202fcb6a8f0ea9bb0adcd798fb8438b14af60 Mon Sep 17 00:00:00 2001 From: Italo Nicola Date: Mon, 27 Sep 2021 08:14:57 -0300 Subject: [PATCH] vrend: always set CLAMP_READ_COLOR to false in do_readpixels Some paths don't emit rasterizer state or framebuffer state before calling do_readpixels, and because of that the clamping is not done properly. Fixes 0d8477543578bc5c561e5972fce1bcce596db9b4 Fixes several piglit snorm tests. Signed-off-by: Italo Nicola Reviewed-by: Gert Wollny --- src/vrend_renderer.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c index d9f4b7b..02dae5a 100644 --- a/src/vrend_renderer.c +++ b/src/vrend_renderer.c @@ -5805,11 +5805,6 @@ static void vrend_hw_emit_rs(struct vrend_context *ctx) 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_sample_mask)) { if (state->multisample) @@ -8073,6 +8068,11 @@ static void do_readpixels(struct vrend_resource *res, } } + /* 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_arb_robustness)) glReadnPixelsARB(x, y, width, height, format, type, bufSize, data); else if (has_feature(feat_gles_khr_robustness))