r600/sfn: read number of images from shader info
authorGert Wollny <gert.wollny@collabora.com>
Sun, 2 May 2021 18:23:11 +0000 (20:23 +0200)
committerGert Wollny <gert.wollny@collabora.com>
Tue, 18 May 2021 20:16:07 +0000 (22:16 +0200)
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10608>

src/gallium/drivers/r600/sfn/sfn_nir.cpp
src/gallium/drivers/r600/sfn/sfn_shader_base.cpp
src/gallium/drivers/r600/sfn/sfn_shader_base.h

index 76310f9..275df7a 100644 (file)
@@ -303,6 +303,7 @@ bool ShaderFromNir::emit_instruction(nir_instr *instr)
 
 bool ShaderFromNir::process_declaration()
 {
+   impl->set_shader_info(sh);
 
    if (!impl->scan_inputs_read(sh))
       return false;
index e37e273..ed3f1b5 100644 (file)
@@ -285,13 +285,20 @@ bool ShaderFromNirProcessor::process_uniforms(nir_variable *uniform)
          sh_info().indirect_files |= 1 << TGSI_FILE_IMAGE;
    }
 
-   if (uniform->type->is_image()) {
-      ++m_image_count;
-   }
-
    return true;
 }
 
+void ShaderFromNirProcessor::set_shader_info(const nir_shader *sh)
+{
+   m_image_count = sh->info.num_images;
+   do_set_shader_info(sh);
+}
+
+void ShaderFromNirProcessor::do_set_shader_info(const nir_shader *sh)
+{
+   (void)sh;
+}
+
 bool ShaderFromNirProcessor::scan_inputs_read(const nir_shader *sh)
 {
    return true;
index a48674d..df1eff4 100644 (file)
@@ -93,6 +93,7 @@ public:
    void get_array_info(r600_shader& shader) const;
 
    virtual bool scan_inputs_read(const nir_shader *sh);
+   void set_shader_info(const nir_shader *sh);
 
 protected:
 
@@ -123,6 +124,8 @@ protected:
 
    void inc_atomic_file_count();
 
+   virtual void do_set_shader_info(const nir_shader *sh);
+
    enum ESlots {
       es_face,
       es_instanceid,