diff options
Diffstat (limited to 'src/compiler/nir/nir.c')
-rw-r--r-- | src/compiler/nir/nir.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/compiler/nir/nir.c b/src/compiler/nir/nir.c index 5e76654ca3d..e12aa5d80f5 100644 --- a/src/compiler/nir/nir.c +++ b/src/compiler/nir/nir.c @@ -32,6 +32,9 @@ #include <assert.h> #include <math.h> +#include "main/imports.h" /* _mesa_bitcount_64 */ +#include "main/menums.h" /* BITFIELD64_MASK */ + nir_shader * nir_shader_create(void *mem_ctx, gl_shader_stage stage, @@ -1847,3 +1850,24 @@ nir_system_value_from_intrinsic(nir_intrinsic_op intrin) unreachable("intrinsic doesn't produce a system value"); } } + +/* OpenGL utility method that remaps the location attributes if they are + * doubles. Not needed for vulkan due the differences on the input location + * count for doubles on vulkan vs OpenGL + */ +void +nir_remap_attributes(nir_shader *shader, + const nir_shader_compiler_options *options) +{ + if (options->vs_inputs_dual_locations) { + nir_foreach_variable(var, &shader->inputs) { + var->data.location += + _mesa_bitcount_64(shader->info.vs.double_inputs & + BITFIELD64_MASK(var->data.location)); + } + } + + /* Once the remap is done, reset double_inputs_read, so later it will have + * which location/slots are doubles */ + shader->info.vs.double_inputs = 0; +} |