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
f1f234f4
Commit
f1f234f4
authored
Dec 09, 2022
by
Eric Pouech
Committed by
Alexandre Julliard
Dec 09, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Reduce usage of long integral types in shader_sm4.c.
parent
7bea5460
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
24 deletions
+25
-24
shader_sm4.c
dlls/wined3d/shader_sm4.c
+25
-24
No files found.
dlls/wined3d/shader_sm4.c
View file @
f1f234f4
...
@@ -579,7 +579,7 @@ static void shader_sm4_read_dcl_resource(struct wined3d_shader_instruction *ins,
...
@@ -579,7 +579,7 @@ static void shader_sm4_read_dcl_resource(struct wined3d_shader_instruction *ins,
enum
wined3d_sm4_resource_type
resource_type
;
enum
wined3d_sm4_resource_type
resource_type
;
enum
wined3d_sm4_data_type
data_type
;
enum
wined3d_sm4_data_type
data_type
;
enum
wined3d_data_type
reg_data_type
;
enum
wined3d_data_type
reg_data_type
;
DWORD
components
;
uint32_t
components
;
resource_type
=
(
opcode_token
&
WINED3D_SM4_RESOURCE_TYPE_MASK
)
>>
WINED3D_SM4_RESOURCE_TYPE_SHIFT
;
resource_type
=
(
opcode_token
&
WINED3D_SM4_RESOURCE_TYPE_MASK
)
>>
WINED3D_SM4_RESOURCE_TYPE_SHIFT
;
if
(
!
resource_type
||
(
resource_type
>=
ARRAY_SIZE
(
resource_type_table
)))
if
(
!
resource_type
||
(
resource_type
>=
ARRAY_SIZE
(
resource_type_table
)))
...
@@ -1238,7 +1238,7 @@ static enum wined3d_data_type map_data_type(char t)
...
@@ -1238,7 +1238,7 @@ static enum wined3d_data_type map_data_type(char t)
static
enum
wined3d_shader_type
wined3d_get_sm4_shader_type
(
const
DWORD
*
byte_code
,
size_t
byte_code_size
)
static
enum
wined3d_shader_type
wined3d_get_sm4_shader_type
(
const
DWORD
*
byte_code
,
size_t
byte_code_size
)
{
{
DWORD
shader_type
;
unsigned
int
shader_type
;
if
(
byte_code_size
/
sizeof
(
*
byte_code
)
<
1
)
if
(
byte_code_size
/
sizeof
(
*
byte_code
)
<
1
)
{
{
...
@@ -1276,7 +1276,7 @@ static enum wined3d_shader_type wined3d_get_sm4_shader_type(const DWORD *byte_co
...
@@ -1276,7 +1276,7 @@ static enum wined3d_shader_type wined3d_get_sm4_shader_type(const DWORD *byte_co
static
void
*
shader_sm4_init
(
const
DWORD
*
byte_code
,
size_t
byte_code_size
,
static
void
*
shader_sm4_init
(
const
DWORD
*
byte_code
,
size_t
byte_code_size
,
const
struct
wined3d_shader_signature
*
output_signature
)
const
struct
wined3d_shader_signature
*
output_signature
)
{
{
DWORD
version_token
,
token_count
;
unsigned
int
version_token
,
token_count
;
struct
wined3d_sm4_data
*
priv
;
struct
wined3d_sm4_data
*
priv
;
unsigned
int
i
;
unsigned
int
i
;
...
@@ -1415,7 +1415,7 @@ static BOOL shader_sm4_read_param(struct wined3d_sm4_data *priv, const DWORD **p
...
@@ -1415,7 +1415,7 @@ static BOOL shader_sm4_read_param(struct wined3d_sm4_data *priv, const DWORD **p
enum
wined3d_shader_src_modifier
*
modifier
)
enum
wined3d_shader_src_modifier
*
modifier
)
{
{
enum
wined3d_sm4_register_type
register_type
;
enum
wined3d_sm4_register_type
register_type
;
DWORD
token
,
order
;
uint32_t
token
,
order
;
if
(
*
ptr
>=
end
)
if
(
*
ptr
>=
end
)
{
{
...
@@ -1439,7 +1439,7 @@ static BOOL shader_sm4_read_param(struct wined3d_sm4_data *priv, const DWORD **p
...
@@ -1439,7 +1439,7 @@ static BOOL shader_sm4_read_param(struct wined3d_sm4_data *priv, const DWORD **p
if
(
token
&
WINED3D_SM4_REGISTER_MODIFIER
)
if
(
token
&
WINED3D_SM4_REGISTER_MODIFIER
)
{
{
DWORD
m
;
unsigned
int
m
;
if
(
*
ptr
>=
end
)
if
(
*
ptr
>=
end
)
{
{
...
@@ -1625,7 +1625,7 @@ static BOOL shader_sm4_read_dst_param(struct wined3d_sm4_data *priv, const DWORD
...
@@ -1625,7 +1625,7 @@ static BOOL shader_sm4_read_dst_param(struct wined3d_sm4_data *priv, const DWORD
return
TRUE
;
return
TRUE
;
}
}
static
void
shader_sm4_read_instruction_modifier
(
DWORD
modifier
,
struct
wined3d_shader_instruction
*
ins
)
static
void
shader_sm4_read_instruction_modifier
(
uint32_t
modifier
,
struct
wined3d_shader_instruction
*
ins
)
{
{
enum
wined3d_sm4_instruction_modifier
modifier_type
=
modifier
&
WINED3D_SM4_MODIFIER_MASK
;
enum
wined3d_sm4_instruction_modifier
modifier_type
=
modifier
&
WINED3D_SM4_MODIFIER_MASK
;
...
@@ -1661,7 +1661,7 @@ static void shader_sm4_read_instruction_modifier(DWORD modifier, struct wined3d_
...
@@ -1661,7 +1661,7 @@ static void shader_sm4_read_instruction_modifier(DWORD modifier, struct wined3d_
case
WINED3D_SM5_MODIFIER_DATA_TYPE
:
case
WINED3D_SM5_MODIFIER_DATA_TYPE
:
{
{
DWORD
components
=
(
modifier
&
WINED3D_SM5_MODIFIER_DATA_TYPE_MASK
)
>>
WINED3D_SM5_MODIFIER_DATA_TYPE_SHIFT
;
uint32_t
components
=
(
modifier
&
WINED3D_SM5_MODIFIER_DATA_TYPE_MASK
)
>>
WINED3D_SM5_MODIFIER_DATA_TYPE_SHIFT
;
enum
wined3d_sm4_data_type
data_type
=
components
&
0xf
;
enum
wined3d_sm4_data_type
data_type
=
components
&
0xf
;
if
((
components
&
0xfff0
)
!=
(
components
&
0xf
)
*
0x1110
)
if
((
components
&
0xfff0
)
!=
(
components
&
0xf
)
*
0x1110
)
...
@@ -1687,8 +1687,9 @@ static void shader_sm4_read_instruction_modifier(DWORD modifier, struct wined3d_
...
@@ -1687,8 +1687,9 @@ static void shader_sm4_read_instruction_modifier(DWORD modifier, struct wined3d_
static
void
shader_sm4_read_instruction
(
void
*
data
,
const
DWORD
**
ptr
,
struct
wined3d_shader_instruction
*
ins
)
static
void
shader_sm4_read_instruction
(
void
*
data
,
const
DWORD
**
ptr
,
struct
wined3d_shader_instruction
*
ins
)
{
{
const
struct
wined3d_sm4_opcode_info
*
opcode_info
;
const
struct
wined3d_sm4_opcode_info
*
opcode_info
;
DWORD
opcode_token
,
opcode
,
previous_token
;
uint32_t
opcode_token
,
previous_token
;
struct
wined3d_sm4_data
*
priv
=
data
;
struct
wined3d_sm4_data
*
priv
=
data
;
unsigned
int
opcode
;
unsigned
int
i
,
len
;
unsigned
int
i
,
len
;
SIZE_T
remaining
;
SIZE_T
remaining
;
const
DWORD
*
p
;
const
DWORD
*
p
;
...
@@ -1837,9 +1838,9 @@ const struct wined3d_shader_frontend sm4_shader_frontend =
...
@@ -1837,9 +1838,9 @@ const struct wined3d_shader_frontend sm4_shader_frontend =
struct
aon9_header
struct
aon9_header
{
{
DWORD
chunk_size
;
DWORD
chunk_size
;
DWORD
shader_version
;
unsigned
int
shader_version
;
DWORD
unknown
;
DWORD
unknown
;
DWORD
byte_code_offset
;
unsigned
int
byte_code_offset
;
};
};
struct
shader_handler_context
struct
shader_handler_context
...
@@ -1849,7 +1850,7 @@ struct shader_handler_context
...
@@ -1849,7 +1850,7 @@ struct shader_handler_context
unsigned
int
max_version
;
unsigned
int
max_version
;
};
};
static
void
read_dword
(
const
char
**
ptr
,
DWORD
*
d
)
static
void
read_dword
(
const
char
**
ptr
,
unsigned
int
*
d
)
{
{
memcpy
(
d
,
*
ptr
,
sizeof
(
*
d
));
memcpy
(
d
,
*
ptr
,
sizeof
(
*
d
));
*
ptr
+=
sizeof
(
*
d
);
*
ptr
+=
sizeof
(
*
d
);
...
@@ -1863,7 +1864,7 @@ static BOOL require_space(size_t offset, size_t count, size_t size, size_t data_
...
@@ -1863,7 +1864,7 @@ static BOOL require_space(size_t offset, size_t count, size_t size, size_t data_
static
void
skip_dword_unknown
(
const
char
**
ptr
,
unsigned
int
count
)
static
void
skip_dword_unknown
(
const
char
**
ptr
,
unsigned
int
count
)
{
{
unsigned
int
i
;
unsigned
int
i
;
DWORD
d
;
unsigned
int
d
;
WARN
(
"Skipping %u unknown DWORDs:
\n
"
,
count
);
WARN
(
"Skipping %u unknown DWORDs:
\n
"
,
count
);
for
(
i
=
0
;
i
<
count
;
++
i
)
for
(
i
=
0
;
i
<
count
;
++
i
)
...
@@ -1874,15 +1875,15 @@ static void skip_dword_unknown(const char **ptr, unsigned int count)
...
@@ -1874,15 +1875,15 @@ static void skip_dword_unknown(const char **ptr, unsigned int count)
}
}
static
HRESULT
parse_dxbc
(
const
char
*
data
,
SIZE_T
data_size
,
static
HRESULT
parse_dxbc
(
const
char
*
data
,
SIZE_T
data_size
,
HRESULT
(
*
chunk_handler
)(
const
char
*
data
,
DWORD
data_size
,
DWORD
tag
,
void
*
ctx
),
void
*
ctx
)
HRESULT
(
*
chunk_handler
)(
const
char
*
data
,
unsigned
int
data_size
,
unsigned
int
tag
,
void
*
ctx
),
void
*
ctx
)
{
{
const
char
*
ptr
=
data
;
const
char
*
ptr
=
data
;
HRESULT
hr
=
S_OK
;
HRESULT
hr
=
S_OK
;
DWORD
chunk_count
;
unsigned
int
chunk_count
;
DWORD
total_size
;
unsigned
int
total_size
;
unsigned
int
i
;
unsigned
int
i
;
DWORD
version
;
unsigned
int
version
;
DWORD
tag
;
unsigned
int
tag
;
read_dword
(
&
ptr
,
&
tag
);
read_dword
(
&
ptr
,
&
tag
);
TRACE
(
"tag: %s.
\n
"
,
debugstr_an
((
const
char
*
)
&
tag
,
4
));
TRACE
(
"tag: %s.
\n
"
,
debugstr_an
((
const
char
*
)
&
tag
,
4
));
...
@@ -1912,9 +1913,9 @@ static HRESULT parse_dxbc(const char *data, SIZE_T data_size,
...
@@ -1912,9 +1913,9 @@ static HRESULT parse_dxbc(const char *data, SIZE_T data_size,
for
(
i
=
0
;
i
<
chunk_count
;
++
i
)
for
(
i
=
0
;
i
<
chunk_count
;
++
i
)
{
{
DWORD
chunk_tag
,
chunk_size
;
unsigned
int
chunk_tag
,
chunk_size
;
const
char
*
chunk_ptr
;
const
char
*
chunk_ptr
;
DWORD
chunk_offset
;
unsigned
int
chunk_offset
;
read_dword
(
&
ptr
,
&
chunk_offset
);
read_dword
(
&
ptr
,
&
chunk_offset
);
TRACE
(
"chunk %u at offset %#x
\n
"
,
i
,
chunk_offset
);
TRACE
(
"chunk %u at offset %#x
\n
"
,
i
,
chunk_offset
);
...
@@ -1944,7 +1945,7 @@ static HRESULT parse_dxbc(const char *data, SIZE_T data_size,
...
@@ -1944,7 +1945,7 @@ static HRESULT parse_dxbc(const char *data, SIZE_T data_size,
return
hr
;
return
hr
;
}
}
static
const
char
*
shader_get_string
(
const
char
*
data
,
size_t
data_size
,
DWORD
offset
)
static
const
char
*
shader_get_string
(
const
char
*
data
,
size_t
data_size
,
unsigned
int
offset
)
{
{
if
(
offset
>=
data_size
)
if
(
offset
>=
data_size
)
{
{
...
@@ -1958,14 +1959,14 @@ static const char *shader_get_string(const char *data, size_t data_size, DWORD o
...
@@ -1958,14 +1959,14 @@ static const char *shader_get_string(const char *data, size_t data_size, DWORD o
return
data
+
offset
;
return
data
+
offset
;
}
}
static
HRESULT
shader_parse_signature
(
DWORD
tag
,
const
char
*
data
,
DWORD
data_size
,
static
HRESULT
shader_parse_signature
(
DWORD
tag
,
const
char
*
data
,
unsigned
int
data_size
,
struct
wined3d_shader_signature
*
s
)
struct
wined3d_shader_signature
*
s
)
{
{
struct
wined3d_shader_signature_element
*
e
;
struct
wined3d_shader_signature_element
*
e
;
bool
has_stream_index
,
has_min_precision
;
bool
has_stream_index
,
has_min_precision
;
const
char
*
ptr
=
data
;
const
char
*
ptr
=
data
;
unsigned
int
i
;
unsigned
int
i
;
DWORD
count
;
unsigned
int
count
;
if
(
!
require_space
(
0
,
2
,
sizeof
(
DWORD
),
data_size
))
if
(
!
require_space
(
0
,
2
,
sizeof
(
DWORD
),
data_size
))
{
{
...
@@ -1995,7 +1996,7 @@ static HRESULT shader_parse_signature(DWORD tag, const char *data, DWORD data_si
...
@@ -1995,7 +1996,7 @@ static HRESULT shader_parse_signature(DWORD tag, const char *data, DWORD data_si
for
(
i
=
0
;
i
<
count
;
++
i
)
for
(
i
=
0
;
i
<
count
;
++
i
)
{
{
DWORD
name_offset
;
unsigned
int
name_offset
;
if
(
has_stream_index
)
if
(
has_stream_index
)
read_dword
(
&
ptr
,
&
e
[
i
].
stream_idx
);
read_dword
(
&
ptr
,
&
e
[
i
].
stream_idx
);
...
@@ -2031,7 +2032,7 @@ static HRESULT shader_parse_signature(DWORD tag, const char *data, DWORD data_si
...
@@ -2031,7 +2032,7 @@ static HRESULT shader_parse_signature(DWORD tag, const char *data, DWORD data_si
return
S_OK
;
return
S_OK
;
}
}
static
HRESULT
shader_dxbc_chunk_handler
(
const
char
*
data
,
DWORD
data_size
,
DWORD
tag
,
void
*
context
)
static
HRESULT
shader_dxbc_chunk_handler
(
const
char
*
data
,
unsigned
int
data_size
,
unsigned
int
tag
,
void
*
context
)
{
{
struct
shader_handler_context
*
ctx
=
context
;
struct
shader_handler_context
*
ctx
=
context
;
struct
wined3d_shader
*
shader
=
ctx
->
shader
;
struct
wined3d_shader
*
shader
=
ctx
->
shader
;
...
...
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