gallium: collect more shader info in tgsi_scan_shader()

Now getting input/output semantic info so we can eventually remove those
fields from pipe_shader_state.
This commit is contained in:
Brian 2008-02-26 10:12:17 -07:00
parent ecd50ef58b
commit 1410b7bb50
2 changed files with 31 additions and 0 deletions

View file

@ -69,6 +69,8 @@ tgsi_scan_shader(const struct tgsi_token *tokens,
*/
while( !tgsi_parse_end_of_tokens( &parse ) ) {
info->num_tokens++;
tgsi_parse_token( &parse );
switch( parse.FullToken.Token.Type ) {
@ -91,9 +93,27 @@ tgsi_scan_shader(const struct tgsi_token *tokens,
for (i = fulldecl->u.DeclarationRange.First;
i <= fulldecl->u.DeclarationRange.Last;
i++) {
/* only first 32 regs will appear in this bitfield */
info->file_mask[file] |= (1 << i);
info->file_count[file]++;
if (file == TGSI_FILE_INPUT) {
info->input_semantic_name[info->num_inputs]
= fulldecl->Semantic.SemanticName;
info->input_semantic_index[info->num_inputs]
= fulldecl->Semantic.SemanticIndex;
info->num_inputs++;
}
if (file == TGSI_FILE_OUTPUT) {
info->output_semantic_name[info->num_outputs]
= fulldecl->Semantic.SemanticName;
info->output_semantic_index[info->num_outputs]
= fulldecl->Semantic.SemanticIndex;
info->num_outputs++;
}
/* special case */
if (procType == TGSI_PROCESSOR_FRAGMENT &&
file == TGSI_FILE_OUTPUT &&

View file

@ -30,6 +30,7 @@
#include "pipe/p_util.h"
#include "pipe/p_state.h"
#include "pipe/p_shader_tokens.h"
@ -38,6 +39,16 @@
*/
struct tgsi_shader_info
{
uint num_tokens;
/* XXX eventually remove the corresponding fields from pipe_shader_state: */
ubyte num_inputs;
ubyte num_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];
uint file_mask[TGSI_FILE_COUNT]; /**< bitmask of declared registers */
uint file_count[TGSI_FILE_COUNT]; /**< number of declared registers */