tgsi: Parse destination operand modulate modifier.

This commit is contained in:
Michal Krol 2008-07-13 15:23:14 +02:00
parent 94013b66b9
commit f5c51ebd2a
3 changed files with 43 additions and 24 deletions

View file

@ -539,6 +539,17 @@ static const char *TGSI_MODULATES[] =
"MODULATE_EIGHTH"
};
static const char *TGSI_MODULATES_SHORT[TGSI_MODULATE_COUNT] =
{
"",
"_2X",
"_4X",
"_8X",
"_D2",
"_D4",
"_D8"
};
void
tgsi_dump_declaration(
const struct tgsi_full_declaration *decl )
@ -736,30 +747,7 @@ tgsi_dump_instruction(
SID( dst->DstRegister.Index );
CHR( ']' );
switch (dst->DstRegisterExtModulate.Modulate) {
case TGSI_MODULATE_1X:
break;
case TGSI_MODULATE_2X:
TXT( "_2X" );
break;
case TGSI_MODULATE_4X:
TXT( "_4X" );
break;
case TGSI_MODULATE_8X:
TXT( "_8X" );
break;
case TGSI_MODULATE_HALF:
TXT( "_D2" );
break;
case TGSI_MODULATE_QUARTER:
TXT( "_D4" );
break;
case TGSI_MODULATE_EIGHTH:
TXT( "_D8" );
break;
default:
assert( 0 );
}
ENM( dst->DstRegisterExtModulate.Modulate, TGSI_MODULATES_SHORT );
if( dst->DstRegister.WriteMask != TGSI_WRITEMASK_XYZW ) {
CHR( '.' );

View file

@ -368,6 +368,17 @@ parse_register_dcl(
return TRUE;
}
static const char *modulate_names[TGSI_MODULATE_COUNT] =
{
"_1X",
"_2X",
"_4X",
"_8X",
"_D2",
"_D4",
"_D8"
};
static boolean
parse_dst_operand(
struct translate_ctx *ctx,
@ -376,11 +387,30 @@ parse_dst_operand(
uint file;
uint index;
uint writemask;
const char *cur;
if (!parse_register( ctx, &file, &index ))
return FALSE;
cur = ctx->cur;
eat_opt_white( &cur );
if (*cur == '_') {
uint i;
for (i = 0; i < TGSI_MODULATE_COUNT; i++) {
if (str_match_no_case( &cur, modulate_names[i] )) {
if (!is_digit_alpha_underscore( cur )) {
dst->DstRegisterExtModulate.Modulate = i;
ctx->cur = cur;
break;
}
}
}
}
if (!parse_opt_writemask( ctx, &writemask ))
return FALSE;
dst->DstRegister.File = file;
dst->DstRegister.Index = index;
dst->DstRegister.WriteMask = writemask;

View file

@ -743,6 +743,7 @@ struct tgsi_dst_register_ext_concode
#define TGSI_MODULATE_HALF 4
#define TGSI_MODULATE_QUARTER 5
#define TGSI_MODULATE_EIGHTH 6
#define TGSI_MODULATE_COUNT 7
struct tgsi_dst_register_ext_modulate
{