/*
* IWineD3DVolume implementation
*
* Copyright 2002-2005 Jason Edmeades
* Copyright 2002-2005 Raphael Junqueira
* Copyright 2005 Oliver Stieber
* 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"
/* Context activation is done by the caller. */
/* 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
*/
{
ENTER_GL();
LEAVE_GL();
} else {
active_sampler = 0;
}
if (active_sampler != WINED3D_UNMAPPED_STAGE)
{
}
if (SUCCEEDED(IWineD3DSurface_GetContainer(iface, &IID_IWineD3DVolumeTexture, (void **)&texture))) {
} else {
ERR("Volume should be part of a volume texture\n");
}
}
{
if (dirty_box)
{
}
else
{
}
}
/* *******************************************
IWineD3DVolume IUnknown parts follow
******************************************* */
static HRESULT WINAPI IWineD3DVolumeImpl_QueryInterface(IWineD3DVolume *iface, REFIID riid, void **object)
{
{
return S_OK;
}
return E_NOINTERFACE;
}
}
if (ref == 0) {
}
return ref;
}
/* ****************************************************
IWineD3DVolume IWineD3DResource parts follow
**************************************************** */
}
static HRESULT WINAPI IWineD3DVolumeImpl_SetPrivateData(IWineD3DVolume *iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) {
}
static HRESULT WINAPI IWineD3DVolumeImpl_GetPrivateData(IWineD3DVolume *iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) {
}
}
}
}
}
/* The whole content is shadowed on This->resource.allocatedMemory, and the
* texture name is managed by the VolumeTexture container
*/
}
}
/* *******************************************
IWineD3DVolume parts follow
******************************************* */
static HRESULT WINAPI IWineD3DVolumeImpl_GetContainer(IWineD3DVolume *iface, REFIID riid, void** ppContainer) {
if (!ppContainer) {
ERR("Called without a valid ppContainer.\n");
return E_FAIL;
}
/* Although surfaces can be standalone, volumes can't */
ERR("Volume without an container. Should not happen.\n");
return E_FAIL;
}
TRACE("Relaying to QueryInterface\n");
}
static HRESULT WINAPI IWineD3DVolumeImpl_GetDesc(IWineD3DVolume *iface, WINED3DVOLUME_DESC* pDesc) {
return WINED3D_OK;
}
static HRESULT WINAPI IWineD3DVolumeImpl_LockBox(IWineD3DVolume *iface, WINED3DLOCKED_BOX* pLockedVolume, CONST WINED3DBOX* pBox, DWORD Flags) {
This->resource.allocatedMemory = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, This->resource.size);
}
/* fixme: should we really lock as such? */
TRACE("(%p) : box=%p, output pbox=%p, allMem=%p\n", This, pBox, pLockedVolume, This->resource.allocatedMemory);
pLockedVolume->RowPitch = This->resource.format_desc->byte_count * This->currentDesc.Width; /* Bytes / row */
if (!pBox) {
TRACE("No box supplied - all is ok\n");
} else {
#ifdef VBOX_WITH_WDDM
)
{
ERR("invalid dimensions!");
return WINED3DERR_INVALIDCALL;
}
#endif
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);
}
/* Don't dirtify */
} else {
/**
* Dirtify on lock
* as seen in msdn docs
*/
/** Dirtify Container if needed */
if (containerType == WINED3DRTYPE_VOLUMETEXTURE) {
} else {
}
}
}
TRACE("returning memory@%p rpitch(%d) spitch(%d)\n", pLockedVolume->pBits, pLockedVolume->RowPitch, pLockedVolume->SlicePitch);
return WINED3D_OK;
}
{
return WINED3DERR_INVALIDCALL;
}
return WINED3D_OK;
}
/* Internal use functions follow : */
static HRESULT WINAPI IWineD3DVolumeImpl_SetContainer(IWineD3DVolume *iface, IWineD3DBase* container) {
/* We can't keep a reference to the container, since the container already keeps a reference to us. */
return WINED3D_OK;
}
/* Context activation is done by the caller. */
static HRESULT WINAPI IWineD3DVolumeImpl_LoadTexture(IWineD3DVolume *iface, int gl_level, BOOL srgb_mode) {
TRACE("(%p) : level %u, format %s (0x%08x)\n", This, gl_level, debug_d3dformat(glDesc->format), glDesc->format);
TRACE("Calling glTexImage3D %x level=%d, intfmt=%x, w=%d, h=%d,d=%d, 0=%d, glFmt=%x, glType=%x, Mem=%p\n",
0,
ENTER_GL();
0,
checkGLcall("glTexImage3D");
LEAVE_GL();
/* 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.
*/
return WINED3D_OK;
}
{
/* IUnknown */
/* IWineD3DResource */
#ifdef VBOX_WITH_WDDM
#endif
/* IWineD3DVolume */
/* Internal interface */
};
#ifdef VBOX_WITH_WDDM
, void *pvClientMem
#endif
)
{
{
WARN("Volume cannot be created - no volume texture support.\n");
return WINED3DERR_INVALIDCALL;
}
#ifdef VBOX_WITH_WDDM
#endif
);
{
return hr;
}
return WINED3D_OK;
}