anv,turnip,radv,clover,glspirv: Run nir_copy_prop before nir_opt_deref
[mesa.git] / src / freedreno / vulkan / tu_shader.c
index f0957a33a903990dcd403d1d83bbe1e6d6036414..a98a967359b9a3210b266a426cbeab10f3dea939 100644 (file)
@@ -64,6 +64,7 @@ tu_spirv_to_nir(struct ir3_compiler *compiler,
          .tessellation = true,
          .draw_parameters = true,
          .variable_pointers = true,
+         .stencil_export = true,
       },
    };
    const nir_shader_compiler_options *nir_options =
@@ -673,7 +674,7 @@ tu_shader_create(struct tu_device *dev,
    struct tu_shader *shader;
 
    shader = vk_zalloc2(
-      &dev->alloc, alloc,
+      &dev->vk.alloc, alloc,
       sizeof(*shader),
       8, VK_SYSTEM_ALLOCATION_SCOPE_COMMAND);
    if (!shader)
@@ -699,7 +700,7 @@ tu_shader_create(struct tu_device *dev,
    }
 
    if (!nir) {
-      vk_free2(&dev->alloc, alloc, shader);
+      vk_free2(&dev->vk.alloc, alloc, shader);
       return NULL;
    }
 
@@ -712,6 +713,7 @@ tu_shader_create(struct tu_device *dev,
    NIR_PASS_V(nir, nir_lower_variable_initializers, nir_var_function_temp);
    NIR_PASS_V(nir, nir_lower_returns);
    NIR_PASS_V(nir, nir_inline_functions);
+   NIR_PASS_V(nir, nir_copy_prop);
    NIR_PASS_V(nir, nir_opt_deref);
    foreach_list_typed_safe(nir_function, func, node, &nir->functions) {
       if (!func->is_entrypoint)
@@ -804,7 +806,7 @@ tu_shader_destroy(struct tu_device *dev,
 {
    ir3_shader_destroy(shader->ir3_shader);
 
-   vk_free2(&dev->alloc, alloc, shader);
+   vk_free2(&dev->vk.alloc, alloc, shader);
 }
 
 VkResult
@@ -820,9 +822,9 @@ tu_CreateShaderModule(VkDevice _device,
    assert(pCreateInfo->flags == 0);
    assert(pCreateInfo->codeSize % 4 == 0);
 
-   module = vk_alloc2(&device->alloc, pAllocator,
-                      sizeof(*module) + pCreateInfo->codeSize, 8,
-                      VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
+   module = vk_object_alloc(&device->vk, pAllocator,
+                            sizeof(*module) + pCreateInfo->codeSize,
+                            VK_OBJECT_TYPE_SHADER_MODULE);
    if (module == NULL)
       return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
 
@@ -847,5 +849,5 @@ tu_DestroyShaderModule(VkDevice _device,
    if (!module)
       return;
 
-   vk_free2(&device->alloc, pAllocator, module);
+   vk_object_free(&device->vk, pAllocator, module);
 }