summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian <brian@i915.localnet.net>2008-02-27 16:02:58 -0700
committerBrian <brian@i915.localnet.net>2008-02-27 16:02:58 -0700
commitcddeca51adf0d2b736a223e47b60f6ef3be85bff (patch)
tree6aa036301dcd1cd5cb4488742427fec2f5c6d7b8
parent7df26d76d2a37e9e828296bfbcf7cec04bfbe233 (diff)
gallium: remove dependencies on pipe_shader_state's semantic info
Use tgsi_scan_shader() to populate a tgsi_shader_info struct and use that instead.
-rw-r--r--src/gallium/auxiliary/draw/draw_aaline.c2
-rw-r--r--src/gallium/auxiliary/draw/draw_aapoint.c6
-rw-r--r--src/gallium/auxiliary/draw/draw_clip.c8
-rw-r--r--src/gallium/auxiliary/draw/draw_context.c8
-rw-r--r--src/gallium/auxiliary/draw/draw_flatshade.c8
-rw-r--r--src/gallium/auxiliary/draw/draw_private.h3
-rw-r--r--src/gallium/auxiliary/draw/draw_pstipple.c2
-rw-r--r--src/gallium/auxiliary/draw/draw_twoside.c12
-rw-r--r--src/gallium/auxiliary/draw/draw_vertex_fetch.c2
-rw-r--r--src/gallium/auxiliary/draw/draw_vertex_shader.c17
-rw-r--r--src/gallium/auxiliary/draw/draw_vs_exec.c2
-rw-r--r--src/gallium/auxiliary/draw/draw_vs_sse.c2
-rw-r--r--src/gallium/auxiliary/draw/draw_wide_prims.c8
13 files changed, 45 insertions, 35 deletions
diff --git a/src/gallium/auxiliary/draw/draw_aaline.c b/src/gallium/auxiliary/draw/draw_aaline.c
index be6cfd3b6a..51140388f0 100644
--- a/src/gallium/auxiliary/draw/draw_aaline.c
+++ b/src/gallium/auxiliary/draw/draw_aaline.c
@@ -340,9 +340,11 @@ generate_aaline_fs(struct aaline_stage *aaline)
tgsi_dump(aaline_fs.tokens, 0);
#endif
+#if 1 /* XXX remove */
aaline_fs.input_semantic_name[aaline_fs.num_inputs] = TGSI_SEMANTIC_GENERIC;
aaline_fs.input_semantic_index[aaline_fs.num_inputs] = transform.maxGeneric + 1;
aaline_fs.num_inputs++;
+#endif
aaline->fs->aaline_fs
= aaline->driver_create_fs_state(aaline->pipe, &aaline_fs);
diff --git a/src/gallium/auxiliary/draw/draw_aapoint.c b/src/gallium/auxiliary/draw/draw_aapoint.c
index d16adb2505..d48a416899 100644
--- a/src/gallium/auxiliary/draw/draw_aapoint.c
+++ b/src/gallium/auxiliary/draw/draw_aapoint.c
@@ -514,9 +514,11 @@ generate_aapoint_fs(struct aapoint_stage *aapoint)
tgsi_dump(aapoint_fs.tokens, 0);
#endif
+#if 1 /* XXX remove */
aapoint_fs.input_semantic_name[aapoint_fs.num_inputs] = TGSI_SEMANTIC_GENERIC;
aapoint_fs.input_semantic_index[aapoint_fs.num_inputs] = transform.maxGeneric + 1;
aapoint_fs.num_inputs++;
+#endif
aapoint->fs->aapoint_fs
= aapoint->driver_create_fs_state(aapoint->pipe, &aapoint_fs);
@@ -694,8 +696,8 @@ aapoint_first_point(struct draw_stage *stage, struct prim_header *header)
/* find PSIZ vertex output */
const struct draw_vertex_shader *vs = draw->vertex_shader;
uint i;
- for (i = 0; i < vs->state->num_outputs; i++) {
- if (vs->state->output_semantic_name[i] == TGSI_SEMANTIC_PSIZE) {
+ for (i = 0; i < vs->info.num_outputs; i++) {
+ if (vs->info.output_semantic_name[i] == TGSI_SEMANTIC_PSIZE) {
aapoint->psize_slot = i;
break;
}
diff --git a/src/gallium/auxiliary/draw/draw_clip.c b/src/gallium/auxiliary/draw/draw_clip.c
index e3051507ea..200152ecab 100644
--- a/src/gallium/auxiliary/draw/draw_clip.c
+++ b/src/gallium/auxiliary/draw/draw_clip.c
@@ -409,13 +409,13 @@ clip_init_state( struct draw_stage *stage )
clipper->flat = stage->draw->rasterizer->flatshade ? TRUE : FALSE;
if (clipper->flat) {
- const struct pipe_shader_state *vs = stage->draw->vertex_shader->state;
+ const struct draw_vertex_shader *vs = stage->draw->vertex_shader;
uint i;
clipper->num_color_attribs = 0;
- for (i = 0; i < vs->num_outputs; i++) {
- if (vs->output_semantic_name[i] == TGSI_SEMANTIC_COLOR ||
- vs->output_semantic_name[i] == TGSI_SEMANTIC_BCOLOR) {
+ for (i = 0; i < vs->info.num_outputs; i++) {
+ if (vs->info.output_semantic_name[i] == TGSI_SEMANTIC_COLOR ||
+ vs->info.output_semantic_name[i] == TGSI_SEMANTIC_BCOLOR) {
clipper->color_attribs[clipper->num_color_attribs++] = i;
}
}
diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c
index 48f00946ea..64ada8ce04 100644
--- a/src/gallium/auxiliary/draw/draw_context.c
+++ b/src/gallium/auxiliary/draw/draw_context.c
@@ -262,11 +262,11 @@ int
draw_find_vs_output(struct draw_context *draw,
uint semantic_name, uint semantic_index)
{
- const struct pipe_shader_state *vs = draw->vertex_shader->state;
+ const struct draw_vertex_shader *vs = draw->vertex_shader;
uint i;
- for (i = 0; i < vs->num_outputs; i++) {
- if (vs->output_semantic_name[i] == semantic_name &&
- vs->output_semantic_index[i] == semantic_index)
+ for (i = 0; i < vs->info.num_outputs; i++) {
+ if (vs->info.output_semantic_name[i] == semantic_name &&
+ vs->info.output_semantic_index[i] == semantic_index)
return i;
}
diff --git a/src/gallium/auxiliary/draw/draw_flatshade.c b/src/gallium/auxiliary/draw/draw_flatshade.c
index 4398abbc60..ccad71d695 100644
--- a/src/gallium/auxiliary/draw/draw_flatshade.c
+++ b/src/gallium/auxiliary/draw/draw_flatshade.c
@@ -128,14 +128,14 @@ static void flatshade_point( struct draw_stage *stage,
static void flatshade_init_state( struct draw_stage *stage )
{
struct flat_stage *flat = flat_stage(stage);
- const struct pipe_shader_state *vs = stage->draw->vertex_shader->state;
+ const struct draw_vertex_shader *vs = stage->draw->vertex_shader;
uint i;
/* Find which vertex shader outputs are colors, make a list */
flat->num_color_attribs = 0;
- for (i = 0; i < vs->num_outputs; i++) {
- if (vs->output_semantic_name[i] == TGSI_SEMANTIC_COLOR ||
- vs->output_semantic_name[i] == TGSI_SEMANTIC_BCOLOR) {
+ for (i = 0; i < vs->info.num_outputs; i++) {
+ if (vs->info.output_semantic_name[i] == TGSI_SEMANTIC_COLOR ||
+ vs->info.output_semantic_name[i] == TGSI_SEMANTIC_BCOLOR) {
flat->color_attribs[flat->num_color_attribs++] = i;
}
}
diff --git a/src/gallium/auxiliary/draw/draw_private.h b/src/gallium/auxiliary/draw/draw_private.h
index 03e3d3a66b..e988e71d23 100644
--- a/src/gallium/auxiliary/draw/draw_private.h
+++ b/src/gallium/auxiliary/draw/draw_private.h
@@ -46,6 +46,7 @@
#include "rtasm/rtasm_x86sse.h"
#include "tgsi/exec/tgsi_exec.h"
+#include "tgsi/util/tgsi_scan.h"
struct pipe_context;
@@ -134,6 +135,8 @@ struct draw_vertex_shader {
*/
const struct pipe_shader_state *state;
+ struct tgsi_shader_info info;
+
void (*prepare)( struct draw_vertex_shader *shader,
struct draw_context *draw );
diff --git a/src/gallium/auxiliary/draw/draw_pstipple.c b/src/gallium/auxiliary/draw/draw_pstipple.c
index efc88bf038..f6200aa820 100644
--- a/src/gallium/auxiliary/draw/draw_pstipple.c
+++ b/src/gallium/auxiliary/draw/draw_pstipple.c
@@ -330,11 +330,13 @@ generate_pstip_fs(struct pstip_stage *pstip)
pstip->sampler_unit = transform.maxSampler + 1;
+#if 1 /* XXX remove */
if (transform.wincoordInput < 0) {
pstip_fs.input_semantic_name[pstip_fs.num_inputs] = TGSI_SEMANTIC_POSITION;
pstip_fs.input_semantic_index[pstip_fs.num_inputs] = (ubyte)transform.maxInput;
pstip_fs.num_inputs++;
}
+#endif
pstip->fs->pstip_fs = pstip->driver_create_fs_state(pstip->pipe, &pstip_fs);
}
diff --git a/src/gallium/auxiliary/draw/draw_twoside.c b/src/gallium/auxiliary/draw/draw_twoside.c
index 1c38957987..3debaac282 100644
--- a/src/gallium/auxiliary/draw/draw_twoside.c
+++ b/src/gallium/auxiliary/draw/draw_twoside.c
@@ -119,7 +119,7 @@ static void twoside_first_tri( struct draw_stage *stage,
struct prim_header *header )
{
struct twoside_stage *twoside = twoside_stage(stage);
- const struct pipe_shader_state *vs = stage->draw->vertex_shader->state;
+ const struct draw_vertex_shader *vs = stage->draw->vertex_shader;
uint i;
twoside->attrib_front0 = 0;
@@ -128,15 +128,15 @@ static void twoside_first_tri( struct draw_stage *stage,
twoside->attrib_back1 = 0;
/* Find which vertex shader outputs are front/back colors */
- for (i = 0; i < vs->num_outputs; i++) {
- if (vs->output_semantic_name[i] == TGSI_SEMANTIC_COLOR) {
- if (vs->output_semantic_index[i] == 0)
+ for (i = 0; i < vs->info.num_outputs; i++) {
+ if (vs->info.output_semantic_name[i] == TGSI_SEMANTIC_COLOR) {
+ if (vs->info.output_semantic_index[i] == 0)
twoside->attrib_front0 = i;
else
twoside->attrib_front1 = i;
}
- if (vs->output_semantic_name[i] == TGSI_SEMANTIC_BCOLOR) {
- if (vs->output_semantic_index[i] == 0)
+ if (vs->info.output_semantic_name[i] == TGSI_SEMANTIC_BCOLOR) {
+ if (vs->info.output_semantic_index[i] == 0)
twoside->attrib_back0 = i;
else
twoside->attrib_back1 = i;
diff --git a/src/gallium/auxiliary/draw/draw_vertex_fetch.c b/src/gallium/auxiliary/draw/draw_vertex_fetch.c
index e13df04605..cb8cdd04a3 100644
--- a/src/gallium/auxiliary/draw/draw_vertex_fetch.c
+++ b/src/gallium/auxiliary/draw/draw_vertex_fetch.c
@@ -473,7 +473,7 @@ void draw_update_vertex_fetch( struct draw_context *draw )
if (!draw->vertex_shader)
return;
- nr_attrs = draw->vertex_shader->state->num_inputs;
+ nr_attrs = draw->vertex_shader->info.num_inputs;
for (i = 0; i < nr_attrs; i++) {
unsigned buf = draw->vertex_element[i].vertex_buffer_index;
diff --git a/src/gallium/auxiliary/draw/draw_vertex_shader.c b/src/gallium/auxiliary/draw/draw_vertex_shader.c
index 5d2f5c9c43..1e95355555 100644
--- a/src/gallium/auxiliary/draw/draw_vertex_shader.c
+++ b/src/gallium/auxiliary/draw/draw_vertex_shader.c
@@ -91,15 +91,16 @@ draw_create_vertex_shader(struct draw_context *draw,
struct draw_vertex_shader *vs;
vs = draw_create_vs_llvm( draw, shader );
- if (vs)
- return vs;
+ if (!vs) {
+ vs = draw_create_vs_sse( draw, shader );
+ if (!vs) {
+ vs = draw_create_vs_exec( draw, shader );
+ }
+ }
+ assert(vs);
- vs = draw_create_vs_sse( draw, shader );
- if (vs)
- return vs;
+ tgsi_scan_shader(shader->tokens, &vs->info);
- vs = draw_create_vs_exec( draw, shader );
- assert(vs);
return vs;
}
@@ -111,7 +112,7 @@ draw_bind_vertex_shader(struct draw_context *draw,
draw_do_flush( draw, DRAW_FLUSH_STATE_CHANGE );
draw->vertex_shader = dvs;
- draw->num_vs_outputs = dvs->state->num_outputs;
+ draw->num_vs_outputs = dvs->info.num_outputs;
tgsi_exec_machine_init(&draw->machine);
diff --git a/src/gallium/auxiliary/draw/draw_vs_exec.c b/src/gallium/auxiliary/draw/draw_vs_exec.c
index 8588879400..583812aadd 100644
--- a/src/gallium/auxiliary/draw/draw_vs_exec.c
+++ b/src/gallium/auxiliary/draw/draw_vs_exec.c
@@ -103,7 +103,7 @@ vs_exec_run( struct draw_vertex_shader *shader,
const float *trans = draw->viewport.translate;
assert(count <= 4);
- assert(draw->vertex_shader->state->output_semantic_name[0]
+ assert(draw->vertex_shader->info.output_semantic_name[0]
== TGSI_SEMANTIC_POSITION);
machine->Consts = (float (*)[4]) draw->user.constants;
diff --git a/src/gallium/auxiliary/draw/draw_vs_sse.c b/src/gallium/auxiliary/draw/draw_vs_sse.c
index 11ef0c503d..0b8bc2bf14 100644
--- a/src/gallium/auxiliary/draw/draw_vs_sse.c
+++ b/src/gallium/auxiliary/draw/draw_vs_sse.c
@@ -119,7 +119,7 @@ vs_sse_run( struct draw_vertex_shader *base,
const float *trans = draw->viewport.translate;
assert(count <= 4);
- assert(draw->vertex_shader->state->output_semantic_name[0]
+ assert(draw->vertex_shader->info.output_semantic_name[0]
== TGSI_SEMANTIC_POSITION);
/* Consts does not require 16 byte alignment. */
diff --git a/src/gallium/auxiliary/draw/draw_wide_prims.c b/src/gallium/auxiliary/draw/draw_wide_prims.c
index d967810dd4..d6bff110b4 100644
--- a/src/gallium/auxiliary/draw/draw_wide_prims.c
+++ b/src/gallium/auxiliary/draw/draw_wide_prims.c
@@ -278,8 +278,8 @@ static void wide_first_point( struct draw_stage *stage,
/* find vertex shader texcoord outputs */
const struct draw_vertex_shader *vs = draw->vertex_shader;
uint i, j = 0;
- for (i = 0; i < vs->state->num_outputs; i++) {
- if (vs->state->output_semantic_name[i] == TGSI_SEMANTIC_GENERIC) {
+ for (i = 0; i < vs->info.num_outputs; i++) {
+ if (vs->info.output_semantic_name[i] == TGSI_SEMANTIC_GENERIC) {
wide->texcoord_slot[j] = i;
wide->texcoord_mode[j] = draw->rasterizer->sprite_coord_mode[j];
j++;
@@ -294,8 +294,8 @@ static void wide_first_point( struct draw_stage *stage,
/* find PSIZ vertex output */
const struct draw_vertex_shader *vs = draw->vertex_shader;
uint i;
- for (i = 0; i < vs->state->num_outputs; i++) {
- if (vs->state->output_semantic_name[i] == TGSI_SEMANTIC_PSIZE) {
+ for (i = 0; i < vs->info.num_outputs; i++) {
+ if (vs->info.output_semantic_name[i] == TGSI_SEMANTIC_PSIZE) {
wide->psize_slot = i;
break;
}