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
509c49bd
Commit
509c49bd
authored
Jul 08, 2014
by
Stefan Dösinger
Committed by
Alexandre Julliard
Jul 09, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3d9/tests: Add a test for SetPriority and GetPriority.
parent
4cecbaa5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
130 additions
and
0 deletions
+130
-0
device.c
dlls/d3d9/tests/device.c
+130
-0
No files found.
dlls/d3d9/tests/device.c
View file @
509c49bd
...
...
@@ -8987,6 +8987,135 @@ done:
DestroyWindow
(
window
);
}
static
void
test_resource_priority
(
void
)
{
IDirect3DDevice9
*
device
;
IDirect3DSurface9
*
surface
;
IDirect3DTexture9
*
texture
;
IDirect3DVertexBuffer9
*
buffer
;
IDirect3D9
*
d3d
;
ULONG
refcount
;
HWND
window
;
HRESULT
hr
;
static
const
struct
{
D3DPOOL
pool
;
const
char
*
name
;
BOOL
can_set_priority
;
}
test_data
[]
=
{
{
D3DPOOL_DEFAULT
,
"D3DPOOL_DEFAULT"
,
FALSE
},
{
D3DPOOL_SYSTEMMEM
,
"D3DPOOL_SYSTEMMEM"
,
FALSE
},
{
D3DPOOL_MANAGED
,
"D3DPOOL_MANAGED"
,
TRUE
},
{
D3DPOOL_SCRATCH
,
"D3DPOOL_SCRATCH"
,
FALSE
}
};
unsigned
int
i
;
DWORD
priority
;
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
"
);
if
(
!
(
device
=
create_device
(
d3d
,
window
,
window
,
TRUE
)))
{
skip
(
"Failed to create a D3D device, skipping tests.
\n
"
);
IDirect3D9_Release
(
d3d
);
DestroyWindow
(
window
);
return
;
}
for
(
i
=
0
;
i
<
sizeof
(
test_data
)
/
sizeof
(
*
test_data
);
i
++
)
{
hr
=
IDirect3DDevice9_CreateTexture
(
device
,
16
,
16
,
0
,
0
,
D3DFMT_X8R8G8B8
,
test_data
[
i
].
pool
,
&
texture
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Failed to create texture, hr %#x, pool %s.
\n
"
,
hr
,
test_data
[
i
].
name
);
hr
=
IDirect3DTexture9_GetSurfaceLevel
(
texture
,
0
,
&
surface
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get surface level, hr %#x.
\n
"
,
hr
);
priority
=
IDirect3DTexture9_GetPriority
(
texture
);
ok
(
priority
==
0
,
"Got unexpected priority %u, pool %s.
\n
"
,
priority
,
test_data
[
i
].
name
);
priority
=
IDirect3DTexture9_SetPriority
(
texture
,
1
);
ok
(
priority
==
0
,
"Got unexpected priority %u, pool %s.
\n
"
,
priority
,
test_data
[
i
].
name
);
priority
=
IDirect3DTexture9_GetPriority
(
texture
);
if
(
test_data
[
i
].
can_set_priority
)
{
ok
(
priority
==
1
,
"Got unexpected priority %u, pool %s.
\n
"
,
priority
,
test_data
[
i
].
name
);
priority
=
IDirect3DTexture9_SetPriority
(
texture
,
2
);
ok
(
priority
==
1
,
"Got unexpected priority %u, pool %s.
\n
"
,
priority
,
test_data
[
i
].
name
);
}
else
ok
(
priority
==
0
,
"Got unexpected priority %u, pool %s.
\n
"
,
priority
,
test_data
[
i
].
name
);
priority
=
IDirect3DSurface9_GetPriority
(
surface
);
ok
(
priority
==
0
,
"Got unexpected priority %u, pool %s.
\n
"
,
priority
,
test_data
[
i
].
name
);
priority
=
IDirect3DSurface9_SetPriority
(
surface
,
1
);
ok
(
priority
==
0
,
"Got unexpected priority %u, pool %s.
\n
"
,
priority
,
test_data
[
i
].
name
);
priority
=
IDirect3DSurface9_GetPriority
(
surface
);
ok
(
priority
==
0
,
"Got unexpected priority %u, pool %s.
\n
"
,
priority
,
test_data
[
i
].
name
);
IDirect3DSurface9_Release
(
surface
);
IDirect3DTexture9_Release
(
texture
);
if
(
test_data
[
i
].
pool
!=
D3DPOOL_MANAGED
)
{
hr
=
IDirect3DDevice9_CreateOffscreenPlainSurface
(
device
,
16
,
16
,
D3DFMT_X8R8G8B8
,
test_data
[
i
].
pool
,
&
surface
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Failed to create surface, hr %#x, pool %s.
\n
"
,
hr
,
test_data
[
i
].
name
);
priority
=
IDirect3DSurface9_GetPriority
(
surface
);
ok
(
priority
==
0
,
"Got unexpected priority %u, pool %s.
\n
"
,
priority
,
test_data
[
i
].
name
);
priority
=
IDirect3DSurface9_SetPriority
(
surface
,
1
);
ok
(
priority
==
0
,
"Got unexpected priority %u, pool %s.
\n
"
,
priority
,
test_data
[
i
].
name
);
priority
=
IDirect3DSurface9_GetPriority
(
surface
);
ok
(
priority
==
0
,
"Got unexpected priority %u, pool %s.
\n
"
,
priority
,
test_data
[
i
].
name
);
IDirect3DSurface9_Release
(
surface
);
}
if
(
test_data
[
i
].
pool
!=
D3DPOOL_SCRATCH
)
{
hr
=
IDirect3DDevice9_CreateVertexBuffer
(
device
,
256
,
0
,
0
,
test_data
[
i
].
pool
,
&
buffer
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Failed to create buffer, hr %#x, pool %s.
\n
"
,
hr
,
test_data
[
i
].
name
);
priority
=
IDirect3DVertexBuffer9_GetPriority
(
buffer
);
ok
(
priority
==
0
,
"Got unexpected priority %u, pool %s.
\n
"
,
priority
,
test_data
[
i
].
name
);
priority
=
IDirect3DVertexBuffer9_SetPriority
(
buffer
,
1
);
ok
(
priority
==
0
,
"Got unexpected priority %u, pool %s.
\n
"
,
priority
,
test_data
[
i
].
name
);
priority
=
IDirect3DVertexBuffer9_GetPriority
(
buffer
);
if
(
test_data
[
i
].
can_set_priority
)
{
ok
(
priority
==
1
,
"Got unexpected priority %u, pool %s.
\n
"
,
priority
,
test_data
[
i
].
name
);
priority
=
IDirect3DVertexBuffer9_SetPriority
(
buffer
,
0
);
ok
(
priority
==
1
,
"Got unexpected priority %u, pool %s.
\n
"
,
priority
,
test_data
[
i
].
name
);
}
else
ok
(
priority
==
0
,
"Got unexpected priority %u, pool %s.
\n
"
,
priority
,
test_data
[
i
].
name
);
IDirect3DVertexBuffer9_Release
(
buffer
);
}
}
hr
=
IDirect3DDevice9_CreateRenderTarget
(
device
,
16
,
16
,
D3DFMT_X8R8G8B8
,
D3DMULTISAMPLE_NONE
,
0
,
FALSE
,
&
surface
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Failed to create render target, hr %#x.
\n
"
,
hr
);
priority
=
IDirect3DSurface9_GetPriority
(
surface
);
ok
(
priority
==
0
,
"Got unexpected priority %u.
\n
"
,
priority
);
priority
=
IDirect3DSurface9_SetPriority
(
surface
,
1
);
ok
(
priority
==
0
,
"Got unexpected priority %u.
\n
"
,
priority
);
priority
=
IDirect3DSurface9_GetPriority
(
surface
);
ok
(
priority
==
0
,
"Got unexpected priority %u.
\n
"
,
priority
);
IDirect3DSurface9_Release
(
surface
);
refcount
=
IDirect3DDevice9_Release
(
device
);
ok
(
!
refcount
,
"Device has %u references left.
\n
"
,
refcount
);
IDirect3D9_Release
(
d3d
);
DestroyWindow
(
window
);
}
START_TEST
(
device
)
{
WNDCLASSA
wc
=
{
0
};
...
...
@@ -9086,6 +9215,7 @@ START_TEST(device)
test_mipmap_lock
();
test_writeonly_resource
();
test_lost_device
();
test_resource_priority
();
UnregisterClassA
(
"d3d9_test_wc"
,
GetModuleHandleA
(
NULL
));
}
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