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
c68eaaa0
Commit
c68eaaa0
authored
Apr 09, 2017
by
Henri Verbeet
Committed by
Alexandre Julliard
Apr 10, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3d9/tests: Introduce mip-mapping to add_dirty_rect_test().
Signed-off-by:
Henri Verbeet
<
hverbeet@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
871657f1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
9 deletions
+44
-9
visual.c
dlls/d3d9/tests/visual.c
+44
-9
No files found.
dlls/d3d9/tests/visual.c
View file @
c68eaaa0
...
...
@@ -17319,7 +17319,7 @@ static void add_dirty_rect_test(void)
IDirect3DTexture9
*
tex_dst1
,
*
tex_dst2
,
*
tex_src_red
,
*
tex_src_green
,
*
tex_managed
,
*
tex_dynamic
;
IDirect3DSurface9
*
surface_dst2
,
*
surface_src_green
,
*
surface_src_red
,
*
surface_managed
,
*
surface_dynamic
;
*
surface_managed
0
,
*
surface_managed1
,
*
surface_dynamic
;
IDirect3DDevice9
*
device
;
IDirect3D9
*
d3d
;
unsigned
int
i
;
...
...
@@ -17353,7 +17353,7 @@ static void add_dirty_rect_test(void)
hr
=
IDirect3DDevice9_CreateTexture
(
device
,
256
,
256
,
1
,
0
,
D3DFMT_X8R8G8B8
,
D3DPOOL_SYSTEMMEM
,
&
tex_src_green
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Failed to create texture, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_CreateTexture
(
device
,
256
,
256
,
1
,
0
,
D3DFMT_X8R8G8B8
,
hr
=
IDirect3DDevice9_CreateTexture
(
device
,
256
,
256
,
2
,
0
,
D3DFMT_X8R8G8B8
,
D3DPOOL_MANAGED
,
&
tex_managed
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Failed to create texture, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_CreateTexture
(
device
,
256
,
256
,
1
,
D3DUSAGE_DYNAMIC
,
...
...
@@ -17366,7 +17366,9 @@ static void add_dirty_rect_test(void)
ok
(
SUCCEEDED
(
hr
),
"Failed to get surface level, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DTexture9_GetSurfaceLevel
(
tex_src_red
,
0
,
&
surface_src_red
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get surface level, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DTexture9_GetSurfaceLevel
(
tex_managed
,
0
,
&
surface_managed
);
hr
=
IDirect3DTexture9_GetSurfaceLevel
(
tex_managed
,
0
,
&
surface_managed0
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get surface level, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DTexture9_GetSurfaceLevel
(
tex_managed
,
1
,
&
surface_managed1
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get surface level, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DTexture9_GetSurfaceLevel
(
tex_dynamic
,
0
,
&
surface_dynamic
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get surface level, hr %#x.
\n
"
,
hr
);
...
...
@@ -17380,6 +17382,8 @@ static void add_dirty_rect_test(void)
ok
(
SUCCEEDED
(
hr
),
"Failed to set color op, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetTextureStageState
(
device
,
0
,
D3DTSS_COLORARG1
,
D3DTA_TEXTURE
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set color arg, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetSamplerState
(
device
,
0
,
D3DSAMP_MIPFILTER
,
D3DTEXF_POINT
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set sampler state, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_UpdateTexture
(
device
,
(
IDirect3DBaseTexture9
*
)
tex_src_green
,
(
IDirect3DBaseTexture9
*
)
tex_dst1
);
...
...
@@ -17563,7 +17567,8 @@ static void add_dirty_rect_test(void)
ok
(
SUCCEEDED
(
hr
),
"Failed to present, hr %#x.
\n
"
,
hr
);
/* Tests with managed textures. */
fill_surface
(
surface_managed
,
0x00ff0000
,
0
);
fill_surface
(
surface_managed0
,
0x00ff0000
,
0
);
fill_surface
(
surface_managed1
,
0x00ff0000
,
0
);
hr
=
IDirect3DDevice9_SetTexture
(
device
,
0
,
(
IDirect3DBaseTexture9
*
)
tex_managed
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set texture, hr %#x.
\n
"
,
hr
);
add_dirty_rect_test_draw
(
device
);
...
...
@@ -17572,15 +17577,30 @@ static void add_dirty_rect_test(void)
"Expected color 0x00ff0000, got 0x%08x.
\n
"
,
color
);
hr
=
IDirect3DDevice9_Present
(
device
,
NULL
,
NULL
,
NULL
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Failed to present, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetSamplerState
(
device
,
0
,
D3DSAMP_MAXMIPLEVEL
,
1
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set sampler state, hr %#x.
\n
"
,
hr
);
add_dirty_rect_test_draw
(
device
);
color
=
getPixelColor
(
device
,
320
,
240
);
ok
(
color_match
(
color
,
0x00ff0000
,
1
),
"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
);
/* Managed textures also honor D3DLOCK_NO_DIRTY_UPDATE. */
fill_surface
(
surface_managed
,
0x0000ff00
,
D3DLOCK_NO_DIRTY_UPDATE
);
fill_surface
(
surface_managed0
,
0x0000ff00
,
D3DLOCK_NO_DIRTY_UPDATE
);
fill_surface
(
surface_managed1
,
0x000000ff
,
D3DLOCK_NO_DIRTY_UPDATE
);
add_dirty_rect_test_draw
(
device
);
color
=
getPixelColor
(
device
,
320
,
240
);
ok
(
color_match
(
color
,
0x00ff0000
,
1
),
"Expected color 0x00ff0000, got 0x%08x.
\n
"
,
color
);
hr
=
IDirect3DDevice9_Present
(
device
,
NULL
,
NULL
,
NULL
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Failed to present, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetSamplerState
(
device
,
0
,
D3DSAMP_MAXMIPLEVEL
,
0
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set sampler state, hr %#x.
\n
"
,
hr
);
add_dirty_rect_test_draw
(
device
);
color
=
getPixelColor
(
device
,
320
,
240
);
ok
(
color_match
(
color
,
0x00ff0000
,
1
),
"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
);
/* AddDirtyRect uploads the new contents.
* Side note, not tested in the test: Partial surface updates work, and two separate
...
...
@@ -17594,15 +17614,29 @@ static void add_dirty_rect_test(void)
"Expected color 0x0000ff00, got 0x%08x.
\n
"
,
color
);
hr
=
IDirect3DDevice9_Present
(
device
,
NULL
,
NULL
,
NULL
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Failed to present, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetSamplerState
(
device
,
0
,
D3DSAMP_MAXMIPLEVEL
,
1
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set sampler state, hr %#x.
\n
"
,
hr
);
add_dirty_rect_test_draw
(
device
);
color
=
getPixelColor
(
device
,
320
,
240
);
todo_wine
ok
(
color_match
(
color
,
0x000000ff
,
1
),
"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
);
/* So does EvictManagedResources. */
fill_surface
(
surface_managed
,
0x000000ff
,
D3DLOCK_NO_DIRTY_UPDATE
);
fill_surface
(
surface_managed0
,
0x00ffff00
,
D3DLOCK_NO_DIRTY_UPDATE
);
fill_surface
(
surface_managed1
,
0x00ff00ff
,
D3DLOCK_NO_DIRTY_UPDATE
);
hr
=
IDirect3DDevice9_EvictManagedResources
(
device
);
ok
(
SUCCEEDED
(
hr
),
"Failed to evict managed resources, hr %#x.
\n
"
,
hr
);
add_dirty_rect_test_draw
(
device
);
color
=
getPixelColor
(
device
,
320
,
240
);
ok
(
color_match
(
color
,
0x000000ff
,
1
),
"Expected color 0x000000ff, got 0x%08x.
\n
"
,
color
);
ok
(
color_match
(
color
,
0x00ff00ff
,
1
),
"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
);
hr
=
IDirect3DDevice9_SetSamplerState
(
device
,
0
,
D3DSAMP_MAXMIPLEVEL
,
0
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set sampler state, hr %#x.
\n
"
,
hr
);
add_dirty_rect_test_draw
(
device
);
color
=
getPixelColor
(
device
,
320
,
240
);
ok
(
color_match
(
color
,
0x00ffff00
,
1
),
"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
);
...
...
@@ -17645,7 +17679,8 @@ static void add_dirty_rect_test(void)
hr
=
IDirect3DDevice9_SetTexture
(
device
,
0
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set texture, hr %#x.
\n
"
,
hr
);
IDirect3DSurface9_Release
(
surface_dst2
);
IDirect3DSurface9_Release
(
surface_managed
);
IDirect3DSurface9_Release
(
surface_managed1
);
IDirect3DSurface9_Release
(
surface_managed0
);
IDirect3DSurface9_Release
(
surface_src_red
);
IDirect3DSurface9_Release
(
surface_src_green
);
IDirect3DSurface9_Release
(
surface_dynamic
);
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