mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-07 19:30:12 +01:00
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.
This commit is contained in:
parent
7df26d76d2
commit
cddeca51ad
13 changed files with 46 additions and 36 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 );
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
vs = draw_create_vs_sse( draw, shader );
|
||||
if (vs)
|
||||
return vs;
|
||||
|
||||
vs = draw_create_vs_exec( draw, shader );
|
||||
if (!vs) {
|
||||
vs = draw_create_vs_sse( draw, shader );
|
||||
if (!vs) {
|
||||
vs = draw_create_vs_exec( draw, shader );
|
||||
}
|
||||
}
|
||||
assert(vs);
|
||||
|
||||
tgsi_scan_shader(shader->tokens, &vs->info);
|
||||
|
||||
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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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. */
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue