Commit c4eff1eb authored by Roderick Colenbrander's avatar Roderick Colenbrander Committed by Alexandre Julliard

wined3d: Vertex Shader regtype cleanups.

parent 35f9a479
...@@ -707,12 +707,17 @@ inline static const SHADER_OPCODE* vshader_program_get_opcode(IWineD3DVertexShad ...@@ -707,12 +707,17 @@ inline static const SHADER_OPCODE* vshader_program_get_opcode(IWineD3DVertexShad
return NULL; 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) { inline static void vshader_program_dump_param(const DWORD param, int input) {
static const char* rastout_reg_names[] = { "oPos", "oFog", "oPts" }; static const char* rastout_reg_names[] = { "oPos", "oFog", "oPts" };
static const char swizzle_reg_chars[] = "xyzw"; static const char swizzle_reg_chars[] = "xyzw";
DWORD reg = param & D3DSP_REGNUM_MASK; 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("-"); if ((param & D3DSP_SRCMOD_MASK) == D3DSPSM_NEG) TRACE("-");
...@@ -781,18 +786,9 @@ inline static void vshader_program_dump_param(const DWORD param, int input) { ...@@ -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) { 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* rastout_reg_names[] = { "oPos", "oFog", "oPts" };
static const char swizzle_reg_chars[] = "xyzw"; 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 reg = param & D3DSP_REGNUM_MASK;
DWORD regtype = ((param & D3DSP_REGTYPE_MASK) >> D3DSP_REGTYPE_SHIFT) | ((param & EXTENDED_REG) >> 8); DWORD regtype = vshader_program_get_regtype(param);
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);
}
if ((param & D3DSP_SRCMOD_MASK) == D3DSPSM_NEG) TRACE("-"); 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) { ...@@ -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( inline static void vshader_program_dump_decl_usage(
IWineD3DVertexShaderImpl *This, DWORD decl, DWORD param) { IWineD3DVertexShaderImpl *This, DWORD decl, DWORD param) {
DWORD regtype = vshader_program_get_regtype(param);
DWORD regtype = ((param & D3DSP_REGTYPE_MASK) >> D3DSP_REGTYPE_SHIFT) |
((param & D3DSP_REGTYPE_MASK2) >> D3DSP_REGTYPE_SHIFT2);
TRACE("dcl_"); TRACE("dcl_");
...@@ -1023,7 +1017,7 @@ inline static void vshader_program_add_param(IWineD3DVertexShaderImpl *This, con ...@@ -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" }; static const char* hwrastout_reg_names[] = { "result.position", "result.fogcoord", "result.pointsize" };
DWORD reg = param & D3DSP_REGNUM_MASK; 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]; char tmpReg[255];
BOOL is_color = FALSE; BOOL is_color = FALSE;
...@@ -1362,7 +1356,7 @@ inline static VOID IWineD3DVertexShaderImpl_GenerateProgramArbHW(IWineD3DVertexS ...@@ -1362,7 +1356,7 @@ inline static VOID IWineD3DVertexShaderImpl_GenerateProgramArbHW(IWineD3DVertexS
} else { } else {
/* Check to see if and tmp or addressing redisters are used */ /* Check to see if and tmp or addressing redisters are used */
if (curOpcode->num_params > 0) { if (curOpcode->num_params > 0) {
regtype = ((((*pToken) & D3DSP_REGTYPE_MASK) >> D3DSP_REGTYPE_SHIFT)); regtype = vshader_program_get_regtype(*pToken);
reg = ((*pToken) & D3DSP_REGNUM_MASK); reg = ((*pToken) & D3DSP_REGNUM_MASK);
if (D3DSPR_ADDR == regtype && nUseAddressRegister <= reg) nUseAddressRegister = reg + 1; if (D3DSPR_ADDR == regtype && nUseAddressRegister <= reg) nUseAddressRegister = reg + 1;
if (D3DSPR_TEMP == regtype){ if (D3DSPR_TEMP == regtype){
...@@ -1371,7 +1365,7 @@ inline static VOID IWineD3DVertexShaderImpl_GenerateProgramArbHW(IWineD3DVertexS ...@@ -1371,7 +1365,7 @@ inline static VOID IWineD3DVertexShaderImpl_GenerateProgramArbHW(IWineD3DVertexS
} }
++pToken; ++pToken;
for (i = 1; i < curOpcode->num_params; ++i) { 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); reg = ((*pToken) & D3DSP_REGNUM_MASK);
if (D3DSPR_ADDR == regtype && nUseAddressRegister <= reg) nUseAddressRegister = reg + 1; if (D3DSPR_ADDR == regtype && nUseAddressRegister <= reg) nUseAddressRegister = reg + 1;
if (D3DSPR_TEMP == regtype){ if (D3DSPR_TEMP == regtype){
...@@ -1645,7 +1639,7 @@ inline static VOID IWineD3DVertexShaderImpl_GenerateProgramArbHW(IWineD3DVertexS ...@@ -1645,7 +1639,7 @@ inline static VOID IWineD3DVertexShaderImpl_GenerateProgramArbHW(IWineD3DVertexS
continue; continue;
case D3DSIO_MOV: case D3DSIO_MOV:
/* Address registers must be loaded with the ARL instruction */ /* 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) { if (((*pToken) & D3DSP_REGNUM_MASK) < nUseAddressRegister) {
strcpy(tmpLine, "ARL"); strcpy(tmpLine, "ARL");
break; break;
...@@ -1840,9 +1834,9 @@ HRESULT WINAPI IWineD3DVertexShaderImpl_ExecuteSW(IWineD3DVertexShader* iface, W ...@@ -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); */ /* 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) { for (i = 0; i < curOpcode->num_params; ++i) {
DWORD reg = pToken[i] & D3DSP_REGNUM_MASK; 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: case D3DSPR_TEMP:
/* TRACE("p[%d]=R[%d]\n", i, reg); */ /* TRACE("p[%d]=R[%d]\n", i, reg); */
p[i] = &R[reg]; p[i] = &R[reg];
......
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