draw: hook up viewport / rhw emit to varient key state

This commit is contained in:
Keith Whitwell 2008-05-27 12:26:23 +01:00
parent 50c1d329b9
commit a08c574bfc
3 changed files with 53 additions and 19 deletions

View file

@ -94,8 +94,8 @@ static void fse_prepare( struct draw_pt_middle_end *middle,
fse->key.nr_elements = MAX2(num_vs_outputs, /* outputs - translate to hw format */
num_vs_inputs); /* inputs - fetch from api format */
fse->key.viewport = 1;
fse->key.clip = 0;
fse->key.viewport = !draw->identity_viewport;
fse->key.clip = !draw->bypass_clipping;
fse->key.pad = 0;
memset(fse->key.element, 0,

View file

@ -2021,11 +2021,14 @@ static boolean build_vertex_program( struct draw_vs_varient_aos_sse *varient,
if (cp.error)
goto fail;
if (cp.vaos->base.key.viewport) {
if (0)
emit_viewport(&cp);
else
emit_rhw_viewport(&cp);
if (cp.vaos->base.key.clip) {
/* not really handling clipping, just do the rhw so we can
* see the results...
*/
emit_rhw_viewport(&cp);
}
else if (cp.vaos->base.key.viewport) {
emit_viewport(&cp);
}
/* Emit output... TODO: do this eagerly after the last write to a
@ -2188,9 +2191,6 @@ static struct draw_vs_varient *varient_aos_sse( struct draw_vertex_shader *vs,
{
struct draw_vs_varient_aos_sse *vaos = CALLOC_STRUCT(draw_vs_varient_aos_sse);
if (key->clip)
return NULL;
if (!vaos)
goto fail;

View file

@ -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;