Commit aadafd64 authored by Ivan Gyurdiev's avatar Ivan Gyurdiev Committed by Alexandre Julliard

wined3d: Make register counting pass the same.

parent 7e12e2ac
...@@ -1102,12 +1102,6 @@ inline static VOID IWineD3DVertexShaderImpl_GenerateProgramArbHW(IWineD3DVertexS ...@@ -1102,12 +1102,6 @@ inline static VOID IWineD3DVertexShaderImpl_GenerateProgramArbHW(IWineD3DVertexS
buffer.bsize = 0; buffer.bsize = 0;
buffer.lineNo = 0; buffer.lineNo = 0;
/* Initialise the shader */
This->namedArrays = FALSE;
This->declaredArrays = FALSE;
for (i = 0; i < WINED3DSHADERDECLUSAGE_MAX_USAGE; i++) {
This->arrayUsageMap[i] = -1;
}
/* set all the tmpsUsed to not used */ /* set all the tmpsUsed to not used */
memset(tmpsUsed, FALSE , sizeof(tmpsUsed)); memset(tmpsUsed, FALSE , sizeof(tmpsUsed));
...@@ -1144,18 +1138,14 @@ inline static VOID IWineD3DVertexShaderImpl_GenerateProgramArbHW(IWineD3DVertexS ...@@ -1144,18 +1138,14 @@ inline static VOID IWineD3DVertexShaderImpl_GenerateProgramArbHW(IWineD3DVertexS
++pToken; ++pToken;
} }
} else { } else {
/* Skip declarations, handled earlier */
if (curOpcode->opcode == D3DSIO_DCL){ if (curOpcode->opcode == D3DSIO_DCL){
INT usage = *pToken++; pToken += 2;
INT arrayNo = (*pToken++ & D3DSP_REGNUM_MASK);
parse_decl_usage(This, usage, arrayNo); /* Skip definition of immediate constants, handled later */
} else if(curOpcode->opcode == D3DSIO_DEF) { } else if(curOpcode->opcode == D3DSIO_DEF) {
This->constantsUsedBitmap[*pToken & 0xFF] = VS_CONSTANT_CONSTANT; pToken += 5;
FIXME("Constant %ld\n", *pToken & 0xFF);
++pToken;
++pToken;
++pToken;
++pToken;
++pToken;
} else { } else {
/* Check to see if and tmp or addressing redisters are used */ /* Check to see if and tmp or addressing redisters are used */
...@@ -1191,19 +1181,7 @@ inline static VOID IWineD3DVertexShaderImpl_GenerateProgramArbHW(IWineD3DVertexS ...@@ -1191,19 +1181,7 @@ inline static VOID IWineD3DVertexShaderImpl_GenerateProgramArbHW(IWineD3DVertexS
} }
} }
} }
#if 1
#define VSHADER_ALWAYS_NUMBERED
#endif
#ifdef VSHADER_ALWAYS_NUMBERED /* handy for debugging using numbered arrays instead of named arrays */
/* TODO: using numbered arrays for software shaders makes things easier */
This->declaredArrays = TRUE;
#endif
/* named arrays and declared arrays are mutually exclusive */
if (This->declaredArrays) {
This->namedArrays = FALSE;
}
/* TODO: validate /* TODO: validate
nUseAddressRegister < = GL_MAX_PROGRAM_ADDRESS_REGISTERS_AR nUseAddressRegister < = GL_MAX_PROGRAM_ADDRESS_REGISTERS_AR
nUseTempRegister <= GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB nUseTempRegister <= GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB
...@@ -1285,6 +1263,7 @@ inline static VOID IWineD3DVertexShaderImpl_GenerateProgramArbHW(IWineD3DVertexS ...@@ -1285,6 +1263,7 @@ inline static VOID IWineD3DVertexShaderImpl_GenerateProgramArbHW(IWineD3DVertexS
*(float *) (pToken + 3), *(float *) (pToken + 3),
*(float *) (pToken + 4)); *(float *) (pToken + 4));
This->constantsUsedBitmap[*pToken & 0xFF] = VS_CONSTANT_CONSTANT;
pToken += 5; pToken += 5;
continue; continue;
...@@ -1876,6 +1855,12 @@ HRESULT WINAPI IWineD3DVertexShaderImpl_SetFunction(IWineD3DVertexShader *iface, ...@@ -1876,6 +1855,12 @@ HRESULT WINAPI IWineD3DVertexShaderImpl_SetFunction(IWineD3DVertexShader *iface,
DWORD i; DWORD i;
TRACE("(%p) : Parsing programme\n", This); TRACE("(%p) : Parsing programme\n", This);
/* Initialise vertex input arrays */
This->namedArrays = FALSE;
This->declaredArrays = FALSE;
for (i = 0; i < WINED3DSHADERDECLUSAGE_MAX_USAGE; i++)
This->arrayUsageMap[i] = -1;
if (NULL != pToken) { if (NULL != pToken) {
while (D3DVS_END() != *pToken) { while (D3DVS_END() != *pToken) {
if (vshader_is_version_token(*pToken)) { /** version */ if (vshader_is_version_token(*pToken)) { /** version */
...@@ -1907,12 +1892,16 @@ HRESULT WINAPI IWineD3DVertexShaderImpl_SetFunction(IWineD3DVertexShader *iface, ...@@ -1907,12 +1892,16 @@ HRESULT WINAPI IWineD3DVertexShaderImpl_SetFunction(IWineD3DVertexShader *iface,
} else { } else {
if (curOpcode->opcode == D3DSIO_DCL) { if (curOpcode->opcode == D3DSIO_DCL) {
vshader_program_dump_decl_usage(This, *pToken, *(pToken + 1));
++pToken; DWORD usage = *pToken;
++len; DWORD param = *(pToken + 1);
vshader_program_dump_vs_param(*pToken, 0);
++pToken; parse_decl_usage(This, usage, param & D3DSP_REGNUM_MASK);
++len; vshader_program_dump_decl_usage(This, usage, param);
vshader_program_dump_vs_param(param, 0);
pToken += 2;
len += 2;
} else } else
if (curOpcode->opcode == D3DSIO_DEF) { if (curOpcode->opcode == D3DSIO_DEF) {
TRACE("def c%lu = ", *pToken & 0xFF); TRACE("def c%lu = ", *pToken & 0xFF);
...@@ -1952,6 +1941,16 @@ HRESULT WINAPI IWineD3DVertexShaderImpl_SetFunction(IWineD3DVertexShader *iface, ...@@ -1952,6 +1941,16 @@ HRESULT WINAPI IWineD3DVertexShaderImpl_SetFunction(IWineD3DVertexShader *iface,
This->baseShader.functionLength = 1; /* no Function defined use fixed function vertex processing */ This->baseShader.functionLength = 1; /* no Function defined use fixed function vertex processing */
} }
/* Handy for debugging using numbered arrays instead of named arrays */
#if 1
/* TODO: using numbered arrays for software shaders makes things easier */
This->declaredArrays = TRUE;
#endif
/* named arrays and declared arrays are mutually exclusive */
if (This->declaredArrays)
This->namedArrays = FALSE;
/* Generate HW shader in needed */ /* Generate HW shader in needed */
if (NULL != pFunction && wined3d_settings.vs_mode == VS_HW) { if (NULL != pFunction && wined3d_settings.vs_mode == VS_HW) {
#if 1 #if 1
......
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