i965: Refactor and expose brw_upload_binding_table()

Read and write parts of the state stage are also split into
explicit arguments allowing future patches to use constant
program data.

v2 (Ken): s/BRW_NEW_WM_PROG_DATA/BRW_NEW_FS_PROG_DATA/

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
This commit is contained in:
Topi Pohjolainen 2015-03-19 10:42:49 +02:00
parent c15e20d8f6
commit 21071afc43
2 changed files with 21 additions and 7 deletions

View File

@ -50,15 +50,13 @@
* This copies brw_stage_state::surf_offset[] into the indirect state section
* of the batchbuffer (allocated by brw_state_batch()).
*/
static void
void
brw_upload_binding_table(struct brw_context *brw,
uint32_t packet_name,
GLbitfield brw_new_binding_table,
const struct brw_stage_prog_data *prog_data,
struct brw_stage_state *stage_state)
{
/* BRW_NEW_*_PROG_DATA */
struct brw_stage_prog_data *prog_data = stage_state->prog_data;
if (prog_data->binding_table.size_bytes == 0) {
/* There are no surfaces; skip making the binding table altogether. */
if (stage_state->bind_bo_offset == 0 && brw->gen < 9)
@ -103,9 +101,12 @@ brw_upload_binding_table(struct brw_context *brw,
static void
brw_vs_upload_binding_table(struct brw_context *brw)
{
/* BRW_NEW_VS_PROG_DATA */
const struct brw_stage_prog_data *prog_data = brw->vs.base.prog_data;
brw_upload_binding_table(brw,
_3DSTATE_BINDING_TABLE_POINTERS_VS,
BRW_NEW_VS_BINDING_TABLE, &brw->vs.base);
BRW_NEW_VS_BINDING_TABLE, prog_data,
&brw->vs.base);
}
const struct brw_tracked_state brw_vs_binding_table = {
@ -124,9 +125,12 @@ const struct brw_tracked_state brw_vs_binding_table = {
static void
brw_upload_wm_binding_table(struct brw_context *brw)
{
/* BRW_NEW_FS_PROG_DATA */
const struct brw_stage_prog_data *prog_data = brw->wm.base.prog_data;
brw_upload_binding_table(brw,
_3DSTATE_BINDING_TABLE_POINTERS_PS,
BRW_NEW_PS_BINDING_TABLE, &brw->wm.base);
BRW_NEW_PS_BINDING_TABLE, prog_data,
&brw->wm.base);
}
const struct brw_tracked_state brw_wm_binding_table = {
@ -147,9 +151,12 @@ brw_gs_upload_binding_table(struct brw_context *brw)
if (brw->geometry_program == NULL)
return;
/* BRW_NEW_GS_PROG_DATA */
const struct brw_stage_prog_data *prog_data = brw->gs.base.prog_data;
brw_upload_binding_table(brw,
_3DSTATE_BINDING_TABLE_POINTERS_GS,
BRW_NEW_GS_BINDING_TABLE, &brw->gs.base);
BRW_NEW_GS_BINDING_TABLE, prog_data,
&brw->gs.base);
}
const struct brw_tracked_state brw_gs_binding_table = {

View File

@ -159,6 +159,13 @@ brw_state_dirty(struct brw_context *brw, GLuint mesa_flags, uint64_t brw_flags)
(brw->ctx.NewDriverState & brw_flags)) != 0;
}
/* brw_binding_tables.c */
void brw_upload_binding_table(struct brw_context *brw,
uint32_t packet_name,
GLbitfield brw_new_binding_table,
const struct brw_stage_prog_data *prog_data,
struct brw_stage_state *stage_state);
/* brw_misc_state.c */
void brw_upload_invariant_state(struct brw_context *brw);
uint32_t