summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBas Nieuwenhuizen <[email protected]>2017-02-27 09:46:12 +0100
committerBas Nieuwenhuizen <[email protected]>2017-02-28 20:48:14 +0100
commit137b06b437eddef97978d76848a0e19cc564d39d (patch)
tree07bd89c6ac74b746d6214174b9020c14e6d6c7d3 /src
parent500e6e40f683fbad09f38360bb79f8a12442c408 (diff)
radv/ac: Use constants for immutable samplers.
Signed-off-by: Bas Nieuwenhuizen <[email protected]> Reviewed-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/amd/common/ac_nir_to_llvm.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
index 4f3d689db7e..db7194c3086 100644
--- a/src/amd/common/ac_nir_to_llvm.c
+++ b/src/amd/common/ac_nir_to_llvm.c
@@ -3383,6 +3383,7 @@ static LLVMValueRef get_sampler_desc(struct nir_to_llvm_context *ctx,
LLVMBuilderRef builder = ctx->builder;
LLVMTypeRef type;
LLVMValueRef index = NULL;
+ unsigned constant_index = 0;
assert(deref->var->data.binding < layout->binding_count);
@@ -3419,6 +3420,21 @@ static LLVMValueRef get_sampler_desc(struct nir_to_llvm_context *ctx,
if (child->deref_array_type == nir_deref_array_type_indirect) {
index = get_src(ctx, child->indirect);
}
+
+ constant_index = child->base_offset;
+ }
+ if (desc_type == DESC_SAMPLER && binding->immutable_samplers &&
+ (!index || binding->immutable_samplers_equal)) {
+ if (binding->immutable_samplers_equal)
+ constant_index = 0;
+
+ LLVMValueRef constants[] = {
+ LLVMConstInt(ctx->i32, binding->immutable_samplers[constant_index * 4 + 0], 0),
+ LLVMConstInt(ctx->i32, binding->immutable_samplers[constant_index * 4 + 1], 0),
+ LLVMConstInt(ctx->i32, binding->immutable_samplers[constant_index * 4 + 2], 0),
+ LLVMConstInt(ctx->i32, binding->immutable_samplers[constant_index * 4 + 3], 0),
+ };
+ return ac_build_gather_values(&ctx->ac, constants, 4);
}
assert(stride % type_size == 0);