summaryrefslogtreecommitdiffstats
path: root/src/freedreno/vulkan/tu_shader.c
diff options
context:
space:
mode:
authorCaio Marcelo de Oliveira Filho <[email protected]>2019-05-18 23:55:01 -0700
committerCaio Marcelo de Oliveira Filho <[email protected]>2019-05-29 10:26:22 -0700
commitc92d0029822f55aeb8e015d865dd4076f0e70062 (patch)
treed6e619c14377e5fd90bb28079918b9a4696dcb7e /src/freedreno/vulkan/tu_shader.c
parent0a0be7aee0dcfa660b62073e39b1e86de67e48fd (diff)
turnip: Don't re-use entry_point pointer from spirv_to_nir
Replace its uses with nir_shader_get_entrypoint(), and change the helper function to return nir_shader *. This is a preparation to change spirv_to_nir() return type. Reviewed-by: Rob Clark <[email protected]> Reviewed-by: Bas Nieuwenhuizen <[email protected]>
Diffstat (limited to 'src/freedreno/vulkan/tu_shader.c')
-rw-r--r--src/freedreno/vulkan/tu_shader.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/freedreno/vulkan/tu_shader.c b/src/freedreno/vulkan/tu_shader.c
index 8d6ccecdd9c..5d5e6524783 100644
--- a/src/freedreno/vulkan/tu_shader.c
+++ b/src/freedreno/vulkan/tu_shader.c
@@ -28,7 +28,7 @@
#include "ir3/ir3_nir.h"
-static nir_function *
+static nir_shader *
tu_spirv_to_nir(struct ir3_compiler *compiler,
const uint32_t *words,
size_t word_count,
@@ -77,7 +77,7 @@ tu_spirv_to_nir(struct ir3_compiler *compiler,
assert(entry_point->shader->info.stage == stage);
nir_validate_shader(entry_point->shader, "after spirv_to_nir");
- return entry_point;
+ return entry_point->shader;
}
static void
@@ -128,16 +128,14 @@ tu_shader_create(struct tu_device *dev,
/* translate SPIR-V to NIR */
assert(module->code_size % 4 == 0);
- nir_function *entry_point = tu_spirv_to_nir(
+ nir_shader *nir = tu_spirv_to_nir(
dev->compiler, (const uint32_t *) module->code, module->code_size / 4,
stage, stage_info->pName, stage_info->pSpecializationInfo);
- if (!entry_point) {
+ if (!nir) {
vk_free2(&dev->alloc, alloc, shader);
return NULL;
}
- nir_shader *nir = entry_point->shader;
-
if (unlikely(dev->physical_device->instance->debug_flags & TU_DEBUG_NIR)) {
fprintf(stderr, "translated nir:\n");
nir_print_shader(nir, stderr);
@@ -176,7 +174,7 @@ tu_shader_create(struct tu_device *dev,
NIR_PASS_V(nir, nir_lower_frexp);
NIR_PASS_V(nir, nir_lower_io, nir_var_all, ir3_glsl_type_size, 0);
- nir_shader_gather_info(nir, entry_point->impl);
+ nir_shader_gather_info(nir, nir_shader_get_entrypoint(nir));
shader->ir3_shader.compiler = dev->compiler;
shader->ir3_shader.type = stage;