d3dcompiler: Store the swizzle unshifted.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com> Signed-off-by: Matteo Bruni <mbruni@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
06918ba76b
commit
a43974a6d4
|
@ -1148,11 +1148,11 @@ swizzle: /* empty */
|
|||
else {
|
||||
DWORD last, i;
|
||||
|
||||
$$ = $2.swizzle << BWRITERVS_SWIZZLE_SHIFT;
|
||||
$$ = $2.swizzle;
|
||||
/* Fill the swizzle by extending the last component */
|
||||
last = ($2.swizzle >> 2 * ($2.idx - 1)) & 0x03;
|
||||
for(i = $2.idx; i < 4; i++){
|
||||
$$ |= last << (BWRITERVS_SWIZZLE_SHIFT + 2 * i);
|
||||
$$ |= last << (2 * i);
|
||||
}
|
||||
TRACE("Got a swizzle: %08x\n", $$);
|
||||
}
|
||||
|
|
|
@ -342,8 +342,6 @@ static void put_dword(struct bytecode_buffer *buffer, DWORD value) {
|
|||
/* bwriter -> d3d9 conversion functions. */
|
||||
static DWORD d3d9_swizzle(DWORD bwriter_swizzle)
|
||||
{
|
||||
/* Currently a NOP, but this allows changing the internal definitions
|
||||
* without side effects. */
|
||||
DWORD ret = 0;
|
||||
|
||||
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,
|
|||
This->funcs->dstreg(This, &instr->dst, buffer, instr->shift, instr->dstmod);
|
||||
} else if(instr->src[0].type == BWRITERSPR_TEMP) {
|
||||
|
||||
swizzlemask = (3 << BWRITERVS_SWIZZLE_SHIFT) |
|
||||
(3 << (BWRITERVS_SWIZZLE_SHIFT + 2)) |
|
||||
(3 << (BWRITERVS_SWIZZLE_SHIFT + 4));
|
||||
swizzlemask = 3 | (3 << 2) | (3 << 4);
|
||||
if((instr->src[0].u.swizzle & swizzlemask) == (BWRITERVS_X_X | BWRITERVS_Y_Y | BWRITERVS_Z_Z)) {
|
||||
TRACE("writing texreg2rgb\n");
|
||||
This->funcs->opcode(This, instr, D3DSIO_TEXREG2RGB & D3DSI_OPCODE_MASK, buffer);
|
||||
|
|
|
@ -542,25 +542,25 @@ enum bwritershader_param_srcmod_type
|
|||
#define BWRITERVS_SWIZZLE_SHIFT 16
|
||||
#define BWRITERVS_SWIZZLE_MASK (0xFF << BWRITERVS_SWIZZLE_SHIFT)
|
||||
|
||||
#define BWRITERVS_X_X (0 << BWRITERVS_SWIZZLE_SHIFT)
|
||||
#define BWRITERVS_X_Y (1 << BWRITERVS_SWIZZLE_SHIFT)
|
||||
#define BWRITERVS_X_Z (2 << BWRITERVS_SWIZZLE_SHIFT)
|
||||
#define BWRITERVS_X_W (3 << BWRITERVS_SWIZZLE_SHIFT)
|
||||
#define BWRITERVS_X_X (0)
|
||||
#define BWRITERVS_X_Y (1)
|
||||
#define BWRITERVS_X_Z (2)
|
||||
#define BWRITERVS_X_W (3)
|
||||
|
||||
#define BWRITERVS_Y_X (0 << (BWRITERVS_SWIZZLE_SHIFT + 2))
|
||||
#define BWRITERVS_Y_Y (1 << (BWRITERVS_SWIZZLE_SHIFT + 2))
|
||||
#define BWRITERVS_Y_Z (2 << (BWRITERVS_SWIZZLE_SHIFT + 2))
|
||||
#define BWRITERVS_Y_W (3 << (BWRITERVS_SWIZZLE_SHIFT + 2))
|
||||
#define BWRITERVS_Y_X (0 << 2)
|
||||
#define BWRITERVS_Y_Y (1 << 2)
|
||||
#define BWRITERVS_Y_Z (2 << 2)
|
||||
#define BWRITERVS_Y_W (3 << 2)
|
||||
|
||||
#define BWRITERVS_Z_X (0 << (BWRITERVS_SWIZZLE_SHIFT + 4))
|
||||
#define BWRITERVS_Z_Y (1 << (BWRITERVS_SWIZZLE_SHIFT + 4))
|
||||
#define BWRITERVS_Z_Z (2 << (BWRITERVS_SWIZZLE_SHIFT + 4))
|
||||
#define BWRITERVS_Z_W (3 << (BWRITERVS_SWIZZLE_SHIFT + 4))
|
||||
#define BWRITERVS_Z_X (0 << 4)
|
||||
#define BWRITERVS_Z_Y (1 << 4)
|
||||
#define BWRITERVS_Z_Z (2 << 4)
|
||||
#define BWRITERVS_Z_W (3 << 4)
|
||||
|
||||
#define BWRITERVS_W_X (0 << (BWRITERVS_SWIZZLE_SHIFT + 6))
|
||||
#define BWRITERVS_W_Y (1 << (BWRITERVS_SWIZZLE_SHIFT + 6))
|
||||
#define BWRITERVS_W_Z (2 << (BWRITERVS_SWIZZLE_SHIFT + 6))
|
||||
#define BWRITERVS_W_W (3 << (BWRITERVS_SWIZZLE_SHIFT + 6))
|
||||
#define BWRITERVS_W_X (0 << 6)
|
||||
#define BWRITERVS_W_Y (1 << 6)
|
||||
#define BWRITERVS_W_Z (2 << 6)
|
||||
#define BWRITERVS_W_W (3 << 6)
|
||||
|
||||
#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)
|
|||
return ".w";
|
||||
}
|
||||
|
||||
swizzle[0] = (arg >> (BWRITERVS_SWIZZLE_SHIFT + 0)) & 0x03;
|
||||
swizzle[1] = (arg >> (BWRITERVS_SWIZZLE_SHIFT + 2)) & 0x03;
|
||||
swizzle[2] = (arg >> (BWRITERVS_SWIZZLE_SHIFT + 4)) & 0x03;
|
||||
swizzle[3] = (arg >> (BWRITERVS_SWIZZLE_SHIFT + 6)) & 0x03;
|
||||
swizzle[0] = arg & 3;
|
||||
swizzle[1] = (arg >> 2) & 3;
|
||||
swizzle[2] = (arg >> 4) & 3;
|
||||
swizzle[3] = (arg >> 6) & 3;
|
||||
|
||||
ret[0] = '.';
|
||||
for (i = 0; i < 4; ++i)
|
||||
|
|
Loading…
Reference in New Issue