glsl: Switch to use nir_foreach_function_impl from nir_foreach_function
authorYonggang Luo <luoyonggang@gmail.com>
Wed, 28 Jun 2023 11:00:27 +0000 (19:00 +0800)
committerMarge Bot <emma+marge@anholt.net>
Thu, 29 Jun 2023 11:29:54 +0000 (11:29 +0000)
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23920>

src/compiler/glsl/gl_nir_link_uniforms.c
src/compiler/glsl/gl_nir_link_varyings.c
src/compiler/glsl/gl_nir_linker.c
src/compiler/glsl/gl_nir_lower_buffers.c
src/compiler/glsl/tests/test_gl_lower_mediump.cpp

index 49345dc..7f8ca8e 100644 (file)
@@ -517,9 +517,9 @@ add_var_use_shader(nir_shader *shader, struct hash_table *live)
    /* Size of the derefs buffer in bytes. */
    unsigned derefs_size = 0;
 
-   nir_foreach_function(function, shader) {
-      if (function->impl) {
-         nir_foreach_block(block, function->impl) {
+   nir_foreach_function_impl(impl, shader) {
+      {
+         nir_foreach_block(block, impl) {
             nir_foreach_instr(instr, block) {
                if (instr->type == nir_instr_type_intrinsic) {
                   nir_intrinsic_instr *intr = nir_instr_as_intrinsic(instr);
index fe9eece..5d5c923 100644 (file)
@@ -2039,11 +2039,8 @@ get_num_components(nir_variable *var)
 static void
 tcs_add_output_reads(nir_shader *shader, BITSET_WORD **read)
 {
-   nir_foreach_function(function, shader) {
-      if (!function->impl)
-         continue;
-
-      nir_foreach_block(block, function->impl) {
+   nir_foreach_function_impl(impl, shader) {
+      nir_foreach_block(block, impl) {
          nir_foreach_instr(instr, block) {
             if (instr->type != nir_instr_type_intrinsic)
                continue;
index ea933cd..bd54a74 100644 (file)
@@ -874,8 +874,8 @@ validate_sampler_array_indexing(const struct gl_constants *consts,
          consts->ShaderCompilerOptions[i].NirOptions->force_indirect_unrolling_sampler;
 
       bool uses_indirect_sampler_array_indexing = false;
-      nir_foreach_function(function, prog->_LinkedShaders[i]->Program->nir) {
-         nir_foreach_block(block, function->impl) {
+      nir_foreach_function_impl(impl, prog->_LinkedShaders[i]->Program->nir) {
+         nir_foreach_block(block, impl) {
             nir_foreach_instr(instr, block) {
                /* Check if a sampler array is accessed indirectly */
                if (instr->type == nir_instr_type_tex) {
index b90ab46..2855e2f 100644 (file)
@@ -341,9 +341,8 @@ gl_nir_lower_buffers(nir_shader *shader,
     * a nir_address_format_32bit_index_offset pointer.  From there forward,
     * we leave the derefs in place and let nir_lower_explicit_io handle them.
     */
-   nir_foreach_function(function, shader) {
-      if (function->impl &&
-          lower_buffer_interface_derefs_impl(function->impl, shader_program))
+   nir_foreach_function_impl(impl, shader) {
+      if (lower_buffer_interface_derefs_impl(impl, shader_program))
          progress = true;
    }
 
index 5316ac0..91aff57 100644 (file)
@@ -60,9 +60,9 @@ namespace
          if (!nir)
             return NULL;
 
-         nir_foreach_function(func, nir)
+         nir_foreach_function_impl(impl, nir)
          {
-            nir_foreach_block(block, func->impl)
+            nir_foreach_block(block, impl)
             {
                nir_foreach_instr(instr, block)
                {