r600/sfn: use the per shader atomic base
authorGert Wollny <gert.wollny@collabora.com>
Sat, 9 May 2020 17:39:40 +0000 (19:39 +0200)
committerMarge Bot <eric+marge@anholt.net>
Tue, 19 May 2020 07:52:13 +0000 (07:52 +0000)
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5085>

src/gallium/drivers/r600/sfn/sfn_shader_base.cpp
src/gallium/drivers/r600/sfn/sfn_shader_base.h
src/gallium/drivers/r600/sfn/sfn_shader_compute.cpp
src/gallium/drivers/r600/sfn/sfn_shader_fragment.cpp
src/gallium/drivers/r600/sfn/sfn_shader_geometry.cpp
src/gallium/drivers/r600/sfn/sfn_shader_tcs.cpp
src/gallium/drivers/r600/sfn/sfn_shader_tess_eval.cpp
src/gallium/drivers/r600/sfn/sfn_shader_vertex.cpp

index 2e65d8dafb24e503dc97110ed612336316b11d19..be869921fe1458eca9fdb3421a6d77d1da3623f5 100644 (file)
@@ -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;
index 27afe4023d4fe92a3bdf5e3c9c38717856a983b2..878e5b7e87dbd0df3990f4119ff2e48969b9d05a 100644 (file)
@@ -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 ;
 };
 
 }
index 2d458ad838cf42949ffb08e00b2aac3d33cfc52e..f7e9ce564e408a650130add9a57813b615c7ac5d 100644 (file)
@@ -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)
 {
 }
index 43e470532ba5bb9a11c9d934497b7e67018cf7f9..36ac806e507035016fcc92c70442ac7ea833c274 100644 (file)
@@ -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),
index 182035c4be9a7c472be86a1eb03182caaa102e65..5155488541d1ceb88c9feadc12efe729fcef39ef 100644 (file)
@@ -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),
index 78a97b3202514f0108fb6f26c1c248c66e889a12..2c94c5b0bf78705ccd76e47b4e878081ebf7143e 100644 (file)
@@ -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;
index e8616fcb2b83cc81b417edb60fb14ea0b76a9953..9e5ce57b309bc56f4c04f88524acd6b0dc82b8ba 100644 (file)
@@ -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)
 
index c3cd020b4dc7b812703f5f47b4af38402617269b..2447a07d5c34ee375d7ffb0becc38df5f60d782a 100644 (file)
@@ -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),