[Mesa-dev] [PATCH v2 43/73] radeonsi/nir: set si_shader_context::num_{sampler, images}
Nicolai Hähnle
nhaehnle at gmail.com
Wed Jul 5 10:48:27 UTC 2017
From: Nicolai Hähnle <nicolai.haehnle at amd.com>
---
src/gallium/drivers/radeonsi/si_shader_nir.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/gallium/drivers/radeonsi/si_shader_nir.c b/src/gallium/drivers/radeonsi/si_shader_nir.c
index 91796a8..a278ef2 100644
--- a/src/gallium/drivers/radeonsi/si_shader_nir.c
+++ b/src/gallium/drivers/radeonsi/si_shader_nir.c
@@ -368,20 +368,22 @@ si_nir_load_sampler_desc(struct ac_shader_abi *abi,
index = si_llvm_bound_index(ctx, index, ctx->num_samplers);
index = LLVMBuildAdd(ctx->gallivm.builder, index,
LLVMConstInt(ctx->i32, SI_NUM_IMAGES / 2, 0), "");
return si_load_sampler_desc(ctx, list, index, desc_type);
}
bool si_nir_build_llvm(struct si_shader_context *ctx, struct nir_shader *nir)
{
+ struct tgsi_shader_info *info = &ctx->shader->selector->info;
+
unsigned fs_attr_idx = 0;
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];
if (nir->stage == MESA_SHADER_VERTEX)
@@ -392,14 +394,17 @@ bool si_nir_build_llvm(struct si_shader_context *ctx, struct nir_shader *nir)
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];
ctx->abi.load_sampler_desc = si_nir_load_sampler_desc;
+ ctx->num_samplers = util_last_bit(info->samplers_declared);
+ ctx->num_images = util_last_bit(info->images_declared);
+
ac_nir_translate(&ctx->ac, &ctx->abi, nir, NULL);
return true;
}
--
2.9.3
More information about the mesa-dev
mailing list