From 0334c1760f98fb9b6609704c736ec51337345422 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Sun, 11 Nov 2007 21:46:17 +0100 Subject: [PATCH] wined3d: Apply matrices when switching from transformed vertices to shaders. --- dlls/wined3d/state.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c index 296c5ce037a..1a49e242737 100644 --- a/dlls/wined3d/state.c +++ b/dlls/wined3d/state.c @@ -3426,6 +3426,19 @@ static void vertexdeclaration(DWORD state, IWineD3DStateBlockImpl *stateblock, W FIXME("Clipping not supported with vertex shaders\n"); warned = TRUE; } + if(wasrhw) { + /* Apply the transform matrices when switching from rhw drawing to vertex shaders. Vertex + * shaders themselves do not need it it, but the matrices are not reapplied automatically when + * switching back from vertex shaders to fixed function processing. So make sure we leave the + * fixed function vertex processing states back in a sane state before switching to shaders + */ + if(!isStateDirty(context, STATE_TRANSFORM(WINED3DTS_PROJECTION))) { + transform_projection(STATE_TRANSFORM(WINED3DTS_PROJECTION), stateblock, context); + } + if(!isStateDirty(context, STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(0)))) { + transform_world(STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(0)), stateblock, context); + } + } } }