diff options
Diffstat (limited to 'src/mesa/pipe')
-rw-r--r-- | src/mesa/pipe/draw/draw_vertex_shader.c | 3 | ||||
-rw-r--r-- | src/mesa/pipe/i915simple/i915_fpc.h | 3 | ||||
-rw-r--r-- | src/mesa/pipe/i915simple/i915_fpc_translate.c | 48 | ||||
-rw-r--r-- | src/mesa/pipe/i915simple/i915_state_derived.c | 32 | ||||
-rw-r--r-- | src/mesa/pipe/p_state.h | 8 | ||||
-rw-r--r-- | src/mesa/pipe/softpipe/sp_state_derived.c | 24 | ||||
-rwxr-xr-x | src/mesa/pipe/tgsi/exec/tgsi_build.c | 2 | ||||
-rwxr-xr-x | src/mesa/pipe/tgsi/exec/tgsi_dump.c | 22 | ||||
-rw-r--r-- | src/mesa/pipe/tgsi/exec/tgsi_token.h | 24 | ||||
-rw-r--r-- | src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.c | 23 | ||||
-rw-r--r-- | src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.h | 3 |
11 files changed, 93 insertions, 99 deletions
diff --git a/src/mesa/pipe/draw/draw_vertex_shader.c b/src/mesa/pipe/draw/draw_vertex_shader.c index 6461e3e3ba..ef0399c46e 100644 --- a/src/mesa/pipe/draw/draw_vertex_shader.c +++ b/src/mesa/pipe/draw/draw_vertex_shader.c @@ -94,7 +94,8 @@ run_vertex_program(struct draw_context *draw, const float *trans = draw->viewport.translate; assert(count <= 4); - assert(draw->vertex_shader.output_semantics[0] == TGSI_SEMANTIC_POSITION); + assert(draw->vertex_shader.output_semantic_name[0] + == TGSI_SEMANTIC_POSITION); #ifdef DEBUG memset( &machine, 0, sizeof( machine ) ); diff --git a/src/mesa/pipe/i915simple/i915_fpc.h b/src/mesa/pipe/i915simple/i915_fpc.h index 5c4f2f90e9..5fdc7ef27e 100644 --- a/src/mesa/pipe/i915simple/i915_fpc.h +++ b/src/mesa/pipe/i915simple/i915_fpc.h @@ -51,7 +51,8 @@ struct i915_fp_compile { uint declarations[I915_PROGRAM_SIZE]; uint program[I915_PROGRAM_SIZE]; - uint input_semantic[PIPE_MAX_SHADER_INPUTS]; + uint input_semantic_name[PIPE_MAX_SHADER_INPUTS]; + uint input_semantic_index[PIPE_MAX_SHADER_INPUTS]; /** points into the i915->current.constants array: */ float (*constants)[4]; diff --git a/src/mesa/pipe/i915simple/i915_fpc_translate.c b/src/mesa/pipe/i915simple/i915_fpc_translate.c index df8859bec8..6f78c72e04 100644 --- a/src/mesa/pipe/i915simple/i915_fpc_translate.c +++ b/src/mesa/pipe/i915simple/i915_fpc_translate.c @@ -128,7 +128,7 @@ src_vector(struct i915_fp_compile *p, const struct tgsi_full_src_register *source) { uint index = source->SrcRegister.Index; - uint src, sem; + uint src, sem_name, sem_ind; switch (source->SrcRegister.File) { case TGSI_FILE_TEMPORARY: @@ -152,10 +152,11 @@ src_vector(struct i915_fp_compile *p, /* use vertex format info to map a slot number to a VF attrib */ assert(index < p->vertex_info->num_attribs); - sem = p->input_semantic[index]; + sem_name = p->input_semantic_name[index]; + sem_ind = p->input_semantic_index[index]; #if 1 - switch (sem) { + switch (sem_name) { case TGSI_SEMANTIC_POSITION: printf("SKIP SEM POS\n"); /* @@ -163,28 +164,23 @@ src_vector(struct i915_fp_compile *p, src = i915_emit_decl(p, REG_TYPE_T, p->wpos_tex, D0_CHANNEL_ALL); */ break; - case TGSI_SEMANTIC_COLOR0: - src = i915_emit_decl(p, REG_TYPE_T, T_DIFFUSE, D0_CHANNEL_ALL); - break; - case TGSI_SEMANTIC_COLOR1: - src = i915_emit_decl(p, REG_TYPE_T, T_SPECULAR, D0_CHANNEL_XYZ); - src = swizzle(src, X, Y, Z, ONE); + case TGSI_SEMANTIC_COLOR: + if (sem_ind == 0) { + src = i915_emit_decl(p, REG_TYPE_T, T_DIFFUSE, D0_CHANNEL_ALL); + } + else { + /* secondary color */ + assert(sem_ind == 1); + src = i915_emit_decl(p, REG_TYPE_T, T_SPECULAR, D0_CHANNEL_XYZ); + src = swizzle(src, X, Y, Z, ONE); + } break; case TGSI_SEMANTIC_FOG: src = i915_emit_decl(p, REG_TYPE_T, T_FOG_W, D0_CHANNEL_W); src = swizzle(src, W, W, W, W); break; - case TGSI_SEMANTIC_TEX0: - case TGSI_SEMANTIC_TEX1: - case TGSI_SEMANTIC_TEX2: - case TGSI_SEMANTIC_TEX3: - case TGSI_SEMANTIC_TEX4: - case TGSI_SEMANTIC_TEX5: - case TGSI_SEMANTIC_TEX6: - case TGSI_SEMANTIC_TEX7: - src = i915_emit_decl(p, REG_TYPE_T, - T_TEX0 + (sem - TGSI_SEMANTIC_TEX0), - D0_CHANNEL_ALL); + case TGSI_SEMANTIC_TEXCOORD: + src = i915_emit_decl(p, REG_TYPE_T, T_TEX0 + sem_ind, D0_CHANNEL_ALL); break; default: i915_program_error(p, "Bad source->Index"); @@ -895,11 +891,13 @@ i915_translate_instructions(struct i915_fp_compile *p, if (parse.FullToken.FullDeclaration.Declaration.File == TGSI_FILE_INPUT) { /* save input register info for use in src_vector() */ - uint ind, sem; + uint ind, sem, semi; ind = parse.FullToken.FullDeclaration.u.DeclarationRange.First; sem = parse.FullToken.FullDeclaration.Semantic.SemanticName; + semi = parse.FullToken.FullDeclaration.Semantic.SemanticIndex; /*printf("FS Input DECL [%u] sem %u\n", ind, sem);*/ - p->input_semantic[ind] = sem; + p->input_semantic_name[ind] = sem; + p->input_semantic_index[ind] = semi; } break; @@ -1059,7 +1057,7 @@ i915_find_wpos_space(struct i915_fp_compile *p) i915_program_error(p, "No free texcoord for wpos value"); } #else - if (p->shader->input_semantics[0] == TGSI_SEMANTIC_POSITION) { + if (p->shader->input_semantic_name[0] == TGSI_SEMANTIC_POSITION) { /* frag shader using the fragment position input */ #if 0 assert(0); @@ -1079,8 +1077,8 @@ i915_find_wpos_space(struct i915_fp_compile *p) static void i915_fixup_depth_write(struct i915_fp_compile *p) { - /* XXX assuming depth is always in output[0] */ - if (p->shader->output_semantics[0] == TGSI_SEMANTIC_DEPTH) { + /* XXX assuming pos/depth is always in output[0] */ + if (p->shader->output_semantic_name[0] == TGSI_SEMANTIC_POSITION) { const uint depth = UREG(REG_TYPE_OD, 0); i915_emit_arith(p, diff --git a/src/mesa/pipe/i915simple/i915_state_derived.c b/src/mesa/pipe/i915simple/i915_state_derived.c index 2a03650620..e825971199 100644 --- a/src/mesa/pipe/i915simple/i915_state_derived.c +++ b/src/mesa/pipe/i915simple/i915_state_derived.c @@ -59,28 +59,24 @@ static void calculate_vertex_layout( struct i915_context *i915 ) /* Note: we'll set the S4_VFMT_XYZ[W] bits below */ for (i = 0; i < fs->num_inputs; i++) { - switch (fs->input_semantics[i]) { + switch (fs->input_semantic_name[i]) { case TGSI_SEMANTIC_POSITION: break; - case TGSI_SEMANTIC_COLOR0: - front0 = draw_emit_vertex_attr(vinfo, FORMAT_4UB, colorInterp); - vinfo->hwfmt[0] |= S4_VFMT_COLOR; - break; - case TGSI_SEMANTIC_COLOR1: - assert(0); /* untested */ - front1 = draw_emit_vertex_attr(vinfo, FORMAT_4UB, colorInterp); - vinfo->hwfmt[0] |= S4_VFMT_SPEC_FOG; + case TGSI_SEMANTIC_COLOR: + if (fs->input_semantic_index[i] == 0) { + front0 = draw_emit_vertex_attr(vinfo, FORMAT_4UB, colorInterp); + vinfo->hwfmt[0] |= S4_VFMT_COLOR; + } + else { + assert(fs->input_semantic_index[i] == 1); + assert(0); /* untested */ + front1 = draw_emit_vertex_attr(vinfo, FORMAT_4UB, colorInterp); + vinfo->hwfmt[0] |= S4_VFMT_SPEC_FOG; + } break; - case TGSI_SEMANTIC_TEX0: - case TGSI_SEMANTIC_TEX1: - case TGSI_SEMANTIC_TEX2: - case TGSI_SEMANTIC_TEX3: - case TGSI_SEMANTIC_TEX4: - case TGSI_SEMANTIC_TEX5: - case TGSI_SEMANTIC_TEX6: - case TGSI_SEMANTIC_TEX7: + case TGSI_SEMANTIC_TEXCOORD: { - const uint unit = fs->input_semantics[i] - TGSI_SEMANTIC_TEX0; + const uint unit = fs->input_semantic_index[i]; uint hwtc; texCoords[unit] = TRUE; draw_emit_vertex_attr(vinfo, FORMAT_4F, INTERP_PERSPECTIVE); diff --git a/src/mesa/pipe/p_state.h b/src/mesa/pipe/p_state.h index 6396d49b84..d67736c558 100644 --- a/src/mesa/pipe/p_state.h +++ b/src/mesa/pipe/p_state.h @@ -148,8 +148,12 @@ struct pipe_shader_state { /** These fields somewhat constitute the shader "signature" */ ubyte num_inputs; ubyte num_outputs; - ubyte input_semantics[PIPE_MAX_SHADER_INPUTS]; - ubyte output_semantics[PIPE_MAX_SHADER_OUTPUTS]; + + ubyte input_semantic_name[PIPE_MAX_SHADER_INPUTS]; /**< TGSI_SEMANTIC_x */ + ubyte input_semantic_index[PIPE_MAX_SHADER_INPUTS]; + + ubyte output_semantic_name[PIPE_MAX_SHADER_OUTPUTS]; /**< TGSI_SEMANTIC_x */ + ubyte output_semantic_index[PIPE_MAX_SHADER_OUTPUTS]; }; struct pipe_depth_stencil_state diff --git a/src/mesa/pipe/softpipe/sp_state_derived.c b/src/mesa/pipe/softpipe/sp_state_derived.c index b51ab66cf3..66e5cc48f6 100644 --- a/src/mesa/pipe/softpipe/sp_state_derived.c +++ b/src/mesa/pipe/softpipe/sp_state_derived.c @@ -65,7 +65,7 @@ static void calculate_vertex_layout( struct softpipe_context *softpipe ) draw_emit_vertex_attr(vinfo, FORMAT_4F, INTERP_LINEAR); for (i = 0; i < fs->num_inputs; i++) { - switch (fs->input_semantics[i]) { + switch (fs->input_semantic_name[i]) { case TGSI_SEMANTIC_POSITION: /* Need Z if depth test is enabled or the fragment program uses the * fragment position (XYZW). @@ -73,13 +73,16 @@ static void calculate_vertex_layout( struct softpipe_context *softpipe ) softpipe->need_z = TRUE; softpipe->need_w = TRUE; break; - case TGSI_SEMANTIC_COLOR0: - front0 = draw_emit_vertex_attr(vinfo, - FORMAT_4F, colorInterp); - break; - case TGSI_SEMANTIC_COLOR1: - front1 = draw_emit_vertex_attr(vinfo, - FORMAT_4F, colorInterp); + case TGSI_SEMANTIC_COLOR: + if (fs->input_semantic_index[i] == 0) { + front0 = draw_emit_vertex_attr(vinfo, + FORMAT_4F, colorInterp); + } + else { + assert(fs->input_semantic_index[i] == 1); + front1 = draw_emit_vertex_attr(vinfo, + FORMAT_4F, colorInterp); + } break; case TGSI_SEMANTIC_FOG: draw_emit_vertex_attr(vinfo, @@ -96,12 +99,13 @@ static void calculate_vertex_layout( struct softpipe_context *softpipe ) #endif softpipe->psize_slot = i; /*case TGSI_SEMANTIC_TEXCOORD:*/ - case TGSI_SEMANTIC_TEX0: + case TGSI_SEMANTIC_TEXCOORD: + /* unit = fs->input_semantic_index[i] */ draw_emit_vertex_attr(vinfo, FORMAT_4F, INTERP_PERSPECTIVE); softpipe->need_w = TRUE; break; - case TGSI_SEMANTIC_OTHER: + case TGSI_SEMANTIC_GENERIC: draw_emit_vertex_attr(vinfo, FORMAT_4F, INTERP_PERSPECTIVE); softpipe->need_w = TRUE; break; diff --git a/src/mesa/pipe/tgsi/exec/tgsi_build.c b/src/mesa/pipe/tgsi/exec/tgsi_build.c index 1320872c64..78f648aae2 100755 --- a/src/mesa/pipe/tgsi/exec/tgsi_build.c +++ b/src/mesa/pipe/tgsi/exec/tgsi_build.c @@ -309,7 +309,7 @@ tgsi_default_declaration_semantic( void ) { struct tgsi_declaration_semantic ds; - ds.SemanticName = TGSI_SEMANTIC_DEPTH; + ds.SemanticName = TGSI_SEMANTIC_POSITION; ds.SemanticIndex = 0; ds.Padding = 0; diff --git a/src/mesa/pipe/tgsi/exec/tgsi_dump.c b/src/mesa/pipe/tgsi/exec/tgsi_dump.c index 0a47ad2a8c..315354198a 100755 --- a/src/mesa/pipe/tgsi/exec/tgsi_dump.c +++ b/src/mesa/pipe/tgsi/exec/tgsi_dump.c @@ -201,28 +201,22 @@ static const char *TGSI_INTERPOLATES_SHORT[] = static const char *TGSI_SEMANTICS[] = { - "SEMANTIC_DEPTH", - "SEMANTIC_COLOR0", - "SEMANTIC_COLOR1", - "SEMANTIC_COLOR0B", - "SEMANTIC_COLOR1B", "SEMANTIC_POSITION", + "SEMANTIC_COLOR", + "SEMANTIC_BCOLOR", "SEMANTIC_FOG", - "SEMANTIC_OTHER," - "SEMANTIC_TEX0", + "SEMANTIC_TEXCOORD", + "SEMANTIC_GENERIC," }; static const char *TGSI_SEMANTICS_SHORT[] = { - "DEPTH", - "COLOR0", - "COLOR1", - "COLOR0B", - "COLOR1B", "POSITION", + "COLOR", + "BCOLOR", "FOG", - "OTHER", - "TEX0" + "TEXCOORD", + "GENERIC", }; static const char *TGSI_IMMS[] = diff --git a/src/mesa/pipe/tgsi/exec/tgsi_token.h b/src/mesa/pipe/tgsi/exec/tgsi_token.h index a642ba131a..2d468b801e 100644 --- a/src/mesa/pipe/tgsi/exec/tgsi_token.h +++ b/src/mesa/pipe/tgsi/exec/tgsi_token.h @@ -103,23 +103,13 @@ struct tgsi_declaration_interpolation unsigned Padding : 28; }; -#define TGSI_SEMANTIC_DEPTH 0 -#define TGSI_SEMANTIC_COLOR0 1 -#define TGSI_SEMANTIC_COLOR1 2 -#define TGSI_SEMANTIC_COLOR0B 3 /**< back-face primary color */ -#define TGSI_SEMANTIC_COLOR1B 4 /**< back-face secondary color */ -#define TGSI_SEMANTIC_POSITION 5 -#define TGSI_SEMANTIC_FOG 6 -#define TGSI_SEMANTIC_OTHER 7 /* XXX temp */ -#define TGSI_SEMANTIC_TEX0 8 -#define TGSI_SEMANTIC_TEX1 9 -#define TGSI_SEMANTIC_TEX2 10 -#define TGSI_SEMANTIC_TEX3 11 -#define TGSI_SEMANTIC_TEX4 12 -#define TGSI_SEMANTIC_TEX5 13 -#define TGSI_SEMANTIC_TEX6 14 -#define TGSI_SEMANTIC_TEX7 15 -#define TGSI_SEMANTIC_COUNT 16 /**< number of semantic values */ +#define TGSI_SEMANTIC_POSITION 0 +#define TGSI_SEMANTIC_COLOR 1 +#define TGSI_SEMANTIC_BCOLOR 2 /**< back-face color */ +#define TGSI_SEMANTIC_FOG 3 +#define TGSI_SEMANTIC_TEXCOORD 4 +#define TGSI_SEMANTIC_GENERIC 5 +#define TGSI_SEMANTIC_COUNT 6 /**< number of semantic values */ struct tgsi_declaration_semantic { diff --git a/src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.c b/src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.c index 115c5d1eb0..c7b62c9b84 100644 --- a/src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.c +++ b/src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.c @@ -473,7 +473,8 @@ make_frag_input_decl( GLuint index,
GLuint interpolate,
GLuint usage_mask,
- GLuint semantic_name )
+ GLuint semantic_name,
+ GLuint semantic_index )
{
struct tgsi_full_declaration decl;
@@ -486,6 +487,7 @@ make_frag_input_decl( decl.u.DeclarationRange.First = index;
decl.u.DeclarationRange.Last = index;
decl.Semantic.SemanticName = semantic_name;
+ decl.Semantic.SemanticIndex = semantic_index;
decl.Interpolation.Interpolate = interpolate;
return decl;
@@ -495,6 +497,7 @@ static struct tgsi_full_declaration make_frag_output_decl(
GLuint index,
GLuint semantic_name,
+ GLuint semantic_index,
GLuint usage_mask )
{
struct tgsi_full_declaration decl;
@@ -507,7 +510,7 @@ make_frag_output_decl( decl.u.DeclarationRange.First = index;
decl.u.DeclarationRange.Last = index;
decl.Semantic.SemanticName = semantic_name;
- decl.Semantic.SemanticIndex = 0;
+ decl.Semantic.SemanticIndex = semantic_index;
return decl;
}
@@ -528,7 +531,8 @@ tgsi_mesa_compile_fp_program( const struct gl_fragment_program *program,
GLuint numInputs,
const GLuint inputMapping[],
- const ubyte inputSemantic[],
+ const ubyte inputSemanticName[],
+ const ubyte inputSemanticIndex[],
const GLuint interpMode[],
const GLuint outputMapping[],
struct tgsi_token *tokens,
@@ -553,13 +557,13 @@ tgsi_mesa_compile_fp_program( ti = 3;
for (i = 0; i < numInputs; i++) {
- switch (inputSemantic[i]) {
+ switch (inputSemanticName[i]) {
case TGSI_SEMANTIC_POSITION:
/* Fragment XY pos */
fulldecl = make_frag_input_decl(i,
TGSI_INTERPOLATE_CONSTANT,
TGSI_WRITEMASK_XY,
- TGSI_SEMANTIC_POSITION );
+ TGSI_SEMANTIC_POSITION, 0 );
ti += tgsi_build_full_declaration(
&fulldecl,
&tokens[ti],
@@ -569,7 +573,7 @@ tgsi_mesa_compile_fp_program( fulldecl = make_frag_input_decl(i,
TGSI_INTERPOLATE_LINEAR,
TGSI_WRITEMASK_ZW,
- TGSI_SEMANTIC_POSITION );
+ TGSI_SEMANTIC_POSITION, 0 );
ti += tgsi_build_full_declaration(
&fulldecl,
&tokens[ti],
@@ -580,7 +584,8 @@ tgsi_mesa_compile_fp_program( fulldecl = make_frag_input_decl(i,
interpMode[i],
TGSI_WRITEMASK_XYZW,
- inputSemantic[i] );
+ inputSemanticName[i],
+ inputSemanticIndex[i]);
ti += tgsi_build_full_declaration(&fulldecl,
&tokens[ti],
header,
@@ -599,7 +604,7 @@ tgsi_mesa_compile_fp_program( fulldecl = make_frag_output_decl(
0,
- TGSI_SEMANTIC_DEPTH,
+ TGSI_SEMANTIC_POSITION, 0, /* Z / Depth */
TGSI_WRITEMASK_Z );
ti += tgsi_build_full_declaration(
&fulldecl,
@@ -610,7 +615,7 @@ tgsi_mesa_compile_fp_program( if( program->Base.OutputsWritten & (1 << FRAG_RESULT_COLR) ) {
fulldecl = make_frag_output_decl(
1,
- TGSI_SEMANTIC_COLOR0,
+ TGSI_SEMANTIC_COLOR, 0,
TGSI_WRITEMASK_XYZW );
ti += tgsi_build_full_declaration(
&fulldecl,
diff --git a/src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.h b/src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.h index d61d80bab0..b40331981e 100644 --- a/src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.h +++ b/src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.h @@ -12,7 +12,8 @@ tgsi_mesa_compile_fp_program( const struct gl_fragment_program *program,
GLuint numInputs,
const GLuint inputMapping[],
- const ubyte inputSemantic[],
+ const ubyte inputSemanticName[],
+ const ubyte inputSemanticIndex[],
const GLuint interpMode[],
const GLuint outputMapping[],
struct tgsi_token *tokens,
|