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
30d5e375
Commit
30d5e375
authored
Jul 22, 2010
by
Owen Rudge
Committed by
Alexandre Julliard
Jul 24, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3dx9: Implement D3DXCreateTexture plus tests.
parent
a9fe0ccb
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
172 additions
and
1 deletion
+172
-1
texture.c
dlls/d3dx9_36/tests/texture.c
+161
-0
texture.c
dlls/d3dx9_36/texture.c
+11
-1
No files found.
dlls/d3dx9_36/tests/texture.c
View file @
30d5e375
...
...
@@ -155,6 +155,166 @@ static void test_D3DXCheckTextureRequirements(IDirect3DDevice9 *device)
ok
(
format
==
D3DFMT_A8R8G8B8
,
"Returned format %u, expected %u
\n
"
,
format
,
D3DFMT_A8R8G8B8
);
}
static
void
test_D3DXCreateTexture
(
IDirect3DDevice9
*
device
)
{
IDirect3DTexture9
*
texture
;
D3DSURFACE_DESC
desc
;
D3DCAPS9
caps
;
UINT
mipmaps
;
HRESULT
hr
;
IDirect3DDevice9_GetDeviceCaps
(
device
,
&
caps
);
hr
=
D3DXCreateTexture
(
NULL
,
0
,
0
,
0
,
0
,
D3DX_DEFAULT
,
0
,
D3DPOOL_DEFAULT
);
ok
(
hr
==
D3DERR_INVALIDCALL
,
"D3DXCreateTexture returned %#x, expected %#x
\n
"
,
hr
,
D3DERR_INVALIDCALL
);
/* width and height tests */
hr
=
D3DXCreateTexture
(
device
,
D3DX_DEFAULT
,
D3DX_DEFAULT
,
D3DX_DEFAULT
,
0
,
0
,
D3DPOOL_DEFAULT
,
&
texture
);
ok
(
hr
==
D3D_OK
,
"D3DXCreateTexture returned %#x, expected %#x
\n
"
,
hr
,
D3D_OK
);
if
(
texture
)
{
hr
=
IDirect3DTexture9_GetLevelDesc
(
texture
,
0
,
&
desc
);
ok
(
desc
.
Width
==
256
,
"Returned width %d, expected %d
\n
"
,
desc
.
Width
,
256
);
ok
(
desc
.
Height
==
256
,
"Returned height %d, expected %d
\n
"
,
desc
.
Height
,
256
);
IDirect3DTexture9_Release
(
texture
);
}
hr
=
D3DXCreateTexture
(
device
,
0
,
0
,
0
,
0
,
0
,
D3DPOOL_DEFAULT
,
&
texture
);
ok
(
hr
==
D3D_OK
,
"D3DXCreateTexture returned %#x, expected %#x
\n
"
,
hr
,
D3D_OK
);
if
(
texture
)
{
hr
=
IDirect3DTexture9_GetLevelDesc
(
texture
,
0
,
&
desc
);
ok
(
desc
.
Width
==
1
,
"Returned width %d, expected %d
\n
"
,
desc
.
Width
,
1
);
ok
(
desc
.
Height
==
1
,
"Returned height %d, expected %d
\n
"
,
desc
.
Height
,
1
);
IDirect3DTexture9_Release
(
texture
);
}
if
(
caps
.
TextureCaps
&
D3DPTEXTURECAPS_POW2
)
skip
(
"Hardware only supports pow2 textures
\n
"
);
else
{
hr
=
D3DXCreateTexture
(
device
,
D3DX_DEFAULT
,
63
,
0
,
0
,
0
,
D3DPOOL_DEFAULT
,
&
texture
);
ok
((
hr
==
D3D_OK
)
||
/* may not work with conditional NPOT */
((
hr
!=
D3D_OK
)
&&
(
caps
.
TextureCaps
&
D3DPTEXTURECAPS_NONPOW2CONDITIONAL
)),
"D3DXCreateTexture returned %#x, expected %#x
\n
"
,
hr
,
D3D_OK
);
if
(
texture
)
{
hr
=
IDirect3DTexture9_GetLevelDesc
(
texture
,
0
,
&
desc
);
/* Conditional NPOT may create a texture with different dimensions, so allow those
situations instead of returning a fail */
ok
(
desc
.
Width
==
63
||
(
caps
.
TextureCaps
&
D3DPTEXTURECAPS_NONPOW2CONDITIONAL
),
"Returned width %d, expected %d
\n
"
,
desc
.
Width
,
63
);
ok
(
desc
.
Height
==
63
||
(
caps
.
TextureCaps
&
D3DPTEXTURECAPS_NONPOW2CONDITIONAL
),
"Returned height %d, expected %d
\n
"
,
desc
.
Height
,
63
);
IDirect3DTexture9_Release
(
texture
);
}
}
/* mipmaps */
hr
=
D3DXCreateTexture
(
device
,
64
,
63
,
9
,
0
,
0
,
D3DPOOL_DEFAULT
,
&
texture
);
ok
(
hr
==
D3D_OK
,
"D3DXCreateTexture returned %#x, expected %#x
\n
"
,
hr
,
D3D_OK
);
if
(
texture
)
{
mipmaps
=
IDirect3DTexture9_GetLevelCount
(
texture
);
ok
(
mipmaps
==
7
,
"Returned mipmaps %d, expected %d
\n
"
,
mipmaps
,
7
);
IDirect3DTexture9_Release
(
texture
);
}
hr
=
D3DXCreateTexture
(
device
,
284
,
137
,
9
,
0
,
0
,
D3DPOOL_DEFAULT
,
&
texture
);
ok
(
hr
==
D3D_OK
,
"D3DXCreateTexture returned %#x, expected %#x
\n
"
,
hr
,
D3D_OK
);
if
(
texture
)
{
mipmaps
=
IDirect3DTexture9_GetLevelCount
(
texture
);
ok
(
mipmaps
==
9
,
"Returned mipmaps %d, expected %d
\n
"
,
mipmaps
,
9
);
IDirect3DTexture9_Release
(
texture
);
}
hr
=
D3DXCreateTexture
(
device
,
0
,
0
,
20
,
0
,
0
,
D3DPOOL_DEFAULT
,
&
texture
);
ok
(
hr
==
D3D_OK
,
"D3DXCreateTexture returned %#x, expected %#x
\n
"
,
hr
,
D3D_OK
);
if
(
texture
)
{
mipmaps
=
IDirect3DTexture9_GetLevelCount
(
texture
);
ok
(
mipmaps
==
1
,
"Returned mipmaps %d, expected %d
\n
"
,
mipmaps
,
1
);
IDirect3DTexture9_Release
(
texture
);
}
hr
=
D3DXCreateTexture
(
device
,
64
,
64
,
1
,
0
,
0
,
D3DPOOL_DEFAULT
,
&
texture
);
ok
(
hr
==
D3D_OK
,
"D3DXCreateTexture returned %#x, expected %#x
\n
"
,
hr
,
D3D_OK
);
if
(
texture
)
{
mipmaps
=
IDirect3DTexture9_GetLevelCount
(
texture
);
ok
(
mipmaps
==
1
,
"Returned mipmaps %d, expected %d
\n
"
,
mipmaps
,
1
);
IDirect3DTexture9_Release
(
texture
);
}
/* usage */
hr
=
D3DXCreateTexture
(
device
,
0
,
0
,
0
,
D3DUSAGE_WRITEONLY
,
0
,
D3DPOOL_DEFAULT
,
&
texture
);
ok
(
hr
==
D3DERR_INVALIDCALL
,
"D3DXCreateTexture succeeded, but should have failed.
\n
"
);
hr
=
D3DXCreateTexture
(
device
,
0
,
0
,
0
,
D3DUSAGE_DONOTCLIP
,
0
,
D3DPOOL_DEFAULT
,
&
texture
);
ok
(
hr
==
D3DERR_INVALIDCALL
,
"D3DXCreateTexture succeeded, but should have failed.
\n
"
);
hr
=
D3DXCreateTexture
(
device
,
0
,
0
,
0
,
D3DUSAGE_POINTS
,
0
,
D3DPOOL_DEFAULT
,
&
texture
);
ok
(
hr
==
D3DERR_INVALIDCALL
,
"D3DXCreateTexture succeeded, but should have failed.
\n
"
);
hr
=
D3DXCreateTexture
(
device
,
0
,
0
,
0
,
D3DUSAGE_RTPATCHES
,
0
,
D3DPOOL_DEFAULT
,
&
texture
);
ok
(
hr
==
D3DERR_INVALIDCALL
,
"D3DXCreateTexture succeeded, but should have failed.
\n
"
);
hr
=
D3DXCreateTexture
(
device
,
0
,
0
,
0
,
D3DUSAGE_NPATCHES
,
0
,
D3DPOOL_DEFAULT
,
&
texture
);
ok
(
hr
==
D3DERR_INVALIDCALL
,
"D3DXCreateTexture succeeded, but should have failed.
\n
"
);
/* format */
hr
=
D3DXCreateTexture
(
device
,
0
,
0
,
0
,
0
,
D3DFMT_UNKNOWN
,
D3DPOOL_DEFAULT
,
&
texture
);
ok
(
hr
==
D3D_OK
,
"D3DXCreateTexture returned %#x, expected %#x
\n
"
,
hr
,
D3D_OK
);
if
(
texture
)
{
hr
=
IDirect3DTexture9_GetLevelDesc
(
texture
,
0
,
&
desc
);
ok
(
desc
.
Format
==
D3DFMT_A8R8G8B8
,
"Returned format %u, expected %u
\n
"
,
desc
.
Format
,
D3DFMT_A8R8G8B8
);
IDirect3DTexture9_Release
(
texture
);
}
hr
=
D3DXCreateTexture
(
device
,
0
,
0
,
0
,
0
,
0
,
D3DPOOL_DEFAULT
,
&
texture
);
ok
(
hr
==
D3D_OK
,
"D3DXCreateTexture returned %#x, expected %#x
\n
"
,
hr
,
D3D_OK
);
if
(
texture
)
{
hr
=
IDirect3DTexture9_GetLevelDesc
(
texture
,
0
,
&
desc
);
ok
(
desc
.
Format
==
D3DFMT_A8R8G8B8
,
"Returned format %u, expected %u
\n
"
,
desc
.
Format
,
D3DFMT_A8R8G8B8
);
IDirect3DTexture9_Release
(
texture
);
}
}
START_TEST
(
texture
)
{
HWND
wnd
;
...
...
@@ -187,6 +347,7 @@ START_TEST(texture)
}
test_D3DXCheckTextureRequirements
(
device
);
test_D3DXCreateTexture
(
device
);
IDirect3DDevice9_Release
(
device
);
IDirect3D9_Release
(
d3d
);
...
...
dlls/d3dx9_36/texture.c
View file @
30d5e375
...
...
@@ -185,9 +185,19 @@ HRESULT WINAPI D3DXCreateTexture(LPDIRECT3DDEVICE9 pDevice,
D3DPOOL
pool
,
LPDIRECT3DTEXTURE9
*
ppTexture
)
{
FIXME
(
"(%p, %u, %u, %u, %x, %x, %x, %p): semi-stub
\n
"
,
pDevice
,
width
,
height
,
miplevels
,
usage
,
format
,
HRESULT
hr
;
TRACE
(
"(%p, %u, %u, %u, %x, %x, %x, %p)
\n
"
,
pDevice
,
width
,
height
,
miplevels
,
usage
,
format
,
pool
,
ppTexture
);
if
(
!
pDevice
||
!
ppTexture
)
return
D3DERR_INVALIDCALL
;
hr
=
D3DXCheckTextureRequirements
(
pDevice
,
&
width
,
&
height
,
&
miplevels
,
usage
,
&
format
,
pool
);
if
(
FAILED
(
hr
))
return
hr
;
return
IDirect3DDevice9_CreateTexture
(
pDevice
,
width
,
height
,
miplevels
,
usage
,
format
,
pool
,
ppTexture
,
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