diff options
author | José Fonseca <[email protected]> | 2014-11-16 11:30:19 +0000 |
---|---|---|
committer | José Fonseca <[email protected]> | 2014-11-16 11:31:23 +0000 |
commit | 2a3e140ff461eb092a3b157d404dccab4f2a7aba (patch) | |
tree | 0a0af78b8a42a02bf82bfca419e4c36f85214e50 /src | |
parent | d2dbeed006c6d05cfd97b4b036a4aec75c2b9671 (diff) |
draw: Fix breakage due to removal pipe_viewport_state::translate[3] and scale[3].
Unfortunately no LLVM type was generated for pipe_viewport_state -- it
was being treated as a single floating point array --, so llvmpipe (and
any driver that relies on draw/llvm) got totally busted.
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/auxiliary/draw/draw_llvm.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/gallium/auxiliary/draw/draw_llvm.c b/src/gallium/auxiliary/draw/draw_llvm.c index 14c802b3b2a..0acb0227b2a 100644 --- a/src/gallium/auxiliary/draw/draw_llvm.c +++ b/src/gallium/auxiliary/draw/draw_llvm.c @@ -1082,6 +1082,10 @@ generate_viewport(struct draw_llvm_variant *variant, LLVMValueRef const1 = lp_build_const_vec(gallivm, f32_type, 1.0); /*1.0 1.0 1.0 1.0*/ LLVMValueRef vp_ptr = draw_jit_context_viewport(gallivm, context_ptr); + /* We treat pipe_viewport_state as a float array */ + const int scale_index_offset = offsetof(struct pipe_viewport_state, scale) / sizeof(float); + const int trans_index_offset = offsetof(struct pipe_viewport_state, translate) / sizeof(float); + /* for 1/w convention*/ out3 = LLVMBuildFDiv(builder, const1, out3, ""); LLVMBuildStore(builder, out3, outputs[pos][3]); @@ -1095,10 +1099,10 @@ generate_viewport(struct draw_llvm_variant *variant, LLVMValueRef trans_i; LLVMValueRef index; - index = lp_build_const_int32(gallivm, i); + index = lp_build_const_int32(gallivm, i + scale_index_offset); scale_i = LLVMBuildGEP(builder, vp_ptr, &index, 1, ""); - index = lp_build_const_int32(gallivm, i+4); + index = lp_build_const_int32(gallivm, i + trans_index_offset); trans_i = LLVMBuildGEP(builder, vp_ptr, &index, 1, ""); scale = lp_build_broadcast(gallivm, vs_type_llvm, |