summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
authorCaio Marcelo de Oliveira Filho <[email protected]>2019-05-19 00:22:17 -0700
committerCaio Marcelo de Oliveira Filho <[email protected]>2019-05-29 10:34:35 -0700
commite45bf01940fa6692d4f1d9385c2d6466da06a9bb (patch)
tree4e8c8694747bb1d65374f878434c03020f8aec65 /src/mesa/main
parenta3bfdacb6c9f992dd1933c163c2580049ffea11e (diff)
spirv: Change spirv_to_nir() to return a nir_shader
spirv_to_nir() returned the nir_function corresponding to the entrypoint, as a way to identify it. There's now a bool is_entrypoint in nir_function and also a helper function to get the entry_point from a nir_shader. The return type reflects better what the function name suggests. It also helps drivers avoid the mistake of reusing internal shader references after running NIR_PASS on it. When using NIR_TEST_CLONE or NIR_TEST_SERIALIZE, those would be invalidated right in the first pass executed. Reviewed-by: Bas Nieuwenhuizen <[email protected]>
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/glspirv.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/mesa/main/glspirv.c b/src/mesa/main/glspirv.c
index 8d1ac9b5072..bb5a3f7452b 100644
--- a/src/mesa/main/glspirv.c
+++ b/src/mesa/main/glspirv.c
@@ -186,8 +186,6 @@ _mesa_spirv_to_nir(struct gl_context *ctx,
gl_shader_stage stage,
const nir_shader_compiler_options *options)
{
- nir_shader *nir = NULL;
-
struct gl_linked_shader *linked_shader = prog->_LinkedShaders[stage];
assert (linked_shader);
@@ -217,7 +215,7 @@ _mesa_spirv_to_nir(struct gl_context *ctx,
.caps = ctx->Const.SpirVCapabilities
};
- nir_function *entry_point =
+ nir_shader *nir =
spirv_to_nir((const uint32_t *) &spirv_module->Binary[0],
spirv_module->Length / 4,
spec_entries, spirv_data->NumSpecializationConstants,
@@ -226,8 +224,7 @@ _mesa_spirv_to_nir(struct gl_context *ctx,
options);
free(spec_entries);
- assert (entry_point);
- nir = entry_point->shader;
+ assert(nir);
assert(nir->info.stage == stage);
nir->options = options;