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@igalia.com>
This commit is contained in:
Timothy Arceri 2019-12-06 13:53:24 +11:00
parent e37115c912
commit c3823d2d29
3 changed files with 16 additions and 7 deletions

View file

@ -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);

View file

@ -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);

View file

@ -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);