anv: Don't re-use entry_point pointer from spirv_to_nir
authorCaio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Sat, 18 May 2019 07:29:21 +0000 (00:29 -0700)
committerCaio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Mon, 20 May 2019 23:47:39 +0000 (16:47 -0700)
When running with NIR_TEST_CLONE=1, the pointer will not be valid, as
the whole shader is going to be recreated every pass.  Prefer using
is_entrypoint (to query when looping) and nir_shader_get_entrypoint()
instead.

Fixes the Vulkan Piglit tests
- vulkan/glsl450/frexp-double
- vulkan/glsl450/isinf-double
- vulkan/shaders/fs-multiple-large-local-array

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=108957
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/intel/vulkan/anv_pipeline.c

index e04f1acab4a78783d04bf88c0d460f902cdf25e1..df9a968f854fd08812b43093874cac6cd7fb8413 100644 (file)
@@ -212,7 +212,7 @@ anv_shader_compile_to_nir(struct anv_device *device,
 
    /* Pick off the single entrypoint that we want */
    foreach_list_typed_safe(nir_function, func, node, &nir->functions) {
-      if (func != entry_point)
+      if (!func->is_entrypoint)
          exec_node_remove(&func->node);
    }
    assert(exec_list_length(&nir->functions) == 1);
@@ -238,7 +238,7 @@ anv_shader_compile_to_nir(struct anv_device *device,
 
    NIR_PASS_V(nir, nir_propagate_invariant);
    NIR_PASS_V(nir, nir_lower_io_to_temporaries,
-              entry_point->impl, true, false);
+              nir_shader_get_entrypoint(nir), true, false);
 
    NIR_PASS_V(nir, nir_lower_frexp);