BRW_STATE_NR_VS_SURFACES,
BRW_STATE_INDEX_BUFFER,
BRW_STATE_VS_CONSTBUF,
- BRW_STATE_WM_CONSTBUF,
BRW_STATE_PROGRAM_CACHE,
BRW_STATE_STATE_BASE_ADDRESS,
};
/** \see brw.state.depth_region */
#define BRW_NEW_INDEX_BUFFER (1 << BRW_STATE_INDEX_BUFFER)
#define BRW_NEW_VS_CONSTBUF (1 << BRW_STATE_VS_CONSTBUF)
-#define BRW_NEW_WM_CONSTBUF (1 << BRW_STATE_WM_CONSTBUF)
#define BRW_NEW_PROGRAM_CACHE (1 << BRW_STATE_PROGRAM_CACHE)
#define BRW_NEW_STATE_BASE_ADDRESS (1 << BRW_STATE_STATE_BASE_ADDRESS)
extern const struct brw_tracked_state brw_clip_prog;
extern const struct brw_tracked_state brw_clip_unit;
extern const struct brw_tracked_state brw_vs_constants;
-extern const struct brw_tracked_state brw_wm_constants;
+extern const struct brw_tracked_state brw_wm_pull_constants;
extern const struct brw_tracked_state brw_constant_buffer;
extern const struct brw_tracked_state brw_curbe_offsets;
extern const struct brw_tracked_state brw_invarient_state;
extern const struct brw_tracked_state brw_wm_input_sizes;
extern const struct brw_tracked_state brw_wm_prog;
extern const struct brw_tracked_state brw_wm_samplers;
-extern const struct brw_tracked_state brw_wm_constant_surface;
extern const struct brw_tracked_state brw_wm_surfaces;
extern const struct brw_tracked_state brw_wm_binding_table;
extern const struct brw_tracked_state brw_wm_unit;
&brw_cc_unit,
&brw_vs_constants, /* Before vs_surfaces and constant_buffer */
- &brw_wm_constants, /* Before wm_surfaces and constant_buffer */
+ &brw_wm_pull_constants, /* Before brw_wm_binding_table */
&brw_vs_surfaces, /* must do before unit */
- &brw_wm_constant_surface, /* must do before wm surfaces/bind bo */
&brw_wm_surfaces, /* must do before samplers and unit */
&brw_wm_binding_table,
&brw_wm_samplers,
&gen6_cc_state_pointers,
&brw_vs_constants, /* Before vs_surfaces and constant_buffer */
- &brw_wm_constants, /* Before wm_surfaces and constant_buffer */
+ &brw_wm_pull_constants, /* Before brw_wm_binding_table */
&gen6_vs_push_constants, /* Before vs_state */
&gen6_wm_push_constants, /* Before wm_state */
&brw_vs_surfaces, /* must do before unit */
- &brw_wm_constant_surface, /* must do before wm surfaces/bind bo */
&brw_wm_surfaces, /* must do before samplers and unit */
&brw_wm_binding_table,
&gen7_depth_stencil_state_pointer,
&brw_vs_constants, /* Before vs_surfaces and constant_buffer */
- &brw_wm_constants, /* Before wm_surfaces and constant_buffer */
+ &brw_wm_pull_constants, /* Before brw_wm_binding_table */
&gen6_vs_push_constants, /* Before vs_state */
&gen6_wm_push_constants, /* Before wm_surfaces and constant_buffer */
&brw_vs_surfaces, /* must do before unit */
- &brw_wm_constant_surface, /* must do before wm surfaces/bind bo */
&brw_wm_surfaces, /* must do before samplers and unit */
&brw_wm_binding_table,
DEFINE_BIT(BRW_NEW_VERTICES),
DEFINE_BIT(BRW_NEW_BATCH),
DEFINE_BIT(BRW_NEW_VS_CONSTBUF),
- DEFINE_BIT(BRW_NEW_WM_CONSTBUF),
DEFINE_BIT(BRW_NEW_VS_BINDING_TABLE),
DEFINE_BIT(BRW_NEW_GS_BINDING_TABLE),
DEFINE_BIT(BRW_NEW_PS_BINDING_TABLE),
/* BRW_NEW_FRAGMENT_PROGRAM */
struct brw_fragment_program *fp =
(struct brw_fragment_program *) brw->fragment_program;
+ struct gl_program_parameter_list *params = fp->program.Base.Parameters;
const int size = brw->wm.prog_data->nr_pull_params * sizeof(float);
+ const int surf_index = SURF_INDEX_FRAG_CONST_BUFFER;
float *constants;
unsigned int i;
- _mesa_load_state_parameters(ctx, fp->program.Base.Parameters);
+ _mesa_load_state_parameters(ctx, params);
/* CACHE_NEW_WM_PROG */
if (brw->wm.prog_data->nr_pull_params == 0) {
if (brw->wm.const_bo) {
drm_intel_bo_unreference(brw->wm.const_bo);
brw->wm.const_bo = NULL;
- brw->state.dirty.brw |= BRW_NEW_WM_CONSTBUF;
+ brw->wm.surf_offset[surf_index] = 0;
+ brw->state.dirty.brw |= BRW_NEW_WM_SURFACES;
}
return;
}
}
drm_intel_gem_bo_unmap_gtt(brw->wm.const_bo);
- brw->state.dirty.brw |= BRW_NEW_WM_CONSTBUF;
+ intel->vtbl.create_constant_surface(brw, brw->wm.const_bo,
+ params->NumParameters,
+ &brw->wm.surf_offset[surf_index]);
+
+ brw->state.dirty.brw |= BRW_NEW_WM_SURFACES;
}
-const struct brw_tracked_state brw_wm_constants = {
+const struct brw_tracked_state brw_wm_pull_constants = {
.dirty = {
.mesa = (_NEW_PROGRAM_CONSTANTS),
- .brw = (BRW_NEW_FRAGMENT_PROGRAM),
+ .brw = (BRW_NEW_BATCH | BRW_NEW_FRAGMENT_PROGRAM),
.cache = CACHE_NEW_WM_PROG,
},
.emit = brw_upload_wm_pull_constants,
};
-/**
- * Updates surface / buffer for fragment shader constant buffer, if
- * one is required.
- *
- * This consumes the state updates for the constant buffer, and produces
- * BRW_NEW_WM_SURFACES to get picked up by brw_prepare_wm_surfaces for
- * inclusion in the binding table.
- */
-static void upload_wm_constant_surface(struct brw_context *brw )
-{
- GLuint surf = SURF_INDEX_FRAG_CONST_BUFFER;
- struct brw_fragment_program *fp =
- (struct brw_fragment_program *) brw->fragment_program;
- const struct gl_program_parameter_list *params =
- fp->program.Base.Parameters;
-
- /* If there's no constant buffer, then no surface BO is needed to point at
- * it.
- */
- if (brw->wm.const_bo == 0) {
- if (brw->wm.surf_offset[surf]) {
- brw->state.dirty.brw |= BRW_NEW_WM_SURFACES;
- brw->wm.surf_offset[surf] = 0;
- }
- return;
- }
-
- brw->intel.vtbl.create_constant_surface(brw, brw->wm.const_bo,
- params->NumParameters,
- &brw->wm.surf_offset[surf]);
- brw->state.dirty.brw |= BRW_NEW_WM_SURFACES;
-}
-
-const struct brw_tracked_state brw_wm_constant_surface = {
- .dirty = {
- .mesa = 0,
- .brw = (BRW_NEW_WM_CONSTBUF |
- BRW_NEW_BATCH),
- .cache = 0
- },
- .emit = upload_wm_constant_surface,
-};
-
static void
brw_update_null_renderbuffer_surface(struct brw_context *brw, unsigned int unit)
{