summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/radeonsi
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2017-12-15 14:13:11 +1100
committerTimothy Arceri <[email protected]>2018-01-30 09:08:47 +1100
commitcf75ee3ab1cf95cb19d925821f71b353d394956d (patch)
tree8fd90dc49e116f02b7a507caa28d286f10edde40 /src/gallium/drivers/radeonsi
parent96cfd4bd7ed8c04b154ad7a855e3c1488cc5fedb (diff)
radeonsi: add bitcast_inputs() helper
Will be used in a following patch to help support doubles. Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/gallium/drivers/radeonsi')
-rw-r--r--src/gallium/drivers/radeonsi/si_shader_nir.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/gallium/drivers/radeonsi/si_shader_nir.c b/src/gallium/drivers/radeonsi/si_shader_nir.c
index 34d28b7a728..e05548c1b88 100644
--- a/src/gallium/drivers/radeonsi/si_shader_nir.c
+++ b/src/gallium/drivers/radeonsi/si_shader_nir.c
@@ -644,6 +644,16 @@ si_nir_load_sampler_desc(struct ac_shader_abi *abi,
return si_load_sampler_desc(ctx, list, index, desc_type);
}
+static void bitcast_inputs(struct si_shader_context *ctx,
+ LLVMValueRef data[4],
+ unsigned input_idx)
+{
+ for (unsigned chan = 0; chan < 4; chan++) {
+ ctx->inputs[input_idx + chan] =
+ LLVMBuildBitCast(ctx->ac.builder, data[chan], ctx->ac.i32, "");
+ }
+}
+
bool si_nir_build_llvm(struct si_shader_context *ctx, struct nir_shader *nir)
{
struct tgsi_shader_info *info = &ctx->shader->selector->info;
@@ -667,15 +677,14 @@ bool si_nir_build_llvm(struct si_shader_context *ctx, struct nir_shader *nir)
if (processed_inputs & ((uint64_t)1 << loc))
continue;
- if (nir->info.stage == MESA_SHADER_VERTEX)
+ if (nir->info.stage == MESA_SHADER_VERTEX) {
declare_nir_input_vs(ctx, variable, data);
- else if (nir->info.stage == MESA_SHADER_FRAGMENT)
+ bitcast_inputs(ctx, data, input_idx);
+ } else if (nir->info.stage == MESA_SHADER_FRAGMENT) {
declare_nir_input_fs(ctx, variable, input_idx / 4, data);
-
- for (unsigned chan = 0; chan < 4; chan++) {
- ctx->inputs[input_idx + chan] =
- LLVMBuildBitCast(ctx->ac.builder, data[chan], ctx->ac.i32, "");
+ bitcast_inputs(ctx, data, input_idx);
}
+
processed_inputs |= ((uint64_t)1 << loc);
}
}