mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-26 08:30:10 +01:00
st/mesa: Move _NEW_FRAG_CLAMP to NewFragClamp driver flag.
Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4314>
This commit is contained in:
parent
eb04db7344
commit
f1538002b8
5 changed files with 21 additions and 12 deletions
|
|
@ -1121,6 +1121,8 @@ void
|
|||
_mesa_update_clamp_fragment_color(struct gl_context *ctx,
|
||||
const struct gl_framebuffer *drawFb)
|
||||
{
|
||||
GLboolean clamp;
|
||||
|
||||
/* Don't clamp if:
|
||||
* - there is no colorbuffer
|
||||
* - all colorbuffers are unsigned normalized, so clamping has no effect
|
||||
|
|
@ -1128,10 +1130,15 @@ _mesa_update_clamp_fragment_color(struct gl_context *ctx,
|
|||
*/
|
||||
if (!drawFb || !drawFb->_HasSNormOrFloatColorBuffer ||
|
||||
drawFb->_IntegerBuffers)
|
||||
ctx->Color._ClampFragmentColor = GL_FALSE;
|
||||
clamp = GL_FALSE;
|
||||
else
|
||||
ctx->Color._ClampFragmentColor =
|
||||
_mesa_get_clamp_fragment_color(ctx, drawFb);
|
||||
clamp = _mesa_get_clamp_fragment_color(ctx, drawFb);
|
||||
|
||||
if (ctx->Color._ClampFragmentColor == clamp)
|
||||
return;
|
||||
|
||||
ctx->NewDriverState |= ctx->DriverFlags.NewFragClamp;
|
||||
ctx->Color._ClampFragmentColor = clamp;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -4707,6 +4707,9 @@ struct gl_driver_flags
|
|||
/** gl_context::Transform::ClipPlanesEnabled */
|
||||
uint64_t NewClipPlaneEnable;
|
||||
|
||||
/** gl_context::Color::ClampFragmentColor */
|
||||
uint64_t NewFragClamp;
|
||||
|
||||
/** gl_context::Transform::DepthClamp */
|
||||
uint64_t NewDepthClamp;
|
||||
|
||||
|
|
|
|||
|
|
@ -239,7 +239,7 @@ st_update_rasterizer(struct st_context *st)
|
|||
/* _NEW_SCISSOR */
|
||||
raster->scissor = !!ctx->Scissor.EnableFlags;
|
||||
|
||||
/* _NEW_FRAG_CLAMP */
|
||||
/* gl_driver_flags::NewFragClamp */
|
||||
raster->clamp_fragment_color = !st->clamp_frag_color_in_shader &&
|
||||
ctx->Color._ClampFragmentColor;
|
||||
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ st_update_fp( struct st_context *st )
|
|||
key.lower_two_sided_color = st->lower_two_sided_color &&
|
||||
_mesa_vertex_program_two_side_enabled(st->ctx);
|
||||
|
||||
/* _NEW_FRAG_CLAMP */
|
||||
/* gl_driver_flags::NewFragClamp */
|
||||
key.clamp_color = st->clamp_frag_color_in_shader &&
|
||||
st->ctx->Color._ClampFragmentColor;
|
||||
|
||||
|
|
|
|||
|
|
@ -219,13 +219,6 @@ st_invalidate_state(struct gl_context *ctx)
|
|||
|
||||
if (new_state & _NEW_FOG)
|
||||
st->dirty |= ST_NEW_FS_STATE;
|
||||
|
||||
if (new_state & _NEW_FRAG_CLAMP) {
|
||||
if (st->clamp_frag_color_in_shader)
|
||||
st->dirty |= ST_NEW_FS_STATE;
|
||||
else
|
||||
st->dirty |= ST_NEW_RASTERIZER;
|
||||
}
|
||||
}
|
||||
|
||||
if (new_state & (_NEW_LIGHT |
|
||||
|
|
@ -542,6 +535,12 @@ st_init_driver_flags(struct st_context *st)
|
|||
f->NewClipControl = ST_NEW_VIEWPORT | ST_NEW_RASTERIZER;
|
||||
f->NewClipPlane = ST_NEW_CLIP_STATE;
|
||||
|
||||
if (st->clamp_frag_color_in_shader) {
|
||||
f->NewFragClamp = ST_NEW_FS_STATE;
|
||||
} else {
|
||||
f->NewFragClamp = ST_NEW_RASTERIZER;
|
||||
}
|
||||
|
||||
if (st->clamp_frag_depth_in_shader) {
|
||||
f->NewClipControl |= ST_NEW_VS_STATE | ST_NEW_GS_STATE |
|
||||
ST_NEW_TES_STATE;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue