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

Go to the source code of this file.

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (d3d9)
 
static DWORD d3dpresentationinterval_from_wined3dswapinterval (enum wined3d_swap_interval interval)
 
static struct d3d9_swapchain * impl_from_IDirect3DSwapChain9Ex (IDirect3DSwapChain9Ex *iface)
 
static HRESULT WINAPI d3d9_swapchain_QueryInterface (IDirect3DSwapChain9Ex *iface, REFIID riid, void **out)
 
static ULONG WINAPI d3d9_swapchain_AddRef (IDirect3DSwapChain9Ex *iface)
 
static ULONG WINAPI d3d9_swapchain_Release (IDirect3DSwapChain9Ex *iface)
 
static HRESULT WINAPI DECLSPEC_HOTPATCH d3d9_swapchain_Present (IDirect3DSwapChain9Ex *iface, const RECT *src_rect, const RECT *dst_rect, HWND dst_window_override, const RGNDATA *dirty_region, DWORD flags)
 
static HRESULT WINAPI d3d9_swapchain_GetFrontBufferData (IDirect3DSwapChain9Ex *iface, IDirect3DSurface9 *surface)
 
static HRESULT WINAPI d3d9_swapchain_GetBackBuffer (IDirect3DSwapChain9Ex *iface, UINT backbuffer_idx, D3DBACKBUFFER_TYPE backbuffer_type, IDirect3DSurface9 **backbuffer)
 
static HRESULT WINAPI d3d9_swapchain_GetRasterStatus (IDirect3DSwapChain9Ex *iface, D3DRASTER_STATUS *raster_status)
 
static HRESULT WINAPI d3d9_swapchain_GetDisplayMode (IDirect3DSwapChain9Ex *iface, D3DDISPLAYMODE *mode)
 
static HRESULT WINAPI d3d9_swapchain_GetDevice (IDirect3DSwapChain9Ex *iface, IDirect3DDevice9 **device)
 
static HRESULT WINAPI d3d9_swapchain_GetPresentParameters (IDirect3DSwapChain9Ex *iface, D3DPRESENT_PARAMETERS *parameters)
 
static HRESULT WINAPI d3d9_swapchain_GetLastPresentCount (IDirect3DSwapChain9Ex *iface, UINT *last_present_count)
 
static HRESULT WINAPI d3d9_swapchain_GetPresentStatistics (IDirect3DSwapChain9Ex *iface, D3DPRESENTSTATS *present_stats)
 
static HRESULT WINAPI d3d9_swapchain_GetDisplayModeEx (IDirect3DSwapChain9Ex *iface, D3DDISPLAYMODEEX *mode, D3DDISPLAYROTATION *rotation)
 
static void STDMETHODCALLTYPE d3d9_swapchain_wined3d_object_released (void *parent)
 
static void CDECL d3d9_swapchain_windowed_state_changed (struct wined3d_swapchain_state_parent *parent, BOOL windowed)
 
static HRESULT swapchain_init (struct d3d9_swapchain *swapchain, struct d3d9_device *device, struct wined3d_swapchain_desc *desc, unsigned int swap_interval)
 
HRESULT d3d9_swapchain_create (struct d3d9_device *device, struct wined3d_swapchain_desc *desc, unsigned int swap_interval, struct d3d9_swapchain **swapchain)
 

Variables

static const struct IDirect3DSwapChain9ExVtbl d3d9_swapchain_vtbl
 
static const struct wined3d_parent_ops d3d9_swapchain_wined3d_parent_ops
 
static const struct wined3d_swapchain_state_parent_ops d3d9_swapchain_state_parent_ops
 

Function Documentation

◆ d3d9_swapchain_AddRef()

static ULONG WINAPI d3d9_swapchain_AddRef ( IDirect3DSwapChain9Ex *  iface)
static

Definition at line 90 of file swapchain.c.

91{
92 struct d3d9_swapchain *swapchain = impl_from_IDirect3DSwapChain9Ex(iface);
94
95 TRACE("%p increasing refcount to %lu.\n", iface, refcount);
96
97 if (refcount == 1)
98 {
99 if (swapchain->parent_device)
101
103 }
104
105 return refcount;
106}
#define InterlockedIncrement
Definition: armddk.h:53
static struct d3d9_swapchain * impl_from_IDirect3DSwapChain9Ex(IDirect3DSwapChain9Ex *iface)
Definition: swapchain.c:48
#define IDirect3DDevice9Ex_AddRef(p)
Definition: d3d9.h:1929
#define TRACE(s)
Definition: solgame.cpp:4
IDirect3DDevice9Ex * parent_device
Definition: d3d9_private.h:161
struct wined3d_swapchain * wined3d_swapchain
Definition: d3d9_private.h:159
uint32_t ULONG
Definition: typedefs.h:59
ULONG CDECL wined3d_swapchain_incref(struct wined3d_swapchain *swapchain)
Definition: swapchain.c:135

◆ d3d9_swapchain_create()

HRESULT d3d9_swapchain_create ( struct d3d9_device *  device,
struct wined3d_swapchain_desc *  desc,
unsigned int  swap_interval,
struct d3d9_swapchain **  swapchain 
)

Definition at line 399 of file swapchain.c.

401{
402 struct wined3d_rendertarget_view *wined3d_dsv;
403 struct d3d9_swapchain *object;
404 struct d3d9_surface *surface;
405 unsigned int i;
406 HRESULT hr;
407
408 if (!(object = calloc(1, sizeof(*object))))
409 return E_OUTOFMEMORY;
410
411 if (FAILED(hr = swapchain_init(object, device, desc, swap_interval)))
412 {
413 WARN("Failed to initialize swapchain, hr %#lx.\n", hr);
414 free(object);
415 return hr;
416 }
417
418 for (i = 0; i < desc->backbuffer_count; ++i)
419 {
420 if (!(surface = d3d9_surface_create(wined3d_swapchain_get_back_buffer(object->wined3d_swapchain, i), 0,
421 (IUnknown *)&object->IDirect3DSwapChain9Ex_iface)))
422 {
423 IDirect3DSwapChain9Ex_Release(&object->IDirect3DSwapChain9Ex_iface);
424 return E_OUTOFMEMORY;
425 }
426 surface->parent_device = &device->IDirect3DDevice9Ex_iface;
427 }
428
429 if ((desc->flags & WINED3D_SWAPCHAIN_IMPLICIT)
430 && (wined3d_dsv = wined3d_device_context_get_depth_stencil_view(device->immediate_context)))
431 {
433
435 (IUnknown *)&device->IDirect3DDevice9Ex_iface)))
436 {
437 IDirect3DSwapChain9Ex_Release(&object->IDirect3DSwapChain9Ex_iface);
438 return E_OUTOFMEMORY;
439 }
440 surface->parent_device = &device->IDirect3DDevice9Ex_iface;
441 }
442
443 TRACE("Created swapchain %p.\n", object);
444 *swapchain = object;
445
446 return D3D_OK;
447}
#define WARN(fmt,...)
Definition: precomp.h:61
static HRESULT swapchain_init(struct d3d8_swapchain *swapchain, struct d3d8_device *device, struct wined3d_swapchain_desc *desc, unsigned int swap_interval)
Definition: swapchain.c:170
#define IDirect3DSwapChain9Ex_Release(p)
Definition: d3d9.h:1717
#define D3D_OK
Definition: d3d.h:106
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define free
Definition: debug_ros.c:5
HRESULT hr
Definition: delayimp.cpp:582
struct wined3d_rendertarget_view *CDECL wined3d_device_context_get_depth_stencil_view(const struct wined3d_device_context *context)
Definition: device.c:4676
struct wined3d_texture *__cdecl wined3d_texture_from_resource(struct wined3d_resource *resource)
Definition: texture.c:3343
struct wined3d_resource *CDECL wined3d_rendertarget_view_get_resource(const struct wined3d_rendertarget_view *view)
Definition: view.c:430
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define FAILED(hr)
Definition: intsafe.h:51
D3D11_SHADER_VARIABLE_DESC desc
Definition: reflection.c:1683
#define calloc
Definition: rosglue.h:14
IDirect3DDevice9Ex * parent_device
Definition: d3d9_private.h:176
Definition: devices.h:37
struct d3d9_surface * d3d9_surface_create(struct wined3d_texture *wined3d_texture, unsigned int sub_resource_idx, IUnknown *container)
Definition: surface.c:356
struct wined3d_texture *CDECL wined3d_swapchain_get_back_buffer(const struct wined3d_swapchain *swapchain, UINT back_buffer_idx)
Definition: swapchain.c:256
#define WINED3D_SWAPCHAIN_IMPLICIT
Definition: wined3d.h:901

Referenced by d3d9_device_CreateAdditionalSwapChain(), and device_init().

◆ d3d9_swapchain_GetBackBuffer()

static HRESULT WINAPI d3d9_swapchain_GetBackBuffer ( IDirect3DSwapChain9Ex *  iface,
UINT  backbuffer_idx,
D3DBACKBUFFER_TYPE  backbuffer_type,
IDirect3DSurface9 **  backbuffer 
)
static

Definition at line 172 of file swapchain.c.

174{
175 struct d3d9_swapchain *swapchain = impl_from_IDirect3DSwapChain9Ex(iface);
177 struct d3d9_surface *surface_impl;
178 HRESULT hr = D3D_OK;
179
180 TRACE("iface %p, backbuffer_idx %u, backbuffer_type %#x, backbuffer %p.\n",
181 iface, backbuffer_idx, backbuffer_type, backbuffer);
182
183 /* backbuffer_type is ignored by native. */
184
185 if (!backbuffer)
186 {
187 WARN("The output pointer is NULL, returning D3DERR_INVALIDCALL.\n");
188 return D3DERR_INVALIDCALL;
189 }
190
192 if ((wined3d_texture = wined3d_swapchain_get_back_buffer(swapchain->wined3d_swapchain, backbuffer_idx)))
193 {
195 *backbuffer = &surface_impl->IDirect3DSurface9_iface;
196 IDirect3DSurface9_AddRef(*backbuffer);
197 }
198 else
199 {
200 /* Do not set *backbuffer = NULL, see tests/device.c, test_swapchain(). */
202 }
204
205 return hr;
206}
#define D3DERR_INVALIDCALL
Definition: d3d10_private.h:42
#define IDirect3DSurface9_AddRef(p)
Definition: d3d9.h:449
void *CDECL wined3d_texture_get_sub_resource_parent(struct wined3d_texture *texture, unsigned int sub_resource_idx)
Definition: texture.c:4033
struct wined3d_swapchain * swapchain
Definition: d3d9_private.h:179
IDirect3DSurface9 IDirect3DSurface9_iface
Definition: d3d9_private.h:170
void WINAPI wined3d_mutex_unlock(void)
Definition: wined3d_main.c:544
void WINAPI wined3d_mutex_lock(void)
Definition: wined3d_main.c:539

◆ d3d9_swapchain_GetDevice()

static HRESULT WINAPI d3d9_swapchain_GetDevice ( IDirect3DSwapChain9Ex *  iface,
IDirect3DDevice9 **  device 
)
static

Definition at line 246 of file swapchain.c.

247{
248 struct d3d9_swapchain *swapchain = impl_from_IDirect3DSwapChain9Ex(iface);
249
250 TRACE("iface %p, device %p.\n", iface, device);
251
252 *device = (IDirect3DDevice9 *)swapchain->parent_device;
254
255 TRACE("Returning device %p.\n", *device);
256
257 return D3D_OK;
258}
#define IDirect3DDevice9_AddRef(p)
Definition: d3d9.h:1335
DWORD IDirect3DDevice9
Definition: dxva2api.idl:22

◆ d3d9_swapchain_GetDisplayMode()

static HRESULT WINAPI d3d9_swapchain_GetDisplayMode ( IDirect3DSwapChain9Ex *  iface,
D3DDISPLAYMODE *  mode 
)
static

Definition at line 223 of file swapchain.c.

224{
225 struct d3d9_swapchain *swapchain = impl_from_IDirect3DSwapChain9Ex(iface);
226 struct wined3d_display_mode wined3d_mode;
227 HRESULT hr;
228
229 TRACE("iface %p, mode %p.\n", iface, mode);
230
232 hr = wined3d_swapchain_get_display_mode(swapchain->wined3d_swapchain, &wined3d_mode, NULL);
234
235 if (SUCCEEDED(hr))
236 {
237 mode->Width = wined3d_mode.width;
238 mode->Height = wined3d_mode.height;
239 mode->RefreshRate = wined3d_mode.refresh_rate;
240 mode->Format = d3dformat_from_wined3dformat(wined3d_mode.format_id);
241 }
242
243 return hr;
244}
D3DFORMAT d3dformat_from_wined3dformat(enum wined3d_format_id format)
Definition: device.c:33
#define NULL
Definition: types.h:112
GLenum mode
Definition: glext.h:6217
#define SUCCEEDED(hr)
Definition: intsafe.h:50
HRESULT CDECL wined3d_swapchain_get_display_mode(const struct wined3d_swapchain *swapchain, struct wined3d_display_mode *mode, enum wined3d_display_rotation *rotation)
Definition: swapchain.c:316

◆ d3d9_swapchain_GetDisplayModeEx()

static HRESULT WINAPI d3d9_swapchain_GetDisplayModeEx ( IDirect3DSwapChain9Ex *  iface,
D3DDISPLAYMODEEX *  mode,
D3DDISPLAYROTATION *  rotation 
)
static

Definition at line 300 of file swapchain.c.

302{
303 struct d3d9_swapchain *swapchain = impl_from_IDirect3DSwapChain9Ex(iface);
304 struct wined3d_display_mode wined3d_mode;
305 HRESULT hr;
306
307 TRACE("iface %p, mode %p, rotation %p.\n", iface, mode, rotation);
308
309 if (mode->Size != sizeof(*mode))
310 return D3DERR_INVALIDCALL;
311
313 hr = wined3d_swapchain_get_display_mode(swapchain->wined3d_swapchain, &wined3d_mode,
314 (enum wined3d_display_rotation *)rotation);
316
317 if (SUCCEEDED(hr))
318 {
319 mode->Width = wined3d_mode.width;
320 mode->Height = wined3d_mode.height;
321 mode->RefreshRate = wined3d_mode.refresh_rate;
322 mode->Format = d3dformat_from_wined3dformat(wined3d_mode.format_id);
323 mode->ScanLineOrdering = d3dscanlineordering_from_wined3d(wined3d_mode.scanline_ordering);
324 }
325
326 return hr;
327}
static D3DSCANLINEORDERING d3dscanlineordering_from_wined3d(enum wined3d_scanline_ordering ordering)
Definition: d3d9_private.h:349
wined3d_display_rotation
Definition: wined3d.h:831

◆ d3d9_swapchain_GetFrontBufferData()

static HRESULT WINAPI d3d9_swapchain_GetFrontBufferData ( IDirect3DSwapChain9Ex *  iface,
IDirect3DSurface9 *  surface 
)
static

Definition at line 157 of file swapchain.c.

158{
159 struct d3d9_swapchain *swapchain = impl_from_IDirect3DSwapChain9Ex(iface);
161 HRESULT hr;
162
163 TRACE("iface %p, surface %p.\n", iface, surface);
164
166 hr = wined3d_swapchain_get_front_buffer_data(swapchain->wined3d_swapchain, dst->wined3d_texture, dst->sub_resource_idx);
168
169 return hr;
170}
GLenum GLenum dst
Definition: glext.h:6340
struct d3d9_surface * unsafe_impl_from_IDirect3DSurface9(IDirect3DSurface9 *iface)
Definition: surface.c:450
HRESULT CDECL wined3d_swapchain_get_front_buffer_data(const struct wined3d_swapchain *swapchain, struct wined3d_texture *dst_texture, unsigned int sub_resource_idx)
Definition: swapchain.c:235

◆ d3d9_swapchain_GetLastPresentCount()

static HRESULT WINAPI d3d9_swapchain_GetLastPresentCount ( IDirect3DSwapChain9Ex *  iface,
UINT *  last_present_count 
)
static

Definition at line 278 of file swapchain.c.

280{
281 FIXME("iface %p, last_present_count %p, stub!\n", iface, last_present_count);
282
283 if (last_present_count)
284 *last_present_count = 0;
285
286 return D3D_OK;
287}
#define FIXME(fmt,...)
Definition: precomp.h:53

◆ d3d9_swapchain_GetPresentParameters()

static HRESULT WINAPI d3d9_swapchain_GetPresentParameters ( IDirect3DSwapChain9Ex *  iface,
D3DPRESENT_PARAMETERS *  parameters 
)
static

Definition at line 260 of file swapchain.c.

262{
263 struct d3d9_swapchain *swapchain = impl_from_IDirect3DSwapChain9Ex(iface);
265 DWORD presentation_interval;
266
267 TRACE("iface %p, parameters %p.\n", iface, parameters);
268
271 presentation_interval = d3dpresentationinterval_from_wined3dswapinterval(swapchain->swap_interval);
274
275 return D3D_OK;
276}
static DWORD d3dpresentationinterval_from_wined3dswapinterval(enum wined3d_swap_interval interval)
Definition: swapchain.c:27
static void present_parameters_from_wined3d_swapchain_desc(D3DPRESENT_PARAMETERS *present_parameters, const struct wined3d_swapchain_desc *swapchain_desc, DWORD presentation_interval)
Definition: device.c:202
unsigned long DWORD
Definition: ntddk_ex.h:95
static BYTE parameters[]
Definition: asn.c:558
unsigned int swap_interval
Definition: d3d9_private.h:162
void CDECL wined3d_swapchain_get_desc(const struct wined3d_swapchain *swapchain, struct wined3d_swapchain_desc *desc)
Definition: swapchain.c:345

◆ d3d9_swapchain_GetPresentStatistics()

static HRESULT WINAPI d3d9_swapchain_GetPresentStatistics ( IDirect3DSwapChain9Ex *  iface,
D3DPRESENTSTATS *  present_stats 
)
static

Definition at line 289 of file swapchain.c.

291{
292 FIXME("iface %p, present_stats %p, stub!\n", iface, present_stats);
293
294 if (present_stats)
295 memset(present_stats, 0, sizeof(*present_stats));
296
297 return D3D_OK;
298}
#define memset(x, y, z)
Definition: compat.h:39

◆ d3d9_swapchain_GetRasterStatus()

static HRESULT WINAPI d3d9_swapchain_GetRasterStatus ( IDirect3DSwapChain9Ex *  iface,
D3DRASTER_STATUS *  raster_status 
)
static

Definition at line 208 of file swapchain.c.

209{
210 struct d3d9_swapchain *swapchain = impl_from_IDirect3DSwapChain9Ex(iface);
211 HRESULT hr;
212
213 TRACE("iface %p, raster_status %p.\n", iface, raster_status);
214
217 (struct wined3d_raster_status *)raster_status);
219
220 return hr;
221}
HRESULT CDECL wined3d_swapchain_get_raster_status(const struct wined3d_swapchain *swapchain, struct wined3d_raster_status *raster_status)
Definition: swapchain.c:294

◆ d3d9_swapchain_Present()

static HRESULT WINAPI DECLSPEC_HOTPATCH d3d9_swapchain_Present ( IDirect3DSwapChain9Ex *  iface,
const RECT *  src_rect,
const RECT *  dst_rect,
HWND  dst_window_override,
const RGNDATA *  dirty_region,
DWORD  flags 
)
static

Definition at line 136 of file swapchain.c.

139{
140 struct d3d9_swapchain *swapchain = impl_from_IDirect3DSwapChain9Ex(iface);
142
143 TRACE("iface %p, src_rect %s, dst_rect %s, dst_window_override %p, dirty_region %p, flags %#lx.\n",
144 iface, wine_dbgstr_rect(src_rect), wine_dbgstr_rect(dst_rect),
145 dst_window_override, dirty_region, flags);
146
147 if (device->device_state != D3D9_DEVICE_STATE_OK)
148 return device->d3d_parent->extended ? S_PRESENT_OCCLUDED : D3DERR_DEVICELOST;
149
150 if (dirty_region)
151 FIXME("Ignoring dirty_region %p.\n", dirty_region);
152
154 src_rect, dst_rect, dst_window_override, swapchain->swap_interval, flags);
155}
static const char * wine_dbgstr_rect(const RECT *prc)
Definition: atltest.h:160
#define S_PRESENT_OCCLUDED
Definition: d3d9.h:110
GLbitfield flags
Definition: glext.h:7161
#define D3DERR_DEVICELOST
Definition: d3d8.h:78
static struct d3d9_device * impl_from_IDirect3DDevice9Ex(IDirect3DDevice9Ex *iface)
Definition: d3d9_private.h:310
@ D3D9_DEVICE_STATE_OK
Definition: d3d9_private.h:84
HRESULT CDECL wined3d_swapchain_present(struct wined3d_swapchain *swapchain, const RECT *src_rect, const RECT *dst_rect, HWND dst_window_override, unsigned int swap_interval, uint32_t flags)
Definition: swapchain.c:192

◆ d3d9_swapchain_QueryInterface()

static HRESULT WINAPI d3d9_swapchain_QueryInterface ( IDirect3DSwapChain9Ex *  iface,
REFIID  riid,
void **  out 
)
static

Definition at line 53 of file swapchain.c.

54{
55 TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out);
56
57 if (IsEqualGUID(riid, &IID_IDirect3DSwapChain9)
59 {
61 *out = iface;
62 return S_OK;
63 }
64
65 if (IsEqualGUID(riid, &IID_IDirect3DSwapChain9Ex))
66 {
67 struct d3d9_swapchain *swapchain = impl_from_IDirect3DSwapChain9Ex(iface);
69
70 /* Find out if the creating d3d9 interface was created with Direct3DCreate9Ex.
71 * It doesn't matter with which function the device was created. */
72 if (!device->d3d_parent->extended)
73 {
74 WARN("IDirect3D9 instance wasn't created with CreateDirect3D9Ex, returning E_NOINTERFACE.\n");
75 *out = NULL;
76 return E_NOINTERFACE;
77 }
78
80 *out = iface;
81 return S_OK;
82 }
83
84 WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid));
85
86 *out = NULL;
87 return E_NOINTERFACE;
88}
const GUID IID_IUnknown
#define IDirect3DSwapChain9Ex_AddRef(p)
Definition: d3d9.h:1716
REFIID riid
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
#define debugstr_guid
Definition: kernel32.h:35
#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
#define E_NOINTERFACE
Definition: winerror.h:3479

◆ d3d9_swapchain_Release()

static ULONG WINAPI d3d9_swapchain_Release ( IDirect3DSwapChain9Ex *  iface)
static

Definition at line 108 of file swapchain.c.

109{
110 struct d3d9_swapchain *swapchain = impl_from_IDirect3DSwapChain9Ex(iface);
112
113 if (!swapchain->refcount)
114 {
115 WARN("Swapchain does not have any references.\n");
116 return 0;
117 }
118
120 TRACE("%p decreasing refcount to %lu.\n", iface, refcount);
121
122 if (!refcount)
123 {
125
127
128 /* Release the device last, as it may cause the device to be destroyed. */
129 if (parent_device)
131 }
132
133 return refcount;
134}
#define InterlockedDecrement
Definition: armddk.h:52
#define IDirect3DDevice9Ex_Release(p)
Definition: d3d9.h:1930
DWORD IDirect3DDevice9Ex
Definition: dxvahd.idl:22
ULONG CDECL wined3d_swapchain_decref(struct wined3d_swapchain *swapchain)
Definition: swapchain.c:144

◆ d3d9_swapchain_windowed_state_changed()

static void CDECL d3d9_swapchain_windowed_state_changed ( struct wined3d_swapchain_state_parent *  parent,
BOOL  windowed 
)
static

Definition at line 359 of file swapchain.c.

361{
362 TRACE("parent %p, windowed %d.\n", parent, windowed);
363}
r parent
Definition: btrfs.c:3010

◆ d3d9_swapchain_wined3d_object_released()

static void STDMETHODCALLTYPE d3d9_swapchain_wined3d_object_released ( void *  parent)
static

Definition at line 349 of file swapchain.c.

350{
351 free(parent);
352}

◆ d3dpresentationinterval_from_wined3dswapinterval()

static DWORD d3dpresentationinterval_from_wined3dswapinterval ( enum wined3d_swap_interval  interval)
static

Definition at line 27 of file swapchain.c.

28{
29 switch (interval)
30 {
41 default:
42 ERR("Invalid swap interval %#x.\n", interval);
45 }
46}
#define ERR(fmt,...)
Definition: precomp.h:57
#define D3DPRESENT_INTERVAL_THREE
Definition: d3d8caps.h:31
#define D3DPRESENT_INTERVAL_TWO
Definition: d3d8caps.h:30
#define D3DPRESENT_INTERVAL_FOUR
Definition: d3d8caps.h:32
#define D3DPRESENT_INTERVAL_IMMEDIATE
Definition: d3d8caps.h:33
#define D3DPRESENT_INTERVAL_ONE
Definition: d3d8caps.h:29
#define D3DPRESENT_INTERVAL_DEFAULT
Definition: d3d8caps.h:28
@ WINED3D_SWAP_INTERVAL_TWO
Definition: wined3d.h:547
@ WINED3D_SWAP_INTERVAL_FOUR
Definition: wined3d.h:549
@ WINED3D_SWAP_INTERVAL_ONE
Definition: wined3d.h:546
@ WINED3D_SWAP_INTERVAL_DEFAULT
Definition: wined3d.h:550
@ WINED3D_SWAP_INTERVAL_THREE
Definition: wined3d.h:548
@ WINED3D_SWAP_INTERVAL_IMMEDIATE
Definition: wined3d.h:545

Referenced by d3d9_swapchain_GetPresentParameters().

◆ impl_from_IDirect3DSwapChain9Ex()

static struct d3d9_swapchain * impl_from_IDirect3DSwapChain9Ex ( IDirect3DSwapChain9Ex *  iface)
inlinestatic

◆ swapchain_init()

static HRESULT swapchain_init ( struct d3d9_swapchain *  swapchain,
struct d3d9_device *  device,
struct wined3d_swapchain_desc *  desc,
unsigned int  swap_interval 
)
static

Definition at line 370 of file swapchain.c.

372{
373 struct wined3d_swapchain_desc swapchain_desc;
374 HRESULT hr;
375
376 swapchain->refcount = 1;
379 swapchain->swap_interval = swap_interval;
380
381 if (FAILED(hr = wined3d_swapchain_create(device->wined3d_device, desc, &swapchain->state_parent,
382 swapchain, &d3d9_swapchain_wined3d_parent_ops, &swapchain->wined3d_swapchain)))
383 {
384 WARN("Failed to create wined3d swapchain, hr %#lx.\n", hr);
385 return hr;
386 }
387
388 wined3d_swapchain_get_desc(swapchain->wined3d_swapchain, &swapchain_desc);
389 desc->backbuffer_width = swapchain_desc.backbuffer_width;
390 desc->backbuffer_height = swapchain_desc.backbuffer_height;
391 desc->backbuffer_format = swapchain_desc.backbuffer_format;
392
393 swapchain->parent_device = &device->IDirect3DDevice9Ex_iface;
395
396 return D3D_OK;
397}
static const struct wined3d_swapchain_state_parent_ops d3d9_swapchain_state_parent_ops
Definition: swapchain.c:365
static const struct IDirect3DSwapChain9ExVtbl d3d9_swapchain_vtbl
Definition: swapchain.c:329
static const struct wined3d_parent_ops d3d9_swapchain_wined3d_parent_ops
Definition: swapchain.c:354
IDirect3DSwapChain9Ex IDirect3DSwapChain9Ex_iface
Definition: d3d9_private.h:157
struct wined3d_swapchain_state_parent state_parent
Definition: d3d9_private.h:160
HRESULT CDECL wined3d_swapchain_create(struct wined3d_device *device, const struct wined3d_swapchain_desc *desc, struct wined3d_swapchain_state_parent *state_parent, void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_swapchain **swapchain)
Definition: swapchain.c:1732

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( d3d9  )

Variable Documentation

◆ d3d9_swapchain_state_parent_ops

const struct wined3d_swapchain_state_parent_ops d3d9_swapchain_state_parent_ops
static
Initial value:
=
{
}
static void CDECL d3d9_swapchain_windowed_state_changed(struct wined3d_swapchain_state_parent *parent, BOOL windowed)
Definition: swapchain.c:359

Definition at line 365 of file swapchain.c.

Referenced by swapchain_init().

◆ d3d9_swapchain_vtbl

const struct IDirect3DSwapChain9ExVtbl d3d9_swapchain_vtbl
static
Initial value:
=
{
}
static HRESULT WINAPI DECLSPEC_HOTPATCH d3d9_swapchain_Present(IDirect3DSwapChain9Ex *iface, const RECT *src_rect, const RECT *dst_rect, HWND dst_window_override, const RGNDATA *dirty_region, DWORD flags)
Definition: swapchain.c:136
static HRESULT WINAPI d3d9_swapchain_GetLastPresentCount(IDirect3DSwapChain9Ex *iface, UINT *last_present_count)
Definition: swapchain.c:278
static HRESULT WINAPI d3d9_swapchain_GetDevice(IDirect3DSwapChain9Ex *iface, IDirect3DDevice9 **device)
Definition: swapchain.c:246
static ULONG WINAPI d3d9_swapchain_Release(IDirect3DSwapChain9Ex *iface)
Definition: swapchain.c:108
static HRESULT WINAPI d3d9_swapchain_GetPresentParameters(IDirect3DSwapChain9Ex *iface, D3DPRESENT_PARAMETERS *parameters)
Definition: swapchain.c:260
static HRESULT WINAPI d3d9_swapchain_GetRasterStatus(IDirect3DSwapChain9Ex *iface, D3DRASTER_STATUS *raster_status)
Definition: swapchain.c:208
static HRESULT WINAPI d3d9_swapchain_GetFrontBufferData(IDirect3DSwapChain9Ex *iface, IDirect3DSurface9 *surface)
Definition: swapchain.c:157
static HRESULT WINAPI d3d9_swapchain_GetBackBuffer(IDirect3DSwapChain9Ex *iface, UINT backbuffer_idx, D3DBACKBUFFER_TYPE backbuffer_type, IDirect3DSurface9 **backbuffer)
Definition: swapchain.c:172
static HRESULT WINAPI d3d9_swapchain_GetPresentStatistics(IDirect3DSwapChain9Ex *iface, D3DPRESENTSTATS *present_stats)
Definition: swapchain.c:289
static HRESULT WINAPI d3d9_swapchain_GetDisplayModeEx(IDirect3DSwapChain9Ex *iface, D3DDISPLAYMODEEX *mode, D3DDISPLAYROTATION *rotation)
Definition: swapchain.c:300
static ULONG WINAPI d3d9_swapchain_AddRef(IDirect3DSwapChain9Ex *iface)
Definition: swapchain.c:90
static HRESULT WINAPI d3d9_swapchain_GetDisplayMode(IDirect3DSwapChain9Ex *iface, D3DDISPLAYMODE *mode)
Definition: swapchain.c:223
static HRESULT WINAPI d3d9_swapchain_QueryInterface(IDirect3DSwapChain9Ex *iface, REFIID riid, void **out)
Definition: swapchain.c:53

Definition at line 329 of file swapchain.c.

Referenced by swapchain_init().

◆ d3d9_swapchain_wined3d_parent_ops

const struct wined3d_parent_ops d3d9_swapchain_wined3d_parent_ops
static
Initial value:
=
{
}
static void STDMETHODCALLTYPE d3d9_swapchain_wined3d_object_released(void *parent)
Definition: swapchain.c:349

Definition at line 354 of file swapchain.c.

Referenced by swapchain_init().