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