cubetexture.c revision ba6524ccac330688123403ddf0a83d702cd9e371
/*
* IWineD3DCubeTexture 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, j;
switch (srgb)
{
case SRGB_RGB:
break;
case SRGB_BOTH:
/* Fallthrough */
case SRGB_SRGB:
break;
default:
break;
}
/* We only have to activate a context for gl when we're not drawing.
* In most cases PreLoad will be called during draw and a context was
* activated at the beginning of drawPrimitive. */
{
/* No danger of recursive calls, context_acquire() sets isInDraw to true
* when loading offscreen render targets into their texture. */
}
{
{
for (j = WINED3DCUBEMAP_FACE_POSITIVE_X; j <= WINED3DCUBEMAP_FACE_NEGATIVE_Z; ++j)
{
{
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)
{
{
for (j = WINED3DCUBEMAP_FACE_POSITIVE_X; j <= WINED3DCUBEMAP_FACE_NEGATIVE_Z; ++j)
{
}
}
}
else
{
}
/* No longer dirty. */
}
{
unsigned int i, j;
{
for (j = 0; j < 6; ++j)
{
if (surface)
{
/* Clean out the texture name we gave to the surface so that the
* surface doesn't try and release it. */
}
}
}
}
/* *******************************************
IWineD3DCubeTexture IUnknown parts follow
******************************************* */
static HRESULT WINAPI IWineD3DCubeTextureImpl_QueryInterface(IWineD3DCubeTexture *iface, REFIID riid, LPVOID *ppobj)
{
return S_OK;
}
return E_NOINTERFACE;
}
}
if (!ref)
{
}
return ref;
}
/* ****************************************************
IWineD3DCubeTexture IWineD3DResource parts follow
**************************************************** */
static HRESULT WINAPI IWineD3DCubeTextureImpl_SetPrivateData(IWineD3DCubeTexture *iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) {
}
static HRESULT WINAPI IWineD3DCubeTextureImpl_GetPrivateData(IWineD3DCubeTexture *iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) {
}
static HRESULT WINAPI IWineD3DCubeTextureImpl_FreePrivateData(IWineD3DCubeTexture *iface, REFGUID refguid) {
}
static DWORD WINAPI IWineD3DCubeTextureImpl_SetPriority(IWineD3DCubeTexture *iface, DWORD PriorityNew) {
}
}
}
unsigned int i, j;
/* 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
*/
for (j = WINED3DCUBEMAP_FACE_POSITIVE_X; j <= WINED3DCUBEMAP_FACE_NEGATIVE_Z ; j++) {
}
}
}
}
static HRESULT WINAPI IWineD3DCubeTextureImpl_GetParent(IWineD3DCubeTexture *iface, IUnknown **pParent) {
}
/* ******************************************************
IWineD3DCubeTexture IWineD3DBaseTexture parts follow
****************************************************** */
}
}
}
static HRESULT WINAPI IWineD3DCubeTextureImpl_SetAutoGenFilterType(IWineD3DCubeTexture *iface, WINED3DTEXTUREFILTERTYPE FilterType) {
}
static WINED3DTEXTUREFILTERTYPE WINAPI IWineD3DCubeTextureImpl_GetAutoGenFilterType(IWineD3DCubeTexture *iface) {
}
}
/* Internal function, No d3d mapping */
}
/* Internal function, No d3d mapping */
}
/* Context activation is done by the caller. */
UINT i, j;
for (j = WINED3DCUBEMAP_FACE_POSITIVE_X; j <= WINED3DCUBEMAP_FACE_NEGATIVE_Z; ++j) {
} else {
}
}
}
}
return hr;
}
{
return GL_TEXTURE_CUBE_MAP_ARB;
}
{
return FALSE;
}
/* *******************************************
IWineD3DCubeTexture IWineD3DCubeTexture parts follow
******************************************* */
static HRESULT WINAPI IWineD3DCubeTextureImpl_GetLevelDesc(IWineD3DCubeTexture *iface, UINT Level, WINED3DSURFACE_DESC* pDesc) {
}
return WINED3DERR_INVALIDCALL;
}
static HRESULT WINAPI IWineD3DCubeTextureImpl_GetCubeMapSurface(IWineD3DCubeTexture *iface, WINED3DCUBEMAP_FACES FaceType, UINT Level, IWineD3DSurface** ppCubeMapSurface) {
hr = WINED3D_OK;
}
if (WINED3D_OK == hr) {
TRACE("(%p) -> faceType(%d) level(%d) returning surface@%p\n", This, FaceType, Level, This->surfaces[FaceType][Level]);
} else {
WARN("(%p) level(%d) overflow Levels(%d) Or FaceType(%d)\n", This, Level, This->baseTexture.levels, FaceType);
}
return hr;
}
static HRESULT WINAPI IWineD3DCubeTextureImpl_LockRect(IWineD3DCubeTexture *iface, WINED3DCUBEMAP_FACES FaceType, UINT Level, WINED3DLOCKED_RECT* pLockedRect, CONST RECT* pRect, DWORD Flags) {
}
if (WINED3D_OK == hr) {
TRACE("(%p) -> faceType(%d) level(%d) returning memory@%p success(%u)\n", This, FaceType, Level, pLockedRect->pBits, hr);
} else {
WARN("(%p) level(%d) overflow Levels(%d) Or FaceType(%d)\n", This, Level, This->baseTexture.levels, FaceType);
}
return hr;
}
static HRESULT WINAPI IWineD3DCubeTextureImpl_UnlockRect(IWineD3DCubeTexture *iface, WINED3DCUBEMAP_FACES FaceType, UINT Level) {
}
if (WINED3D_OK == hr) {
} else {
WARN("(%p) level(%d) overflow Levels(%d) Or FaceType(%d)\n", This, Level, This->baseTexture.levels, FaceType);
}
return hr;
}
static HRESULT WINAPI IWineD3DCubeTextureImpl_AddDirtyRect(IWineD3DCubeTexture *iface, WINED3DCUBEMAP_FACES FaceType, CONST RECT* pDirtyRect) {
if (FaceType <= WINED3DCUBEMAP_FACE_NEGATIVE_Z) {
hr = WINED3D_OK;
} else {
}
return hr;
}
static const IWineD3DCubeTextureVtbl IWineD3DCubeTexture_Vtbl =
{
/* IUnknown */
/* IWineD3DResource */
/* IWineD3DBaseTexture */
/* IWineD3DCubeTexture */
};
#ifdef VBOX_WITH_WDDM
, void **pavClientMem
#endif
)
{
unsigned int i, j;
/* TODO: It should only be possible to create textures for formats
* that are reported as supported. */
if (WINED3DFMT_UNKNOWN >= format)
{
return WINED3DERR_INVALIDCALL;
}
{
return WINED3DERR_INVALIDCALL;
}
/* Calculate levels for mip mapping */
if (usage & WINED3DUSAGE_AUTOGENMIPMAP)
{
{
WARN("No mipmap generation support, returning D3DERR_INVALIDCALL.\n");
return WINED3DERR_INVALIDCALL;
}
if (levels > 1)
{
WARN("D3DUSAGE_AUTOGENMIPMAP is set, and level count > 1, returning D3DERR_INVALIDCALL.\n");
return WINED3DERR_INVALIDCALL;
}
levels = 1;
}
else if (!levels)
{
}
#ifdef VBOX_WITH_WDDM
#endif
);
{
return hr;
}
/* Find the nearest pow2 match. */
pow2_edge_length = 1;
{
/* Precalculated scaling for 'faked' non power of two texture coords. */
}
else
{
/* Precalculated scaling for 'faked' non power of two texture coords. */
}
/* Generate all the surfaces. */
tmp_w = edge_length;
{
/* Create the 6 faces. */
for (j = 0; j < 6; ++j)
{
{
};
#ifdef VBOX_WITH_WDDM
);
#else
);
#endif
{
return hr;
}
}
}
#ifdef VBOX_WITH_WDDM
if (VBOXSHRC_IS_SHARED(texture))
{
{
for (j = 0; j < 6; ++j)
{
}
}
#ifdef DEBUG
{
for (j = 0; j < 6; ++j)
{
}
}
#endif
if (!VBOXSHRC_IS_SHARED_OPENED(texture))
{
Assert(!(*shared_handle));
}
else
{
}
#ifdef DEBUG
{
for (j = 0; j < 6; ++j)
{
}
}
#endif
}
else
{
}
#endif
return WINED3D_OK;
}