summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2017-09-24 19:59:41 -0700
committerKenneth Graunke <[email protected]>2017-09-26 15:29:16 -0700
commit17eb2afada7b310e71abd3f4b9026c5178ba91cb (patch)
tree74773078b996040495e698a625c916fd7a3ac628 /src/mesa
parentb99cf705c87eeea8337ac0045937e4da579af358 (diff)
i965: Convert brw->*_program into a brw->programs[i] array.
This makes it easier to loop over programs. Reviewed-by: Alejandro PiƱeiro <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/i965/brw_binding_tables.c6
-rw-r--r--src/mesa/drivers/dri/i965/brw_context.h7
-rw-r--r--src/mesa/drivers/dri/i965/brw_cs.c6
-rw-r--r--src/mesa/drivers/dri/i965/brw_curbe.c12
-rw-r--r--src/mesa/drivers/dri/i965/brw_gs.c6
-rw-r--r--src/mesa/drivers/dri/i965/brw_gs_surface_state.c7
-rw-r--r--src/mesa/drivers/dri/i965/brw_program.c31
-rw-r--r--src/mesa/drivers/dri/i965/brw_sf.c2
-rw-r--r--src/mesa/drivers/dri/i965/brw_state_upload.c36
-rw-r--r--src/mesa/drivers/dri/i965/brw_tcs.c11
-rw-r--r--src/mesa/drivers/dri/i965/brw_tcs_surface_state.c7
-rw-r--r--src/mesa/drivers/dri/i965/brw_tes.c9
-rw-r--r--src/mesa/drivers/dri/i965/brw_tes_surface_state.c7
-rw-r--r--src/mesa/drivers/dri/i965/brw_vs.c7
-rw-r--r--src/mesa/drivers/dri/i965/brw_vs_surface_state.c7
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm.c7
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm_surface_state.c24
-rw-r--r--src/mesa/drivers/dri/i965/gen6_sol.c11
-rw-r--r--src/mesa/drivers/dri/i965/gen6_urb.c5
-rw-r--r--src/mesa/drivers/dri/i965/gen7_cs_state.c6
-rw-r--r--src/mesa/drivers/dri/i965/gen7_urb.c4
-rw-r--r--src/mesa/drivers/dri/i965/genX_state_upload.c55
22 files changed, 147 insertions, 126 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_binding_tables.c b/src/mesa/drivers/dri/i965/brw_binding_tables.c
index 4bbaa5d0594..73f5e56010b 100644
--- a/src/mesa/drivers/dri/i965/brw_binding_tables.c
+++ b/src/mesa/drivers/dri/i965/brw_binding_tables.c
@@ -153,7 +153,7 @@ static void
brw_tcs_upload_binding_table(struct brw_context *brw)
{
/* Skip if the tessellation stages are disabled. */
- if (brw->tess_eval_program == NULL)
+ if (brw->programs[MESA_SHADER_TESS_EVAL] == NULL)
return;
/* BRW_NEW_TCS_PROG_DATA */
@@ -182,7 +182,7 @@ static void
brw_tes_upload_binding_table(struct brw_context *brw)
{
/* If there's no TES, skip changing anything. */
- if (brw->tess_eval_program == NULL)
+ if (brw->programs[MESA_SHADER_TESS_EVAL] == NULL)
return;
/* BRW_NEW_TES_PROG_DATA */
@@ -210,7 +210,7 @@ static void
brw_gs_upload_binding_table(struct brw_context *brw)
{
/* If there's no GS, skip changing anything. */
- if (brw->geometry_program == NULL)
+ if (brw->programs[MESA_SHADER_GEOMETRY] == NULL)
return;
/* BRW_NEW_GS_PROG_DATA */
diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index 6de5c2d0974..bc3d3e398be 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -875,12 +875,7 @@ struct brw_context
/* Active vertex program:
*/
- const struct gl_program *vertex_program;
- const struct gl_program *geometry_program;
- const struct gl_program *tess_ctrl_program;
- const struct gl_program *tess_eval_program;
- const struct gl_program *fragment_program;
- const struct gl_program *compute_program;
+ struct gl_program *programs[MESA_SHADER_STAGES];
/**
* Number of samples in ctx->DrawBuffer, updated by BRW_NEW_NUM_SAMPLES so
diff --git a/src/mesa/drivers/dri/i965/brw_cs.c b/src/mesa/drivers/dri/i965/brw_cs.c
index cf72889b411..bc09abd912c 100644
--- a/src/mesa/drivers/dri/i965/brw_cs.c
+++ b/src/mesa/drivers/dri/i965/brw_cs.c
@@ -177,7 +177,8 @@ brw_cs_populate_key(struct brw_context *brw, struct brw_cs_prog_key *key)
{
struct gl_context *ctx = &brw->ctx;
/* BRW_NEW_COMPUTE_PROGRAM */
- const struct brw_program *cp = (struct brw_program *) brw->compute_program;
+ const struct brw_program *cp =
+ (struct brw_program *) brw->programs[MESA_SHADER_COMPUTE];
const struct gl_program *prog = (struct gl_program *) cp;
memset(key, 0, sizeof(*key));
@@ -195,7 +196,8 @@ brw_upload_cs_prog(struct brw_context *brw)
{
struct gl_context *ctx = &brw->ctx;
struct brw_cs_prog_key key;
- struct brw_program *cp = (struct brw_program *) brw->compute_program;
+ struct brw_program *cp =
+ (struct brw_program *) brw->programs[MESA_SHADER_COMPUTE];
if (!cp)
return;
diff --git a/src/mesa/drivers/dri/i965/brw_curbe.c b/src/mesa/drivers/dri/i965/brw_curbe.c
index 7adf911dea0..07e3c42b152 100644
--- a/src/mesa/drivers/dri/i965/brw_curbe.c
+++ b/src/mesa/drivers/dri/i965/brw_curbe.c
@@ -204,6 +204,12 @@ brw_upload_constant_buffer(struct brw_context *brw)
GLuint i;
gl_clip_plane *clip_planes;
+ /* BRW_NEW_FRAGMENT_PROGRAM */
+ struct gl_program *fp = brw->programs[MESA_SHADER_FRAGMENT];
+
+ /* BRW_NEW_VERTEX_PROGRAM */
+ struct gl_program *vp = brw->programs[MESA_SHADER_VERTEX];
+
if (sz == 0) {
goto emit;
}
@@ -215,7 +221,7 @@ brw_upload_constant_buffer(struct brw_context *brw)
/* fragment shader constants */
if (brw->curbe.wm_size) {
- _mesa_load_state_parameters(ctx, brw->fragment_program->Parameters);
+ _mesa_load_state_parameters(ctx, fp->Parameters);
/* BRW_NEW_PUSH_CONSTANT_ALLOCATION */
GLuint offset = brw->curbe.wm_start * 16;
@@ -257,7 +263,7 @@ brw_upload_constant_buffer(struct brw_context *brw)
/* vertex shader constants */
if (brw->curbe.vs_size) {
- _mesa_load_state_parameters(ctx, brw->vertex_program->Parameters);
+ _mesa_load_state_parameters(ctx, vp->Parameters);
GLuint offset = brw->curbe.vs_start * 16;
@@ -325,7 +331,7 @@ emit:
* BRW_NEW_FRAGMENT_PROGRAM
*/
if (devinfo->gen == 4 && !devinfo->is_g4x &&
- (brw->fragment_program->info.inputs_read & (1 << VARYING_SLOT_POS))) {
+ (fp->info.inputs_read & (1 << VARYING_SLOT_POS))) {
BEGIN_BATCH(2);
OUT_BATCH(_3DSTATE_GLOBAL_DEPTH_OFFSET_CLAMP << 16 | (2 - 2));
OUT_BATCH(0);
diff --git a/src/mesa/drivers/dri/i965/brw_gs.c b/src/mesa/drivers/dri/i965/brw_gs.c
index 01e85daca55..e7062ee7899 100644
--- a/src/mesa/drivers/dri/i965/brw_gs.c
+++ b/src/mesa/drivers/dri/i965/brw_gs.c
@@ -185,7 +185,8 @@ brw_gs_populate_key(struct brw_context *brw,
struct brw_gs_prog_key *key)
{
struct gl_context *ctx = &brw->ctx;
- struct brw_program *gp = (struct brw_program *) brw->geometry_program;
+ struct brw_program *gp =
+ (struct brw_program *) brw->programs[MESA_SHADER_GEOMETRY];
memset(key, 0, sizeof(*key));
@@ -201,7 +202,8 @@ brw_upload_gs_prog(struct brw_context *brw)
struct brw_stage_state *stage_state = &brw->gs.base;
struct brw_gs_prog_key key;
/* BRW_NEW_GEOMETRY_PROGRAM */
- struct brw_program *gp = (struct brw_program *) brw->geometry_program;
+ struct brw_program *gp =
+ (struct brw_program *) brw->programs[MESA_SHADER_GEOMETRY];
if (!brw_gs_state_dirty(brw))
return;
diff --git a/src/mesa/drivers/dri/i965/brw_gs_surface_state.c b/src/mesa/drivers/dri/i965/brw_gs_surface_state.c
index f79ce53d9a5..570f3fb4dd2 100644
--- a/src/mesa/drivers/dri/i965/brw_gs_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_gs_surface_state.c
@@ -41,7 +41,8 @@ brw_upload_gs_pull_constants(struct brw_context *brw)
struct brw_stage_state *stage_state = &brw->gs.base;
/* BRW_NEW_GEOMETRY_PROGRAM */
- struct brw_program *gp = (struct brw_program *) brw->geometry_program;
+ struct brw_program *gp =
+ (struct brw_program *) brw->programs[MESA_SHADER_GEOMETRY];
if (!gp)
return;
@@ -94,7 +95,7 @@ static void
brw_upload_gs_abo_surfaces(struct brw_context *brw)
{
/* _NEW_PROGRAM */
- const struct gl_program *gp = brw->geometry_program;
+ const struct gl_program *gp = brw->programs[MESA_SHADER_GEOMETRY];
if (gp) {
/* BRW_NEW_GS_PROG_DATA */
@@ -116,7 +117,7 @@ static void
brw_upload_gs_image_surfaces(struct brw_context *brw)
{
/* BRW_NEW_GEOMETRY_PROGRAM */
- const struct gl_program *gp = brw->geometry_program;
+ const struct gl_program *gp = brw->programs[MESA_SHADER_GEOMETRY];
if (gp) {
/* BRW_NEW_GS_PROG_DATA, BRW_NEW_IMAGE_UNITS, _NEW_TEXTURE */
diff --git a/src/mesa/drivers/dri/i965/brw_program.c b/src/mesa/drivers/dri/i965/brw_program.c
index 094bba43db1..9ec2917c90e 100644
--- a/src/mesa/drivers/dri/i965/brw_program.c
+++ b/src/mesa/drivers/dri/i965/brw_program.c
@@ -151,15 +151,15 @@ static void brwDeleteProgram( struct gl_context *ctx,
/* Beware! prog's refcount has reached zero, and it's about to be freed.
*
- * In brw_upload_pipeline_state(), we compare brw->foo_program to
+ * In brw_upload_pipeline_state(), we compare brw->programs[i] to
* ctx->FooProgram._Current, and flag BRW_NEW_FOO_PROGRAM if the
* pointer has changed.
*
- * We cannot leave brw->foo_program as a dangling pointer to the dead
+ * We cannot leave brw->programs[i] as a dangling pointer to the dead
* program. malloc() may allocate the same memory for a new gl_program,
* causing us to see matching pointers...but totally different programs.
*
- * We cannot set brw->foo_program to NULL, either. If we've deleted the
+ * We cannot set brw->programs[i] to NULL, either. If we've deleted the
* active program, Mesa may set ctx->FooProgram._Current to NULL. That
* would cause us to see matching pointers (NULL == NULL), and fail to
* detect that a program has changed since our last draw.
@@ -172,23 +172,10 @@ static void brwDeleteProgram( struct gl_context *ctx,
*/
static const struct gl_program deleted_program;
- if (brw->vertex_program == prog)
- brw->vertex_program = &deleted_program;
-
- if (brw->tess_ctrl_program == prog)
- brw->tess_ctrl_program = &deleted_program;
-
- if (brw->tess_eval_program == prog)
- brw->tess_eval_program = &deleted_program;
-
- if (brw->geometry_program == prog)
- brw->geometry_program = &deleted_program;
-
- if (brw->fragment_program == prog)
- brw->fragment_program = &deleted_program;
-
- if (brw->compute_program == prog)
- brw->compute_program = &deleted_program;
+ for (int i = 0; i < MESA_SHADER_STAGES; i++) {
+ if (brw->programs[i] == prog)
+ brw->programs[i] = (struct gl_program *) &deleted_program;
+ }
_mesa_delete_program( ctx, prog );
}
@@ -208,7 +195,7 @@ brwProgramStringNotify(struct gl_context *ctx,
case GL_FRAGMENT_PROGRAM_ARB: {
struct brw_program *newFP = brw_program(prog);
const struct brw_program *curFP =
- brw_program_const(brw->fragment_program);
+ brw_program_const(brw->programs[MESA_SHADER_FRAGMENT]);
if (newFP == curFP)
brw->ctx.NewDriverState |= BRW_NEW_FRAGMENT_PROGRAM;
@@ -224,7 +211,7 @@ brwProgramStringNotify(struct gl_context *ctx,
case GL_VERTEX_PROGRAM_ARB: {
struct brw_program *newVP = brw_program(prog);
const struct brw_program *curVP =
- brw_program_const(brw->vertex_program);
+ brw_program_const(brw->programs[MESA_SHADER_VERTEX]);
if (newVP == curVP)
brw->ctx.NewDriverState |= BRW_NEW_VERTEX_PROGRAM;
diff --git a/src/mesa/drivers/dri/i965/brw_sf.c b/src/mesa/drivers/dri/i965/brw_sf.c
index 1d5023258a7..37ce999dc07 100644
--- a/src/mesa/drivers/dri/i965/brw_sf.c
+++ b/src/mesa/drivers/dri/i965/brw_sf.c
@@ -128,7 +128,7 @@ brw_upload_sf_prog(struct brw_context *brw)
if (key.do_point_sprite) {
key.point_sprite_coord_replace = ctx->Point.CoordReplace & 0xff;
}
- if (brw->fragment_program->info.inputs_read &
+ if (brw->programs[MESA_SHADER_FRAGMENT]->info.inputs_read &
BITFIELD64_BIT(VARYING_SLOT_PNTC)) {
key.do_point_coord = 1;
}
diff --git a/src/mesa/drivers/dri/i965/brw_state_upload.c b/src/mesa/drivers/dri/i965/brw_state_upload.c
index 28a31482821..16f44d03bbe 100644
--- a/src/mesa/drivers/dri/i965/brw_state_upload.c
+++ b/src/mesa/drivers/dri/i965/brw_state_upload.c
@@ -380,7 +380,7 @@ brw_print_dirty_count(struct dirty_bit_map *bit_map)
static inline void
brw_upload_tess_programs(struct brw_context *brw)
{
- if (brw->tess_eval_program) {
+ if (brw->programs[MESA_SHADER_TESS_EVAL]) {
brw_upload_tcs_prog(brw);
brw_upload_tes_prog(brw);
} else {
@@ -400,7 +400,7 @@ brw_upload_programs(struct brw_context *brw,
brw_upload_vs_prog(brw);
brw_upload_tess_programs(brw);
- if (brw->geometry_program) {
+ if (brw->programs[MESA_SHADER_GEOMETRY]) {
brw_upload_gs_prog(brw);
} else {
brw->gs.base.prog_data = NULL;
@@ -414,9 +414,9 @@ brw_upload_programs(struct brw_context *brw,
GLbitfield64 old_slots = brw->vue_map_geom_out.slots_valid;
bool old_separate = brw->vue_map_geom_out.separate;
struct brw_vue_prog_data *vue_prog_data;
- if (brw->geometry_program)
+ if (brw->programs[MESA_SHADER_GEOMETRY])
vue_prog_data = brw_vue_prog_data(brw->gs.base.prog_data);
- else if (brw->tess_eval_program)
+ else if (brw->programs[MESA_SHADER_TESS_EVAL])
vue_prog_data = brw_vue_prog_data(brw->tes.base.prog_data);
else
vue_prog_data = brw_vue_prog_data(brw->vs.base.prog_data);
@@ -487,34 +487,38 @@ brw_upload_pipeline_state(struct brw_context *brw,
}
if (pipeline == BRW_RENDER_PIPELINE) {
- if (brw->fragment_program != ctx->FragmentProgram._Current) {
- brw->fragment_program = ctx->FragmentProgram._Current;
+ if (brw->programs[MESA_SHADER_FRAGMENT] !=
+ ctx->FragmentProgram._Current) {
+ brw->programs[MESA_SHADER_FRAGMENT] = ctx->FragmentProgram._Current;
brw->ctx.NewDriverState |= BRW_NEW_FRAGMENT_PROGRAM;
}
- if (brw->tess_eval_program != ctx->TessEvalProgram._Current) {
- brw->tess_eval_program = ctx->TessEvalProgram._Current;
+ if (brw->programs[MESA_SHADER_TESS_EVAL] !=
+ ctx->TessEvalProgram._Current) {
+ brw->programs[MESA_SHADER_TESS_EVAL] = ctx->TessEvalProgram._Current;
brw->ctx.NewDriverState |= BRW_NEW_TESS_PROGRAMS;
}
- if (brw->tess_ctrl_program != ctx->TessCtrlProgram._Current) {
- brw->tess_ctrl_program = ctx->TessCtrlProgram._Current;
+ if (brw->programs[MESA_SHADER_TESS_CTRL] !=
+ ctx->TessCtrlProgram._Current) {
+ brw->programs[MESA_SHADER_TESS_CTRL] = ctx->TessCtrlProgram._Current;
brw->ctx.NewDriverState |= BRW_NEW_TESS_PROGRAMS;
}
- if (brw->geometry_program != ctx->GeometryProgram._Current) {
- brw->geometry_program = ctx->GeometryProgram._Current;
+ if (brw->programs[MESA_SHADER_GEOMETRY] !=
+ ctx->GeometryProgram._Current) {
+ brw->programs[MESA_SHADER_GEOMETRY] = ctx->GeometryProgram._Current;
brw->ctx.NewDriverState |= BRW_NEW_GEOMETRY_PROGRAM;
}
- if (brw->vertex_program != ctx->VertexProgram._Current) {
- brw->vertex_program = ctx->VertexProgram._Current;
+ if (brw->programs[MESA_SHADER_VERTEX] != ctx->VertexProgram._Current) {
+ brw->programs[MESA_SHADER_VERTEX] = ctx->VertexProgram._Current;
brw->ctx.NewDriverState |= BRW_NEW_VERTEX_PROGRAM;
}
}
- if (brw->compute_program != ctx->ComputeProgram._Current) {
- brw->compute_program = ctx->ComputeProgram._Current;
+ if (brw->programs[MESA_SHADER_COMPUTE] != ctx->ComputeProgram._Current) {
+ brw->programs[MESA_SHADER_COMPUTE] = ctx->ComputeProgram._Current;
brw->ctx.NewDriverState |= BRW_NEW_COMPUTE_PROGRAM;
}
diff --git a/src/mesa/drivers/dri/i965/brw_tcs.c b/src/mesa/drivers/dri/i965/brw_tcs.c
index 109e3fdbf55..474787b0ea6 100644
--- a/src/mesa/drivers/dri/i965/brw_tcs.c
+++ b/src/mesa/drivers/dri/i965/brw_tcs.c
@@ -295,8 +295,10 @@ brw_tcs_populate_key(struct brw_context *brw,
struct brw_tcs_prog_key *key)
{
const struct gen_device_info *devinfo = &brw->screen->devinfo;
- struct brw_program *tcp = (struct brw_program *) brw->tess_ctrl_program;
- struct brw_program *tep = (struct brw_program *) brw->tess_eval_program;
+ struct brw_program *tcp =
+ (struct brw_program *) brw->programs[MESA_SHADER_TESS_CTRL];
+ struct brw_program *tep =
+ (struct brw_program *) brw->programs[MESA_SHADER_TESS_EVAL];
struct gl_program *tes_prog = &tep->program;
uint64_t per_vertex_slots = tes_prog->info.inputs_read;
@@ -337,9 +339,10 @@ brw_upload_tcs_prog(struct brw_context *brw)
struct brw_stage_state *stage_state = &brw->tcs.base;
struct brw_tcs_prog_key key;
/* BRW_NEW_TESS_PROGRAMS */
- struct brw_program *tcp = (struct brw_program *) brw->tess_ctrl_program;
+ struct brw_program *tcp =
+ (struct brw_program *) brw->programs[MESA_SHADER_TESS_CTRL];
MAYBE_UNUSED struct brw_program *tep =
- (struct brw_program *) brw->tess_eval_program;
+ (struct brw_program *) brw->programs[MESA_SHADER_TESS_EVAL];
assert(tep);
if (!brw_state_dirty(brw,
diff --git a/src/mesa/drivers/dri/i965/brw_tcs_surface_state.c b/src/mesa/drivers/dri/i965/brw_tcs_surface_state.c
index df618e0a2aa..f4f9abc0620 100644
--- a/src/mesa/drivers/dri/i965/brw_tcs_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_tcs_surface_state.c
@@ -41,7 +41,8 @@ brw_upload_tcs_pull_constants(struct brw_context *brw)
struct brw_stage_state *stage_state = &brw->tcs.base;
/* BRW_NEW_TESS_PROGRAMS */
- struct brw_program *tcp = (struct brw_program *) brw->tess_ctrl_program;
+ struct brw_program *tcp =
+ (struct brw_program *) brw->programs[MESA_SHADER_TESS_CTRL];
if (!tcp)
return;
@@ -94,7 +95,7 @@ static void
brw_upload_tcs_abo_surfaces(struct brw_context *brw)
{
/* _NEW_PROGRAM */
- const struct gl_program *tcp = brw->tess_ctrl_program;
+ const struct gl_program *tcp = brw->programs[MESA_SHADER_TESS_CTRL];
if (tcp) {
/* BRW_NEW_TCS_PROG_DATA */
@@ -117,7 +118,7 @@ static void
brw_upload_tcs_image_surfaces(struct brw_context *brw)
{
/* BRW_NEW_TESS_PROGRAMS */
- const struct gl_program *tcp = brw->tess_ctrl_program;
+ const struct gl_program *tcp = brw->programs[MESA_SHADER_TESS_CTRL];
if (tcp) {
/* BRW_NEW_TCS_PROG_DATA, BRW_NEW_IMAGE_UNITS */
diff --git a/src/mesa/drivers/dri/i965/brw_tes.c b/src/mesa/drivers/dri/i965/brw_tes.c
index 20ce1f4c15b..6564fefc06e 100644
--- a/src/mesa/drivers/dri/i965/brw_tes.c
+++ b/src/mesa/drivers/dri/i965/brw_tes.c
@@ -165,8 +165,10 @@ void
brw_tes_populate_key(struct brw_context *brw,
struct brw_tes_prog_key *key)
{
- struct brw_program *tcp = (struct brw_program *) brw->tess_ctrl_program;
- struct brw_program *tep = (struct brw_program *) brw->tess_eval_program;
+ struct brw_program *tcp =
+ (struct brw_program *) brw->programs[MESA_SHADER_TESS_CTRL];
+ struct brw_program *tep =
+ (struct brw_program *) brw->programs[MESA_SHADER_TESS_EVAL];
struct gl_program *prog = &tep->program;
uint64_t per_vertex_slots = prog->info.inputs_read;
@@ -200,7 +202,8 @@ brw_upload_tes_prog(struct brw_context *brw)
struct brw_stage_state *stage_state = &brw->tes.base;
struct brw_tes_prog_key key;
/* BRW_NEW_TESS_PROGRAMS */
- struct brw_program *tep = (struct brw_program *) brw->tess_eval_program;
+ struct brw_program *tep =
+ (struct brw_program *) brw->programs[MESA_SHADER_TESS_EVAL];
if (!brw_state_dirty(brw,
_NEW_TEXTURE,
diff --git a/src/mesa/drivers/dri/i965/brw_tes_surface_state.c b/src/mesa/drivers/dri/i965/brw_tes_surface_state.c
index a6204ced28b..85b285d8688 100644
--- a/src/mesa/drivers/dri/i965/brw_tes_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_tes_surface_state.c
@@ -41,7 +41,8 @@ brw_upload_tes_pull_constants(struct brw_context *brw)
struct brw_stage_state *stage_state = &brw->tes.base;
/* BRW_NEW_TESS_PROGRAMS */
- struct brw_program *dp = (struct brw_program *) brw->tess_eval_program;
+ struct brw_program *dp =
+ (struct brw_program *) brw->programs[MESA_SHADER_TESS_EVAL];
if (!dp)
return;
@@ -94,7 +95,7 @@ static void
brw_upload_tes_abo_surfaces(struct brw_context *brw)
{
/* _NEW_PROGRAM */
- const struct gl_program *tep = brw->tess_eval_program;
+ const struct gl_program *tep = brw->programs[MESA_SHADER_TESS_EVAL];
if (tep) {
/* BRW_NEW_TES_PROG_DATA */
@@ -117,7 +118,7 @@ static void
brw_upload_tes_image_surfaces(struct brw_context *brw)
{
/* BRW_NEW_TESS_PROGRAMS */
- const struct gl_program *tep = brw->tess_eval_program;
+ const struct gl_program *tep = brw->programs[MESA_SHADER_TESS_EVAL];
if (tep) {
/* BRW_NEW_TES_PROG_DATA, BRW_NEW_IMAGE_UNITS */
diff --git a/src/mesa/drivers/dri/i965/brw_vs.c b/src/mesa/drivers/dri/i965/brw_vs.c
index 1add877c85e..756e13db31f 100644
--- a/src/mesa/drivers/dri/i965/brw_vs.c
+++ b/src/mesa/drivers/dri/i965/brw_vs.c
@@ -305,8 +305,8 @@ brw_vs_populate_key(struct brw_context *brw,
{
struct gl_context *ctx = &brw->ctx;
/* BRW_NEW_VERTEX_PROGRAM */
- struct brw_program *vp = (struct brw_program *)brw->vertex_program;
- struct gl_program *prog = (struct gl_program *) brw->vertex_program;
+ struct gl_program *prog = brw->programs[MESA_SHADER_VERTEX];
+ struct brw_program *vp = (struct brw_program *) prog;
const struct gen_device_info *devinfo = &brw->screen->devinfo;
memset(key, 0, sizeof(*key));
@@ -356,7 +356,8 @@ brw_upload_vs_prog(struct brw_context *brw)
{
struct brw_vs_prog_key key;
/* BRW_NEW_VERTEX_PROGRAM */
- struct brw_program *vp = (struct brw_program *)brw->vertex_program;
+ struct brw_program *vp =
+ (struct brw_program *) brw->programs[MESA_SHADER_VERTEX];
if (!brw_vs_state_dirty(brw))
return;
diff --git a/src/mesa/drivers/dri/i965/brw_vs_surface_state.c b/src/mesa/drivers/dri/i965/brw_vs_surface_state.c
index 00b5077894c..23f841ecc31 100644
--- a/src/mesa/drivers/dri/i965/brw_vs_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_vs_surface_state.c
@@ -113,7 +113,8 @@ brw_upload_vs_pull_constants(struct brw_context *brw)
struct brw_stage_state *stage_state = &brw->vs.base;
/* BRW_NEW_VERTEX_PROGRAM */
- struct brw_program *vp = (struct brw_program *) brw->vertex_program;
+ struct brw_program *vp =
+ (struct brw_program *) brw->programs[MESA_SHADER_VERTEX];
/* BRW_NEW_VS_PROG_DATA */
const struct brw_stage_prog_data *prog_data = brw->vs.base.prog_data;
@@ -159,7 +160,7 @@ static void
brw_upload_vs_abo_surfaces(struct brw_context *brw)
{
/* _NEW_PROGRAM */
- const struct gl_program *vp = brw->vertex_program;
+ const struct gl_program *vp = brw->programs[MESA_SHADER_VERTEX];
if (vp) {
/* BRW_NEW_VS_PROG_DATA */
@@ -181,7 +182,7 @@ static void
brw_upload_vs_image_surfaces(struct brw_context *brw)
{
/* BRW_NEW_VERTEX_PROGRAM */
- const struct gl_program *vp = brw->vertex_program;
+ const struct gl_program *vp = brw->programs[MESA_SHADER_VERTEX];
if (vp) {
/* BRW_NEW_VS_PROG_DATA, BRW_NEW_IMAGE_UNITS, _NEW_TEXTURE */
diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c
index 92354e464ca..3ab8e3930ae 100644
--- a/src/mesa/drivers/dri/i965/brw_wm.c
+++ b/src/mesa/drivers/dri/i965/brw_wm.c
@@ -460,8 +460,8 @@ brw_wm_populate_key(struct brw_context *brw, struct brw_wm_prog_key *key)
const struct gen_device_info *devinfo = &brw->screen->devinfo;
struct gl_context *ctx = &brw->ctx;
/* BRW_NEW_FRAGMENT_PROGRAM */
- const struct brw_program *fp = brw_program_const(brw->fragment_program);
- const struct gl_program *prog = (struct gl_program *) brw->fragment_program;
+ const struct gl_program *prog = brw->programs[MESA_SHADER_FRAGMENT];
+ const struct brw_program *fp = brw_program_const(prog);
GLuint lookup = 0;
GLuint line_aa;
@@ -595,7 +595,8 @@ void
brw_upload_wm_prog(struct brw_context *brw)
{
struct brw_wm_prog_key key;
- struct brw_program *fp = (struct brw_program *) brw->fragment_program;
+ struct brw_program *fp =
+ (struct brw_program *) brw->programs[MESA_SHADER_FRAGMENT];
if (!brw_wm_state_dirty(brw))
return;
diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
index 7ff6245832b..ae74ff1845e 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
@@ -798,7 +798,9 @@ brw_upload_wm_pull_constants(struct brw_context *brw)
{
struct brw_stage_state *stage_state = &brw->wm.base;
/* BRW_NEW_FRAGMENT_PROGRAM */
- struct brw_program *fp = (struct brw_program *) brw->fragment_program;
+ struct brw_program *fp =
+ (struct brw_program *) brw->programs[MESA_SHADER_FRAGMENT];
+
/* BRW_NEW_FS_PROG_DATA */
struct brw_stage_prog_data *prog_data = brw->wm.base.prog_data;
@@ -1169,17 +1171,17 @@ brw_update_texture_surfaces(struct brw_context *brw)
const struct gen_device_info *devinfo = &brw->screen->devinfo;
/* BRW_NEW_VERTEX_PROGRAM */
- struct gl_program *vs = (struct gl_program *) brw->vertex_program;
+ struct gl_program *vs = brw->programs[MESA_SHADER_VERTEX];
/* BRW_NEW_TESS_PROGRAMS */
- struct gl_program *tcs = (struct gl_program *) brw->tess_ctrl_program;
- struct gl_program *tes = (struct gl_program *) brw->tess_eval_program;
+ struct gl_program *tcs = brw->programs[MESA_SHADER_TESS_CTRL];
+ struct gl_program *tes = brw->programs[MESA_SHADER_TESS_EVAL];
/* BRW_NEW_GEOMETRY_PROGRAM */
- struct gl_program *gs = (struct gl_program *) brw->geometry_program;
+ struct gl_program *gs = brw->programs[MESA_SHADER_GEOMETRY];
/* BRW_NEW_FRAGMENT_PROGRAM */
- struct gl_program *fs = (struct gl_program *) brw->fragment_program;
+ struct gl_program *fs = brw->programs[MESA_SHADER_FRAGMENT];
/* _NEW_TEXTURE */
update_stage_texture_surfaces(brw, vs, &brw->vs.base, false, 0);
@@ -1237,7 +1239,7 @@ brw_update_cs_texture_surfaces(struct brw_context *brw)
const struct gen_device_info *devinfo = &brw->screen->devinfo;
/* BRW_NEW_COMPUTE_PROGRAM */
- struct gl_program *cs = (struct gl_program *) brw->compute_program;
+ struct gl_program *cs = brw->programs[MESA_SHADER_COMPUTE];
/* _NEW_TEXTURE */
update_stage_texture_surfaces(brw, cs, &brw->cs.base, false, 0);
@@ -1409,7 +1411,7 @@ static void
brw_upload_wm_abo_surfaces(struct brw_context *brw)
{
/* _NEW_PROGRAM */
- const struct gl_program *wm = brw->fragment_program;
+ const struct gl_program *wm = brw->programs[MESA_SHADER_FRAGMENT];
if (wm) {
/* BRW_NEW_FS_PROG_DATA */
@@ -1431,7 +1433,7 @@ static void
brw_upload_cs_abo_surfaces(struct brw_context *brw)
{
/* _NEW_PROGRAM */
- const struct gl_program *cp = brw->compute_program;
+ const struct gl_program *cp = brw->programs[MESA_SHADER_COMPUTE];
if (cp) {
/* BRW_NEW_CS_PROG_DATA */
@@ -1453,7 +1455,7 @@ static void
brw_upload_cs_image_surfaces(struct brw_context *brw)
{
/* _NEW_PROGRAM */
- const struct gl_program *cp = brw->compute_program;
+ const struct gl_program *cp = brw->programs[MESA_SHADER_COMPUTE];
if (cp) {
/* BRW_NEW_CS_PROG_DATA, BRW_NEW_IMAGE_UNITS, _NEW_TEXTURE */
@@ -1640,7 +1642,7 @@ static void
brw_upload_wm_image_surfaces(struct brw_context *brw)
{
/* BRW_NEW_FRAGMENT_PROGRAM */
- const struct gl_program *wm = brw->fragment_program;
+ const struct gl_program *wm = brw->programs[MESA_SHADER_FRAGMENT];
if (wm) {
/* BRW_NEW_FS_PROG_DATA, BRW_NEW_IMAGE_UNITS, _NEW_TEXTURE */
diff --git a/src/mesa/drivers/dri/i965/gen6_sol.c b/src/mesa/drivers/dri/i965/gen6_sol.c
index d350e77dc99..53e4fd1c144 100644
--- a/src/mesa/drivers/dri/i965/gen6_sol.c
+++ b/src/mesa/drivers/dri/i965/gen6_sol.c
@@ -55,7 +55,7 @@ gen6_update_sol_surfaces(struct brw_context *brw)
unsigned buffer_offset =
xfb_obj->Offset[buffer] / 4 +
linked_xfb_info->Outputs[i].DstOffset;
- if (brw->geometry_program) {
+ if (brw->programs[MESA_SHADER_GEOMETRY]) {
brw_update_sol_surface(
brw, xfb_obj->Buffers[buffer],
&brw->gs.base.surf_offset[surf_index],
@@ -69,7 +69,7 @@ gen6_update_sol_surfaces(struct brw_context *brw)
linked_xfb_info->Buffers[buffer].Stride, buffer_offset);
}
} else {
- if (!brw->geometry_program)
+ if (!brw->programs[MESA_SHADER_GEOMETRY])
brw->ff_gs.surf_offset[surf_index] = 0;
else
brw->gs.base.surf_offset[surf_index] = 0;
@@ -103,14 +103,15 @@ brw_gs_upload_binding_table(struct brw_context *brw)
/* We have two scenarios here:
* 1) We are using a geometry shader only to implement transform feedback
- * for a vertex shader (brw->geometry_program == NULL). In this case, we
- * only need surfaces for transform feedback in the GS stage.
+ * for a vertex shader (brw->programs[MESA_SHADER_GEOMETRY] == NULL).
+ * In this case, we only need surfaces for transform feedback in the
+ * GS stage.
* 2) We have a user-provided geometry shader. In this case we may need
* surfaces for transform feedback and/or other stuff, like textures,
* in the GS stage.
*/
- if (!brw->geometry_program) {
+ if (!brw->programs[MESA_SHADER_GEOMETRY]) {
/* BRW_NEW_VERTEX_PROGRAM */
prog = ctx->_Shader->CurrentProgram[MESA_SHADER_VERTEX];
if (prog) {
diff --git a/src/mesa/drivers/dri/i965/gen6_urb.c b/src/mesa/drivers/dri/i965/gen6_urb.c
index e69a1dfada1..a04cf8b8fbf 100644
--- a/src/mesa/drivers/dri/i965/gen6_urb.c
+++ b/src/mesa/drivers/dri/i965/gen6_urb.c
@@ -115,7 +115,8 @@ upload_urb(struct brw_context *brw)
const unsigned vs_size = MAX2(vs_vue_prog_data->urb_entry_size, 1);
/* BRW_NEW_GEOMETRY_PROGRAM, BRW_NEW_GS_PROG_DATA */
- const bool gs_present = brw->ff_gs.prog_active || brw->geometry_program;
+ const bool gs_present =
+ brw->ff_gs.prog_active || brw->programs[MESA_SHADER_GEOMETRY];
/* Whe using GS to do transform feedback only we use the same VUE layout for
* VS outputs and GS outputs (as it's what the SF and Clipper expect), so we
@@ -128,7 +129,7 @@ upload_urb(struct brw_context *brw)
* outputs can be different from the VS outputs.
*/
unsigned gs_size = vs_size;
- if (brw->geometry_program) {
+ if (brw->programs[MESA_SHADER_GEOMETRY]) {
const struct brw_vue_prog_data *gs_vue_prog_data =
brw_vue_prog_data(brw->gs.base.prog_data);
gs_size = gs_vue_prog_data->urb_entry_size;
diff --git a/src/mesa/drivers/dri/i965/gen7_cs_state.c b/src/mesa/drivers/dri/i965/gen7_cs_state.c
index 26e4264018f..cdd6ad852cd 100644
--- a/src/mesa/drivers/dri/i965/gen7_cs_state.c
+++ b/src/mesa/drivers/dri/i965/gen7_cs_state.c
@@ -114,7 +114,8 @@ gen7_upload_cs_push_constants(struct brw_context *brw)
struct brw_stage_state *stage_state = &brw->cs.base;
/* BRW_NEW_COMPUTE_PROGRAM */
- const struct brw_program *cp = (struct brw_program *) brw->compute_program;
+ const struct brw_program *cp =
+ (struct brw_program *) brw->programs[MESA_SHADER_COMPUTE];
if (cp) {
/* BRW_NEW_CS_PROG_DATA */
@@ -148,7 +149,8 @@ brw_upload_cs_pull_constants(struct brw_context *brw)
struct brw_stage_state *stage_state = &brw->cs.base;
/* BRW_NEW_COMPUTE_PROGRAM */
- struct brw_program *cp = (struct brw_program *) brw->compute_program;
+ struct brw_program *cp =
+ (struct brw_program *) brw->programs[MESA_SHADER_COMPUTE];
/* BRW_NEW_CS_PROG_DATA */
const struct brw_stage_prog_data *prog_data = brw->cs.base.prog_data;
diff --git a/src/mesa/drivers/dri/i965/gen7_urb.c b/src/mesa/drivers/dri/i965/gen7_urb.c
index 44ce2c6a58e..2e5f8e60ba9 100644
--- a/src/mesa/drivers/dri/i965/gen7_urb.c
+++ b/src/mesa/drivers/dri/i965/gen7_urb.c
@@ -65,10 +65,10 @@ gen7_allocate_push_constants(struct brw_context *brw)
const struct gen_device_info *devinfo = &brw->screen->devinfo;
/* BRW_NEW_GEOMETRY_PROGRAM */
- bool gs_present = brw->geometry_program;
+ bool gs_present = brw->programs[MESA_SHADER_GEOMETRY];
/* BRW_NEW_TESS_PROGRAMS */
- bool tess_present = brw->tess_eval_program;
+ bool tess_present = brw->programs[MESA_SHADER_TESS_EVAL];
unsigned avail_size = 16;
unsigned multiplier =
diff --git a/src/mesa/drivers/dri/i965/genX_state_upload.c b/src/mesa/drivers/dri/i965/genX_state_upload.c
index 612761601a2..2a99376e3c2 100644
--- a/src/mesa/drivers/dri/i965/genX_state_upload.c
+++ b/src/mesa/drivers/dri/i965/genX_state_upload.c
@@ -1019,6 +1019,9 @@ genX(calculate_attr_overrides)(const struct brw_context *brw,
/* _NEW_POINT */
const struct gl_point_attrib *point = &ctx->Point;
+ /* BRW_NEW_FRAGMENT_PROGRAM */
+ const struct gl_program *fp = brw->programs[MESA_SHADER_FRAGMENT];
+
/* BRW_NEW_FS_PROG_DATA */
const struct brw_wm_prog_data *wm_prog_data =
brw_wm_prog_data(brw->wm.base.prog_data);
@@ -1026,16 +1029,14 @@ genX(calculate_attr_overrides)(const struct brw_context *brw,
*point_sprite_enables = 0;
- /* BRW_NEW_FRAGMENT_PROGRAM
- *
- * If the fragment shader reads VARYING_SLOT_LAYER, then we need to pass in
+ /* If the fragment shader reads VARYING_SLOT_LAYER, then we need to pass in
* the full vertex header. Otherwise, we can program the SF to start
* reading at an offset of 1 (2 varying slots) to skip unnecessary data:
* - VARYING_SLOT_PSIZ and BRW_VARYING_SLOT_NDC on gen4-5
* - VARYING_SLOT_{PSIZ,LAYER} and VARYING_SLOT_POS on gen6+
*/
- bool fs_needs_vue_header = brw->fragment_program->info.inputs_read &
+ bool fs_needs_vue_header = fp->info.inputs_read &
(VARYING_BIT_LAYER | VARYING_BIT_VIEWPORT);
*urb_entry_read_offset = fs_needs_vue_header ? 0 : 1;
@@ -1713,7 +1714,7 @@ brw_color_buffer_write_enabled(struct brw_context *brw)
{
struct gl_context *ctx = &brw->ctx;
/* BRW_NEW_FRAGMENT_PROGRAM */
- const struct gl_program *fp = brw->fragment_program;
+ const struct gl_program *fp = brw->programs[MESA_SHADER_FRAGMENT];
unsigned i;
/* _NEW_BUFFERS */
@@ -2524,8 +2525,9 @@ genX(upload_gs_state)(struct brw_context *brw)
UNUSED struct gl_context *ctx = &brw->ctx;
UNUSED const struct gen_device_info *devinfo = &brw->screen->devinfo;
const struct brw_stage_state *stage_state = &brw->gs.base;
+ const struct gl_program *gs_prog = brw->programs[MESA_SHADER_GEOMETRY];
/* BRW_NEW_GEOMETRY_PROGRAM */
- bool active = GEN_GEN >= 6 && brw->geometry_program;
+ bool active = GEN_GEN >= 6 && gs_prog;
/* BRW_NEW_GS_PROG_DATA */
struct brw_stage_prog_data *stage_prog_data = stage_state->prog_data;
@@ -2621,7 +2623,7 @@ genX(upload_gs_state)(struct brw_context *brw)
#if GEN_GEN < 7
gs.SOStatisticsEnable = true;
- if (brw->geometry_program->info.has_transform_feedback_varyings)
+ if (gs_prog->info.has_transform_feedback_varyings)
gs.SVBIPayloadEnable = true;
/* GEN6_GS_SPF_MODE and GEN6_GS_VECTOR_MASK_ENABLE are enabled as it
@@ -3139,8 +3141,9 @@ genX(upload_vs_push_constants)(struct brw_context *brw)
{
struct brw_stage_state *stage_state = &brw->vs.base;
- /* _BRW_NEW_VERTEX_PROGRAM */
- const struct brw_program *vp = brw_program_const(brw->vertex_program);
+ /* BRW_NEW_VERTEX_PROGRAM */
+ const struct brw_program *vp =
+ brw_program_const(brw->programs[MESA_SHADER_VERTEX]);
/* BRW_NEW_VS_PROG_DATA */
const struct brw_stage_prog_data *prog_data = brw->vs.base.prog_data;
@@ -3166,7 +3169,8 @@ genX(upload_gs_push_constants)(struct brw_context *brw)
struct brw_stage_state *stage_state = &brw->gs.base;
/* BRW_NEW_GEOMETRY_PROGRAM */
- const struct brw_program *gp = brw_program_const(brw->geometry_program);
+ const struct brw_program *gp =
+ brw_program_const(brw->programs[MESA_SHADER_GEOMETRY]);
if (gp) {
/* BRW_NEW_GS_PROG_DATA */
@@ -3194,7 +3198,8 @@ genX(upload_wm_push_constants)(struct brw_context *brw)
{
struct brw_stage_state *stage_state = &brw->wm.base;
/* BRW_NEW_FRAGMENT_PROGRAM */
- const struct brw_program *fp = brw_program_const(brw->fragment_program);
+ const struct brw_program *fp =
+ brw_program_const(brw->programs[MESA_SHADER_FRAGMENT]);
/* BRW_NEW_FS_PROG_DATA */
const struct brw_stage_prog_data *prog_data = brw->wm.base.prog_data;
@@ -3389,6 +3394,8 @@ static void
genX(upload_sbe)(struct brw_context *brw)
{
struct gl_context *ctx = &brw->ctx;
+ /* BRW_NEW_FRAGMENT_PROGRAM */
+ UNUSED const struct gl_program *fp = brw->programs[MESA_SHADER_FRAGMENT];
/* BRW_NEW_FS_PROG_DATA */
const struct brw_wm_prog_data *wm_prog_data =
brw_wm_prog_data(brw->wm.base.prog_data);
@@ -3451,10 +3458,8 @@ genX(upload_sbe)(struct brw_context *brw)
/* prepare the active component dwords */
int input_index = 0;
for (int attr = 0; attr < VARYING_SLOT_MAX; attr++) {
- if (!(brw->fragment_program->info.inputs_read &
- BITFIELD64_BIT(attr))) {
+ if (!(fp->info.inputs_read & BITFIELD64_BIT(attr)))
continue;
- }
assert(input_index < 32);
@@ -4000,7 +4005,7 @@ static void
upload_te_state(struct brw_context *brw)
{
/* BRW_NEW_TESS_PROGRAMS */
- bool active = brw->tess_eval_program;
+ bool active = brw->programs[MESA_SHADER_TESS_EVAL];
/* BRW_NEW_TES_PROG_DATA */
const struct brw_tes_prog_data *tes_prog_data =
@@ -4038,7 +4043,8 @@ genX(upload_tes_push_constants)(struct brw_context *brw)
{
struct brw_stage_state *stage_state = &brw->tes.base;
/* BRW_NEW_TESS_PROGRAMS */
- const struct brw_program *tep = brw_program_const(brw->tess_eval_program);
+ const struct brw_program *tep =
+ brw_program_const(brw->programs[MESA_SHADER_TESS_EVAL]);
if (tep) {
/* BRW_NEW_TES_PROG_DATA */
@@ -4064,8 +4070,9 @@ genX(upload_tcs_push_constants)(struct brw_context *brw)
{
struct brw_stage_state *stage_state = &brw->tcs.base;
/* BRW_NEW_TESS_PROGRAMS */
- const struct brw_program *tcp = brw_program_const(brw->tess_ctrl_program);
- bool active = brw->tess_eval_program;
+ const struct brw_program *tcp =
+ brw_program_const(brw->programs[MESA_SHADER_TESS_CTRL]);
+ bool active = brw->programs[MESA_SHADER_TESS_EVAL];
if (active) {
/* BRW_NEW_TCS_PROG_DATA */
@@ -5113,7 +5120,7 @@ static void
genX(upload_fs_samplers)(struct brw_context *brw)
{
/* BRW_NEW_FRAGMENT_PROGRAM */
- struct gl_program *fs = (struct gl_program *) brw->fragment_program;
+ struct gl_program *fs = brw->programs[MESA_SHADER_FRAGMENT];
genX(upload_sampler_state_table)(brw, fs, &brw->wm.base);
}
@@ -5131,7 +5138,7 @@ static void
genX(upload_vs_samplers)(struct brw_context *brw)
{
/* BRW_NEW_VERTEX_PROGRAM */
- struct gl_program *vs = (struct gl_program *) brw->vertex_program;
+ struct gl_program *vs = brw->programs[MESA_SHADER_VERTEX];
genX(upload_sampler_state_table)(brw, vs, &brw->vs.base);
}
@@ -5150,7 +5157,7 @@ static void
genX(upload_gs_samplers)(struct brw_context *brw)
{
/* BRW_NEW_GEOMETRY_PROGRAM */
- struct gl_program *gs = (struct gl_program *) brw->geometry_program;
+ struct gl_program *gs = brw->programs[MESA_SHADER_GEOMETRY];
if (!gs)
return;
@@ -5174,7 +5181,7 @@ static void
genX(upload_tcs_samplers)(struct brw_context *brw)
{
/* BRW_NEW_TESS_PROGRAMS */
- struct gl_program *tcs = (struct gl_program *) brw->tess_ctrl_program;
+ struct gl_program *tcs = brw->programs[MESA_SHADER_TESS_CTRL];
if (!tcs)
return;
@@ -5197,7 +5204,7 @@ static void
genX(upload_tes_samplers)(struct brw_context *brw)
{
/* BRW_NEW_TESS_PROGRAMS */
- struct gl_program *tes = (struct gl_program *) brw->tess_eval_program;
+ struct gl_program *tes = brw->programs[MESA_SHADER_TESS_EVAL];
if (!tes)
return;
@@ -5220,7 +5227,7 @@ static void
genX(upload_cs_samplers)(struct brw_context *brw)
{
/* BRW_NEW_COMPUTE_PROGRAM */
- struct gl_program *cs = (struct gl_program *) brw->compute_program;
+ struct gl_program *cs = brw->programs[MESA_SHADER_COMPUTE];
if (!cs)
return;