[Mesa-dev] [PATCH 8/8] i965/cs: Add BRW_NEW_COMPUTE_PROGRAM state flag.

Jordan Justen jordan.l.justen at intel.com
Wed Aug 27 14:30:17 PDT 2014


From: Paul Berry <stereotype441 at gmail.com>

Also add code to brw_upload_state to set it when the compute program
changes.

Reviewed-by: Jordan Justen <jordan.l.justen at intel.com>
---
 src/mesa/drivers/dri/i965/brw_context.h      | 3 +++
 src/mesa/drivers/dri/i965/brw_state_upload.c | 6 ++++++
 2 files changed, 9 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index 875c43b..59833b1 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -182,6 +182,7 @@ enum brw_state_id {
    BRW_STATE_INTERPOLATION_MAP,
    BRW_STATE_PUSH_CONSTANT_ALLOCATION,
    BRW_STATE_NUM_SAMPLES,
+   BRW_STATE_COMPUTE_PROGRAM,
    BRW_NUM_STATE_BITS
 };
 
@@ -222,6 +223,7 @@ enum brw_state_id {
 #define BRW_NEW_INTERPOLATION_MAP       (1 << BRW_STATE_INTERPOLATION_MAP)
 #define BRW_NEW_PUSH_CONSTANT_ALLOCATION (1 << BRW_STATE_PUSH_CONSTANT_ALLOCATION)
 #define BRW_NEW_NUM_SAMPLES             (1 << BRW_STATE_NUM_SAMPLES)
+#define BRW_NEW_COMPUTE_PROGRAM         (1ULL << BRW_STATE_COMPUTE_PROGRAM)
 
 struct brw_state_flags {
    /** State update flags signalled by mesa internals */
@@ -1172,6 +1174,7 @@ struct brw_context
    const struct gl_vertex_program *vertex_program;
    const struct gl_geometry_program *geometry_program;
    const struct gl_fragment_program *fragment_program;
+   const struct gl_compute_program *compute_program;
 
    /**
     * Number of samples in ctx->DrawBuffer, updated by BRW_NEW_NUM_SAMPLES so
diff --git a/src/mesa/drivers/dri/i965/brw_state_upload.c b/src/mesa/drivers/dri/i965/brw_state_upload.c
index 9d93431..b319f03 100644
--- a/src/mesa/drivers/dri/i965/brw_state_upload.c
+++ b/src/mesa/drivers/dri/i965/brw_state_upload.c
@@ -516,6 +516,7 @@ static struct dirty_bit_map brw_bits[] = {
    DEFINE_BIT(BRW_NEW_INTERPOLATION_MAP),
    DEFINE_BIT(BRW_NEW_PUSH_CONSTANT_ALLOCATION),
    DEFINE_BIT(BRW_NEW_NUM_SAMPLES),
+   DEFINE_BIT(BRW_NEW_COMPUTE_PROGRAM),
    {0, 0, 0}
 };
 
@@ -611,6 +612,11 @@ void brw_upload_state(struct brw_context *brw, brw_pipeline pipeline)
       SET_DIRTY_BIT(brw, BRW_NEW_VERTEX_PROGRAM);
    }
 
+   if (brw->compute_program != ctx->ComputeProgram._Current) {
+      brw->compute_program = ctx->ComputeProgram._Current;
+      SET_DIRTY_BIT(brw, BRW_NEW_COMPUTE_PROGRAM);
+   }
+
    if (brw->meta_in_progress != _mesa_meta_in_progress(ctx)) {
       brw->meta_in_progress = _mesa_meta_in_progress(ctx);
       SET_DIRTY_BIT(brw, BRW_NEW_META_IN_PROGRESS);
-- 
2.1.0



More information about the mesa-dev mailing list