From 18c9e5d5d0835d2bd5434e10e96c6b9a5a6f05e9 Mon Sep 17 00:00:00 2001 From: Felix Nawothnig Date: Thu, 29 Mar 2007 18:45:04 +0200 Subject: [PATCH] wined3d: Use GL_TEXTURE_2D for dummy textures. --- dlls/wined3d/baseshader.c | 4 ---- dlls/wined3d/context.c | 4 ---- dlls/wined3d/state.c | 10 ++-------- dlls/wined3d/stateblock.c | 11 ++++++----- 4 files changed, 8 insertions(+), 21 deletions(-) diff --git a/dlls/wined3d/baseshader.c b/dlls/wined3d/baseshader.c index f4230d7bb6a..9e937ad7c99 100644 --- a/dlls/wined3d/baseshader.c +++ b/dlls/wined3d/baseshader.c @@ -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; diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c index ab8e9caea95..02bc4066c3f 100644 --- a/dlls/wined3d/context.c +++ b/dlls/wined3d/context.c @@ -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"); diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c index 054819874a5..07af88db2b7 100644 --- a/dlls/wined3d/state.c +++ b/dlls/wined3d/state.c @@ -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])"); } } diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c index 5ccd5ee6208..fe92d1ff899 100644 --- a/dlls/wined3d/stateblock.c +++ b/dlls/wined3d/stateblock.c @@ -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();