wined3d: Use GL_TEXTURE_2D for dummy textures.

This commit is contained in:
Felix Nawothnig 2007-03-29 18:45:04 +02:00 committed by Alexandre Julliard
parent 6760ccac1c
commit 18c9e5d5d0
4 changed files with 8 additions and 21 deletions

View file

@ -333,10 +333,6 @@ HRESULT shader_get_registers_used(
} else {
int texType = IWineD3DBaseTexture_GetTextureDimensions(stateBlock->textures[sampler_code]);
switch(texType) {
case GL_TEXTURE_1D:
reg_maps->samplers[sampler_code] = (0x1 << 31) | WINED3DSTT_1D;
break;
case GL_TEXTURE_2D:
reg_maps->samplers[sampler_code] = (0x1 << 31) | WINED3DSTT_2D;
break;

View file

@ -487,8 +487,6 @@ static inline void SetupForBlit(IWineD3DDeviceImpl *This, WineD3DContext *contex
checkGLcall("glDisable GL_TEXTURE_3D");
glDisable(GL_TEXTURE_2D);
checkGLcall("glDisable GL_TEXTURE_2D");
glDisable(GL_TEXTURE_1D);
checkGLcall("glDisable GL_TEXTURE_1D");
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
checkGLcall("glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);");
@ -505,8 +503,6 @@ static inline void SetupForBlit(IWineD3DDeviceImpl *This, WineD3DContext *contex
}
glDisable(GL_TEXTURE_3D);
checkGLcall("glDisable GL_TEXTURE_3D");
glDisable(GL_TEXTURE_1D);
checkGLcall("glDisable GL_TEXTURE_1D");
glEnable(GL_TEXTURE_2D);
checkGLcall("glEnable GL_TEXTURE_2D");

View file

@ -1549,8 +1549,6 @@ static void state_ckeyblend(DWORD state, IWineD3DStateBlockImpl *stateblock, Win
*/
static void activate_dimensions(DWORD stage, IWineD3DStateBlockImpl *stateblock) {
if(stateblock->textures[stage]) {
glDisable(GL_TEXTURE_1D);
checkGLcall("glDisable(GL_TEXTURE_1D)");
switch(stateblock->textureDimensions[stage]) {
case GL_TEXTURE_2D:
glDisable(GL_TEXTURE_3D);
@ -1590,8 +1588,6 @@ static void activate_dimensions(DWORD stage, IWineD3DStateBlockImpl *stateblock)
glDisable(GL_TEXTURE_CUBE_MAP_ARB);
checkGLcall("glDisable(GL_TEXTURE_CUBE_MAP_ARB)");
}
glEnable(GL_TEXTURE_1D);
checkGLcall("glEnable(GL_TEXTURE_1D)");
/* Binding textures is done by samplers. A dummy texture will be bound */
}
}
@ -1639,8 +1635,6 @@ static void tex_colorop(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3D
TRACE("Stage disabled\n");
if (mapped_stage != -1) {
/* Disable everything here */
glDisable(GL_TEXTURE_1D);
checkGLcall("glDisable(GL_TEXTURE_1D)");
glDisable(GL_TEXTURE_2D);
checkGLcall("glDisable(GL_TEXTURE_2D)");
glDisable(GL_TEXTURE_3D);
@ -2079,8 +2073,8 @@ static void sampler(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DCont
activate_dimensions(sampler, stateblock);
}
} /* Otherwise tex_colorop disables the stage */
glBindTexture(GL_TEXTURE_1D, stateblock->wineD3DDevice->dummyTextureName[sampler]);
checkGLcall("glBindTexture(GL_TEXTURE_1D, stateblock->wineD3DDevice->dummyTextureName[sampler])");
glBindTexture(GL_TEXTURE_2D, stateblock->wineD3DDevice->dummyTextureName[sampler]);
checkGLcall("glBindTexture(GL_TEXTURE_2D, stateblock->wineD3DDevice->dummyTextureName[sampler])");
}
}

View file

@ -1083,13 +1083,14 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_InitStartupStateBlock(IWineD3DStat
checkGLcall("glGenTextures");
TRACE("Dummy Texture %d given name %d\n", i, ThisDevice->dummyTextureName[i]);
/* Generate a dummy 1d texture */
This->textureDimensions[i] = GL_TEXTURE_1D;
glBindTexture(GL_TEXTURE_1D, ThisDevice->dummyTextureName[i]);
/* Generate a dummy 2d texture (not using 1d because they cause many
* DRI drivers fall back to sw) */
This->textureDimensions[i] = GL_TEXTURE_2D;
glBindTexture(GL_TEXTURE_2D, ThisDevice->dummyTextureName[i]);
checkGLcall("glBindTexture");
glTexImage1D(GL_TEXTURE_1D, 0, GL_LUMINANCE, 1, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, &white);
checkGLcall("glTexImage1D");
glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, 1, 1, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, &white);
checkGLcall("glTexImage2D");
}
LEAVE_GL();