Commit c796f764 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Add IWineD3DRendertargetView.

parent 6ace799f
......@@ -37,6 +37,7 @@ C_SRCS = \
utils.c \
vertexdeclaration.c \
vertexshader.c \
view.c \
volume.c \
volumetexture.c \
wined3d_main.c
......
......@@ -793,6 +793,29 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateSurface(IWineD3DDevice *iface, U
return hr;
}
static HRESULT WINAPI IWineD3DDeviceImpl_CreateRendertargetView(IWineD3DDevice *iface,
IWineD3DResource *resource, IUnknown *parent, IWineD3DRendertargetView **rendertarget_view)
{
struct wined3d_rendertarget_view *object;
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
if (!object)
{
ERR("Failed to allocate memory\n");
return E_OUTOFMEMORY;
}
object->vtbl = &wined3d_rendertarget_view_vtbl;
object->refcount = 1;
IWineD3DResource_AddRef(resource);
object->resource = resource;
object->parent = parent;
*rendertarget_view = (IWineD3DRendertargetView *)object;
return WINED3D_OK;
}
static HRESULT WINAPI IWineD3DDeviceImpl_CreateTexture(IWineD3DDevice *iface,
UINT Width, UINT Height, UINT Levels, DWORD Usage, WINED3DFORMAT Format, WINED3DPOOL Pool,
IWineD3DTexture **ppTexture, HANDLE *pSharedHandle, IUnknown *parent)
......@@ -7575,6 +7598,7 @@ const IWineD3DDeviceVtbl IWineD3DDevice_Vtbl =
IWineD3DDeviceImpl_CreateIndexBuffer,
IWineD3DDeviceImpl_CreateStateBlock,
IWineD3DDeviceImpl_CreateSurface,
IWineD3DDeviceImpl_CreateRendertargetView,
IWineD3DDeviceImpl_CreateTexture,
IWineD3DDeviceImpl_CreateVolumeTexture,
IWineD3DDeviceImpl_CreateVolume,
......
/*
* Copyright 2009 Henri Verbeet for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*
*/
#include "config.h"
#include "wine/port.h"
#include "wined3d_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d);
/* IUnknown methods */
static HRESULT STDMETHODCALLTYPE rendertarget_view_QueryInterface(IWineD3DRendertargetView *iface,
REFIID riid, void **object)
{
TRACE("iface %p, riid %s, object %p\n", iface, debugstr_guid(riid), object);
if (IsEqualGUID(riid, &IID_IWineD3DRendertargetView)
|| IsEqualGUID(riid, &IID_IWineD3DBase)
|| IsEqualGUID(riid, &IID_IUnknown))
{
IUnknown_AddRef(iface);
*object = iface;
return S_OK;
}
WARN("%s not implemented, returning E_NOINTERFACE\n", debugstr_guid(riid));
*object = NULL;
return E_NOINTERFACE;
}
static ULONG STDMETHODCALLTYPE rendertarget_view_AddRef(IWineD3DRendertargetView *iface)
{
struct wined3d_rendertarget_view *This = (struct wined3d_rendertarget_view *)iface;
ULONG refcount = InterlockedIncrement(&This->refcount);
TRACE("%p increasing refcount to %u\n", This, refcount);
return refcount;
}
static ULONG STDMETHODCALLTYPE rendertarget_view_Release(IWineD3DRendertargetView *iface)
{
struct wined3d_rendertarget_view *This = (struct wined3d_rendertarget_view *)iface;
ULONG refcount = InterlockedDecrement(&This->refcount);
TRACE("%p decreasing refcount to %u\n", This, refcount);
if (!refcount)
{
IWineD3DResource_Release(This->resource);
HeapFree(GetProcessHeap(), 0, This);
}
return refcount;
}
/* IWineD3DBase methods */
static HRESULT STDMETHODCALLTYPE rendertarget_view_GetParent(IWineD3DRendertargetView *iface, IUnknown **parent)
{
struct wined3d_rendertarget_view *This = (struct wined3d_rendertarget_view *)iface;
IUnknown_AddRef(This->parent);
*parent = This->parent;
return WINED3D_OK;
}
/* IWineD3DRendertargetView methods */
static HRESULT STDMETHODCALLTYPE rendertarget_view_GetResource(IWineD3DRendertargetView *iface,
IWineD3DResource **resource)
{
struct wined3d_rendertarget_view *This = (struct wined3d_rendertarget_view *)iface;
IWineD3DResource_AddRef(This->resource);
*resource = This->resource;
return WINED3D_OK;
}
const struct IWineD3DRendertargetViewVtbl wined3d_rendertarget_view_vtbl =
{
/* IUnknown methods */
rendertarget_view_QueryInterface,
rendertarget_view_AddRef,
rendertarget_view_Release,
/* IWineD3DBase methods */
rendertarget_view_GetParent,
/* IWineD3DRendertargetView methods */
rendertarget_view_GetResource,
};
......@@ -1985,6 +1985,18 @@ struct wined3d_buffer
extern const IWineD3DBufferVtbl wined3d_buffer_vtbl;
/* IWineD3DRendertargetView */
struct wined3d_rendertarget_view
{
const struct IWineD3DRendertargetViewVtbl *vtbl;
LONG refcount;
IWineD3DResource *resource;
IUnknown *parent;
};
extern const IWineD3DRendertargetViewVtbl wined3d_rendertarget_view_vtbl;
/*****************************************************************************
* IWineD3DSwapChainImpl implementation structure (extends IUnknown)
*/
......
......@@ -2396,6 +2396,18 @@ interface IWineD3DResource : IWineD3DBase
[
object,
local,
uuid(f7d8abf4-fb93-43e4-9c96-4618cf9b3cbc)
]
interface IWineD3DRendertargetView : IWineD3DBase
{
HRESULT GetResource(
[out] IWineD3DResource **resource
);
}
[
object,
local,
uuid(217f671e-6f30-11d9-c687-00046142c14f)
]
interface IWineD3DVertexBuffer : IWineD3DResource
......@@ -3012,6 +3024,11 @@ interface IWineD3DDevice : IWineD3DBase
[in] WINED3DSURFTYPE surface_type,
[in] IUnknown *parent
);
HRESULT CreateRendertargetView(
[in] IWineD3DResource *resource,
[in] IUnknown *parent,
[out] IWineD3DRendertargetView **rendertarget_view
);
HRESULT CreateTexture(
[in] UINT width,
[in] UINT height,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment