Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
0c11c316
Commit
0c11c316
authored
Mar 14, 2012
by
Henri Verbeet
Committed by
Alexandre Julliard
Mar 15, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ddraw: Get rid of IDirect3DViewportImpl.
parent
ddfb19e9
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
161 additions
and
207 deletions
+161
-207
ddraw.c
dlls/ddraw/ddraw.c
+1
-1
ddraw_private.h
dlls/ddraw/ddraw_private.h
+9
-10
device.c
dlls/ddraw/device.c
+15
-15
executebuffer.c
dlls/ddraw/executebuffer.c
+6
-6
viewport.c
dlls/ddraw/viewport.c
+130
-175
No files found.
dlls/ddraw/ddraw.c
View file @
0c11c316
...
...
@@ -4271,7 +4271,7 @@ static HRESULT WINAPI d3d3_CreateViewport(IDirect3D3 *iface, IDirect3DViewport3
IUnknown
*
outer_unknown
)
{
struct
ddraw
*
ddraw
=
impl_from_IDirect3D3
(
iface
);
IDirect3DViewportImpl
*
object
;
struct
d3d_viewport
*
object
;
TRACE
(
"iface %p, viewport %p, outer_unknown %p.
\n
"
,
iface
,
viewport
,
outer_unknown
);
...
...
dlls/ddraw/ddraw_private.h
View file @
0c11c316
...
...
@@ -42,7 +42,6 @@ extern const struct wined3d_parent_ops ddraw_null_wined3d_parent_ops DECLSPEC_HI
/* Typdef the interfaces */
typedef
struct
IDirect3DDeviceImpl
IDirect3DDeviceImpl
;
typedef
struct
IDirect3DViewportImpl
IDirect3DViewportImpl
;
typedef
struct
IDirect3DMaterialImpl
IDirect3DMaterialImpl
;
typedef
struct
IDirect3DExecuteBufferImpl
IDirect3DExecuteBufferImpl
;
typedef
struct
IDirect3DVertexBufferImpl
IDirect3DVertexBufferImpl
;
...
...
@@ -290,7 +289,7 @@ struct IDirect3DDeviceImpl
/* Viewport management */
struct
list
viewport_list
;
IDirect3DViewportImpl
*
current_viewport
;
struct
d3d_viewport
*
current_viewport
;
D3DVIEWPORT7
active_viewport
;
/* Required to keep track which of two available texture blending modes in d3ddevice3 is used */
...
...
@@ -410,7 +409,7 @@ struct d3d_light
struct
ddraw
*
ddraw
;
/* If this light is active for one viewport, put the viewport here */
IDirect3DViewportImpl
*
active_viewport
;
struct
d3d_viewport
*
active_viewport
;
D3DLIGHT2
light
;
D3DLIGHT7
light7
;
...
...
@@ -451,7 +450,7 @@ IDirect3DMaterialImpl *d3d_material_create(struct ddraw *ddraw) DECLSPEC_HIDDEN;
/*****************************************************************************
* IDirect3DViewport - Wraps to D3D7
*****************************************************************************/
struct
IDirect3DViewportImpl
struct
d3d_viewport
{
IDirect3DViewport3
IDirect3DViewport3_iface
;
LONG
ref
;
...
...
@@ -480,13 +479,13 @@ struct IDirect3DViewportImpl
IDirect3DMaterialImpl
*
background
;
};
IDirect3DViewportImpl
*
unsafe_impl_from_IDirect3DViewport3
(
IDirect3DViewport3
*
iface
)
DECLSPEC_HIDDEN
;
IDirect3DViewportImpl
*
unsafe_impl_from_IDirect3DViewport2
(
IDirect3DViewport2
*
iface
)
DECLSPEC_HIDDEN
;
IDirect3DViewportImpl
*
unsafe_impl_from_IDirect3DViewport
(
IDirect3DViewport
*
iface
)
DECLSPEC_HIDDEN
;
struct
d3d_viewport
*
unsafe_impl_from_IDirect3DViewport3
(
IDirect3DViewport3
*
iface
)
DECLSPEC_HIDDEN
;
struct
d3d_viewport
*
unsafe_impl_from_IDirect3DViewport2
(
IDirect3DViewport2
*
iface
)
DECLSPEC_HIDDEN
;
struct
d3d_viewport
*
unsafe_impl_from_IDirect3DViewport
(
IDirect3DViewport
*
iface
)
DECLSPEC_HIDDEN
;
/* Helper functions */
void
viewport_activate
(
IDirect3DViewportImpl
*
This
,
BOOL
ignore_lights
)
DECLSPEC_HIDDEN
;
void
d3d_viewport_init
(
IDirect3DViewportImpl
*
viewport
,
struct
ddraw
*
ddraw
)
DECLSPEC_HIDDEN
;
void
viewport_activate
(
struct
d3d_viewport
*
viewport
,
BOOL
ignore_lights
)
DECLSPEC_HIDDEN
;
void
d3d_viewport_init
(
struct
d3d_viewport
*
viewport
,
struct
ddraw
*
ddraw
)
DECLSPEC_HIDDEN
;
/*****************************************************************************
* IDirect3DExecuteBuffer - Wraps to D3D7
...
...
@@ -519,7 +518,7 @@ IDirect3DExecuteBufferImpl *unsafe_impl_from_IDirect3DExecuteBuffer(IDirect3DExe
/* The execute function */
HRESULT
d3d_execute_buffer_execute
(
IDirect3DExecuteBufferImpl
*
execute_buffer
,
IDirect3DDeviceImpl
*
device
,
IDirect3DViewportImpl
*
viewport
)
DECLSPEC_HIDDEN
;
IDirect3DDeviceImpl
*
device
,
struct
d3d_viewport
*
viewport
)
DECLSPEC_HIDDEN
;
/*****************************************************************************
* IDirect3DVertexBuffer
...
...
dlls/ddraw/device.c
View file @
0c11c316
...
...
@@ -778,7 +778,7 @@ static HRESULT WINAPI IDirect3DDeviceImpl_1_Execute(IDirect3DDevice *iface,
{
IDirect3DDeviceImpl
*
This
=
impl_from_IDirect3DDevice
(
iface
);
IDirect3DExecuteBufferImpl
*
buffer
=
unsafe_impl_from_IDirect3DExecuteBuffer
(
ExecuteBuffer
);
IDirect3DViewportImpl
*
Direct3DViewportI
mpl
=
unsafe_impl_from_IDirect3DViewport
(
Viewport
);
struct
d3d_viewport
*
viewport_i
mpl
=
unsafe_impl_from_IDirect3DViewport
(
Viewport
);
HRESULT
hr
;
TRACE
(
"iface %p, buffer %p, viewport %p, flags %#x.
\n
"
,
iface
,
ExecuteBuffer
,
Viewport
,
Flags
);
...
...
@@ -788,7 +788,7 @@ static HRESULT WINAPI IDirect3DDeviceImpl_1_Execute(IDirect3DDevice *iface,
/* Execute... */
wined3d_mutex_lock
();
hr
=
d3d_execute_buffer_execute
(
buffer
,
This
,
Direct3DViewportI
mpl
);
hr
=
d3d_execute_buffer_execute
(
buffer
,
This
,
viewport_i
mpl
);
wined3d_mutex_unlock
();
return
hr
;
...
...
@@ -816,7 +816,7 @@ IDirect3DDeviceImpl_3_AddViewport(IDirect3DDevice3 *iface,
IDirect3DViewport3
*
Viewport
)
{
IDirect3DDeviceImpl
*
This
=
impl_from_IDirect3DDevice3
(
iface
);
IDirect3DViewportImpl
*
vp
=
unsafe_impl_from_IDirect3DViewport3
(
Viewport
);
struct
d3d_viewport
*
vp
=
unsafe_impl_from_IDirect3DViewport3
(
Viewport
);
TRACE
(
"iface %p, viewport %p.
\n
"
,
iface
,
Viewport
);
...
...
@@ -837,7 +837,7 @@ static HRESULT WINAPI IDirect3DDeviceImpl_2_AddViewport(IDirect3DDevice2 *iface,
IDirect3DViewport2
*
Direct3DViewport2
)
{
IDirect3DDeviceImpl
*
This
=
impl_from_IDirect3DDevice2
(
iface
);
IDirect3DViewportImpl
*
vp
=
unsafe_impl_from_IDirect3DViewport2
(
Direct3DViewport2
);
struct
d3d_viewport
*
vp
=
unsafe_impl_from_IDirect3DViewport2
(
Direct3DViewport2
);
TRACE
(
"iface %p, viewport %p.
\n
"
,
iface
,
Direct3DViewport2
);
...
...
@@ -848,7 +848,7 @@ static HRESULT WINAPI IDirect3DDeviceImpl_1_AddViewport(IDirect3DDevice *iface,
IDirect3DViewport
*
Direct3DViewport
)
{
IDirect3DDeviceImpl
*
This
=
impl_from_IDirect3DDevice
(
iface
);
IDirect3DViewportImpl
*
vp
=
unsafe_impl_from_IDirect3DViewport
(
Direct3DViewport
);
struct
d3d_viewport
*
vp
=
unsafe_impl_from_IDirect3DViewport
(
Direct3DViewport
);
TRACE
(
"iface %p, viewport %p.
\n
"
,
iface
,
Direct3DViewport
);
...
...
@@ -874,7 +874,7 @@ static HRESULT WINAPI IDirect3DDeviceImpl_1_AddViewport(IDirect3DDevice *iface,
static
HRESULT
WINAPI
IDirect3DDeviceImpl_3_DeleteViewport
(
IDirect3DDevice3
*
iface
,
IDirect3DViewport3
*
viewport
)
{
IDirect3DDeviceImpl
*
This
=
impl_from_IDirect3DDevice3
(
iface
);
IDirect3DViewportImpl
*
vp
=
unsafe_impl_from_IDirect3DViewport3
(
viewport
);
struct
d3d_viewport
*
vp
=
unsafe_impl_from_IDirect3DViewport3
(
viewport
);
TRACE
(
"iface %p, viewport %p.
\n
"
,
iface
,
viewport
);
...
...
@@ -899,7 +899,7 @@ static HRESULT WINAPI IDirect3DDeviceImpl_2_DeleteViewport(IDirect3DDevice2 *ifa
IDirect3DViewport2
*
Direct3DViewport2
)
{
IDirect3DDeviceImpl
*
This
=
impl_from_IDirect3DDevice2
(
iface
);
IDirect3DViewportImpl
*
vp
=
unsafe_impl_from_IDirect3DViewport2
(
Direct3DViewport2
);
struct
d3d_viewport
*
vp
=
unsafe_impl_from_IDirect3DViewport2
(
Direct3DViewport2
);
TRACE
(
"iface %p, viewport %p.
\n
"
,
iface
,
Direct3DViewport2
);
...
...
@@ -910,7 +910,7 @@ static HRESULT WINAPI IDirect3DDeviceImpl_1_DeleteViewport(IDirect3DDevice *ifac
IDirect3DViewport
*
Direct3DViewport
)
{
IDirect3DDeviceImpl
*
This
=
impl_from_IDirect3DDevice
(
iface
);
IDirect3DViewportImpl
*
vp
=
unsafe_impl_from_IDirect3DViewport
(
Direct3DViewport
);
struct
d3d_viewport
*
vp
=
unsafe_impl_from_IDirect3DViewport
(
Direct3DViewport
);
TRACE
(
"iface %p, viewport %p.
\n
"
,
iface
,
Direct3DViewport
);
...
...
@@ -942,8 +942,8 @@ IDirect3DDeviceImpl_3_NextViewport(IDirect3DDevice3 *iface,
DWORD
Flags
)
{
IDirect3DDeviceImpl
*
This
=
impl_from_IDirect3DDevice3
(
iface
);
IDirect3DViewportImpl
*
vp
=
unsafe_impl_from_IDirect3DViewport3
(
Viewport3
);
IDirect3DViewportImpl
*
next
;
struct
d3d_viewport
*
vp
=
unsafe_impl_from_IDirect3DViewport3
(
Viewport3
);
struct
d3d_viewport
*
next
;
struct
list
*
entry
;
TRACE
(
"iface %p, viewport %p, next %p, flags %#x.
\n
"
,
...
...
@@ -980,7 +980,7 @@ IDirect3DDeviceImpl_3_NextViewport(IDirect3DDevice3 *iface,
if
(
entry
)
{
next
=
LIST_ENTRY
(
entry
,
IDirect3DViewportImpl
,
entry
);
next
=
LIST_ENTRY
(
entry
,
struct
d3d_viewport
,
entry
);
*
lplpDirect3DViewport3
=
&
next
->
IDirect3DViewport3_iface
;
}
else
...
...
@@ -995,7 +995,7 @@ static HRESULT WINAPI IDirect3DDeviceImpl_2_NextViewport(IDirect3DDevice2 *iface
IDirect3DViewport2
*
Viewport2
,
IDirect3DViewport2
**
lplpDirect3DViewport2
,
DWORD
Flags
)
{
IDirect3DDeviceImpl
*
This
=
impl_from_IDirect3DDevice2
(
iface
);
IDirect3DViewportImpl
*
vp
=
unsafe_impl_from_IDirect3DViewport2
(
Viewport2
);
struct
d3d_viewport
*
vp
=
unsafe_impl_from_IDirect3DViewport2
(
Viewport2
);
IDirect3DViewport3
*
res
;
HRESULT
hr
;
...
...
@@ -1012,7 +1012,7 @@ static HRESULT WINAPI IDirect3DDeviceImpl_1_NextViewport(IDirect3DDevice *iface,
IDirect3DViewport
*
Viewport
,
IDirect3DViewport
**
lplpDirect3DViewport
,
DWORD
Flags
)
{
IDirect3DDeviceImpl
*
This
=
impl_from_IDirect3DDevice
(
iface
);
IDirect3DViewportImpl
*
vp
=
unsafe_impl_from_IDirect3DViewport
(
Viewport
);
struct
d3d_viewport
*
vp
=
unsafe_impl_from_IDirect3DViewport
(
Viewport
);
IDirect3DViewport3
*
res
;
HRESULT
hr
;
...
...
@@ -1787,7 +1787,7 @@ IDirect3DDeviceImpl_3_SetCurrentViewport(IDirect3DDevice3 *iface,
IDirect3DViewport3
*
Direct3DViewport3
)
{
IDirect3DDeviceImpl
*
This
=
impl_from_IDirect3DDevice3
(
iface
);
IDirect3DViewportImpl
*
vp
=
unsafe_impl_from_IDirect3DViewport3
(
Direct3DViewport3
);
struct
d3d_viewport
*
vp
=
unsafe_impl_from_IDirect3DViewport3
(
Direct3DViewport3
);
TRACE
(
"iface %p, viewport %p.
\n
"
,
iface
,
Direct3DViewport3
);
...
...
@@ -1830,7 +1830,7 @@ static HRESULT WINAPI IDirect3DDeviceImpl_2_SetCurrentViewport(IDirect3DDevice2
IDirect3DViewport2
*
Direct3DViewport2
)
{
IDirect3DDeviceImpl
*
This
=
impl_from_IDirect3DDevice2
(
iface
);
IDirect3DViewportImpl
*
vp
=
unsafe_impl_from_IDirect3DViewport2
(
Direct3DViewport2
);
struct
d3d_viewport
*
vp
=
unsafe_impl_from_IDirect3DViewport2
(
Direct3DViewport2
);
TRACE
(
"iface %p, viewport %p.
\n
"
,
iface
,
Direct3DViewport2
);
...
...
dlls/ddraw/executebuffer.c
View file @
0c11c316
...
...
@@ -69,7 +69,7 @@ static void _dump_D3DEXECUTEBUFFERDESC(const D3DEXECUTEBUFFERDESC *lpDesc) {
*
*****************************************************************************/
HRESULT
d3d_execute_buffer_execute
(
IDirect3DExecuteBufferImpl
*
This
,
IDirect3DDeviceImpl
*
lpDevice
,
IDirect3DViewportImpl
*
lpV
iewport
)
IDirect3DDeviceImpl
*
lpDevice
,
struct
d3d_viewport
*
v
iewport
)
{
/* DWORD bs = This->desc.dwBufferSize; */
DWORD
vs
=
This
->
data
.
dwVertexOffset
;
...
...
@@ -79,15 +79,15 @@ HRESULT d3d_execute_buffer_execute(IDirect3DExecuteBufferImpl *This,
char
*
instr
=
(
char
*
)
This
->
desc
.
lpData
+
is
;
if
(
lpV
iewport
->
active_device
!=
lpDevice
)
if
(
v
iewport
->
active_device
!=
lpDevice
)
{
WARN
(
"Viewport %p active device is %p.
\n
"
,
lpViewport
,
lpV
iewport
->
active_device
);
viewport
,
v
iewport
->
active_device
);
return
DDERR_INVALIDPARAMS
;
}
/* Activate the viewport */
viewport_activate
(
lpV
iewport
,
FALSE
);
viewport_activate
(
v
iewport
,
FALSE
);
TRACE
(
"ExecuteData :
\n
"
);
if
(
TRACE_ON
(
ddraw
))
...
...
@@ -376,8 +376,8 @@ HRESULT d3d_execute_buffer_execute(IDirect3DExecuteBufferImpl *This,
unsigned
int
nb
;
D3DVERTEX
*
src
=
((
LPD3DVERTEX
)
((
char
*
)
This
->
desc
.
lpData
+
vs
))
+
ci
->
wStart
;
D3DTLVERTEX
*
dst
=
((
LPD3DTLVERTEX
)
(
This
->
vertex_data
))
+
ci
->
wDest
;
D3DVIEWPORT
*
Viewport
=
&
viewport
->
viewports
.
vp1
;
D3DMATRIX
mat
;
D3DVIEWPORT
*
Viewport
=
&
lpViewport
->
viewports
.
vp1
;
if
(
TRACE_ON
(
ddraw
))
{
...
...
@@ -421,8 +421,8 @@ HRESULT d3d_execute_buffer_execute(IDirect3DExecuteBufferImpl *This,
unsigned
int
nb
;
D3DLVERTEX
*
src
=
((
LPD3DLVERTEX
)
((
char
*
)
This
->
desc
.
lpData
+
vs
))
+
ci
->
wStart
;
D3DTLVERTEX
*
dst
=
((
LPD3DTLVERTEX
)
(
This
->
vertex_data
))
+
ci
->
wDest
;
D3DVIEWPORT
*
Viewport
=
&
viewport
->
viewports
.
vp1
;
D3DMATRIX
mat
;
D3DVIEWPORT
*
Viewport
=
&
lpViewport
->
viewports
.
vp1
;
if
(
TRACE_ON
(
ddraw
))
{
...
...
dlls/ddraw/viewport.c
View file @
0c11c316
...
...
@@ -56,7 +56,7 @@ static void update_clip_space(IDirect3DDeviceImpl *device,
* activates the viewport using IDirect3DDevice7::SetViewport
*
*****************************************************************************/
void
viewport_activate
(
IDirect3DViewportImpl
*
This
,
BOOL
ignore_lights
)
void
viewport_activate
(
struct
d3d_viewport
*
This
,
BOOL
ignore_lights
)
{
struct
wined3d_vec3
scale
,
offset
;
D3DVIEWPORT7
vp
;
...
...
@@ -144,9 +144,9 @@ static void _dump_D3DVIEWPORT2(const D3DVIEWPORT2 *lpvp)
lpvp
->
dvMinZ
,
lpvp
->
dvMaxZ
);
}
static
inline
IDirect3DViewportImpl
*
impl_from_IDirect3DViewport3
(
IDirect3DViewport3
*
iface
)
static
inline
struct
d3d_viewport
*
impl_from_IDirect3DViewport3
(
IDirect3DViewport3
*
iface
)
{
return
CONTAINING_RECORD
(
iface
,
IDirect3DViewportImpl
,
IDirect3DViewport3_iface
);
return
CONTAINING_RECORD
(
iface
,
struct
d3d_viewport
,
IDirect3DViewport3_iface
);
}
/*****************************************************************************
...
...
@@ -169,7 +169,7 @@ static inline IDirect3DViewportImpl *impl_from_IDirect3DViewport3(IDirect3DViewp
* E_NOINTERFACE if the requested interface wasn't found
*
*****************************************************************************/
static
HRESULT
WINAPI
IDirect3DViewportImpl
_QueryInterface
(
IDirect3DViewport3
*
iface
,
REFIID
riid
,
void
**
object
)
static
HRESULT
WINAPI
d3d_viewport
_QueryInterface
(
IDirect3DViewport3
*
iface
,
REFIID
riid
,
void
**
object
)
{
TRACE
(
"iface %p, riid %s, object %p.
\n
"
,
iface
,
debugstr_guid
(
riid
),
object
);
...
...
@@ -198,13 +198,12 @@ static HRESULT WINAPI IDirect3DViewportImpl_QueryInterface(IDirect3DViewport3 *i
* The new refcount
*
*****************************************************************************/
static
ULONG
WINAPI
IDirect3DViewportImpl_AddRef
(
IDirect3DViewport3
*
iface
)
static
ULONG
WINAPI
d3d_viewport_AddRef
(
IDirect3DViewport3
*
iface
)
{
IDirect3DViewportImpl
*
This
=
impl_from_IDirect3DViewport3
(
iface
);
ULONG
ref
=
InterlockedIncrement
(
&
This
->
ref
);
struct
d3d_viewport
*
viewport
=
impl_from_IDirect3DViewport3
(
iface
);
ULONG
ref
=
InterlockedIncrement
(
&
viewport
->
ref
);
TRACE
(
"%p increasing refcount to %u.
\n
"
,
This
,
ref
);
TRACE
(
"%p increasing refcount to %u.
\n
"
,
viewport
,
ref
);
return
ref
;
}
...
...
@@ -218,18 +217,16 @@ IDirect3DViewportImpl_AddRef(IDirect3DViewport3 *iface)
* The new refcount
*
*****************************************************************************/
static
ULONG
WINAPI
IDirect3DViewportImpl_Release
(
IDirect3DViewport3
*
iface
)
static
ULONG
WINAPI
d3d_viewport_Release
(
IDirect3DViewport3
*
iface
)
{
IDirect3DViewportImpl
*
This
=
impl_from_IDirect3DViewport3
(
iface
);
ULONG
ref
=
InterlockedDecrement
(
&
This
->
ref
);
struct
d3d_viewport
*
viewport
=
impl_from_IDirect3DViewport3
(
iface
);
ULONG
ref
=
InterlockedDecrement
(
&
viewport
->
ref
);
TRACE
(
"%p decreasing refcount to %u.
\n
"
,
This
,
ref
);
TRACE
(
"%p decreasing refcount to %u.
\n
"
,
viewport
,
ref
);
if
(
!
ref
)
HeapFree
(
GetProcessHeap
(),
0
,
viewport
);
if
(
!
ref
)
{
HeapFree
(
GetProcessHeap
(),
0
,
This
);
return
0
;
}
return
ref
;
}
...
...
@@ -249,11 +246,9 @@ IDirect3DViewportImpl_Release(IDirect3DViewport3 *iface)
* DDERR_ALREADYINITIALIZED
*
*****************************************************************************/
static
HRESULT
WINAPI
IDirect3DViewportImpl_Initialize
(
IDirect3DViewport3
*
iface
,
IDirect3D
*
Direct3D
)
static
HRESULT
WINAPI
d3d_viewport_Initialize
(
IDirect3DViewport3
*
iface
,
IDirect3D
*
d3d
)
{
TRACE
(
"iface %p, d3d %p.
\n
"
,
iface
,
Direct3D
);
TRACE
(
"iface %p, d3d %p.
\n
"
,
iface
,
d3d
);
return
DDERR_ALREADYINITIALIZED
;
}
...
...
@@ -271,11 +266,9 @@ IDirect3DViewportImpl_Initialize(IDirect3DViewport3 *iface,
* DDERR_INVALIDPARAMS if Data is NULL
*
*****************************************************************************/
static
HRESULT
WINAPI
IDirect3DViewportImpl_GetViewport
(
IDirect3DViewport3
*
iface
,
D3DVIEWPORT
*
lpData
)
static
HRESULT
WINAPI
d3d_viewport_GetViewport
(
IDirect3DViewport3
*
iface
,
D3DVIEWPORT
*
lpData
)
{
IDirect3DViewportImpl
*
This
=
impl_from_IDirect3DViewport3
(
iface
);
struct
d3d_viewport
*
This
=
impl_from_IDirect3DViewport3
(
iface
);
DWORD
dwSize
;
TRACE
(
"iface %p, data %p.
\n
"
,
iface
,
lpData
);
...
...
@@ -326,11 +319,9 @@ IDirect3DViewportImpl_GetViewport(IDirect3DViewport3 *iface,
* DDERR_INVALIDPARAMS if Data is NULL
*
*****************************************************************************/
static
HRESULT
WINAPI
IDirect3DViewportImpl_SetViewport
(
IDirect3DViewport3
*
iface
,
D3DVIEWPORT
*
lpData
)
static
HRESULT
WINAPI
d3d_viewport_SetViewport
(
IDirect3DViewport3
*
iface
,
D3DVIEWPORT
*
lpData
)
{
IDirect3DViewportImpl
*
This
=
impl_from_IDirect3DViewport3
(
iface
);
struct
d3d_viewport
*
This
=
impl_from_IDirect3DViewport3
(
iface
);
IDirect3DViewport3
*
current_viewport
;
TRACE
(
"iface %p, data %p.
\n
"
,
iface
,
lpData
);
...
...
@@ -395,20 +386,16 @@ IDirect3DViewportImpl_SetViewport(IDirect3DViewport3 *iface,
* DDERR_INVALIDPARAMS if no clipping flag is specified
*
*****************************************************************************/
static
HRESULT
WINAPI
IDirect3DViewportImpl_TransformVertices
(
IDirect3DViewport3
*
iface
,
DWORD
dwVertexCount
,
D3DTRANSFORMDATA
*
lpData
,
DWORD
dwFlags
,
DWORD
*
lpOffScreen
)
static
HRESULT
WINAPI
d3d_viewport_TransformVertices
(
IDirect3DViewport3
*
iface
,
DWORD
dwVertexCount
,
D3DTRANSFORMDATA
*
lpData
,
DWORD
dwFlags
,
DWORD
*
lpOffScreen
)
{
IDirect3DViewportImpl
*
This
=
impl_from_IDirect3DViewport3
(
iface
);
struct
d3d_viewport
*
viewport
=
impl_from_IDirect3DViewport3
(
iface
);
D3DVIEWPORT
vp
=
viewport
->
viewports
.
vp1
;
D3DMATRIX
view_mat
,
world_mat
,
mat
;
float
*
in
;
float
*
out
;
float
x
,
y
,
z
,
w
;
unsigned
int
i
;
D3DVIEWPORT
vp
=
This
->
viewports
.
vp1
;
D3DHVERTEX
*
outH
;
TRACE
(
"iface %p, vertex_count %u, vertex_data %p, flags %#x, clip_plane %p.
\n
"
,
...
...
@@ -416,7 +403,7 @@ IDirect3DViewportImpl_TransformVertices(IDirect3DViewport3 *iface,
/* Tests on windows show that Windows crashes when this occurs,
* so don't return the (intuitive) return value
if
(!This
->active_device)
if
(!viewport
->active_device)
{
WARN("No device active, returning D3DERR_VIEWPORTHASNODEVICE\n");
return D3DERR_VIEWPORTHASNODEVICE;
...
...
@@ -431,12 +418,12 @@ IDirect3DViewportImpl_TransformVertices(IDirect3DViewport3 *iface,
wined3d_mutex_lock
();
wined3d_device_get_transform
(
This
->
active_device
->
wined3d_device
,
wined3d_device_get_transform
(
viewport
->
active_device
->
wined3d_device
,
D3DTRANSFORMSTATE_VIEW
,
(
struct
wined3d_matrix
*
)
&
view_mat
);
wined3d_device_get_transform
(
This
->
active_device
->
wined3d_device
,
wined3d_device_get_transform
(
viewport
->
active_device
->
wined3d_device
,
WINED3D_TS_WORLD_MATRIX
(
0
),
(
struct
wined3d_matrix
*
)
&
world_mat
);
multiply_matrix
(
&
mat
,
&
view_mat
,
&
world_mat
);
multiply_matrix
(
&
mat
,
&
This
->
active_device
->
legacy_projection
,
&
mat
);
multiply_matrix
(
&
mat
,
&
viewport
->
active_device
->
legacy_projection
,
&
mat
);
in
=
lpData
->
lpIn
;
out
=
lpData
->
lpOut
;
...
...
@@ -531,12 +518,10 @@ IDirect3DViewportImpl_TransformVertices(IDirect3DViewport3 *iface,
* DDERR_UNSUPPORTED
*
*****************************************************************************/
static
HRESULT
WINAPI
IDirect3DViewportImpl_LightElements
(
IDirect3DViewport3
*
iface
,
DWORD
dwElementCount
,
LPD3DLIGHTDATA
lpData
)
static
HRESULT
WINAPI
d3d_viewport_LightElements
(
IDirect3DViewport3
*
iface
,
DWORD
element_count
,
D3DLIGHTDATA
*
data
)
{
TRACE
(
"iface %p, element_count %u, data %p.
\n
"
,
iface
,
dwElementCount
,
lpD
ata
);
TRACE
(
"iface %p, element_count %u, data %p.
\n
"
,
iface
,
element_count
,
d
ata
);
return
DDERR_UNSUPPORTED
;
}
...
...
@@ -553,11 +538,9 @@ IDirect3DViewportImpl_LightElements(IDirect3DViewport3 *iface,
* D3D_OK on success
*
*****************************************************************************/
static
HRESULT
WINAPI
IDirect3DViewportImpl_SetBackground
(
IDirect3DViewport3
*
iface
,
D3DMATERIALHANDLE
hMat
)
static
HRESULT
WINAPI
d3d_viewport_SetBackground
(
IDirect3DViewport3
*
iface
,
D3DMATERIALHANDLE
hMat
)
{
IDirect3DViewportImpl
*
This
=
impl_from_IDirect3DViewport3
(
iface
);
struct
d3d_viewport
*
viewport
=
impl_from_IDirect3DViewport3
(
iface
);
IDirect3DMaterialImpl
*
m
;
TRACE
(
"iface %p, material %#x.
\n
"
,
iface
,
hMat
);
...
...
@@ -566,13 +549,13 @@ IDirect3DViewportImpl_SetBackground(IDirect3DViewport3 *iface,
if
(
!
hMat
)
{
This
->
background
=
NULL
;
viewport
->
background
=
NULL
;
TRACE
(
"Setting background to NULL
\n
"
);
wined3d_mutex_unlock
();
return
D3D_OK
;
}
m
=
ddraw_get_object
(
&
This
->
ddraw
->
d3ddevice
->
handle_table
,
hMat
-
1
,
DDRAW_HANDLE_MATERIAL
);
m
=
ddraw_get_object
(
&
viewport
->
ddraw
->
d3ddevice
->
handle_table
,
hMat
-
1
,
DDRAW_HANDLE_MATERIAL
);
if
(
!
m
)
{
WARN
(
"Invalid material handle.
\n
"
);
...
...
@@ -583,7 +566,7 @@ IDirect3DViewportImpl_SetBackground(IDirect3DViewport3 *iface,
TRACE
(
"Setting background color : %.8e %.8e %.8e %.8e.
\n
"
,
m
->
mat
.
u
.
diffuse
.
u1
.
r
,
m
->
mat
.
u
.
diffuse
.
u2
.
g
,
m
->
mat
.
u
.
diffuse
.
u3
.
b
,
m
->
mat
.
u
.
diffuse
.
u4
.
a
);
This
->
background
=
m
;
viewport
->
background
=
m
;
wined3d_mutex_unlock
();
...
...
@@ -603,31 +586,18 @@ IDirect3DViewportImpl_SetBackground(IDirect3DViewport3 *iface,
* D3D_OK
*
*****************************************************************************/
static
HRESULT
WINAPI
IDirect3DViewportImpl_GetBackground
(
IDirect3DViewport3
*
iface
,
D3DMATERIALHANDLE
*
lphMat
,
BOOL
*
lpValid
)
static
HRESULT
WINAPI
d3d_viewport_GetBackground
(
IDirect3DViewport3
*
iface
,
D3DMATERIALHANDLE
*
material
,
BOOL
*
valid
)
{
IDirect3DViewportImpl
*
This
=
impl_from_IDirect3DViewport3
(
iface
);
struct
d3d_viewport
*
viewport
=
impl_from_IDirect3DViewport3
(
iface
);
TRACE
(
"iface %p, material %p, valid %p.
\n
"
,
iface
,
lphMat
,
lpV
alid
);
TRACE
(
"iface %p, material %p, valid %p.
\n
"
,
iface
,
material
,
v
alid
);
wined3d_mutex_lock
();
if
(
lpValid
)
{
*
lpValid
=
This
->
background
!=
NULL
;
}
if
(
lphMat
)
{
if
(
This
->
background
)
{
*
lphMat
=
This
->
background
->
Handle
;
}
else
{
*
lphMat
=
0
;
}
}
if
(
valid
)
*
valid
=
!!
viewport
->
background
;
if
(
material
)
*
material
=
viewport
->
background
?
viewport
->
background
->
Handle
:
0
;
wined3d_mutex_unlock
();
return
D3D_OK
;
...
...
@@ -645,11 +615,9 @@ IDirect3DViewportImpl_GetBackground(IDirect3DViewport3 *iface,
* Returns: D3D_OK, because it's a stub
*
*****************************************************************************/
static
HRESULT
WINAPI
IDirect3DViewportImpl_SetBackgroundDepth
(
IDirect3DViewport3
*
iface
,
IDirectDrawSurface
*
lpDDSurface
)
static
HRESULT
WINAPI
d3d_viewport_SetBackgroundDepth
(
IDirect3DViewport3
*
iface
,
IDirectDrawSurface
*
surface
)
{
FIXME
(
"iface %p, surface %p stub!
\n
"
,
iface
,
lpDDS
urface
);
FIXME
(
"iface %p, surface %p stub!
\n
"
,
iface
,
s
urface
);
return
D3D_OK
;
}
...
...
@@ -668,12 +636,10 @@ IDirect3DViewportImpl_SetBackgroundDepth(IDirect3DViewport3 *iface,
* (DDERR_INVALIDPARAMS if DDSurface of Valid is NULL)
*
*****************************************************************************/
static
HRESULT
WINAPI
IDirect3DViewportImpl_GetBackgroundDepth
(
IDirect3DViewport3
*
iface
,
IDirectDrawSurface
**
lplpDDSurface
,
LPBOOL
lpValid
)
static
HRESULT
WINAPI
d3d_viewport_GetBackgroundDepth
(
IDirect3DViewport3
*
iface
,
IDirectDrawSurface
**
surface
,
BOOL
*
valid
)
{
FIXME
(
"iface %p, surface %p, valid %p stub!
\n
"
,
iface
,
lplpDDSurface
,
lpV
alid
);
FIXME
(
"iface %p, surface %p, valid %p stub!
\n
"
,
iface
,
surface
,
v
alid
);
return
DD_OK
;
}
...
...
@@ -695,16 +661,16 @@ IDirect3DViewportImpl_GetBackgroundDepth(IDirect3DViewport3 *iface,
* The return value of IDirect3DDevice7::Clear
*
*****************************************************************************/
static
HRESULT
WINAPI
IDirect3DViewportImpl
_Clear
(
IDirect3DViewport3
*
iface
,
DWORD
dwCount
,
D3DRECT
*
lpRects
,
DWORD
dwF
lags
)
static
HRESULT
WINAPI
d3d_viewport
_Clear
(
IDirect3DViewport3
*
iface
,
DWORD
rect_count
,
D3DRECT
*
rects
,
DWORD
f
lags
)
{
IDirect3DViewportImpl
*
This
=
impl_from_IDirect3DViewport3
(
iface
);
struct
d3d_viewport
*
This
=
impl_from_IDirect3DViewport3
(
iface
);
DWORD
color
=
0x00000000
;
HRESULT
hr
;
IDirect3DViewport3
*
current_viewport
;
IDirect3DDevice3
*
d3d_device3
;
TRACE
(
"iface %p, rect_count %u, rects %p, flags %#x.
\n
"
,
iface
,
dwCount
,
lpRects
,
dwF
lags
);
TRACE
(
"iface %p, rect_count %u, rects %p, flags %#x.
\n
"
,
iface
,
rect_count
,
rects
,
f
lags
);
if
(
This
->
active_device
==
NULL
)
{
ERR
(
" Trying to clear a viewport not attached to a device !
\n
"
);
...
...
@@ -714,7 +680,8 @@ static HRESULT WINAPI IDirect3DViewportImpl_Clear(IDirect3DViewport3 *iface,
wined3d_mutex_lock
();
if
(
dwFlags
&
D3DCLEAR_TARGET
)
{
if
(
flags
&
D3DCLEAR_TARGET
)
{
if
(
This
->
background
==
NULL
)
{
ERR
(
" Trying to clear the color buffer without background material !
\n
"
);
}
...
...
@@ -731,12 +698,13 @@ static HRESULT WINAPI IDirect3DViewportImpl_Clear(IDirect3DViewport3 *iface,
afterwards. */
viewport_activate
(
This
,
TRUE
);
hr
=
IDirect3DDevice7_Clear
(
&
This
->
active_device
->
IDirect3DDevice7_iface
,
dwCount
,
lpR
ects
,
dwF
lags
&
(
D3DCLEAR_ZBUFFER
|
D3DCLEAR_TARGET
),
color
,
1
.
0
,
0x00000000
);
hr
=
IDirect3DDevice7_Clear
(
&
This
->
active_device
->
IDirect3DDevice7_iface
,
rect_count
,
r
ects
,
f
lags
&
(
D3DCLEAR_ZBUFFER
|
D3DCLEAR_TARGET
),
color
,
1
.
0
,
0x00000000
);
IDirect3DDevice3_GetCurrentViewport
(
d3d_device3
,
&
current_viewport
);
if
(
current_viewport
)
{
IDirect3DViewportImpl
*
vp
=
impl_from_IDirect3DViewport3
(
current_viewport
);
if
(
current_viewport
)
{
struct
d3d_viewport
*
vp
=
impl_from_IDirect3DViewport3
(
current_viewport
);
viewport_activate
(
vp
,
TRUE
);
IDirect3DViewport3_Release
(
current_viewport
);
}
...
...
@@ -760,10 +728,9 @@ static HRESULT WINAPI IDirect3DViewportImpl_Clear(IDirect3DViewport3 *iface,
* DDERR_INVALIDPARAMS if there are 8 lights or more
*
*****************************************************************************/
static
HRESULT
WINAPI
IDirect3DViewportImpl_AddLight
(
IDirect3DViewport3
*
iface
,
IDirect3DLight
*
lpDirect3DLight
)
static
HRESULT
WINAPI
d3d_viewport_AddLight
(
IDirect3DViewport3
*
iface
,
IDirect3DLight
*
lpDirect3DLight
)
{
IDirect3DViewportImpl
*
This
=
impl_from_IDirect3DViewport3
(
iface
);
struct
d3d_viewport
*
This
=
impl_from_IDirect3DViewport3
(
iface
);
struct
d3d_light
*
light_impl
=
unsafe_impl_from_IDirect3DLight
(
lpDirect3DLight
);
DWORD
i
=
0
;
DWORD
map
=
This
->
map_lights
;
...
...
@@ -817,17 +784,16 @@ static HRESULT WINAPI IDirect3DViewportImpl_AddLight(IDirect3DViewport3 *iface,
* DDERR_INVALIDPARAMS if the light wasn't found
*
*****************************************************************************/
static
HRESULT
WINAPI
IDirect3DViewportImpl_DeleteLight
(
IDirect3DViewport3
*
iface
,
IDirect3DLight
*
lpDirect3DLight
)
static
HRESULT
WINAPI
d3d_viewport_DeleteLight
(
IDirect3DViewport3
*
iface
,
IDirect3DLight
*
lpDirect3DLight
)
{
IDirect3DViewportImpl
*
This
=
impl_from_IDirect3DViewport3
(
iface
);
struct
d3d_viewport
*
viewport
=
impl_from_IDirect3DViewport3
(
iface
);
struct
d3d_light
*
l
=
unsafe_impl_from_IDirect3DLight
(
lpDirect3DLight
);
TRACE
(
"iface %p, light %p.
\n
"
,
iface
,
lpDirect3DLight
);
wined3d_mutex_lock
();
if
(
l
->
active_viewport
!=
This
)
if
(
l
->
active_viewport
!=
viewport
)
{
WARN
(
"Light %p active viewport is %p.
\n
"
,
l
,
l
->
active_viewport
);
wined3d_mutex_unlock
();
...
...
@@ -838,8 +804,8 @@ static HRESULT WINAPI IDirect3DViewportImpl_DeleteLight(IDirect3DViewport3 *ifac
list_remove
(
&
l
->
entry
);
l
->
active_viewport
=
NULL
;
IDirect3DLight_Release
(
lpDirect3DLight
);
--
This
->
num_lights
;
This
->
map_lights
&=
~
(
1
<<
l
->
dwLightIndex
);
--
viewport
->
num_lights
;
viewport
->
map_lights
&=
~
(
1
<<
l
->
dwLightIndex
);
wined3d_mutex_unlock
();
...
...
@@ -859,46 +825,46 @@ static HRESULT WINAPI IDirect3DViewportImpl_DeleteLight(IDirect3DViewport3 *ifac
* D3D_OK, because it's a stub
*
*****************************************************************************/
static
HRESULT
WINAPI
IDirect3DViewportImpl
_NextLight
(
IDirect3DViewport3
*
iface
,
IDirect3DLight
*
lpDirect3DLight
,
IDirect3DLight
**
lplpDirect3DLight
,
DWORD
dwF
lags
)
static
HRESULT
WINAPI
d3d_viewport
_NextLight
(
IDirect3DViewport3
*
iface
,
IDirect3DLight
*
lpDirect3DLight
,
IDirect3DLight
**
lplpDirect3DLight
,
DWORD
f
lags
)
{
IDirect3DViewportImpl
*
This
=
impl_from_IDirect3DViewport3
(
iface
);
struct
d3d_viewport
*
viewport
=
impl_from_IDirect3DViewport3
(
iface
);
struct
d3d_light
*
l
=
unsafe_impl_from_IDirect3DLight
(
lpDirect3DLight
);
struct
list
*
entry
;
HRESULT
hr
;
TRACE
(
"iface %p, light %p, next_light %p, flags %#x.
\n
"
,
iface
,
lpDirect3DLight
,
lplpDirect3DLight
,
dwF
lags
);
iface
,
lpDirect3DLight
,
lplpDirect3DLight
,
f
lags
);
if
(
!
lplpDirect3DLight
)
return
DDERR_INVALIDPARAMS
;
wined3d_mutex_lock
();
switch
(
dwF
lags
)
switch
(
f
lags
)
{
case
D3DNEXT_NEXT
:
if
(
!
l
||
l
->
active_viewport
!=
This
)
if
(
!
l
||
l
->
active_viewport
!=
viewport
)
{
if
(
l
)
WARN
(
"Light %p active viewport is %p.
\n
"
,
l
,
l
->
active_viewport
);
entry
=
NULL
;
}
else
entry
=
list_next
(
&
This
->
light_list
,
&
l
->
entry
);
entry
=
list_next
(
&
viewport
->
light_list
,
&
l
->
entry
);
break
;
case
D3DNEXT_HEAD
:
entry
=
list_head
(
&
This
->
light_list
);
entry
=
list_head
(
&
viewport
->
light_list
);
break
;
case
D3DNEXT_TAIL
:
entry
=
list_tail
(
&
This
->
light_list
);
entry
=
list_tail
(
&
viewport
->
light_list
);
break
;
default:
entry
=
NULL
;
WARN
(
"Invalid flags %#x.
\n
"
,
dwF
lags
);
WARN
(
"Invalid flags %#x.
\n
"
,
f
lags
);
break
;
}
...
...
@@ -939,11 +905,9 @@ static HRESULT WINAPI IDirect3DViewportImpl_NextLight(IDirect3DViewport3 *iface,
* DDERR_INVALIDPARAMS if Data is NULL
*
*****************************************************************************/
static
HRESULT
WINAPI
IDirect3DViewportImpl_GetViewport2
(
IDirect3DViewport3
*
iface
,
D3DVIEWPORT2
*
lpData
)
static
HRESULT
WINAPI
d3d_viewport_GetViewport2
(
IDirect3DViewport3
*
iface
,
D3DVIEWPORT2
*
lpData
)
{
IDirect3DViewportImpl
*
This
=
impl_from_IDirect3DViewport3
(
iface
);
struct
d3d_viewport
*
This
=
impl_from_IDirect3DViewport3
(
iface
);
DWORD
dwSize
;
TRACE
(
"iface %p, data %p.
\n
"
,
iface
,
lpData
);
...
...
@@ -992,11 +956,9 @@ IDirect3DViewportImpl_GetViewport2(IDirect3DViewport3 *iface,
* D3D_OK on success
*
*****************************************************************************/
static
HRESULT
WINAPI
IDirect3DViewportImpl_SetViewport2
(
IDirect3DViewport3
*
iface
,
D3DVIEWPORT2
*
lpData
)
static
HRESULT
WINAPI
d3d_viewport_SetViewport2
(
IDirect3DViewport3
*
iface
,
D3DVIEWPORT2
*
lpData
)
{
IDirect3DViewportImpl
*
This
=
impl_from_IDirect3DViewport3
(
iface
);
struct
d3d_viewport
*
This
=
impl_from_IDirect3DViewport3
(
iface
);
IDirect3DViewport3
*
current_viewport
;
TRACE
(
"iface %p, data %p.
\n
"
,
iface
,
lpData
);
...
...
@@ -1044,11 +1006,10 @@ IDirect3DViewportImpl_SetViewport2(IDirect3DViewport3 *iface,
* D3D_OK, because it's stub
*
*****************************************************************************/
static
HRESULT
WINAPI
IDirect3DViewportImpl_SetBackgroundDepth2
(
IDirect3DViewport3
*
iface
,
IDirectDrawSurface4
*
lpDDS
)
static
HRESULT
WINAPI
d3d_viewport_SetBackgroundDepth2
(
IDirect3DViewport3
*
iface
,
IDirectDrawSurface4
*
surface
)
{
FIXME
(
"iface %p, surface %p stub!
\n
"
,
iface
,
lpDDS
);
FIXME
(
"iface %p, surface %p stub!
\n
"
,
iface
,
surface
);
return
D3D_OK
;
}
...
...
@@ -1066,12 +1027,10 @@ IDirect3DViewportImpl_SetBackgroundDepth2(IDirect3DViewport3 *iface,
* D3D_OK because it's a stub
*
*****************************************************************************/
static
HRESULT
WINAPI
IDirect3DViewportImpl_GetBackgroundDepth2
(
IDirect3DViewport3
*
iface
,
IDirectDrawSurface4
**
lplpDDS
,
BOOL
*
lpValid
)
static
HRESULT
WINAPI
d3d_viewport_GetBackgroundDepth2
(
IDirect3DViewport3
*
iface
,
IDirectDrawSurface4
**
surface
,
BOOL
*
valid
)
{
FIXME
(
"iface %p, surface %p, valid %p stub!
\n
"
,
iface
,
lplpDDS
,
lpV
alid
);
FIXME
(
"iface %p, surface %p, valid %p stub!
\n
"
,
iface
,
surface
,
v
alid
);
return
D3D_OK
;
}
...
...
@@ -1092,40 +1051,36 @@ IDirect3DViewportImpl_GetBackgroundDepth2(IDirect3DViewport3 *iface,
* Returns:
*
*****************************************************************************/
static
HRESULT
WINAPI
IDirect3DViewportImpl_Clear2
(
IDirect3DViewport3
*
iface
,
DWORD
dwCount
,
LPD3DRECT
lpRects
,
DWORD
dwFlags
,
DWORD
dwColor
,
D3DVALUE
dvZ
,
DWORD
dwStencil
)
static
HRESULT
WINAPI
d3d_viewport_Clear2
(
IDirect3DViewport3
*
iface
,
DWORD
rect_count
,
D3DRECT
*
rects
,
DWORD
flags
,
DWORD
color
,
D3DVALUE
depth
,
DWORD
stencil
)
{
IDirect3DViewportImpl
*
This
=
impl_from_IDirect3DViewport3
(
iface
);
struct
d3d_viewport
*
viewport
=
impl_from_IDirect3DViewport3
(
iface
);
HRESULT
hr
;
IDirect3DViewport3
*
current_viewport
;
IDirect3DDevice3
*
d3d_device3
;
TRACE
(
"iface %p, rect_count %u, rects %p, flags %#x, color 0x%08x, depth %.8e, stencil %u.
\n
"
,
iface
,
dwCount
,
lpRects
,
dwFlags
,
dwColor
,
dvZ
,
dwS
tencil
);
iface
,
rect_count
,
rects
,
flags
,
color
,
depth
,
s
tencil
);
wined3d_mutex_lock
();
if
(
This
->
active_device
==
NULL
)
{
ERR
(
" Trying to clear a viewport not attached to a device !
\n
"
);
if
(
!
viewport
->
active_device
)
{
WARN
(
"Trying to clear a viewport not attached to a device.
\n
"
);
wined3d_mutex_unlock
();
return
D3DERR_VIEWPORTHASNODEVICE
;
}
d3d_device3
=
&
This
->
active_device
->
IDirect3DDevice3_iface
;
d3d_device3
=
&
viewport
->
active_device
->
IDirect3DDevice3_iface
;
/* Need to temporarily activate viewport to clear it. Previously active
* one will be restored afterwards. */
viewport_activate
(
This
,
TRUE
);
viewport_activate
(
viewport
,
TRUE
);
hr
=
IDirect3DDevice7_Clear
(
&
This
->
active_device
->
IDirect3DDevice7_iface
,
dwCount
,
lpRects
,
dwFlags
,
dwColor
,
dvZ
,
dwS
tencil
);
hr
=
IDirect3DDevice7_Clear
(
&
viewport
->
active_device
->
IDirect3DDevice7_iface
,
rect_count
,
rects
,
flags
,
color
,
depth
,
s
tencil
);
IDirect3DDevice3_GetCurrentViewport
(
d3d_device3
,
&
current_viewport
);
if
(
current_viewport
)
{
IDirect3DViewportImpl
*
vp
=
impl_from_IDirect3DViewport3
(
current_viewport
);
if
(
current_viewport
)
{
struct
d3d_viewport
*
vp
=
impl_from_IDirect3DViewport3
(
current_viewport
);
viewport_activate
(
vp
,
TRUE
);
IDirect3DViewport3_Release
(
current_viewport
);
}
...
...
@@ -1142,56 +1097,56 @@ IDirect3DViewportImpl_Clear2(IDirect3DViewport3 *iface,
static
const
struct
IDirect3DViewport3Vtbl
d3d_viewport_vtbl
=
{
/*** IUnknown Methods ***/
IDirect3DViewportImpl
_QueryInterface
,
IDirect3DViewportImpl
_AddRef
,
IDirect3DViewportImpl
_Release
,
d3d_viewport
_QueryInterface
,
d3d_viewport
_AddRef
,
d3d_viewport
_Release
,
/*** IDirect3DViewport Methods */
IDirect3DViewportImpl
_Initialize
,
IDirect3DViewportImpl
_GetViewport
,
IDirect3DViewportImpl
_SetViewport
,
IDirect3DViewportImpl
_TransformVertices
,
IDirect3DViewportImpl
_LightElements
,
IDirect3DViewportImpl
_SetBackground
,
IDirect3DViewportImpl
_GetBackground
,
IDirect3DViewportImpl
_SetBackgroundDepth
,
IDirect3DViewportImpl
_GetBackgroundDepth
,
IDirect3DViewportImpl
_Clear
,
IDirect3DViewportImpl
_AddLight
,
IDirect3DViewportImpl
_DeleteLight
,
IDirect3DViewportImpl
_NextLight
,
d3d_viewport
_Initialize
,
d3d_viewport
_GetViewport
,
d3d_viewport
_SetViewport
,
d3d_viewport
_TransformVertices
,
d3d_viewport
_LightElements
,
d3d_viewport
_SetBackground
,
d3d_viewport
_GetBackground
,
d3d_viewport
_SetBackgroundDepth
,
d3d_viewport
_GetBackgroundDepth
,
d3d_viewport
_Clear
,
d3d_viewport
_AddLight
,
d3d_viewport
_DeleteLight
,
d3d_viewport
_NextLight
,
/*** IDirect3DViewport2 Methods ***/
IDirect3DViewportImpl
_GetViewport2
,
IDirect3DViewportImpl
_SetViewport2
,
d3d_viewport
_GetViewport2
,
d3d_viewport
_SetViewport2
,
/*** IDirect3DViewport3 Methods ***/
IDirect3DViewportImpl
_SetBackgroundDepth2
,
IDirect3DViewportImpl
_GetBackgroundDepth2
,
IDirect3DViewportImpl
_Clear2
,
d3d_viewport
_SetBackgroundDepth2
,
d3d_viewport
_GetBackgroundDepth2
,
d3d_viewport
_Clear2
,
};
IDirect3DViewportImpl
*
unsafe_impl_from_IDirect3DViewport3
(
IDirect3DViewport3
*
iface
)
struct
d3d_viewport
*
unsafe_impl_from_IDirect3DViewport3
(
IDirect3DViewport3
*
iface
)
{
if
(
!
iface
)
return
NULL
;
assert
(
iface
->
lpVtbl
==
&
d3d_viewport_vtbl
);
return
CONTAINING_RECORD
(
iface
,
IDirect3DViewportImpl
,
IDirect3DViewport3_iface
);
return
CONTAINING_RECORD
(
iface
,
struct
d3d_viewport
,
IDirect3DViewport3_iface
);
}
IDirect3DViewportImpl
*
unsafe_impl_from_IDirect3DViewport2
(
IDirect3DViewport2
*
iface
)
struct
d3d_viewport
*
unsafe_impl_from_IDirect3DViewport2
(
IDirect3DViewport2
*
iface
)
{
/* IDirect3DViewport and IDirect3DViewport3 use the same iface. */
if
(
!
iface
)
return
NULL
;
assert
(
iface
->
lpVtbl
==
(
IDirect3DViewport2Vtbl
*
)
&
d3d_viewport_vtbl
);
return
CONTAINING_RECORD
(
iface
,
IDirect3DViewportImpl
,
IDirect3DViewport3_iface
);
return
CONTAINING_RECORD
(
iface
,
struct
d3d_viewport
,
IDirect3DViewport3_iface
);
}
IDirect3DViewportImpl
*
unsafe_impl_from_IDirect3DViewport
(
IDirect3DViewport
*
iface
)
struct
d3d_viewport
*
unsafe_impl_from_IDirect3DViewport
(
IDirect3DViewport
*
iface
)
{
/* IDirect3DViewport and IDirect3DViewport3 use the same iface. */
if
(
!
iface
)
return
NULL
;
assert
(
iface
->
lpVtbl
==
(
IDirect3DViewportVtbl
*
)
&
d3d_viewport_vtbl
);
return
CONTAINING_RECORD
(
iface
,
IDirect3DViewportImpl
,
IDirect3DViewport3_iface
);
return
CONTAINING_RECORD
(
iface
,
struct
d3d_viewport
,
IDirect3DViewport3_iface
);
}
void
d3d_viewport_init
(
IDirect3DViewportImpl
*
viewport
,
struct
ddraw
*
ddraw
)
void
d3d_viewport_init
(
struct
d3d_viewport
*
viewport
,
struct
ddraw
*
ddraw
)
{
viewport
->
IDirect3DViewport3_iface
.
lpVtbl
=
&
d3d_viewport_vtbl
;
viewport
->
ref
=
1
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment