summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/draw/draw_vs.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_vs.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_vs.c')
-rw-r--r--src/gallium/auxiliary/draw/draw_vs.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/draw/draw_vs.c b/src/gallium/auxiliary/draw/draw_vs.c
index bc1c90b0f3a..150653c669a 100644
--- a/src/gallium/auxiliary/draw/draw_vs.c
+++ b/src/gallium/auxiliary/draw/draw_vs.c
@@ -120,6 +120,7 @@ draw_create_vertex_shader(struct draw_context *draw,
if (vs)
{
uint i;
+ bool found_clipvertex = FALSE;
for (i = 0; i < vs->info.num_outputs; i++) {
if (vs->info.output_semantic_name[i] == TGSI_SEMANTIC_POSITION &&
vs->info.output_semantic_index[i] == 0)
@@ -127,7 +128,14 @@ draw_create_vertex_shader(struct draw_context *draw,
else if (vs->info.output_semantic_name[i] == TGSI_SEMANTIC_EDGEFLAG &&
vs->info.output_semantic_index[i] == 0)
vs->edgeflag_output = i;
+ else if (vs->info.output_semantic_name[i] == TGSI_SEMANTIC_CLIPVERTEX &&
+ vs->info.output_semantic_index[i] == 0) {
+ found_clipvertex = TRUE;
+ vs->clipvertex_output = i;
+ }
}
+ if (!found_clipvertex)
+ vs->clipvertex_output = vs->position_output;
}
assert(vs);
@@ -147,6 +155,7 @@ draw_bind_vertex_shader(struct draw_context *draw,
draw->vs.num_vs_outputs = dvs->info.num_outputs;
draw->vs.position_output = dvs->position_output;
draw->vs.edgeflag_output = dvs->edgeflag_output;
+ draw->vs.clipvertex_output = dvs->clipvertex_output;
dvs->prepare( dvs, draw );
}
else {