058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync/*
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync * Copyright 2005 Oliver Stieber
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync *
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync * This library is free software; you can redistribute it and/or
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync * modify it under the terms of the GNU Lesser General Public
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync * License as published by the Free Software Foundation; either
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync * version 2.1 of the License, or (at your option) any later version.
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync *
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync * This library is distributed in the hope that it will be useful,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync * but WITHOUT ANY WARRANTY; without even the implied warranty of
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync * Lesser General Public License for more details.
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync *
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync * You should have received a copy of the GNU Lesser General Public
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync * License along with this library; if not, write to the Free Software
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync */
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
4237d5a79f48789aacc67dc43378d2d7813a39f4vboxsync/*
4237d5a79f48789aacc67dc43378d2d7813a39f4vboxsync * Oracle LGPL Disclaimer: For the avoidance of doubt, except that if any license choice
4237d5a79f48789aacc67dc43378d2d7813a39f4vboxsync * other than GPL or LGPL is available it will apply instead, Oracle elects to use only
4237d5a79f48789aacc67dc43378d2d7813a39f4vboxsync * the Lesser General Public License version 2.1 (LGPLv2) at this time for any software where
4237d5a79f48789aacc67dc43378d2d7813a39f4vboxsync * a choice of LGPL license versions is made available with the language indicating
4237d5a79f48789aacc67dc43378d2d7813a39f4vboxsync * that LGPLv2 or any later version may be used, or where a choice of which version
4237d5a79f48789aacc67dc43378d2d7813a39f4vboxsync * of the LGPL is applied is otherwise unspecified.
4237d5a79f48789aacc67dc43378d2d7813a39f4vboxsync */
4237d5a79f48789aacc67dc43378d2d7813a39f4vboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#include "config.h"
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#include "d3d8_private.h"
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncWINE_DEFAULT_DEBUG_CHANNEL(d3d8);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic inline struct d3d8_texture *impl_from_IDirect3DTexture8(IDirect3DTexture8 *iface)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return CONTAINING_RECORD(iface, struct d3d8_texture, IDirect3DBaseTexture8_iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic inline struct d3d8_texture *impl_from_IDirect3DCubeTexture8(IDirect3DCubeTexture8 *iface)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return CONTAINING_RECORD(iface, struct d3d8_texture, IDirect3DBaseTexture8_iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic inline struct d3d8_texture *impl_from_IDirect3DVolumeTexture8(IDirect3DVolumeTexture8 *iface)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return CONTAINING_RECORD(iface, struct d3d8_texture, IDirect3DBaseTexture8_iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic HRESULT WINAPI d3d8_texture_2d_QueryInterface(IDirect3DTexture8 *iface, REFIID riid, void **out)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync if (IsEqualGUID(riid, &IID_IDirect3DTexture8)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync || IsEqualGUID(riid, &IID_IDirect3DBaseTexture8)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync || IsEqualGUID(riid, &IID_IDirect3DResource8)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync || IsEqualGUID(riid, &IID_IUnknown))
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync {
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync IDirect3DTexture8_AddRef(iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync *out = iface;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return S_OK;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync }
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid));
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync *out = NULL;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return E_NOINTERFACE;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic ULONG WINAPI d3d8_texture_2d_AddRef(IDirect3DTexture8 *iface)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d8_texture *texture = impl_from_IDirect3DTexture8(iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync ULONG ref = InterlockedIncrement(&texture->refcount);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("%p increasing refcount to %u.\n", iface, ref);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync if (ref == 1)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync {
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync IDirect3DDevice8_AddRef(texture->parent_device);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_lock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_texture_incref(texture->wined3d_texture);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_unlock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync }
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return ref;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic ULONG WINAPI d3d8_texture_2d_Release(IDirect3DTexture8 *iface)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d8_texture *texture = impl_from_IDirect3DTexture8(iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync ULONG ref = InterlockedDecrement(&texture->refcount);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("%p decreasing refcount to %u.\n", iface, ref);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync if (!ref)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync {
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync IDirect3DDevice8 *parent_device = texture->parent_device;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_lock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_texture_decref(texture->wined3d_texture);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_unlock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync /* Release the device last, as it may cause the device to be destroyed. */
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync IDirect3DDevice8_Release(parent_device);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync }
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return ref;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic HRESULT WINAPI d3d8_texture_2d_GetDevice(IDirect3DTexture8 *iface, IDirect3DDevice8 **device)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d8_texture *texture = impl_from_IDirect3DTexture8(iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("iface %p, device %p.\n", iface, device);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync *device = texture->parent_device;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync IDirect3DDevice8_AddRef(*device);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("Returning device %p.\n", *device);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return D3D_OK;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic HRESULT WINAPI d3d8_texture_2d_SetPrivateData(IDirect3DTexture8 *iface,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync REFGUID guid, const void *data, DWORD data_size, DWORD flags)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d8_texture *texture = impl_from_IDirect3DTexture8(iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct wined3d_resource *resource;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync HRESULT hr;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("iface %p, guid %s, data %p, data_size %u, flags %#x.\n",
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync iface, debugstr_guid(guid), data, data_size, flags);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_lock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync resource = wined3d_texture_get_resource(texture->wined3d_texture);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync hr = wined3d_resource_set_private_data(resource, guid, data, data_size, flags);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_unlock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return hr;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic HRESULT WINAPI d3d8_texture_2d_GetPrivateData(IDirect3DTexture8 *iface,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync REFGUID guid, void *data, DWORD *data_size)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d8_texture *texture = impl_from_IDirect3DTexture8(iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct wined3d_resource *resource;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync HRESULT hr;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("iface %p, guid %s, data %p, data_size %p.\n",
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync iface, debugstr_guid(guid), data, data_size);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_lock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync resource = wined3d_texture_get_resource(texture->wined3d_texture);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync hr = wined3d_resource_get_private_data(resource, guid, data, data_size);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_unlock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return hr;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic HRESULT WINAPI d3d8_texture_2d_FreePrivateData(IDirect3DTexture8 *iface, REFGUID guid)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d8_texture *texture = impl_from_IDirect3DTexture8(iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct wined3d_resource *resource;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync HRESULT hr;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("iface %p, guid %s.\n", iface, debugstr_guid(guid));
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_lock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync resource = wined3d_texture_get_resource(texture->wined3d_texture);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync hr = wined3d_resource_free_private_data(resource, guid);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_unlock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return hr;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic DWORD WINAPI d3d8_texture_2d_SetPriority(IDirect3DTexture8 *iface, DWORD priority)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d8_texture *texture = impl_from_IDirect3DTexture8(iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync DWORD ret;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("iface %p, priority %u.\n", iface, priority);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_lock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync ret = wined3d_texture_set_priority(texture->wined3d_texture, priority);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_unlock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return ret;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic DWORD WINAPI d3d8_texture_2d_GetPriority(IDirect3DTexture8 *iface)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d8_texture *texture = impl_from_IDirect3DTexture8(iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync DWORD ret;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("iface %p.\n", iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_lock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync ret = wined3d_texture_get_priority(texture->wined3d_texture);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_unlock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return ret;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic void WINAPI d3d8_texture_2d_PreLoad(IDirect3DTexture8 *iface)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d8_texture *texture = impl_from_IDirect3DTexture8(iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("iface %p.\n", iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_lock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_texture_preload(texture->wined3d_texture);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_unlock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic D3DRESOURCETYPE WINAPI d3d8_texture_2d_GetType(IDirect3DTexture8 *iface)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("iface %p.\n", iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return D3DRTYPE_TEXTURE;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic DWORD WINAPI d3d8_texture_2d_SetLOD(IDirect3DTexture8 *iface, DWORD lod)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d8_texture *texture = impl_from_IDirect3DTexture8(iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync DWORD ret;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("iface %p, lod %u.\n", iface, lod);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_lock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync ret = wined3d_texture_set_lod(texture->wined3d_texture, lod);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_unlock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return ret;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic DWORD WINAPI d3d8_texture_2d_GetLOD(IDirect3DTexture8 *iface)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d8_texture *texture = impl_from_IDirect3DTexture8(iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync DWORD ret;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("iface %p.\n", iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_lock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync ret = wined3d_texture_get_lod(texture->wined3d_texture);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_unlock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return ret;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic DWORD WINAPI d3d8_texture_2d_GetLevelCount(IDirect3DTexture8 *iface)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d8_texture *texture = impl_from_IDirect3DTexture8(iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync DWORD ret;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("iface %p.\n", iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_lock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync ret = wined3d_texture_get_level_count(texture->wined3d_texture);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_unlock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return ret;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic HRESULT WINAPI d3d8_texture_2d_GetLevelDesc(IDirect3DTexture8 *iface, UINT level, D3DSURFACE_DESC *desc)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d8_texture *texture = impl_from_IDirect3DTexture8(iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct wined3d_resource *sub_resource;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync HRESULT hr = D3D_OK;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("iface %p, level %u, desc %p.\n", iface, level, desc);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_lock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync if (!(sub_resource = wined3d_texture_get_sub_resource(texture->wined3d_texture, level)))
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync hr = D3DERR_INVALIDCALL;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync else
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync {
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct wined3d_resource_desc wined3d_desc;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_resource_get_desc(sub_resource, &wined3d_desc);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync desc->Format = d3dformat_from_wined3dformat(wined3d_desc.format);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync desc->Type = wined3d_desc.resource_type;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync desc->Usage = wined3d_desc.usage & WINED3DUSAGE_MASK;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync desc->Pool = wined3d_desc.pool;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync desc->Size = wined3d_desc.size;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync desc->MultiSampleType = wined3d_desc.multisample_type;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync desc->Width = wined3d_desc.width;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync desc->Height = wined3d_desc.height;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync }
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_unlock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return hr;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic HRESULT WINAPI d3d8_texture_2d_GetSurfaceLevel(IDirect3DTexture8 *iface,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync UINT level, IDirect3DSurface8 **surface)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d8_texture *texture = impl_from_IDirect3DTexture8(iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct wined3d_resource *sub_resource;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d8_surface *surface_impl;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("iface %p, level %u, surface %p.\n", iface, level, surface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_lock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync if (!(sub_resource = wined3d_texture_get_sub_resource(texture->wined3d_texture, level)))
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync {
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_unlock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return D3DERR_INVALIDCALL;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync }
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync surface_impl = wined3d_resource_get_parent(sub_resource);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync *surface = &surface_impl->IDirect3DSurface8_iface;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync IDirect3DSurface8_AddRef(*surface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_unlock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return D3D_OK;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic HRESULT WINAPI d3d8_texture_2d_LockRect(IDirect3DTexture8 *iface, UINT level,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync D3DLOCKED_RECT *locked_rect, const RECT *rect, DWORD flags)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d8_texture *texture = impl_from_IDirect3DTexture8(iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct wined3d_resource *sub_resource;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d8_surface *surface_impl;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync HRESULT hr;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("iface %p, level %u, locked_rect %p, rect %p, flags %#x.\n",
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync iface, level, locked_rect, rect, flags);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_lock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync if (!(sub_resource = wined3d_texture_get_sub_resource(texture->wined3d_texture, level)))
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync hr = D3DERR_INVALIDCALL;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync else
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync {
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync surface_impl = wined3d_resource_get_parent(sub_resource);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync hr = IDirect3DSurface8_LockRect(&surface_impl->IDirect3DSurface8_iface, locked_rect, rect, flags);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync }
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_unlock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return hr;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic HRESULT WINAPI d3d8_texture_2d_UnlockRect(IDirect3DTexture8 *iface, UINT level)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d8_texture *texture = impl_from_IDirect3DTexture8(iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct wined3d_resource *sub_resource;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d8_surface *surface_impl;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync HRESULT hr;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("iface %p, level %u.\n", iface, level);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_lock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync if (!(sub_resource = wined3d_texture_get_sub_resource(texture->wined3d_texture, level)))
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync hr = D3DERR_INVALIDCALL;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync else
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync {
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync surface_impl = wined3d_resource_get_parent(sub_resource);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync hr = IDirect3DSurface8_UnlockRect(&surface_impl->IDirect3DSurface8_iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync }
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_unlock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return hr;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic HRESULT WINAPI d3d8_texture_2d_AddDirtyRect(IDirect3DTexture8 *iface, const RECT *dirty_rect)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d8_texture *texture = impl_from_IDirect3DTexture8(iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync HRESULT hr;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("iface %p, dirty_rect %s.\n",
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync iface, wine_dbgstr_rect(dirty_rect));
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_lock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync if (!dirty_rect)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync hr = wined3d_texture_add_dirty_region(texture->wined3d_texture, 0, NULL);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync else
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync {
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct wined3d_box dirty_region;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync dirty_region.left = dirty_rect->left;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync dirty_region.top = dirty_rect->top;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync dirty_region.right = dirty_rect->right;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync dirty_region.bottom = dirty_rect->bottom;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync dirty_region.front = 0;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync dirty_region.back = 1;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync hr = wined3d_texture_add_dirty_region(texture->wined3d_texture, 0, &dirty_region);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync }
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_unlock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return hr;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic const IDirect3DTexture8Vtbl Direct3DTexture8_Vtbl =
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync /* IUnknown */
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d8_texture_2d_QueryInterface,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d8_texture_2d_AddRef,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d8_texture_2d_Release,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync /* IDirect3DResource8 */
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d8_texture_2d_GetDevice,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d8_texture_2d_SetPrivateData,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d8_texture_2d_GetPrivateData,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d8_texture_2d_FreePrivateData,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d8_texture_2d_SetPriority,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d8_texture_2d_GetPriority,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d8_texture_2d_PreLoad,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d8_texture_2d_GetType,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync /* IDirect3dBaseTexture8 */
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d8_texture_2d_SetLOD,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d8_texture_2d_GetLOD,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d8_texture_2d_GetLevelCount,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync /* IDirect3DTexture8 */
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d8_texture_2d_GetLevelDesc,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d8_texture_2d_GetSurfaceLevel,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d8_texture_2d_LockRect,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d8_texture_2d_UnlockRect,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d8_texture_2d_AddDirtyRect,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync};
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic HRESULT WINAPI d3d8_texture_cube_QueryInterface(IDirect3DCubeTexture8 *iface, REFIID riid, void **out)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync if (IsEqualGUID(riid, &IID_IDirect3DCubeTexture8)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync || IsEqualGUID(riid, &IID_IDirect3DBaseTexture8)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync || IsEqualGUID(riid, &IID_IDirect3DResource8)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync || IsEqualGUID(riid, &IID_IUnknown))
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync {
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync IDirect3DCubeTexture8_AddRef(iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync *out = iface;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return S_OK;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync }
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid));
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync *out = NULL;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return E_NOINTERFACE;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic ULONG WINAPI d3d8_texture_cube_AddRef(IDirect3DCubeTexture8 *iface)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d8_texture *texture = impl_from_IDirect3DCubeTexture8(iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync ULONG ref = InterlockedIncrement(&texture->refcount);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("%p increasing refcount to %u.\n", iface, ref);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync if (ref == 1)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync {
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync IDirect3DDevice8_AddRef(texture->parent_device);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_lock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_texture_incref(texture->wined3d_texture);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_unlock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync }
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return ref;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic ULONG WINAPI d3d8_texture_cube_Release(IDirect3DCubeTexture8 *iface)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d8_texture *texture = impl_from_IDirect3DCubeTexture8(iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync ULONG ref = InterlockedDecrement(&texture->refcount);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("%p decreasing refcount to %u.\n", iface, ref);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync if (!ref)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync {
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync IDirect3DDevice8 *parent_device = texture->parent_device;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("Releasing child %p.\n", texture->wined3d_texture);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_lock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_texture_decref(texture->wined3d_texture);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_unlock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync /* Release the device last, as it may cause the device to be destroyed. */
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync IDirect3DDevice8_Release(parent_device);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync }
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return ref;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic HRESULT WINAPI d3d8_texture_cube_GetDevice(IDirect3DCubeTexture8 *iface, IDirect3DDevice8 **device)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d8_texture *texture = impl_from_IDirect3DCubeTexture8(iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("iface %p, device %p.\n", iface, device);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync *device = texture->parent_device;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync IDirect3DDevice8_AddRef(*device);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("Returning device %p.\n", *device);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return D3D_OK;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic HRESULT WINAPI d3d8_texture_cube_SetPrivateData(IDirect3DCubeTexture8 *iface,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync REFGUID guid, const void *data, DWORD data_size, DWORD flags)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d8_texture *texture = impl_from_IDirect3DCubeTexture8(iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct wined3d_resource *resource;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync HRESULT hr;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("iface %p, guid %s, data %p, data_size %u, flags %#x.\n",
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync iface, debugstr_guid(guid), data, data_size, flags);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_lock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync resource = wined3d_texture_get_resource(texture->wined3d_texture);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync hr = wined3d_resource_set_private_data(resource, guid, data, data_size, flags);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_unlock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return hr;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic HRESULT WINAPI d3d8_texture_cube_GetPrivateData(IDirect3DCubeTexture8 *iface,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync REFGUID guid, void *data, DWORD *data_size)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d8_texture *texture = impl_from_IDirect3DCubeTexture8(iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct wined3d_resource *resource;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync HRESULT hr;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("iface %p, guid %s, data %p, data_size %p.\n",
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync iface, debugstr_guid(guid), data, data_size);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_lock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync resource = wined3d_texture_get_resource(texture->wined3d_texture);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync hr = wined3d_resource_get_private_data(resource, guid, data, data_size);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_unlock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return hr;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic HRESULT WINAPI d3d8_texture_cube_FreePrivateData(IDirect3DCubeTexture8 *iface, REFGUID guid)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d8_texture *texture = impl_from_IDirect3DCubeTexture8(iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct wined3d_resource *resource;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync HRESULT hr;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("iface %p, guid %s.\n", iface, debugstr_guid(guid));
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_lock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync resource = wined3d_texture_get_resource(texture->wined3d_texture);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync hr = wined3d_resource_free_private_data(resource, guid);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_unlock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return hr;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic DWORD WINAPI d3d8_texture_cube_SetPriority(IDirect3DCubeTexture8 *iface, DWORD priority)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d8_texture *texture = impl_from_IDirect3DCubeTexture8(iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync DWORD ret;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("iface %p, priority %u.\n", iface, priority);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_lock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync ret = wined3d_texture_set_priority(texture->wined3d_texture, priority);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_unlock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return ret;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic DWORD WINAPI d3d8_texture_cube_GetPriority(IDirect3DCubeTexture8 *iface)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d8_texture *texture = impl_from_IDirect3DCubeTexture8(iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync DWORD ret;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("iface %p.\n", iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_lock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync ret = wined3d_texture_get_priority(texture->wined3d_texture);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_unlock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return ret;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic void WINAPI d3d8_texture_cube_PreLoad(IDirect3DCubeTexture8 *iface)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d8_texture *texture = impl_from_IDirect3DCubeTexture8(iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("iface %p.\n", iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_lock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_texture_preload(texture->wined3d_texture);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_unlock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic D3DRESOURCETYPE WINAPI d3d8_texture_cube_GetType(IDirect3DCubeTexture8 *iface)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("iface %p.\n", iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return D3DRTYPE_CUBETEXTURE;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic DWORD WINAPI d3d8_texture_cube_SetLOD(IDirect3DCubeTexture8 *iface, DWORD lod)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d8_texture *texture = impl_from_IDirect3DCubeTexture8(iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync DWORD ret;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("iface %p, lod %u.\n", iface, lod);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_lock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync ret = wined3d_texture_set_lod(texture->wined3d_texture, lod);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_unlock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return ret;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic DWORD WINAPI d3d8_texture_cube_GetLOD(IDirect3DCubeTexture8 *iface)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d8_texture *texture = impl_from_IDirect3DCubeTexture8(iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync DWORD ret;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("iface %p.\n", iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_lock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync ret = wined3d_texture_get_lod(texture->wined3d_texture);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_unlock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return ret;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic DWORD WINAPI d3d8_texture_cube_GetLevelCount(IDirect3DCubeTexture8 *iface)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d8_texture *texture = impl_from_IDirect3DCubeTexture8(iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync DWORD ret;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("iface %p.\n", iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_lock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync ret = wined3d_texture_get_level_count(texture->wined3d_texture);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_unlock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return ret;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic HRESULT WINAPI d3d8_texture_cube_GetLevelDesc(IDirect3DCubeTexture8 *iface, UINT level, D3DSURFACE_DESC *desc)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d8_texture *texture = impl_from_IDirect3DCubeTexture8(iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct wined3d_resource *sub_resource;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync HRESULT hr = D3D_OK;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("iface %p, level %u, desc %p.\n", iface, level, desc);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_lock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync if (level >= wined3d_texture_get_level_count(texture->wined3d_texture))
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync {
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_unlock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return D3DERR_INVALIDCALL;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync }
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync if (!(sub_resource = wined3d_texture_get_sub_resource(texture->wined3d_texture, level)))
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync hr = D3DERR_INVALIDCALL;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync else
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync {
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct wined3d_resource_desc wined3d_desc;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_resource_get_desc(sub_resource, &wined3d_desc);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync desc->Format = d3dformat_from_wined3dformat(wined3d_desc.format);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync desc->Type = wined3d_desc.resource_type;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync desc->Usage = wined3d_desc.usage & WINED3DUSAGE_MASK;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync desc->Pool = wined3d_desc.pool;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync desc->Size = wined3d_desc.size;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync desc->MultiSampleType = wined3d_desc.multisample_type;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync desc->Width = wined3d_desc.width;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync desc->Height = wined3d_desc.height;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync }
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_unlock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return hr;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic HRESULT WINAPI d3d8_texture_cube_GetCubeMapSurface(IDirect3DCubeTexture8 *iface,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync D3DCUBEMAP_FACES face, UINT level, IDirect3DSurface8 **surface)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d8_texture *texture = impl_from_IDirect3DCubeTexture8(iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct wined3d_resource *sub_resource;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d8_surface *surface_impl;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync UINT sub_resource_idx;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync DWORD level_count;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("iface %p, face %#x, level %u, surface %p.\n", iface, face, level, surface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_lock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync level_count = wined3d_texture_get_level_count(texture->wined3d_texture);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync if (level >= level_count)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync {
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_unlock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return D3DERR_INVALIDCALL;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync }
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync sub_resource_idx = level_count * face + level;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync if (!(sub_resource = wined3d_texture_get_sub_resource(texture->wined3d_texture, sub_resource_idx)))
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync {
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_unlock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return D3DERR_INVALIDCALL;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync }
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync surface_impl = wined3d_resource_get_parent(sub_resource);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync *surface = &surface_impl->IDirect3DSurface8_iface;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync IDirect3DSurface8_AddRef(*surface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_unlock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return D3D_OK;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic HRESULT WINAPI d3d8_texture_cube_LockRect(IDirect3DCubeTexture8 *iface,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync D3DCUBEMAP_FACES face, UINT level, D3DLOCKED_RECT *locked_rect, const RECT *rect,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync DWORD flags)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d8_texture *texture = impl_from_IDirect3DCubeTexture8(iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct wined3d_resource *sub_resource;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d8_surface *surface_impl;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync UINT sub_resource_idx;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync HRESULT hr;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("iface %p, face %#x, level %u, locked_rect %p, rect %p, flags %#x.\n",
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync iface, face, level, locked_rect, rect, flags);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_lock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync sub_resource_idx = wined3d_texture_get_level_count(texture->wined3d_texture) * face + level;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync if (!(sub_resource = wined3d_texture_get_sub_resource(texture->wined3d_texture, sub_resource_idx)))
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync hr = D3DERR_INVALIDCALL;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync else
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync {
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync surface_impl = wined3d_resource_get_parent(sub_resource);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync hr = IDirect3DSurface8_LockRect(&surface_impl->IDirect3DSurface8_iface, locked_rect, rect, flags);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync }
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_unlock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return hr;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic HRESULT WINAPI d3d8_texture_cube_UnlockRect(IDirect3DCubeTexture8 *iface,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync D3DCUBEMAP_FACES face, UINT level)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d8_texture *texture = impl_from_IDirect3DCubeTexture8(iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct wined3d_resource *sub_resource;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d8_surface *surface_impl;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync UINT sub_resource_idx;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync HRESULT hr;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("iface %p, face %#x, level %u.\n", iface, face, level);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_lock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync sub_resource_idx = wined3d_texture_get_level_count(texture->wined3d_texture) * face + level;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync if (!(sub_resource = wined3d_texture_get_sub_resource(texture->wined3d_texture, sub_resource_idx)))
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync hr = D3DERR_INVALIDCALL;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync else
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync {
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync surface_impl = wined3d_resource_get_parent(sub_resource);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync hr = IDirect3DSurface8_UnlockRect(&surface_impl->IDirect3DSurface8_iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync }
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_unlock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return hr;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic HRESULT WINAPI d3d8_texture_cube_AddDirtyRect(IDirect3DCubeTexture8 *iface,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync D3DCUBEMAP_FACES face, const RECT *dirty_rect)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d8_texture *texture = impl_from_IDirect3DCubeTexture8(iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync HRESULT hr;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("iface %p, face %#x, dirty_rect %s.\n",
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync iface, face, wine_dbgstr_rect(dirty_rect));
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_lock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync if (!dirty_rect)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync hr = wined3d_texture_add_dirty_region(texture->wined3d_texture, face, NULL);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync else
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync {
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct wined3d_box dirty_region;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync dirty_region.left = dirty_rect->left;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync dirty_region.top = dirty_rect->top;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync dirty_region.right = dirty_rect->right;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync dirty_region.bottom = dirty_rect->bottom;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync dirty_region.front = 0;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync dirty_region.back = 1;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync hr = wined3d_texture_add_dirty_region(texture->wined3d_texture, face, &dirty_region);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync }
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_unlock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return hr;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic const IDirect3DCubeTexture8Vtbl Direct3DCubeTexture8_Vtbl =
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync /* IUnknown */
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d8_texture_cube_QueryInterface,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d8_texture_cube_AddRef,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d8_texture_cube_Release,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync /* IDirect3DResource8 */
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d8_texture_cube_GetDevice,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d8_texture_cube_SetPrivateData,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d8_texture_cube_GetPrivateData,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d8_texture_cube_FreePrivateData,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d8_texture_cube_SetPriority,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d8_texture_cube_GetPriority,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d8_texture_cube_PreLoad,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d8_texture_cube_GetType,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync /* IDirect3DBaseTexture8 */
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d8_texture_cube_SetLOD,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d8_texture_cube_GetLOD,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d8_texture_cube_GetLevelCount,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync /* IDirect3DCubeTexture8 */
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d8_texture_cube_GetLevelDesc,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d8_texture_cube_GetCubeMapSurface,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d8_texture_cube_LockRect,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d8_texture_cube_UnlockRect,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d8_texture_cube_AddDirtyRect,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync};
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic HRESULT WINAPI d3d8_texture_3d_QueryInterface(IDirect3DVolumeTexture8 *iface, REFIID riid, void **out)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync if (IsEqualGUID(riid, &IID_IDirect3DVolumeTexture8)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync || IsEqualGUID(riid, &IID_IDirect3DBaseTexture8)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync || IsEqualGUID(riid, &IID_IDirect3DResource8)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync || IsEqualGUID(riid, &IID_IUnknown))
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync {
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync IDirect3DVolumeTexture8_AddRef(iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync *out = iface;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return S_OK;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync }
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid));
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync *out = NULL;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return E_NOINTERFACE;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic ULONG WINAPI d3d8_texture_3d_AddRef(IDirect3DVolumeTexture8 *iface)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d8_texture *texture = impl_from_IDirect3DVolumeTexture8(iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync ULONG ref = InterlockedIncrement(&texture->refcount);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("%p increasing refcount to %u.\n", iface, ref);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync if (ref == 1)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync {
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync IDirect3DDevice8_AddRef(texture->parent_device);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_lock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_texture_incref(texture->wined3d_texture);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_unlock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync }
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return ref;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic ULONG WINAPI d3d8_texture_3d_Release(IDirect3DVolumeTexture8 *iface)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d8_texture *texture = impl_from_IDirect3DVolumeTexture8(iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync ULONG ref = InterlockedDecrement(&texture->refcount);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("%p decreasing refcount to %u.\n", iface, ref);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync if (!ref)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync {
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync IDirect3DDevice8 *parent_device = texture->parent_device;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_lock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_texture_decref(texture->wined3d_texture);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_unlock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync /* Release the device last, as it may cause the device to be destroyed. */
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync IDirect3DDevice8_Release(parent_device);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync }
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return ref;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic HRESULT WINAPI d3d8_texture_3d_GetDevice(IDirect3DVolumeTexture8 *iface, IDirect3DDevice8 **device)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d8_texture *texture = impl_from_IDirect3DVolumeTexture8(iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("iface %p, device %p.\n", iface, device);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync *device = texture->parent_device;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync IDirect3DDevice8_AddRef(*device);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("Returning device %p.\n", *device);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return D3D_OK;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic HRESULT WINAPI d3d8_texture_3d_SetPrivateData(IDirect3DVolumeTexture8 *iface,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync REFGUID guid, const void *data, DWORD data_size, DWORD flags)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d8_texture *texture = impl_from_IDirect3DVolumeTexture8(iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct wined3d_resource *resource;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync HRESULT hr;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("iface %p, guid %s, data %p, data_size %u, flags %#x.\n",
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync iface, debugstr_guid(guid), data, data_size, flags);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_lock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync resource = wined3d_texture_get_resource(texture->wined3d_texture);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync hr = wined3d_resource_set_private_data(resource, guid, data, data_size, flags);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_unlock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return hr;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic HRESULT WINAPI d3d8_texture_3d_GetPrivateData(IDirect3DVolumeTexture8 *iface,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync REFGUID guid, void *data, DWORD *data_size)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d8_texture *texture = impl_from_IDirect3DVolumeTexture8(iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct wined3d_resource *resource;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync HRESULT hr;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("iface %p, guid %s, data %p, data_size %p.\n",
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync iface, debugstr_guid(guid), data, data_size);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_lock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync resource = wined3d_texture_get_resource(texture->wined3d_texture);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync hr = wined3d_resource_get_private_data(resource, guid, data, data_size);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_unlock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return hr;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic HRESULT WINAPI d3d8_texture_3d_FreePrivateData(IDirect3DVolumeTexture8 *iface, REFGUID guid)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d8_texture *texture = impl_from_IDirect3DVolumeTexture8(iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct wined3d_resource *resource;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync HRESULT hr;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("iface %p, guid %s.\n", iface, debugstr_guid(guid));
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_lock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync resource = wined3d_texture_get_resource(texture->wined3d_texture);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync hr = wined3d_resource_free_private_data(resource, guid);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_unlock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return hr;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic DWORD WINAPI d3d8_texture_3d_SetPriority(IDirect3DVolumeTexture8 *iface, DWORD priority)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d8_texture *texture = impl_from_IDirect3DVolumeTexture8(iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync DWORD ret;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("iface %p, priority %u.\n", iface, priority);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_lock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync ret = wined3d_texture_set_priority(texture->wined3d_texture, priority);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_unlock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return ret;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic DWORD WINAPI d3d8_texture_3d_GetPriority(IDirect3DVolumeTexture8 *iface)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d8_texture *texture = impl_from_IDirect3DVolumeTexture8(iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync DWORD ret;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("iface %p.\n", iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_lock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync ret = wined3d_texture_get_priority(texture->wined3d_texture);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_unlock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return ret;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic void WINAPI d3d8_texture_3d_PreLoad(IDirect3DVolumeTexture8 *iface)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d8_texture *texture = impl_from_IDirect3DVolumeTexture8(iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("iface %p.\n", iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_lock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_texture_preload(texture->wined3d_texture);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_unlock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic D3DRESOURCETYPE WINAPI d3d8_texture_3d_GetType(IDirect3DVolumeTexture8 *iface)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("iface %p.\n", iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return D3DRTYPE_VOLUMETEXTURE;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic DWORD WINAPI d3d8_texture_3d_SetLOD(IDirect3DVolumeTexture8 *iface, DWORD lod)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d8_texture *texture = impl_from_IDirect3DVolumeTexture8(iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync DWORD ret;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("iface %p, lod %u.\n", iface, lod);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_lock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync ret = wined3d_texture_set_lod(texture->wined3d_texture, lod);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_unlock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return ret;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic DWORD WINAPI d3d8_texture_3d_GetLOD(IDirect3DVolumeTexture8 *iface)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d8_texture *texture = impl_from_IDirect3DVolumeTexture8(iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync DWORD ret;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("iface %p.\n", iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_lock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync ret = wined3d_texture_get_lod(texture->wined3d_texture);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_unlock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return ret;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic DWORD WINAPI d3d8_texture_3d_GetLevelCount(IDirect3DVolumeTexture8 *iface)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d8_texture *texture = impl_from_IDirect3DVolumeTexture8(iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync DWORD ret;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("iface %p.\n", iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_lock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync ret = wined3d_texture_get_level_count(texture->wined3d_texture);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_unlock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return ret;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic HRESULT WINAPI d3d8_texture_3d_GetLevelDesc(IDirect3DVolumeTexture8 *iface, UINT level, D3DVOLUME_DESC *desc)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d8_texture *texture = impl_from_IDirect3DVolumeTexture8(iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct wined3d_resource *sub_resource;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync HRESULT hr = D3D_OK;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("iface %p, level %u, desc %p.\n", iface, level, desc);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_lock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync if (!(sub_resource = wined3d_texture_get_sub_resource(texture->wined3d_texture, level)))
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync hr = D3DERR_INVALIDCALL;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync else
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync {
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct wined3d_resource_desc wined3d_desc;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_resource_get_desc(sub_resource, &wined3d_desc);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync desc->Format = d3dformat_from_wined3dformat(wined3d_desc.format);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync desc->Type = wined3d_desc.resource_type;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync desc->Usage = wined3d_desc.usage & WINED3DUSAGE_MASK;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync desc->Pool = wined3d_desc.pool;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync desc->Size = wined3d_desc.size;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync desc->Width = wined3d_desc.width;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync desc->Height = wined3d_desc.height;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync desc->Depth = wined3d_desc.depth;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync }
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_unlock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return hr;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic HRESULT WINAPI d3d8_texture_3d_GetVolumeLevel(IDirect3DVolumeTexture8 *iface,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync UINT level, IDirect3DVolume8 **volume)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d8_texture *texture = impl_from_IDirect3DVolumeTexture8(iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct wined3d_resource *sub_resource;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d8_volume *volume_impl;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("iface %p, level %u, volume %p.\n", iface, level, volume);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_lock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync if (!(sub_resource = wined3d_texture_get_sub_resource(texture->wined3d_texture, level)))
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync {
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_unlock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return D3DERR_INVALIDCALL;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync }
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync volume_impl = wined3d_resource_get_parent(sub_resource);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync *volume = &volume_impl->IDirect3DVolume8_iface;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync IDirect3DVolume8_AddRef(*volume);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_unlock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return D3D_OK;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic HRESULT WINAPI d3d8_texture_3d_LockBox(IDirect3DVolumeTexture8 *iface,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync UINT level, D3DLOCKED_BOX *locked_box, const D3DBOX *box, DWORD flags)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d8_texture *texture = impl_from_IDirect3DVolumeTexture8(iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct wined3d_resource *sub_resource;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d8_volume *volume_impl;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync HRESULT hr;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("iface %p, level %u, locked_box %p, box %p, flags %#x.\n",
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync iface, level, locked_box, box, flags);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_lock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync if (!(sub_resource = wined3d_texture_get_sub_resource(texture->wined3d_texture, level)))
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync hr = D3DERR_INVALIDCALL;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync else
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync {
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync volume_impl = wined3d_resource_get_parent(sub_resource);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync hr = IDirect3DVolume8_LockBox(&volume_impl->IDirect3DVolume8_iface, locked_box, box, flags);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync }
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_unlock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return hr;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic HRESULT WINAPI d3d8_texture_3d_UnlockBox(IDirect3DVolumeTexture8 *iface, UINT level)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d8_texture *texture = impl_from_IDirect3DVolumeTexture8(iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct wined3d_resource *sub_resource;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d8_volume *volume_impl;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync HRESULT hr;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("iface %p, level %u.\n", iface, level);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_lock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync if (!(sub_resource = wined3d_texture_get_sub_resource(texture->wined3d_texture, level)))
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync hr = D3DERR_INVALIDCALL;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync else
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync {
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync volume_impl = wined3d_resource_get_parent(sub_resource);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync hr = IDirect3DVolume8_UnlockBox(&volume_impl->IDirect3DVolume8_iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync }
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_unlock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return hr;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic HRESULT WINAPI d3d8_texture_3d_AddDirtyBox(IDirect3DVolumeTexture8 *iface, const D3DBOX *dirty_box)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d8_texture *texture = impl_from_IDirect3DVolumeTexture8(iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync HRESULT hr;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("iface %p, dirty_box %p.\n", iface, dirty_box);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_lock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync hr = wined3d_texture_add_dirty_region(texture->wined3d_texture, 0, (const struct wined3d_box *)dirty_box);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_unlock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return hr;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic const IDirect3DVolumeTexture8Vtbl Direct3DVolumeTexture8_Vtbl =
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync /* IUnknown */
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d8_texture_3d_QueryInterface,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d8_texture_3d_AddRef,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d8_texture_3d_Release,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync /* IDirect3DResource8 */
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d8_texture_3d_GetDevice,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d8_texture_3d_SetPrivateData,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d8_texture_3d_GetPrivateData,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d8_texture_3d_FreePrivateData,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d8_texture_3d_SetPriority,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d8_texture_3d_GetPriority,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d8_texture_3d_PreLoad,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d8_texture_3d_GetType,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync /* IDirect3DBaseTexture8 */
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d8_texture_3d_SetLOD,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d8_texture_3d_GetLOD,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d8_texture_3d_GetLevelCount,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync /* IDirect3DVolumeTexture8 */
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d8_texture_3d_GetLevelDesc,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d8_texture_3d_GetVolumeLevel,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d8_texture_3d_LockBox,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d8_texture_3d_UnlockBox,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d8_texture_3d_AddDirtyBox
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync};
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstruct d3d8_texture *unsafe_impl_from_IDirect3DBaseTexture8(IDirect3DBaseTexture8 *iface)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync if (!iface)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return NULL;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync /* SetTexture() in particular doesn't do a lot of validation on the pointer
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync * that gets passed in, and passing an invalid pointer works as long as the
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync * application doesn't try to actually render anything with it, so we print
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync * a WARN and return NULL instead of having the usual assert() here.
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync * One application affected by this is Fishdom 2. */
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync if (iface->lpVtbl != (const IDirect3DBaseTexture8Vtbl *)&Direct3DTexture8_Vtbl
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync && iface->lpVtbl != (const IDirect3DBaseTexture8Vtbl *)&Direct3DCubeTexture8_Vtbl
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync && iface->lpVtbl != (const IDirect3DBaseTexture8Vtbl *)&Direct3DVolumeTexture8_Vtbl)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync {
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync WARN("%p is not a valid IDirect3DBaseTexture8 interface.\n", iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return NULL;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync }
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return CONTAINING_RECORD(iface, struct d3d8_texture, IDirect3DBaseTexture8_iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic void STDMETHODCALLTYPE d3d8_texture_wined3d_object_destroyed(void *parent)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync HeapFree(GetProcessHeap(), 0, parent);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic const struct wined3d_parent_ops d3d8_texture_wined3d_parent_ops =
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d8_texture_wined3d_object_destroyed,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync};
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncHRESULT texture_init(struct d3d8_texture *texture, struct d3d8_device *device,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync UINT width, UINT height, UINT levels, DWORD usage, D3DFORMAT format, D3DPOOL pool)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct wined3d_resource_desc desc;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync DWORD surface_flags = 0;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync HRESULT hr;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync texture->IDirect3DBaseTexture8_iface.lpVtbl = (const IDirect3DBaseTexture8Vtbl *)&Direct3DTexture8_Vtbl;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync texture->refcount = 1;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync desc.resource_type = WINED3D_RTYPE_TEXTURE;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync desc.format = wined3dformat_from_d3dformat(format);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync desc.multisample_type = WINED3D_MULTISAMPLE_NONE;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync desc.multisample_quality = 0;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync desc.usage = usage & WINED3DUSAGE_MASK;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync desc.pool = pool;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync desc.width = width;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync desc.height = height;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync desc.depth = 1;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync desc.size = 0;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync if (pool != D3DPOOL_DEFAULT || (usage & D3DUSAGE_DYNAMIC))
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync surface_flags |= WINED3D_SURFACE_MAPPABLE;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_lock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync hr = wined3d_texture_create_2d(device->wined3d_device, &desc, levels, surface_flags,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync texture, &d3d8_texture_wined3d_parent_ops, &texture->wined3d_texture);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_unlock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync if (FAILED(hr))
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync {
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync WARN("Failed to create wined3d texture, hr %#x.\n", hr);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return hr;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync }
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync texture->parent_device = &device->IDirect3DDevice8_iface;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync IDirect3DDevice8_AddRef(texture->parent_device);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return D3D_OK;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncHRESULT cubetexture_init(struct d3d8_texture *texture, struct d3d8_device *device,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync UINT edge_length, UINT levels, DWORD usage, D3DFORMAT format, D3DPOOL pool)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct wined3d_resource_desc desc;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync DWORD surface_flags = 0;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync HRESULT hr;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync texture->IDirect3DBaseTexture8_iface.lpVtbl = (const IDirect3DBaseTexture8Vtbl *)&Direct3DCubeTexture8_Vtbl;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync texture->refcount = 1;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync desc.resource_type = WINED3D_RTYPE_CUBE_TEXTURE;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync desc.format = wined3dformat_from_d3dformat(format);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync desc.multisample_type = WINED3D_MULTISAMPLE_NONE;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync desc.multisample_quality = 0;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync desc.usage = usage & WINED3DUSAGE_MASK;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync desc.pool = pool;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync desc.width = edge_length;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync desc.height = edge_length;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync desc.depth = 1;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync desc.size = 0;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync if (pool != D3DPOOL_DEFAULT || (usage & D3DUSAGE_DYNAMIC))
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync surface_flags |= WINED3D_SURFACE_MAPPABLE;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_lock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync hr = wined3d_texture_create_cube(device->wined3d_device, &desc, levels, surface_flags,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync texture, &d3d8_texture_wined3d_parent_ops, &texture->wined3d_texture);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_unlock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync if (FAILED(hr))
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync {
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync WARN("Failed to create wined3d cube texture, hr %#x.\n", hr);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return hr;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync }
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync texture->parent_device = &device->IDirect3DDevice8_iface;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync IDirect3DDevice8_AddRef(texture->parent_device);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return D3D_OK;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncHRESULT volumetexture_init(struct d3d8_texture *texture, struct d3d8_device *device,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync UINT width, UINT height, UINT depth, UINT levels, DWORD usage, D3DFORMAT format, D3DPOOL pool)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct wined3d_resource_desc desc;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync HRESULT hr;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync texture->IDirect3DBaseTexture8_iface.lpVtbl = (const IDirect3DBaseTexture8Vtbl *)&Direct3DVolumeTexture8_Vtbl;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync texture->refcount = 1;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync desc.resource_type = WINED3D_RTYPE_VOLUME_TEXTURE;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync desc.format = wined3dformat_from_d3dformat(format);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync desc.multisample_type = WINED3D_MULTISAMPLE_NONE;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync desc.multisample_quality = 0;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync desc.usage = usage & WINED3DUSAGE_MASK;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync desc.pool = pool;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync desc.width = width;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync desc.height = height;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync desc.depth = depth;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync desc.size = 0;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_lock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync hr = wined3d_texture_create_3d(device->wined3d_device, &desc, levels,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync texture, &d3d8_texture_wined3d_parent_ops, &texture->wined3d_texture);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_unlock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync if (FAILED(hr))
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync {
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync WARN("Failed to create wined3d volume texture, hr %#x.\n", hr);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return hr;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync }
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync texture->parent_device = &device->IDirect3DDevice8_iface;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync IDirect3DDevice8_AddRef(texture->parent_device);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return D3D_OK;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}