r600/sfn: remove old deref code
Signed-off-by: Gert Wollny <gert.wollny@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9874>
This commit is contained in:
@@ -307,14 +307,6 @@ bool ShaderFromNir::process_declaration()
|
||||
if (!impl->scan_inputs_read(sh))
|
||||
return false;
|
||||
|
||||
// scan declarations
|
||||
nir_foreach_shader_out_variable(variable, sh) {
|
||||
if (!impl->process_outputs(variable)) {
|
||||
fprintf(stderr, "R600: error parsing outputs variable %s\n", variable->name);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// scan declarations
|
||||
nir_foreach_variable_with_modes(variable, sh, nir_var_uniform |
|
||||
nir_var_mem_ubo |
|
||||
|
@@ -297,11 +297,6 @@ bool ShaderFromNirProcessor::scan_inputs_read(const nir_shader *sh)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ShaderFromNirProcessor::process_outputs(nir_variable *output)
|
||||
{
|
||||
return do_process_outputs(output);
|
||||
}
|
||||
|
||||
void ShaderFromNirProcessor::set_var_address(nir_deref_instr *instr)
|
||||
{
|
||||
auto& dest = instr->dest;
|
||||
@@ -638,8 +633,6 @@ bool ShaderFromNirProcessor::emit_intrinsic_instruction(nir_intrinsic_instr* ins
|
||||
return false;
|
||||
}
|
||||
switch (mode_helper->second) {
|
||||
case nir_var_shader_in:
|
||||
return emit_load_input_deref(var, instr);
|
||||
case nir_var_function_temp:
|
||||
return emit_load_function_temp(var, instr);
|
||||
default:
|
||||
@@ -652,8 +645,6 @@ bool ShaderFromNirProcessor::emit_intrinsic_instruction(nir_intrinsic_instr* ins
|
||||
return emit_store_scratch(instr);
|
||||
case nir_intrinsic_load_scratch:
|
||||
return emit_load_scratch(instr);
|
||||
case nir_intrinsic_store_deref:
|
||||
return emit_store_deref(instr);
|
||||
case nir_intrinsic_load_uniform:
|
||||
return load_uniform(instr);
|
||||
case nir_intrinsic_discard:
|
||||
@@ -964,12 +955,6 @@ bool ShaderFromNirProcessor::emit_discard_if(nir_intrinsic_instr* instr)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ShaderFromNirProcessor::emit_load_input_deref(const nir_variable *var,
|
||||
nir_intrinsic_instr* instr)
|
||||
{
|
||||
return do_emit_load_deref(var, instr);
|
||||
}
|
||||
|
||||
bool ShaderFromNirProcessor::load_uniform(nir_intrinsic_instr* instr)
|
||||
{
|
||||
r600::sfn_log << SfnLog::instr << __func__ << ": emit '"
|
||||
@@ -1090,15 +1075,6 @@ PValue ShaderFromNirProcessor::from_nir_with_fetch_constant(const nir_src& src,
|
||||
return value;
|
||||
}
|
||||
|
||||
bool ShaderFromNirProcessor::emit_store_deref(nir_intrinsic_instr* instr)
|
||||
{
|
||||
auto out_var = get_deref_location(instr->src[0]);
|
||||
if (!out_var)
|
||||
return false;
|
||||
|
||||
return do_emit_store_deref(out_var, instr);
|
||||
}
|
||||
|
||||
bool ShaderFromNirProcessor::emit_deref_instruction(nir_deref_instr* instr)
|
||||
{
|
||||
r600::sfn_log << SfnLog::instr << __func__ << ": emit '"
|
||||
|
@@ -163,25 +163,16 @@ private:
|
||||
bool load_uniform_indirect(nir_intrinsic_instr* instr, PValue addr, int offest, int bufid);
|
||||
|
||||
/* Code creating functions */
|
||||
bool emit_load_input_deref(const nir_variable *var, nir_intrinsic_instr* instr);
|
||||
bool emit_load_function_temp(const nir_variable *var, nir_intrinsic_instr *instr);
|
||||
AluInstruction *emit_load_literal(const nir_load_const_instr *literal, const nir_src& src, unsigned writemask);
|
||||
|
||||
bool emit_store_deref(nir_intrinsic_instr* instr);
|
||||
|
||||
bool load_uniform(nir_intrinsic_instr* instr);
|
||||
bool process_uniforms(nir_variable *uniform);
|
||||
bool process_inputs(nir_variable *input);
|
||||
bool process_outputs(nir_variable *output);
|
||||
|
||||
void append_block(int nesting_change);
|
||||
|
||||
virtual void emit_shader_start();
|
||||
virtual bool emit_deref_instruction_override(nir_deref_instr* instr);
|
||||
virtual bool do_process_outputs(nir_variable *output) = 0;
|
||||
virtual bool do_emit_load_deref(const nir_variable *in_var, nir_intrinsic_instr* instr) = 0;
|
||||
virtual bool do_emit_store_deref(const nir_variable *out_var, nir_intrinsic_instr* instr) = 0;
|
||||
|
||||
|
||||
bool emit_store_scratch(nir_intrinsic_instr* instr);
|
||||
bool emit_load_scratch(nir_intrinsic_instr* instr);
|
||||
|
@@ -104,22 +104,6 @@ bool ComputeShaderFromNir::emit_load_num_work_groups(nir_intrinsic_instr* instr)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ComputeShaderFromNir::do_process_outputs(UNUSED nir_variable *output)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ComputeShaderFromNir::do_emit_load_deref(UNUSED const nir_variable *in_var,
|
||||
UNUSED nir_intrinsic_instr* instr)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ComputeShaderFromNir::do_emit_store_deref(UNUSED const nir_variable *out_var,
|
||||
UNUSED nir_intrinsic_instr* instr)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
void ComputeShaderFromNir::do_finalize()
|
||||
{
|
||||
|
||||
|
@@ -47,9 +47,6 @@ private:
|
||||
bool emit_intrinsic_instruction_override(nir_intrinsic_instr* instr) override;
|
||||
|
||||
bool do_allocate_reserved_registers() override;
|
||||
bool do_process_outputs(nir_variable *output) override;
|
||||
bool do_emit_load_deref(const nir_variable *in_var, nir_intrinsic_instr* instr) override;
|
||||
bool do_emit_store_deref(const nir_variable *out_var, nir_intrinsic_instr* instr) override;
|
||||
void do_finalize() override;
|
||||
|
||||
bool emit_load_3vec(nir_intrinsic_instr* instr, const std::array<PValue,3>& src);
|
||||
|
@@ -60,12 +60,6 @@ FragmentShaderFromNir::FragmentShaderFromNir(const nir_shader& nir,
|
||||
sh_info().atomic_base = key.ps.first_atomic_counter;
|
||||
}
|
||||
|
||||
bool FragmentShaderFromNir::do_emit_load_deref(const nir_variable *in_var, nir_intrinsic_instr* instr)
|
||||
{
|
||||
assert(0 && "all input derefs should have been lowered");
|
||||
return false;
|
||||
}
|
||||
|
||||
unsigned barycentric_ij_index(nir_intrinsic_instr *instr)
|
||||
{
|
||||
unsigned index = 0;
|
||||
@@ -430,23 +424,6 @@ void FragmentShaderFromNir::emit_shader_start()
|
||||
}
|
||||
}
|
||||
|
||||
bool FragmentShaderFromNir::do_emit_store_deref(const nir_variable *out_var, nir_intrinsic_instr* instr)
|
||||
{
|
||||
if (out_var->data.location == FRAG_RESULT_COLOR)
|
||||
return emit_export_pixel(out_var, instr, m_dual_source_blend ? 1 : m_max_color_exports);
|
||||
|
||||
if ((out_var->data.location >= FRAG_RESULT_DATA0 &&
|
||||
out_var->data.location <= FRAG_RESULT_DATA7) ||
|
||||
out_var->data.location == FRAG_RESULT_DEPTH ||
|
||||
out_var->data.location == FRAG_RESULT_STENCIL ||
|
||||
out_var->data.location == FRAG_RESULT_SAMPLE_MASK)
|
||||
return emit_export_pixel(out_var, instr, 1);
|
||||
|
||||
sfn_log << SfnLog::err << "r600-NIR: Unimplemented store_deref for " <<
|
||||
out_var->data.location << "(" << out_var->data.driver_location << ")\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
bool FragmentShaderFromNir::process_store_output(nir_intrinsic_instr *instr)
|
||||
{
|
||||
|
||||
@@ -489,55 +466,6 @@ bool FragmentShaderFromNir::process_store_output(nir_intrinsic_instr *instr)
|
||||
|
||||
}
|
||||
|
||||
bool FragmentShaderFromNir::do_process_outputs(nir_variable *output)
|
||||
{
|
||||
sfn_log << SfnLog::io << "Parse output variable "
|
||||
<< output->name << " @" << output->data.location
|
||||
<< "@dl:" << output->data.driver_location
|
||||
<< " dual source idx: " << output->data.index
|
||||
<< "\n";
|
||||
|
||||
++sh_info().noutput;
|
||||
r600_shader_io& io = sh_info().output[output->data.driver_location];
|
||||
tgsi_get_gl_frag_result_semantic(static_cast<gl_frag_result>( output->data.location),
|
||||
&io.name, &io.sid);
|
||||
|
||||
/* Check whether this code has become obsolete by the IO vectorization */
|
||||
unsigned num_components = 4;
|
||||
unsigned vector_elements = glsl_get_vector_elements(glsl_without_array(output->type));
|
||||
if (vector_elements)
|
||||
num_components = vector_elements;
|
||||
unsigned component = output->data.location_frac;
|
||||
|
||||
for (unsigned j = component; j < num_components + component; j++)
|
||||
io.write_mask |= 1 << j;
|
||||
|
||||
int loc = output->data.location;
|
||||
if (loc == FRAG_RESULT_COLOR &&
|
||||
(m_nir.info.outputs_written & (1ull << loc)) &&
|
||||
!m_dual_source_blend) {
|
||||
sh_info().fs_write_all = true;
|
||||
}
|
||||
|
||||
if (output->data.location == FRAG_RESULT_COLOR ||
|
||||
(output->data.location >= FRAG_RESULT_DATA0 &&
|
||||
output->data.location <= FRAG_RESULT_DATA7)) {
|
||||
++m_max_counted_color_exports;
|
||||
|
||||
if (m_max_counted_color_exports > 1)
|
||||
sh_info().fs_write_all = false;
|
||||
return true;
|
||||
}
|
||||
if (output->data.location == FRAG_RESULT_DEPTH ||
|
||||
output->data.location == FRAG_RESULT_STENCIL ||
|
||||
output->data.location == FRAG_RESULT_SAMPLE_MASK) {
|
||||
io.write_mask = 15;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool FragmentShaderFromNir::emit_load_sample_mask_in(nir_intrinsic_instr* instr)
|
||||
{
|
||||
auto dest = from_nir(instr->dest, 0);
|
||||
|
@@ -50,11 +50,8 @@ private:
|
||||
|
||||
void emit_shader_start() override;
|
||||
bool do_allocate_reserved_registers() override;
|
||||
bool do_process_outputs(nir_variable *output) override;
|
||||
bool process_store_output(nir_intrinsic_instr *instr);
|
||||
|
||||
bool do_emit_load_deref(const nir_variable *in_var, nir_intrinsic_instr* instr) override;
|
||||
bool do_emit_store_deref(const nir_variable *out_var, nir_intrinsic_instr* instr) override;
|
||||
bool emit_store_output(nir_intrinsic_instr* instr);
|
||||
|
||||
bool emit_export_pixel(const nir_variable *, nir_intrinsic_instr* instr, int outputs);
|
||||
|
@@ -51,16 +51,6 @@ GeometryShaderFromNir::GeometryShaderFromNir(r600_pipe_shader *sh,
|
||||
sh_info().atomic_base = key.gs.first_atomic_counter;
|
||||
}
|
||||
|
||||
bool GeometryShaderFromNir::do_emit_load_deref(UNUSED const nir_variable *in_var, UNUSED nir_intrinsic_instr* instr)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool GeometryShaderFromNir::do_emit_store_deref(UNUSED const nir_variable *out_var, UNUSED nir_intrinsic_instr* instr)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool GeometryShaderFromNir::emit_store(nir_intrinsic_instr* instr)
|
||||
{
|
||||
auto location = nir_intrinsic_io_semantics(instr).location;
|
||||
@@ -193,50 +183,6 @@ bool GeometryShaderFromNir::process_load_input(nir_intrinsic_instr* instr)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool GeometryShaderFromNir::do_process_outputs(nir_variable *output)
|
||||
{
|
||||
if (output->data.location == VARYING_SLOT_COL0 ||
|
||||
output->data.location == VARYING_SLOT_COL1 ||
|
||||
(output->data.location >= VARYING_SLOT_VAR0 &&
|
||||
output->data.location <= VARYING_SLOT_VAR31) ||
|
||||
(output->data.location >= VARYING_SLOT_TEX0 &&
|
||||
output->data.location <= VARYING_SLOT_TEX7) ||
|
||||
output->data.location == VARYING_SLOT_BFC0 ||
|
||||
output->data.location == VARYING_SLOT_BFC1 ||
|
||||
output->data.location == VARYING_SLOT_PNTC ||
|
||||
output->data.location == VARYING_SLOT_CLIP_VERTEX ||
|
||||
output->data.location == VARYING_SLOT_CLIP_DIST0 ||
|
||||
output->data.location == VARYING_SLOT_CLIP_DIST1 ||
|
||||
output->data.location == VARYING_SLOT_PRIMITIVE_ID ||
|
||||
output->data.location == VARYING_SLOT_POS ||
|
||||
output->data.location == VARYING_SLOT_PSIZ ||
|
||||
output->data.location == VARYING_SLOT_LAYER ||
|
||||
output->data.location == VARYING_SLOT_VIEWPORT ||
|
||||
output->data.location == VARYING_SLOT_FOGC) {
|
||||
r600_shader_io& io = sh_info().output[output->data.driver_location];
|
||||
|
||||
auto semantic = r600_get_varying_semantic(output->data.location);
|
||||
io.name = semantic.first;
|
||||
io.sid = semantic.second;
|
||||
|
||||
evaluate_spi_sid(io);
|
||||
++sh_info().noutput;
|
||||
|
||||
if (output->data.location == VARYING_SLOT_CLIP_DIST0 ||
|
||||
output->data.location == VARYING_SLOT_CLIP_DIST1) {
|
||||
m_clip_dist_mask |= 1 << (output->data.location - VARYING_SLOT_CLIP_DIST0);
|
||||
}
|
||||
|
||||
if (output->data.location == VARYING_SLOT_VIEWPORT) {
|
||||
sh_info().vs_out_viewport = 1;
|
||||
sh_info().vs_out_misc_write = 1;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool GeometryShaderFromNir::do_allocate_reserved_registers()
|
||||
{
|
||||
const int sel[6] = {0, 0 ,0, 1, 1, 1};
|
||||
|
@@ -41,11 +41,8 @@ public:
|
||||
PValue primitive_id() override {return m_primitive_id;}
|
||||
|
||||
private:
|
||||
bool do_emit_load_deref(const nir_variable *in_var, nir_intrinsic_instr* instr) override;
|
||||
bool do_emit_store_deref(const nir_variable *out_var, nir_intrinsic_instr* instr) override;
|
||||
|
||||
bool do_allocate_reserved_registers() override;
|
||||
bool do_process_outputs(nir_variable *output) override;
|
||||
bool emit_intrinsic_instruction_override(nir_intrinsic_instr* instr) override;
|
||||
|
||||
bool emit_vertex(nir_intrinsic_instr* instr, bool cut);
|
||||
|
@@ -42,20 +42,6 @@ bool TcsShaderFromNir::scan_sysvalue_access(nir_instr *instr)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TcsShaderFromNir::do_process_outputs(nir_variable *output)
|
||||
{
|
||||
unsigned name, sid;
|
||||
|
||||
tgsi_get_gl_varying_semantic(static_cast<gl_varying_slot>(output->data.location),
|
||||
true, &name, &sid);
|
||||
|
||||
auto& io = sh_info().output[sh_info().noutput++];
|
||||
io.name = name;
|
||||
io.write_mask = ((1 << output->type->components()) - 1)
|
||||
<< output->data.location_frac;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TcsShaderFromNir::do_allocate_reserved_registers()
|
||||
{
|
||||
if (m_sv_values.test(es_primitive_id)) {
|
||||
|
@@ -16,9 +16,6 @@ private:
|
||||
bool emit_intrinsic_instruction_override(nir_intrinsic_instr* instr) override;
|
||||
bool store_tess_factor(nir_intrinsic_instr* instr);
|
||||
|
||||
bool do_process_outputs(nir_variable *output) override;
|
||||
bool do_emit_load_deref(const nir_variable *in_var, nir_intrinsic_instr* instr) override { return true;}
|
||||
bool do_emit_store_deref(const nir_variable *out_var, nir_intrinsic_instr* instr) override { return true;}
|
||||
void do_finalize() override {}
|
||||
|
||||
int m_reserved_registers;
|
||||
|
@@ -99,17 +99,6 @@ bool TEvalShaderFromNir::emit_intrinsic_instruction_override(nir_intrinsic_instr
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool TEvalShaderFromNir::do_process_outputs(nir_variable *output)
|
||||
{
|
||||
return m_export_processor->do_process_outputs(output);
|
||||
}
|
||||
|
||||
bool TEvalShaderFromNir::do_emit_store_deref(const nir_variable *out_var, nir_intrinsic_instr* instr)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void TEvalShaderFromNir::do_finalize()
|
||||
{
|
||||
m_export_processor->finalize_exports();
|
||||
|
@@ -21,9 +21,6 @@ public:
|
||||
bool emit_load_tess_coord(nir_intrinsic_instr* instr);
|
||||
bool load_tess_z_coord(nir_intrinsic_instr* instr);
|
||||
|
||||
bool do_process_outputs(nir_variable *output) override;
|
||||
bool do_emit_load_deref(const nir_variable *in_var, nir_intrinsic_instr* instr) override { return true;}
|
||||
bool do_emit_store_deref(const nir_variable *out_var, nir_intrinsic_instr* instr) override;
|
||||
void do_finalize() override;
|
||||
|
||||
|
||||
|
@@ -222,36 +222,9 @@ bool VertexShaderFromNir::emit_store_local_shared(nir_intrinsic_instr* instr)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool VertexShaderFromNir::do_process_outputs(nir_variable *output)
|
||||
{
|
||||
return m_export_processor->do_process_outputs(output);
|
||||
}
|
||||
|
||||
bool VertexShaderFromNir::do_emit_load_deref(const nir_variable *in_var, nir_intrinsic_instr* instr)
|
||||
{
|
||||
if (in_var->data.location < VERT_ATTRIB_MAX) {
|
||||
for (unsigned i = 0; i < nir_dest_num_components(instr->dest); ++i) {
|
||||
auto src = m_attribs[4 * in_var->data.driver_location + i];
|
||||
|
||||
if (i == 0)
|
||||
set_input(in_var->data.driver_location, src);
|
||||
|
||||
load_preloaded_value(instr->dest, i, src, i == (unsigned)(instr->num_components - 1));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
fprintf(stderr, "r600-NIR: Unimplemented load_deref for %d\n", in_var->data.location);
|
||||
return false;
|
||||
}
|
||||
|
||||
void VertexShaderFromNir::do_finalize()
|
||||
{
|
||||
m_export_processor->finalize_exports();
|
||||
}
|
||||
|
||||
bool VertexShaderFromNir::do_emit_store_deref(const nir_variable *out_var, nir_intrinsic_instr* instr)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -39,7 +39,6 @@ public:
|
||||
const r600_shader_key &key, r600_shader *gs_shader,
|
||||
enum chip_class chip_class);
|
||||
|
||||
bool do_emit_load_deref(const nir_variable *in_var, nir_intrinsic_instr* instr) override;
|
||||
bool scan_sysvalue_access(nir_instr *instr) override;
|
||||
|
||||
PValue primitive_id() override {return m_primitive_id;}
|
||||
@@ -61,12 +60,10 @@ protected:
|
||||
private:
|
||||
bool load_input(nir_intrinsic_instr* instr);
|
||||
|
||||
bool do_emit_store_deref(const nir_variable *out_var, nir_intrinsic_instr* instr) override;
|
||||
void finalize_exports();
|
||||
|
||||
void emit_shader_start() override;
|
||||
bool do_allocate_reserved_registers() override;
|
||||
bool do_process_outputs(nir_variable *output) override;
|
||||
bool emit_intrinsic_instruction_override(nir_intrinsic_instr* instr) override;
|
||||
bool emit_store_local_shared(nir_intrinsic_instr* instr);
|
||||
|
||||
|
Reference in New Issue
Block a user