Module: wine Branch: master Commit: a8e21d06922c651500aa73aefef65d3fd8fe1dea URL: http://source.winehq.org/git/wine.git/?a=commit;h=a8e21d06922c651500aa73aefe...
Author: Stefan Dösinger stefan@codeweavers.com Date: Sun Aug 19 12:50:14 2007 +0200
wined3d: Texture transforms are disabled when drawing rhw vertices.
---
dlls/wined3d/state.c | 14 ++++++++++++-- dlls/wined3d/utils.c | 4 ++-- dlls/wined3d/wined3d_private.h | 4 ++-- 3 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c index 20a7fa5..4526151 100644 --- a/dlls/wined3d/state.c +++ b/dlls/wined3d/state.c @@ -1875,7 +1875,8 @@ static void transform_texture(DWORD state, IWineD3DStateBlockImpl *stateblock, W
set_texture_matrix((float *)&stateblock->transforms[WINED3DTS_TEXTURE0 + texUnit].u.m[0][0], stateblock->textureState[texUnit][WINED3DTSS_TEXTURETRANSFORMFLAGS], - (stateblock->textureState[texUnit][WINED3DTSS_TEXCOORDINDEX] & 0xFFFF0000) != WINED3DTSS_TCI_PASSTHRU); + (stateblock->textureState[texUnit][WINED3DTSS_TEXCOORDINDEX] & 0xFFFF0000) != WINED3DTSS_TCI_PASSTHRU, + context->last_was_rhw);
}
@@ -3198,7 +3199,7 @@ static inline void handleStreams(IWineD3DStateBlockImpl *stateblock, BOOL useVer }
static void vertexdeclaration(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) { - BOOL useVertexShaderFunction = FALSE, updateFog = FALSE; + BOOL useVertexShaderFunction = FALSE, updateFog = FALSE, updateTexMatrices = FALSE; BOOL usePixelShaderFunction = stateblock->wineD3DDevice->ps_selected_mode != SHADER_NONE && stateblock->pixelShader && ((IWineD3DPixelShaderImpl *)stateblock->pixelShader)->baseShader.function; BOOL transformed; @@ -3227,6 +3228,7 @@ static void vertexdeclaration(DWORD state, IWineD3DStateBlockImpl *stateblock, W
if(transformed != context->last_was_rhw && !useVertexShaderFunction) { updateFog = TRUE; + updateTexMatrices = TRUE; }
/* Reapply lighting if it is not scheduled for reapplication already */ @@ -3331,6 +3333,14 @@ static void vertexdeclaration(DWORD state, IWineD3DStateBlockImpl *stateblock, W if(updateFog) { state_fog(STATE_RENDER(WINED3DRS_FOGENABLE), stateblock, context); } + if(updateTexMatrices) { + int i; + for(i = 0; i < MAX_TEXTURES; i++) { + if(!isStateDirty(context, STATE_TRANSFORM(WINED3DTS_TEXTURE0 + i))) { + transform_texture(STATE_TRANSFORM(WINED3DTS_TEXTURE0 + i), stateblock, context); + } + } + } }
static void viewport(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) { diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c index abb5eb3..3f9cdd5 100644 --- a/dlls/wined3d/utils.c +++ b/dlls/wined3d/utils.c @@ -2418,14 +2418,14 @@ void set_tex_op(IWineD3DDevice *iface, BOOL isAlpha, int Stage, WINED3DTEXTUREOP #endif
/* Setup this textures matrix according to the texture flags*/ -void set_texture_matrix(const float *smat, DWORD flags, BOOL calculatedCoords) +void set_texture_matrix(const float *smat, DWORD flags, BOOL calculatedCoords, BOOL transformed) { float mat[16];
glMatrixMode(GL_TEXTURE); checkGLcall("glMatrixMode(GL_TEXTURE)");
- if (flags == WINED3DTTFF_DISABLE) { + if (flags == WINED3DTTFF_DISABLE || transformed) { glLoadIdentity(); checkGLcall("glLoadIdentity()"); return; diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index e12cebc..36185a1 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -91,7 +91,7 @@ void hash_table_remove(hash_table_t *table, void *key); #define NUM_SAVEDPIXELSTATES_R 35 #define NUM_SAVEDPIXELSTATES_T 18 #define NUM_SAVEDPIXELSTATES_S 12 -#define NUM_SAVEDVERTEXSTATES_R 33 +#define NUM_SAVEDVERTEXSTATES_R 34 #define NUM_SAVEDVERTEXSTATES_T 2 #define NUM_SAVEDVERTEXSTATES_S 1
@@ -1532,7 +1532,7 @@ GLenum StencilOp(DWORD op); GLenum CompareFunc(DWORD func); void set_tex_op(IWineD3DDevice *iface, BOOL isAlpha, int Stage, WINED3DTEXTUREOP op, DWORD arg1, DWORD arg2, DWORD arg3); void set_tex_op_nvrc(IWineD3DDevice *iface, BOOL is_alpha, int stage, WINED3DTEXTUREOP op, DWORD arg1, DWORD arg2, DWORD arg3, INT texture_idx); -void set_texture_matrix(const float *smat, DWORD flags, BOOL calculatedCoords); +void set_texture_matrix(const float *smat, DWORD flags, BOOL calculatedCoords, BOOL transformed);
void surface_set_compatible_renderbuffer(IWineD3DSurface *iface, unsigned int width, unsigned int height); GLenum surface_get_gl_buffer(IWineD3DSurface *iface, IWineD3DSwapChain *swapchain);