summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/draw/draw_llvm.c
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2012-01-04 11:52:30 +0000
committerDave Airlie <[email protected]>2012-01-11 07:13:35 +0000
commit40c5987ed84f9f0b8bb1f707bb13c1aafc39330a (patch)
tree0614696dcf1b6b8f1886920b3520e38f66dcc3f3 /src/gallium/auxiliary/draw/draw_llvm.c
parent34a78b7ef6b0edf217acf221eab4b63542be5552 (diff)
draw/softpipe: add clip vertex support. (v2)
softpipe always clipped using the position vector, however for unclipped vertices it stored the position in window coordinates, however when position and clipping are separated, we need to store the clip-space position and the clip-space vertex clip, so we can interpolate both separately. This means we have to take the clip space position and store it to use later. This allows softpipe to pass all the clip-vertex piglit tests. v2: fix llvm draw regression, the structure being passed into llvm needed updating, remove some hardcoded ints that should have been enums while there. Signed-off-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/draw/draw_llvm.c')
-rw-r--r--src/gallium/auxiliary/draw/draw_llvm.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/gallium/auxiliary/draw/draw_llvm.c b/src/gallium/auxiliary/draw/draw_llvm.c
index cf97e82a63c..50c7e254deb 100644
--- a/src/gallium/auxiliary/draw/draw_llvm.c
+++ b/src/gallium/auxiliary/draw/draw_llvm.c
@@ -268,15 +268,16 @@ static LLVMTypeRef
create_jit_vertex_header(struct gallivm_state *gallivm, int data_elems)
{
LLVMTargetDataRef target = gallivm->target;
- LLVMTypeRef elem_types[3];
+ LLVMTypeRef elem_types[4];
LLVMTypeRef vertex_header;
char struct_name[24];
util_snprintf(struct_name, 23, "vertex_header%d", data_elems);
- elem_types[0] = LLVMIntTypeInContext(gallivm->context, 32);
- elem_types[1] = LLVMArrayType(LLVMFloatTypeInContext(gallivm->context), 4);
- elem_types[2] = LLVMArrayType(elem_types[1], data_elems);
+ elem_types[DRAW_JIT_VERTEX_VERTEX_ID] = LLVMIntTypeInContext(gallivm->context, 32);
+ elem_types[DRAW_JIT_VERTEX_CLIP] = LLVMArrayType(LLVMFloatTypeInContext(gallivm->context), 4);
+ elem_types[DRAW_JIT_VERTEX_PRE_CLIP_POS] = LLVMArrayType(LLVMFloatTypeInContext(gallivm->context), 4);
+ elem_types[DRAW_JIT_VERTEX_DATA] = LLVMArrayType(elem_types[1], data_elems);
#if HAVE_LLVM >= 0x0300
vertex_header = LLVMStructCreateNamed(gallivm->context, struct_name);
@@ -307,6 +308,9 @@ create_jit_vertex_header(struct gallivm_state *gallivm, int data_elems)
LP_CHECK_MEMBER_OFFSET(struct vertex_header, clip,
target, vertex_header,
DRAW_JIT_VERTEX_CLIP);
+ LP_CHECK_MEMBER_OFFSET(struct vertex_header, pre_clip_pos,
+ target, vertex_header,
+ DRAW_JIT_VERTEX_PRE_CLIP_POS);
LP_CHECK_MEMBER_OFFSET(struct vertex_header, data,
target, vertex_header,
DRAW_JIT_VERTEX_DATA);