wined3d: Set wrapmode for cubemags to clamp regardeless of the
sampler state
Fabian Bieler
der.fabe at gmx.net
Sat Mar 10 08:02:46 CST 2007
This Patch forces GL_CLAMP_TO_EDGE on all cubemaps.
I tested this on XP with some Radeon X1???.
Also, this fixes some renderissues Half-Life 2.
-------------- next part --------------
From 942b0eb1c681c752c5ab5ff4d35c70d1e4219d84 Mon Sep 17 00:00:00 2001
From: Fabian Bieler <der.fabe at gmx.net>
Date: Sat, 10 Mar 2007 14:37:28 +0100
Subject: [PATCH] wined3d: Set wrapmode for cubemags to clamp regardeless of the sampler state
---
dlls/wined3d/basetexture.c | 14 +++++++++++++-
1 files changed, 13 insertions(+), 1 deletions(-)
diff --git a/dlls/wined3d/basetexture.c b/dlls/wined3d/basetexture.c
index c55ceda..c34b9c8 100644
--- a/dlls/wined3d/basetexture.c
+++ b/dlls/wined3d/basetexture.c
@@ -279,6 +279,12 @@ HRESULT WINAPI IWineD3DBaseTextureImpl_BindTexture(IWineD3DBaseTexture *iface) {
TRACE("Setting GL_TEXTURE_MAX_LEVEL to %d\n", This->baseTexture.levels - 1);
glTexParameteri(textureDimensions, GL_TEXTURE_MAX_LEVEL, This->baseTexture.levels - 1);
checkGLcall("glTexParameteri(textureDimensions, GL_TEXTURE_MAX_LEVEL, This->baseTexture.levels)");
+ if(textureDimensions==GL_TEXTURE_CUBE_MAP_ARB) {
+ /* Cubemaps are always set to clamp, regardeless of the sampler state. */
+ glTexParameteri(textureDimensions, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+ glTexParameteri(textureDimensions, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+ glTexParameteri(textureDimensions, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
+ }
}
} else { /* this only happened if we've run out of openGL textures */
@@ -355,7 +361,13 @@ void WINAPI IWineD3DBaseTextureImpl_ApplyStateChanges(IWineD3DBaseTexture *iface
if (*state < minLookup[WINELOOKUP_WARPPARAM] || *state > maxLookup[WINELOOKUP_WARPPARAM]) {
FIXME("Unrecognized or unsupported WINED3DTADDRESS_* value %d, state %d\n", *state, textureObjectSamplerStates[i].function);
} else {
- GLint wrapParm = stateLookup[WINELOOKUP_WARPPARAM][*state - minLookup[WINELOOKUP_WARPPARAM]];
+ GLint wrapParm;
+ if(textureDimensions==GL_TEXTURE_CUBE_MAP_ARB) {
+ /* Cubemaps are always set to clamp, regardeless of the sampler state. */
+ wrapParm = GL_CLAMP_TO_EDGE;
+ } else {
+ wrapParm = stateLookup[WINELOOKUP_WARPPARAM][*state - minLookup[WINELOOKUP_WARPPARAM]];
+ }
TRACE("Setting WRAP_R to %d for %x\n", wrapParm, textureDimensions);
glTexParameteri(textureDimensions, warpLookupType(textureObjectSamplerStates[i].function), wrapParm);
checkGLcall("glTexParameteri(..., GL_TEXTURE_WRAP_R, wrapParm)");
--
1.4.4.1
More information about the wine-patches
mailing list