ReactOS  0.4.13-dev-651-g5dbc677
stateblock.c File Reference
#include "config.h"
#include "d3d9_private.h"
Include dependency graph for stateblock.c:

Go to the source code of this file.

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (d3d9)
 
static struct d3d9_stateblockimpl_from_IDirect3DStateBlock9 (IDirect3DStateBlock9 *iface)
 
static HRESULT WINAPI d3d9_stateblock_QueryInterface (IDirect3DStateBlock9 *iface, REFIID riid, void **out)
 
static ULONG WINAPI d3d9_stateblock_AddRef (IDirect3DStateBlock9 *iface)
 
static ULONG WINAPI d3d9_stateblock_Release (IDirect3DStateBlock9 *iface)
 
static HRESULT WINAPI d3d9_stateblock_GetDevice (IDirect3DStateBlock9 *iface, IDirect3DDevice9 **device)
 
static HRESULT WINAPI d3d9_stateblock_Capture (IDirect3DStateBlock9 *iface)
 
static HRESULT WINAPI d3d9_stateblock_Apply (IDirect3DStateBlock9 *iface)
 
HRESULT stateblock_init (struct d3d9_stateblock *stateblock, struct d3d9_device *device, D3DSTATEBLOCKTYPE type, struct wined3d_stateblock *wined3d_stateblock)
 

Variables

static const struct IDirect3DStateBlock9Vtbl d3d9_stateblock_vtbl
 

Function Documentation

◆ d3d9_stateblock_AddRef()

static ULONG WINAPI d3d9_stateblock_AddRef ( IDirect3DStateBlock9 *  iface)
static

Definition at line 51 of file stateblock.c.

52 {
53  struct d3d9_stateblock *stateblock = impl_from_IDirect3DStateBlock9(iface);
55 
56  TRACE("%p increasing refcount to %u.\n", iface, refcount);
57 
58  return refcount;
59 }
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedIncrement
Definition: armddk.h:53
static struct d3d9_stateblock * impl_from_IDirect3DStateBlock9(IDirect3DStateBlock9 *iface)
Definition: stateblock.c:28
unsigned int ULONG
Definition: retypes.h:1

◆ d3d9_stateblock_Apply()

static HRESULT WINAPI d3d9_stateblock_Apply ( IDirect3DStateBlock9 *  iface)
static

Definition at line 108 of file stateblock.c.

109 {
110  struct d3d9_stateblock *stateblock = impl_from_IDirect3DStateBlock9(iface);
111 
112  TRACE("iface %p.\n", iface);
113 
117 
118  return D3D_OK;
119 }
struct wined3d_stateblock * wined3d_stateblock
Definition: d3d9_private.h:231
void WINAPI wined3d_mutex_lock(void)
Definition: wined3d_main.c:360
#define TRACE(s)
Definition: solgame.cpp:4
void CDECL wined3d_stateblock_apply(const struct wined3d_stateblock *stateblock)
Definition: stateblock.c:977
#define D3D_OK
Definition: d3d.h:106
static struct d3d9_stateblock * impl_from_IDirect3DStateBlock9(IDirect3DStateBlock9 *iface)
Definition: stateblock.c:28
void WINAPI wined3d_mutex_unlock(void)
Definition: wined3d_main.c:365

◆ d3d9_stateblock_Capture()

static HRESULT WINAPI d3d9_stateblock_Capture ( IDirect3DStateBlock9 *  iface)
static

Definition at line 95 of file stateblock.c.

96 {
97  struct d3d9_stateblock *stateblock = impl_from_IDirect3DStateBlock9(iface);
98 
99  TRACE("iface %p.\n", iface);
100 
104 
105  return D3D_OK;
106 }
struct wined3d_stateblock * wined3d_stateblock
Definition: d3d9_private.h:231
void WINAPI wined3d_mutex_lock(void)
Definition: wined3d_main.c:360
#define TRACE(s)
Definition: solgame.cpp:4
#define D3D_OK
Definition: d3d.h:106
static struct d3d9_stateblock * impl_from_IDirect3DStateBlock9(IDirect3DStateBlock9 *iface)
Definition: stateblock.c:28
void CDECL wined3d_stateblock_capture(struct wined3d_stateblock *stateblock)
Definition: stateblock.c:683
void WINAPI wined3d_mutex_unlock(void)
Definition: wined3d_main.c:365

◆ d3d9_stateblock_GetDevice()

static HRESULT WINAPI d3d9_stateblock_GetDevice ( IDirect3DStateBlock9 *  iface,
IDirect3DDevice9 **  device 
)
static

Definition at line 81 of file stateblock.c.

82 {
83  struct d3d9_stateblock *stateblock = impl_from_IDirect3DStateBlock9(iface);
84 
85  TRACE("iface %p, device %p.\n", iface, device);
86 
87  *device = (IDirect3DDevice9 *)stateblock->parent_device;
89 
90  TRACE("Returning device %p.\n", *device);
91 
92  return D3D_OK;
93 }
Definition: devices.h:37
#define TRACE(s)
Definition: solgame.cpp:4
#define IDirect3DDevice9_AddRef(p)
Definition: d3d9.h:1507
IDirect3DDevice9Ex * parent_device
Definition: d3d9_private.h:232
#define D3D_OK
Definition: d3d.h:106
static struct d3d9_stateblock * impl_from_IDirect3DStateBlock9(IDirect3DStateBlock9 *iface)
Definition: stateblock.c:28

◆ d3d9_stateblock_QueryInterface()

static HRESULT WINAPI d3d9_stateblock_QueryInterface ( IDirect3DStateBlock9 *  iface,
REFIID  riid,
void **  out 
)
static

Definition at line 33 of file stateblock.c.

34 {
35  TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out);
36 
37  if (IsEqualGUID(riid, &IID_IDirect3DStateBlock9)
39  {
41  *out = iface;
42  return S_OK;
43  }
44 
45  WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid));
46 
47  *out = NULL;
48  return E_NOINTERFACE;
49 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
#define WARN(fmt,...)
Definition: debug.h:111
#define IDirect3DStateBlock9_AddRef(p)
Definition: d3d9.h:1299
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
const GUID IID_IUnknown
static FILE * out
Definition: regtests2xml.c:44
#define S_OK
Definition: intsafe.h:59
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4021

◆ d3d9_stateblock_Release()

static ULONG WINAPI d3d9_stateblock_Release ( IDirect3DStateBlock9 *  iface)
static

Definition at line 61 of file stateblock.c.

62 {
63  struct d3d9_stateblock *stateblock = impl_from_IDirect3DStateBlock9(iface);
65 
66  TRACE("%p decreasing refcount to %u.\n", iface, refcount);
67 
68  if (!refcount)
69  {
73 
75  heap_free(stateblock);
76  }
77 
78  return refcount;
79 }
struct wined3d_stateblock * wined3d_stateblock
Definition: d3d9_private.h:231
void WINAPI wined3d_mutex_lock(void)
Definition: wined3d_main.c:360
#define IDirect3DDevice9Ex_Release(p)
Definition: d3d9.h:1917
#define TRACE(s)
Definition: solgame.cpp:4
ULONG CDECL wined3d_stateblock_decref(struct wined3d_stateblock *stateblock)
Definition: stateblock.c:551
#define InterlockedDecrement
Definition: armddk.h:52
IDirect3DDevice9Ex * parent_device
Definition: d3d9_private.h:232
static struct d3d9_stateblock * impl_from_IDirect3DStateBlock9(IDirect3DStateBlock9 *iface)
Definition: stateblock.c:28
unsigned int ULONG
Definition: retypes.h:1
void WINAPI wined3d_mutex_unlock(void)
Definition: wined3d_main.c:365
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

◆ impl_from_IDirect3DStateBlock9()

static struct d3d9_stateblock* impl_from_IDirect3DStateBlock9 ( IDirect3DStateBlock9 *  iface)
inlinestatic

Definition at line 28 of file stateblock.c.

29 {
31 }
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
IDirect3DStateBlock9 IDirect3DStateBlock9_iface
Definition: d3d9_private.h:229

Referenced by d3d9_stateblock_AddRef(), d3d9_stateblock_Apply(), d3d9_stateblock_Capture(), d3d9_stateblock_GetDevice(), and d3d9_stateblock_Release().

◆ stateblock_init()

HRESULT stateblock_init ( struct d3d9_stateblock stateblock,
struct d3d9_device device,
D3DSTATEBLOCKTYPE  type,
struct wined3d_stateblock wined3d_stateblock 
)

Definition at line 134 of file stateblock.c.

136 {
137  HRESULT hr;
138 
139  stateblock->IDirect3DStateBlock9_iface.lpVtbl = &d3d9_stateblock_vtbl;
140  stateblock->refcount = 1;
141 
142  if (wined3d_stateblock)
143  {
145  }
146  else
147  {
149  hr = wined3d_stateblock_create(device->wined3d_device,
150  (enum wined3d_stateblock_type)type, &stateblock->wined3d_stateblock);
152  if (FAILED(hr))
153  {
154  WARN("Failed to create wined3d stateblock, hr %#x.\n", hr);
155  return hr;
156  }
157  }
158 
159  stateblock->parent_device = &device->IDirect3DDevice9Ex_iface;
161 
162  return D3D_OK;
163 }
struct wined3d_stateblock * wined3d_stateblock
Definition: d3d9_private.h:231
HRESULT hr
Definition: shlfolder.c:183
#define WARN(fmt,...)
Definition: debug.h:111
void WINAPI wined3d_mutex_lock(void)
Definition: wined3d_main.c:360
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
HRESULT CDECL wined3d_stateblock_create(struct wined3d_device *device, enum wined3d_stateblock_type type, struct wined3d_stateblock **stateblock)
Definition: stateblock.c:1384
Definition: devices.h:37
#define IDirect3DDevice9Ex_AddRef(p)
Definition: d3d9.h:1916
wined3d_stateblock_type
Definition: wined3d.h:774
static const struct IDirect3DStateBlock9Vtbl d3d9_stateblock_vtbl
Definition: stateblock.c:122
LONG HRESULT
Definition: typedefs.h:77
IDirect3DStateBlock9 IDirect3DStateBlock9_iface
Definition: d3d9_private.h:229
IDirect3DDevice9Ex * parent_device
Definition: d3d9_private.h:232
#define D3D_OK
Definition: d3d.h:106
void WINAPI wined3d_mutex_unlock(void)
Definition: wined3d_main.c:365

Referenced by d3d9_device_CreateStateBlock(), d3d9_device_EndStateBlock(), and wined3d_stateblock_create().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( d3d9  )

Variable Documentation

◆ d3d9_stateblock_vtbl

const struct IDirect3DStateBlock9Vtbl d3d9_stateblock_vtbl
static
Initial value:
=
{
}
static HRESULT WINAPI d3d9_stateblock_GetDevice(IDirect3DStateBlock9 *iface, IDirect3DDevice9 **device)
Definition: stateblock.c:81
static HRESULT WINAPI d3d9_stateblock_QueryInterface(IDirect3DStateBlock9 *iface, REFIID riid, void **out)
Definition: stateblock.c:33
static HRESULT WINAPI d3d9_stateblock_Capture(IDirect3DStateBlock9 *iface)
Definition: stateblock.c:95
static ULONG WINAPI d3d9_stateblock_Release(IDirect3DStateBlock9 *iface)
Definition: stateblock.c:61
static HRESULT WINAPI d3d9_stateblock_Apply(IDirect3DStateBlock9 *iface)
Definition: stateblock.c:108
static ULONG WINAPI d3d9_stateblock_AddRef(IDirect3DStateBlock9 *iface)
Definition: stateblock.c:51

Definition at line 122 of file stateblock.c.

Referenced by stateblock_init().