Mesa (master): glsl: move nir_remap_dual_slot_attributes() call out of glsl_to_nir()
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Dec 13 00:35:41 UTC 2019
Module: Mesa
Branch: master
Commit: c3823d2d2944e8cd1f22bba01390cfb96c245bf7
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=c3823d2d2944e8cd1f22bba01390cfb96c245bf7
Author: Timothy Arceri <tarceri at itsqueeze.com>
Date: Fri Dec 6 13:53:24 2019 +1100
glsl: move nir_remap_dual_slot_attributes() call out of glsl_to_nir()
In order to be able to implement a NIR based glsl linker we need to
build the program resource list with NIR. This change delays the
remaping so that a later commit can call the NIR based resource
list builder.
Reviewed-by: Alejandro Piñeiro <apinheiro at igalia.com>
---
src/compiler/glsl/glsl_to_nir.cpp | 7 -------
src/mesa/drivers/dri/i965/brw_program.c | 8 ++++++++
src/mesa/state_tracker/st_glsl_to_nir.cpp | 8 ++++++++
3 files changed, 16 insertions(+), 7 deletions(-)
diff --git a/src/compiler/glsl/glsl_to_nir.cpp b/src/compiler/glsl/glsl_to_nir.cpp
index 09bb11f92e7..dadcf69a539 100644
--- a/src/compiler/glsl/glsl_to_nir.cpp
+++ b/src/compiler/glsl/glsl_to_nir.cpp
@@ -235,13 +235,6 @@ glsl_to_nir(struct gl_context *ctx,
}
}
- /* Remap the locations to slots so those requiring two slots will occupy
- * two locations. For instance, if we have in the IR code a dvec3 attr0 in
- * location 0 and vec4 attr1 in location 1, in NIR attr0 will use
- * locations/slots 0 and 1, and attr1 will use location/slot 2 */
- if (shader->info.stage == MESA_SHADER_VERTEX)
- nir_remap_dual_slot_attributes(shader, &sh->Program->DualSlotInputs);
-
shader->info.name = ralloc_asprintf(shader, "GLSL%d", shader_prog->Name);
if (shader_prog->Label)
shader->info.label = ralloc_strdup(shader, shader_prog->Label);
diff --git a/src/mesa/drivers/dri/i965/brw_program.c b/src/mesa/drivers/dri/i965/brw_program.c
index 16762fc661b..4a76ee58ddd 100644
--- a/src/mesa/drivers/dri/i965/brw_program.c
+++ b/src/mesa/drivers/dri/i965/brw_program.c
@@ -95,6 +95,14 @@ brw_create_nir(struct brw_context *brw,
nir = _mesa_spirv_to_nir(ctx, shader_prog, stage, options);
} else {
nir = glsl_to_nir(ctx, shader_prog, stage, options);
+
+ /* Remap the locations to slots so those requiring two slots will
+ * occupy two locations. For instance, if we have in the IR code a
+ * dvec3 attr0 in location 0 and vec4 attr1 in location 1, in NIR attr0
+ * will use locations/slots 0 and 1, and attr1 will use location/slot 2
+ */
+ if (nir->info.stage == MESA_SHADER_VERTEX)
+ nir_remap_dual_slot_attributes(nir, &prog->DualSlotInputs);
}
assert (nir);
diff --git a/src/mesa/state_tracker/st_glsl_to_nir.cpp b/src/mesa/state_tracker/st_glsl_to_nir.cpp
index 7a417d98f14..a1b7b499cff 100644
--- a/src/mesa/state_tracker/st_glsl_to_nir.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_nir.cpp
@@ -732,6 +732,14 @@ st_link_nir(struct gl_context *ctx,
if (num_shaders == 1)
st_nir_opts(nir);
+ /* Remap the locations to slots so those requiring two slots will occupy
+ * two locations. For instance, if we have in the IR code a dvec3 attr0 in
+ * location 0 and vec4 attr1 in location 1, in NIR attr0 will use
+ * locations/slots 0 and 1, and attr1 will use location/slot 2
+ */
+ if (nir->info.stage == MESA_SHADER_VERTEX && !shader_program->data->spirv)
+ nir_remap_dual_slot_attributes(nir, &shader->Program->DualSlotInputs);
+
NIR_PASS_V(nir, st_nir_lower_wpos_ytransform, shader->Program,
st->pipe->screen);
More information about the mesa-commit
mailing list