Commit a43974a6 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

d3dcompiler: Store the swizzle unshifted.

parent 06918ba7
...@@ -1148,11 +1148,11 @@ swizzle: /* empty */ ...@@ -1148,11 +1148,11 @@ swizzle: /* empty */
else { else {
DWORD last, i; DWORD last, i;
$$ = $2.swizzle << BWRITERVS_SWIZZLE_SHIFT; $$ = $2.swizzle;
/* Fill the swizzle by extending the last component */ /* Fill the swizzle by extending the last component */
last = ($2.swizzle >> 2 * ($2.idx - 1)) & 0x03; last = ($2.swizzle >> 2 * ($2.idx - 1)) & 0x03;
for(i = $2.idx; i < 4; i++){ for(i = $2.idx; i < 4; i++){
$$ |= last << (BWRITERVS_SWIZZLE_SHIFT + 2 * i); $$ |= last << (2 * i);
} }
TRACE("Got a swizzle: %08x\n", $$); TRACE("Got a swizzle: %08x\n", $$);
} }
......
...@@ -342,8 +342,6 @@ static void put_dword(struct bytecode_buffer *buffer, DWORD value) { ...@@ -342,8 +342,6 @@ static void put_dword(struct bytecode_buffer *buffer, DWORD value) {
/* bwriter -> d3d9 conversion functions. */ /* bwriter -> d3d9 conversion functions. */
static DWORD d3d9_swizzle(DWORD bwriter_swizzle) static DWORD d3d9_swizzle(DWORD bwriter_swizzle)
{ {
/* Currently a NOP, but this allows changing the internal definitions
* without side effects. */
DWORD ret = 0; DWORD ret = 0;
if ((bwriter_swizzle & BWRITERVS_X_X) == BWRITERVS_X_X) ret |= D3DVS_X_X; if ((bwriter_swizzle & BWRITERVS_X_X) == BWRITERVS_X_X) ret |= D3DVS_X_X;
...@@ -1270,9 +1268,7 @@ static void instr_ps_1_0123_texld(struct bc_writer *This, ...@@ -1270,9 +1268,7 @@ static void instr_ps_1_0123_texld(struct bc_writer *This,
This->funcs->dstreg(This, &instr->dst, buffer, instr->shift, instr->dstmod); This->funcs->dstreg(This, &instr->dst, buffer, instr->shift, instr->dstmod);
} else if(instr->src[0].type == BWRITERSPR_TEMP) { } else if(instr->src[0].type == BWRITERSPR_TEMP) {
swizzlemask = (3 << BWRITERVS_SWIZZLE_SHIFT) | swizzlemask = 3 | (3 << 2) | (3 << 4);
(3 << (BWRITERVS_SWIZZLE_SHIFT + 2)) |
(3 << (BWRITERVS_SWIZZLE_SHIFT + 4));
if((instr->src[0].u.swizzle & swizzlemask) == (BWRITERVS_X_X | BWRITERVS_Y_Y | BWRITERVS_Z_Z)) { if((instr->src[0].u.swizzle & swizzlemask) == (BWRITERVS_X_X | BWRITERVS_Y_Y | BWRITERVS_Z_Z)) {
TRACE("writing texreg2rgb\n"); TRACE("writing texreg2rgb\n");
This->funcs->opcode(This, instr, D3DSIO_TEXREG2RGB & D3DSI_OPCODE_MASK, buffer); This->funcs->opcode(This, instr, D3DSIO_TEXREG2RGB & D3DSI_OPCODE_MASK, buffer);
......
...@@ -542,25 +542,25 @@ enum bwritershader_param_srcmod_type ...@@ -542,25 +542,25 @@ enum bwritershader_param_srcmod_type
#define BWRITERVS_SWIZZLE_SHIFT 16 #define BWRITERVS_SWIZZLE_SHIFT 16
#define BWRITERVS_SWIZZLE_MASK (0xFF << BWRITERVS_SWIZZLE_SHIFT) #define BWRITERVS_SWIZZLE_MASK (0xFF << BWRITERVS_SWIZZLE_SHIFT)
#define BWRITERVS_X_X (0 << BWRITERVS_SWIZZLE_SHIFT) #define BWRITERVS_X_X (0)
#define BWRITERVS_X_Y (1 << BWRITERVS_SWIZZLE_SHIFT) #define BWRITERVS_X_Y (1)
#define BWRITERVS_X_Z (2 << BWRITERVS_SWIZZLE_SHIFT) #define BWRITERVS_X_Z (2)
#define BWRITERVS_X_W (3 << BWRITERVS_SWIZZLE_SHIFT) #define BWRITERVS_X_W (3)
#define BWRITERVS_Y_X (0 << (BWRITERVS_SWIZZLE_SHIFT + 2)) #define BWRITERVS_Y_X (0 << 2)
#define BWRITERVS_Y_Y (1 << (BWRITERVS_SWIZZLE_SHIFT + 2)) #define BWRITERVS_Y_Y (1 << 2)
#define BWRITERVS_Y_Z (2 << (BWRITERVS_SWIZZLE_SHIFT + 2)) #define BWRITERVS_Y_Z (2 << 2)
#define BWRITERVS_Y_W (3 << (BWRITERVS_SWIZZLE_SHIFT + 2)) #define BWRITERVS_Y_W (3 << 2)
#define BWRITERVS_Z_X (0 << (BWRITERVS_SWIZZLE_SHIFT + 4)) #define BWRITERVS_Z_X (0 << 4)
#define BWRITERVS_Z_Y (1 << (BWRITERVS_SWIZZLE_SHIFT + 4)) #define BWRITERVS_Z_Y (1 << 4)
#define BWRITERVS_Z_Z (2 << (BWRITERVS_SWIZZLE_SHIFT + 4)) #define BWRITERVS_Z_Z (2 << 4)
#define BWRITERVS_Z_W (3 << (BWRITERVS_SWIZZLE_SHIFT + 4)) #define BWRITERVS_Z_W (3 << 4)
#define BWRITERVS_W_X (0 << (BWRITERVS_SWIZZLE_SHIFT + 6)) #define BWRITERVS_W_X (0 << 6)
#define BWRITERVS_W_Y (1 << (BWRITERVS_SWIZZLE_SHIFT + 6)) #define BWRITERVS_W_Y (1 << 6)
#define BWRITERVS_W_Z (2 << (BWRITERVS_SWIZZLE_SHIFT + 6)) #define BWRITERVS_W_Z (2 << 6)
#define BWRITERVS_W_W (3 << (BWRITERVS_SWIZZLE_SHIFT + 6)) #define BWRITERVS_W_W (3 << 6)
#define BWRITERVS_NOSWIZZLE (BWRITERVS_X_X | BWRITERVS_Y_Y | BWRITERVS_Z_Z | BWRITERVS_W_W) #define BWRITERVS_NOSWIZZLE (BWRITERVS_X_X | BWRITERVS_Y_Y | BWRITERVS_Z_Z | BWRITERVS_W_W)
......
...@@ -291,10 +291,10 @@ static const char *debug_print_swizzle(DWORD arg) ...@@ -291,10 +291,10 @@ static const char *debug_print_swizzle(DWORD arg)
return ".w"; return ".w";
} }
swizzle[0] = (arg >> (BWRITERVS_SWIZZLE_SHIFT + 0)) & 0x03; swizzle[0] = arg & 3;
swizzle[1] = (arg >> (BWRITERVS_SWIZZLE_SHIFT + 2)) & 0x03; swizzle[1] = (arg >> 2) & 3;
swizzle[2] = (arg >> (BWRITERVS_SWIZZLE_SHIFT + 4)) & 0x03; swizzle[2] = (arg >> 4) & 3;
swizzle[3] = (arg >> (BWRITERVS_SWIZZLE_SHIFT + 6)) & 0x03; swizzle[3] = (arg >> 6) & 3;
ret[0] = '.'; ret[0] = '.';
for (i = 0; i < 4; ++i) for (i = 0; i < 4; ++i)
......
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