[Mesa-dev] [FLAG-DAY-PREP 9/9] amd: use nir_tex_*_var() accessors
Rob Clark
robdclark at gmail.com
Thu Mar 15 14:28:08 UTC 2018
---
src/amd/common/ac_nir_to_llvm.c | 6 ++++--
src/amd/vulkan/radv_shader_info.c | 11 +++++++----
2 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
index 8df00fc3c8c..37e66f081de 100644
--- a/src/amd/common/ac_nir_to_llvm.c
+++ b/src/amd/common/ac_nir_to_llvm.c
@@ -1046,7 +1046,8 @@ static LLVMValueRef lower_gather4_integer(struct ac_llvm_context *ctx,
struct ac_image_args *args,
const nir_tex_instr *instr)
{
- enum glsl_base_type stype = glsl_get_sampler_result_type(instr->texture->var->type);
+ nir_variable *tex = nir_tex_texture_var(instr);
+ enum glsl_base_type stype = glsl_get_sampler_result_type(tex->type);
LLVMValueRef coord = args->addr;
LLVMValueRef half_texel[2];
LLVMValueRef compare_cube_wa = NULL;
@@ -1219,7 +1220,8 @@ static LLVMValueRef build_tex_intrinsic(struct ac_nir_context *ctx,
}
if (instr->op == nir_texop_tg4 && ctx->ac.chip_class <= VI) {
- enum glsl_base_type stype = glsl_get_sampler_result_type(instr->texture->var->type);
+ enum glsl_base_type stype = glsl_get_sampler_result_type(
+ nir_tex_texture_var(instr)->type);
if (stype == GLSL_TYPE_UINT || stype == GLSL_TYPE_INT) {
return lower_gather4_integer(&ctx->ac, args, instr);
}
diff --git a/src/amd/vulkan/radv_shader_info.c b/src/amd/vulkan/radv_shader_info.c
index dea89fa0a9f..2a7215b0b98 100644
--- a/src/amd/vulkan/radv_shader_info.c
+++ b/src/amd/vulkan/radv_shader_info.c
@@ -174,10 +174,13 @@ static void
gather_tex_info(const nir_shader *nir, const nir_tex_instr *instr,
struct radv_shader_info *info)
{
- if (instr->sampler)
- mark_sampler_desc(instr->sampler->var, info);
- if (instr->texture)
- mark_sampler_desc(instr->texture->var, info);
+ nir_variable *samp = nir_tex_sampler_var(instr);
+ if (samp)
+ mark_sampler_desc(samp, info);
+
+ nir_variable *tex = nir_tex_texture_var(instr);
+ if (tex)
+ mark_sampler_desc(tex, info);
}
static void
--
2.14.3
More information about the mesa-dev
mailing list