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
9e068a33
Commit
9e068a33
authored
Sep 30, 2009
by
Stefan Dösinger
Committed by
Alexandre Julliard
Oct 02, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: SetRenderTarget doesn't change the viewport in d3d7.
parent
eda00d97
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
106 additions
and
1 deletion
+106
-1
d3d.c
dlls/ddraw/tests/d3d.c
+104
-0
device.c
dlls/wined3d/device.c
+2
-1
No files found.
dlls/ddraw/tests/d3d.c
View file @
9e068a33
...
...
@@ -2973,6 +2973,109 @@ static void ComputeSphereVisibility(void)
ok
(
result
[
0
]
==
0x2002f
,
"Expected 0x2002f, got %x
\n
"
,
result
[
0
]);
}
static
void
SetRenderTargetTest
(
void
)
{
HRESULT
hr
;
IDirectDrawSurface7
*
newrt
,
*
oldrt
;
D3DVIEWPORT7
vp
;
DDSURFACEDESC2
ddsd
;
DWORD
stateblock
;
memset
(
&
ddsd
,
0
,
sizeof
(
ddsd
));
ddsd
.
dwSize
=
sizeof
(
ddsd
);
ddsd
.
dwFlags
=
DDSD_CAPS
|
DDSD_WIDTH
|
DDSD_HEIGHT
;
ddsd
.
ddsCaps
.
dwCaps
=
DDSCAPS_TEXTURE
|
DDSCAPS_3DDEVICE
;
ddsd
.
dwWidth
=
64
;
ddsd
.
dwHeight
=
64
;
hr
=
IDirectDraw7_CreateSurface
(
lpDD
,
&
ddsd
,
&
newrt
,
NULL
);
ok
(
hr
==
DD_OK
,
"IDirectDraw7_CreateSurface failed, hr=0x%08x
\n
"
,
hr
);
if
(
FAILED
(
hr
))
{
skip
(
"Skipping SetRenderTarget test
\n
"
);
return
;
}
memset
(
&
vp
,
0
,
sizeof
(
vp
));
vp
.
dwX
=
10
;
vp
.
dwY
=
10
;
vp
.
dwWidth
=
246
;
vp
.
dwHeight
=
246
;
vp
.
dvMinZ
=
0
.
25
;
vp
.
dvMaxZ
=
0
.
75
;
hr
=
IDirect3DDevice7_SetViewport
(
lpD3DDevice
,
&
vp
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice7_SetViewport failed, hr=0x%08x
\n
"
,
hr
);
hr
=
IDirect3DDevice7_GetRenderTarget
(
lpD3DDevice
,
&
oldrt
);
ok
(
hr
==
DD_OK
,
"IDirect3DDevice7_GetRenderTarget failed, hr=0x%08x
\n
"
,
hr
);
hr
=
IDirect3DDevice7_SetRenderTarget
(
lpD3DDevice
,
newrt
,
0
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice7_SetRenderTarget failed, hr=0x%08x
\n
"
,
hr
);
memset
(
&
vp
,
0xff
,
sizeof
(
vp
));
hr
=
IDirect3DDevice7_GetViewport
(
lpD3DDevice
,
&
vp
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice7_GetViewport failed, hr=0x%08x
\n
"
,
hr
);
ok
(
vp
.
dwX
==
10
,
"vp.dwX is %u, expected 10
\n
"
,
vp
.
dwX
);
ok
(
vp
.
dwY
==
10
,
"vp.dwY is %u, expected 10
\n
"
,
vp
.
dwY
);
ok
(
vp
.
dwWidth
==
246
,
"vp.dwWidth is %u, expected 246
\n
"
,
vp
.
dwWidth
);
ok
(
vp
.
dwHeight
==
246
,
"vp.dwHeight is %u, expected 246
\n
"
,
vp
.
dwHeight
);
ok
(
vp
.
dvMinZ
==
0
.
25
,
"vp.dvMinZ is %f, expected 0.1
\n
"
,
vp
.
dvMinZ
);
ok
(
vp
.
dvMaxZ
==
0
.
75
,
"vp.dvMaxZ is %f, expected 0.9
\n
"
,
vp
.
dvMaxZ
);
memset
(
&
vp
,
0
,
sizeof
(
vp
));
vp
.
dwX
=
0
;
vp
.
dwY
=
0
;
vp
.
dwWidth
=
64
;
vp
.
dwHeight
=
64
;
vp
.
dvMinZ
=
0
.
0
;
vp
.
dvMaxZ
=
1
.
0
;
hr
=
IDirect3DDevice7_SetViewport
(
lpD3DDevice
,
&
vp
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice7_SetViewport failed, hr=0x%08x
\n
"
,
hr
);
hr
=
IDirect3DDevice7_BeginStateBlock
(
lpD3DDevice
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice7_BeginStateblock failed, hr=0x%08x
\n
"
,
hr
);
hr
=
IDirect3DDevice7_SetRenderTarget
(
lpD3DDevice
,
oldrt
,
0
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice7_SetRenderTarget failed, hr=0x%08x
\n
"
,
hr
);
/* Check this twice, before and after ending the stateblock */
memset
(
&
vp
,
0xff
,
sizeof
(
vp
));
hr
=
IDirect3DDevice7_GetViewport
(
lpD3DDevice
,
&
vp
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice7_GetViewport failed, hr=0x%08x
\n
"
,
hr
);
ok
(
vp
.
dwX
==
0
,
"vp.dwX is %u, expected 0
\n
"
,
vp
.
dwX
);
ok
(
vp
.
dwY
==
0
,
"vp.dwY is %u, expected 0
\n
"
,
vp
.
dwY
);
ok
(
vp
.
dwWidth
==
64
,
"vp.dwWidth is %u, expected 64
\n
"
,
vp
.
dwWidth
);
ok
(
vp
.
dwHeight
==
64
,
"vp.dwHeight is %u, expected 64
\n
"
,
vp
.
dwHeight
);
ok
(
vp
.
dvMinZ
==
0
.
0
,
"vp.dvMinZ is %f, expected 0.0
\n
"
,
vp
.
dvMinZ
);
ok
(
vp
.
dvMaxZ
==
1
.
0
,
"vp.dvMaxZ is %f, expected 1.0
\n
"
,
vp
.
dvMaxZ
);
hr
=
IDirect3DDevice7_EndStateBlock
(
lpD3DDevice
,
&
stateblock
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice7_EndStateblock failed, hr=0x%08x
\n
"
,
hr
);
memset
(
&
vp
,
0xff
,
sizeof
(
vp
));
hr
=
IDirect3DDevice7_GetViewport
(
lpD3DDevice
,
&
vp
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice7_GetViewport failed, hr=0x%08x
\n
"
,
hr
);
ok
(
vp
.
dwX
==
0
,
"vp.dwX is %u, expected 0
\n
"
,
vp
.
dwX
);
ok
(
vp
.
dwY
==
0
,
"vp.dwY is %u, expected 0
\n
"
,
vp
.
dwY
);
ok
(
vp
.
dwWidth
==
64
,
"vp.dwWidth is %u, expected 64
\n
"
,
vp
.
dwWidth
);
ok
(
vp
.
dwHeight
==
64
,
"vp.dwHeight is %u, expected 64
\n
"
,
vp
.
dwHeight
);
ok
(
vp
.
dvMinZ
==
0
.
0
,
"vp.dvMinZ is %f, expected 0.0
\n
"
,
vp
.
dvMinZ
);
ok
(
vp
.
dvMaxZ
==
1
.
0
,
"vp.dvMaxZ is %f, expected 1.0
\n
"
,
vp
.
dvMaxZ
);
hr
=
IDirect3DDevice7_DeleteStateBlock
(
lpD3DDevice
,
stateblock
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice7_DeleteStateblock failed, hr=0x%08x
\n
"
,
hr
);
memset
(
&
vp
,
0
,
sizeof
(
vp
));
vp
.
dwX
=
0
;
vp
.
dwY
=
0
;
vp
.
dwWidth
=
256
;
vp
.
dwHeight
=
256
;
vp
.
dvMinZ
=
0
.
0
;
vp
.
dvMaxZ
=
0
.
0
;
hr
=
IDirect3DDevice7_SetViewport
(
lpD3DDevice
,
&
vp
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice7_SetViewport failed, hr=0x%08x
\n
"
,
hr
);
IDirectDrawSurface7_Release
(
oldrt
);
IDirectDrawSurface7_Release
(
newrt
);
}
START_TEST
(
d3d
)
{
init_function_pointers
();
...
...
@@ -2996,6 +3099,7 @@ START_TEST(d3d)
VertexBufferDescTest
();
D3D7_OldRenderStateTest
();
DeviceLoadTest
();
SetRenderTargetTest
();
ReleaseDirect3D
();
}
...
...
dlls/wined3d/device.c
View file @
9e068a33
...
...
@@ -6131,6 +6131,7 @@ void stretch_rect_fbo(IWineD3DDevice *iface, IWineD3DSurface *src_surface, WINED
static
HRESULT
WINAPI
IWineD3DDeviceImpl_SetRenderTarget
(
IWineD3DDevice
*
iface
,
DWORD
RenderTargetIndex
,
IWineD3DSurface
*
pRenderTarget
)
{
IWineD3DDeviceImpl
*
This
=
(
IWineD3DDeviceImpl
*
)
iface
;
WINED3DVIEWPORT
viewport
;
int
dxVersion
=
(
(
IWineD3DImpl
*
)
This
->
wineD3D
)
->
dxVersion
;
TRACE
(
"(%p) : Setting rendertarget %d to %p
\n
"
,
This
,
RenderTargetIndex
,
pRenderTarget
);
...
...
@@ -6163,7 +6164,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetRenderTarget(IWineD3DDevice *iface,
This
->
render_targets
[
RenderTargetIndex
]
=
pRenderTarget
;
/* Render target 0 is special */
if
(
RenderTargetIndex
==
0
)
{
if
(
RenderTargetIndex
==
0
&&
dxVersion
>
7
)
{
/* Finally, reset the viewport as the MSDN states. */
viewport
.
Height
=
((
IWineD3DSurfaceImpl
*
)
This
->
render_targets
[
0
])
->
currentDesc
.
Height
;
viewport
.
Width
=
((
IWineD3DSurfaceImpl
*
)
This
->
render_targets
[
0
])
->
currentDesc
.
Width
;
...
...
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