diff options
author | Nicolai Hähnle <[email protected]> | 2017-06-08 18:38:06 +0200 |
---|---|---|
committer | Nicolai Hähnle <[email protected]> | 2017-07-31 14:55:36 +0200 |
commit | 8643d41622f0f175d7062d0c469537e2d5a5ec35 (patch) | |
tree | db2fae0594a9a566b1ee7508a83a8b2b8b147e6b /src/gallium/drivers/radeonsi/si_shader_nir.c | |
parent | d007919d999c812bbef481f0605c64f7e0f225b7 (diff) |
radeonsi/nir: load VS inputs
Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/gallium/drivers/radeonsi/si_shader_nir.c')
-rw-r--r-- | src/gallium/drivers/radeonsi/si_shader_nir.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/gallium/drivers/radeonsi/si_shader_nir.c b/src/gallium/drivers/radeonsi/si_shader_nir.c index 00bcf963bea..ef0dd9dbf96 100644 --- a/src/gallium/drivers/radeonsi/si_shader_nir.c +++ b/src/gallium/drivers/radeonsi/si_shader_nir.c @@ -313,8 +313,34 @@ void si_nir_scan_shader(const struct nir_shader *nir, } } +static void declare_nir_input_vs(struct si_shader_context *ctx, + struct nir_variable *variable, unsigned rel, + LLVMValueRef out[4]) +{ + si_llvm_load_input_vs(ctx, variable->data.driver_location / 4 + rel, out); +} + bool si_nir_build_llvm(struct si_shader_context *ctx, struct nir_shader *nir) { + nir_foreach_variable(variable, &nir->inputs) { + unsigned attrib_count = glsl_count_attribute_slots(variable->type, + nir->stage == MESA_SHADER_VERTEX); + unsigned input_idx = variable->data.driver_location; + + for (unsigned i = 0; i < attrib_count; ++i) { + LLVMValueRef data[4]; + + declare_nir_input_vs(ctx, variable, i, data); + + for (unsigned chan = 0; chan < 4; chan++) { + ctx->inputs[input_idx + chan] = + LLVMBuildBitCast(ctx->ac.builder, data[chan], ctx->ac.i32, ""); + } + } + } + + ctx->abi.inputs = &ctx->inputs[0]; + ac_nir_translate(&ctx->ac, &ctx->abi, nir, NULL); return true; |