Commit 949eca40 authored by Matteo Bruni's avatar Matteo Bruni Committed by Alexandre Julliard

d3dx9: Add shift modifiers parsing to the shader assembler.

parent 4c5954ea
......@@ -232,8 +232,9 @@ static void asmparser_instr(struct asm_parser *This, DWORD opcode,
if(!This->shader) return;
TRACE_(parsed_shader)("%s%s%s ", debug_print_opcode(opcode),
TRACE_(parsed_shader)("%s%s%s%s ", debug_print_opcode(opcode),
debug_print_dstmod(mod),
debug_print_shift(shift),
debug_print_comp(comp));
if(dst) {
TRACE_(parsed_shader)("%s", debug_print_dstreg(dst));
......
......@@ -276,6 +276,11 @@ ps_3_0 {return VER_PS30; }
/* Output modifiers */
\_x2 {return SHIFT_X2; }
\_x4 {return SHIFT_X4; }
\_x8 {return SHIFT_X8; }
\_d2 {return SHIFT_D2; }
\_d4 {return SHIFT_D4; }
\_d8 {return SHIFT_D8; }
\_sat {return MOD_SAT; }
\_pp {return MOD_PP; }
\_centroid {return MOD_CENTROID; }
......
......@@ -199,6 +199,11 @@ void set_rel_reg(struct shader_reg *reg, struct rel_reg *rel) {
/* Output modifiers */
%token SHIFT_X2
%token SHIFT_X4
%token SHIFT_X8
%token SHIFT_D2
%token SHIFT_D4
%token SHIFT_D8
%token MOD_SAT
%token MOD_PP
%token MOD_CENTROID
......@@ -1045,7 +1050,37 @@ omods: /* Empty */
}
}
omodifier: MOD_SAT
omodifier: SHIFT_X2
{
$$.mod = 0;
$$.shift = 1;
}
| SHIFT_X4
{
$$.mod = 0;
$$.shift = 2;
}
| SHIFT_X8
{
$$.mod = 0;
$$.shift = 3;
}
| SHIFT_D2
{
$$.mod = 0;
$$.shift = 15;
}
| SHIFT_D4
{
$$.mod = 0;
$$.shift = 14;
}
| SHIFT_D8
{
$$.mod = 0;
$$.shift = 13;
}
| MOD_SAT
{
$$.mod = BWRITERSPDM_SATURATE;
$$.shift = 0;
......
......@@ -274,6 +274,28 @@ const char *debug_print_dstmod(DWORD mod) {
}
}
const char *debug_print_shift(DWORD shift) {
static const char * const shiftstrings[] = {
"",
"_x2",
"_x4",
"_x8",
"_x16",
"_x32",
"",
"",
"",
"",
"",
"",
"_d16",
"_d8",
"_d4",
"_d2",
};
return shiftstrings[shift];
}
static const char *get_regname(const struct shader_reg *reg) {
switch(reg->type) {
case BWRITERSPR_TEMP:
......
......@@ -400,6 +400,7 @@ struct bc_writer {
/* Debug utility routines */
const char *debug_print_srcmod(DWORD mod);
const char *debug_print_dstmod(DWORD mod);
const char *debug_print_shift(DWORD shift);
const char *debug_print_dstreg(const struct shader_reg *reg);
const char *debug_print_srcreg(const struct shader_reg *reg);
const char *debug_print_swizzle(DWORD swizzle);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment