diff options
author | Jason Ekstrand <[email protected]> | 2015-10-01 08:55:20 -0700 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2015-10-02 14:22:53 -0700 |
commit | ea006c4cb5eb2d98d6bfd5a6c32fcae10b636f17 (patch) | |
tree | a0647357954c7cda28a2ce967a4a75154d98bc4b /src/mesa/drivers/dri/i965/brw_wm.c | |
parent | 28709e37d96d6b64753ca4dcce5fbfeb75f5b499 (diff) |
i965: Move binding table setup to codegen time.
Setting up binding tables really has little to do with the actual process
of turning shaders into instructions; it's more part of setting up
prog_data. This commit moves it out of the visitors and with the rest of
the prog_data setup stuff.
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_wm.c')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_wm.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c index 08f2416855b..69e4aecd2d2 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.c +++ b/src/mesa/drivers/dri/i965/brw_wm.c @@ -132,6 +132,26 @@ computed_depth_mode(struct gl_fragment_program *fp) return BRW_PSCDEPTH_OFF; } +static void +assign_fs_binding_table_offsets(const struct brw_device_info *devinfo, + const struct gl_shader_program *shader_prog, + const struct gl_program *prog, + const struct brw_wm_prog_key *key, + struct brw_wm_prog_data *prog_data) +{ + uint32_t next_binding_table_offset = 0; + + /* If there are no color regions, we still perform an FB write to a null + * renderbuffer, which we place at surface index 0. + */ + prog_data->binding_table.render_target_start = next_binding_table_offset; + next_binding_table_offset += MAX2(key->nr_color_regions, 1); + + brw_assign_common_binding_table_offsets(MESA_SHADER_FRAGMENT, devinfo, + shader_prog, prog, &prog_data->base, + next_binding_table_offset); +} + /** * All Mesa program -> GPU code generation goes through this function. * Depending on the instructions used (i.e. flow control instructions) @@ -170,6 +190,9 @@ brw_codegen_wm_prog(struct brw_context *brw, if (!prog) prog_data.base.use_alt_mode = true; + assign_fs_binding_table_offsets(brw->intelScreen->devinfo, prog, + &fp->program.Base, key, &prog_data); + /* Allocate the references to the uniforms that will end up in the * prog_data associated with the compiled program, and which will be freed * by the state cache. |