2005-01-17 14:44:57 +01:00
|
|
|
/*
|
|
|
|
* IWineD3DVolume implementation
|
|
|
|
*
|
|
|
|
* Copyright 2002-2005 Jason Edmeades
|
2005-03-29 21:01:00 +02:00
|
|
|
* Copyright 2002-2005 Raphael Junqueira
|
2005-07-13 16:15:54 +02:00
|
|
|
* Copyright 2005 Oliver Stieber
|
2005-01-17 14:44:57 +01:00
|
|
|
*
|
|
|
|
* 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
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2005-01-17 14:44:57 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
#include "wined3d_private.h"
|
|
|
|
|
2008-09-17 17:51:44 +02:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(d3d_surface);
|
2007-06-09 14:27:41 +02:00
|
|
|
#define GLINFO_LOCATION This->resource.wineD3DDevice->adapter->gl_info
|
2005-01-17 14:44:57 +01:00
|
|
|
|
2008-09-17 17:50:40 +02:00
|
|
|
static void volume_bind_and_dirtify(IWineD3DVolume *iface) {
|
|
|
|
IWineD3DVolumeImpl *This = (IWineD3DVolumeImpl *)iface;
|
|
|
|
IWineD3DVolumeTexture *texture;
|
|
|
|
int active_sampler;
|
|
|
|
|
|
|
|
/* We don't need a specific texture unit, but after binding the texture the current unit is dirty.
|
|
|
|
* Read the unit back instead of switching to 0, this avoids messing around with the state manager's
|
|
|
|
* gl states. The current texture unit should always be a valid one.
|
|
|
|
*
|
|
|
|
* To be more specific, this is tricky because we can implicitly be called
|
|
|
|
* from sampler() in state.c. This means we can't touch anything other than
|
|
|
|
* whatever happens to be the currently active texture, or we would risk
|
|
|
|
* marking already applied sampler states dirty again.
|
|
|
|
*
|
|
|
|
* TODO: Track the current active texture per GL context instead of using glGet
|
|
|
|
*/
|
|
|
|
if (GL_SUPPORT(ARB_MULTITEXTURE)) {
|
|
|
|
GLint active_texture;
|
|
|
|
ENTER_GL();
|
|
|
|
glGetIntegerv(GL_ACTIVE_TEXTURE, &active_texture);
|
|
|
|
LEAVE_GL();
|
|
|
|
active_sampler = This->resource.wineD3DDevice->rev_tex_unit_map[active_texture - GL_TEXTURE0_ARB];
|
|
|
|
} else {
|
|
|
|
active_sampler = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (active_sampler != -1) {
|
|
|
|
IWineD3DDeviceImpl_MarkStateDirty(This->resource.wineD3DDevice, STATE_SAMPLER(active_sampler));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (SUCCEEDED(IWineD3DSurface_GetContainer(iface, &IID_IWineD3DVolumeTexture, (void **)&texture))) {
|
|
|
|
IWineD3DVolumeTexture_BindTexture(texture);
|
|
|
|
IWineD3DVolumeTexture_Release(texture);
|
|
|
|
} else {
|
|
|
|
ERR("Volume should be part of a volume texture\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-01-17 14:44:57 +01:00
|
|
|
/* *******************************************
|
|
|
|
IWineD3DVolume IUnknown parts follow
|
|
|
|
******************************************* */
|
2006-06-10 13:15:32 +02:00
|
|
|
static HRESULT WINAPI IWineD3DVolumeImpl_QueryInterface(IWineD3DVolume *iface, REFIID riid, LPVOID *ppobj)
|
2005-01-17 14:44:57 +01:00
|
|
|
{
|
|
|
|
IWineD3DVolumeImpl *This = (IWineD3DVolumeImpl *)iface;
|
2005-03-02 14:44:58 +01:00
|
|
|
TRACE("(%p)->(%s,%p)\n",This,debugstr_guid(riid),ppobj);
|
|
|
|
if (IsEqualGUID(riid, &IID_IUnknown)
|
2006-02-06 11:32:41 +01:00
|
|
|
|| IsEqualGUID(riid, &IID_IWineD3DBase)
|
2005-03-02 14:44:58 +01:00
|
|
|
|| IsEqualGUID(riid, &IID_IWineD3DVolume)){
|
|
|
|
IUnknown_AddRef(iface);
|
|
|
|
*ppobj = This;
|
2006-04-25 23:59:12 +02:00
|
|
|
return S_OK;
|
2005-03-02 14:44:58 +01:00
|
|
|
}
|
2006-04-25 23:59:12 +02:00
|
|
|
*ppobj = NULL;
|
2005-01-17 14:44:57 +01:00
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
2006-06-10 13:15:32 +02:00
|
|
|
static ULONG WINAPI IWineD3DVolumeImpl_AddRef(IWineD3DVolume *iface) {
|
2005-01-17 14:44:57 +01:00
|
|
|
IWineD3DVolumeImpl *This = (IWineD3DVolumeImpl *)iface;
|
2006-10-01 05:20:10 +02:00
|
|
|
TRACE("(%p) : AddRef increasing from %d\n", This, This->resource.ref);
|
2005-03-29 21:01:00 +02:00
|
|
|
return InterlockedIncrement(&This->resource.ref);
|
2005-01-17 14:44:57 +01:00
|
|
|
}
|
|
|
|
|
2006-06-10 13:15:32 +02:00
|
|
|
static ULONG WINAPI IWineD3DVolumeImpl_Release(IWineD3DVolume *iface) {
|
2005-01-17 14:44:57 +01:00
|
|
|
IWineD3DVolumeImpl *This = (IWineD3DVolumeImpl *)iface;
|
|
|
|
ULONG ref;
|
2006-10-01 05:20:10 +02:00
|
|
|
TRACE("(%p) : Releasing from %d\n", This, This->resource.ref);
|
2005-03-29 21:01:00 +02:00
|
|
|
ref = InterlockedDecrement(&This->resource.ref);
|
2005-01-17 14:44:57 +01:00
|
|
|
if (ref == 0) {
|
2008-12-02 18:41:33 +01:00
|
|
|
resource_cleanup((IWineD3DResource *)iface);
|
2005-01-17 14:44:57 +01:00
|
|
|
HeapFree(GetProcessHeap(), 0, This);
|
|
|
|
}
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
2005-03-29 21:01:00 +02:00
|
|
|
/* ****************************************************
|
2005-07-13 16:15:54 +02:00
|
|
|
IWineD3DVolume IWineD3DResource parts follow
|
2005-03-29 21:01:00 +02:00
|
|
|
**************************************************** */
|
2006-06-10 13:15:32 +02:00
|
|
|
static HRESULT WINAPI IWineD3DVolumeImpl_GetParent(IWineD3DVolume *iface, IUnknown **pParent) {
|
2008-12-02 18:41:33 +01:00
|
|
|
return resource_get_parent((IWineD3DResource *)iface, pParent);
|
2005-01-17 14:44:57 +01:00
|
|
|
}
|
|
|
|
|
2006-06-10 13:15:32 +02:00
|
|
|
static HRESULT WINAPI IWineD3DVolumeImpl_GetDevice(IWineD3DVolume *iface, IWineD3DDevice** ppDevice) {
|
2008-12-02 18:41:33 +01:00
|
|
|
return resource_get_device((IWineD3DResource *)iface, ppDevice);
|
2005-01-17 14:44:57 +01:00
|
|
|
}
|
|
|
|
|
2006-06-10 13:15:32 +02:00
|
|
|
static HRESULT WINAPI IWineD3DVolumeImpl_SetPrivateData(IWineD3DVolume *iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) {
|
2008-12-02 18:41:33 +01:00
|
|
|
return resource_set_private_data((IWineD3DResource *)iface, refguid, pData, SizeOfData, Flags);
|
2005-01-17 14:44:57 +01:00
|
|
|
}
|
|
|
|
|
2006-06-10 13:15:32 +02:00
|
|
|
static HRESULT WINAPI IWineD3DVolumeImpl_GetPrivateData(IWineD3DVolume *iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) {
|
2008-12-02 18:41:33 +01:00
|
|
|
return resource_get_private_data((IWineD3DResource *)iface, refguid, pData, pSizeOfData);
|
2005-01-17 14:44:57 +01:00
|
|
|
}
|
|
|
|
|
2006-06-10 13:15:32 +02:00
|
|
|
static HRESULT WINAPI IWineD3DVolumeImpl_FreePrivateData(IWineD3DVolume *iface, REFGUID refguid) {
|
2008-12-02 18:41:33 +01:00
|
|
|
return resource_free_private_data((IWineD3DResource *)iface, refguid);
|
2005-03-29 21:01:00 +02:00
|
|
|
}
|
|
|
|
|
2006-06-10 13:15:32 +02:00
|
|
|
static DWORD WINAPI IWineD3DVolumeImpl_SetPriority(IWineD3DVolume *iface, DWORD PriorityNew) {
|
2008-12-02 18:41:33 +01:00
|
|
|
return resource_set_priority((IWineD3DResource *)iface, PriorityNew);
|
2005-03-29 21:01:00 +02:00
|
|
|
}
|
|
|
|
|
2006-06-10 13:15:32 +02:00
|
|
|
static DWORD WINAPI IWineD3DVolumeImpl_GetPriority(IWineD3DVolume *iface) {
|
2008-12-02 18:41:33 +01:00
|
|
|
return resource_get_priority((IWineD3DResource *)iface);
|
2005-03-29 21:01:00 +02:00
|
|
|
}
|
|
|
|
|
2006-06-10 13:15:32 +02:00
|
|
|
static void WINAPI IWineD3DVolumeImpl_PreLoad(IWineD3DVolume *iface) {
|
2008-12-01 15:32:15 +01:00
|
|
|
FIXME("iface %p stub!\n", iface);
|
2005-01-17 14:44:57 +01:00
|
|
|
}
|
|
|
|
|
2008-01-12 22:56:30 +01:00
|
|
|
static void WINAPI IWineD3DVolumeImpl_UnLoad(IWineD3DVolume *iface) {
|
2008-01-08 15:28:57 +01:00
|
|
|
/* The whole content is shadowed on This->resource.allocatedMemory, and the
|
|
|
|
* texture name is managed by the VolumeTexture container
|
|
|
|
*/
|
|
|
|
TRACE("(%p): Nothing to do\n", iface);
|
2008-01-12 22:56:30 +01:00
|
|
|
}
|
|
|
|
|
2006-06-10 13:15:32 +02:00
|
|
|
static WINED3DRESOURCETYPE WINAPI IWineD3DVolumeImpl_GetType(IWineD3DVolume *iface) {
|
2008-12-02 18:41:33 +01:00
|
|
|
return resource_get_type((IWineD3DResource *)iface);
|
2005-03-29 21:01:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* *******************************************
|
|
|
|
IWineD3DVolume parts follow
|
|
|
|
******************************************* */
|
2006-06-10 13:15:32 +02:00
|
|
|
static HRESULT WINAPI IWineD3DVolumeImpl_GetContainer(IWineD3DVolume *iface, REFIID riid, void** ppContainer) {
|
2005-01-17 14:44:57 +01:00
|
|
|
IWineD3DVolumeImpl *This = (IWineD3DVolumeImpl *)iface;
|
2006-02-07 12:26:10 +01:00
|
|
|
|
|
|
|
TRACE("(This %p, riid %s, ppContainer %p)\n", This, debugstr_guid(riid), ppContainer);
|
|
|
|
|
|
|
|
if (!ppContainer) {
|
|
|
|
ERR("Called without a valid ppContainer.\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Although surfaces can be standalone, volumes can't */
|
|
|
|
if (!This->container) {
|
|
|
|
ERR("Volume without an container. Should not happen.\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
TRACE("Relaying to QueryInterface\n");
|
2006-06-06 23:42:33 +02:00
|
|
|
return IUnknown_QueryInterface(This->container, riid, ppContainer);
|
2005-01-17 14:44:57 +01:00
|
|
|
}
|
|
|
|
|
2006-06-10 13:15:32 +02:00
|
|
|
static HRESULT WINAPI IWineD3DVolumeImpl_GetDesc(IWineD3DVolume *iface, WINED3DVOLUME_DESC* pDesc) {
|
2005-01-17 14:44:57 +01:00
|
|
|
IWineD3DVolumeImpl *This = (IWineD3DVolumeImpl *)iface;
|
|
|
|
TRACE("(%p) : copying into %p\n", This, pDesc);
|
2005-07-13 16:15:54 +02:00
|
|
|
|
2005-03-29 21:01:00 +02:00
|
|
|
*(pDesc->Format) = This->resource.format;
|
|
|
|
*(pDesc->Type) = This->resource.resourceType;
|
|
|
|
*(pDesc->Usage) = This->resource.usage;
|
|
|
|
*(pDesc->Pool) = This->resource.pool;
|
|
|
|
*(pDesc->Size) = This->resource.size; /* dx8 only */
|
|
|
|
*(pDesc->Width) = This->currentDesc.Width;
|
|
|
|
*(pDesc->Height) = This->currentDesc.Height;
|
|
|
|
*(pDesc->Depth) = This->currentDesc.Depth;
|
2006-04-07 12:51:12 +02:00
|
|
|
return WINED3D_OK;
|
2005-01-17 14:44:57 +01:00
|
|
|
}
|
|
|
|
|
2006-06-10 13:15:32 +02:00
|
|
|
static HRESULT WINAPI IWineD3DVolumeImpl_LockBox(IWineD3DVolume *iface, WINED3DLOCKED_BOX* pLockedVolume, CONST WINED3DBOX* pBox, DWORD Flags) {
|
2005-01-17 14:44:57 +01:00
|
|
|
IWineD3DVolumeImpl *This = (IWineD3DVolumeImpl *)iface;
|
2005-07-13 16:15:54 +02:00
|
|
|
FIXME("(%p) : pBox=%p stub\n", This, pBox);
|
2005-01-17 14:44:57 +01:00
|
|
|
|
2007-02-20 23:02:30 +01:00
|
|
|
if(!This->resource.allocatedMemory) {
|
|
|
|
This->resource.allocatedMemory = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, This->resource.size);
|
|
|
|
}
|
|
|
|
|
2005-01-17 14:44:57 +01:00
|
|
|
/* fixme: should we really lock as such? */
|
2005-03-29 21:01:00 +02:00
|
|
|
TRACE("(%p) : box=%p, output pbox=%p, allMem=%p\n", This, pBox, pLockedVolume, This->resource.allocatedMemory);
|
2005-01-17 14:44:57 +01:00
|
|
|
|
|
|
|
pLockedVolume->RowPitch = This->bytesPerPixel * This->currentDesc.Width; /* Bytes / row */
|
|
|
|
pLockedVolume->SlicePitch = This->bytesPerPixel * This->currentDesc.Width * This->currentDesc.Height; /* Bytes / slice */
|
|
|
|
if (!pBox) {
|
|
|
|
TRACE("No box supplied - all is ok\n");
|
2005-03-29 21:01:00 +02:00
|
|
|
pLockedVolume->pBits = This->resource.allocatedMemory;
|
2005-01-17 14:44:57 +01:00
|
|
|
This->lockedBox.Left = 0;
|
|
|
|
This->lockedBox.Top = 0;
|
|
|
|
This->lockedBox.Front = 0;
|
|
|
|
This->lockedBox.Right = This->currentDesc.Width;
|
|
|
|
This->lockedBox.Bottom = This->currentDesc.Height;
|
|
|
|
This->lockedBox.Back = This->currentDesc.Depth;
|
|
|
|
} else {
|
|
|
|
TRACE("Lock Box (%p) = l %d, t %d, r %d, b %d, fr %d, ba %d\n", pBox, pBox->Left, pBox->Top, pBox->Right, pBox->Bottom, pBox->Front, pBox->Back);
|
2005-07-13 16:15:54 +02:00
|
|
|
pLockedVolume->pBits = This->resource.allocatedMemory +
|
2005-01-17 14:44:57 +01:00
|
|
|
(pLockedVolume->SlicePitch * pBox->Front) + /* FIXME: is front < back or vica versa? */
|
2005-07-13 16:15:54 +02:00
|
|
|
(pLockedVolume->RowPitch * pBox->Top) +
|
2005-01-17 14:44:57 +01:00
|
|
|
(pBox->Left * This->bytesPerPixel);
|
|
|
|
This->lockedBox.Left = pBox->Left;
|
|
|
|
This->lockedBox.Top = pBox->Top;
|
|
|
|
This->lockedBox.Front = pBox->Front;
|
|
|
|
This->lockedBox.Right = pBox->Right;
|
|
|
|
This->lockedBox.Bottom = pBox->Bottom;
|
|
|
|
This->lockedBox.Back = pBox->Back;
|
|
|
|
}
|
2005-07-13 16:15:54 +02:00
|
|
|
|
2006-03-08 00:11:28 +01:00
|
|
|
if (Flags & (WINED3DLOCK_NO_DIRTY_UPDATE | WINED3DLOCK_READONLY)) {
|
2005-01-17 14:44:57 +01:00
|
|
|
/* Don't dirtify */
|
|
|
|
} else {
|
|
|
|
/**
|
|
|
|
* Dirtify on lock
|
|
|
|
* as seen in msdn docs
|
|
|
|
*/
|
|
|
|
IWineD3DVolume_AddDirtyBox(iface, &This->lockedBox);
|
|
|
|
|
|
|
|
/** Dirtify Container if needed */
|
|
|
|
if (NULL != This->container) {
|
|
|
|
|
2005-07-13 16:15:54 +02:00
|
|
|
IWineD3DVolumeTexture *cont = (IWineD3DVolumeTexture*) This->container;
|
2006-03-09 23:21:16 +01:00
|
|
|
WINED3DRESOURCETYPE containerType = IWineD3DBaseTexture_GetType((IWineD3DBaseTexture *) cont);
|
2005-01-17 14:44:57 +01:00
|
|
|
|
2006-03-09 23:21:16 +01:00
|
|
|
if (containerType == WINED3DRTYPE_VOLUMETEXTURE) {
|
2005-01-17 14:44:57 +01:00
|
|
|
IWineD3DBaseTextureImpl* pTexture = (IWineD3DBaseTextureImpl*) cont;
|
|
|
|
pTexture->baseTexture.dirty = TRUE;
|
|
|
|
} else {
|
|
|
|
FIXME("Set dirty on container type %d\n", containerType);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
This->locked = TRUE;
|
|
|
|
TRACE("returning memory@%p rpitch(%d) spitch(%d)\n", pLockedVolume->pBits, pLockedVolume->RowPitch, pLockedVolume->SlicePitch);
|
2006-04-07 12:51:12 +02:00
|
|
|
return WINED3D_OK;
|
2005-01-17 14:44:57 +01:00
|
|
|
}
|
|
|
|
|
2006-06-10 13:15:32 +02:00
|
|
|
static HRESULT WINAPI IWineD3DVolumeImpl_UnlockBox(IWineD3DVolume *iface) {
|
2005-01-17 14:44:57 +01:00
|
|
|
IWineD3DVolumeImpl *This = (IWineD3DVolumeImpl *)iface;
|
2006-09-26 20:31:58 +02:00
|
|
|
if (!This->locked) {
|
2005-07-13 16:15:54 +02:00
|
|
|
ERR("trying to lock unlocked volume@%p\n", This);
|
2006-04-07 12:51:12 +02:00
|
|
|
return WINED3DERR_INVALIDCALL;
|
2005-01-17 14:44:57 +01:00
|
|
|
}
|
|
|
|
TRACE("(%p) : unlocking volume\n", This);
|
|
|
|
This->locked = FALSE;
|
|
|
|
memset(&This->lockedBox, 0, sizeof(RECT));
|
2006-04-07 12:51:12 +02:00
|
|
|
return WINED3D_OK;
|
2005-01-17 14:44:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Internal use functions follow : */
|
|
|
|
|
2006-06-10 13:15:32 +02:00
|
|
|
static HRESULT WINAPI IWineD3DVolumeImpl_CleanDirtyBox(IWineD3DVolume *iface) {
|
2005-01-17 14:44:57 +01:00
|
|
|
IWineD3DVolumeImpl *This = (IWineD3DVolumeImpl *)iface;
|
|
|
|
This->dirty = FALSE;
|
|
|
|
This->lockedBox.Left = This->currentDesc.Width;
|
|
|
|
This->lockedBox.Top = This->currentDesc.Height;
|
2005-07-13 16:15:54 +02:00
|
|
|
This->lockedBox.Front = This->currentDesc.Depth;
|
2005-01-17 14:44:57 +01:00
|
|
|
This->lockedBox.Right = 0;
|
|
|
|
This->lockedBox.Bottom = 0;
|
|
|
|
This->lockedBox.Back = 0;
|
2006-04-07 12:51:12 +02:00
|
|
|
return WINED3D_OK;
|
2005-01-17 14:44:57 +01:00
|
|
|
}
|
|
|
|
|
2006-06-10 13:15:32 +02:00
|
|
|
static HRESULT WINAPI IWineD3DVolumeImpl_AddDirtyBox(IWineD3DVolume *iface, CONST WINED3DBOX* pDirtyBox) {
|
2005-01-17 14:44:57 +01:00
|
|
|
IWineD3DVolumeImpl *This = (IWineD3DVolumeImpl *)iface;
|
|
|
|
This->dirty = TRUE;
|
|
|
|
if (NULL != pDirtyBox) {
|
|
|
|
This->lockedBox.Left = min(This->lockedBox.Left, pDirtyBox->Left);
|
|
|
|
This->lockedBox.Top = min(This->lockedBox.Top, pDirtyBox->Top);
|
|
|
|
This->lockedBox.Front = min(This->lockedBox.Front, pDirtyBox->Front);
|
|
|
|
This->lockedBox.Right = max(This->lockedBox.Right, pDirtyBox->Right);
|
|
|
|
This->lockedBox.Bottom = max(This->lockedBox.Bottom, pDirtyBox->Bottom);
|
|
|
|
This->lockedBox.Back = max(This->lockedBox.Back, pDirtyBox->Back);
|
|
|
|
} else {
|
|
|
|
This->lockedBox.Left = 0;
|
|
|
|
This->lockedBox.Top = 0;
|
|
|
|
This->lockedBox.Front = 0;
|
|
|
|
This->lockedBox.Right = This->currentDesc.Width;
|
|
|
|
This->lockedBox.Bottom = This->currentDesc.Height;
|
|
|
|
This->lockedBox.Back = This->currentDesc.Depth;
|
|
|
|
}
|
2006-04-07 12:51:12 +02:00
|
|
|
return WINED3D_OK;
|
2005-01-17 14:44:57 +01:00
|
|
|
}
|
|
|
|
|
2006-06-10 13:15:32 +02:00
|
|
|
static HRESULT WINAPI IWineD3DVolumeImpl_SetContainer(IWineD3DVolume *iface, IWineD3DBase* container) {
|
2006-02-06 11:30:48 +01:00
|
|
|
IWineD3DVolumeImpl *This = (IWineD3DVolumeImpl *)iface;
|
2005-07-13 16:15:54 +02:00
|
|
|
|
2006-02-06 11:30:48 +01:00
|
|
|
TRACE("This %p, container %p\n", This, container);
|
|
|
|
|
2006-02-13 13:23:58 +01:00
|
|
|
/* We can't keep a reference to the container, since the container already keeps a reference to us. */
|
2006-02-06 11:30:48 +01:00
|
|
|
|
|
|
|
TRACE("Setting container to %p from %p\n", container, This->container);
|
|
|
|
This->container = container;
|
|
|
|
|
2006-04-07 12:51:12 +02:00
|
|
|
return WINED3D_OK;
|
2005-03-14 11:12:52 +01:00
|
|
|
}
|
|
|
|
|
2007-06-07 01:08:26 +02:00
|
|
|
static HRESULT WINAPI IWineD3DVolumeImpl_LoadTexture(IWineD3DVolume *iface, int gl_level, BOOL srgb_mode) {
|
2005-03-14 11:12:52 +01:00
|
|
|
IWineD3DVolumeImpl *This = (IWineD3DVolumeImpl *)iface;
|
2007-04-23 22:03:00 +02:00
|
|
|
WINED3DFORMAT format = This->resource.format;
|
2008-12-03 14:53:42 +01:00
|
|
|
const struct GlPixelFormatDesc *glDesc;
|
2007-07-27 13:22:54 +02:00
|
|
|
getFormatDescEntry(format, &GLINFO_LOCATION, &glDesc);
|
2007-04-23 22:03:00 +02:00
|
|
|
|
|
|
|
TRACE("(%p) : level %u, format %s (0x%08x)\n", This, gl_level, debug_d3dformat(format), format);
|
2005-03-14 11:12:52 +01:00
|
|
|
|
2008-09-17 17:50:40 +02:00
|
|
|
volume_bind_and_dirtify(iface);
|
|
|
|
|
2007-10-26 13:44:16 +02:00
|
|
|
TRACE("Calling glTexImage3D %x level=%d, intfmt=%x, w=%d, h=%d,d=%d, 0=%d, glFmt=%x, glType=%x, Mem=%p\n",
|
|
|
|
GL_TEXTURE_3D,
|
|
|
|
gl_level,
|
|
|
|
glDesc->glInternal,
|
|
|
|
This->currentDesc.Width,
|
|
|
|
This->currentDesc.Height,
|
|
|
|
This->currentDesc.Depth,
|
|
|
|
0,
|
|
|
|
glDesc->glFormat,
|
|
|
|
glDesc->glType,
|
|
|
|
This->resource.allocatedMemory);
|
2008-10-19 02:07:49 +02:00
|
|
|
|
|
|
|
ENTER_GL();
|
2007-10-26 13:44:16 +02:00
|
|
|
GL_EXTCALL(glTexImage3DEXT(GL_TEXTURE_3D,
|
2006-08-05 00:11:17 +02:00
|
|
|
gl_level,
|
2007-07-23 11:13:37 +02:00
|
|
|
glDesc->glInternal,
|
2006-08-05 00:11:17 +02:00
|
|
|
This->currentDesc.Width,
|
|
|
|
This->currentDesc.Height,
|
|
|
|
This->currentDesc.Depth,
|
|
|
|
0,
|
2007-07-23 11:13:37 +02:00
|
|
|
glDesc->glFormat,
|
|
|
|
glDesc->glType,
|
2007-10-26 13:44:16 +02:00
|
|
|
This->resource.allocatedMemory));
|
|
|
|
checkGLcall("glTexImage3D");
|
2008-10-19 02:07:49 +02:00
|
|
|
LEAVE_GL();
|
2007-03-31 23:02:37 +02:00
|
|
|
|
|
|
|
/* When adding code releasing This->resource.allocatedMemory to save data keep in mind that
|
|
|
|
* GL_UNPACK_CLIENT_STORAGE_APPLE is enabled by default if supported(GL_APPLE_client_storage).
|
|
|
|
* Thus do not release This->resource.allocatedMemory if GL_APPLE_client_storage is supported.
|
|
|
|
*/
|
2006-04-07 12:51:12 +02:00
|
|
|
return WINED3D_OK;
|
2005-07-13 16:15:54 +02:00
|
|
|
|
2005-03-14 11:12:52 +01:00
|
|
|
}
|
|
|
|
|
2005-06-06 21:50:35 +02:00
|
|
|
const IWineD3DVolumeVtbl IWineD3DVolume_Vtbl =
|
2005-01-17 14:44:57 +01:00
|
|
|
{
|
2005-03-14 11:12:52 +01:00
|
|
|
/* IUnknown */
|
2005-01-17 14:44:57 +01:00
|
|
|
IWineD3DVolumeImpl_QueryInterface,
|
|
|
|
IWineD3DVolumeImpl_AddRef,
|
|
|
|
IWineD3DVolumeImpl_Release,
|
2005-03-29 21:01:00 +02:00
|
|
|
/* IWineD3DResource */
|
2005-01-17 14:44:57 +01:00
|
|
|
IWineD3DVolumeImpl_GetParent,
|
|
|
|
IWineD3DVolumeImpl_GetDevice,
|
|
|
|
IWineD3DVolumeImpl_SetPrivateData,
|
|
|
|
IWineD3DVolumeImpl_GetPrivateData,
|
|
|
|
IWineD3DVolumeImpl_FreePrivateData,
|
2005-03-29 21:01:00 +02:00
|
|
|
IWineD3DVolumeImpl_SetPriority,
|
|
|
|
IWineD3DVolumeImpl_GetPriority,
|
|
|
|
IWineD3DVolumeImpl_PreLoad,
|
2008-01-12 22:56:30 +01:00
|
|
|
IWineD3DVolumeImpl_UnLoad,
|
2005-03-29 21:01:00 +02:00
|
|
|
IWineD3DVolumeImpl_GetType,
|
|
|
|
/* IWineD3DVolume */
|
2005-01-17 14:44:57 +01:00
|
|
|
IWineD3DVolumeImpl_GetContainer,
|
|
|
|
IWineD3DVolumeImpl_GetDesc,
|
|
|
|
IWineD3DVolumeImpl_LockBox,
|
|
|
|
IWineD3DVolumeImpl_UnlockBox,
|
2005-07-13 16:15:54 +02:00
|
|
|
/* Internal interface */
|
2005-01-17 14:44:57 +01:00
|
|
|
IWineD3DVolumeImpl_AddDirtyBox,
|
2005-03-14 11:12:52 +01:00
|
|
|
IWineD3DVolumeImpl_CleanDirtyBox,
|
|
|
|
IWineD3DVolumeImpl_LoadTexture,
|
|
|
|
IWineD3DVolumeImpl_SetContainer
|
2005-01-17 14:44:57 +01:00
|
|
|
};
|