mesa: pass shader centroid/invariant info through to the TGSI shader
This commit is contained in:
@@ -578,7 +578,8 @@ make_input_decl(
|
||||
GLuint usage_mask,
|
||||
GLboolean semantic_info,
|
||||
GLuint semantic_name,
|
||||
GLbitfield semantic_index )
|
||||
GLbitfield semantic_index,
|
||||
GLbitfield input_flags)
|
||||
{
|
||||
struct tgsi_full_declaration decl;
|
||||
|
||||
@@ -597,6 +598,10 @@ make_input_decl(
|
||||
if (interpolate_info) {
|
||||
decl.Declaration.Interpolate = interpolate;
|
||||
}
|
||||
if (input_flags & PROG_PARAM_BIT_CENTROID)
|
||||
decl.Declaration.Centroid = 1;
|
||||
if (input_flags & PROG_PARAM_BIT_INVARIANT)
|
||||
decl.Declaration.Invariant = 1;
|
||||
|
||||
return decl;
|
||||
}
|
||||
@@ -609,7 +614,8 @@ make_output_decl(
|
||||
GLuint index,
|
||||
GLuint semantic_name,
|
||||
GLuint semantic_index,
|
||||
GLbitfield usage_mask )
|
||||
GLuint usage_mask,
|
||||
GLbitfield output_flags)
|
||||
{
|
||||
struct tgsi_full_declaration decl;
|
||||
|
||||
@@ -623,6 +629,10 @@ make_output_decl(
|
||||
decl.DeclarationRange.Last = index;
|
||||
decl.Semantic.SemanticName = semantic_name;
|
||||
decl.Semantic.SemanticIndex = semantic_index;
|
||||
if (output_flags & PROG_PARAM_BIT_CENTROID)
|
||||
decl.Declaration.Centroid = 1;
|
||||
if (output_flags & PROG_PARAM_BIT_INVARIANT)
|
||||
decl.Declaration.Invariant = 1;
|
||||
|
||||
return decl;
|
||||
}
|
||||
@@ -736,10 +746,12 @@ st_translate_mesa_program(
|
||||
const ubyte inputSemanticName[],
|
||||
const ubyte inputSemanticIndex[],
|
||||
const GLuint interpMode[],
|
||||
const GLbitfield inputFlags[],
|
||||
GLuint numOutputs,
|
||||
const GLuint outputMapping[],
|
||||
const ubyte outputSemanticName[],
|
||||
const ubyte outputSemanticIndex[],
|
||||
const GLbitfield outputFlags[],
|
||||
struct tgsi_token *tokens,
|
||||
GLuint maxTokens )
|
||||
{
|
||||
@@ -777,7 +789,8 @@ st_translate_mesa_program(
|
||||
GL_TRUE, interpMode[i],
|
||||
TGSI_WRITEMASK_XYZW,
|
||||
GL_TRUE, inputSemanticName[i],
|
||||
inputSemanticIndex[i]);
|
||||
inputSemanticIndex[i],
|
||||
inputFlags[i]);
|
||||
ti += tgsi_build_full_declaration(&fulldecl,
|
||||
&tokens[ti],
|
||||
header,
|
||||
@@ -794,7 +807,8 @@ st_translate_mesa_program(
|
||||
fulldecl = make_input_decl(i,
|
||||
GL_FALSE, 0,
|
||||
TGSI_WRITEMASK_XYZW,
|
||||
GL_FALSE, 0, 0);
|
||||
GL_FALSE, 0, 0,
|
||||
inputFlags[i]);
|
||||
ti += tgsi_build_full_declaration(&fulldecl,
|
||||
&tokens[ti],
|
||||
header,
|
||||
@@ -813,13 +827,15 @@ st_translate_mesa_program(
|
||||
fulldecl = make_output_decl(i,
|
||||
TGSI_SEMANTIC_POSITION, /* Z / Depth */
|
||||
outputSemanticIndex[i],
|
||||
TGSI_WRITEMASK_Z );
|
||||
TGSI_WRITEMASK_Z,
|
||||
outputFlags[i]);
|
||||
break;
|
||||
case TGSI_SEMANTIC_COLOR:
|
||||
fulldecl = make_output_decl(i,
|
||||
TGSI_SEMANTIC_COLOR,
|
||||
outputSemanticIndex[i],
|
||||
TGSI_WRITEMASK_XYZW );
|
||||
TGSI_WRITEMASK_XYZW,
|
||||
outputFlags[i]);
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
@@ -838,7 +854,8 @@ st_translate_mesa_program(
|
||||
fulldecl = make_output_decl(i,
|
||||
outputSemanticName[i],
|
||||
outputSemanticIndex[i],
|
||||
TGSI_WRITEMASK_XYZW );
|
||||
TGSI_WRITEMASK_XYZW,
|
||||
outputFlags[i]);
|
||||
ti += tgsi_build_full_declaration(&fulldecl,
|
||||
&tokens[ti],
|
||||
header,
|
||||
|
@@ -48,10 +48,12 @@ st_translate_mesa_program(
|
||||
const ubyte inputSemanticName[],
|
||||
const ubyte inputSemanticIndex[],
|
||||
const GLuint interpMode[],
|
||||
const GLbitfield inputFlags[],
|
||||
GLuint numOutputs,
|
||||
const GLuint outputMapping[],
|
||||
const ubyte outputSemanticName[],
|
||||
const ubyte outputSemanticIndex[],
|
||||
const GLbitfield outputFlags[],
|
||||
struct tgsi_token *tokens,
|
||||
GLuint maxTokens );
|
||||
|
||||
|
@@ -99,7 +99,12 @@ st_translate_vertex_program(struct st_context *st,
|
||||
ubyte vs_output_semantic_index[PIPE_MAX_SHADER_OUTPUTS];
|
||||
uint vs_num_outputs = 0;
|
||||
|
||||
GLbitfield input_flags[MAX_PROGRAM_INPUTS];
|
||||
GLbitfield output_flags[MAX_PROGRAM_OUTPUTS];
|
||||
|
||||
memset(&vs, 0, sizeof(vs));
|
||||
memset(input_flags, 0, sizeof(input_flags));
|
||||
memset(output_flags, 0, sizeof(output_flags));
|
||||
|
||||
if (stvp->Base.IsPositionInvariant)
|
||||
_mesa_insert_mvp_code(st->ctx, &stvp->Base);
|
||||
@@ -171,6 +176,8 @@ st_translate_vertex_program(struct st_context *st,
|
||||
default:
|
||||
assert(0);
|
||||
}
|
||||
|
||||
input_flags[slot] = stvp->Base.Base.InputFlags[attr];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -192,6 +199,7 @@ st_translate_vertex_program(struct st_context *st,
|
||||
for (i = 0; i < PIPE_MAX_SHADER_OUTPUTS; i++) {
|
||||
vs_output_semantic_name[i] = TGSI_SEMANTIC_GENERIC;
|
||||
vs_output_semantic_index[i] = 0;
|
||||
output_flags[i] = 0x0;
|
||||
}
|
||||
|
||||
num_generic = 0;
|
||||
@@ -276,6 +284,8 @@ st_translate_vertex_program(struct st_context *st,
|
||||
vs_output_semantic_index[slot] = num_generic++;
|
||||
}
|
||||
}
|
||||
|
||||
output_flags[slot] = stvp->Base.Base.OutputFlags[attr];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -315,11 +325,13 @@ st_translate_vertex_program(struct st_context *st,
|
||||
vs_input_semantic_name,
|
||||
vs_input_semantic_index,
|
||||
NULL,
|
||||
input_flags,
|
||||
/* outputs */
|
||||
vs_num_outputs,
|
||||
outputMapping,
|
||||
vs_output_semantic_name,
|
||||
vs_output_semantic_index,
|
||||
output_flags,
|
||||
/* tokenized result */
|
||||
tokens, ST_MAX_SHADER_TOKENS);
|
||||
|
||||
@@ -371,7 +383,12 @@ st_translate_fragment_program(struct st_context *st,
|
||||
ubyte fs_output_semantic_index[PIPE_MAX_SHADER_OUTPUTS];
|
||||
uint fs_num_outputs = 0;
|
||||
|
||||
GLbitfield input_flags[MAX_PROGRAM_INPUTS];
|
||||
GLbitfield output_flags[MAX_PROGRAM_OUTPUTS];
|
||||
|
||||
memset(&fs, 0, sizeof(fs));
|
||||
memset(input_flags, 0, sizeof(input_flags));
|
||||
memset(output_flags, 0, sizeof(output_flags));
|
||||
|
||||
/* which vertex output goes to the first fragment input: */
|
||||
if (inputsRead & FRAG_BIT_WPOS)
|
||||
@@ -435,6 +452,8 @@ st_translate_fragment_program(struct st_context *st,
|
||||
stfp->input_semantic_index[slot] = num_generic++;
|
||||
interpMode[slot] = TGSI_INTERPOLATE_PERSPECTIVE;
|
||||
}
|
||||
|
||||
input_flags[slot] = stfp->Base.Base.InputFlags[attr];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -471,6 +490,9 @@ st_translate_fragment_program(struct st_context *st,
|
||||
default:
|
||||
assert(0);
|
||||
}
|
||||
|
||||
output_flags[fs_num_outputs] = stfp->Base.Base.OutputFlags[attr];
|
||||
|
||||
fs_num_outputs++;
|
||||
}
|
||||
}
|
||||
@@ -489,11 +511,13 @@ st_translate_fragment_program(struct st_context *st,
|
||||
stfp->input_semantic_name,
|
||||
stfp->input_semantic_index,
|
||||
interpMode,
|
||||
input_flags,
|
||||
/* outputs */
|
||||
fs_num_outputs,
|
||||
outputMapping,
|
||||
fs_output_semantic_name,
|
||||
fs_output_semantic_index,
|
||||
output_flags,
|
||||
/* tokenized result */
|
||||
tokens, ST_MAX_SHADER_TOKENS);
|
||||
|
||||
|
Reference in New Issue
Block a user