diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index b80db00..2a29dfe 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -1264,7 +1264,7 @@ struct brw_context int num_atoms[BRW_NUM_PIPELINES]; const struct brw_tracked_state render_atoms[76]; - const struct brw_tracked_state compute_atoms[10]; + const struct brw_tracked_state compute_atoms[11]; /* If (INTEL_DEBUG & DEBUG_BATCH) */ struct { diff --git a/src/mesa/drivers/dri/i965/brw_sampler_state.c b/src/mesa/drivers/dri/i965/brw_sampler_state.c index d181468..c20a028 100644 --- a/src/mesa/drivers/dri/i965/brw_sampler_state.c +++ b/src/mesa/drivers/dri/i965/brw_sampler_state.c @@ -582,7 +582,7 @@ brw_upload_sampler_state_table(struct brw_context *brw, batch_offset_for_sampler_state += size_in_bytes; } - if (brw->gen >= 7) { + if (brw->gen >= 7 && stage_state->stage != MESA_SHADER_COMPUTE) { /* Emit a 3DSTATE_SAMPLER_STATE_POINTERS_XS packet. */ gen7_emit_sampler_state_pointers_xs(brw, stage_state); } else { @@ -693,3 +693,23 @@ const struct brw_tracked_state brw_tes_samplers = { }, .emit = brw_upload_tes_samplers, }; + +static void +brw_upload_cs_samplers(struct brw_context *brw) +{ + /* BRW_NEW_COMPUTE_PROGRAM */ + struct gl_program *cs = (struct gl_program *) brw->compute_program; + if (!cs) + return; + + brw_upload_sampler_state_table(brw, cs, &brw->cs.base); +} + +const struct brw_tracked_state brw_cs_samplers = { + .dirty = { + .mesa = _NEW_TEXTURE, + .brw = BRW_NEW_BATCH | + BRW_NEW_COMPUTE_PROGRAM, + }, + .emit = brw_upload_cs_samplers, +}; diff --git a/src/mesa/drivers/dri/i965/brw_state.h b/src/mesa/drivers/dri/i965/brw_state.h index 7d61b7c..f44ccd6 100644 --- a/src/mesa/drivers/dri/i965/brw_state.h +++ b/src/mesa/drivers/dri/i965/brw_state.h @@ -75,6 +75,7 @@ extern const struct brw_tracked_state brw_vs_samplers; extern const struct brw_tracked_state brw_tcs_samplers; extern const struct brw_tracked_state brw_tes_samplers; extern const struct brw_tracked_state brw_gs_samplers; +extern const struct brw_tracked_state brw_cs_samplers; extern const struct brw_tracked_state brw_vs_ubo_surfaces; extern const struct brw_tracked_state brw_vs_abo_surfaces; extern const struct brw_tracked_state brw_vs_image_surfaces; diff --git a/src/mesa/drivers/dri/i965/brw_state_upload.c b/src/mesa/drivers/dri/i965/brw_state_upload.c index 876e130..ee75ca8 100644 --- a/src/mesa/drivers/dri/i965/brw_state_upload.c +++ b/src/mesa/drivers/dri/i965/brw_state_upload.c @@ -282,6 +282,7 @@ static const struct brw_tracked_state *gen7_compute_atoms[] = &brw_cs_abo_surfaces, &brw_texture_surfaces, &brw_cs_work_groups_surface, + &brw_cs_samplers, &brw_cs_state, }; @@ -396,6 +397,7 @@ static const struct brw_tracked_state *gen8_compute_atoms[] = &brw_cs_abo_surfaces, &brw_texture_surfaces, &brw_cs_work_groups_surface, + &brw_cs_samplers, &brw_cs_state, }; diff --git a/src/mesa/drivers/dri/i965/gen7_cs_state.c b/src/mesa/drivers/dri/i965/gen7_cs_state.c index a025bb9..6d6988c 100644 --- a/src/mesa/drivers/dri/i965/gen7_cs_state.c +++ b/src/mesa/drivers/dri/i965/gen7_cs_state.c @@ -196,6 +196,7 @@ const struct brw_tracked_state brw_cs_state = { .brw = BRW_NEW_BATCH | BRW_NEW_CS_PROG_DATA | BRW_NEW_PUSH_CONSTANT_ALLOCATION | + BRW_NEW_SAMPLER_STATE_TABLE | BRW_NEW_SURFACES, }, .emit = brw_upload_cs_state