wined3d: Texture transforms are disabled when drawing rhw vertices.

This commit is contained in:
Stefan Dösinger 2007-08-19 12:50:14 +02:00 committed by Alexandre Julliard
parent 2665a8bf79
commit a8e21d0692
3 changed files with 16 additions and 6 deletions

View File

@ -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) {

View File

@ -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;

View File

@ -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);