int dispatch_width;
uint32_t prog_offset_16;
+ /**
+ * Mask of which interpolation modes are required by the fragment shader.
+ * Used in hardware setup on gen6+.
+ */
+ uint32_t barycentric_interp_modes;
+
/* Pointer to tracked values (only valid once
* _mesa_load_state_parameters has been called at runtime).
*/
/* brw_vs.c */
gl_clip_plane *brw_select_clip_planes(struct gl_context *ctx);
-/* brw_wm.c */
-unsigned
-brw_compute_barycentric_interp_modes(bool shade_model_flat,
- const struct gl_fragment_program *fprog);
-
/* brw_wm_surface_state.c */
void brw_init_surface_formats(struct brw_context *brw);
void
* Return a bitfield where bit n is set if barycentric interpolation mode n
* (see enum brw_wm_barycentric_interp_mode) is needed by the fragment shader.
*/
-unsigned
+static unsigned
brw_compute_barycentric_interp_modes(bool shade_model_flat,
const struct gl_fragment_program *fprog)
{
struct intel_context *intel = &brw->intel;
bool uses_depth = (c->fp->program.Base.InputsRead &
(1 << FRAG_ATTRIB_WPOS)) != 0;
- unsigned barycentric_interp_modes =
- brw_compute_barycentric_interp_modes(c->key.flat_shade,
- &c->fp->program);
+ unsigned barycentric_interp_modes = c->prog_data.barycentric_interp_modes;
int i;
if (intel->gen >= 6) {
brw_init_compile(brw, &c->func, c);
+ c->prog_data.barycentric_interp_modes =
+ brw_compute_barycentric_interp_modes(c->key.flat_shade, &fp->program);
+
if (prog && prog->_LinkedShaders[MESA_SHADER_FRAGMENT]) {
if (!brw_wm_fs_emit(brw, c, prog))
return false;
brw_fragment_program_const(brw->fragment_program);
uint32_t dw2, dw4, dw5, dw6;
- /* _NEW_LIGHT */
- bool flat_shade = (ctx->Light.ShadeModel == GL_FLAT);
-
/* CACHE_NEW_WM_PROG */
if (brw->wm.prog_data->nr_params == 0) {
/* Disable the push constant buffers. */
dw5 |= GEN6_WM_USES_SOURCE_DEPTH | GEN6_WM_USES_SOURCE_W;
if (fp->program.Base.OutputsWritten & BITFIELD64_BIT(FRAG_RESULT_DEPTH))
dw5 |= GEN6_WM_COMPUTED_DEPTH;
- dw6 |= brw_compute_barycentric_interp_modes(flat_shade, &fp->program) <<
+ /* CACHE_NEW_WM_PROG */
+ dw6 |= brw->wm.prog_data->barycentric_interp_modes <<
GEN6_WM_BARYCENTRIC_INTERPOLATION_MODE_SHIFT;
/* _NEW_COLOR */
const struct brw_tracked_state gen6_wm_state = {
.dirty = {
.mesa = (_NEW_LINE |
- _NEW_LIGHT |
_NEW_COLOR |
_NEW_BUFFERS |
_NEW_PROGRAM_CONSTANTS |
bool writes_depth = false;
uint32_t dw1;
- /* _NEW_LIGHT */
- bool flat_shade = (ctx->Light.ShadeModel == GL_FLAT);
-
dw1 = 0;
dw1 |= GEN7_WM_STATISTICS_ENABLE;
dw1 |= GEN7_WM_LINE_AA_WIDTH_1_0;
writes_depth = true;
dw1 |= GEN7_WM_PSCDEPTH_ON;
}
- dw1 |= brw_compute_barycentric_interp_modes(flat_shade, &fp->program) <<
+ /* CACHE_NEW_WM_PROG */
+ dw1 |= brw->wm.prog_data->barycentric_interp_modes <<
GEN7_WM_BARYCENTRIC_INTERPOLATION_MODE_SHIFT;
/* _NEW_COLOR */
const struct brw_tracked_state gen7_wm_state = {
.dirty = {
- .mesa = (_NEW_LINE | _NEW_LIGHT | _NEW_POLYGON |
+ .mesa = (_NEW_LINE | _NEW_POLYGON |
_NEW_COLOR | _NEW_BUFFERS),
.brw = (BRW_NEW_FRAGMENT_PROGRAM |
BRW_NEW_BATCH),
- .cache = 0,
+ .cache = CACHE_NEW_WM_PROG,
},
.emit = upload_wm_state,
};