This makes it easier to loop over programs.
Reviewed-by: Alejandro PiƱeiro <apinheiro@igalia.com>
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 */
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 */
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 */
/* 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
{
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));
{
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;
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;
}
/* 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;
/* 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;
* 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);
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));
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;
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;
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 */
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 */
/* 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.
*/
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 );
}
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;
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;
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;
}
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 {
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;
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);
}
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;
}
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;
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,
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;
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 */
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 */
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;
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,
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;
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 */
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 */
{
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));
{
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;
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;
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 */
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 */
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;
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;
{
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;
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);
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);
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 */
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 */
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 */
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 */
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],
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;
/* 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) {
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
* 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;
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 */
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;
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 =
/* _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);
*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;
{
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 */
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;
#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
{
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;
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 */
{
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;
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);
/* 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);
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 =
{
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 */
{
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 */
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);
}
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);
}
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;
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;
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;
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;