basetexture.c revision c113f3435253eb5c01a17f6b599c280d505663f7
/*
* 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
*
* 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
*/
/*
* Sun LGPL Disclaimer: For the avoidance of doubt, except that if any license choice
* other than GPL or LGPL is available it will apply instead, Sun 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.
*/
#include "config.h"
#include "wined3d_private.h"
HRESULT basetexture_init(IWineD3DBaseTextureImpl *texture, UINT levels, WINED3DRESOURCETYPE resource_type,
#ifdef VBOX_WITH_WDDM
, void *pvClientMem
#endif
)
{
#ifdef VBOX_WITH_WDDM
#endif
);
{
return hr;
}
texture->baseTexture.filterType = (usage & WINED3DUSAGE_AUTOGENMIPMAP) ? WINED3DTEXF_LINEAR : WINED3DTEXF_NONE;
#if defined(VBOX_WITH_WDDM) && defined(DEBUG_leo)
#else
#endif
{
}
else
{
}
return WINED3D_OK;
}
{
}
/* A GL context is provided by the caller */
{
ENTER_GL();
LEAVE_GL();
}
{
{
}
}
}
}
{
/* The d3d9:texture test shows that SetLOD is ignored on non-managed
* textures. The call always returns 0, and GetLOD always returns 0
*/
return 0;
}
}
}
return old;
}
{
}
{
}
HRESULT basetexture_set_autogen_filter_type(IWineD3DBaseTexture *iface, WINED3DTEXTUREFILTERTYPE FilterType)
{
return WINED3DERR_INVALIDCALL;
}
/* 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
* immediately.
*/
ENTER_GL();
checkGLcall("glBindTexture");
switch(FilterType) {
case WINED3DTEXF_NONE:
case WINED3DTEXF_POINT:
checkGLcall("glTexParameteri(textureDimensions, GL_GENERATE_MIPMAP_HINT_SGIS, GL_FASTEST)");
break;
case WINED3DTEXF_LINEAR:
checkGLcall("glTexParameteri(textureDimensions, GL_GENERATE_MIPMAP_HINT_SGIS, GL_NICEST)");
break;
default:
checkGLcall("glTexParameteri(textureDimensions, GL_GENERATE_MIPMAP_HINT_SGIS, GL_NICEST)");
}
LEAVE_GL();
}
return WINED3D_OK;
}
{
}
{
/* TODO: Implement filters using GL_SGI_generate_mipmaps. */
}
{
return old;
}
{
}
/* Context activation is done by the caller. */
{
struct gl_texture *gl_tex;
if(srgb) {
} else {
}
ENTER_GL();
/* Generate a texture name if we don't already have one */
*set_surface_desc = TRUE;
#ifdef VBOX_WITH_WDDM
{
}
else
#endif
{
#ifdef VBOX_WITH_WDDM
if (VBOXSHRC_IS_SHARED(This))
{
}
#endif
}
checkGLcall("glGenTextures");
/* Tell opengl to try and keep this texture in video ram (well mostly) */
tmp = 0.9f;
}
/* Initialise the state of the texture object
to the openGL defaults, not the directx defaults */
isNewTexture = TRUE;
/* 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("glBindTexture");
checkGLcall("glTexParameteri(textureDimensions, GL_GENERATE_MIPMAP_SGIS, GL_TRUE)");
}
} else {
}
/* Bind the texture */
checkGLcall("glBindTexture");
if (isNewTexture) {
/* 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");
}
LEAVE_GL();
return hr;
}
/* GL locking is done by the caller */
{
{
return;
}
if (target == GL_TEXTURE_CUBE_MAP_ARB
{
/* Cubemaps are always set to clamp, regardless of the sampler state. */
}
else
{
}
checkGLcall("glTexParameteri(target, param, gl_wrap)");
}
/* GL locking is done by the caller (state handler) */
const struct wined3d_gl_info *gl_info)
{
struct gl_texture *gl_tex;
} else {
}
/* This function relies on the correct texture being bound and loaded. */
}
}
}
float col[4];
checkGLcall("glTexParameteri(..., GL_TEXTURE_BORDER_COLOR, ...)");
}
if (state > WINED3DTEXF_ANISOTROPIC) {
}
}
{
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, ...");
if(!cond_np2) {
/* baseTexture.LOD is already clamped in the setter */
} else {
}
/* 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.
*/
}
}
|| cond_np2)
{
aniso = 1;
}
else
{
}
{
{
checkGLcall("glTexParameteri(GL_TEXTURE_MAX_ANISOTROPY_EXT, aniso)");
}
else
{
WARN("Anisotropic filtering not supported.\n");
}
}
}