From: José Fonseca Date: Sun, 16 Nov 2014 11:30:19 +0000 (+0000) Subject: draw: Fix breakage due to removal pipe_viewport_state::translate[3] and scale[3]. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2a3e140ff461eb092a3b157d404dccab4f2a7aba;p=mesa.git 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. --- 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,