summaryrefslogtreecommitdiff
path: root/src/gallium
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/auxiliary/tgsi/util/tgsi_dump.c36
-rw-r--r--src/gallium/auxiliary/tgsi/util/tgsi_text.c30
-rw-r--r--src/gallium/include/pipe/p_shader_tokens.h1
3 files changed, 43 insertions, 24 deletions
diff --git a/src/gallium/auxiliary/tgsi/util/tgsi_dump.c b/src/gallium/auxiliary/tgsi/util/tgsi_dump.c
index 8220e09199..0cf4454f25 100644
--- a/src/gallium/auxiliary/tgsi/util/tgsi_dump.c
+++ b/src/gallium/auxiliary/tgsi/util/tgsi_dump.c
@@ -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( '.' );
diff --git a/src/gallium/auxiliary/tgsi/util/tgsi_text.c b/src/gallium/auxiliary/tgsi/util/tgsi_text.c
index c618a50fb9..1b283feb4c 100644
--- a/src/gallium/auxiliary/tgsi/util/tgsi_text.c
+++ b/src/gallium/auxiliary/tgsi/util/tgsi_text.c
@@ -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;
diff --git a/src/gallium/include/pipe/p_shader_tokens.h b/src/gallium/include/pipe/p_shader_tokens.h
index c8e2830516..ed931d24b9 100644
--- a/src/gallium/include/pipe/p_shader_tokens.h
+++ b/src/gallium/include/pipe/p_shader_tokens.h
@@ -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
{