Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
1908d0b3
Commit
1908d0b3
authored
Dec 16, 2022
by
Nikolay Sivov
Committed by
Alexandre Julliard
Jan 27, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3dx9: Fix ARGB texture fills with negative component values.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
parent
809618e4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
5 deletions
+27
-5
texture.c
dlls/d3dx9_36/tests/texture.c
+26
-4
texture.c
dlls/d3dx9_36/texture.c
+1
-1
No files found.
dlls/d3dx9_36/tests/texture.c
View file @
1908d0b3
...
...
@@ -1330,6 +1330,15 @@ static void WINAPI fillfunc_cube(D3DXVECTOR4 *value, const D3DXVECTOR3 *texcoord
value
->
w
=
texelsize
->
x
;
}
static
void
WINAPI
fillfunc_cube_coord
(
D3DXVECTOR4
*
value
,
const
D3DXVECTOR3
*
texcoord
,
const
D3DXVECTOR3
*
texelsize
,
void
*
data
)
{
value
->
x
=
texcoord
->
x
;
value
->
y
=
texcoord
->
y
;
value
->
z
=
texcoord
->
z
;
value
->
w
=
1
.
0
f
;
}
enum
cube_coord
{
XCOORD
=
0
,
...
...
@@ -1388,15 +1397,20 @@ static DWORD get_argb_color(D3DFORMAT format, DWORD x, DWORD y, const D3DLOCKED_
}
}
static
BYTE
get_s8_clipped
(
float
v
)
{
return
(
BYTE
)(
v
>=
0
.
0
f
?
v
*
255
+
0
.
5
f
:
0
.
0
f
);
}
static
DWORD
get_expected_argb_color
(
D3DFORMAT
format
,
const
D3DXVECTOR4
*
v
)
{
switch
(
format
)
{
case
D3DFMT_A8R8G8B8
:
return
(
BYTE
)(
v
->
w
*
255
+
0
.
5
f
)
<<
24
|
(
BYTE
)(
v
->
x
*
255
+
0
.
5
f
)
<<
16
|
(
BYTE
)(
v
->
y
*
255
+
0
.
5
f
)
<<
8
|
(
BYTE
)(
v
->
z
*
255
+
0
.
5
f
);
return
get_s8_clipped
(
v
->
w
)
<<
24
|
get_s8_clipped
(
v
->
x
)
<<
16
|
get_s8_clipped
(
v
->
y
)
<<
8
|
get_s8_clipped
(
v
->
z
);
case
D3DFMT_A1R5G5B5
:
return
(
BYTE
)(
v
->
w
+
0
.
5
f
)
<<
24
...
...
@@ -1475,13 +1489,21 @@ static void test_D3DXFillCubeTexture(IDirect3DDevice9 *device)
IDirect3DCubeTexture9
*
tex
;
HRESULT
hr
;
/* A8R8G8B8 */
hr
=
IDirect3DDevice9_CreateCubeTexture
(
device
,
4
,
0
,
0
,
D3DFMT_A8R8G8B8
,
D3DPOOL_MANAGED
,
&
tex
,
NULL
);
ok
(
hr
==
D3D_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
D3DXFillCubeTexture
(
tex
,
fillfunc_cube
,
NULL
);
ok
(
hr
==
D3D_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
compare_cube_texture
(
tex
,
fillfunc_cube
,
1
);
hr
=
D3DXFillCubeTexture
(
tex
,
fillfunc_cube_coord
,
NULL
);
ok
(
hr
==
D3D_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
compare_cube_texture
(
tex
,
fillfunc_cube_coord
,
1
);
IDirect3DCubeTexture9_Release
(
tex
);
/* A1R5G5B5 */
hr
=
IDirect3DDevice9_CreateCubeTexture
(
device
,
4
,
1
,
0
,
D3DFMT_A1R5G5B5
,
D3DPOOL_MANAGED
,
&
tex
,
NULL
);
ok
(
hr
==
D3D_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
...
...
dlls/d3dx9_36/texture.c
View file @
1908d0b3
...
...
@@ -1288,7 +1288,7 @@ static inline void fill_texture(const struct pixel_format_desc *format, BYTE *po
else
if
(
format
->
type
==
FORMAT_ARGBF
)
v
=
*
(
DWORD
*
)
&
comp_value
;
else
if
(
format
->
type
==
FORMAT_ARGB
)
v
=
comp_value
*
((
1
<<
format
->
bits
[
c
])
-
1
)
+
0
.
5
f
;
v
=
max
(
comp_value
*
((
1
<<
format
->
bits
[
c
])
-
1
)
+
0
.
5
f
,
0
)
;
else
FIXME
(
"Unhandled format type %#x
\n
"
,
format
->
type
);
...
...
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