aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary
diff options
context:
space:
mode:
authorKeith Whitwell <[email protected]>2008-05-27 14:42:15 +0100
committerKeith Whitwell <[email protected]>2008-05-27 14:45:52 +0100
commitf8762ba5234fd1b44e11e76bb5f58d2305c90572 (patch)
tree993d78827d7b6157a8c8f4b8dc369316ec1ff04e /src/gallium/auxiliary
parentf64c44ad3e55467ce964871502445cf5a0fb46d6 (diff)
draw: explicitly list nr_inputs, outputs in varient key
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r--src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c14
-rw-r--r--src/gallium/auxiliary/draw/draw_vs.h6
-rw-r--r--src/gallium/auxiliary/draw/draw_vs_aos.c2
-rw-r--r--src/gallium/auxiliary/draw/draw_vs_aos_io.c4
-rw-r--r--src/gallium/auxiliary/draw/draw_vs_varient.c10
5 files changed, 21 insertions, 15 deletions
diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c
index c6249b4b410..581026dcb05 100644
--- a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c
+++ b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c
@@ -72,7 +72,6 @@ static void fse_prepare( struct draw_pt_middle_end *middle,
struct fetch_shade_emit *fse = (struct fetch_shade_emit *)middle;
struct draw_context *draw = fse->draw;
unsigned num_vs_inputs = draw->vs.vertex_shader->info.num_inputs;
- unsigned num_vs_outputs = draw->vs.vertex_shader->info.num_outputs;
const struct vertex_info *vinfo;
unsigned i;
boolean need_psize = 0;
@@ -91,8 +90,11 @@ static void fse_prepare( struct draw_pt_middle_end *middle,
fse->key.output_stride = vinfo->size * 4;
- fse->key.nr_elements = MAX2(num_vs_outputs, /* outputs - translate to hw format */
- num_vs_inputs); /* inputs - fetch from api format */
+ fse->key.nr_outputs = vinfo->num_attribs;
+ fse->key.nr_inputs = num_vs_inputs;
+
+ fse->key.nr_elements = MAX2(fse->key.nr_outputs, /* outputs - translate to hw format */
+ fse->key.nr_inputs); /* inputs - fetch from api format */
fse->key.viewport = !draw->identity_viewport;
fse->key.clip = !draw->bypass_clipping;
@@ -142,7 +144,7 @@ static void fse_prepare( struct draw_pt_middle_end *middle,
need_psize = 1;
output_format = PIPE_FORMAT_R32_FLOAT;
emit_sz = 1 * sizeof(float);
- vs_output = num_vs_outputs + 1;
+ vs_output = vinfo->num_attribs + 1;
break;
case EMIT_4UB:
output_format = PIPE_FORMAT_B8G8R8A8_UNORM;
@@ -177,7 +179,9 @@ static void fse_prepare( struct draw_pt_middle_end *middle,
fse->key.element[i].input_buffer = 0; //nr_buffers + 1;
fse->key.element[i].input_offset = 0;
- fse->key.nr_elements += 1;
+ fse->key.nr_inputs += 1;
+ fse->key.nr_elements = MAX2(fse->key.nr_inputs,
+ fse->key.nr_outputs);
}
#endif
diff --git a/src/gallium/auxiliary/draw/draw_vs.h b/src/gallium/auxiliary/draw/draw_vs.h
index ff3e19b2a88..17902ab86a6 100644
--- a/src/gallium/auxiliary/draw/draw_vs.h
+++ b/src/gallium/auxiliary/draw/draw_vs.h
@@ -58,10 +58,12 @@ struct draw_vs_element {
struct draw_vs_varient_key {
unsigned output_stride;
- unsigned nr_elements:16;
+ unsigned nr_elements:8; /* max2(nr_inputs, nr_outputs) */
+ unsigned nr_inputs:8;
+ unsigned nr_outputs:8;
unsigned viewport:1;
unsigned clip:1;
- unsigned pad:14;
+ unsigned pad:5;
struct draw_vs_element element[PIPE_MAX_ATTRIBS];
};
diff --git a/src/gallium/auxiliary/draw/draw_vs_aos.c b/src/gallium/auxiliary/draw/draw_vs_aos.c
index c63553216cb..e2e96470f72 100644
--- a/src/gallium/auxiliary/draw/draw_vs_aos.c
+++ b/src/gallium/auxiliary/draw/draw_vs_aos.c
@@ -2095,7 +2095,7 @@ static void vaos_set_buffer( struct draw_vs_varient *varient,
struct draw_vs_varient_aos_sse *vaos = (struct draw_vs_varient_aos_sse *)varient;
unsigned i;
- for (i = 0; i < vaos->base.vs->info.num_inputs; i++) {
+ for (i = 0; i < vaos->base.key.nr_inputs; i++) {
if (vaos->base.key.element[i].in.buffer == buf) {
vaos->machine->attrib[i].input_ptr = ((char *)ptr +
vaos->base.key.element[i].in.offset);
diff --git a/src/gallium/auxiliary/draw/draw_vs_aos_io.c b/src/gallium/auxiliary/draw/draw_vs_aos_io.c
index f39ebb7a176..ef265d61cfd 100644
--- a/src/gallium/auxiliary/draw/draw_vs_aos_io.c
+++ b/src/gallium/auxiliary/draw/draw_vs_aos_io.c
@@ -180,7 +180,7 @@ boolean aos_fetch_inputs( struct aos_compilation *cp, boolean linear )
{
unsigned i;
- for (i = 0; i < cp->vaos->base.vs->info.num_inputs; i++) {
+ for (i = 0; i < cp->vaos->base.key.nr_inputs; i++) {
if (!load_input( cp, i, linear ))
return FALSE;
cp->insn_counter++;
@@ -282,7 +282,7 @@ boolean aos_emit_outputs( struct aos_compilation *cp )
{
unsigned i;
- for (i = 0; i < cp->vaos->base.vs->info.num_outputs; i++) {
+ for (i = 0; i < cp->vaos->base.key.nr_outputs; i++) {
unsigned format = cp->vaos->base.key.element[i].out.format;
unsigned offset = cp->vaos->base.key.element[i].out.offset;
diff --git a/src/gallium/auxiliary/draw/draw_vs_varient.c b/src/gallium/auxiliary/draw/draw_vs_varient.c
index d4deabfff35..dab46e8eed3 100644
--- a/src/gallium/auxiliary/draw/draw_vs_varient.c
+++ b/src/gallium/auxiliary/draw/draw_vs_varient.c
@@ -276,11 +276,11 @@ struct draw_vs_varient *draw_vs_varient_generic( struct draw_vertex_shader *vs,
- /* OK, have to build a new one:
+ /* Build free-standing fetch and emit functions:
*/
- fetch.nr_elements = vs->info.num_inputs;
+ fetch.nr_elements = key->nr_inputs;
fetch.output_stride = 0;
- for (i = 0; i < vs->info.num_inputs; i++) {
+ for (i = 0; i < key->nr_inputs; i++) {
fetch.element[i].input_format = key->element[i].in.format;
fetch.element[i].input_buffer = key->element[i].in.buffer;
fetch.element[i].input_offset = key->element[i].in.offset;
@@ -290,9 +290,9 @@ struct draw_vs_varient *draw_vs_varient_generic( struct draw_vertex_shader *vs,
}
- emit.nr_elements = vs->info.num_outputs;
+ emit.nr_elements = key->nr_outputs;
emit.output_stride = key->output_stride;
- for (i = 0; i < vs->info.num_outputs; i++) {
+ for (i = 0; i < key->nr_outputs; i++) {
emit.element[i].input_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
emit.element[i].input_buffer = 0;
emit.element[i].input_offset = i * 4 * sizeof(float);