diff options
Diffstat (limited to 'src/compiler/glsl')
-rw-r--r-- | src/compiler/glsl/glsl_to_nir.cpp | 16 | ||||
-rw-r--r-- | src/compiler/glsl/ir_set_program_inouts.cpp | 2 | ||||
-rw-r--r-- | src/compiler/glsl/serialize.cpp | 2 |
3 files changed, 8 insertions, 12 deletions
diff --git a/src/compiler/glsl/glsl_to_nir.cpp b/src/compiler/glsl/glsl_to_nir.cpp index f38d280d406..d22f4a58dd4 100644 --- a/src/compiler/glsl/glsl_to_nir.cpp +++ b/src/compiler/glsl/glsl_to_nir.cpp @@ -149,8 +149,11 @@ glsl_to_nir(const struct gl_shader_program *shader_prog, * 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_attributes(shader, options); + if (shader->info.stage == MESA_SHADER_VERTEX) { + sh->Program->DualSlotInputs = nir_get_dual_slot_attributes(shader); + if (options->vs_inputs_dual_locations) + nir_remap_dual_slot_attributes(shader, sh->Program->DualSlotInputs); + } shader->info.name = ralloc_asprintf(shader, "GLSL%d", shader_prog->Name); if (shader_prog->Label) @@ -344,15 +347,6 @@ nir_visitor::visit(ir_variable *ir) var->data.compact = ir->type->without_array()->is_scalar(); } } - - /* Mark all the locations that require two slots */ - if (shader->info.stage == MESA_SHADER_VERTEX && - glsl_type_is_dual_slot(glsl_without_array(var->type))) { - for (unsigned i = 0; i < glsl_count_attribute_slots(var->type, true); i++) { - uint64_t bitfield = BITFIELD64_BIT(var->data.location + i); - shader->info.vs.double_inputs |= bitfield; - } - } break; case ir_var_shader_out: diff --git a/src/compiler/glsl/ir_set_program_inouts.cpp b/src/compiler/glsl/ir_set_program_inouts.cpp index ba1e44167c3..a3cb19479b8 100644 --- a/src/compiler/glsl/ir_set_program_inouts.cpp +++ b/src/compiler/glsl/ir_set_program_inouts.cpp @@ -118,7 +118,7 @@ mark(struct gl_program *prog, ir_variable *var, int offset, int len, /* double inputs read is only for vertex inputs */ if (stage == MESA_SHADER_VERTEX && var->type->without_array()->is_dual_slot()) - prog->info.vs.double_inputs_read |= bitfield; + prog->DualSlotInputs |= bitfield; if (stage == MESA_SHADER_FRAGMENT) { prog->info.fs.uses_sample_qualifier |= var->data.sample; diff --git a/src/compiler/glsl/serialize.cpp b/src/compiler/glsl/serialize.cpp index 889038fb5e2..267700e7e78 100644 --- a/src/compiler/glsl/serialize.cpp +++ b/src/compiler/glsl/serialize.cpp @@ -1035,6 +1035,7 @@ write_shader_metadata(struct blob *metadata, gl_linked_shader *shader) struct gl_program *glprog = shader->Program; unsigned i; + blob_write_uint64(metadata, glprog->DualSlotInputs); blob_write_bytes(metadata, glprog->TexturesUsed, sizeof(glprog->TexturesUsed)); blob_write_uint64(metadata, glprog->SamplersUsed); @@ -1088,6 +1089,7 @@ read_shader_metadata(struct blob_reader *metadata, { unsigned i; + glprog->DualSlotInputs = blob_read_uint64(metadata); blob_copy_bytes(metadata, (uint8_t *) glprog->TexturesUsed, sizeof(glprog->TexturesUsed)); glprog->SamplersUsed = blob_read_uint64(metadata); |