r600g: implement timestamp query and get_timestamp hook
[mesa.git] / src / gallium / drivers / r600 / r600_llvm.c
index 2ca838f87fa130c7fd6ba0acdd9a7cdf0009acc0..e77758b3a7779e0de5fe85a1f63b9ddaf67e7da4 100644 (file)
@@ -16,6 +16,8 @@
 
 #include <stdio.h>
 
+#if defined R600_USE_LLVM || defined HAVE_OPENCL
+
 static LLVMValueRef llvm_fetch_const(
        struct lp_build_tgsi_context * bld_base,
        const struct tgsi_full_src_register *reg,
@@ -144,15 +146,17 @@ static void llvm_emit_tex(
 {
        struct gallivm_state * gallivm = bld_base->base.gallivm;
        LLVMValueRef args[6];
-       unsigned c;
+       unsigned c, sampler_src;
 
        assert(emit_data->arg_count + 2 <= Elements(args));
 
        for (c = 0; c < emit_data->arg_count; ++c)
                args[c] = emit_data->args[c];
 
+       sampler_src = emit_data->inst->Instruction.NumSrcRegs-1;
+
        args[c++] = lp_build_const_int32(gallivm,
-                                       emit_data->inst->Src[1].Register.Index);
+                                       emit_data->inst->Src[sampler_src].Register.Index);
        args[c++] = lp_build_const_int32(gallivm,
                                        emit_data->inst->Texture.Texture);
 
@@ -317,3 +321,5 @@ unsigned r600_llvm_compile(
        return radeon_llvm_compile(mod, inst_bytes, inst_byte_count,
                                                        gpu_family, dump);
 }
+
+#endif