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
a875f383
Commit
a875f383
authored
Oct 13, 2010
by
Matteo Bruni
Committed by
Alexandre Julliard
Nov 04, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3dx9: Implement D3DXFilterTexture for cube textures.
parent
a3c21e71
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
71 additions
and
16 deletions
+71
-16
texture.c
dlls/d3dx9_36/tests/texture.c
+21
-1
texture.c
dlls/d3dx9_36/texture.c
+50
-15
No files found.
dlls/d3dx9_36/tests/texture.c
View file @
a875f383
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
*
*
* Copyright 2009 Tony Wasserka
* Copyright 2009 Tony Wasserka
* Copyright 2010 Owen Rudge for CodeWeavers
* Copyright 2010 Owen Rudge for CodeWeavers
* Copyright 2010 Matteo Bruni for CodeWeavers
*
*
* This library is free software; you can redistribute it and/or
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* modify it under the terms of the GNU Lesser General Public
...
@@ -398,6 +399,7 @@ static void test_D3DXCreateTexture(IDirect3DDevice9 *device)
...
@@ -398,6 +399,7 @@ static void test_D3DXCreateTexture(IDirect3DDevice9 *device)
static
void
test_D3DXFilterTexture
(
IDirect3DDevice9
*
device
)
static
void
test_D3DXFilterTexture
(
IDirect3DDevice9
*
device
)
{
{
IDirect3DTexture9
*
tex
;
IDirect3DTexture9
*
tex
;
IDirect3DCubeTexture9
*
cubetex
;
HRESULT
hr
;
HRESULT
hr
;
hr
=
IDirect3DDevice9_CreateTexture
(
device
,
256
,
256
,
5
,
0
,
D3DFMT_A8R8G8B8
,
D3DPOOL_MANAGED
,
&
tex
,
NULL
);
hr
=
IDirect3DDevice9_CreateTexture
(
device
,
256
,
256
,
5
,
0
,
D3DFMT_A8R8G8B8
,
D3DPOOL_MANAGED
,
&
tex
,
NULL
);
...
@@ -433,7 +435,6 @@ static void test_D3DXFilterTexture(IDirect3DDevice9 *device)
...
@@ -433,7 +435,6 @@ static void test_D3DXFilterTexture(IDirect3DDevice9 *device)
else
else
skip
(
"Failed to create texture
\n
"
);
skip
(
"Failed to create texture
\n
"
);
hr
=
IDirect3DDevice9_CreateTexture
(
device
,
256
,
256
,
0
,
0
,
D3DFMT_A8R8G8B8
,
D3DPOOL_SCRATCH
,
&
tex
,
NULL
);
hr
=
IDirect3DDevice9_CreateTexture
(
device
,
256
,
256
,
0
,
0
,
D3DFMT_A8R8G8B8
,
D3DPOOL_SCRATCH
,
&
tex
,
NULL
);
if
(
SUCCEEDED
(
hr
))
if
(
SUCCEEDED
(
hr
))
...
@@ -444,6 +445,25 @@ static void test_D3DXFilterTexture(IDirect3DDevice9 *device)
...
@@ -444,6 +445,25 @@ static void test_D3DXFilterTexture(IDirect3DDevice9 *device)
}
}
else
else
skip
(
"Failed to create texture
\n
"
);
skip
(
"Failed to create texture
\n
"
);
/* Cube texture test */
hr
=
IDirect3DDevice9_CreateCubeTexture
(
device
,
256
,
5
,
0
,
D3DFMT_A8R8G8B8
,
D3DPOOL_MANAGED
,
&
cubetex
,
NULL
);
if
(
SUCCEEDED
(
hr
))
{
hr
=
D3DXFilterTexture
((
IDirect3DBaseTexture9
*
)
cubetex
,
NULL
,
0
,
D3DX_FILTER_NONE
);
ok
(
hr
==
D3D_OK
,
"D3DXFilterTexture returned %#x, expected %#x
\n
"
,
hr
,
D3D_OK
);
hr
=
D3DXFilterTexture
((
IDirect3DBaseTexture9
*
)
cubetex
,
NULL
,
0
,
D3DX_FILTER_BOX
+
1
);
/* Invalid filter */
ok
(
hr
==
D3DERR_INVALIDCALL
,
"D3DXFilterTexture returned %#x, expected %#x
\n
"
,
hr
,
D3DERR_INVALIDCALL
);
hr
=
D3DXFilterTexture
((
IDirect3DBaseTexture9
*
)
cubetex
,
NULL
,
5
,
D3DX_FILTER_NONE
);
/* Invalid miplevel */
ok
(
hr
==
D3DERR_INVALIDCALL
,
"D3DXFilterTexture returned %#x, expected %#x
\n
"
,
hr
,
D3DERR_INVALIDCALL
);
}
else
skip
(
"Failed to create texture
\n
"
);
IDirect3DCubeTexture9_Release
(
cubetex
);
}
}
START_TEST
(
texture
)
START_TEST
(
texture
)
...
...
dlls/d3dx9_36/texture.c
View file @
a875f383
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
* Copyright 2009 Tony Wasserka
* Copyright 2009 Tony Wasserka
* Copyright 2010 Christian Costa
* Copyright 2010 Christian Costa
* Copyright 2010 Owen Rudge for CodeWeavers
* Copyright 2010 Owen Rudge for CodeWeavers
* Copyright 2010 Matteo Bruni for CodeWeavers
*
*
* This library is free software; you can redistribute it and/or
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* modify it under the terms of the GNU Lesser General Public
...
@@ -45,6 +46,21 @@ static UINT make_pow2(UINT num)
...
@@ -45,6 +46,21 @@ static UINT make_pow2(UINT num)
return
result
;
return
result
;
}
}
static
HRESULT
get_surface
(
D3DRESOURCETYPE
type
,
LPDIRECT3DBASETEXTURE9
tex
,
int
face
,
UINT
level
,
LPDIRECT3DSURFACE9
*
surf
)
{
switch
(
type
)
{
case
D3DRTYPE_TEXTURE
:
return
IDirect3DTexture9_GetSurfaceLevel
((
IDirect3DTexture9
*
)
tex
,
level
,
surf
);
case
D3DRTYPE_CUBETEXTURE
:
return
IDirect3DCubeTexture9_GetCubeMapSurface
((
IDirect3DCubeTexture9
*
)
tex
,
face
,
level
,
surf
);
default:
ERR
(
"Unexpected texture type
\n
"
);
return
E_NOTIMPL
;
}
}
HRESULT
WINAPI
D3DXFilterTexture
(
LPDIRECT3DBASETEXTURE9
texture
,
HRESULT
WINAPI
D3DXFilterTexture
(
LPDIRECT3DBASETEXTURE9
texture
,
CONST
PALETTEENTRY
*
palette
,
CONST
PALETTEENTRY
*
palette
,
UINT
srclevel
,
UINT
srclevel
,
...
@@ -52,6 +68,7 @@ HRESULT WINAPI D3DXFilterTexture(LPDIRECT3DBASETEXTURE9 texture,
...
@@ -52,6 +68,7 @@ HRESULT WINAPI D3DXFilterTexture(LPDIRECT3DBASETEXTURE9 texture,
{
{
UINT
level
=
srclevel
+
1
;
UINT
level
=
srclevel
+
1
;
HRESULT
hr
;
HRESULT
hr
;
D3DRESOURCETYPE
type
;
TRACE
(
"(%p, %p, %d, %d)
\n
"
,
texture
,
palette
,
srclevel
,
filter
);
TRACE
(
"(%p, %p, %d, %d)
\n
"
,
texture
,
palette
,
srclevel
,
filter
);
...
@@ -64,46 +81,64 @@ HRESULT WINAPI D3DXFilterTexture(LPDIRECT3DBASETEXTURE9 texture,
...
@@ -64,46 +81,64 @@ HRESULT WINAPI D3DXFilterTexture(LPDIRECT3DBASETEXTURE9 texture,
if
(
srclevel
>=
IDirect3DBaseTexture9_GetLevelCount
(
texture
))
if
(
srclevel
>=
IDirect3DBaseTexture9_GetLevelCount
(
texture
))
return
D3DERR_INVALIDCALL
;
return
D3DERR_INVALIDCALL
;
switch
(
IDirect3DBaseTexture9_GetType
(
texture
))
switch
(
type
=
IDirect3DBaseTexture9_GetType
(
texture
))
{
{
case
D3DRTYPE_TEXTURE
:
case
D3DRTYPE_TEXTURE
:
case
D3DRTYPE_CUBETEXTURE
:
{
{
IDirect3DSurface9
*
topsurf
,
*
mipsurf
;
IDirect3DSurface9
*
topsurf
,
*
mipsurf
;
D3DSURFACE_DESC
desc
;
D3DSURFACE_DESC
desc
;
int
i
,
numfaces
;
if
(
filter
==
D3DX_DEFAULT
)
if
(
type
==
D3DRTYPE_TEXTURE
)
{
{
numfaces
=
1
;
IDirect3DTexture9_GetLevelDesc
((
IDirect3DTexture9
*
)
texture
,
srclevel
,
&
desc
);
IDirect3DTexture9_GetLevelDesc
((
IDirect3DTexture9
*
)
texture
,
srclevel
,
&
desc
);
}
else
{
numfaces
=
6
;
IDirect3DCubeTexture9_GetLevelDesc
((
IDirect3DTexture9
*
)
texture
,
srclevel
,
&
desc
);
}
if
(
filter
==
D3DX_DEFAULT
)
{
if
(
is_pow2
(
desc
.
Width
)
&&
is_pow2
(
desc
.
Height
))
if
(
is_pow2
(
desc
.
Width
)
&&
is_pow2
(
desc
.
Height
))
filter
=
D3DX_FILTER_BOX
;
filter
=
D3DX_FILTER_BOX
;
else
else
filter
=
D3DX_FILTER_BOX
|
D3DX_FILTER_DITHER
;
filter
=
D3DX_FILTER_BOX
|
D3DX_FILTER_DITHER
;
}
}
hr
=
IDirect3DTexture9_GetSurfaceLevel
((
IDirect3DTexture9
*
)
texture
,
srclevel
,
&
topsurf
);
for
(
i
=
0
;
i
<
numfaces
;
i
++
)
if
(
FAILED
(
hr
))
return
D3DERR_INVALIDCALL
;
while
(
IDirect3DTexture9_GetSurfaceLevel
((
IDirect3DTexture9
*
)
texture
,
level
,
&
mipsurf
)
==
D3D_OK
)
{
{
hr
=
D3DXLoadSurfaceFromSurface
(
mipsurf
,
palette
,
NULL
,
topsurf
,
palette
,
NULL
,
filter
,
0
)
;
level
=
srclevel
+
1
;
IDirect3DSurface9_Release
(
mi
psurf
);
hr
=
get_surface
(
type
,
texture
,
i
,
srclevel
,
&
to
psurf
);
if
(
FAILED
(
hr
))
if
(
FAILED
(
hr
))
break
;
return
D3DERR_INVALIDCALL
;
level
++
;
while
(
get_surface
(
type
,
texture
,
i
,
level
,
&
mipsurf
)
==
D3D_OK
)
}
{
hr
=
D3DXLoadSurfaceFromSurface
(
mipsurf
,
palette
,
NULL
,
topsurf
,
palette
,
NULL
,
filter
,
0
);
IDirect3DSurface9_Release
(
topsurf
);
topsurf
=
mipsurf
;
if
(
FAILED
(
hr
))
break
;
level
++
;
}
IDirect3DSurface9_Release
(
topsurf
);
IDirect3DSurface9_Release
(
topsurf
);
if
(
FAILED
(
hr
))
return
hr
;
}
return
D3D_OK
;
return
D3D_OK
;
}
}
default:
default:
FIXME
(
"Implement volume
and cube
texture filtering
\n
"
);
FIXME
(
"Implement volume texture filtering
\n
"
);
return
E_NOTIMPL
;
return
E_NOTIMPL
;
}
}
}
}
...
...
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