r600/sfn: use the per shader atomic base

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>
This commit is contained in:
Gert Wollny 2020-05-09 19:39:40 +02:00 committed by Marge Bot
parent cd2d7966ac
commit 7c247f505c
8 changed files with 16 additions and 10 deletions

View 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;

View 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 ;
};
}

View 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)
{
}

View 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),

View 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),

View 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;

View 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)

View 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),