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
770eaec5
Commit
770eaec5
authored
Aug 25, 2014
by
Matteo Bruni
Committed by
Alexandre Julliard
Aug 25, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3dx9: Properly evaluate fallbacks for luminance texture formats in D3DXCheckTextureRequirements.
parent
ab8e9d23
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
4 deletions
+47
-4
texture.c
dlls/d3dx9_36/tests/texture.c
+22
-0
texture.c
dlls/d3dx9_36/texture.c
+25
-4
No files found.
dlls/d3dx9_36/tests/texture.c
View file @
770eaec5
...
@@ -340,6 +340,28 @@ static void test_D3DXCheckTextureRequirements(IDirect3DDevice9 *device)
...
@@ -340,6 +340,28 @@ static void test_D3DXCheckTextureRequirements(IDirect3DDevice9 *device)
ok
(
hr
==
D3D_OK
,
"D3DXCheckTextureRequirements returned %#x, expected %#x
\n
"
,
hr
,
D3D_OK
);
ok
(
hr
==
D3D_OK
,
"D3DXCheckTextureRequirements returned %#x, expected %#x
\n
"
,
hr
,
D3D_OK
);
ok
(
format
==
expected
,
"Returned format %u, expected %u
\n
"
,
format
,
expected
);
ok
(
format
==
expected
,
"Returned format %u, expected %u
\n
"
,
format
,
expected
);
if
(
SUCCEEDED
(
IDirect3D9_CheckDeviceFormat
(
d3d
,
params
.
AdapterOrdinal
,
params
.
DeviceType
,
mode
.
Format
,
D3DUSAGE_RENDERTARGET
,
D3DRTYPE_TEXTURE
,
D3DFMT_L8
)))
expected
=
D3DFMT_L8
;
else
expected
=
D3DFMT_X8R8G8B8
;
format
=
D3DFMT_L8
;
hr
=
D3DXCheckTextureRequirements
(
device
,
NULL
,
NULL
,
NULL
,
D3DUSAGE_RENDERTARGET
,
&
format
,
D3DPOOL_DEFAULT
);
ok
(
hr
==
D3D_OK
,
"D3DXCheckTextureRequirements returned %#x, expected %#x
\n
"
,
hr
,
D3D_OK
);
ok
(
format
==
expected
,
"Returned format %u, expected %u
\n
"
,
format
,
expected
);
if
(
SUCCEEDED
(
IDirect3D9_CheckDeviceFormat
(
d3d
,
params
.
AdapterOrdinal
,
params
.
DeviceType
,
mode
.
Format
,
D3DUSAGE_RENDERTARGET
,
D3DRTYPE_TEXTURE
,
D3DFMT_L16
)))
expected
=
D3DFMT_L16
;
else
expected
=
D3DFMT_A16B16G16R16
;
format
=
D3DFMT_L16
;
hr
=
D3DXCheckTextureRequirements
(
device
,
NULL
,
NULL
,
NULL
,
D3DUSAGE_RENDERTARGET
,
&
format
,
D3DPOOL_DEFAULT
);
ok
(
hr
==
D3D_OK
,
"D3DXCheckTextureRequirements returned %#x, expected %#x
\n
"
,
hr
,
D3D_OK
);
ok
(
format
==
expected
,
"Returned format %u, expected %u
\n
"
,
format
,
expected
);
/* Block-based texture formats and size < block size. */
/* Block-based texture formats and size < block size. */
if
(
has_2d_dxt5
)
if
(
has_2d_dxt5
)
{
{
...
...
dlls/d3dx9_36/texture.c
View file @
770eaec5
...
@@ -184,6 +184,27 @@ HRESULT WINAPI D3DXFilterTexture(IDirect3DBaseTexture9 *texture,
...
@@ -184,6 +184,27 @@ HRESULT WINAPI D3DXFilterTexture(IDirect3DBaseTexture9 *texture,
}
}
}
}
static
D3DFORMAT
get_luminance_replacement_format
(
D3DFORMAT
format
)
{
static
const
struct
{
D3DFORMAT
luminance_format
;
D3DFORMAT
replacement_format
;
}
luminance_replacements
[]
=
{
{
D3DFMT_L8
,
D3DFMT_X8R8G8B8
},
{
D3DFMT_A8L8
,
D3DFMT_A8R8G8B8
},
{
D3DFMT_A4L4
,
D3DFMT_A4R4G4B4
},
{
D3DFMT_L16
,
D3DFMT_A16B16G16R16
}
};
unsigned
int
i
;
for
(
i
=
0
;
i
<
sizeof
(
luminance_replacements
)
/
sizeof
(
luminance_replacements
[
0
]);
++
i
)
if
(
format
==
luminance_replacements
[
i
].
luminance_format
)
return
luminance_replacements
[
i
].
replacement_format
;
return
format
;
}
HRESULT
WINAPI
D3DXCheckTextureRequirements
(
struct
IDirect3DDevice9
*
device
,
UINT
*
width
,
UINT
*
height
,
HRESULT
WINAPI
D3DXCheckTextureRequirements
(
struct
IDirect3DDevice9
*
device
,
UINT
*
width
,
UINT
*
height
,
UINT
*
miplevels
,
DWORD
usage
,
D3DFORMAT
*
format
,
D3DPOOL
pool
)
UINT
*
miplevels
,
DWORD
usage
,
D3DFORMAT
*
format
,
D3DPOOL
pool
)
{
{
...
@@ -255,16 +276,16 @@ HRESULT WINAPI D3DXCheckTextureRequirements(struct IDirect3DDevice9 *device, UIN
...
@@ -255,16 +276,16 @@ HRESULT WINAPI D3DXCheckTextureRequirements(struct IDirect3DDevice9 *device, UIN
FIXME
(
"Pixel format %x not handled
\n
"
,
usedformat
);
FIXME
(
"Pixel format %x not handled
\n
"
,
usedformat
);
goto
cleanup
;
goto
cleanup
;
}
}
fmt
=
get_format_info
(
get_luminance_replacement_format
(
usedformat
));
allow_24bits
=
fmt
->
bytes_per_pixel
==
3
;
allow_24bits
=
fmt
->
bytes_per_pixel
==
3
;
channels
=
(
fmt
->
bits
[
0
]
?
1
:
0
)
+
(
fmt
->
bits
[
1
]
?
1
:
0
)
channels
=
!!
fmt
->
bits
[
0
]
+
!!
fmt
->
bits
[
1
]
+
!!
fmt
->
bits
[
2
]
+
!!
fmt
->
bits
[
3
];
+
(
fmt
->
bits
[
2
]
?
1
:
0
)
+
(
fmt
->
bits
[
3
]
?
1
:
0
);
usedformat
=
D3DFMT_UNKNOWN
;
usedformat
=
D3DFMT_UNKNOWN
;
while
((
curfmt
=
get_format_info_idx
(
i
)))
while
((
curfmt
=
get_format_info_idx
(
i
)))
{
{
unsigned
int
curchannels
=
(
curfmt
->
bits
[
0
]
?
1
:
0
)
+
(
curfmt
->
bits
[
1
]
?
1
:
0
)
unsigned
int
curchannels
=
!!
curfmt
->
bits
[
0
]
+
!!
curfmt
->
bits
[
1
]
+
(
curfmt
->
bits
[
2
]
?
1
:
0
)
+
(
curfmt
->
bits
[
3
]
?
1
:
0
)
;
+
!!
curfmt
->
bits
[
2
]
+
!!
curfmt
->
bits
[
3
]
;
int
score
;
int
score
;
i
++
;
i
++
;
...
...
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