summaryrefslogtreecommitdiffstats
path: root/src/amd/common/ac_nir_to_llvm.c
diff options
context:
space:
mode:
authorChih-Wei Huang <cwhuang@linux.org.tw>2016-11-25 12:05:07 +0800
committerChih-Wei Huang <cwhuang@linux.org.tw>2016-11-25 12:05:07 +0800
commit524121d42bfdf8c1bd3565bd2adb0ffd7b52713f (patch)
tree57b645909523126d571949a0cabb16087aca9849 /src/amd/common/ac_nir_to_llvm.c
parent5d0d07d402fa0edead26450fb86111292e8f834f (diff)
parentf7b58a378ca94cf1c2637d640ce5b9fb8f8519a6 (diff)
downloadexternal_mesa3d-524121d42bfdf8c1bd3565bd2adb0ffd7b52713f.zip
external_mesa3d-524121d42bfdf8c1bd3565bd2adb0ffd7b52713f.tar.gz
external_mesa3d-524121d42bfdf8c1bd3565bd2adb0ffd7b52713f.tar.bz2
Merge remote-tracking branch 'mesa/13.0' into nougat-x86
Diffstat (limited to 'src/amd/common/ac_nir_to_llvm.c')
-rw-r--r--src/amd/common/ac_nir_to_llvm.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
index f235cc2..31d7b6e 100644
--- a/src/amd/common/ac_nir_to_llvm.c
+++ b/src/amd/common/ac_nir_to_llvm.c
@@ -1683,7 +1683,7 @@ static LLVMValueRef radv_lower_gather4_integer(struct nir_to_llvm_context *ctx,
for (c = 0; c < 2; c++) {
half_texel[c] = LLVMBuildExtractElement(ctx->builder, size,
- ctx->i32zero, "");
+ LLVMConstInt(ctx->i32, c, false), "");
half_texel[c] = LLVMBuildUIToFP(ctx->builder, half_texel[c], ctx->f32, "");
half_texel[c] = emit_fdiv(ctx, ctx->f32one, half_texel[c]);
half_texel[c] = LLVMBuildFMul(ctx->builder, half_texel[c],
@@ -3299,17 +3299,25 @@ static void visit_tex(struct nir_to_llvm_context *ctx, nir_tex_instr *instr)
}
if (instr->op == nir_texop_texture_samples) {
- LLVMValueRef res, samples;
+ LLVMValueRef res, samples, is_msaa;
res = LLVMBuildBitCast(ctx->builder, res_ptr, ctx->v8i32, "");
samples = LLVMBuildExtractElement(ctx->builder, res,
LLVMConstInt(ctx->i32, 3, false), "");
+ is_msaa = LLVMBuildLShr(ctx->builder, samples,
+ LLVMConstInt(ctx->i32, 28, false), "");
+ is_msaa = LLVMBuildAnd(ctx->builder, is_msaa,
+ LLVMConstInt(ctx->i32, 0xe, false), "");
+ is_msaa = LLVMBuildICmp(ctx->builder, LLVMIntEQ, is_msaa,
+ LLVMConstInt(ctx->i32, 0xe, false), "");
+
samples = LLVMBuildLShr(ctx->builder, samples,
LLVMConstInt(ctx->i32, 16, false), "");
samples = LLVMBuildAnd(ctx->builder, samples,
LLVMConstInt(ctx->i32, 0xf, false), "");
samples = LLVMBuildShl(ctx->builder, ctx->i32one,
samples, "");
-
+ samples = LLVMBuildSelect(ctx->builder, is_msaa, samples,
+ ctx->i32one, "");
result = samples;
goto write_result;
}
@@ -3408,7 +3416,10 @@ static void visit_tex(struct nir_to_llvm_context *ctx, nir_tex_instr *instr)
address[count++] = sample_index;
} else if(instr->op == nir_texop_txs) {
count = 0;
- address[count++] = lod;
+ if (lod)
+ address[count++] = lod;
+ else
+ address[count++] = ctx->i32zero;
}
for (chan = 0; chan < count; chan++) {