texture.c revision ba6524ccac330688123403ddf0a83d702cd9e371
/*
* IWineD3DTexture implementation
*
* Copyright 2002-2005 Jason Edmeades
* Copyright 2002-2005 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
*/
/*
* 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.
*/
#include "config.h"
#include "wined3d_private.h"
{
/* Override the IWineD3DResource PreLoad method. */
unsigned int i;
switch (srgb)
{
case SRGB_RGB:
break;
case SRGB_BOTH:
/* Fallthrough */
case SRGB_SRGB:
break;
default:
break;
}
{
/* context_acquire() 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 */
}
}
}
/* *******************************************
IWineD3DTexture IUnknown parts follow
******************************************* */
static HRESULT WINAPI IWineD3DTextureImpl_QueryInterface(IWineD3DTexture *iface, REFIID riid, LPVOID *ppobj)
{
return WINED3D_OK;
}
return E_NOINTERFACE;
}
}
if (!ref)
{
}
return ref;
}
/* ****************************************************
IWineD3DTexture IWineD3DResource parts follow
**************************************************** */
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;
struct gl_texture *gl_tex;
} 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 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;
}
static const IWineD3DTextureVtbl IWineD3DTexture_Vtbl =
{
/* IUnknown */
/* IWineD3DResource */
/* IWineD3DBaseTexture */
/* IWineD3DTexture */
};
#ifdef VBOX_WITH_WDDM
, void **pavClientMem
#endif
)
{
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)
{
{
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)
{
}
#ifdef VBOX_WITH_WDDM
#endif
);
{
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). The reason is that EXT_PALETTED_TEXTURE
* doesn't work in combination with ARB_TEXTURE_RECTANGLE. */
{
}
else if (gl_info->supported[ARB_TEXTURE_RECTANGLE] && (width != pow2_width || height != pow2_height)
{
{
}
else
{
}
}
else
{
{
}
else
{
}
}
/* Generate all the surfaces. */
{
#ifdef VBOX_WITH_WDDM
/* Use the callback to create the texture surface. */
hr = IWineD3DDeviceParent_CreateSurface(device->device_parent, parent, tmp_w, tmp_h, format_desc->format,
, NULL /* <- we first create a surface in an everage "non-shared" fashion and initialize its share properties later (see below)
* this is done this way because the surface does not have its parent (texture) setup properly
* thus we can not initialize texture at this stage */
#else
/* Use the callback to create the texture surface. */
hr = IWineD3DDeviceParent_CreateSurface(device->device_parent, parent, tmp_w, tmp_h, format_desc->format,
#endif
{
return hr;
}
/* Calculate the next mipmap level. */
}
#ifdef VBOX_WITH_WDDM
if (VBOXSHRC_IS_SHARED(texture))
{
{
}
#ifdef DEBUG
{
}
#endif
if (!VBOXSHRC_IS_SHARED_OPENED(texture))
{
Assert(!(*shared_handle));
}
else
{
}
#ifdef DEBUG
{
}
#endif
}
else
{
}
#endif
return WINED3D_OK;
}