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

Go to the source code of this file.

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (d3d8)
 
static struct d3d8_surface * impl_from_IDirect3DSurface8 (IDirect3DSurface8 *iface)
 
static HRESULT WINAPI d3d8_surface_QueryInterface (IDirect3DSurface8 *iface, REFIID riid, void **out)
 
static ULONG WINAPI d3d8_surface_AddRef (IDirect3DSurface8 *iface)
 
static ULONG WINAPI d3d8_surface_Release (IDirect3DSurface8 *iface)
 
static HRESULT WINAPI d3d8_surface_GetDevice (IDirect3DSurface8 *iface, IDirect3DDevice8 **device)
 
static HRESULT WINAPI d3d8_surface_SetPrivateData (IDirect3DSurface8 *iface, REFGUID guid, const void *data, DWORD data_size, DWORD flags)
 
static HRESULT WINAPI d3d8_surface_GetPrivateData (IDirect3DSurface8 *iface, REFGUID guid, void *data, DWORD *data_size)
 
static HRESULT WINAPI d3d8_surface_FreePrivateData (IDirect3DSurface8 *iface, REFGUID guid)
 
static HRESULT WINAPI d3d8_surface_GetContainer (IDirect3DSurface8 *iface, REFIID riid, void **container)
 
static HRESULT WINAPI d3d8_surface_GetDesc (IDirect3DSurface8 *iface, D3DSURFACE_DESC *desc)
 
static HRESULT WINAPI d3d8_surface_LockRect (IDirect3DSurface8 *iface, D3DLOCKED_RECT *locked_rect, const RECT *rect, DWORD flags)
 
static HRESULT WINAPI d3d8_surface_UnlockRect (IDirect3DSurface8 *iface)
 
static void STDMETHODCALLTYPE surface_wined3d_object_destroyed (void *parent)
 
struct d3d8_surface * d3d8_surface_create (struct wined3d_texture *wined3d_texture, unsigned int sub_resource_idx, IUnknown *container)
 
static void STDMETHODCALLTYPE view_wined3d_object_destroyed (void *parent)
 
struct d3d8_device * d3d8_surface_get_device (const struct d3d8_surface *surface)
 
struct wined3d_rendertarget_view * d3d8_surface_acquire_rendertarget_view (struct d3d8_surface *surface)
 
void d3d8_surface_release_rendertarget_view (struct d3d8_surface *surface, struct wined3d_rendertarget_view *rtv)
 
struct d3d8_surface * unsafe_impl_from_IDirect3DSurface8 (IDirect3DSurface8 *iface)
 

Variables

static const IDirect3DSurface8Vtbl d3d8_surface_vtbl
 
static const struct wined3d_parent_ops d3d8_surface_wined3d_parent_ops
 
static const struct wined3d_parent_ops d3d8_view_wined3d_parent_ops
 

Function Documentation

◆ d3d8_surface_acquire_rendertarget_view()

struct wined3d_rendertarget_view * d3d8_surface_acquire_rendertarget_view ( struct d3d8_surface *  surface)

Definition at line 379 of file surface.c.

380{
381 HRESULT hr;
382
383 /* The surface reference count can be equal to 0 when this function is
384 * called. In order to properly manage the render target view reference
385 * count, we temporarily increment the surface reference count. */
387
388 if (surface->wined3d_rtv)
389 return surface->wined3d_rtv;
390
392 surface->sub_resource_idx, surface, &d3d8_view_wined3d_parent_ops, &surface->wined3d_rtv)))
393 {
394 ERR("Failed to create rendertarget view, hr %#lx.\n", hr);
396 return NULL;
397 }
398
399 if (surface->texture)
400 list_add_head(&surface->texture->rtv_list, &surface->rtv_entry);
401
402 return surface->wined3d_rtv;
403}
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 ULONG WINAPI d3d8_surface_Release(IDirect3DSurface8 *iface)
Definition: surface.c:79
static ULONG WINAPI d3d8_surface_AddRef(IDirect3DSurface8 *iface)
Definition: surface.c:49
static const struct wined3d_parent_ops d3d8_view_wined3d_parent_ops
Definition: surface.c:367
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 d3d8_texture * texture
Definition: d3d8_private.h:198
unsigned int sub_resource_idx
Definition: d3d8_private.h:193
struct list rtv_entry
Definition: d3d8_private.h:194
struct wined3d_rendertarget_view * wined3d_rtv
Definition: d3d8_private.h:195
IDirect3DSurface8 IDirect3DSurface8_iface
Definition: d3d8_private.h:190
struct wined3d_texture * wined3d_texture
Definition: d3d8_private.h:192

Referenced by d3d8_device_SetRenderTarget().

◆ d3d8_surface_AddRef()

static ULONG WINAPI d3d8_surface_AddRef ( IDirect3DSurface8 *  iface)
static

Definition at line 49 of file surface.c.

50{
51 struct d3d8_surface *surface = impl_from_IDirect3DSurface8(iface);
52 ULONG refcount;
53
54 TRACE("iface %p.\n", iface);
55
56 if (surface->texture)
57 {
58 TRACE("Forwarding to %p.\n", surface->texture);
59 return IDirect3DBaseTexture8_AddRef(&surface->texture->IDirect3DBaseTexture8_iface);
60 }
61
62 refcount = InterlockedIncrement(&surface->resource.refcount);
63 TRACE("%p increasing refcount to %lu.\n", iface, refcount);
64
65 if (refcount == 1)
66 {
67 if (surface->parent_device)
69 if (surface->wined3d_rtv)
72 if (surface->swapchain)
74 }
75
76 return refcount;
77}
#define InterlockedIncrement
Definition: armddk.h:53
static struct d3d8_surface * impl_from_IDirect3DSurface8(IDirect3DSurface8 *iface)
Definition: surface.c:25
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 IDirect3DBaseTexture8_AddRef(p)
Definition: d3d8.h:541
#define IDirect3DDevice8_AddRef(p)
Definition: d3d8.h:943
#define TRACE(s)
Definition: solgame.cpp:4
IDirect3DDevice8 * parent_device
Definition: d3d8_private.h:196
struct d3d8_resource resource
Definition: d3d8_private.h:191
struct wined3d_swapchain * swapchain
Definition: d3d8_private.h:199
uint32_t ULONG
Definition: typedefs.h:59
ULONG CDECL wined3d_swapchain_incref(struct wined3d_swapchain *swapchain)
Definition: swapchain.c:135

Referenced by d3d8_surface_acquire_rendertarget_view().

◆ d3d8_surface_create()

struct d3d8_surface * d3d8_surface_create ( struct wined3d_texture *  wined3d_texture,
unsigned int  sub_resource_idx,
IUnknown *  container 
)

Definition at line 318 of file surface.c.

320{
321 IDirect3DBaseTexture8 *texture;
322 struct d3d8_surface *surface;
323
324 if (!(surface = calloc(1, sizeof(*surface))))
325 return NULL;
326
328 d3d8_resource_init(&surface->resource);
329 surface->resource.refcount = 0;
330 list_init(&surface->rtv_entry);
331 surface->container = container;
335
336 if (surface->container && SUCCEEDED(IUnknown_QueryInterface(surface->container,
337 &IID_IDirect3DBaseTexture8, (void **)&texture)))
338 {
341 }
342
345
346 TRACE("Created surface %p.\n", surface);
347 return surface;
348}
static void list_init(struct list_entry *head)
Definition: list.h:51
void d3d8_resource_init(struct d3d8_resource *resource)
Definition: d3d8_main.c:210
struct d3d8_texture * unsafe_impl_from_IDirect3DBaseTexture8(IDirect3DBaseTexture8 *iface)
Definition: texture.c:1017
static const struct wined3d_parent_ops d3d8_surface_wined3d_parent_ops
Definition: surface.c:313
static const IDirect3DSurface8Vtbl d3d8_surface_vtbl
Definition: surface.c:288
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
#define IDirect3DBaseTexture8_Release(p)
Definition: d3d8.h:542
IUnknown * container
Definition: d3d8_private.h:197

Referenced by d3d8_device_create_surface(), d3d8_device_CreateCubeTexture(), d3d8_device_CreateTexture(), d3d8_device_Reset(), and d3d8_swapchain_create().

◆ d3d8_surface_FreePrivateData()

static HRESULT WINAPI d3d8_surface_FreePrivateData ( IDirect3DSurface8 *  iface,
REFGUID  guid 
)
static

Definition at line 157 of file surface.c.

158{
159 struct d3d8_surface *surface = impl_from_IDirect3DSurface8(iface);
160 TRACE("iface %p, guid %s.\n", iface, debugstr_guid(guid));
161
163}
HRESULT d3d8_resource_free_private_data(struct d3d8_resource *resource, const GUID *guid)
Definition: d3d8_main.c:154
GUID guid
Definition: version.c:147
#define debugstr_guid
Definition: kernel32.h:35

◆ d3d8_surface_get_device()

struct d3d8_device * d3d8_surface_get_device ( const struct d3d8_surface *  surface)

Definition at line 372 of file surface.c.

373{
374 IDirect3DDevice8 *device;
375 device = surface->texture ? &surface->texture->parent_device->IDirect3DDevice8_iface : surface->parent_device;
377}
static struct d3d8_device * impl_from_IDirect3DDevice8(IDirect3DDevice8 *iface)
Definition: d3d8_private.h:144
Definition: devices.h:37

Referenced by d3d8_device_SetRenderTarget().

◆ d3d8_surface_GetContainer()

static HRESULT WINAPI d3d8_surface_GetContainer ( IDirect3DSurface8 *  iface,
REFIID  riid,
void **  container 
)
static

Definition at line 165 of file surface.c.

166{
167 struct d3d8_surface *surface = impl_from_IDirect3DSurface8(iface);
168 HRESULT hr;
169
170 TRACE("iface %p, riid %s, container %p.\n", iface, debugstr_guid(riid), container);
171
172 if (!surface->container)
173 return E_NOINTERFACE;
174
175 hr = IUnknown_QueryInterface(surface->container, riid, container);
176
177 TRACE("Returning %p.\n", *container);
178
179 return hr;
180}
REFIID riid
Definition: atlbase.h:39
#define E_NOINTERFACE
Definition: winerror.h:3479

◆ d3d8_surface_GetDesc()

static HRESULT WINAPI d3d8_surface_GetDesc ( IDirect3DSurface8 *  iface,
D3DSURFACE_DESC *  desc 
)
static

Definition at line 182 of file surface.c.

183{
184 struct d3d8_surface *surface = impl_from_IDirect3DSurface8(iface);
185 struct wined3d_sub_resource_desc wined3d_desc;
186
187 TRACE("iface %p, desc %p.\n", iface, desc);
188
192
193 desc->Format = d3dformat_from_wined3dformat(wined3d_desc.format);
194 desc->Type = D3DRTYPE_SURFACE;
195 desc->Usage = d3dusage_from_wined3dusage(wined3d_desc.usage, wined3d_desc.bind_flags);
196 desc->Pool = d3dpool_from_wined3daccess(wined3d_desc.access, wined3d_desc.usage);
197 desc->Size = wined3d_desc.size;
198 desc->MultiSampleType = d3dmultisample_type_from_wined3d(wined3d_desc.multisample_type);
199 desc->Width = wined3d_desc.width;
200 desc->Height = wined3d_desc.height;
201
202 return D3D_OK;
203}
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
void WINAPI wined3d_mutex_unlock(void)
Definition: wined3d_main.c:544
void WINAPI wined3d_mutex_lock(void)
Definition: wined3d_main.c:539

◆ d3d8_surface_GetDevice()

static HRESULT WINAPI d3d8_surface_GetDevice ( IDirect3DSurface8 *  iface,
IDirect3DDevice8 **  device 
)
static

Definition at line 120 of file surface.c.

121{
122 struct d3d8_surface *surface = impl_from_IDirect3DSurface8(iface);
123
124 TRACE("iface %p, device %p.\n", iface, device);
125
126 if (surface->texture)
127 return IDirect3DBaseTexture8_GetDevice(&surface->texture->IDirect3DBaseTexture8_iface, device);
128
129 *device = surface->parent_device;
131
132 TRACE("Returning device %p.\n", *device);
133
134 return D3D_OK;
135}
#define IDirect3DBaseTexture8_GetDevice(p, a)
Definition: d3d8.h:544

◆ d3d8_surface_GetPrivateData()

static HRESULT WINAPI d3d8_surface_GetPrivateData ( IDirect3DSurface8 *  iface,
REFGUID  guid,
void *  data,
DWORD *  data_size 
)
static

Definition at line 147 of file surface.c.

149{
150 struct d3d8_surface *surface = impl_from_IDirect3DSurface8(iface);
151 TRACE("iface %p, guid %s, data %p, data_size %p.\n",
152 iface, debugstr_guid(guid), data, data_size);
153
154 return d3d8_resource_get_private_data(&surface->resource, guid, data, data_size);
155}
HRESULT d3d8_resource_get_private_data(struct d3d8_resource *resource, const GUID *guid, void *data, DWORD *data_size)
Definition: d3d8_main.c:172
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950

◆ d3d8_surface_LockRect()

static HRESULT WINAPI d3d8_surface_LockRect ( IDirect3DSurface8 *  iface,
D3DLOCKED_RECT *  locked_rect,
const RECT *  rect,
DWORD  flags 
)
static

Definition at line 205 of file surface.c.

207{
208 struct d3d8_surface *surface = impl_from_IDirect3DSurface8(iface);
209 struct wined3d_box box;
210 struct wined3d_map_desc map_desc;
211 HRESULT hr;
213
214 TRACE("iface %p, locked_rect %p, rect %s, flags %#lx.\n",
215 iface, locked_rect, wine_dbgstr_rect(rect), flags);
216
218
219 if (surface->texture)
220 type = IDirect3DBaseTexture8_GetType(&surface->texture->IDirect3DBaseTexture8_iface);
221 else
223
224 if (rect)
225 {
228
230 && ((rect->left < 0)
231 || (rect->top < 0)
232 || (rect->left >= rect->right)
233 || (rect->top >= rect->bottom)
234 || (rect->right > desc.Width)
235 || (rect->bottom > desc.Height)))
236 {
237 WARN("Trying to lock an invalid rectangle, returning D3DERR_INVALIDCALL\n");
239
240 locked_rect->Pitch = 0;
241 locked_rect->pBits = NULL;
242 return D3DERR_INVALIDCALL;
243 }
245 }
246
248 &map_desc, rect ? &box : NULL, wined3dmapflags_from_d3dmapflags(flags, 0));
250
251 if (SUCCEEDED(hr))
252 {
253 locked_rect->Pitch = map_desc.row_pitch;
254 locked_rect->pBits = map_desc.data;
255 }
256 else if (type != D3DRTYPE_TEXTURE)
257 {
258 locked_rect->Pitch = 0;
259 locked_rect->pBits = NULL;
260 }
261
262 if (hr == E_INVALIDARG)
263 return D3DERR_INVALIDCALL;
264 return hr;
265}
static const char * wine_dbgstr_rect(const RECT *prc)
Definition: atltest.h:160
#define WARN(fmt,...)
Definition: precomp.h:61
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
enum _D3DRESOURCETYPE D3DRESOURCETYPE
@ D3DRTYPE_TEXTURE
Definition: d3d8types.h:812
#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
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLbitfield flags
Definition: glext.h:7161
#define IDirect3DSurface8_GetDesc(p, a)
Definition: d3d8.h:313
#define IDirect3DBaseTexture8_GetType(p)
Definition: d3d8.h:551
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

◆ d3d8_surface_QueryInterface()

static HRESULT WINAPI d3d8_surface_QueryInterface ( IDirect3DSurface8 *  iface,
REFIID  riid,
void **  out 
)
static

Definition at line 30 of file surface.c.

31{
32 TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out);
33
34 if (IsEqualGUID(riid, &IID_IDirect3DSurface8)
35 || IsEqualGUID(riid, &IID_IDirect3DResource8)
37 {
39 *out = iface;
40 return S_OK;
41 }
42
43 WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid));
44
45 *out = NULL;
46 return E_NOINTERFACE;
47}
const GUID IID_IUnknown
#define S_OK
Definition: intsafe.h:52
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define IDirect3DSurface8_AddRef(p)
Definition: d3d8.h:305
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
Definition: wcsftime.cpp:383

◆ d3d8_surface_Release()

static ULONG WINAPI d3d8_surface_Release ( IDirect3DSurface8 *  iface)
static

Definition at line 79 of file surface.c.

80{
81 struct d3d8_surface *surface = impl_from_IDirect3DSurface8(iface);
82 ULONG refcount;
83
84 TRACE("iface %p.\n", iface);
85
86 if (surface->texture)
87 {
88 TRACE("Forwarding to %p.\n", surface->texture);
89 return IDirect3DBaseTexture8_Release(&surface->texture->IDirect3DBaseTexture8_iface);
90 }
91
92 if (!surface->resource.refcount)
93 {
94 WARN("Surface does not have any references.\n");
95 return 0;
96 }
97
98 refcount = InterlockedDecrement(&surface->resource.refcount);
99 TRACE("%p decreasing refcount to %lu.\n", iface, refcount);
100
101 if (!refcount)
102 {
103 IDirect3DDevice8 *parent_device = surface->parent_device;
104
105 if (surface->wined3d_rtv)
107 if (surface->swapchain)
109 /* Releasing the texture may free the d3d8 object, so do not access it
110 * after releasing the texture. */
112
113 if (parent_device)
115 }
116
117 return refcount;
118}
#define InterlockedDecrement
Definition: armddk.h:52
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
#define IDirect3DDevice8_Release(p)
Definition: d3d8.h:944
ULONG CDECL wined3d_swapchain_decref(struct wined3d_swapchain *swapchain)
Definition: swapchain.c:144

Referenced by d3d8_surface_acquire_rendertarget_view(), and d3d8_surface_release_rendertarget_view().

◆ d3d8_surface_release_rendertarget_view()

void d3d8_surface_release_rendertarget_view ( struct d3d8_surface *  surface,
struct wined3d_rendertarget_view *  rtv 
)

Definition at line 405 of file surface.c.

407{
408 if (rtv)
410}

Referenced by d3d8_device_SetRenderTarget().

◆ d3d8_surface_SetPrivateData()

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

Definition at line 137 of file surface.c.

139{
140 struct d3d8_surface *surface = impl_from_IDirect3DSurface8(iface);
141 TRACE("iface %p, guid %s, data %p, data_size %lu, flags %#lx.\n",
142 iface, debugstr_guid(guid), data, data_size, flags);
143
144 return d3d8_resource_set_private_data(&surface->resource, guid, data, data_size, flags);
145}
HRESULT d3d8_resource_set_private_data(struct d3d8_resource *resource, const GUID *guid, const void *data, DWORD data_size, DWORD flags)
Definition: d3d8_main.c:216

◆ d3d8_surface_UnlockRect()

static HRESULT WINAPI d3d8_surface_UnlockRect ( IDirect3DSurface8 *  iface)
static

Definition at line 267 of file surface.c.

268{
269 struct d3d8_surface *surface = impl_from_IDirect3DSurface8(iface);
270 HRESULT hr;
271
272 TRACE("iface %p.\n", iface);
273
275
276 if (hr == WINEDDERR_NOTLOCKED)
277 {
279 if (surface->texture)
280 type = IDirect3DBaseTexture8_GetType(&surface->texture->IDirect3DBaseTexture8_iface);
281 else
284 }
285 return hr;
286}
HRESULT CDECL wined3d_resource_unmap(struct wined3d_resource *resource, unsigned int sub_resource_idx)
Definition: resource.c:304
#define WINEDDERR_NOTLOCKED
Definition: wined3d.h:46

◆ impl_from_IDirect3DSurface8()

static struct d3d8_surface * impl_from_IDirect3DSurface8 ( IDirect3DSurface8 *  iface)
inlinestatic

◆ surface_wined3d_object_destroyed()

static void STDMETHODCALLTYPE surface_wined3d_object_destroyed ( void *  parent)
static

Definition at line 306 of file surface.c.

307{
308 struct d3d8_surface *surface = parent;
310 free(surface);
311}
void d3d8_resource_cleanup(struct d3d8_resource *resource)
Definition: d3d8_main.c:149
#define free
Definition: debug_ros.c:5
r parent
Definition: btrfs.c:3010

◆ unsafe_impl_from_IDirect3DSurface8()

struct d3d8_surface * unsafe_impl_from_IDirect3DSurface8 ( IDirect3DSurface8 *  iface)

Definition at line 412 of file surface.c.

413{
414 if (!iface)
415 return NULL;
416 assert(iface->lpVtbl == &d3d8_surface_vtbl);
417
418 return impl_from_IDirect3DSurface8(iface);
419}
#define assert(_expr)
Definition: assert.h:32

Referenced by d3d8_device_CopyRects(), d3d8_device_GetFrontBuffer(), d3d8_device_SetCursorProperties(), and d3d8_device_SetRenderTarget().

◆ view_wined3d_object_destroyed()

static void STDMETHODCALLTYPE view_wined3d_object_destroyed ( void *  parent)
static

Definition at line 350 of file surface.c.

351{
352 struct d3d8_surface *surface = parent;
353
354 /* If the surface reference count drops to zero, we release our reference
355 * to the view, but don't clear the pointer yet, in case e.g. a
356 * GetRenderTarget() call brings the surface back before the view is
357 * actually destroyed. When the view is destroyed, we need to clear the
358 * pointer, or a subsequent surface AddRef() would reference it again.
359 *
360 * This is safe because as long as the view still has a reference to the
361 * texture, the surface is also still alive, and we're called before the
362 * view releases that reference. */
363 surface->wined3d_rtv = NULL;
364 list_remove(&surface->rtv_entry);
365}
static void list_remove(struct list_entry *entry)
Definition: list.h:90

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( d3d8  )

Variable Documentation

◆ d3d8_surface_vtbl

const IDirect3DSurface8Vtbl d3d8_surface_vtbl
static
Initial value:
=
{
}
static HRESULT WINAPI d3d8_surface_LockRect(IDirect3DSurface8 *iface, D3DLOCKED_RECT *locked_rect, const RECT *rect, DWORD flags)
Definition: surface.c:205
static HRESULT WINAPI d3d8_surface_SetPrivateData(IDirect3DSurface8 *iface, REFGUID guid, const void *data, DWORD data_size, DWORD flags)
Definition: surface.c:137
static HRESULT WINAPI d3d8_surface_GetPrivateData(IDirect3DSurface8 *iface, REFGUID guid, void *data, DWORD *data_size)
Definition: surface.c:147
static HRESULT WINAPI d3d8_surface_FreePrivateData(IDirect3DSurface8 *iface, REFGUID guid)
Definition: surface.c:157
static HRESULT WINAPI d3d8_surface_QueryInterface(IDirect3DSurface8 *iface, REFIID riid, void **out)
Definition: surface.c:30
static HRESULT WINAPI d3d8_surface_GetDesc(IDirect3DSurface8 *iface, D3DSURFACE_DESC *desc)
Definition: surface.c:182
static HRESULT WINAPI d3d8_surface_UnlockRect(IDirect3DSurface8 *iface)
Definition: surface.c:267
static HRESULT WINAPI d3d8_surface_GetDevice(IDirect3DSurface8 *iface, IDirect3DDevice8 **device)
Definition: surface.c:120
static HRESULT WINAPI d3d8_surface_GetContainer(IDirect3DSurface8 *iface, REFIID riid, void **container)
Definition: surface.c:165

Definition at line 288 of file surface.c.

Referenced by d3d8_surface_create(), and unsafe_impl_from_IDirect3DSurface8().

◆ d3d8_surface_wined3d_parent_ops

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

Definition at line 313 of file surface.c.

Referenced by d3d8_surface_create().

◆ d3d8_view_wined3d_parent_ops

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

Definition at line 367 of file surface.c.

Referenced by d3d8_surface_acquire_rendertarget_view().