i965: Combine the two WM pull constant tracked state atoms.
These were only split for historical reasons: brw_wm_constants used to be the "prepare" step, while brw_wm_constant_surface was "emit". Now that both happen at emit time, it makes sense to combine them. Call the newly combined state atom "brw_wm_pull_constants" to indicate help distinguish it from the Gen6+ atoms that handle push constants. Finally, remove the BRW_NEW_WM_CONSTBUF dirty bit entirely now that it's never flagged nor used. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Eric Anholt <eric@anholt.net> Reviewed-by: Paul Berry <stereotype441@gmail.com>
This commit is contained in:
@@ -142,7 +142,6 @@ enum brw_state_id {
|
||||
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,
|
||||
};
|
||||
@@ -171,7 +170,6 @@ enum brw_state_id {
|
||||
/** \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)
|
||||
|
||||
|
@@ -42,7 +42,7 @@ extern const struct brw_tracked_state brw_check_fallback;
|
||||
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;
|
||||
@@ -69,7 +69,6 @@ extern const struct brw_tracked_state brw_vs_unit;
|
||||
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;
|
||||
|
@@ -64,10 +64,9 @@ static const struct brw_tracked_state *gen4_atoms[] =
|
||||
&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,
|
||||
@@ -134,12 +133,11 @@ static const struct brw_tracked_state *gen6_atoms[] =
|
||||
&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,
|
||||
|
||||
@@ -199,12 +197,11 @@ const struct brw_tracked_state *gen7_atoms[] =
|
||||
&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,
|
||||
|
||||
@@ -358,7 +355,6 @@ static struct dirty_bit_map brw_bits[] = {
|
||||
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),
|
||||
|
@@ -362,18 +362,21 @@ brw_upload_wm_pull_constants(struct brw_context *brw)
|
||||
/* 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;
|
||||
}
|
||||
@@ -391,59 +394,20 @@ brw_upload_wm_pull_constants(struct brw_context *brw)
|
||||
}
|
||||
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]);
|
||||
|
||||
const struct brw_tracked_state brw_wm_constants = {
|
||||
.dirty = {
|
||||
.mesa = (_NEW_PROGRAM_CONSTANTS),
|
||||
.brw = (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 = {
|
||||
const struct brw_tracked_state brw_wm_pull_constants = {
|
||||
.dirty = {
|
||||
.mesa = 0,
|
||||
.brw = (BRW_NEW_WM_CONSTBUF |
|
||||
BRW_NEW_BATCH),
|
||||
.cache = 0
|
||||
.mesa = (_NEW_PROGRAM_CONSTANTS),
|
||||
.brw = (BRW_NEW_BATCH | BRW_NEW_FRAGMENT_PROGRAM),
|
||||
.cache = CACHE_NEW_WM_PROG,
|
||||
},
|
||||
.emit = upload_wm_constant_surface,
|
||||
.emit = brw_upload_wm_pull_constants,
|
||||
};
|
||||
|
||||
static void
|
||||
|
Reference in New Issue
Block a user