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
39e7248d
Commit
39e7248d
authored
Apr 12, 2013
by
Stefan Dösinger
Committed by
Alexandre Julliard
Apr 16, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3d9/tests: Test NPOT texture creation.
parent
c6ed6273
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
124 additions
and
0 deletions
+124
-0
device.c
dlls/d3d9/tests/device.c
+124
-0
No files found.
dlls/d3d9/tests/device.c
View file @
39e7248d
...
@@ -6267,6 +6267,129 @@ static void test_rtpatch(void)
...
@@ -6267,6 +6267,129 @@ static void test_rtpatch(void)
DestroyWindow
(
window
);
DestroyWindow
(
window
);
}
}
static
void
test_npot_textures
(
void
)
{
IDirect3DDevice9
*
device
=
NULL
;
IDirect3D9
*
d3d9
;
ULONG
refcount
;
HWND
window
=
NULL
;
HRESULT
hr
;
D3DCAPS9
caps
;
IDirect3DTexture9
*
texture
;
IDirect3DCubeTexture9
*
cube_texture
;
IDirect3DVolumeTexture9
*
volume_texture
;
struct
{
D3DPOOL
pool
;
const
char
*
pool_name
;
HRESULT
hr
;
}
pools
[]
=
{
{
D3DPOOL_DEFAULT
,
"D3DPOOL_DEFAULT"
,
D3DERR_INVALIDCALL
},
{
D3DPOOL_MANAGED
,
"D3DPOOL_MANAGED"
,
D3DERR_INVALIDCALL
},
{
D3DPOOL_SYSTEMMEM
,
"D3DPOOL_SYSTEMMEM"
,
D3DERR_INVALIDCALL
},
{
D3DPOOL_SCRATCH
,
"D3DPOOL_SCRATCH"
,
D3D_OK
},
};
unsigned
int
i
,
levels
;
BOOL
tex_pow2
,
cube_pow2
,
vol_pow2
;
if
(
!
(
d3d9
=
pDirect3DCreate9
(
D3D_SDK_VERSION
)))
{
skip
(
"Failed to create IDirect3D9 object, skipping tests.
\n
"
);
return
;
}
window
=
CreateWindowA
(
"static"
,
"d3d9_test"
,
WS_OVERLAPPEDWINDOW
,
0
,
0
,
640
,
480
,
0
,
0
,
0
,
0
);
if
(
!
(
device
=
create_device
(
d3d9
,
window
,
window
,
TRUE
)))
{
skip
(
"Failed to create a D3D device, skipping tests.
\n
"
);
goto
done
;
}
hr
=
IDirect3DDevice9_GetDeviceCaps
(
device
,
&
caps
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get caps, hr %#x.
\n
"
,
hr
);
tex_pow2
=
!!
(
caps
.
TextureCaps
&
D3DPTEXTURECAPS_POW2
);
cube_pow2
=
!!
(
caps
.
TextureCaps
&
D3DPTEXTURECAPS_CUBEMAP_POW2
);
vol_pow2
=
!!
(
caps
.
TextureCaps
&
D3DPTEXTURECAPS_VOLUMEMAP_POW2
);
ok
(
cube_pow2
==
tex_pow2
,
"Cube texture and 2d texture pow2 restrictions mismatch.
\n
"
);
ok
(
vol_pow2
==
tex_pow2
,
"Volume texture and 2d texture pow2 restrictions mismatch.
\n
"
);
for
(
i
=
0
;
i
<
sizeof
(
pools
)
/
sizeof
(
*
pools
);
i
++
)
{
for
(
levels
=
0
;
levels
<=
2
;
levels
++
)
{
HRESULT
expected
;
hr
=
IDirect3DDevice9_CreateTexture
(
device
,
10
,
10
,
levels
,
0
,
D3DFMT_X8R8G8B8
,
pools
[
i
].
pool
,
&
texture
,
NULL
);
if
(
!
tex_pow2
)
{
expected
=
D3D_OK
;
}
else
if
(
caps
.
TextureCaps
&
D3DPTEXTURECAPS_NONPOW2CONDITIONAL
)
{
if
(
levels
==
1
)
expected
=
D3D_OK
;
else
expected
=
pools
[
i
].
hr
;
}
else
{
expected
=
pools
[
i
].
hr
;
}
ok
(
hr
==
expected
,
"CreateTexture(w=h=10, %s, levels=%u) returned hr %#x, expected %#x.
\n
"
,
pools
[
i
].
pool_name
,
levels
,
hr
,
expected
);
if
(
SUCCEEDED
(
hr
))
IDirect3DTexture9_Release
(
texture
);
}
hr
=
IDirect3DDevice9_CreateCubeTexture
(
device
,
3
,
1
,
0
,
D3DFMT_X8R8G8B8
,
pools
[
i
].
pool
,
&
cube_texture
,
NULL
);
if
(
tex_pow2
)
{
ok
(
hr
==
pools
[
i
].
hr
,
"CreateCubeTexture(EdgeLength=3, %s) returned hr %#x, expected %#x.
\n
"
,
pools
[
i
].
pool_name
,
hr
,
pools
[
i
].
hr
);
}
else
{
ok
(
SUCCEEDED
(
hr
),
"CreateCubeTexture(EdgeLength=3, %s) returned hr %#x, expected %#x.
\n
"
,
pools
[
i
].
pool_name
,
hr
,
D3D_OK
);
}
if
(
SUCCEEDED
(
hr
))
IDirect3DCubeTexture9_Release
(
cube_texture
);
hr
=
IDirect3DDevice9_CreateVolumeTexture
(
device
,
2
,
2
,
3
,
1
,
0
,
D3DFMT_X8R8G8B8
,
pools
[
i
].
pool
,
&
volume_texture
,
NULL
);
if
(
tex_pow2
)
{
ok
(
hr
==
pools
[
i
].
hr
,
"CreateVolumeTextur(Depth=3, %s) returned hr %#x, expected %#x.
\n
"
,
pools
[
i
].
pool_name
,
hr
,
pools
[
i
].
hr
);
}
else
{
ok
(
SUCCEEDED
(
hr
),
"CreateVolumeTextur(Depth=3, %s) returned hr %#x, expected %#x.
\n
"
,
pools
[
i
].
pool_name
,
hr
,
D3D_OK
);
}
if
(
SUCCEEDED
(
hr
))
IDirect3DVolumeTexture9_Release
(
volume_texture
);
}
done:
if
(
device
)
{
refcount
=
IDirect3DDevice9_Release
(
device
);
ok
(
!
refcount
,
"Device has %u references left.
\n
"
,
refcount
);
}
IDirect3D9_Release
(
d3d9
);
DestroyWindow
(
window
);
}
START_TEST
(
device
)
START_TEST
(
device
)
{
{
HMODULE
d3d9_handle
=
LoadLibraryA
(
"d3d9.dll"
);
HMODULE
d3d9_handle
=
LoadLibraryA
(
"d3d9.dll"
);
...
@@ -6355,6 +6478,7 @@ START_TEST(device)
...
@@ -6355,6 +6478,7 @@ START_TEST(device)
test_set_palette
();
test_set_palette
();
test_swvp_buffer
();
test_swvp_buffer
();
test_rtpatch
();
test_rtpatch
();
test_npot_textures
();
}
}
out
:
out
:
...
...
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