Kenneth Graunke <[email protected]> writes: > Traditionally, we've implemented fragment color clamping by emitting > "mov.sat" in the fragment shader's final color write code, clamping > the output to [0, 1] prior to blending. (When clamping is off, we > use a regular "mov".) This means we have to recompile based on the > GL_CLAMP_FRAGMENT_COLOR state, and because GL_FIXED_ONLY is an option, > we need to consider the render target format.
> ---
> src/mesa/drivers/dri/i965/brw_fs.cpp | 2 --
> src/mesa/drivers/dri/i965/brw_wm.c | 3 ++-
> 2 files changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp
> b/src/mesa/drivers/dri/i965/brw_fs.cpp
> index 1b32d63..bd44952 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
> @@ -3616,8 +3616,6 @@ brw_fs_precompile(struct gl_context *ctx, struct
> gl_shader_program *prog)
> BRW_FS_VARYING_INPUT_MASK) > 16)
> key.input_slots_valid = fp->Base.InputsRead | VARYING_BIT_POS;
>
> - key.clamp_fragment_color = ctx->API == API_OPENGL_COMPAT;
> -
> unsigned sampler_count = _mesa_fls(fp->Base.SamplersUsed);
> for (unsigned i = 0; i < sampler_count; i++) {
> if (fp->Base.ShadowSamplers & (1 << i)) {
> diff --git a/src/mesa/drivers/dri/i965/brw_wm.c
> b/src/mesa/drivers/dri/i965/brw_wm.c
> index 0d0d6ec..baf001f 100644
> --- a/src/mesa/drivers/dri/i965/brw_wm.c
> +++ b/src/mesa/drivers/dri/i965/brw_wm.c
> @@ -488,7 +488,8 @@ static void brw_wm_populate_key( struct brw_context *brw,
> key->flat_shade = (ctx->Light.ShadeModel == GL_FLAT);
>
> /* _NEW_FRAG_CLAMP | _NEW_BUFFERS */
> - key->clamp_fragment_color = ctx->Color._ClampFragmentColor;
> + key->clamp_fragment_color = ctx->Color._ClampFragmentColor &&
> + ctx->DrawBuffer->_HasSNormOrFloatColorBuffer;
>
> /* _NEW_TEXTURE */
> brw_populate_sampler_prog_key_data(ctx, prog, brw->wm.base.sampler_count,
Given Roland's note about how _ClampFragmentColor is set, I think we
only need the brw_fs.cpp hunk and not the brw_wm.c hunk. For just the
one hunk,
Reviewed-by: Eric Anholt <[email protected]>
pgpegMxVxTbIN.pgp
Description: PGP signature
_______________________________________________ mesa-dev mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/mesa-dev
