diff options
author | Eric Anholt <[email protected]> | 2013-10-02 18:53:04 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2013-10-15 10:18:45 -0700 |
commit | 4e5306453da6a1c076309e543ec92d999e02f67a (patch) | |
tree | c844468b4cd513e1bbf11e023082890e0b1412ca /src/mesa/drivers/dri/i965/brw_fs.cpp | |
parent | 3c9dc2d31b80fc73bffa1f40a91443a53229c8e2 (diff) |
i965/fs: Dynamically set up the WM binding table offsets.
Reviewed-by: Paul Berry <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_fs.cpp')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs.cpp | 35 |
1 files changed, 29 insertions, 6 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 265b4aaa050..4d83c079c98 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -2981,12 +2981,35 @@ fs_visitor::setup_payload_gen6() void fs_visitor::assign_binding_table_offsets() { - c->prog_data.binding_table.render_target_start = SURF_INDEX_DRAW(0); - c->prog_data.base.binding_table.texture_start = SURF_INDEX_TEXTURE(0); - c->prog_data.base.binding_table.ubo_start = SURF_INDEX_WM_UBO(0); - c->prog_data.base.binding_table.shader_time_start = SURF_INDEX_WM_SHADER_TIME; - c->prog_data.base.binding_table.gather_texture_start = SURF_INDEX_GATHER_TEXTURE(0); - c->prog_data.base.binding_table.pull_constants_start = SURF_INDEX_FRAG_CONST_BUFFER; + int num_textures = _mesa_fls(fp->Base.SamplersUsed); + int next = 0; + + c->prog_data.binding_table.render_target_start = next; + next += c->key.nr_color_regions; + + c->prog_data.base.binding_table.texture_start = next; + next += num_textures; + + if (shader) { + c->prog_data.base.binding_table.ubo_start = next; + next += shader->base.NumUniformBlocks; + } + + if (INTEL_DEBUG & DEBUG_SHADER_TIME) { + c->prog_data.base.binding_table.shader_time_start = next; + next++; + } + + if (fp->Base.UsesGather) { + c->prog_data.base.binding_table.gather_texture_start = next; + next += num_textures; + } + + /* This may or may not be used depending on how the compile goes. */ + c->prog_data.base.binding_table.pull_constants_start = next; + next++; + + assert(next < BRW_MAX_SURFACES); /* c->prog_data.base.binding_table.size will be set by mark_surface_used. */ } |