brw->must_use_separate_stencil = screen->hw_must_use_separate_stencil;
brw->has_swizzling = screen->hw_has_swizzling;
+ brw->vs.base.stage = MESA_SHADER_VERTEX;
+ brw->gs.base.stage = MESA_SHADER_GEOMETRY;
+ brw->wm.base.stage = MESA_SHADER_FRAGMENT;
if (brw->gen >= 8) {
gen8_init_vtable_surface_functions(brw);
gen7_init_vtable_sampler_functions(brw);
*/
struct brw_stage_state
{
+ gl_shader_stage stage;
struct brw_stage_prog_data *prog_data;
/**
/* CACHE_NEW_GS_PROG */
const struct brw_vec4_prog_data *prog_data = &brw->gs.prog_data->base;
- /* CACHE_NEW_SAMPLER */
- BEGIN_BATCH(2);
- OUT_BATCH(_3DSTATE_SAMPLER_STATE_POINTERS_GS << 16 | (2 - 2));
- OUT_BATCH(stage_state->sampler_offset);
- ADVANCE_BATCH();
-
gen7_upload_constant_state(brw, stage_state, active, _3DSTATE_CONSTANT_GS);
/**
BRW_NEW_GS_BINDING_TABLE |
BRW_NEW_BATCH |
BRW_NEW_PUSH_CONSTANT_ALLOCATION),
- .cache = CACHE_NEW_GS_PROG | CACHE_NEW_SAMPLER
+ .cache = CACHE_NEW_GS_PROG
},
.emit = upload_gs_state,
};
struct gl_context *ctx = &brw->ctx;
struct gen7_sampler_state *samplers;
uint32_t sampler_count = stage_state->sampler_count;
+ static const uint16_t packet_headers[] = {
+ [MESA_SHADER_VERTEX] = _3DSTATE_SAMPLER_STATE_POINTERS_VS,
+ [MESA_SHADER_GEOMETRY] = _3DSTATE_SAMPLER_STATE_POINTERS_GS,
+ [MESA_SHADER_FRAGMENT] = _3DSTATE_SAMPLER_STATE_POINTERS_PS,
+ };
GLbitfield SamplersUsed = prog->SamplersUsed;
}
}
- brw->state.dirty.cache |= CACHE_NEW_SAMPLER;
+ if (brw->gen == 7 && !brw->is_haswell &&
+ stage_state->stage == MESA_SHADER_VERTEX) {
+ gen7_emit_vs_workaround_flush(brw);
+ }
+
+ BEGIN_BATCH(2);
+ OUT_BATCH(packet_headers[stage_state->stage] << 16 | (2 - 2));
+ OUT_BATCH(stage_state->sampler_offset);
+ ADVANCE_BATCH();
}
void
if (!brw->is_haswell)
gen7_emit_vs_workaround_flush(brw);
- /* CACHE_NEW_SAMPLER */
- BEGIN_BATCH(2);
- OUT_BATCH(_3DSTATE_SAMPLER_STATE_POINTERS_VS << 16 | (2 - 2));
- OUT_BATCH(stage_state->sampler_offset);
- ADVANCE_BATCH();
-
gen7_upload_constant_state(brw, stage_state, true /* active */,
_3DSTATE_CONSTANT_VS);
BRW_NEW_VS_BINDING_TABLE |
BRW_NEW_BATCH |
BRW_NEW_PUSH_CONSTANT_ALLOCATION),
- .cache = CACHE_NEW_VS_PROG | CACHE_NEW_SAMPLER
+ .cache = CACHE_NEW_VS_PROG
},
.emit = upload_vs_state,
};
const int max_threads_shift = brw->is_haswell ?
HSW_PS_MAX_THREADS_SHIFT : IVB_PS_MAX_THREADS_SHIFT;
- /* CACHE_NEW_SAMPLER */
- BEGIN_BATCH(2);
- OUT_BATCH(_3DSTATE_SAMPLER_STATE_POINTERS_PS << 16 | (2 - 2));
- OUT_BATCH(brw->wm.base.sampler_offset);
- ADVANCE_BATCH();
-
/* CACHE_NEW_WM_PROG */
gen7_upload_constant_state(brw, &brw->wm.base, true, _3DSTATE_CONSTANT_PS);
BRW_NEW_PS_BINDING_TABLE |
BRW_NEW_BATCH |
BRW_NEW_PUSH_CONSTANT_ALLOCATION),
- .cache = (CACHE_NEW_SAMPLER |
- CACHE_NEW_WM_PROG)
+ .cache = (CACHE_NEW_WM_PROG)
},
.emit = upload_ps_state,
};
/* CACHE_NEW_GS_PROG */
const struct brw_vec4_prog_data *prog_data = &brw->gs.prog_data->base;
- /* CACHE_NEW_SAMPLER */
- BEGIN_BATCH(2);
- OUT_BATCH(_3DSTATE_SAMPLER_STATE_POINTERS_GS << 16 | (2 - 2));
- OUT_BATCH(stage_state->sampler_offset);
- ADVANCE_BATCH();
-
gen8_upload_constant_state(brw, stage_state, active, _3DSTATE_CONSTANT_GS);
if (active) {
BRW_NEW_GS_BINDING_TABLE |
BRW_NEW_BATCH |
BRW_NEW_PUSH_CONSTANT_ALLOCATION),
- .cache = CACHE_NEW_GS_PROG | CACHE_NEW_SAMPLER
+ .cache = CACHE_NEW_GS_PROG
},
.emit = gen8_upload_gs_state,
};
struct gl_context *ctx = &brw->ctx;
uint32_t dw3 = 0, dw6 = 0, dw7 = 0;
- /* CACHE_NEW_SAMPLER */
- BEGIN_BATCH(2);
- OUT_BATCH(_3DSTATE_SAMPLER_STATE_POINTERS_PS << 16 | (2 - 2));
- OUT_BATCH(brw->wm.base.sampler_offset);
- ADVANCE_BATCH();
-
/* CACHE_NEW_WM_PROG */
gen8_upload_constant_state(brw, &brw->wm.base, true, _3DSTATE_CONSTANT_PS);
BRW_NEW_PS_BINDING_TABLE |
BRW_NEW_BATCH |
BRW_NEW_PUSH_CONSTANT_ALLOCATION,
- .cache = CACHE_NEW_SAMPLER | CACHE_NEW_WM_PROG
+ .cache = CACHE_NEW_WM_PROG
},
.emit = upload_ps_state,
};
/* CACHE_NEW_VS_PROG */
const struct brw_vec4_prog_data *prog_data = &brw->vs.prog_data->base;
- /* CACHE_NEW_SAMPLER */
- BEGIN_BATCH(2);
- OUT_BATCH(_3DSTATE_SAMPLER_STATE_POINTERS_VS << 16 | (2 - 2));
- OUT_BATCH(stage_state->sampler_offset);
- ADVANCE_BATCH();
-
gen8_upload_constant_state(brw, stage_state, true /* active */,
_3DSTATE_CONSTANT_VS);
BRW_NEW_VS_BINDING_TABLE |
BRW_NEW_BATCH |
BRW_NEW_PUSH_CONSTANT_ALLOCATION,
- .cache = CACHE_NEW_VS_PROG | CACHE_NEW_SAMPLER
+ .cache = CACHE_NEW_VS_PROG
},
.emit = upload_vs_state,
};