texture.c revision 114410893548b9522c46fdcbd8f63385eb8bfb68
/*
* IWineD3DTexture implementation
*
* Copyright 2002-2005 Jason Edmeades
* Copyright 2002-2005 Raphael Junqueira
* Copyright 2005 Oliver Stieber
* Copyright 2007-2008 Stefan Dösinger 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"
#define GLINFO_LOCATION (*gl_info)
{
/* Override the IWineD3DResource PreLoad method. */
unsigned int i;
switch (srgb)
{
case SRGB_RGB:
break;
case SRGB_BOTH:
/* Fallthrough */
case SRGB_SRGB:
break;
default:
break;
}
{
/* ActivateContext sets isInDraw to TRUE when loading a pbuffer into a texture,
* thus no danger of recursive calls. */
}
{
{
{
TRACE("Reloading surface because the d3d8/9 palette was changed.\n");
/* TODO: This is not necessarily needed with hw palettized texture support. */
/* Make sure the texture is reloaded because of the palette change, this kills performance though :( */
}
}
}
/* If the texture is marked dirty or the srgb sampler setting has changed
* since the last load then reload the surfaces. */
if (*dirty)
{
{
}
}
else
{
}
/* No longer dirty. */
}
{
unsigned int i;
{
{
/* Clean out the texture name we gave to the surface so that the
* surface doesn't try and release it */
}
}
}
{
unsigned int i;
/* TODO: It should only be possible to create textures for formats
* that are reported as supported. */
if (WINED3DFMT_UNKNOWN >= format)
{
return WINED3DERR_INVALIDCALL;
}
/* Non-power2 support. */
{
pow2_width = width;
}
else
{
/* Find the nearest pow2 match. */
{
if (levels > 1)
{
WARN("Attempted to create a mipmapped np2 texture without unconditional np2 support.\n");
return WINED3DERR_INVALIDCALL;
}
levels = 1;
}
}
/* Calculate levels for mip mapping. */
if (usage & WINED3DUSAGE_AUTOGENMIPMAP)
{
if (!GL_SUPPORT(SGIS_GENERATE_MIPMAP))
{
WARN("No mipmap generation support, returning WINED3DERR_INVALIDCALL.\n");
return WINED3DERR_INVALIDCALL;
}
if (levels > 1)
{
WARN("D3DUSAGE_AUTOGENMIPMAP is set, and level count > 1, returning WINED3DERR_INVALIDCALL.\n");
return WINED3DERR_INVALIDCALL;
}
levels = 1;
}
else if (!levels)
{
}
{
return hr;
}
/* Precalculated scaling for 'faked' non power of two texture coords.
* Second also don't use ARB_TEXTURE_RECTANGLE in case the surface format is P8 and EXT_PALETTED_TEXTURE
* is used in combination with texture uploads (RTL_READTEX/RTL_TEXTEX). The reason is that EXT_PALETTED_TEXTURE
* doesn't work in combination with ARB_TEXTURE_RECTANGLE. */
{
}
{
}
else
{
{
}
else
{
}
}
/* Generate all the surfaces. */
{
/* Use the callback to create the texture surface. */
hr = IWineD3DDeviceParent_CreateSurface(device->device_parent, parent, tmp_w, tmp_h, format_desc->format,
{
return hr;
}
/* Calculate the next mipmap level. */
}
return WINED3D_OK;
}
/* *******************************************
IWineD3DTexture IUnknown parts follow
******************************************* */
static HRESULT WINAPI IWineD3DTextureImpl_QueryInterface(IWineD3DTexture *iface, REFIID riid, LPVOID *ppobj)
{
return WINED3D_OK;
}
return E_NOINTERFACE;
}
}
if (ref == 0) {
}
return ref;
}
/* ****************************************************
IWineD3DTexture IWineD3DResource parts follow
**************************************************** */
static HRESULT WINAPI IWineD3DTextureImpl_GetDevice(IWineD3DTexture *iface, IWineD3DDevice** ppDevice) {
}
static HRESULT WINAPI IWineD3DTextureImpl_SetPrivateData(IWineD3DTexture *iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) {
}
static HRESULT WINAPI IWineD3DTextureImpl_GetPrivateData(IWineD3DTexture *iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) {
}
static HRESULT WINAPI IWineD3DTextureImpl_FreePrivateData(IWineD3DTexture *iface, REFGUID refguid) {
}
}
}
}
unsigned int i;
/* Unload all the surfaces and reset the texture name. If UnLoad was called on the
* surface before, this one will be a NOP and vice versa. Unloading an unloaded
* surface is fine
*/
}
}
}
}
/* ******************************************************
IWineD3DTexture IWineD3DBaseTexture parts follow
****************************************************** */
}
}
}
static HRESULT WINAPI IWineD3DTextureImpl_SetAutoGenFilterType(IWineD3DTexture *iface, WINED3DTEXTUREFILTERTYPE FilterType) {
}
static WINED3DTEXTUREFILTERTYPE WINAPI IWineD3DTextureImpl_GetAutoGenFilterType(IWineD3DTexture *iface) {
}
}
/* Internal function, No d3d mapping */
}
}
/* Context activation is done by the caller. */
UINT i;
} else {
}
}
/* Conditinal non power of two textures use a different clamping default. If we're using the GL_WINE_normalized_texrect
* partial driver emulation, we're dealing with a GL_TEXTURE_2D texture which has the address mode set to repeat - something
* that prevents us from hitting the accelerated codepath. Thus manually set the GL state. The same applies to filtering.
* Even if the texture has only one mip level, the default LINEAR_MIPMAP_LINEAR filter causes a SW fallback on macos.
*/
ENTER_GL();
checkGLcall("glTexParameteri(dimension, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE)");
checkGLcall("glTexParameteri(dimension, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE)");
checkGLcall("glTexParameteri(dimension, GL_TEXTURE_MIN_FILTER, GL_NEAREST)");
checkGLcall("glTexParameteri(dimension, GL_TEXTURE_MAG_FILTER, GL_NEAREST)");
LEAVE_GL();
}
}
return hr;
}
}
}
/* *******************************************
IWineD3DTexture IWineD3DTexture parts follow
******************************************* */
static void WINAPI IWineD3DTextureImpl_Destroy(IWineD3DTexture *iface, D3DCB_DESTROYSURFACEFN D3DCB_DestroySurface) {
/* free the object */
}
static HRESULT WINAPI IWineD3DTextureImpl_GetLevelDesc(IWineD3DTexture *iface, UINT Level, WINED3DSURFACE_DESC* pDesc) {
}
return WINED3DERR_INVALIDCALL;
}
static HRESULT WINAPI IWineD3DTextureImpl_GetSurfaceLevel(IWineD3DTexture *iface, UINT Level, IWineD3DSurface** ppSurfaceLevel) {
hr = WINED3D_OK;
}
if (WINED3D_OK != hr) {
}
return hr;
}
static HRESULT WINAPI IWineD3DTextureImpl_LockRect(IWineD3DTexture *iface, UINT Level, WINED3DLOCKED_RECT *pLockedRect,
}
if (WINED3D_OK == hr) {
} else {
}
return hr;
}
}
if ( WINED3D_OK == hr) {
} else {
}
return hr;
}
static HRESULT WINAPI IWineD3DTextureImpl_AddDirtyRect(IWineD3DTexture *iface, CONST RECT* pDirtyRect) {
return WINED3D_OK;
}
{
/* IUnknown */
/* IWineD3DResource */
/* IWineD3DBaseTexture */
/* IWineD3DTexture */
};