ReactOS 0.4.17-dev-966-gf06eace
surface.c File Reference
#include "d3d9_private.h"
Include dependency graph for surface.c:

Go to the source code of this file.

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (d3d9)
 
static struct d3d9_surface * impl_from_IDirect3DSurface9 (IDirect3DSurface9 *iface)
 
static HRESULT WINAPI d3d9_surface_QueryInterface (IDirect3DSurface9 *iface, REFIID riid, void **out)
 
static ULONG WINAPI d3d9_surface_AddRef (IDirect3DSurface9 *iface)
 
static ULONG WINAPI d3d9_surface_Release (IDirect3DSurface9 *iface)
 
static HRESULT WINAPI d3d9_surface_GetDevice (IDirect3DSurface9 *iface, IDirect3DDevice9 **device)
 
static HRESULT WINAPI d3d9_surface_SetPrivateData (IDirect3DSurface9 *iface, REFGUID guid, const void *data, DWORD data_size, DWORD flags)
 
static HRESULT WINAPI d3d9_surface_GetPrivateData (IDirect3DSurface9 *iface, REFGUID guid, void *data, DWORD *data_size)
 
static HRESULT WINAPI d3d9_surface_FreePrivateData (IDirect3DSurface9 *iface, REFGUID guid)
 
static DWORD WINAPI d3d9_surface_SetPriority (IDirect3DSurface9 *iface, DWORD priority)
 
static DWORD WINAPI d3d9_surface_GetPriority (IDirect3DSurface9 *iface)
 
static void WINAPI d3d9_surface_PreLoad (IDirect3DSurface9 *iface)
 
static D3DRESOURCETYPE WINAPI d3d9_surface_GetType (IDirect3DSurface9 *iface)
 
static HRESULT WINAPI d3d9_surface_GetContainer (IDirect3DSurface9 *iface, REFIID riid, void **container)
 
static HRESULT WINAPI d3d9_surface_GetDesc (IDirect3DSurface9 *iface, D3DSURFACE_DESC *desc)
 
static HRESULT WINAPI d3d9_surface_LockRect (IDirect3DSurface9 *iface, D3DLOCKED_RECT *locked_rect, const RECT *rect, DWORD flags)
 
static HRESULT WINAPI d3d9_surface_UnlockRect (IDirect3DSurface9 *iface)
 
static HRESULT WINAPI d3d9_surface_GetDC (IDirect3DSurface9 *iface, HDC *dc)
 
static HRESULT WINAPI d3d9_surface_ReleaseDC (IDirect3DSurface9 *iface, HDC dc)
 
static void STDMETHODCALLTYPE surface_wined3d_object_destroyed (void *parent)
 
struct d3d9_surface * d3d9_surface_create (struct wined3d_texture *wined3d_texture, unsigned int sub_resource_idx, IUnknown *container)
 
static void STDMETHODCALLTYPE view_wined3d_object_destroyed (void *parent)
 
struct d3d9_device * d3d9_surface_get_device (const struct d3d9_surface *surface)
 
struct wined3d_rendertarget_view * d3d9_surface_acquire_rendertarget_view (struct d3d9_surface *surface)
 
void d3d9_surface_release_rendertarget_view (struct d3d9_surface *surface, struct wined3d_rendertarget_view *rtv)
 
struct d3d9_surface * unsafe_impl_from_IDirect3DSurface9 (IDirect3DSurface9 *iface)
 

Variables

static const struct IDirect3DSurface9Vtbl d3d9_surface_vtbl
 
static const struct wined3d_parent_ops d3d9_surface_wined3d_parent_ops
 
static const struct wined3d_parent_ops d3d9_view_wined3d_parent_ops
 

Function Documentation

◆ d3d9_surface_acquire_rendertarget_view()

struct wined3d_rendertarget_view * d3d9_surface_acquire_rendertarget_view ( struct d3d9_surface *  surface)

Definition at line 417 of file surface.c.

418{
419 HRESULT hr;
420
421 /* The surface reference count can be equal to 0 when this function is
422 * called. In order to properly manage the render target view reference
423 * count, we temporarily increment the surface reference count. */
425
426 if (surface->wined3d_rtv)
427 return surface->wined3d_rtv;
428
430 surface->sub_resource_idx, surface, &d3d9_view_wined3d_parent_ops, &surface->wined3d_rtv)))
431 {
432 ERR("Failed to create rendertarget view, hr %#lx.\n", hr);
434 return NULL;
435 }
436
437 if (surface->texture)
438 list_add_head(&surface->texture->rtv_list, &surface->rtv_entry);
439
440 return surface->wined3d_rtv;
441}
static void list_add_head(struct list_entry *head, struct list_entry *entry)
Definition: list.h:76
#define ERR(fmt,...)
Definition: precomp.h:57
HRESULT hr
Definition: delayimp.cpp:582
#define NULL
Definition: types.h:112
static const struct wined3d_parent_ops d3d9_view_wined3d_parent_ops
Definition: surface.c:405
static ULONG WINAPI d3d9_surface_AddRef(IDirect3DSurface9 *iface)
Definition: surface.c:50
static ULONG WINAPI d3d9_surface_Release(IDirect3DSurface9 *iface)
Definition: surface.c:80
HRESULT CDECL wined3d_rendertarget_view_create_from_sub_resource(struct wined3d_texture *texture, unsigned int sub_resource_idx, void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_rendertarget_view **view)
Definition: view.c:946
#define FAILED(hr)
Definition: intsafe.h:51
struct wined3d_texture * wined3d_texture
Definition: d3d9_private.h:172
struct list rtv_entry
Definition: d3d9_private.h:174
IDirect3DSurface9 IDirect3DSurface9_iface
Definition: d3d9_private.h:170
struct wined3d_rendertarget_view * wined3d_rtv
Definition: d3d9_private.h:175
struct d3d9_texture * texture
Definition: d3d9_private.h:178
unsigned int sub_resource_idx
Definition: d3d9_private.h:173

Referenced by d3d9_device_ColorFill(), d3d9_device_SetDepthStencilSurface(), and d3d9_device_SetRenderTarget().

◆ d3d9_surface_AddRef()

static ULONG WINAPI d3d9_surface_AddRef ( IDirect3DSurface9 *  iface)
static

Definition at line 50 of file surface.c.

51{
52 struct d3d9_surface *surface = impl_from_IDirect3DSurface9(iface);
53 ULONG refcount;
54
55 TRACE("iface %p.\n", iface);
56
57 if (surface->texture)
58 {
59 TRACE("Forwarding to %p.\n", surface->texture);
60 return IDirect3DBaseTexture9_AddRef(&surface->texture->IDirect3DBaseTexture9_iface);
61 }
62
63 refcount = InterlockedIncrement(&surface->resource.refcount);
64 TRACE("%p increasing refcount to %lu.\n", iface, refcount);
65
66 if (refcount == 1)
67 {
68 if (surface->parent_device)
70 if (surface->wined3d_rtv)
73 if (surface->swapchain)
75 }
76
77 return refcount;
78}
#define InterlockedIncrement
Definition: armddk.h:53
#define IDirect3DDevice9Ex_AddRef(p)
Definition: d3d9.h:1929
#define IDirect3DBaseTexture9_AddRef(p)
Definition: d3d9.h:662
static struct d3d9_surface * impl_from_IDirect3DSurface9(IDirect3DSurface9 *iface)
Definition: surface.c:26
ULONG CDECL wined3d_texture_incref(struct wined3d_texture *texture)
Definition: texture.c:1516
ULONG CDECL wined3d_rendertarget_view_incref(struct wined3d_rendertarget_view *view)
Definition: view.c:365
#define TRACE(s)
Definition: solgame.cpp:4
IDirect3DDevice9Ex * parent_device
Definition: d3d9_private.h:176
struct wined3d_swapchain * swapchain
Definition: d3d9_private.h:179
struct d3d9_resource resource
Definition: d3d9_private.h:171
uint32_t ULONG
Definition: typedefs.h:59
ULONG CDECL wined3d_swapchain_incref(struct wined3d_swapchain *swapchain)
Definition: swapchain.c:135

Referenced by d3d9_surface_acquire_rendertarget_view().

◆ d3d9_surface_create()

struct d3d9_surface * d3d9_surface_create ( struct wined3d_texture *  wined3d_texture,
unsigned int  sub_resource_idx,
IUnknown *  container 
)

Definition at line 356 of file surface.c.

358{
359 IDirect3DBaseTexture9 *texture;
360 struct d3d9_surface *surface;
361
362 if (!(surface = calloc(1, sizeof(*surface))))
363 return NULL;
364
366 d3d9_resource_init(&surface->resource);
367 surface->resource.refcount = 0;
368 list_init(&surface->rtv_entry);
369 surface->container = container;
373
374 if (surface->container && SUCCEEDED(IUnknown_QueryInterface(surface->container,
375 &IID_IDirect3DBaseTexture9, (void **)&texture)))
376 {
379 }
380
383
384 TRACE("Created surface %p.\n", surface);
385 return surface;
386}
static void list_init(struct list_entry *head)
Definition: list.h:51
#define IDirect3DBaseTexture9_Release(p)
Definition: d3d9.h:663
void d3d9_resource_init(struct d3d9_resource *resource)
Definition: d3d9_main.c:345
static const struct IDirect3DSurface9Vtbl d3d9_surface_vtbl
Definition: surface.c:320
static const struct wined3d_parent_ops d3d9_surface_wined3d_parent_ops
Definition: surface.c:351
struct wined3d_swapchain *CDECL wined3d_texture_get_swapchain(struct wined3d_texture *texture)
Definition: texture.c:4028
void CDECL wined3d_texture_set_sub_resource_parent(struct wined3d_texture *texture, unsigned int sub_resource_idx, void *parent, const struct wined3d_parent_ops *parent_ops)
Definition: texture.c:4043
GLenum GLuint texture
Definition: glext.h:6295
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define calloc
Definition: rosglue.h:14
IUnknown * container
Definition: d3d9_private.h:177
struct d3d9_texture * unsafe_impl_from_IDirect3DBaseTexture9(IDirect3DBaseTexture9 *iface)
Definition: texture.c:1204

Referenced by d3d9_device_create_surface(), d3d9_device_CreateCubeTexture(), d3d9_device_CreateTexture(), d3d9_device_reset(), and d3d9_swapchain_create().

◆ d3d9_surface_FreePrivateData()

static HRESULT WINAPI d3d9_surface_FreePrivateData ( IDirect3DSurface9 *  iface,
REFGUID  guid 
)
static

Definition at line 159 of file surface.c.

160{
161 struct d3d9_surface *surface = impl_from_IDirect3DSurface9(iface);
162 TRACE("iface %p, guid %s.\n", iface, debugstr_guid(guid));
163
165}
HRESULT d3d9_resource_free_private_data(struct d3d9_resource *resource, const GUID *guid)
Definition: d3d9_main.c:289
GUID guid
Definition: version.c:147
#define debugstr_guid
Definition: kernel32.h:35

◆ d3d9_surface_get_device()

struct d3d9_device * d3d9_surface_get_device ( const struct d3d9_surface *  surface)

Definition at line 410 of file surface.c.

411{
413 device = surface->texture ? &surface->texture->parent_device->IDirect3DDevice9Ex_iface : surface->parent_device;
415}
DWORD IDirect3DDevice9Ex
Definition: dxvahd.idl:22
Definition: devices.h:37
static struct d3d9_device * impl_from_IDirect3DDevice9Ex(IDirect3DDevice9Ex *iface)
Definition: d3d9_private.h:310

Referenced by d3d9_device_SetRenderTarget().

◆ d3d9_surface_GetContainer()

static HRESULT WINAPI d3d9_surface_GetContainer ( IDirect3DSurface9 *  iface,
REFIID  riid,
void **  container 
)
static

Definition at line 197 of file surface.c.

198{
199 struct d3d9_surface *surface = impl_from_IDirect3DSurface9(iface);
200 HRESULT hr;
201
202 TRACE("iface %p, riid %s, container %p.\n", iface, debugstr_guid(riid), container);
203
204 if (!surface->container)
205 return E_NOINTERFACE;
206
207 hr = IUnknown_QueryInterface(surface->container, riid, container);
208
209 TRACE("Returning %p.\n", *container);
210
211 return hr;
212}
REFIID riid
Definition: atlbase.h:39
#define E_NOINTERFACE
Definition: winerror.h:3479

◆ d3d9_surface_GetDC()

static HRESULT WINAPI d3d9_surface_GetDC ( IDirect3DSurface9 *  iface,
HDC *  dc 
)
static

Definition at line 290 of file surface.c.

291{
292 struct d3d9_surface *surface = impl_from_IDirect3DSurface9(iface);
293 HRESULT hr;
294
295 TRACE("iface %p, dc %p.\n", iface, dc);
296
300
301 return hr;
302}
HDC dc
Definition: cylfrac.c:34
HRESULT CDECL wined3d_texture_get_dc(struct wined3d_texture *texture, unsigned int sub_resource_idx, HDC *dc)
Definition: texture.c:4243
void WINAPI wined3d_mutex_unlock(void)
Definition: wined3d_main.c:544
void WINAPI wined3d_mutex_lock(void)
Definition: wined3d_main.c:539

◆ d3d9_surface_GetDesc()

static HRESULT WINAPI d3d9_surface_GetDesc ( IDirect3DSurface9 *  iface,
D3DSURFACE_DESC *  desc 
)
static

Definition at line 214 of file surface.c.

215{
216 struct d3d9_surface *surface = impl_from_IDirect3DSurface9(iface);
217 struct wined3d_sub_resource_desc wined3d_desc;
218
219 TRACE("iface %p, desc %p.\n", iface, desc);
220
224
225 desc->Format = d3dformat_from_wined3dformat(wined3d_desc.format);
226 desc->Type = D3DRTYPE_SURFACE;
227 desc->Usage = d3dusage_from_wined3dusage(wined3d_desc.usage, wined3d_desc.bind_flags);
228 desc->Pool = d3dpool_from_wined3daccess(wined3d_desc.access, wined3d_desc.usage);
229 desc->MultiSampleType = d3dmultisample_type_from_wined3d(wined3d_desc.multisample_type);
230 desc->MultiSampleQuality = wined3d_desc.multisample_quality;
231 desc->Width = wined3d_desc.width;
232 desc->Height = wined3d_desc.height;
233
234 return D3D_OK;
235}
static DWORD d3dusage_from_wined3dusage(unsigned int wined3d_usage, unsigned int bind_flags)
Definition: d3d8_private.h:305
D3DFORMAT d3dformat_from_wined3dformat(enum wined3d_format_id format)
Definition: device.c:33
static D3DMULTISAMPLE_TYPE d3dmultisample_type_from_wined3d(enum wined3d_multisample_type type)
Definition: d3d8_private.h:387
static D3DPOOL d3dpool_from_wined3daccess(unsigned int access, unsigned int usage)
Definition: d3d8_private.h:315
@ D3DRTYPE_SURFACE
Definition: d3d8types.h:810
#define D3D_OK
Definition: d3d.h:106
HRESULT CDECL wined3d_texture_get_sub_resource_desc(const struct wined3d_texture *texture, unsigned int sub_resource_idx, struct wined3d_sub_resource_desc *desc)
Definition: texture.c:4055
D3D11_SHADER_VARIABLE_DESC desc
Definition: reflection.c:1683

◆ d3d9_surface_GetDevice()

static HRESULT WINAPI d3d9_surface_GetDevice ( IDirect3DSurface9 *  iface,
IDirect3DDevice9 **  device 
)
static

Definition at line 122 of file surface.c.

123{
124 struct d3d9_surface *surface = impl_from_IDirect3DSurface9(iface);
125
126 TRACE("iface %p, device %p.\n", iface, device);
127
128 if (surface->texture)
129 return IDirect3DBaseTexture9_GetDevice(&surface->texture->IDirect3DBaseTexture9_iface, device);
130
133
134 TRACE("Returning device %p.\n", *device);
135
136 return D3D_OK;
137}
#define IDirect3DBaseTexture9_GetDevice(p, a)
Definition: d3d9.h:665
#define IDirect3DDevice9_AddRef(p)
Definition: d3d9.h:1335
DWORD IDirect3DDevice9
Definition: dxva2api.idl:22

◆ d3d9_surface_GetPriority()

static DWORD WINAPI d3d9_surface_GetPriority ( IDirect3DSurface9 *  iface)
static

Definition at line 173 of file surface.c.

174{
175 TRACE("iface %p. Ignored on surfaces.\n", iface);
176 return 0;
177}

◆ d3d9_surface_GetPrivateData()

static HRESULT WINAPI d3d9_surface_GetPrivateData ( IDirect3DSurface9 *  iface,
REFGUID  guid,
void *  data,
DWORD *  data_size 
)
static

Definition at line 149 of file surface.c.

151{
152 struct d3d9_surface *surface = impl_from_IDirect3DSurface9(iface);
153 TRACE("iface %p, guid %s, data %p, data_size %p.\n",
154 iface, debugstr_guid(guid), data, data_size);
155
156 return d3d9_resource_get_private_data(&surface->resource, guid, data, data_size);
157}
HRESULT d3d9_resource_get_private_data(struct d3d9_resource *resource, const GUID *guid, void *data, DWORD *data_size)
Definition: d3d9_main.c:307
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950

◆ d3d9_surface_GetType()

static D3DRESOURCETYPE WINAPI d3d9_surface_GetType ( IDirect3DSurface9 *  iface)
static

Definition at line 190 of file surface.c.

191{
192 TRACE("iface %p.\n", iface);
193
194 return D3DRTYPE_SURFACE;
195}

◆ d3d9_surface_LockRect()

static HRESULT WINAPI d3d9_surface_LockRect ( IDirect3DSurface9 *  iface,
D3DLOCKED_RECT *  locked_rect,
const RECT *  rect,
DWORD  flags 
)
static

Definition at line 237 of file surface.c.

239{
240 struct d3d9_surface *surface = impl_from_IDirect3DSurface9(iface);
241 struct wined3d_box box;
242 struct wined3d_map_desc map_desc;
243 HRESULT hr;
244
245 TRACE("iface %p, locked_rect %p, rect %s, flags %#lx.\n",
246 iface, locked_rect, wine_dbgstr_rect(rect), flags);
247
248 if (rect)
250
252 &map_desc, rect ? &box : NULL, wined3dmapflags_from_d3dmapflags(flags, 0));
253
254 if (SUCCEEDED(hr))
255 {
256 locked_rect->Pitch = map_desc.row_pitch;
257 locked_rect->pBits = map_desc.data;
258 }
259
260 if (hr == E_INVALIDARG)
261 return D3DERR_INVALIDCALL;
262 return hr;
263}
static const char * wine_dbgstr_rect(const RECT *prc)
Definition: atltest.h:160
RECT rect
Definition: combotst.c:67
#define D3DERR_INVALIDCALL
Definition: d3d10_private.h:42
unsigned int wined3dmapflags_from_d3dmapflags(unsigned int flags, unsigned int usage)
Definition: device.c:135
#define E_INVALIDARG
Definition: ddrawi.h:101
HRESULT CDECL wined3d_resource_map(struct wined3d_resource *resource, unsigned int sub_resource_idx, struct wined3d_map_desc *map_desc, const struct wined3d_box *box, uint32_t flags)
Definition: resource.c:295
struct wined3d_resource *CDECL wined3d_texture_get_resource(struct wined3d_texture *texture)
Definition: texture.c:1649
GLbitfield flags
Definition: glext.h:7161
long bottom
Definition: dcommon.idl:29
long right
Definition: dcommon.idl:29
long left
Definition: dcommon.idl:29
long top
Definition: dcommon.idl:29
Definition: palette.c:466
static void wined3d_box_set(struct wined3d_box *box, unsigned int left, unsigned int top, unsigned int right, unsigned int bottom, unsigned int front, unsigned int back)
Definition: wined3d.h:3006

◆ d3d9_surface_PreLoad()

static void WINAPI d3d9_surface_PreLoad ( IDirect3DSurface9 *  iface)
static

Definition at line 179 of file surface.c.

180{
181 struct d3d9_surface *surface = impl_from_IDirect3DSurface9(iface);
182
183 TRACE("iface %p.\n", iface);
184
188}
void CDECL wined3d_resource_preload(struct wined3d_resource *resource)
Definition: resource.c:311

◆ d3d9_surface_QueryInterface()

static HRESULT WINAPI d3d9_surface_QueryInterface ( IDirect3DSurface9 *  iface,
REFIID  riid,
void **  out 
)
static

Definition at line 31 of file surface.c.

32{
33 TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out);
34
35 if (IsEqualGUID(riid, &IID_IDirect3DSurface9)
36 || IsEqualGUID(riid, &IID_IDirect3DResource9)
38 {
40 *out = iface;
41 return S_OK;
42 }
43
44 WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid));
45
46 *out = NULL;
47 return E_NOINTERFACE;
48}
#define WARN(fmt,...)
Definition: precomp.h:61
const GUID IID_IUnknown
#define IDirect3DSurface9_AddRef(p)
Definition: d3d9.h:449
#define S_OK
Definition: intsafe.h:52
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
Definition: wcsftime.cpp:383

◆ d3d9_surface_Release()

static ULONG WINAPI d3d9_surface_Release ( IDirect3DSurface9 *  iface)
static

Definition at line 80 of file surface.c.

81{
82 struct d3d9_surface *surface = impl_from_IDirect3DSurface9(iface);
83 ULONG refcount;
84
85 TRACE("iface %p.\n", iface);
86
87 if (surface->texture)
88 {
89 TRACE("Forwarding to %p.\n", surface->texture);
90 return IDirect3DBaseTexture9_Release(&surface->texture->IDirect3DBaseTexture9_iface);
91 }
92
93 if (!surface->resource.refcount)
94 {
95 WARN("Surface does not have any references.\n");
96 return 0;
97 }
98
99 refcount = InterlockedDecrement(&surface->resource.refcount);
100 TRACE("%p decreasing refcount to %lu.\n", iface, refcount);
101
102 if (!refcount)
103 {
105
106 if (surface->wined3d_rtv)
108 if (surface->swapchain)
110 /* Releasing the texture may free the d3d9 object, so do not access it
111 * after releasing the texture. */
113
114 /* Release the device last, as it may cause the device to be destroyed. */
115 if (parent_device)
117 }
118
119 return refcount;
120}
#define InterlockedDecrement
Definition: armddk.h:52
#define IDirect3DDevice9Ex_Release(p)
Definition: d3d9.h:1930
ULONG CDECL wined3d_texture_decref(struct wined3d_texture *texture)
Definition: texture.c:1606
ULONG CDECL wined3d_rendertarget_view_decref(struct wined3d_rendertarget_view *view)
Definition: view.c:379
ULONG CDECL wined3d_swapchain_decref(struct wined3d_swapchain *swapchain)
Definition: swapchain.c:144

Referenced by d3d9_surface_acquire_rendertarget_view(), and d3d9_surface_release_rendertarget_view().

◆ d3d9_surface_release_rendertarget_view()

void d3d9_surface_release_rendertarget_view ( struct d3d9_surface *  surface,
struct wined3d_rendertarget_view *  rtv 
)

Definition at line 443 of file surface.c.

445{
446 if (rtv)
448}

Referenced by d3d9_device_ColorFill(), d3d9_device_SetDepthStencilSurface(), and d3d9_device_SetRenderTarget().

◆ d3d9_surface_ReleaseDC()

static HRESULT WINAPI d3d9_surface_ReleaseDC ( IDirect3DSurface9 *  iface,
HDC  dc 
)
static

Definition at line 304 of file surface.c.

305{
306 struct d3d9_surface *surface = impl_from_IDirect3DSurface9(iface);
307 HRESULT hr;
308
309 TRACE("iface %p, dc %p.\n", iface, dc);
310
313 if (SUCCEEDED(hr) && surface->texture)
316
317 return hr;
318}
HRESULT CDECL wined3d_texture_release_dc(struct wined3d_texture *texture, unsigned int sub_resource_idx, HDC dc)
Definition: texture.c:4291
void d3d9_texture_flag_auto_gen_mipmap(struct d3d9_texture *texture)
Definition: texture.c:106

◆ d3d9_surface_SetPriority()

static DWORD WINAPI d3d9_surface_SetPriority ( IDirect3DSurface9 *  iface,
DWORD  priority 
)
static

Definition at line 167 of file surface.c.

168{
169 TRACE("iface %p, priority %lu. Ignored on surfaces.\n", iface, priority);
170 return 0;
171}
static int priority
Definition: timer.c:163

◆ d3d9_surface_SetPrivateData()

static HRESULT WINAPI d3d9_surface_SetPrivateData ( IDirect3DSurface9 *  iface,
REFGUID  guid,
const void *  data,
DWORD  data_size,
DWORD  flags 
)
static

Definition at line 139 of file surface.c.

141{
142 struct d3d9_surface *surface = impl_from_IDirect3DSurface9(iface);
143 TRACE("iface %p, guid %s, data %p, data_size %lu, flags %#lx.\n",
144 iface, debugstr_guid(guid), data, data_size, flags);
145
146 return d3d9_resource_set_private_data(&surface->resource, guid, data, data_size, flags);
147}
HRESULT d3d9_resource_set_private_data(struct d3d9_resource *resource, const GUID *guid, const void *data, DWORD data_size, DWORD flags)
Definition: d3d9_main.c:351

◆ d3d9_surface_UnlockRect()

static HRESULT WINAPI d3d9_surface_UnlockRect ( IDirect3DSurface9 *  iface)
static

Definition at line 265 of file surface.c.

266{
267 struct d3d9_surface *surface = impl_from_IDirect3DSurface9(iface);
268 HRESULT hr;
269
270 TRACE("iface %p.\n", iface);
271
274 if (SUCCEEDED(hr) && surface->texture)
277
278 if (hr == WINEDDERR_NOTLOCKED)
279 {
281 if (surface->texture)
282 type = IDirect3DBaseTexture9_GetType(&surface->texture->IDirect3DBaseTexture9_iface);
283 else
286 }
287 return hr;
288}
enum _D3DRESOURCETYPE D3DRESOURCETYPE
@ D3DRTYPE_TEXTURE
Definition: d3d8types.h:812
#define IDirect3DBaseTexture9_GetType(p)
Definition: d3d9.h:672
HRESULT CDECL wined3d_resource_unmap(struct wined3d_resource *resource, unsigned int sub_resource_idx)
Definition: resource.c:304
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define WINEDDERR_NOTLOCKED
Definition: wined3d.h:46

◆ impl_from_IDirect3DSurface9()

◆ surface_wined3d_object_destroyed()

static void STDMETHODCALLTYPE surface_wined3d_object_destroyed ( void *  parent)
static

Definition at line 344 of file surface.c.

345{
346 struct d3d9_surface *surface = parent;
348 free(surface);
349}
void d3d9_resource_cleanup(struct d3d9_resource *resource)
Definition: d3d9_main.c:284
#define free
Definition: debug_ros.c:5
r parent
Definition: btrfs.c:3010

◆ unsafe_impl_from_IDirect3DSurface9()

◆ view_wined3d_object_destroyed()

static void STDMETHODCALLTYPE view_wined3d_object_destroyed ( void *  parent)
static

Definition at line 388 of file surface.c.

389{
390 struct d3d9_surface *surface = parent;
391
392 /* If the surface reference count drops to zero, we release our reference
393 * to the view, but don't clear the pointer yet, in case e.g. a
394 * GetRenderTarget() call brings the surface back before the view is
395 * actually destroyed. When the view is destroyed, we need to clear the
396 * pointer, or a subsequent surface AddRef() would reference it again.
397 *
398 * This is safe because as long as the view still has a reference to the
399 * texture, the surface is also still alive, and we're called before the
400 * view releases that reference. */
401 surface->wined3d_rtv = NULL;
402 list_remove(&surface->rtv_entry);
403}
static void list_remove(struct list_entry *entry)
Definition: list.h:90

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( d3d9  )

Variable Documentation

◆ d3d9_surface_vtbl

const struct IDirect3DSurface9Vtbl d3d9_surface_vtbl
static
Initial value:
=
{
}
static D3DRESOURCETYPE WINAPI d3d9_surface_GetType(IDirect3DSurface9 *iface)
Definition: surface.c:190
static HRESULT WINAPI d3d9_surface_GetPrivateData(IDirect3DSurface9 *iface, REFGUID guid, void *data, DWORD *data_size)
Definition: surface.c:149
static HRESULT WINAPI d3d9_surface_GetDesc(IDirect3DSurface9 *iface, D3DSURFACE_DESC *desc)
Definition: surface.c:214
static HRESULT WINAPI d3d9_surface_GetDC(IDirect3DSurface9 *iface, HDC *dc)
Definition: surface.c:290
static HRESULT WINAPI d3d9_surface_QueryInterface(IDirect3DSurface9 *iface, REFIID riid, void **out)
Definition: surface.c:31
static HRESULT WINAPI d3d9_surface_GetDevice(IDirect3DSurface9 *iface, IDirect3DDevice9 **device)
Definition: surface.c:122
static HRESULT WINAPI d3d9_surface_LockRect(IDirect3DSurface9 *iface, D3DLOCKED_RECT *locked_rect, const RECT *rect, DWORD flags)
Definition: surface.c:237
static HRESULT WINAPI d3d9_surface_SetPrivateData(IDirect3DSurface9 *iface, REFGUID guid, const void *data, DWORD data_size, DWORD flags)
Definition: surface.c:139
static DWORD WINAPI d3d9_surface_SetPriority(IDirect3DSurface9 *iface, DWORD priority)
Definition: surface.c:167
static void WINAPI d3d9_surface_PreLoad(IDirect3DSurface9 *iface)
Definition: surface.c:179
static HRESULT WINAPI d3d9_surface_FreePrivateData(IDirect3DSurface9 *iface, REFGUID guid)
Definition: surface.c:159
static HRESULT WINAPI d3d9_surface_UnlockRect(IDirect3DSurface9 *iface)
Definition: surface.c:265
static HRESULT WINAPI d3d9_surface_GetContainer(IDirect3DSurface9 *iface, REFIID riid, void **container)
Definition: surface.c:197
static HRESULT WINAPI d3d9_surface_ReleaseDC(IDirect3DSurface9 *iface, HDC dc)
Definition: surface.c:304
static DWORD WINAPI d3d9_surface_GetPriority(IDirect3DSurface9 *iface)
Definition: surface.c:173

Definition at line 320 of file surface.c.

Referenced by d3d9_surface_create(), and unsafe_impl_from_IDirect3DSurface9().

◆ d3d9_surface_wined3d_parent_ops

const struct wined3d_parent_ops d3d9_surface_wined3d_parent_ops
static
Initial value:
=
{
}
static void STDMETHODCALLTYPE surface_wined3d_object_destroyed(void *parent)
Definition: surface.c:306

Definition at line 351 of file surface.c.

Referenced by d3d9_surface_create().

◆ d3d9_view_wined3d_parent_ops

const struct wined3d_parent_ops d3d9_view_wined3d_parent_ops
static
Initial value:
=
{
}
static void STDMETHODCALLTYPE view_wined3d_object_destroyed(void *parent)
Definition: surface.c:350

Definition at line 405 of file surface.c.

Referenced by d3d9_surface_acquire_rendertarget_view().