summaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2019-12-06 21:57:16 +1100
committerTimothy Arceri <[email protected]>2019-12-13 00:07:19 +0000
commita6aedc662ebbcac747475324abe3791ff67fc1a8 (patch)
treedadce9bb76192df75032944ced5098a32688740c /src/mesa/state_tracker
parent144f54e483d1e1b0cd865606fecdef002bb322b1 (diff)
st/glsl_to_nir: use nir based program resource list builder
Here we use the NIR based builder to add everything to the resource list execpt for SSO packed varyings. Since the details of those varyings get lost during packing we leave the special handing to the GLSL IR pass for now. In order to do this we add some bools to the build resource list functions. Using the NIR based resource list builder gets us a step closer to using a native NIR based linker. It should also be faster than the GLSL IR builder, one because the NIR optimisations should mean we add less entries due to better optimisations, and two because nir gives us better lists to work with and we don't need to walk the entire IR to find the resources. Ack-by: Alejandro PiƱeiro <[email protected]>
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r--src/mesa/state_tracker/st_glsl_to_ir.cpp2
-rw-r--r--src/mesa/state_tracker/st_glsl_to_nir.cpp5
2 files changed, 5 insertions, 2 deletions
diff --git a/src/mesa/state_tracker/st_glsl_to_ir.cpp b/src/mesa/state_tracker/st_glsl_to_ir.cpp
index 25e16fa058c..4d2a45728a9 100644
--- a/src/mesa/state_tracker/st_glsl_to_ir.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_ir.cpp
@@ -167,7 +167,7 @@ st_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
validate_ir_tree(ir);
}
- build_program_resource_list(ctx, prog);
+ build_program_resource_list(ctx, prog, use_nir);
if (use_nir)
return st_link_nir(ctx, prog);
diff --git a/src/mesa/state_tracker/st_glsl_to_nir.cpp b/src/mesa/state_tracker/st_glsl_to_nir.cpp
index c252babb711..425af0cfb5d 100644
--- a/src/mesa/state_tracker/st_glsl_to_nir.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_nir.cpp
@@ -699,7 +699,7 @@ st_link_nir(struct gl_context *ctx,
if (!gl_nir_link(ctx, shader_program, &opts))
return GL_FALSE;
- nir_build_program_resource_list(ctx, shader_program);
+ nir_build_program_resource_list(ctx, shader_program, true);
for (unsigned i = 0; i < num_shaders; i++) {
struct gl_linked_shader *shader = linked_shader[i];
@@ -721,6 +721,9 @@ st_link_nir(struct gl_context *ctx,
linked_shader[i + 1]->Program->nir);
}
+ if (!shader_program->data->spirv)
+ nir_build_program_resource_list(ctx, shader_program, false);
+
for (unsigned i = 0; i < num_shaders; i++) {
struct gl_linked_shader *shader = linked_shader[i];
nir_shader *nir = shader->Program->nir;