diff options
author | Gert Wollny <[email protected]> | 2020-05-09 19:39:40 +0200 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-05-19 07:52:13 +0000 |
commit | 7c247f505c253f6f2eb6652f176e21681219734c (patch) | |
tree | 2732625f0591f32fb84aff14d797b2f57bd5cf78 | |
parent | cd2d7966ac44697d31684e2b5b5b492142915a1e (diff) |
r600/sfn: use the per shader atomic base
Signed-off-by: Gert Wollny <[email protected]>
Reviewed-by: Reviewed-by: Dave Airlie <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5085>
8 files changed, 16 insertions, 10 deletions
diff --git a/src/gallium/drivers/r600/sfn/sfn_shader_base.cpp b/src/gallium/drivers/r600/sfn/sfn_shader_base.cpp index 2e65d8dafb2..be869921fe1 100644 --- a/src/gallium/drivers/r600/sfn/sfn_shader_base.cpp +++ b/src/gallium/drivers/r600/sfn/sfn_shader_base.cpp @@ -59,7 +59,8 @@ using namespace std; ShaderFromNirProcessor::ShaderFromNirProcessor(pipe_shader_type ptype, r600_pipe_shader_selector& sel, r600_shader &sh_info, int scratch_size, - enum chip_class chip_class): + enum chip_class chip_class, + int atomic_base): m_processor_type(ptype), m_nesting_depth(0), m_block_number(0), @@ -72,9 +73,12 @@ ShaderFromNirProcessor::ShaderFromNirProcessor(pipe_shader_type ptype, m_pending_else(nullptr), m_scratch_size(scratch_size), m_next_hwatomic_loc(0), - m_sel(sel) + m_sel(sel), + m_atomic_base(atomic_base) + { m_sh_info.processor_type = ptype; + } @@ -198,7 +202,7 @@ bool ShaderFromNirProcessor::process_uniforms(nir_variable *uniform) struct r600_shader_atomic& atom = sh_info().atomics[sh_info().nhwatomic_ranges]; ++sh_info().nhwatomic_ranges; atom.buffer_id = uniform->data.binding; - atom.hw_idx = m_next_hwatomic_loc; + atom.hw_idx = m_atomic_base + m_next_hwatomic_loc; atom.start = m_next_hwatomic_loc; atom.end = atom.start + natomics - 1; m_next_hwatomic_loc = atom.end + 1; diff --git a/src/gallium/drivers/r600/sfn/sfn_shader_base.h b/src/gallium/drivers/r600/sfn/sfn_shader_base.h index 27afe4023d4..878e5b7e87d 100644 --- a/src/gallium/drivers/r600/sfn/sfn_shader_base.h +++ b/src/gallium/drivers/r600/sfn/sfn_shader_base.h @@ -56,7 +56,8 @@ extern SfnLog sfn_log; class ShaderFromNirProcessor : public ValuePool { public: ShaderFromNirProcessor(pipe_shader_type ptype, r600_pipe_shader_selector& sel, - r600_shader& sh_info, int scratch_size, enum chip_class _chip_class); + r600_shader& sh_info, int scratch_size, enum chip_class _chip_class, + int atomic_base); virtual ~ShaderFromNirProcessor(); void emit_instruction(Instruction *ir); @@ -206,6 +207,7 @@ private: int m_next_hwatomic_loc; r600_pipe_shader_selector& m_sel; + int m_atomic_base ; }; } diff --git a/src/gallium/drivers/r600/sfn/sfn_shader_compute.cpp b/src/gallium/drivers/r600/sfn/sfn_shader_compute.cpp index 2d458ad838c..f7e9ce564e4 100644 --- a/src/gallium/drivers/r600/sfn/sfn_shader_compute.cpp +++ b/src/gallium/drivers/r600/sfn/sfn_shader_compute.cpp @@ -34,7 +34,7 @@ ComputeShaderFromNir::ComputeShaderFromNir(r600_pipe_shader *sh, UNUSED const r600_shader_key& key, enum chip_class chip_class): ShaderFromNirProcessor (PIPE_SHADER_COMPUTE, sel, sh->shader, - sh->scratch_space_needed, chip_class), + sh->scratch_space_needed, chip_class, 0), m_reserved_registers(0) { } diff --git a/src/gallium/drivers/r600/sfn/sfn_shader_fragment.cpp b/src/gallium/drivers/r600/sfn/sfn_shader_fragment.cpp index 43e470532ba..36ac806e507 100644 --- a/src/gallium/drivers/r600/sfn/sfn_shader_fragment.cpp +++ b/src/gallium/drivers/r600/sfn/sfn_shader_fragment.cpp @@ -36,7 +36,7 @@ FragmentShaderFromNir::FragmentShaderFromNir(const nir_shader& nir, r600_pipe_shader_selector &sel, const r600_shader_key &key, enum chip_class chip_class): - ShaderFromNirProcessor(PIPE_SHADER_FRAGMENT, sel, sh, nir.scratch_size, chip_class), + ShaderFromNirProcessor(PIPE_SHADER_FRAGMENT, sel, sh, nir.scratch_size, chip_class, 0), m_max_color_exports(MAX2(key.ps.nr_cbufs,1)), m_max_counted_color_exports(0), m_two_sided_color(key.ps.color_two_side), diff --git a/src/gallium/drivers/r600/sfn/sfn_shader_geometry.cpp b/src/gallium/drivers/r600/sfn/sfn_shader_geometry.cpp index 182035c4be9..5155488541d 100644 --- a/src/gallium/drivers/r600/sfn/sfn_shader_geometry.cpp +++ b/src/gallium/drivers/r600/sfn/sfn_shader_geometry.cpp @@ -36,7 +36,7 @@ GeometryShaderFromNir::GeometryShaderFromNir(r600_pipe_shader *sh, const r600_shader_key &key, enum chip_class chip_class): VertexStage(PIPE_SHADER_GEOMETRY, sel, sh->shader, - sh->scratch_space_needed, chip_class), + sh->scratch_space_needed, chip_class, key.gs.first_atomic_counter), m_pipe_shader(sh), m_so_info(&sel.so), m_first_vertex_emitted(false), diff --git a/src/gallium/drivers/r600/sfn/sfn_shader_tcs.cpp b/src/gallium/drivers/r600/sfn/sfn_shader_tcs.cpp index 78a97b32025..2c94c5b0bf7 100644 --- a/src/gallium/drivers/r600/sfn/sfn_shader_tcs.cpp +++ b/src/gallium/drivers/r600/sfn/sfn_shader_tcs.cpp @@ -9,7 +9,7 @@ TcsShaderFromNir::TcsShaderFromNir(r600_pipe_shader *sh, const r600_shader_key& key, enum chip_class chip_class): ShaderFromNirProcessor (PIPE_SHADER_TESS_CTRL, sel, sh->shader, - sh->scratch_space_needed, chip_class), + sh->scratch_space_needed, chip_class, key.tcs.first_atomic_counter), m_reserved_registers(0) { sh_info().tcs_prim_mode = key.tcs.prim_mode; diff --git a/src/gallium/drivers/r600/sfn/sfn_shader_tess_eval.cpp b/src/gallium/drivers/r600/sfn/sfn_shader_tess_eval.cpp index e8616fcb2b8..9e5ce57b309 100644 --- a/src/gallium/drivers/r600/sfn/sfn_shader_tess_eval.cpp +++ b/src/gallium/drivers/r600/sfn/sfn_shader_tess_eval.cpp @@ -7,7 +7,7 @@ TEvalShaderFromNir::TEvalShaderFromNir(r600_pipe_shader *sh, r600_pipe_shader_se const r600_shader_key& key, r600_shader *gs_shader, enum chip_class chip_class): VertexStage(PIPE_SHADER_TESS_EVAL, sel, sh->shader, - sh->scratch_space_needed, chip_class), + sh->scratch_space_needed, chip_class, key.tes.first_atomic_counter), m_reserved_registers(0), m_key(key) diff --git a/src/gallium/drivers/r600/sfn/sfn_shader_vertex.cpp b/src/gallium/drivers/r600/sfn/sfn_shader_vertex.cpp index c3cd020b4dc..2447a07d5c3 100644 --- a/src/gallium/drivers/r600/sfn/sfn_shader_vertex.cpp +++ b/src/gallium/drivers/r600/sfn/sfn_shader_vertex.cpp @@ -43,7 +43,7 @@ VertexShaderFromNir::VertexShaderFromNir(r600_pipe_shader *sh, struct r600_shader* gs_shader, enum chip_class chip_class): VertexStage(PIPE_SHADER_VERTEX, sel, sh->shader, - sh->scratch_space_needed, chip_class), + sh->scratch_space_needed, chip_class, key.vs.first_atomic_counter), m_num_clip_dist(0), m_last_param_export(nullptr), m_last_pos_export(nullptr), |