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
69337665
Commit
69337665
authored
Oct 18, 2010
by
Matteo Bruni
Committed by
Alexandre Julliard
Nov 04, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3dx9: Implement D3DXCheckCubeTextureRequirements.
parent
a875f383
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
123 additions
and
6 deletions
+123
-6
d3dx9_36.spec
dlls/d3dx9_36/d3dx9_36.spec
+1
-1
texture.c
dlls/d3dx9_36/tests/texture.c
+82
-5
texture.c
dlls/d3dx9_36/texture.c
+40
-0
No files found.
dlls/d3dx9_36/d3dx9_36.spec
View file @
69337665
...
...
@@ -4,7 +4,7 @@
@ stdcall D3DXAssembleShaderFromResourceA(long str ptr ptr long ptr ptr)
@ stdcall D3DXAssembleShaderFromResourceW(long wstr ptr ptr long ptr ptr)
@ stdcall D3DXBoxBoundProbe(ptr ptr ptr ptr)
@ st
ub D3DXCheckCubeTextureRequirements
@ st
dcall D3DXCheckCubeTextureRequirements(ptr ptr ptr long ptr ptr)
@ stdcall D3DXCheckTextureRequirements(ptr ptr ptr ptr long ptr ptr)
@ stdcall D3DXCheckVersion(long long)
@ stub D3DXCheckVolumeTextureRequirements
...
...
dlls/d3dx9_36/tests/texture.c
View file @
69337665
...
...
@@ -92,11 +92,6 @@ static void test_D3DXCheckTextureRequirements(IDirect3DDevice9 *device)
ok
(
hr
==
D3D_OK
,
"D3DXCheckTextureRequirements returned %#x, expected %#x
\n
"
,
hr
,
D3D_OK
);
ok
(
width
==
1
,
"Returned width %d, expected %d
\n
"
,
width
,
1
);
width
=
D3DX_DEFAULT
;
hr
=
D3DXCheckTextureRequirements
(
device
,
&
width
,
NULL
,
NULL
,
0
,
NULL
,
D3DPOOL_DEFAULT
);
ok
(
hr
==
D3D_OK
,
"D3DXCheckTextureRequirements returned %#x, expected %#x
\n
"
,
hr
,
D3D_OK
);
ok
(
width
==
256
,
"Returned width %d, expected %d
\n
"
,
width
,
256
);
width
=
0xFFFFFFFE
;
hr
=
D3DXCheckTextureRequirements
(
device
,
&
width
,
NULL
,
NULL
,
0
,
NULL
,
D3DPOOL_DEFAULT
);
ok
(
hr
==
D3D_OK
,
"D3DXCheckTextureRequirements returned %#x, expected %#x
\n
"
,
hr
,
D3D_OK
);
...
...
@@ -196,6 +191,87 @@ static void test_D3DXCheckTextureRequirements(IDirect3DDevice9 *device)
IDirect3D9_Release
(
d3d
);
}
static
void
test_D3DXCheckCubeTextureRequirements
(
IDirect3DDevice9
*
device
)
{
UINT
size
,
mipmaps
;
D3DFORMAT
format
;
D3DCAPS9
caps
;
HRESULT
hr
;
IDirect3DDevice9_GetDeviceCaps
(
device
,
&
caps
);
/* general tests */
hr
=
D3DXCheckCubeTextureRequirements
(
device
,
NULL
,
NULL
,
0
,
NULL
,
D3DPOOL_DEFAULT
);
ok
(
hr
==
D3D_OK
,
"D3DXCheckCubeTextureRequirements returned %#x, expected %#x
\n
"
,
hr
,
D3D_OK
);
hr
=
D3DXCheckCubeTextureRequirements
(
device
,
NULL
,
NULL
,
D3DX_DEFAULT
,
NULL
,
D3DPOOL_DEFAULT
);
ok
(
hr
==
D3D_OK
,
"D3DXCheckCubeTextureRequirements returned %#x, expected %#x
\n
"
,
hr
,
D3D_OK
);
hr
=
D3DXCheckCubeTextureRequirements
(
NULL
,
NULL
,
NULL
,
D3DX_DEFAULT
,
NULL
,
D3DPOOL_DEFAULT
);
ok
(
hr
==
D3DERR_INVALIDCALL
,
"D3DXCheckCubeTextureRequirements returned %#x, expected %#x
\n
"
,
hr
,
D3DERR_INVALIDCALL
);
/* size */
size
=
D3DX_DEFAULT
;
hr
=
D3DXCheckCubeTextureRequirements
(
device
,
&
size
,
NULL
,
0
,
NULL
,
D3DPOOL_DEFAULT
);
ok
(
hr
==
D3D_OK
,
"D3DXCheckCubeTextureRequirements returned %#x, expected %#x
\n
"
,
hr
,
D3D_OK
);
ok
(
size
==
256
,
"Returned size %d, expected %d
\n
"
,
size
,
256
);
/* mipmaps */
size
=
64
;
mipmaps
=
9
;
hr
=
D3DXCheckCubeTextureRequirements
(
device
,
&
size
,
&
mipmaps
,
0
,
NULL
,
D3DPOOL_DEFAULT
);
ok
(
hr
==
D3D_OK
,
"D3DXCheckCubeTextureRequirements returned %#x, expected %#x
\n
"
,
hr
,
D3D_OK
);
ok
(
mipmaps
==
7
,
"Returned mipmaps %d, expected %d
\n
"
,
mipmaps
,
7
);
size
=
284
;
mipmaps
=
20
;
hr
=
D3DXCheckCubeTextureRequirements
(
device
,
&
size
,
&
mipmaps
,
0
,
NULL
,
D3DPOOL_DEFAULT
);
ok
(
hr
==
D3D_OK
,
"D3DXCheckCubeTextureRequirements returned %#x, expected %#x
\n
"
,
hr
,
D3D_OK
);
ok
(
mipmaps
==
10
,
"Returned mipmaps %d, expected %d
\n
"
,
mipmaps
,
10
);
size
=
63
;
mipmaps
=
9
;
hr
=
D3DXCheckCubeTextureRequirements
(
device
,
&
size
,
&
mipmaps
,
0
,
NULL
,
D3DPOOL_DEFAULT
);
ok
(
hr
==
D3D_OK
,
"D3DXCheckCubeTextureRequirements returned %#x, expected %#x
\n
"
,
hr
,
D3D_OK
);
ok
(
mipmaps
==
7
,
"Returned mipmaps %d, expected %d
\n
"
,
mipmaps
,
7
);
mipmaps
=
0
;
hr
=
D3DXCheckCubeTextureRequirements
(
device
,
NULL
,
&
mipmaps
,
0
,
NULL
,
D3DPOOL_DEFAULT
);
ok
(
hr
==
D3D_OK
,
"D3DXCheckCubeTextureRequirements returned %#x, expected %#x
\n
"
,
hr
,
D3D_OK
);
ok
(
mipmaps
==
9
,
"Returned mipmaps %d, expected %d
\n
"
,
mipmaps
,
9
);
/* usage */
hr
=
D3DXCheckCubeTextureRequirements
(
device
,
NULL
,
NULL
,
D3DUSAGE_WRITEONLY
,
NULL
,
D3DPOOL_DEFAULT
);
ok
(
hr
==
D3DERR_INVALIDCALL
,
"D3DXCheckCubeTextureRequirements succeeded, but should've failed.
\n
"
);
hr
=
D3DXCheckCubeTextureRequirements
(
device
,
NULL
,
NULL
,
D3DUSAGE_DONOTCLIP
,
NULL
,
D3DPOOL_DEFAULT
);
ok
(
hr
==
D3DERR_INVALIDCALL
,
"D3DXCheckCubeTextureRequirements succeeded, but should've failed.
\n
"
);
hr
=
D3DXCheckCubeTextureRequirements
(
device
,
NULL
,
NULL
,
D3DUSAGE_POINTS
,
NULL
,
D3DPOOL_DEFAULT
);
ok
(
hr
==
D3DERR_INVALIDCALL
,
"D3DXCheckCubeTextureRequirements succeeded, but should've failed.
\n
"
);
hr
=
D3DXCheckCubeTextureRequirements
(
device
,
NULL
,
NULL
,
D3DUSAGE_RTPATCHES
,
NULL
,
D3DPOOL_DEFAULT
);
ok
(
hr
==
D3DERR_INVALIDCALL
,
"D3DXCheckCubeTextureRequirements succeeded, but should've failed.
\n
"
);
hr
=
D3DXCheckCubeTextureRequirements
(
device
,
NULL
,
NULL
,
D3DUSAGE_NPATCHES
,
NULL
,
D3DPOOL_DEFAULT
);
ok
(
hr
==
D3DERR_INVALIDCALL
,
"D3DXCheckCubeTextureRequirements succeeded, but should've failed.
\n
"
);
/* format */
hr
=
D3DXCheckCubeTextureRequirements
(
device
,
NULL
,
NULL
,
0
,
NULL
,
D3DPOOL_DEFAULT
);
ok
(
hr
==
D3D_OK
,
"D3DXCheckCubeTextureRequirements returned %#x, expected %#x
\n
"
,
hr
,
D3D_OK
);
format
=
D3DFMT_UNKNOWN
;
hr
=
D3DXCheckCubeTextureRequirements
(
device
,
NULL
,
NULL
,
0
,
&
format
,
D3DPOOL_DEFAULT
);
ok
(
hr
==
D3D_OK
,
"D3DXCheckCubeTextureRequirements returned %#x, expected %#x
\n
"
,
hr
,
D3D_OK
);
ok
(
format
==
D3DFMT_A8R8G8B8
,
"Returned format %u, expected %u
\n
"
,
format
,
D3DFMT_A8R8G8B8
);
format
=
D3DX_DEFAULT
;
hr
=
D3DXCheckCubeTextureRequirements
(
device
,
NULL
,
NULL
,
0
,
&
format
,
D3DPOOL_DEFAULT
);
ok
(
hr
==
D3D_OK
,
"D3DXCheckCubeTextureRequirements returned %#x, expected %#x
\n
"
,
hr
,
D3D_OK
);
ok
(
format
==
D3DFMT_A8R8G8B8
,
"Returned format %u, expected %u
\n
"
,
format
,
D3DFMT_A8R8G8B8
);
format
=
D3DFMT_R8G8B8
;
hr
=
D3DXCheckCubeTextureRequirements
(
device
,
NULL
,
NULL
,
0
,
&
format
,
D3DPOOL_DEFAULT
);
ok
(
hr
==
D3D_OK
,
"D3DXCheckCubeTextureRequirements returned %#x, expected %#x
\n
"
,
hr
,
D3D_OK
);
ok
(
format
==
D3DFMT_X8R8G8B8
,
"Returned format %u, expected %u
\n
"
,
format
,
D3DFMT_X8R8G8B8
);
}
static
void
test_D3DXCreateTexture
(
IDirect3DDevice9
*
device
)
{
IDirect3DTexture9
*
texture
;
...
...
@@ -498,6 +574,7 @@ START_TEST(texture)
}
test_D3DXCheckTextureRequirements
(
device
);
test_D3DXCheckCubeTextureRequirements
(
device
);
test_D3DXCreateTexture
(
device
);
test_D3DXFilterTexture
(
device
);
...
...
dlls/d3dx9_36/texture.c
View file @
69337665
...
...
@@ -343,6 +343,46 @@ cleanup:
return
D3D_OK
;
}
HRESULT
WINAPI
D3DXCheckCubeTextureRequirements
(
LPDIRECT3DDEVICE9
device
,
UINT
*
size
,
UINT
*
miplevels
,
DWORD
usage
,
D3DFORMAT
*
format
,
D3DPOOL
pool
)
{
D3DCAPS9
caps
;
UINT
s
=
(
size
&&
*
size
)
?
*
size
:
256
;
HRESULT
hr
;
TRACE
(
"(%p, %p, %p, %u, %p, %u)
\n
"
,
device
,
size
,
miplevels
,
usage
,
format
,
pool
);
if
(
s
==
D3DX_DEFAULT
)
s
=
256
;
if
(
!
device
||
FAILED
(
IDirect3DDevice9_GetDeviceCaps
(
device
,
&
caps
)))
return
D3DERR_INVALIDCALL
;
if
(
!
(
caps
.
TextureCaps
&
D3DPTEXTURECAPS_CUBEMAP
))
return
D3DERR_NOTAVAILABLE
;
/* ensure width/height is power of 2 */
if
((
caps
.
TextureCaps
&
D3DPTEXTURECAPS_CUBEMAP_POW2
)
&&
(
!
is_pow2
(
s
)))
s
=
make_pow2
(
s
);
hr
=
D3DXCheckTextureRequirements
(
device
,
&
s
,
&
s
,
miplevels
,
usage
,
format
,
pool
);
if
(
!
(
caps
.
TextureCaps
&
D3DPTEXTURECAPS_MIPCUBEMAP
))
{
if
(
miplevels
)
*
miplevels
=
1
;
}
if
(
size
)
*
size
=
s
;
return
hr
;
}
HRESULT
WINAPI
D3DXCreateTexture
(
LPDIRECT3DDEVICE9
pDevice
,
UINT
width
,
UINT
height
,
...
...
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