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
a9f658f6
Commit
a9f658f6
authored
Dec 29, 2006
by
H. Verbeet
Committed by
Alexandre Julliard
Dec 29, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Simplify the get_write_mask and get_swizzle functions.
parent
c8fc7df8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
54 deletions
+22
-54
arb_program_shader.c
dlls/wined3d/arb_program_shader.c
+11
-27
glsl_shader.c
dlls/wined3d/glsl_shader.c
+11
-27
No files found.
dlls/wined3d/arb_program_shader.c
View file @
a9f658f6
...
@@ -209,14 +209,11 @@ static const char * const shift_tab[] = {
...
@@ -209,14 +209,11 @@ static const char * const shift_tab[] = {
static
void
shader_arb_get_write_mask
(
const
DWORD
param
,
char
*
write_mask
)
{
static
void
shader_arb_get_write_mask
(
const
DWORD
param
,
char
*
write_mask
)
{
char
*
ptr
=
write_mask
;
char
*
ptr
=
write_mask
;
if
((
param
&
WINED3DSP_WRITEMASK_ALL
)
!=
WINED3DSP_WRITEMASK_ALL
)
{
*
ptr
++
=
'.'
;
*
ptr
++
=
'.'
;
if
(
param
&
WINED3DSP_WRITEMASK_0
)
*
ptr
++
=
'x'
;
if
(
param
&
WINED3DSP_WRITEMASK_0
)
*
ptr
++
=
'x'
;
if
(
param
&
WINED3DSP_WRITEMASK_1
)
*
ptr
++
=
'y'
;
if
(
param
&
WINED3DSP_WRITEMASK_1
)
*
ptr
++
=
'y'
;
if
(
param
&
WINED3DSP_WRITEMASK_2
)
*
ptr
++
=
'z'
;
if
(
param
&
WINED3DSP_WRITEMASK_2
)
*
ptr
++
=
'z'
;
if
(
param
&
WINED3DSP_WRITEMASK_3
)
*
ptr
++
=
'w'
;
if
(
param
&
WINED3DSP_WRITEMASK_3
)
*
ptr
++
=
'w'
;
}
*
ptr
=
'\0'
;
*
ptr
=
'\0'
;
}
}
...
@@ -226,28 +223,15 @@ static void shader_arb_get_swizzle(const DWORD param, BOOL fixup, char *swizzle_
...
@@ -226,28 +223,15 @@ static void shader_arb_get_swizzle(const DWORD param, BOOL fixup, char *swizzle_
* and z components. */
* and z components. */
const
char
*
swizzle_chars
=
fixup
?
"zyxw"
:
"xyzw"
;
const
char
*
swizzle_chars
=
fixup
?
"zyxw"
:
"xyzw"
;
char
*
ptr
=
swizzle_str
;
char
*
ptr
=
swizzle_str
;
DWORD
swizzle
=
(
param
&
WINED3DSP_SWIZZLE_MASK
)
>>
WINED3DSP_SWIZZLE_SHIFT
;
size_t
i
=
0
;
*
ptr
++
=
'.'
;
/* swizzle bits fields: wwzzyyxx */
/* swizzle bits fields: wwzzyyxx */
DWORD
swizzle
=
(
param
&
WINED3DSP_SWIZZLE_MASK
)
>>
WINED3DSP_SWIZZLE_SHIFT
;
for
(
i
=
0
;
i
<
4
;
++
i
)
{
DWORD
swizzle_x
=
swizzle
&
0x03
;
*
ptr
++
=
swizzle_chars
[
swizzle
&
0x3
];
DWORD
swizzle_y
=
(
swizzle
>>
2
)
&
0x03
;
swizzle
>>=
2
;
DWORD
swizzle_z
=
(
swizzle
>>
4
)
&
0x03
;
DWORD
swizzle_w
=
(
swizzle
>>
6
)
&
0x03
;
/* If the swizzle is the default swizzle (ie, "xyzw"), we don't need to
* generate a swizzle string. Unless we need to our own swizzling. */
if
((
WINED3DSP_NOSWIZZLE
>>
WINED3DSP_SWIZZLE_SHIFT
)
!=
swizzle
||
fixup
)
{
*
ptr
++
=
'.'
;
if
(
swizzle_x
==
swizzle_y
&&
swizzle_x
==
swizzle_z
&&
swizzle_x
==
swizzle_w
)
{
*
ptr
++
=
swizzle_chars
[
swizzle_x
];
}
else
{
*
ptr
++
=
swizzle_chars
[
swizzle_x
];
*
ptr
++
=
swizzle_chars
[
swizzle_y
];
*
ptr
++
=
swizzle_chars
[
swizzle_z
];
*
ptr
++
=
swizzle_chars
[
swizzle_w
];
}
}
}
*
ptr
=
'\0'
;
*
ptr
=
'\0'
;
}
}
...
...
dlls/wined3d/glsl_shader.c
View file @
a9f658f6
...
@@ -722,14 +722,11 @@ static void shader_glsl_get_register_name(
...
@@ -722,14 +722,11 @@ static void shader_glsl_get_register_name(
static
void
shader_glsl_get_write_mask
(
const
DWORD
param
,
char
*
write_mask
)
{
static
void
shader_glsl_get_write_mask
(
const
DWORD
param
,
char
*
write_mask
)
{
char
*
ptr
=
write_mask
;
char
*
ptr
=
write_mask
;
if
((
param
&
WINED3DSP_WRITEMASK_ALL
)
!=
WINED3DSP_WRITEMASK_ALL
)
{
*
ptr
++
=
'.'
;
*
ptr
++
=
'.'
;
if
(
param
&
WINED3DSP_WRITEMASK_0
)
*
ptr
++
=
'x'
;
if
(
param
&
WINED3DSP_WRITEMASK_0
)
*
ptr
++
=
'x'
;
if
(
param
&
WINED3DSP_WRITEMASK_1
)
*
ptr
++
=
'y'
;
if
(
param
&
WINED3DSP_WRITEMASK_1
)
*
ptr
++
=
'y'
;
if
(
param
&
WINED3DSP_WRITEMASK_2
)
*
ptr
++
=
'z'
;
if
(
param
&
WINED3DSP_WRITEMASK_2
)
*
ptr
++
=
'z'
;
if
(
param
&
WINED3DSP_WRITEMASK_3
)
*
ptr
++
=
'w'
;
if
(
param
&
WINED3DSP_WRITEMASK_3
)
*
ptr
++
=
'w'
;
}
*
ptr
=
'\0'
;
*
ptr
=
'\0'
;
}
}
...
@@ -739,28 +736,15 @@ static void shader_glsl_get_swizzle(const DWORD param, BOOL fixup, char *swizzle
...
@@ -739,28 +736,15 @@ static void shader_glsl_get_swizzle(const DWORD param, BOOL fixup, char *swizzle
* and z components. */
* and z components. */
const
char
*
swizzle_chars
=
fixup
?
"zyxw"
:
"xyzw"
;
const
char
*
swizzle_chars
=
fixup
?
"zyxw"
:
"xyzw"
;
char
*
ptr
=
swizzle_str
;
char
*
ptr
=
swizzle_str
;
DWORD
swizzle
=
(
param
&
WINED3DSP_SWIZZLE_MASK
)
>>
WINED3DSP_SWIZZLE_SHIFT
;
size_t
i
=
0
;
*
ptr
++
=
'.'
;
/* swizzle bits fields: wwzzyyxx */
/* swizzle bits fields: wwzzyyxx */
DWORD
swizzle
=
(
param
&
WINED3DSP_SWIZZLE_MASK
)
>>
WINED3DSP_SWIZZLE_SHIFT
;
for
(
i
=
0
;
i
<
4
;
++
i
)
{
DWORD
swizzle_x
=
swizzle
&
0x03
;
*
ptr
++
=
swizzle_chars
[
swizzle
&
0x3
];
DWORD
swizzle_y
=
(
swizzle
>>
2
)
&
0x03
;
swizzle
>>=
2
;
DWORD
swizzle_z
=
(
swizzle
>>
4
)
&
0x03
;
DWORD
swizzle_w
=
(
swizzle
>>
6
)
&
0x03
;
/* If the swizzle is the default swizzle (ie, "xyzw"), we don't need to
* generate a swizzle string. Unless we need to our own swizzling. */
if
((
WINED3DSP_NOSWIZZLE
>>
WINED3DSP_SWIZZLE_SHIFT
)
!=
swizzle
||
fixup
)
{
*
ptr
++
=
'.'
;
if
(
swizzle_x
==
swizzle_y
&&
swizzle_x
==
swizzle_z
&&
swizzle_x
==
swizzle_w
)
{
*
ptr
++
=
swizzle_chars
[
swizzle_x
];
}
else
{
*
ptr
++
=
swizzle_chars
[
swizzle_x
];
*
ptr
++
=
swizzle_chars
[
swizzle_y
];
*
ptr
++
=
swizzle_chars
[
swizzle_z
];
*
ptr
++
=
swizzle_chars
[
swizzle_w
];
}
}
}
*
ptr
=
'\0'
;
*
ptr
=
'\0'
;
}
}
...
...
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