volume.c revision 058c0c53c37f5cb271aeb3c385c10766f84f4aef
/*
* Copyright 2002-2005 Jason Edmeades
* Copyright 2002-2005 Raphael Junqueira
* Copyright 2005 Oliver Stieber
* Copyright 2009-2011 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
*/
#include "config.h"
#include "wined3d_private.h"
#ifdef VBOX_WITH_WDDM
# include "../../common/VBoxVideoTools.h"
#endif
/* Context activation is done by the caller. */
static void volume_bind_and_dirtify(const struct wined3d_volume *volume, struct wined3d_context *context)
{
/* 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. */
if (active_sampler != WINED3D_UNMAPPED_STAGE)
}
{
if (dirty_box)
{
}
else
{
}
}
{
}
/* Context activation is done by the caller. */
void volume_load(const struct wined3d_volume *volume, struct wined3d_context *context, UINT level, BOOL srgb_mode)
{
TRACE("volume %p, context %p, level %u, srgb %#x, format %s (%#x).\n",
checkGLcall("glTexImage3D");
/* When adding code releasing volume->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
* volume->resource.allocatedMemory if GL_APPLE_client_storage is
* supported. */
}
/* Do not call while under the GL lock. */
{
/* The whole content is shadowed on This->resource.allocatedMemory, and
* the texture name is managed by the VolumeTexture container. */
}
{
{
}
return refcount;
}
/* Do not call while under the GL lock. */
{
{
}
if (!refcount)
{
}
return refcount;
}
{
}
{
}
{
}
/* Do not call while under the GL lock. */
{
}
{
}
{
TRACE("volume %p, map_desc %p, box %p, flags %#x.\n",
volume->resource.allocatedMemory = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, volume->resource.size);
map_desc->row_pitch = volume->resource.format->byte_count * volume->resource.width; /* Bytes / row */
if (!box)
{
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 %u, t %u, r %u, b %u, fr %u, ba %u\n",
}
{
}
TRACE("Returning memory %p, row pitch %d, slice pitch %d.\n",
return WINED3D_OK;
}
{
return volume_from_resource(resource);
}
{
{
return WINED3DERR_INVALIDCALL;
}
return WINED3D_OK;
}
static const struct wined3d_resource_ops volume_resource_ops =
{
};
static HRESULT volume_init(struct wined3d_volume *volume, struct wined3d_device *device, UINT width,
#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;
}
#ifdef VBOX_WITH_WDDM
, void *pvClientMem
#endif
)
{
struct wined3d_volume *object;
TRACE("device %p, width %u, height %u, depth %u, usage %#x, format %s, pool %s\n",
if (!object)
{
return WINED3DERR_OUTOFVIDEOMEMORY;
}
#ifdef VBOX_WITH_WDDM
#endif
);
{
return hr;
}
return WINED3D_OK;
}
#ifdef VBOX_WITH_WDDM
HRESULT CDECL wined3d_device_blt_vol(struct wined3d_device *device, struct wined3d_volume *src, struct wined3d_volume *dst,
const struct wined3d_box *pSrcBoxArg,
const VBOXPOINT3D *pDstPoin3D)
{
const struct wined3d_box *pDstBox;
const struct wined3d_box *pSrcBox;
int j, k;
TRACE("device %p, src_volume %p, dst_volume %p.\n",
if (!pSrcBox)
{
}
if (!pDstPoin3D)
else
{
vboxWddmBoxTranslated((VBOXBOX3D*)&DstBox, (const VBOXBOX3D *)pSrcBox, pDstPoin3D->x, pDstPoin3D->y, pDstPoin3D->z);
}
{
ERR("dimensions do not match, stretching not supported for volumes!");
return WINED3DERR_INVALIDCALL;
}
/* TODO: Implement direct loading into the gl volume instead of using memcpy and
* dirtification to improve loading performance.
*/
{
ERR("wined3d_volume_map src failed");
return hr;
}
{
ERR("wined3d_volume_map dst failed");
return hr;
}
for (k = 0; k < srcD; ++k)
{
for (j = 0; j < srcH; ++j)
{
}
}
} else {
}
return hr;
}
#endif