basetexture.c revision ba6524ccac330688123403ddf0a83d702cd9e371
* IWineD3DBaseTexture Implementation * Copyright 2002-2004 Jason Edmeades * Copyright 2002-2004 Raphael Junqueira * Copyright 2005 Oliver Stieber * Copyright 2007-2008 Stefan Dösinger for CodeWeavers * Copyright 2009 Henri Verbeet for CodeWeavers * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Oracle LGPL Disclaimer: For the avoidance of doubt, except that if any license choice * other than GPL or LGPL is available it will apply instead, Oracle elects to use only * the Lesser General Public License version 2.1 (LGPLv2) at this time for any software where * a choice of LGPL license versions is made available with the language indicating * that LGPLv2 or any later version may be used, or where a choice of which version * of the LGPL is applied is otherwise unspecified. WARN(
"Failed to initialize resource, returning %#x\n",
hr);
/* A GL context is provided by the caller */ /* The d3d9:texture test shows that SetLOD is ignored on non-managed * textures. The call always returns 0, and GetLOD always returns 0 TRACE(
"(%p) : returning invalid call\n",
This);
/* What about multithreading? Do we want all the context overhead just to set this value? * Or should we delay the applying until the texture is used for drawing? For now, apply checkGLcall(
"glTexParameteri(textureDimensions, GL_GENERATE_MIPMAP_HINT_SGIS, GL_FASTEST)");
checkGLcall(
"glTexParameteri(textureDimensions, GL_GENERATE_MIPMAP_HINT_SGIS, GL_NICEST)");
WARN(
"Unexpected filter type %d, setting to GL_NICEST\n",
FilterType);
checkGLcall(
"glTexParameteri(textureDimensions, GL_GENERATE_MIPMAP_HINT_SGIS, GL_NICEST)");
/* TODO: Implement filters using GL_SGI_generate_mipmaps. */ /* Context activation is done by the caller. */ TRACE(
"(%p) : About to bind texture\n",
This);
/* Generate a texture name if we don't already have one */ /* Tell opengl to try and keep this texture in video ram (well mostly) */ /* Initialise the state of the texture object to the openGL defaults, not the directx defaults */ /* This means double binding the texture at creation, but keeps the code simpler all * in all, and the run-time path free from additional checks checkGLcall(
"glTexParameteri(textureDimensions, GL_GENERATE_MIPMAP_SGIS, GL_TRUE)");
/* For a new texture we have to set the textures levels after binding the texture. * In theory this is all we should ever have to do, but because ATI's drivers are broken, we * also need to set the texture dimensions before the texture is set * Beware that texture rectangles do not support mipmapping, but set the maxmiplevel if we're * relying on the partial GL_ARB_texture_non_power_of_two emulation with texture rectangles * (ie, do not care for cond_np2 here, just look for GL_TEXTURE_RECTANGLE_ARB) checkGLcall(
"glTexParameteri(textureDimensions, GL_TEXTURE_MAX_LEVEL, This->baseTexture.levels)");
/* Cubemaps are always set to clamp, regardless of the sampler state. */ }
else {
/* this only happened if we've run out of openGL textures */ WARN(
"This texture doesn't have an openGL texture assigned to it\n");
/* GL locking is done by the caller */ FIXME(
"Unrecognized or unsupported WINED3DTEXTUREADDRESS %#x.\n",
d3d_wrap);
/* Cubemaps are always set to clamp, regardless of the sampler state. */ checkGLcall(
"glTexParameteri(target, param, gl_wrap)");
/* GL locking is done by the caller (state handler) */ /* This function relies on the correct texture being bound and loaded. */ checkGLcall(
"glTexParameteri(..., GL_TEXTURE_BORDER_COLOR, ...)");
FIXME(
"Unrecognized or unsupported MAGFILTER* value %d\n",
state);
FIXME(
"Unrecognized or unsupported D3DSAMP_MINFILTER value %d D3DSAMP_MIPFILTER value %d\n",
TRACE(
"ValueMIN=%d, ValueMIP=%d, setting MINFILTER to %x\n",
checkGLcall(
"glTexParameter GL_TEXTURE_MIN_FILTER, ...");
/* baseTexture.LOD is already clamped in the setter */ /* Note that D3DSAMP_MAXMIPLEVEL specifies the biggest mipmap(default 0), while * GL_TEXTURE_MAX_LEVEL specifies the smallest mimap used(default 1000). * So D3DSAMP_MAXMIPLEVEL is the same as GL_TEXTURE_BASE_LEVEL. checkGLcall(
"glTexParameteri(GL_TEXTURE_MAX_ANISOTROPY_EXT, aniso)");
WARN(
"Anisotropic filtering not supported.\n");