Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
178d0030
Commit
178d0030
authored
Oct 05, 2015
by
Stefan Dösinger
Committed by
Alexandre Julliard
Oct 06, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3d9/tests: Port test_flip to d3d9.
Signed-off-by:
Stefan Dösinger
<
stefan@codeweavers.com
>
parent
b90b61aa
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
107 additions
and
0 deletions
+107
-0
visual.c
dlls/d3d9/tests/visual.c
+107
-0
No files found.
dlls/d3d9/tests/visual.c
View file @
178d0030
...
...
@@ -19796,6 +19796,112 @@ done:
DestroyWindow
(
window
);
}
static
void
test_flip
(
void
)
{
IDirect3DDevice9
*
device
;
IDirect3D9
*
d3d
;
ULONG
refcount
;
HWND
window
;
HRESULT
hr
;
IDirect3DSurface9
*
back_buffers
[
3
],
*
test_surface
;
unsigned
int
i
;
D3DCOLOR
color
;
D3DPRESENT_PARAMETERS
present_parameters
=
{
0
};
window
=
CreateWindowA
(
"static"
,
"d3d9_test"
,
WS_OVERLAPPEDWINDOW
,
0
,
0
,
640
,
480
,
NULL
,
NULL
,
NULL
,
NULL
);
d3d
=
Direct3DCreate9
(
D3D_SDK_VERSION
);
ok
(
!!
d3d
,
"Failed to create a D3D object.
\n
"
);
present_parameters
.
BackBufferWidth
=
640
;
present_parameters
.
BackBufferHeight
=
480
;
present_parameters
.
BackBufferFormat
=
D3DFMT_A8R8G8B8
;
present_parameters
.
SwapEffect
=
D3DSWAPEFFECT_DISCARD
;
present_parameters
.
hDeviceWindow
=
window
;
present_parameters
.
Windowed
=
TRUE
;
present_parameters
.
BackBufferCount
=
3
;
present_parameters
.
Flags
=
D3DPRESENTFLAG_LOCKABLE_BACKBUFFER
;
hr
=
IDirect3D9_CreateDevice
(
d3d
,
D3DADAPTER_DEFAULT
,
D3DDEVTYPE_HAL
,
window
,
D3DCREATE_SOFTWARE_VERTEXPROCESSING
,
&
present_parameters
,
&
device
);
if
(
!
device
)
{
skip
(
"Failed to create a D3D device, skipping tests.
\n
"
);
IDirect3D9_Release
(
d3d
);
DestroyWindow
(
window
);
return
;
}
for
(
i
=
0
;
i
<
sizeof
(
back_buffers
)
/
sizeof
(
*
back_buffers
);
++
i
)
{
hr
=
IDirect3DDevice9_GetBackBuffer
(
device
,
0
,
i
,
D3DBACKBUFFER_TYPE_MONO
,
&
back_buffers
[
i
]);
ok
(
SUCCEEDED
(
hr
),
"Failed to get back buffer, hr %#x.
\n
"
,
hr
);
}
hr
=
IDirect3DDevice9_GetRenderTarget
(
device
,
0
,
&
test_surface
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get render target, hr %#x.
\n
"
,
hr
);
ok
(
test_surface
==
back_buffers
[
0
],
"Expected render target %p, got %p.
\n
"
,
back_buffers
[
0
],
test_surface
);
IDirect3DSurface9_Release
(
test_surface
);
hr
=
IDirect3DDevice9_SetRenderTarget
(
device
,
0
,
back_buffers
[
2
]);
ok
(
SUCCEEDED
(
hr
),
"Failed to set render target, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_ColorFill
(
device
,
back_buffers
[
0
],
NULL
,
0xffff0000
);
ok
(
SUCCEEDED
(
hr
),
"Failed to color fill, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_ColorFill
(
device
,
back_buffers
[
1
],
NULL
,
0xff00ff00
);
ok
(
SUCCEEDED
(
hr
),
"Failed to color fill, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_Clear
(
device
,
0
,
NULL
,
D3DCLEAR_TARGET
,
0xff0000ff
,
0
.
0
f
,
0
);
ok
(
SUCCEEDED
(
hr
),
"Failed to clear, hr %#x
\n
"
,
hr
);
hr
=
IDirect3DDevice9_Present
(
device
,
NULL
,
NULL
,
NULL
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Failed to present, hr %#x.
\n
"
,
hr
);
/* Render target is unmodified. */
hr
=
IDirect3DDevice9_GetRenderTarget
(
device
,
0
,
&
test_surface
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get render target, hr %#x.
\n
"
,
hr
);
ok
(
test_surface
==
back_buffers
[
2
],
"Expected render target %p, got %p.
\n
"
,
back_buffers
[
2
],
test_surface
);
IDirect3DSurface9_Release
(
test_surface
);
/* Backbuffer surface pointers are unmodified */
for
(
i
=
0
;
i
<
sizeof
(
back_buffers
)
/
sizeof
(
*
back_buffers
);
++
i
)
{
hr
=
IDirect3DDevice9_GetBackBuffer
(
device
,
0
,
i
,
D3DBACKBUFFER_TYPE_MONO
,
&
test_surface
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get back buffer, hr %#x.
\n
"
,
hr
);
ok
(
test_surface
==
back_buffers
[
i
],
"Expected back buffer %u = %p, got %p.
\n
"
,
i
,
back_buffers
[
i
],
test_surface
);
IDirect3DSurface9_Release
(
test_surface
);
}
/* Contents were changed. */
color
=
getPixelColorFromSurface
(
back_buffers
[
0
],
1
,
1
);
todo_wine
ok
(
color
==
0xff00ff00
,
"Got unexpected color 0x%08x.
\n
"
,
color
);
color
=
getPixelColorFromSurface
(
back_buffers
[
1
],
1
,
1
);
todo_wine
ok
(
color
==
0xff0000ff
,
"Got unexpected color 0x%08x.
\n
"
,
color
);
hr
=
IDirect3DDevice9_Clear
(
device
,
0
,
NULL
,
D3DCLEAR_TARGET
,
0xff808080
,
0
.
0
f
,
0
);
ok
(
SUCCEEDED
(
hr
),
"Failed to clear, hr %#x
\n
"
,
hr
);
hr
=
IDirect3DDevice9_Present
(
device
,
NULL
,
NULL
,
NULL
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Failed to present, hr %#x.
\n
"
,
hr
);
color
=
getPixelColorFromSurface
(
back_buffers
[
0
],
1
,
1
);
todo_wine
ok
(
color
==
0xff0000ff
,
"Got unexpected color 0x%08x.
\n
"
,
color
);
color
=
getPixelColorFromSurface
(
back_buffers
[
1
],
1
,
1
);
todo_wine
ok
(
color
==
0xff808080
,
"Got unexpected color 0x%08x.
\n
"
,
color
);
hr
=
IDirect3DDevice9_Present
(
device
,
NULL
,
NULL
,
NULL
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Failed to present, hr %#x.
\n
"
,
hr
);
color
=
getPixelColorFromSurface
(
back_buffers
[
0
],
1
,
1
);
todo_wine
ok
(
color
==
0xff808080
,
"Got unexpected color 0x%08x.
\n
"
,
color
);
for
(
i
=
0
;
i
<
sizeof
(
back_buffers
)
/
sizeof
(
*
back_buffers
);
++
i
)
IDirect3DSurface9_Release
(
back_buffers
[
i
]);
refcount
=
IDirect3DDevice9_Release
(
device
);
ok
(
!
refcount
,
"Device has %u references left.
\n
"
,
refcount
);
IDirect3D9_Release
(
d3d
);
DestroyWindow
(
window
);
}
START_TEST
(
visual
)
{
D3DADAPTER_IDENTIFIER9
identifier
;
...
...
@@ -19914,4 +20020,5 @@ START_TEST(visual)
test_vertex_blending
();
test_updatetexture
();
test_depthbias
();
test_flip
();
}
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