diff options
author | Jordan Justen <[email protected]> | 2015-09-24 01:20:55 -0700 |
---|---|---|
committer | Jordan Justen <[email protected]> | 2015-09-29 08:23:47 -0700 |
commit | d1be9d21265cf4e344a5d78b17cea7ee2c8408a1 (patch) | |
tree | 453c158fe85a2681adf23098c60ffe9755a76822 /src/mesa/drivers/dri/i965/brw_fs.cpp | |
parent | d57a85f32b2242e19c2d20e91af0218d41e1e9fe (diff) |
i965/cs: Add a binding table entry for gl_NumWorkGroups
If glDispatchComputeIndirect is used, then the value for this variable
must be read from the indirect BO.
To allow the same generated code to support indirect and
glDispatchCompute, we will also setup a BO for the number of work
groups using the intel_upload_data mechanism. This will only be
required if the gl_NumWorkGroups variable is accessed.
Signed-off-by: Jordan Justen <[email protected]>
Reviewed-by: Kristian Høgsberg <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_fs.cpp')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs.cpp | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 49dc7f65b48..64215ae5a6a 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -4750,7 +4750,7 @@ fs_visitor::setup_cs_payload() } void -fs_visitor::assign_binding_table_offsets() +fs_visitor::assign_fs_binding_table_offsets() { assert(stage == MESA_SHADER_FRAGMENT); brw_wm_prog_data *prog_data = (brw_wm_prog_data*) this->prog_data; @@ -4767,6 +4767,20 @@ fs_visitor::assign_binding_table_offsets() } void +fs_visitor::assign_cs_binding_table_offsets() +{ + assert(stage == MESA_SHADER_COMPUTE); + brw_cs_prog_data *prog_data = (brw_cs_prog_data*) this->prog_data; + uint32_t next_binding_table_offset = 0; + + /* May not be used if the gl_NumWorkGroups variable is not accessed. */ + prog_data->binding_table.work_groups_start = next_binding_table_offset; + next_binding_table_offset++; + + assign_common_binding_table_offsets(next_binding_table_offset); +} + +void fs_visitor::calculate_register_pressure() { invalidate_live_intervals(); @@ -5020,7 +5034,7 @@ fs_visitor::run_fs(bool do_rep_send) sanity_param_count = prog->Parameters->NumParameters; - assign_binding_table_offsets(); + assign_fs_binding_table_offsets(); if (devinfo->gen >= 6) setup_payload_gen6(); @@ -5108,7 +5122,7 @@ fs_visitor::run_cs() sanity_param_count = prog->Parameters->NumParameters; - assign_common_binding_table_offsets(0); + assign_cs_binding_table_offsets(); setup_cs_payload(); |