058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync/*
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync * Copyright 2002-2005 Jason Edmeades
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync * Copyright 2002-2005 Raphael Junqueira
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 "d3d9_private.h"
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncWINE_DEFAULT_DEBUG_CHANNEL(d3d9);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic inline struct d3d9_texture *impl_from_IDirect3DTexture9(IDirect3DTexture9 *iface)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return CONTAINING_RECORD(iface, struct d3d9_texture, IDirect3DBaseTexture9_iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic inline struct d3d9_texture *impl_from_IDirect3DCubeTexture9(IDirect3DCubeTexture9 *iface)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return CONTAINING_RECORD(iface, struct d3d9_texture, IDirect3DBaseTexture9_iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic inline struct d3d9_texture *impl_from_IDirect3DVolumeTexture9(IDirect3DVolumeTexture9 *iface)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return CONTAINING_RECORD(iface, struct d3d9_texture, IDirect3DBaseTexture9_iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic HRESULT WINAPI d3d9_texture_2d_QueryInterface(IDirect3DTexture9 *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_IDirect3DTexture9)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync || IsEqualGUID(riid, &IID_IDirect3DBaseTexture9)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync || IsEqualGUID(riid, &IID_IDirect3DResource9)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync || IsEqualGUID(riid, &IID_IUnknown))
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync {
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync IDirect3DTexture9_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 d3d9_texture_2d_AddRef(IDirect3DTexture9 *iface)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d9_texture *texture = impl_from_IDirect3DTexture9(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 IDirect3DDevice9Ex_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 d3d9_texture_2d_Release(IDirect3DTexture9 *iface)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d9_texture *texture = impl_from_IDirect3DTexture9(iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync ULONG ref = InterlockedDecrement(&texture->refcount);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("%p decreasing refcount to %u.\n", iface, ref);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync if (!ref)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync {
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync IDirect3DDevice9Ex *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 IDirect3DDevice9Ex_Release(parent_device);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync }
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return ref;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic HRESULT WINAPI d3d9_texture_2d_GetDevice(IDirect3DTexture9 *iface, IDirect3DDevice9 **device)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d9_texture *texture = impl_from_IDirect3DTexture9(iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("iface %p, device %p.\n", iface, device);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync *device = (IDirect3DDevice9 *)texture->parent_device;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync IDirect3DDevice9_AddRef(*device);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("Returning device %p.\n", *device);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return D3D_OK;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic HRESULT WINAPI d3d9_texture_2d_SetPrivateData(IDirect3DTexture9 *iface,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync REFGUID guid, const void *data, DWORD data_size, DWORD flags)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d9_texture *texture = impl_from_IDirect3DTexture9(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 d3d9_texture_2d_GetPrivateData(IDirect3DTexture9 *iface,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync REFGUID guid, void *data, DWORD *data_size)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d9_texture *texture = impl_from_IDirect3DTexture9(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 d3d9_texture_2d_FreePrivateData(IDirect3DTexture9 *iface, REFGUID guid)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d9_texture *texture = impl_from_IDirect3DTexture9(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 d3d9_texture_2d_SetPriority(IDirect3DTexture9 *iface, DWORD priority)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d9_texture *texture = impl_from_IDirect3DTexture9(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 d3d9_texture_2d_GetPriority(IDirect3DTexture9 *iface)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d9_texture *texture = impl_from_IDirect3DTexture9(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 d3d9_texture_2d_PreLoad(IDirect3DTexture9 *iface)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d9_texture *texture = impl_from_IDirect3DTexture9(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 d3d9_texture_2d_GetType(IDirect3DTexture9 *iface)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("iface %p.\n", iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return D3DRTYPE_TEXTURE;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic DWORD WINAPI d3d9_texture_2d_SetLOD(IDirect3DTexture9 *iface, DWORD lod)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d9_texture *texture = impl_from_IDirect3DTexture9(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 d3d9_texture_2d_GetLOD(IDirect3DTexture9 *iface)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d9_texture *texture = impl_from_IDirect3DTexture9(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 d3d9_texture_2d_GetLevelCount(IDirect3DTexture9 *iface)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d9_texture *texture = impl_from_IDirect3DTexture9(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 d3d9_texture_2d_SetAutoGenFilterType(IDirect3DTexture9 *iface, D3DTEXTUREFILTERTYPE filter_type)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d9_texture *texture = impl_from_IDirect3DTexture9(iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync HRESULT hr;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("iface %p, filter_type %#x.\n", iface, filter_type);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_lock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync hr = wined3d_texture_set_autogen_filter_type(texture->wined3d_texture,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync (enum wined3d_texture_filter_type)filter_type);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_unlock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return hr;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic D3DTEXTUREFILTERTYPE WINAPI d3d9_texture_2d_GetAutoGenFilterType(IDirect3DTexture9 *iface)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d9_texture *texture = impl_from_IDirect3DTexture9(iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync D3DTEXTUREFILTERTYPE ret;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("iface %p.\n", iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_lock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync ret = (D3DTEXTUREFILTERTYPE)wined3d_texture_get_autogen_filter_type(texture->wined3d_texture);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_unlock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return ret;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic void WINAPI d3d9_texture_2d_GenerateMipSubLevels(IDirect3DTexture9 *iface)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d9_texture *texture = impl_from_IDirect3DTexture9(iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("iface %p.\n", iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_lock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_texture_generate_mipmaps(texture->wined3d_texture);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_unlock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic HRESULT WINAPI d3d9_texture_2d_GetLevelDesc(IDirect3DTexture9 *iface, UINT level, D3DSURFACE_DESC *desc)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d9_texture *texture = impl_from_IDirect3DTexture9(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->MultiSampleType = wined3d_desc.multisample_type;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync desc->MultiSampleQuality = wined3d_desc.multisample_quality;
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 d3d9_texture_2d_GetSurfaceLevel(IDirect3DTexture9 *iface,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync UINT level, IDirect3DSurface9 **surface)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d9_texture *texture = impl_from_IDirect3DTexture9(iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct wined3d_resource *sub_resource;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d9_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->IDirect3DSurface9_iface;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync IDirect3DSurface9_AddRef(*surface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_unlock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return D3D_OK;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic HRESULT WINAPI d3d9_texture_2d_LockRect(IDirect3DTexture9 *iface,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync UINT level, D3DLOCKED_RECT *locked_rect, const RECT *rect, DWORD flags)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d9_texture *texture = impl_from_IDirect3DTexture9(iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct wined3d_resource *sub_resource;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d9_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 = IDirect3DSurface9_LockRect(&surface_impl->IDirect3DSurface9_iface, locked_rect, rect, flags);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync }
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_unlock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return hr;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic HRESULT WINAPI d3d9_texture_2d_UnlockRect(IDirect3DTexture9 *iface, UINT level)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d9_texture *texture = impl_from_IDirect3DTexture9(iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct wined3d_resource *sub_resource;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d9_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 = IDirect3DSurface9_UnlockRect(&surface_impl->IDirect3DSurface9_iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync }
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_unlock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return hr;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic HRESULT WINAPI d3d9_texture_2d_AddDirtyRect(IDirect3DTexture9 *iface, const RECT *dirty_rect)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d9_texture *texture = impl_from_IDirect3DTexture9(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 IDirect3DTexture9Vtbl d3d9_texture_2d_vtbl =
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync /* IUnknown */
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d9_texture_2d_QueryInterface,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d9_texture_2d_AddRef,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d9_texture_2d_Release,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync /* IDirect3DResource9 */
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d9_texture_2d_GetDevice,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d9_texture_2d_SetPrivateData,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d9_texture_2d_GetPrivateData,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d9_texture_2d_FreePrivateData,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d9_texture_2d_SetPriority,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d9_texture_2d_GetPriority,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d9_texture_2d_PreLoad,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d9_texture_2d_GetType,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync /* IDirect3dBaseTexture9 */
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d9_texture_2d_SetLOD,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d9_texture_2d_GetLOD,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d9_texture_2d_GetLevelCount,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d9_texture_2d_SetAutoGenFilterType,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d9_texture_2d_GetAutoGenFilterType,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d9_texture_2d_GenerateMipSubLevels,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync /* IDirect3DTexture9 */
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d9_texture_2d_GetLevelDesc,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d9_texture_2d_GetSurfaceLevel,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d9_texture_2d_LockRect,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d9_texture_2d_UnlockRect,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d9_texture_2d_AddDirtyRect,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync};
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic HRESULT WINAPI d3d9_texture_cube_QueryInterface(IDirect3DCubeTexture9 *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_IDirect3DCubeTexture9)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync || IsEqualGUID(riid, &IID_IDirect3DBaseTexture9)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync || IsEqualGUID(riid, &IID_IDirect3DResource9)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync || IsEqualGUID(riid, &IID_IUnknown))
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync {
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync IDirect3DCubeTexture9_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 d3d9_texture_cube_AddRef(IDirect3DCubeTexture9 *iface)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d9_texture *texture = impl_from_IDirect3DCubeTexture9(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 IDirect3DDevice9Ex_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 d3d9_texture_cube_Release(IDirect3DCubeTexture9 *iface)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d9_texture *texture = impl_from_IDirect3DCubeTexture9(iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync ULONG ref = InterlockedDecrement(&texture->refcount);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("%p decreasing refcount to %u.\n", iface, ref);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync if (!ref)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync {
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync IDirect3DDevice9Ex *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 IDirect3DDevice9Ex_Release(parent_device);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync }
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return ref;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic HRESULT WINAPI d3d9_texture_cube_GetDevice(IDirect3DCubeTexture9 *iface, IDirect3DDevice9 **device)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d9_texture *texture = impl_from_IDirect3DCubeTexture9(iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("iface %p, device %p.\n", iface, device);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync *device = (IDirect3DDevice9 *)texture->parent_device;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync IDirect3DDevice9_AddRef(*device);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("Returning device %p.\n", *device);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return D3D_OK;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic HRESULT WINAPI d3d9_texture_cube_SetPrivateData(IDirect3DCubeTexture9 *iface,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync REFGUID guid, const void *data, DWORD data_size, DWORD flags)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d9_texture *texture = impl_from_IDirect3DCubeTexture9(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 d3d9_texture_cube_GetPrivateData(IDirect3DCubeTexture9 *iface,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync REFGUID guid, void *data, DWORD *data_size)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d9_texture *texture = impl_from_IDirect3DCubeTexture9(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 d3d9_texture_cube_FreePrivateData(IDirect3DCubeTexture9 *iface, REFGUID guid)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d9_texture *texture = impl_from_IDirect3DCubeTexture9(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 d3d9_texture_cube_SetPriority(IDirect3DCubeTexture9 *iface, DWORD priority)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d9_texture *texture = impl_from_IDirect3DCubeTexture9(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 d3d9_texture_cube_GetPriority(IDirect3DCubeTexture9 *iface)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d9_texture *texture = impl_from_IDirect3DCubeTexture9(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 d3d9_texture_cube_PreLoad(IDirect3DCubeTexture9 *iface)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d9_texture *texture = impl_from_IDirect3DCubeTexture9(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 d3d9_texture_cube_GetType(IDirect3DCubeTexture9 *iface)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("iface %p.\n", iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return D3DRTYPE_CUBETEXTURE;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic DWORD WINAPI d3d9_texture_cube_SetLOD(IDirect3DCubeTexture9 *iface, DWORD lod)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d9_texture *texture = impl_from_IDirect3DCubeTexture9(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 d3d9_texture_cube_GetLOD(IDirect3DCubeTexture9 *iface)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d9_texture *texture = impl_from_IDirect3DCubeTexture9(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 d3d9_texture_cube_GetLevelCount(IDirect3DCubeTexture9 *iface)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d9_texture *texture = impl_from_IDirect3DCubeTexture9(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 d3d9_texture_cube_SetAutoGenFilterType(IDirect3DCubeTexture9 *iface,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync D3DTEXTUREFILTERTYPE filter_type)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d9_texture *texture = impl_from_IDirect3DCubeTexture9(iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync HRESULT hr;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("iface %p, filter_type %#x.\n", iface, filter_type);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_lock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync hr = wined3d_texture_set_autogen_filter_type(texture->wined3d_texture,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync (enum wined3d_texture_filter_type)filter_type);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_unlock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return hr;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic D3DTEXTUREFILTERTYPE WINAPI d3d9_texture_cube_GetAutoGenFilterType(IDirect3DCubeTexture9 *iface)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d9_texture *texture = impl_from_IDirect3DCubeTexture9(iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync D3DTEXTUREFILTERTYPE ret;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("iface %p.\n", iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_lock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync ret = (D3DTEXTUREFILTERTYPE)wined3d_texture_get_autogen_filter_type(texture->wined3d_texture);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_unlock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return ret;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic void WINAPI d3d9_texture_cube_GenerateMipSubLevels(IDirect3DCubeTexture9 *iface)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d9_texture *texture = impl_from_IDirect3DCubeTexture9(iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("iface %p.\n", iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_lock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_texture_generate_mipmaps(texture->wined3d_texture);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_unlock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic HRESULT WINAPI d3d9_texture_cube_GetLevelDesc(IDirect3DCubeTexture9 *iface, UINT level, D3DSURFACE_DESC *desc)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d9_texture *texture = impl_from_IDirect3DCubeTexture9(iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct wined3d_resource *sub_resource;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync HRESULT hr = D3D_OK;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync DWORD level_count;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("iface %p, level %u, desc %p.\n", iface, level, desc);
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 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->MultiSampleType = wined3d_desc.multisample_type;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync desc->MultiSampleQuality = wined3d_desc.multisample_quality;
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 d3d9_texture_cube_GetCubeMapSurface(IDirect3DCubeTexture9 *iface,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync D3DCUBEMAP_FACES face, UINT level, IDirect3DSurface9 **surface)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d9_texture *texture = impl_from_IDirect3DCubeTexture9(iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct wined3d_resource *sub_resource;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d9_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->IDirect3DSurface9_iface;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync IDirect3DSurface9_AddRef(*surface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_unlock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return D3D_OK;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic HRESULT WINAPI d3d9_texture_cube_LockRect(IDirect3DCubeTexture9 *iface,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync D3DCUBEMAP_FACES face, UINT level, D3DLOCKED_RECT *locked_rect, const RECT *rect,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync DWORD flags)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d9_texture *texture = impl_from_IDirect3DCubeTexture9(iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct wined3d_resource *sub_resource;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d9_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 = IDirect3DSurface9_LockRect(&surface_impl->IDirect3DSurface9_iface, locked_rect, rect, flags);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync }
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_unlock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return hr;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic HRESULT WINAPI d3d9_texture_cube_UnlockRect(IDirect3DCubeTexture9 *iface,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync D3DCUBEMAP_FACES face, UINT level)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d9_texture *texture = impl_from_IDirect3DCubeTexture9(iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct wined3d_resource *sub_resource;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d9_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 = IDirect3DSurface9_UnlockRect(&surface_impl->IDirect3DSurface9_iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync }
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_unlock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return hr;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic HRESULT WINAPI d3d9_texture_cube_AddDirtyRect(IDirect3DCubeTexture9 *iface,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync D3DCUBEMAP_FACES face, const RECT *dirty_rect)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d9_texture *texture = impl_from_IDirect3DCubeTexture9(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 IDirect3DCubeTexture9Vtbl d3d9_texture_cube_vtbl =
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync /* IUnknown */
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d9_texture_cube_QueryInterface,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d9_texture_cube_AddRef,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d9_texture_cube_Release,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync /* IDirect3DResource9 */
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d9_texture_cube_GetDevice,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d9_texture_cube_SetPrivateData,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d9_texture_cube_GetPrivateData,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d9_texture_cube_FreePrivateData,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d9_texture_cube_SetPriority,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d9_texture_cube_GetPriority,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d9_texture_cube_PreLoad,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d9_texture_cube_GetType,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync /* IDirect3DBaseTexture9 */
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d9_texture_cube_SetLOD,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d9_texture_cube_GetLOD,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d9_texture_cube_GetLevelCount,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d9_texture_cube_SetAutoGenFilterType,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d9_texture_cube_GetAutoGenFilterType,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d9_texture_cube_GenerateMipSubLevels,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync /* IDirect3DCubeTexture9 */
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d9_texture_cube_GetLevelDesc,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d9_texture_cube_GetCubeMapSurface,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d9_texture_cube_LockRect,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d9_texture_cube_UnlockRect,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d9_texture_cube_AddDirtyRect,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync};
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic HRESULT WINAPI d3d9_texture_3d_QueryInterface(IDirect3DVolumeTexture9 *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_IDirect3DVolumeTexture9)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync || IsEqualGUID(riid, &IID_IDirect3DBaseTexture9)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync || IsEqualGUID(riid, &IID_IDirect3DResource9)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync || IsEqualGUID(riid, &IID_IUnknown))
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync {
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync IDirect3DVolumeTexture9_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 d3d9_texture_3d_AddRef(IDirect3DVolumeTexture9 *iface)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d9_texture *texture = impl_from_IDirect3DVolumeTexture9(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 IDirect3DDevice9Ex_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 d3d9_texture_3d_Release(IDirect3DVolumeTexture9 *iface)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d9_texture *texture = impl_from_IDirect3DVolumeTexture9(iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync ULONG ref = InterlockedDecrement(&texture->refcount);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("%p decreasing refcount to %u.\n", iface, ref);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync if (!ref)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync {
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync IDirect3DDevice9Ex *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 IDirect3DDevice9Ex_Release(parent_device);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync }
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return ref;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic HRESULT WINAPI d3d9_texture_3d_GetDevice(IDirect3DVolumeTexture9 *iface, IDirect3DDevice9 **device)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d9_texture *texture = impl_from_IDirect3DVolumeTexture9(iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("iface %p, device %p.\n", iface, device);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync *device = (IDirect3DDevice9 *)texture->parent_device;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync IDirect3DDevice9_AddRef(*device);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("Returning device %p.\n", *device);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return D3D_OK;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic HRESULT WINAPI d3d9_texture_3d_SetPrivateData(IDirect3DVolumeTexture9 *iface,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync REFGUID guid, const void *data, DWORD data_size, DWORD flags)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d9_texture *texture = impl_from_IDirect3DVolumeTexture9(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 d3d9_texture_3d_GetPrivateData(IDirect3DVolumeTexture9 *iface,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync REFGUID guid, void *data, DWORD *data_size)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d9_texture *texture = impl_from_IDirect3DVolumeTexture9(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 d3d9_texture_3d_FreePrivateData(IDirect3DVolumeTexture9 *iface, REFGUID guid)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d9_texture *texture = impl_from_IDirect3DVolumeTexture9(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 d3d9_texture_3d_SetPriority(IDirect3DVolumeTexture9 *iface, DWORD priority)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d9_texture *texture = impl_from_IDirect3DVolumeTexture9(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 d3d9_texture_3d_GetPriority(IDirect3DVolumeTexture9 *iface)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d9_texture *texture = impl_from_IDirect3DVolumeTexture9(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 d3d9_texture_3d_PreLoad(IDirect3DVolumeTexture9 *iface)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d9_texture *texture = impl_from_IDirect3DVolumeTexture9(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 d3d9_texture_3d_GetType(IDirect3DVolumeTexture9 *iface)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("iface %p.\n", iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return D3DRTYPE_VOLUMETEXTURE;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic DWORD WINAPI d3d9_texture_3d_SetLOD(IDirect3DVolumeTexture9 *iface, DWORD lod)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d9_texture *texture = impl_from_IDirect3DVolumeTexture9(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 d3d9_texture_3d_GetLOD(IDirect3DVolumeTexture9 *iface)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d9_texture *texture = impl_from_IDirect3DVolumeTexture9(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 d3d9_texture_3d_GetLevelCount(IDirect3DVolumeTexture9 *iface)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d9_texture *texture = impl_from_IDirect3DVolumeTexture9(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 d3d9_texture_3d_SetAutoGenFilterType(IDirect3DVolumeTexture9 *iface,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync D3DTEXTUREFILTERTYPE filter_type)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d9_texture *texture = impl_from_IDirect3DVolumeTexture9(iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync HRESULT hr;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("iface %p, filter_type %#x.\n", iface, filter_type);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_lock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync hr = wined3d_texture_set_autogen_filter_type(texture->wined3d_texture,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync (enum wined3d_texture_filter_type)filter_type);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_unlock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return hr;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic D3DTEXTUREFILTERTYPE WINAPI d3d9_texture_3d_GetAutoGenFilterType(IDirect3DVolumeTexture9 *iface)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d9_texture *texture = impl_from_IDirect3DVolumeTexture9(iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync D3DTEXTUREFILTERTYPE filter_type;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("iface %p.\n", iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_lock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync filter_type = (D3DTEXTUREFILTERTYPE)wined3d_texture_get_autogen_filter_type(texture->wined3d_texture);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_unlock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return filter_type;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic void WINAPI d3d9_texture_3d_GenerateMipSubLevels(IDirect3DVolumeTexture9 *iface)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d9_texture *texture = impl_from_IDirect3DVolumeTexture9(iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync TRACE("iface %p.\n", iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_lock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_texture_generate_mipmaps(texture->wined3d_texture);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_unlock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic HRESULT WINAPI d3d9_texture_3d_GetLevelDesc(IDirect3DVolumeTexture9 *iface, UINT level, D3DVOLUME_DESC *desc)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d9_texture *texture = impl_from_IDirect3DVolumeTexture9(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->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 d3d9_texture_3d_GetVolumeLevel(IDirect3DVolumeTexture9 *iface,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync UINT level, IDirect3DVolume9 **volume)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d9_texture *texture = impl_from_IDirect3DVolumeTexture9(iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct wined3d_resource *sub_resource;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d9_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->IDirect3DVolume9_iface;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync IDirect3DVolume9_AddRef(*volume);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_unlock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return D3D_OK;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic HRESULT WINAPI d3d9_texture_3d_LockBox(IDirect3DVolumeTexture9 *iface,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync UINT level, D3DLOCKED_BOX *locked_box, const D3DBOX *box, DWORD flags)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d9_texture *texture = impl_from_IDirect3DVolumeTexture9(iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct wined3d_resource *sub_resource;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d9_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 = IDirect3DVolume9_LockBox(&volume_impl->IDirect3DVolume9_iface, locked_box, box, flags);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync }
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_unlock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return hr;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic HRESULT WINAPI d3d9_texture_3d_UnlockBox(IDirect3DVolumeTexture9 *iface, UINT level)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d9_texture *texture = impl_from_IDirect3DVolumeTexture9(iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct wined3d_resource *sub_resource;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d9_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 = IDirect3DVolume9_UnlockBox(&volume_impl->IDirect3DVolume9_iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync }
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync wined3d_mutex_unlock();
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return hr;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic HRESULT WINAPI d3d9_texture_3d_AddDirtyBox(IDirect3DVolumeTexture9 *iface, const D3DBOX *dirty_box)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct d3d9_texture *texture = impl_from_IDirect3DVolumeTexture9(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
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic const IDirect3DVolumeTexture9Vtbl d3d9_texture_3d_vtbl =
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync /* IUnknown */
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d9_texture_3d_QueryInterface,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d9_texture_3d_AddRef,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d9_texture_3d_Release,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync /* IDirect3DResource9 */
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d9_texture_3d_GetDevice,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d9_texture_3d_SetPrivateData,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d9_texture_3d_GetPrivateData,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d9_texture_3d_FreePrivateData,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d9_texture_3d_SetPriority,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d9_texture_3d_GetPriority,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d9_texture_3d_PreLoad,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d9_texture_3d_GetType,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync /* IDirect3DBaseTexture9 */
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d9_texture_3d_SetLOD,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d9_texture_3d_GetLOD,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d9_texture_3d_GetLevelCount,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d9_texture_3d_SetAutoGenFilterType,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d9_texture_3d_GetAutoGenFilterType,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d9_texture_3d_GenerateMipSubLevels,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync /* IDirect3DVolumeTexture9 */
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d9_texture_3d_GetLevelDesc,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d9_texture_3d_GetVolumeLevel,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d9_texture_3d_LockBox,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d9_texture_3d_UnlockBox,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d9_texture_3d_AddDirtyBox,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync};
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstruct d3d9_texture *unsafe_impl_from_IDirect3DBaseTexture9(IDirect3DBaseTexture9 *iface)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync if (!iface)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return NULL;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync assert(iface->lpVtbl == (const IDirect3DBaseTexture9Vtbl *)&d3d9_texture_2d_vtbl
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync || iface->lpVtbl == (const IDirect3DBaseTexture9Vtbl *)&d3d9_texture_cube_vtbl
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync || iface->lpVtbl == (const IDirect3DBaseTexture9Vtbl *)&d3d9_texture_3d_vtbl);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return CONTAINING_RECORD(iface, struct d3d9_texture, IDirect3DBaseTexture9_iface);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic void STDMETHODCALLTYPE d3d9_texture_wined3d_object_destroyed(void *parent)
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync HeapFree(GetProcessHeap(), 0, parent);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncstatic const struct wined3d_parent_ops d3d9_texture_wined3d_parent_ops =
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync d3d9_texture_wined3d_object_destroyed,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync};
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncHRESULT texture_init(struct d3d9_texture *texture, struct d3d9_device *device,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync UINT width, UINT height, UINT levels, DWORD usage, D3DFORMAT format, D3DPOOL pool
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#ifdef VBOX_WITH_WDDM
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync , HANDLE *shared_handle
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync , void **pavClientMem
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#endif
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync )
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct wined3d_resource_desc desc;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync DWORD surface_flags = 0;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync HRESULT hr;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync texture->IDirect3DBaseTexture9_iface.lpVtbl = (const IDirect3DBaseTexture9Vtbl *)&d3d9_texture_2d_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, &d3d9_texture_wined3d_parent_ops, &texture->wined3d_texture
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#ifdef VBOX_WITH_WDDM
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync , shared_handle
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync , pavClientMem
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#endif
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync );
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->IDirect3DDevice9Ex_iface;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync IDirect3DDevice9Ex_AddRef(texture->parent_device);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return D3D_OK;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncHRESULT cubetexture_init(struct d3d9_texture *texture, struct d3d9_device *device,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync UINT edge_length, UINT levels, DWORD usage, D3DFORMAT format, D3DPOOL pool
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#ifdef VBOX_WITH_WDDM
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync , HANDLE *shared_handle
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync , void **pavClientMem
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#endif
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync )
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct wined3d_resource_desc desc;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync DWORD surface_flags = 0;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync HRESULT hr;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync texture->IDirect3DBaseTexture9_iface.lpVtbl = (const IDirect3DBaseTexture9Vtbl *)&d3d9_texture_cube_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, &d3d9_texture_wined3d_parent_ops, &texture->wined3d_texture
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#ifdef VBOX_WITH_WDDM
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync , shared_handle
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync , pavClientMem
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#endif
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync );
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->IDirect3DDevice9Ex_iface;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync IDirect3DDevice9Ex_AddRef(texture->parent_device);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return D3D_OK;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsyncHRESULT volumetexture_init(struct d3d9_texture *texture, struct d3d9_device *device,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync UINT width, UINT height, UINT depth, UINT levels, DWORD usage, D3DFORMAT format, D3DPOOL pool
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#ifdef VBOX_WITH_WDDM
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync , HANDLE *shared_handle
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync , void **pavClientMem
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#endif
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync )
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync{
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync struct wined3d_resource_desc desc;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync HRESULT hr;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync texture->IDirect3DBaseTexture9_iface.lpVtbl = (const IDirect3DBaseTexture9Vtbl *)&d3d9_texture_3d_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, &d3d9_texture_wined3d_parent_ops, &texture->wined3d_texture
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#ifdef VBOX_WITH_WDDM
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync , shared_handle
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync , pavClientMem
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync#endif
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync );
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->IDirect3DDevice9Ex_iface;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync IDirect3DDevice9Ex_AddRef(texture->parent_device);
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync return D3D_OK;
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync}