diff options
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/state_tracker/st_mesa_to_tgsi.c | 31 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_mesa_to_tgsi.h | 2 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_program.c | 84 |
3 files changed, 80 insertions, 37 deletions
diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c b/src/mesa/state_tracker/st_mesa_to_tgsi.c index 33574ddf409..b3a9f6594b2 100644 --- a/src/mesa/state_tracker/st_mesa_to_tgsi.c +++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c @@ -569,7 +569,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; @@ -588,6 +589,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; } @@ -600,7 +605,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; @@ -614,6 +620,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; } @@ -727,10 +737,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 ) { @@ -768,7 +780,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, @@ -785,7 +798,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, @@ -804,13 +818,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); @@ -829,7 +845,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, diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.h b/src/mesa/state_tracker/st_mesa_to_tgsi.h index 77c74644b8b..7b2bee1ab70 100644 --- a/src/mesa/state_tracker/st_mesa_to_tgsi.h +++ b/src/mesa/state_tracker/st_mesa_to_tgsi.h @@ -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 ); diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c index af0df22dc59..cf4b39cee40 100644 --- a/src/mesa/state_tracker/st_program.c +++ b/src/mesa/state_tracker/st_program.c @@ -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]; } } @@ -307,21 +317,23 @@ st_translate_vertex_program(struct st_context *st, /* XXX: fix static allocation of tokens: */ - num_tokens = st_translate_mesa_program( TGSI_PROCESSOR_VERTEX, - &stvp->Base.Base, - /* inputs */ - vs_num_inputs, - stvp->input_to_index, - vs_input_semantic_name, - vs_input_semantic_index, - NULL, - /* outputs */ - vs_num_outputs, - outputMapping, - vs_output_semantic_name, - vs_output_semantic_index, - /* tokenized result */ - tokens, ST_MAX_SHADER_TOKENS); + num_tokens = st_translate_mesa_program(TGSI_PROCESSOR_VERTEX, + &stvp->Base.Base, + /* inputs */ + vs_num_inputs, + stvp->input_to_index, + 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); assert(num_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++; } } @@ -481,21 +503,23 @@ st_translate_fragment_program(struct st_context *st, /* XXX: fix static allocation of tokens: */ - num_tokens = st_translate_mesa_program( TGSI_PROCESSOR_FRAGMENT, - &stfp->Base.Base, - /* inputs */ - fs_num_inputs, - inputMapping, - stfp->input_semantic_name, - stfp->input_semantic_index, - interpMode, - /* outputs */ - fs_num_outputs, - outputMapping, - fs_output_semantic_name, - fs_output_semantic_index, - /* tokenized result */ - tokens, ST_MAX_SHADER_TOKENS); + num_tokens = st_translate_mesa_program(TGSI_PROCESSOR_FRAGMENT, + &stfp->Base.Base, + /* inputs */ + fs_num_inputs, + inputMapping, + 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); assert(num_tokens < ST_MAX_SHADER_TOKENS); |