wined3d: Vertex Shader regtype cleanups.

This commit is contained in:
Roderick Colenbrander 2006-04-23 17:14:13 +02:00 committed by Alexandre Julliard
parent 35f9a4797f
commit c4eff1eb44

View File

@ -707,12 +707,17 @@ inline static const SHADER_OPCODE* vshader_program_get_opcode(IWineD3DVertexShad
return NULL;
}
inline static int vshader_program_get_regtype(const DWORD param) {
return (((param & D3DSP_REGTYPE_MASK) >> D3DSP_REGTYPE_SHIFT) |
((param & D3DSP_REGTYPE_MASK2) >> D3DSP_REGTYPE_SHIFT2));
}
inline static void vshader_program_dump_param(const DWORD param, int input) {
static const char* rastout_reg_names[] = { "oPos", "oFog", "oPts" };
static const char swizzle_reg_chars[] = "xyzw";
DWORD reg = param & D3DSP_REGNUM_MASK;
DWORD regtype = ((param & D3DSP_REGTYPE_MASK) >> D3DSP_REGTYPE_SHIFT);
DWORD regtype = vshader_program_get_regtype(param);
if ((param & D3DSP_SRCMOD_MASK) == D3DSPSM_NEG) TRACE("-");
@ -781,18 +786,9 @@ inline static void vshader_program_dump_param(const DWORD param, int input) {
inline static void vshader_program_dump_vs_param(const DWORD param, int input) {
static const char* rastout_reg_names[] = { "oPos", "oFog", "oPts" };
static const char swizzle_reg_chars[] = "xyzw";
/* the unknown mask is for bits not yet accounted for by any other mask... */
#define UNKNOWN_MASK 0xC000
/* for registeres about 7 we have to add on bits 11 and 12 to get the correct register */
#define EXTENDED_REG 0x1800
DWORD reg = param & D3DSP_REGNUM_MASK;
DWORD regtype = ((param & D3DSP_REGTYPE_MASK) >> D3DSP_REGTYPE_SHIFT) | ((param & EXTENDED_REG) >> 8);
if(param & UNKNOWN_MASK) { /* if this register has any of the unknown bits set then report them*/
FIXME("Unknown bits set regtype %lx , %lx, UK(%lx)\n", regtype, (param & EXTENDED_REG), param & UNKNOWN_MASK);
}
DWORD regtype = vshader_program_get_regtype(param);
if ((param & D3DSP_SRCMOD_MASK) == D3DSPSM_NEG) TRACE("-");
@ -875,9 +871,7 @@ inline static void vshader_program_dump_vs_param(const DWORD param, int input) {
inline static void vshader_program_dump_decl_usage(
IWineD3DVertexShaderImpl *This, DWORD decl, DWORD param) {
DWORD regtype = ((param & D3DSP_REGTYPE_MASK) >> D3DSP_REGTYPE_SHIFT) |
((param & D3DSP_REGTYPE_MASK2) >> D3DSP_REGTYPE_SHIFT2);
DWORD regtype = vshader_program_get_regtype(param);
TRACE("dcl_");
@ -1023,7 +1017,7 @@ inline static void vshader_program_add_param(IWineD3DVertexShaderImpl *This, con
static const char* hwrastout_reg_names[] = { "result.position", "result.fogcoord", "result.pointsize" };
DWORD reg = param & D3DSP_REGNUM_MASK;
DWORD regtype = ((param & D3DSP_REGTYPE_MASK) >> D3DSP_REGTYPE_SHIFT);
DWORD regtype = vshader_program_get_regtype(param);
char tmpReg[255];
BOOL is_color = FALSE;
@ -1362,7 +1356,7 @@ inline static VOID IWineD3DVertexShaderImpl_GenerateProgramArbHW(IWineD3DVertexS
} else {
/* Check to see if and tmp or addressing redisters are used */
if (curOpcode->num_params > 0) {
regtype = ((((*pToken) & D3DSP_REGTYPE_MASK) >> D3DSP_REGTYPE_SHIFT));
regtype = vshader_program_get_regtype(*pToken);
reg = ((*pToken) & D3DSP_REGNUM_MASK);
if (D3DSPR_ADDR == regtype && nUseAddressRegister <= reg) nUseAddressRegister = reg + 1;
if (D3DSPR_TEMP == regtype){
@ -1371,7 +1365,7 @@ inline static VOID IWineD3DVertexShaderImpl_GenerateProgramArbHW(IWineD3DVertexS
}
++pToken;
for (i = 1; i < curOpcode->num_params; ++i) {
regtype = ((((*pToken) & D3DSP_REGTYPE_MASK) >> D3DSP_REGTYPE_SHIFT));
regtype = vshader_program_get_regtype(*pToken);
reg = ((*pToken) & D3DSP_REGNUM_MASK);
if (D3DSPR_ADDR == regtype && nUseAddressRegister <= reg) nUseAddressRegister = reg + 1;
if (D3DSPR_TEMP == regtype){
@ -1645,7 +1639,7 @@ inline static VOID IWineD3DVertexShaderImpl_GenerateProgramArbHW(IWineD3DVertexS
continue;
case D3DSIO_MOV:
/* Address registers must be loaded with the ARL instruction */
if ((((*pToken) & D3DSP_REGTYPE_MASK) >> D3DSP_REGTYPE_SHIFT) == D3DSPR_ADDR) {
if (vshader_program_get_regtype(*pToken) == D3DSPR_ADDR) {
if (((*pToken) & D3DSP_REGNUM_MASK) < nUseAddressRegister) {
strcpy(tmpLine, "ARL");
break;
@ -1840,9 +1834,9 @@ HRESULT WINAPI IWineD3DVertexShaderImpl_ExecuteSW(IWineD3DVertexShader* iface, W
/* TRACE(">> execting opcode: pos=%d opcode_name=%s token=%08lX\n", pToken - vshader->function, curOpcode->name, *pToken); */
for (i = 0; i < curOpcode->num_params; ++i) {
DWORD reg = pToken[i] & D3DSP_REGNUM_MASK;
DWORD regtype = ((pToken[i] & D3DSP_REGTYPE_MASK) >> D3DSP_REGTYPE_SHIFT);
DWORD regtype = vshader_program_get_regtype(pToken[i]);
switch (regtype << D3DSP_REGTYPE_SHIFT) {
switch (regtype /*<< D3DSP_REGTYPE_SHIFT*/) {
case D3DSPR_TEMP:
/* TRACE("p[%d]=R[%d]\n", i, reg); */
p[i] = &R[reg];