summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary/draw/draw_vs_varient.c
diff options
context:
space:
mode:
authorKeith Whitwell <keith@tungstengraphics.com>2008-05-27 12:26:23 +0100
committerKeith Whitwell <keith@tungstengraphics.com>2008-05-27 12:26:23 +0100
commita08c574bfcf72c7f7ffbeb35c10347b491ef87fb (patch)
treed461dd17249bcabd02627f5393f2145336fdfb03 /src/gallium/auxiliary/draw/draw_vs_varient.c
parent50c1d329b95ad78e03ca4d537daee4d11f308c7a (diff)
draw: hook up viewport / rhw emit to varient key state
Diffstat (limited to 'src/gallium/auxiliary/draw/draw_vs_varient.c')
-rw-r--r--src/gallium/auxiliary/draw/draw_vs_varient.c52
1 files changed, 43 insertions, 9 deletions
diff --git a/src/gallium/auxiliary/draw/draw_vs_varient.c b/src/gallium/auxiliary/draw/draw_vs_varient.c
index c15c648527..d4deabfff3 100644
--- a/src/gallium/auxiliary/draw/draw_vs_varient.c
+++ b/src/gallium/auxiliary/draw/draw_vs_varient.c
@@ -89,9 +89,9 @@ static void vsvg_set_input( struct draw_vs_varient *varient,
/* Mainly for debug at this stage:
*/
-static void do_viewport( struct draw_vs_varient_generic *vsvg,
- unsigned count,
- void *output_buffer )
+static void do_rhw_viewport( struct draw_vs_varient_generic *vsvg,
+ unsigned count,
+ void *output_buffer )
{
char *ptr = (char *)output_buffer;
const float *scale = vsvg->viewport.scale;
@@ -109,6 +109,25 @@ static void do_viewport( struct draw_vs_varient_generic *vsvg,
data[3] = w;
}
}
+
+static void do_viewport( struct draw_vs_varient_generic *vsvg,
+ unsigned count,
+ void *output_buffer )
+{
+ char *ptr = (char *)output_buffer;
+ const float *scale = vsvg->viewport.scale;
+ const float *trans = vsvg->viewport.translate;
+ unsigned stride = vsvg->base.key.output_stride;
+ unsigned j;
+
+ for (j = 0; j < count; j++, ptr += stride) {
+ float *data = (float *)ptr;
+
+ data[0] = data[0] * scale[0] + trans[0];
+ data[1] = data[1] * scale[1] + trans[1];
+ data[2] = data[2] * scale[2] + trans[2];
+ }
+}
static void vsvg_run_elts( struct draw_vs_varient *varient,
@@ -136,10 +155,20 @@ static void vsvg_run_elts( struct draw_vs_varient *varient,
vsvg->base.key.output_stride,
vsvg->base.key.output_stride);
- if (vsvg->base.key.viewport)
+
+ if (vsvg->base.key.clip) {
+ /* not really handling clipping, just do the rhw so we can
+ * see the results...
+ */
+ do_rhw_viewport( vsvg,
+ count,
+ output_buffer );
+ }
+ else if (vsvg->base.key.viewport) {
do_viewport( vsvg,
count,
output_buffer );
+ }
//if (!vsvg->already_in_emit_format)
@@ -182,11 +211,19 @@ static void vsvg_run_linear( struct draw_vs_varient *varient,
vsvg->base.key.output_stride,
vsvg->base.key.output_stride);
- if (vsvg->base.key.viewport)
+ if (vsvg->base.key.clip) {
+ /* not really handling clipping, just do the rhw so we can
+ * see the results...
+ */
+ do_rhw_viewport( vsvg,
+ count,
+ output_buffer );
+ }
+ else if (vsvg->base.key.viewport) {
do_viewport( vsvg,
count,
output_buffer );
-
+ }
//if (!vsvg->already_in_emit_format)
vsvg->emit->set_buffer( vsvg->emit,
@@ -224,9 +261,6 @@ struct draw_vs_varient *draw_vs_varient_generic( struct draw_vertex_shader *vs,
unsigned i;
struct translate_key fetch, emit;
- if (key->clip)
- return NULL;
-
struct draw_vs_varient_generic *vsvg = CALLOC_STRUCT( draw_vs_varient_generic );
if (vsvg == NULL)
return NULL;