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>master
| } | } | ||||
| } | } | ||||
| /* 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); | shader->info.name = ralloc_asprintf(shader, "GLSL%d", shader_prog->Name); | ||||
| if (shader_prog->Label) | if (shader_prog->Label) | ||||
| shader->info.label = ralloc_strdup(shader, shader_prog->Label); | shader->info.label = ralloc_strdup(shader, shader_prog->Label); |
| nir = _mesa_spirv_to_nir(ctx, shader_prog, stage, options); | nir = _mesa_spirv_to_nir(ctx, shader_prog, stage, options); | ||||
| } else { | } else { | ||||
| nir = glsl_to_nir(ctx, shader_prog, stage, options); | 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); | assert (nir); | ||||
| if (num_shaders == 1) | if (num_shaders == 1) | ||||
| st_nir_opts(nir); | 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, | NIR_PASS_V(nir, st_nir_lower_wpos_ytransform, shader->Program, | ||||
| st->pipe->screen); | st->pipe->screen); | ||||