wined3d: Move D3DSP dest modifier related items into the WINED3D namespace.
This commit is contained in:
parent
76b571cb48
commit
82379f22a7
|
@ -208,24 +208,24 @@ static const char* shift_tab[] = {
|
|||
|
||||
static void pshader_get_write_mask(const DWORD output_reg, char *write_mask) {
|
||||
*write_mask = 0;
|
||||
if ((output_reg & D3DSP_WRITEMASK_ALL) != D3DSP_WRITEMASK_ALL) {
|
||||
if ((output_reg & WINED3DSP_WRITEMASK_ALL) != WINED3DSP_WRITEMASK_ALL) {
|
||||
strcat(write_mask, ".");
|
||||
if (output_reg & D3DSP_WRITEMASK_0) strcat(write_mask, "r");
|
||||
if (output_reg & D3DSP_WRITEMASK_1) strcat(write_mask, "g");
|
||||
if (output_reg & D3DSP_WRITEMASK_2) strcat(write_mask, "b");
|
||||
if (output_reg & D3DSP_WRITEMASK_3) strcat(write_mask, "a");
|
||||
if (output_reg & WINED3DSP_WRITEMASK_0) strcat(write_mask, "r");
|
||||
if (output_reg & WINED3DSP_WRITEMASK_1) strcat(write_mask, "g");
|
||||
if (output_reg & WINED3DSP_WRITEMASK_2) strcat(write_mask, "b");
|
||||
if (output_reg & WINED3DSP_WRITEMASK_3) strcat(write_mask, "a");
|
||||
}
|
||||
}
|
||||
|
||||
/* TODO: merge with pixel shader */
|
||||
static void vshader_program_add_output_param_swizzle(const DWORD param, int is_color, char *hwLine) {
|
||||
/** operand output */
|
||||
if ((param & D3DSP_WRITEMASK_ALL) != D3DSP_WRITEMASK_ALL) {
|
||||
if ((param & WINED3DSP_WRITEMASK_ALL) != WINED3DSP_WRITEMASK_ALL) {
|
||||
strcat(hwLine, ".");
|
||||
if (param & D3DSP_WRITEMASK_0) { strcat(hwLine, "x"); }
|
||||
if (param & D3DSP_WRITEMASK_1) { strcat(hwLine, "y"); }
|
||||
if (param & D3DSP_WRITEMASK_2) { strcat(hwLine, "z"); }
|
||||
if (param & D3DSP_WRITEMASK_3) { strcat(hwLine, "w"); }
|
||||
if (param & WINED3DSP_WRITEMASK_0) { strcat(hwLine, "x"); }
|
||||
if (param & WINED3DSP_WRITEMASK_1) { strcat(hwLine, "y"); }
|
||||
if (param & WINED3DSP_WRITEMASK_2) { strcat(hwLine, "z"); }
|
||||
if (param & WINED3DSP_WRITEMASK_3) { strcat(hwLine, "w"); }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -569,20 +569,20 @@ void pshader_hw_map2gl(SHADER_OPCODE_ARG* arg) {
|
|||
strcpy(tmpLine, curOpcode->glname);
|
||||
|
||||
/* Process modifiers */
|
||||
if (0 != (dst & D3DSP_DSTMOD_MASK)) {
|
||||
DWORD mask = dst & D3DSP_DSTMOD_MASK;
|
||||
if (0 != (dst & WINED3DSP_DSTMOD_MASK)) {
|
||||
DWORD mask = dst & WINED3DSP_DSTMOD_MASK;
|
||||
|
||||
saturate = mask & D3DSPDM_SATURATE;
|
||||
centroid = mask & D3DSPDM_MSAMPCENTROID;
|
||||
partialprecision = mask & D3DSPDM_PARTIALPRECISION;
|
||||
mask &= ~(D3DSPDM_MSAMPCENTROID | D3DSPDM_PARTIALPRECISION | D3DSPDM_SATURATE);
|
||||
saturate = mask & WINED3DSPDM_SATURATE;
|
||||
centroid = mask & WINED3DSPDM_MSAMPCENTROID;
|
||||
partialprecision = mask & WINED3DSPDM_PARTIALPRECISION;
|
||||
mask &= ~(WINED3DSPDM_MSAMPCENTROID | WINED3DSPDM_PARTIALPRECISION | WINED3DSPDM_SATURATE);
|
||||
if (mask)
|
||||
FIXME("Unrecognized modifier(0x%#x)\n", mask >> D3DSP_DSTMOD_SHIFT);
|
||||
FIXME("Unrecognized modifier(0x%#x)\n", mask >> WINED3DSP_DSTMOD_SHIFT);
|
||||
|
||||
if (centroid)
|
||||
FIXME("Unhandled modifier(0x%#x)\n", mask >> D3DSP_DSTMOD_SHIFT);
|
||||
FIXME("Unhandled modifier(0x%#x)\n", mask >> WINED3DSP_DSTMOD_SHIFT);
|
||||
}
|
||||
shift = (dst & D3DSP_DSTSHIFT_MASK) >> D3DSP_DSTSHIFT_SHIFT;
|
||||
shift = (dst & WINED3DSP_DSTSHIFT_MASK) >> WINED3DSP_DSTSHIFT_SHIFT;
|
||||
|
||||
/* Generate input and output registers */
|
||||
if (curOpcode->num_params > 0) {
|
||||
|
@ -877,7 +877,7 @@ void vshader_hw_mnxn(SHADER_OPCODE_ARG* arg) {
|
|||
}
|
||||
|
||||
for (i = 0; i < nComponents; i++) {
|
||||
tmpArg.dst = ((arg->dst) & ~D3DSP_WRITEMASK_ALL)|(D3DSP_WRITEMASK_0<<i);
|
||||
tmpArg.dst = ((arg->dst) & ~WINED3DSP_WRITEMASK_ALL)|(WINED3DSP_WRITEMASK_0<<i);
|
||||
tmpArg.src[1] = arg->src[1]+i;
|
||||
vshader_hw_map2gl(&tmpArg);
|
||||
}
|
||||
|
|
|
@ -606,12 +606,12 @@ void shader_dump_param(
|
|||
if (!input) {
|
||||
/* operand output (for modifiers and shift, see dump_ins_modifiers) */
|
||||
|
||||
if ((param & D3DSP_WRITEMASK_ALL) != D3DSP_WRITEMASK_ALL) {
|
||||
if ((param & WINED3DSP_WRITEMASK_ALL) != WINED3DSP_WRITEMASK_ALL) {
|
||||
TRACE(".");
|
||||
if (param & D3DSP_WRITEMASK_0) TRACE("%c", swizzle_reg_chars[0]);
|
||||
if (param & D3DSP_WRITEMASK_1) TRACE("%c", swizzle_reg_chars[1]);
|
||||
if (param & D3DSP_WRITEMASK_2) TRACE("%c", swizzle_reg_chars[2]);
|
||||
if (param & D3DSP_WRITEMASK_3) TRACE("%c", swizzle_reg_chars[3]);
|
||||
if (param & WINED3DSP_WRITEMASK_0) TRACE("%c", swizzle_reg_chars[0]);
|
||||
if (param & WINED3DSP_WRITEMASK_1) TRACE("%c", swizzle_reg_chars[1]);
|
||||
if (param & WINED3DSP_WRITEMASK_2) TRACE("%c", swizzle_reg_chars[2]);
|
||||
if (param & WINED3DSP_WRITEMASK_3) TRACE("%c", swizzle_reg_chars[3]);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
@ -782,8 +782,8 @@ void shader_generate_main(
|
|||
|
||||
void shader_dump_ins_modifiers(const DWORD output) {
|
||||
|
||||
DWORD shift = (output & D3DSP_DSTSHIFT_MASK) >> D3DSP_DSTSHIFT_SHIFT;
|
||||
DWORD mmask = output & D3DSP_DSTMOD_MASK;
|
||||
DWORD shift = (output & WINED3DSP_DSTSHIFT_MASK) >> WINED3DSP_DSTSHIFT_SHIFT;
|
||||
DWORD mmask = output & WINED3DSP_DSTMOD_MASK;
|
||||
|
||||
switch (shift) {
|
||||
case 0: break;
|
||||
|
@ -796,13 +796,13 @@ void shader_dump_ins_modifiers(const DWORD output) {
|
|||
default: TRACE("_unhandled_shift(%d)", shift); break;
|
||||
}
|
||||
|
||||
if (mmask & D3DSPDM_SATURATE) TRACE("_sat");
|
||||
if (mmask & D3DSPDM_PARTIALPRECISION) TRACE("_pp");
|
||||
if (mmask & D3DSPDM_MSAMPCENTROID) TRACE("_centroid");
|
||||
if (mmask & WINED3DSPDM_SATURATE) TRACE("_sat");
|
||||
if (mmask & WINED3DSPDM_PARTIALPRECISION) TRACE("_pp");
|
||||
if (mmask & WINED3DSPDM_MSAMPCENTROID) TRACE("_centroid");
|
||||
|
||||
mmask &= ~(D3DSPDM_SATURATE | D3DSPDM_PARTIALPRECISION | D3DSPDM_MSAMPCENTROID);
|
||||
mmask &= ~(WINED3DSPDM_SATURATE | WINED3DSPDM_PARTIALPRECISION | WINED3DSPDM_MSAMPCENTROID);
|
||||
if (mmask)
|
||||
FIXME("_unrecognized_modifier(%#x)", mmask >> D3DSP_DSTMOD_SHIFT);
|
||||
FIXME("_unrecognized_modifier(%#x)", mmask >> WINED3DSP_DSTMOD_SHIFT);
|
||||
}
|
||||
|
||||
/* First pass: trace shader, initialize length and version */
|
||||
|
|
|
@ -504,7 +504,7 @@ static const char* shift_glsl_tab[] = {
|
|||
* Will also change the reg_mask if necessary (not all register types are equal in DX vs GL) */
|
||||
static void shader_glsl_add_dst(DWORD param, const char* reg_name, char* reg_mask, char* outStr) {
|
||||
|
||||
int shift = (param & D3DSP_DSTSHIFT_MASK) >> D3DSP_DSTSHIFT_SHIFT;
|
||||
int shift = (param & WINED3DSP_DSTSHIFT_MASK) >> WINED3DSP_DSTSHIFT_SHIFT;
|
||||
char cast[6];
|
||||
|
||||
if ((shader_get_regtype(param) == WINED3DSPR_RASTOUT)
|
||||
|
@ -728,12 +728,12 @@ static void shader_glsl_get_output_register_swizzle(
|
|||
char *write_mask) {
|
||||
|
||||
*write_mask = 0;
|
||||
if ((param & D3DSP_WRITEMASK_ALL) != D3DSP_WRITEMASK_ALL) {
|
||||
if ((param & WINED3DSP_WRITEMASK_ALL) != WINED3DSP_WRITEMASK_ALL) {
|
||||
strcat(write_mask, ".");
|
||||
if (param & D3DSP_WRITEMASK_0) strcat(write_mask, "x");
|
||||
if (param & D3DSP_WRITEMASK_1) strcat(write_mask, "y");
|
||||
if (param & D3DSP_WRITEMASK_2) strcat(write_mask, "z");
|
||||
if (param & D3DSP_WRITEMASK_3) strcat(write_mask, "w");
|
||||
if (param & WINED3DSP_WRITEMASK_0) strcat(write_mask, "x");
|
||||
if (param & WINED3DSP_WRITEMASK_1) strcat(write_mask, "y");
|
||||
if (param & WINED3DSP_WRITEMASK_2) strcat(write_mask, "z");
|
||||
if (param & WINED3DSP_WRITEMASK_3) strcat(write_mask, "w");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -816,7 +816,7 @@ static void shader_glsl_add_param(
|
|||
/** Process GLSL instruction modifiers */
|
||||
void shader_glsl_add_instruction_modifiers(SHADER_OPCODE_ARG* arg) {
|
||||
|
||||
DWORD mask = arg->dst & D3DSP_DSTMOD_MASK;
|
||||
DWORD mask = arg->dst & WINED3DSP_DSTMOD_MASK;
|
||||
|
||||
if (arg->opcode->dst_token && mask != 0) {
|
||||
char dst_reg[50];
|
||||
|
@ -825,14 +825,14 @@ void shader_glsl_add_instruction_modifiers(SHADER_OPCODE_ARG* arg) {
|
|||
|
||||
shader_glsl_add_param(arg, arg->dst, 0, FALSE, dst_reg, dst_mask, dst_str);
|
||||
|
||||
if (mask & D3DSPDM_SATURATE) {
|
||||
if (mask & WINED3DSPDM_SATURATE) {
|
||||
/* _SAT means to clamp the value of the register to between 0 and 1 */
|
||||
shader_addline(arg->buffer, "%s%s = clamp(%s%s, 0.0, 1.0);\n", dst_reg, dst_mask, dst_reg, dst_mask);
|
||||
}
|
||||
if (mask & D3DSPDM_MSAMPCENTROID) {
|
||||
if (mask & WINED3DSPDM_MSAMPCENTROID) {
|
||||
FIXME("_centroid modifier not handled\n");
|
||||
}
|
||||
if (mask & D3DSPDM_PARTIALPRECISION) {
|
||||
if (mask & WINED3DSPDM_PARTIALPRECISION) {
|
||||
/* MSDN says this modifier can be safely ignored, so that's what we'll do. */
|
||||
}
|
||||
}
|
||||
|
@ -1163,7 +1163,7 @@ void shader_glsl_mnxn(SHADER_OPCODE_ARG* arg) {
|
|||
}
|
||||
|
||||
for (i = 0; i < nComponents; i++) {
|
||||
tmpArg.dst = ((arg->dst) & ~D3DSP_WRITEMASK_ALL)|(D3DSP_WRITEMASK_0<<i);
|
||||
tmpArg.dst = ((arg->dst) & ~WINED3DSP_WRITEMASK_ALL)|(WINED3DSP_WRITEMASK_0<<i);
|
||||
tmpArg.src[1] = arg->src[1]+i;
|
||||
shader_glsl_dot(&tmpArg);
|
||||
}
|
||||
|
|
|
@ -627,7 +627,7 @@ static void vshader_set_input(
|
|||
|
||||
/* Fake register; set reserved bit, regnum, type: input, wmask: all */
|
||||
DWORD reg_token = (0x1 << 31) |
|
||||
D3DSP_WRITEMASK_ALL | (WINED3DSPR_INPUT << WINED3DSP_REGTYPE_SHIFT) | regnum;
|
||||
WINED3DSP_WRITEMASK_ALL | (WINED3DSPR_INPUT << WINED3DSP_REGTYPE_SHIFT) | regnum;
|
||||
|
||||
This->semantics_in[regnum].usage = usage_token;
|
||||
This->semantics_in[regnum].reg = reg_token;
|
||||
|
@ -991,7 +991,7 @@ HRESULT WINAPI IWineD3DVertexShaderImpl_ExecuteSW(IWineD3DVertexShader* iface, W
|
|||
p_send[i] = &s[i];
|
||||
}
|
||||
} else { /* output reg */
|
||||
if ((pToken[i] & D3DSP_WRITEMASK_ALL) == D3DSP_WRITEMASK_ALL) {
|
||||
if ((pToken[i] & WINED3DSP_WRITEMASK_ALL) == WINED3DSP_WRITEMASK_ALL) {
|
||||
p_send[i] = p[i];
|
||||
} else {
|
||||
p_send[i] = &d; /* to be post-processed for modifiers management */
|
||||
|
@ -1027,11 +1027,13 @@ HRESULT WINAPI IWineD3DVertexShaderImpl_ExecuteSW(IWineD3DVertexShader* iface, W
|
|||
}
|
||||
|
||||
/* check if output reg modifier post-process */
|
||||
if (curOpcode->num_params > 0 && (pToken[0] & D3DSP_WRITEMASK_ALL) != D3DSP_WRITEMASK_ALL) {
|
||||
if (pToken[0] & D3DSP_WRITEMASK_0) p[0]->x = d.x;
|
||||
if (pToken[0] & D3DSP_WRITEMASK_1) p[0]->y = d.y;
|
||||
if (pToken[0] & D3DSP_WRITEMASK_2) p[0]->z = d.z;
|
||||
if (pToken[0] & D3DSP_WRITEMASK_3) p[0]->w = d.w;
|
||||
if (curOpcode->num_params > 0 &&
|
||||
(pToken[0] & WINED3DSP_WRITEMASK_ALL) != WINED3DSP_WRITEMASK_ALL) {
|
||||
|
||||
if (pToken[0] & WINED3DSP_WRITEMASK_0) p[0]->x = d.x;
|
||||
if (pToken[0] & WINED3DSP_WRITEMASK_1) p[0]->y = d.y;
|
||||
if (pToken[0] & WINED3DSP_WRITEMASK_2) p[0]->z = d.z;
|
||||
if (pToken[0] & WINED3DSP_WRITEMASK_3) p[0]->w = d.w;
|
||||
}
|
||||
#if 0
|
||||
TRACE_VSVECTOR(output->oPos);
|
||||
|
|
|
@ -134,6 +134,28 @@ typedef enum _WINED3DSHADER_PARAM_SRCMOD_TYPE {
|
|||
WINED3DSPSM_FORCE_DWORD = 0x7FFFFFFF
|
||||
} WINED3DSHADER_PARAM_SRCMOD_TYPE;
|
||||
|
||||
/** Destination register modifiers **/
|
||||
#define WINED3DSP_WRITEMASK_0 0x00010000 /* .x r */
|
||||
#define WINED3DSP_WRITEMASK_1 0x00020000 /* .y g */
|
||||
#define WINED3DSP_WRITEMASK_2 0x00040000 /* .z b */
|
||||
#define WINED3DSP_WRITEMASK_3 0x00080000 /* .w a */
|
||||
#define WINED3DSP_WRITEMASK_ALL 0x000F0000 /* all */
|
||||
|
||||
#define WINED3DSP_DSTMOD_SHIFT 20
|
||||
#define WINED3DSP_DSTMOD_MASK (0xF << WINED3DSP_DSTMOD_SHIFT)
|
||||
|
||||
typedef enum _WINED3DSHADER_PARAM_DSTMOD_TYPE {
|
||||
WINED3DSPDM_NONE = 0 << WINED3DSP_DSTMOD_SHIFT,
|
||||
WINED3DSPDM_SATURATE = 1 << WINED3DSP_DSTMOD_SHIFT,
|
||||
WINED3DSPDM_PARTIALPRECISION = 2 << WINED3DSP_DSTMOD_SHIFT,
|
||||
WINED3DSPDM_MSAMPCENTROID = 4 << WINED3DSP_DSTMOD_SHIFT,
|
||||
|
||||
WINED3DSPDM_FORCE_DWORD = 0x7FFFFFFF
|
||||
} WINED3DSHADER_PARAM_DSTMOD_TYPE;
|
||||
|
||||
#define WINED3DSP_DSTSHIFT_SHIFT 24
|
||||
#define WINED3DSP_DSTSHIFT_MASK (0xF << WINED3DSP_DSTSHIFT_SHIFT)
|
||||
|
||||
/** opcodes types for PS and VS */
|
||||
typedef enum _WINED3DSHADER_INSTRUCTION_OPCODE_TYPE {
|
||||
WINED3DSIO_NOP = 0,
|
||||
|
|
Loading…
Reference in New Issue