[Mesa-dev] [PATCH 02/24] st/mesa: move blend color into its own state atom

Marek Olšák maraeo at gmail.com
Mon Jun 12 18:18:33 UTC 2017


From: Marek Olšák <marek.olsak at amd.com>

This is now sensible thanks to the NewBlendColor flag.
---
 src/mesa/state_tracker/st_atom_blend.c | 13 ++++++++-----
 src/mesa/state_tracker/st_atom_list.h  |  1 +
 src/mesa/state_tracker/st_context.c    |  2 +-
 3 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/src/mesa/state_tracker/st_atom_blend.c b/src/mesa/state_tracker/st_atom_blend.c
index c0876b8..bb5dd65 100644
--- a/src/mesa/state_tracker/st_atom_blend.c
+++ b/src/mesa/state_tracker/st_atom_blend.c
@@ -272,17 +272,20 @@ st_update_blend( struct st_context *st )
        * if both msaa is enabled and we have a multisample buffer.
        */
       blend->alpha_to_coverage = ctx->Multisample.SampleAlphaToCoverage;
       blend->alpha_to_one = ctx->Multisample.SampleAlphaToOne;
    }
 
    if (st->has_srgb_enable && ctx->Color.sRGBEnabled)
       blend->srgb_enable = st->state.fb_srgb_buffers;
 
    cso_set_blend(st->cso_context, blend);
+}
 
-   {
-      struct pipe_blend_color bc;
-      COPY_4FV(bc.color, ctx->Color.BlendColorUnclamped);
-      cso_set_blend_color(st->cso_context, &bc);
-   }
+void
+st_update_blend_color(struct st_context *st)
+{
+   struct pipe_blend_color bc;
+
+   COPY_4FV(bc.color, st->ctx->Color.BlendColorUnclamped);
+   cso_set_blend_color(st->cso_context, &bc);
 }
diff --git a/src/mesa/state_tracker/st_atom_list.h b/src/mesa/state_tracker/st_atom_list.h
index ed20a32..759b560 100644
--- a/src/mesa/state_tracker/st_atom_list.h
+++ b/src/mesa/state_tracker/st_atom_list.h
@@ -30,20 +30,21 @@ ST_STATE(ST_NEW_FS_SAMPLERS, st_update_fragment_samplers) /* depends on update_*
 ST_STATE(ST_NEW_VS_IMAGES, st_bind_vs_images)
 ST_STATE(ST_NEW_TCS_IMAGES, st_bind_tcs_images)
 ST_STATE(ST_NEW_TES_IMAGES, st_bind_tes_images)
 ST_STATE(ST_NEW_GS_IMAGES, st_bind_gs_images)
 ST_STATE(ST_NEW_FS_IMAGES, st_bind_fs_images)
 
 ST_STATE(ST_NEW_FB_STATE, st_update_framebuffer_state) /* depends on update_*_texture and bind_*_images */
 ST_STATE(ST_NEW_SAMPLE_MASK, st_update_sample_mask) /* depends on update_framebuffer_state */
 ST_STATE(ST_NEW_SAMPLE_SHADING, st_update_sample_shading)
 ST_STATE(ST_NEW_BLEND, st_update_blend) /* depends on update_framebuffer_state */
+ST_STATE(ST_NEW_BLEND_COLOR, st_update_blend_color)
 
 ST_STATE(ST_NEW_VS_CONSTANTS, st_update_vs_constants)
 ST_STATE(ST_NEW_TCS_CONSTANTS, st_update_tcs_constants)
 ST_STATE(ST_NEW_TES_CONSTANTS, st_update_tes_constants)
 ST_STATE(ST_NEW_GS_CONSTANTS, st_update_gs_constants)
 ST_STATE(ST_NEW_FS_CONSTANTS, st_update_fs_constants)
 
 ST_STATE(ST_NEW_VS_UBOS, st_bind_vs_ubos)
 ST_STATE(ST_NEW_TCS_UBOS, st_bind_tcs_ubos)
 ST_STATE(ST_NEW_TES_UBOS, st_bind_tes_ubos)
diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c
index 26f80b6..14af339 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -500,21 +500,21 @@ static void st_init_driver_flags(struct st_context *st)
    if (st->has_srgb_enable)
       f->NewFramebufferSRGB = ST_NEW_BLEND;
    else
       f->NewFramebufferSRGB = ST_NEW_FB_STATE;
 
    f->NewWindowRectangles = ST_NEW_WINDOW_RECTANGLES;
    f->NewScissorRect = ST_NEW_SCISSOR;
    f->NewScissorTest = ST_NEW_SCISSOR | ST_NEW_RASTERIZER;
    f->NewAlphaTest = ST_NEW_DSA;
    f->NewBlend = ST_NEW_BLEND;
-   f->NewBlendColor = ST_NEW_BLEND; /* TODO: add an atom for blend color */
+   f->NewBlendColor = ST_NEW_BLEND_COLOR;
    f->NewColorMask = ST_NEW_BLEND;
    f->NewDepth = ST_NEW_DSA;
    f->NewLogicOp = ST_NEW_BLEND;
    f->NewStencil = ST_NEW_DSA;
    f->NewMultisampleEnable = ST_NEW_BLEND | ST_NEW_RASTERIZER |
                              ST_NEW_SAMPLE_MASK | ST_NEW_SAMPLE_SHADING;
    f->NewSampleAlphaToXEnable = ST_NEW_BLEND;
    f->NewSampleMask = ST_NEW_SAMPLE_MASK;
    f->NewSampleShading = ST_NEW_SAMPLE_SHADING;
 
-- 
2.7.4



More information about the mesa-dev mailing list