Commit ac8f2c03 authored by Jason Green's avatar Jason Green Committed by Alexandre Julliard

wined3d: Improve traces for D3DTRANSFORMSTATETYPE.

Added debug function for WINED3DTRANSFORMSTATETYPE and changed all references from D3DTS_* to WINED3DTS_*.
parent e325efbd
...@@ -156,7 +156,7 @@ static void setup_light(IWineD3DDevice *iface, LONG Index, PLIGHTINFOEL *lightIn ...@@ -156,7 +156,7 @@ static void setup_light(IWineD3DDevice *iface, LONG Index, PLIGHTINFOEL *lightIn
/* Light settings are affected by the model view in OpenGL, the View transform in direct3d*/ /* Light settings are affected by the model view in OpenGL, the View transform in direct3d*/
glMatrixMode(GL_MODELVIEW); glMatrixMode(GL_MODELVIEW);
glPushMatrix(); glPushMatrix();
glLoadMatrixf((float *)&This->stateBlock->transforms[D3DTS_VIEW].u.m[0][0]); glLoadMatrixf((float *)&This->stateBlock->transforms[WINED3DTS_VIEW].u.m[0][0]);
/* Diffuse: */ /* Diffuse: */
colRGBA[0] = lightInfo->OriginalParms.Diffuse.r; colRGBA[0] = lightInfo->OriginalParms.Diffuse.r;
...@@ -2450,7 +2450,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetTransform(IWineD3DDevice *iface, D ...@@ -2450,7 +2450,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetTransform(IWineD3DDevice *iface, D
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
/* Most of this routine, comments included copied from ddraw tree initially: */ /* Most of this routine, comments included copied from ddraw tree initially: */
TRACE("(%p) : Transform State=%d\n", This, d3dts); TRACE("(%p) : Transform State=%s\n", This, debug_d3dtstype(d3dts));
/* Handle recording of state blocks */ /* Handle recording of state blocks */
if (This->isRecordingState) { if (This->isRecordingState) {
...@@ -2485,27 +2485,27 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetTransform(IWineD3DDevice *iface, D ...@@ -2485,27 +2485,27 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetTransform(IWineD3DDevice *iface, D
*/ */
/* Capture the times we can just ignore the change for now */ /* Capture the times we can just ignore the change for now */
if (d3dts == D3DTS_WORLDMATRIX(0)) { if (d3dts == WINED3DTS_WORLDMATRIX(0)) {
This->modelview_valid = FALSE; This->modelview_valid = FALSE;
return WINED3D_OK; return WINED3D_OK;
} else if (d3dts == D3DTS_PROJECTION) { } else if (d3dts == WINED3DTS_PROJECTION) {
This->proj_valid = FALSE; This->proj_valid = FALSE;
return WINED3D_OK; return WINED3D_OK;
} else if (d3dts >= D3DTS_WORLDMATRIX(1) && d3dts <= D3DTS_WORLDMATRIX(255)) { } else if (d3dts >= WINED3DTS_WORLDMATRIX(1) && d3dts <= WINED3DTS_WORLDMATRIX(255)) {
/* Indexed Vertex Blending Matrices 256 -> 511 */ /* Indexed Vertex Blending Matrices 256 -> 511 */
/* Use arb_vertex_blend or NV_VERTEX_WEIGHTING? */ /* Use arb_vertex_blend or NV_VERTEX_WEIGHTING? */
FIXME("D3DTS_WORLDMATRIX(1..255) not handled\n"); FIXME("WINED3DTS_WORLDMATRIX(1..255) not handled\n");
return WINED3D_OK; return WINED3D_OK;
} }
/* Now we really are going to have to change a matrix */ /* Now we really are going to have to change a matrix */
ENTER_GL(); ENTER_GL();
if (d3dts >= D3DTS_TEXTURE0 && d3dts <= D3DTS_TEXTURE7) { /* handle texture matrices */ if (d3dts >= WINED3DTS_TEXTURE0 && d3dts <= WINED3DTS_TEXTURE7) { /* handle texture matrices */
/* This is now set with the texture unit states, it may be a good idea to flag the change though! */ /* This is now set with the texture unit states, it may be a good idea to flag the change though! */
} else if (d3dts == D3DTS_VIEW) { /* handle the VIEW matrice */ } else if (d3dts == WINED3DTS_VIEW) { /* handle the VIEW matrice */
unsigned int k; unsigned int k;
/* If we are changing the View matrix, reset the light and clipping planes to the new view /* If we are changing the View matrix, reset the light and clipping planes to the new view
...@@ -2552,7 +2552,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetTransform(IWineD3DDevice *iface, D ...@@ -2552,7 +2552,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetTransform(IWineD3DDevice *iface, D
} }
static HRESULT WINAPI IWineD3DDeviceImpl_GetTransform(IWineD3DDevice *iface, D3DTRANSFORMSTATETYPE State, D3DMATRIX* pMatrix) { static HRESULT WINAPI IWineD3DDeviceImpl_GetTransform(IWineD3DDevice *iface, D3DTRANSFORMSTATETYPE State, D3DMATRIX* pMatrix) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
TRACE("(%p) : for Transform State %d\n", This, State); TRACE("(%p) : for Transform State %s\n", This, debug_d3dtstype(State));
memcpy(pMatrix, &This->stateBlock->transforms[State], sizeof(D3DMATRIX)); memcpy(pMatrix, &This->stateBlock->transforms[State], sizeof(D3DMATRIX));
return WINED3D_OK; return WINED3D_OK;
} }
...@@ -2567,7 +2567,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_MultiplyTransform(IWineD3DDevice *iface ...@@ -2567,7 +2567,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_MultiplyTransform(IWineD3DDevice *iface
* If this is found to be wrong, change to StateBlock. * If this is found to be wrong, change to StateBlock.
*/ */
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
TRACE("(%p) : For state %u\n", This, State); TRACE("(%p) : For state %s\n", This, debug_d3dtstype(State));
if (State < HIGHEST_TRANSFORMSTATE) if (State < HIGHEST_TRANSFORMSTATE)
{ {
...@@ -3016,7 +3016,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetClipPlane(IWineD3DDevice *iface, DWO ...@@ -3016,7 +3016,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetClipPlane(IWineD3DDevice *iface, DWO
/* Clip Plane settings are affected by the model view in OpenGL, the View transform in direct3d */ /* Clip Plane settings are affected by the model view in OpenGL, the View transform in direct3d */
glMatrixMode(GL_MODELVIEW); glMatrixMode(GL_MODELVIEW);
glPushMatrix(); glPushMatrix();
glLoadMatrixf((float *) &This->stateBlock->transforms[D3DTS_VIEW].u.m[0][0]); glLoadMatrixf((float *) &This->stateBlock->transforms[WINED3DTS_VIEW].u.m[0][0]);
TRACE("Clipplane [%f,%f,%f,%f]\n", TRACE("Clipplane [%f,%f,%f,%f]\n",
This->updateStateBlock->clipplane[Index][0], This->updateStateBlock->clipplane[Index][0],
...@@ -5024,13 +5024,13 @@ process_vertices_strided(IWineD3DDeviceImpl *This, DWORD dwDestIndex, DWORD dwCo ...@@ -5024,13 +5024,13 @@ process_vertices_strided(IWineD3DDeviceImpl *This, DWORD dwDestIndex, DWORD dwCo
} }
IWineD3DDevice_GetTransform( (IWineD3DDevice *) This, IWineD3DDevice_GetTransform( (IWineD3DDevice *) This,
D3DTS_VIEW, WINED3DTS_VIEW,
&view_mat); &view_mat);
IWineD3DDevice_GetTransform( (IWineD3DDevice *) This, IWineD3DDevice_GetTransform( (IWineD3DDevice *) This,
D3DTS_PROJECTION, WINED3DTS_PROJECTION,
&proj_mat); &proj_mat);
IWineD3DDevice_GetTransform( (IWineD3DDevice *) This, IWineD3DDevice_GetTransform( (IWineD3DDevice *) This,
D3DTS_WORLDMATRIX(0), WINED3DTS_WORLDMATRIX(0),
&world_mat); &world_mat);
TRACE("View mat:\n"); TRACE("View mat:\n");
...@@ -5520,7 +5520,7 @@ static void WINAPI IWineD3DDeviceImpl_ApplyTextureUnitState(IWineD3DDevice *ifac ...@@ -5520,7 +5520,7 @@ static void WINAPI IWineD3DDeviceImpl_ApplyTextureUnitState(IWineD3DDevice *ifac
/* Unhandled */ /* Unhandled */
case WINED3DTSS_TEXTURETRANSFORMFLAGS : case WINED3DTSS_TEXTURETRANSFORMFLAGS :
set_texture_matrix((float *)&This->stateBlock->transforms[D3DTS_TEXTURE0 + Stage].u.m[0][0], Value, (This->stateBlock->textureState[Stage][WINED3DTSS_TEXCOORDINDEX] & 0xFFFF0000) != D3DTSS_TCI_PASSTHRU); set_texture_matrix((float *)&This->stateBlock->transforms[WINED3DTS_TEXTURE0 + Stage].u.m[0][0], Value, (This->stateBlock->textureState[Stage][WINED3DTSS_TEXCOORDINDEX] & 0xFFFF0000) != D3DTSS_TCI_PASSTHRU);
break; break;
case WINED3DTSS_BUMPENVMAT00 : case WINED3DTSS_BUMPENVMAT00 :
......
...@@ -267,12 +267,12 @@ static void primitiveInitState( ...@@ -267,12 +267,12 @@ static void primitiveInitState(
/* In the general case, the view matrix is the identity matrix */ /* In the general case, the view matrix is the identity matrix */
if (This->view_ident) { if (This->view_ident) {
glLoadMatrixf((float *) &This->stateBlock->transforms[D3DTS_WORLDMATRIX(0)].u.m[0][0]); glLoadMatrixf((float *) &This->stateBlock->transforms[WINED3DTS_WORLDMATRIX(0)].u.m[0][0]);
checkGLcall("glLoadMatrixf"); checkGLcall("glLoadMatrixf");
} else { } else {
glLoadMatrixf((float *) &This->stateBlock->transforms[D3DTS_VIEW].u.m[0][0]); glLoadMatrixf((float *) &This->stateBlock->transforms[WINED3DTS_VIEW].u.m[0][0]);
checkGLcall("glLoadMatrixf"); checkGLcall("glLoadMatrixf");
glMultMatrixf((float *) &This->stateBlock->transforms[D3DTS_WORLDMATRIX(0)].u.m[0][0]); glMultMatrixf((float *) &This->stateBlock->transforms[WINED3DTS_WORLDMATRIX(0)].u.m[0][0]);
checkGLcall("glMultMatrixf"); checkGLcall("glMultMatrixf");
} }
} }
...@@ -299,7 +299,7 @@ static void primitiveInitState( ...@@ -299,7 +299,7 @@ static void primitiveInitState(
glMultMatrixf(invymat); glMultMatrixf(invymat);
checkGLcall("glMultMatrixf(invymat)"); checkGLcall("glMultMatrixf(invymat)");
} }
glMultMatrixf((float *) &This->stateBlock->transforms[D3DTS_PROJECTION].u.m[0][0]); glMultMatrixf((float *) &This->stateBlock->transforms[WINED3DTS_PROJECTION].u.m[0][0]);
checkGLcall("glLoadMatrixf"); checkGLcall("glLoadMatrixf");
} }
......
...@@ -816,10 +816,10 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_InitStartupStateBlock(IWineD3DStat ...@@ -816,10 +816,10 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_InitStartupStateBlock(IWineD3DStat
This->blockType = WINED3DSBT_INIT; This->blockType = WINED3DSBT_INIT;
/* Set some of the defaults for lights, transforms etc */ /* Set some of the defaults for lights, transforms etc */
memcpy(&This->transforms[D3DTS_PROJECTION], &identity, sizeof(identity)); memcpy(&This->transforms[WINED3DTS_PROJECTION], &identity, sizeof(identity));
memcpy(&This->transforms[D3DTS_VIEW], &identity, sizeof(identity)); memcpy(&This->transforms[WINED3DTS_VIEW], &identity, sizeof(identity));
for (i = 0; i < 256; ++i) { for (i = 0; i < 256; ++i) {
memcpy(&This->transforms[D3DTS_WORLDMATRIX(i)], &identity, sizeof(identity)); memcpy(&This->transforms[WINED3DTS_WORLDMATRIX(i)], &identity, sizeof(identity));
} }
TRACE("Render states\n"); TRACE("Render states\n");
...@@ -970,7 +970,7 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_InitStartupStateBlock(IWineD3DStat ...@@ -970,7 +970,7 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_InitStartupStateBlock(IWineD3DStat
/* Texture Stage States - Put directly into state block, we will call function below */ /* Texture Stage States - Put directly into state block, we will call function below */
for (i = 0; i < GL_LIMITS(texture_stages); i++) { for (i = 0; i < GL_LIMITS(texture_stages); i++) {
TRACE("Setting up default texture states for texture Stage %d\n", i); TRACE("Setting up default texture states for texture Stage %d\n", i);
memcpy(&This->transforms[D3DTS_TEXTURE0 + i], &identity, sizeof(identity)); memcpy(&This->transforms[WINED3DTS_TEXTURE0 + i], &identity, sizeof(identity));
This->textureState[i][D3DTSS_COLOROP ] = (i==0)? D3DTOP_MODULATE : D3DTOP_DISABLE; This->textureState[i][D3DTSS_COLOROP ] = (i==0)? D3DTOP_MODULATE : D3DTOP_DISABLE;
This->textureState[i][D3DTSS_COLORARG1 ] = D3DTA_TEXTURE; This->textureState[i][D3DTSS_COLORARG1 ] = D3DTA_TEXTURE;
This->textureState[i][D3DTSS_COLORARG2 ] = D3DTA_CURRENT; This->textureState[i][D3DTSS_COLORARG2 ] = D3DTA_CURRENT;
......
...@@ -542,6 +542,31 @@ const char* debug_d3dtop(D3DTEXTUREOP d3dtop) { ...@@ -542,6 +542,31 @@ const char* debug_d3dtop(D3DTEXTUREOP d3dtop) {
} }
} }
const char* debug_d3dtstype(WINED3DTRANSFORMSTATETYPE tstype) {
switch (tstype) {
#define TSTYPE_TO_STR(tstype) case tstype: return #tstype
TSTYPE_TO_STR(WINED3DTS_VIEW);
TSTYPE_TO_STR(WINED3DTS_PROJECTION);
TSTYPE_TO_STR(WINED3DTS_TEXTURE0);
TSTYPE_TO_STR(WINED3DTS_TEXTURE1);
TSTYPE_TO_STR(WINED3DTS_TEXTURE2);
TSTYPE_TO_STR(WINED3DTS_TEXTURE3);
TSTYPE_TO_STR(WINED3DTS_TEXTURE4);
TSTYPE_TO_STR(WINED3DTS_TEXTURE5);
TSTYPE_TO_STR(WINED3DTS_TEXTURE6);
TSTYPE_TO_STR(WINED3DTS_TEXTURE7);
TSTYPE_TO_STR(WINED3DTS_WORLDMATRIX(0));
#undef TSTYPE_TO_STR
default:
if (tstype > 256 && tstype < 512) {
FIXME("WINED3DTS_WORLDMATRIX(%u). 1..255 not currently supported\n", tstype);
return ("WINED3DTS_WORLDMATRIX > 0");
}
FIXME("Unrecognized %u WINED3DTS\n", tstype);
return "unrecognized";
}
}
const char* debug_d3dpool(WINED3DPOOL Pool) { const char* debug_d3dpool(WINED3DPOOL Pool) {
switch (Pool) { switch (Pool) {
#define POOL_TO_STR(p) case p: return #p; #define POOL_TO_STR(p) case p: return #p;
......
...@@ -1215,6 +1215,7 @@ const char* debug_d3dprimitivetype(D3DPRIMITIVETYPE PrimitiveType); ...@@ -1215,6 +1215,7 @@ const char* debug_d3dprimitivetype(D3DPRIMITIVETYPE PrimitiveType);
const char* debug_d3drenderstate(DWORD state); const char* debug_d3drenderstate(DWORD state);
const char* debug_d3dsamplerstate(DWORD state); const char* debug_d3dsamplerstate(DWORD state);
const char* debug_d3dtexturestate(DWORD state); const char* debug_d3dtexturestate(DWORD state);
const char* debug_d3dtstype(WINED3DTRANSFORMSTATETYPE tstype);
const char* debug_d3dpool(WINED3DPOOL pool); const char* debug_d3dpool(WINED3DPOOL pool);
/* Routines for GL <-> D3D values */ /* Routines for GL <-> D3D values */
......
...@@ -455,6 +455,27 @@ typedef enum _WINED3DTEXTURESTAGESTATETYPE { ...@@ -455,6 +455,27 @@ typedef enum _WINED3DTEXTURESTAGESTATETYPE {
#define WINED3D_HIGHEST_TEXTURE_STATE WINED3DTSS_CONSTANT #define WINED3D_HIGHEST_TEXTURE_STATE WINED3DTSS_CONSTANT
typedef enum _WINED3DTRANSFORMSTATETYPE {
WINED3DTS_VIEW = 2,
WINED3DTS_PROJECTION = 3,
WINED3DTS_TEXTURE0 = 16,
WINED3DTS_TEXTURE1 = 17,
WINED3DTS_TEXTURE2 = 18,
WINED3DTS_TEXTURE3 = 19,
WINED3DTS_TEXTURE4 = 20,
WINED3DTS_TEXTURE5 = 21,
WINED3DTS_TEXTURE6 = 22,
WINED3DTS_TEXTURE7 = 23,
WINED3DTS_FORCE_DWORD = 0x7fffffff
} WINED3DTRANSFORMSTATETYPE;
#define WINED3DTS_WORLD WINED3DTS_WORLDMATRIX(0)
#define WINED3DTS_WORLD1 WINED3DTS_WORLDMATRIX(1)
#define WINED3DTS_WORLD2 WINED3DTS_WORLDMATRIX(2)
#define WINED3DTS_WORLD3 WINED3DTS_WORLDMATRIX(3)
#define WINED3DTS_WORLDMATRIX(index) (WINED3DTRANSFORMSTATETYPE)(index + 256)
typedef enum _WINED3DBASISTYPE { typedef enum _WINED3DBASISTYPE {
WINED3DBASIS_BEZIER = 0, WINED3DBASIS_BEZIER = 0,
WINED3DBASIS_BSPLINE = 1, WINED3DBASIS_BSPLINE = 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