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
42582ada
Commit
42582ada
authored
Sep 04, 2012
by
Henri Verbeet
Committed by
Alexandre Julliard
Sep 05, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Read complete shader instructions at a time.
parent
f2437c2b
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
157 additions
and
94 deletions
+157
-94
shader.c
dlls/wined3d/shader.c
+0
-0
shader_sm1.c
dlls/wined3d/shader_sm1.c
+90
-36
shader_sm4.c
dlls/wined3d/shader_sm4.c
+56
-43
wined3d_private.h
dlls/wined3d/wined3d_private.h
+11
-15
No files found.
dlls/wined3d/shader.c
View file @
42582ada
This diff is collapsed.
Click to expand it.
dlls/wined3d/shader_sm1.c
View file @
42582ada
...
...
@@ -204,6 +204,13 @@ struct wined3d_sm1_data
{
struct
wined3d_shader_version
shader_version
;
const
struct
wined3d_sm1_opcode_info
*
opcode_table
;
struct
wined3d_shader_src_param
src_rel_addr
[
4
];
struct
wined3d_shader_src_param
pred_rel_addr
;
struct
wined3d_shader_src_param
dst_rel_addr
;
struct
wined3d_shader_src_param
src_param
[
4
];
struct
wined3d_shader_src_param
pred_param
;
struct
wined3d_shader_dst_param
dst_param
;
};
/* This table is not order or position dependent. */
...
...
@@ -568,36 +575,9 @@ static void shader_sm1_read_header(void *data, const DWORD **ptr, struct wined3d
*
shader_version
=
priv
->
shader_version
;
}
static
void
shader_sm1_read_
opcode
(
void
*
data
,
const
DWORD
**
ptr
,
struct
wined3d_shader_instruction
*
ins
,
UINT
*
param_size
)
static
void
shader_sm1_read_
src_param
(
struct
wined3d_sm1_data
*
priv
,
const
DWORD
**
ptr
,
struct
wined3d_shader_src_param
*
src_param
,
struct
wined3d_shader_src_param
*
src_rel_addr
)
{
struct
wined3d_sm1_data
*
priv
=
data
;
const
struct
wined3d_sm1_opcode_info
*
opcode_info
;
DWORD
opcode_token
;
opcode_token
=
*
(
*
ptr
)
++
;
opcode_info
=
shader_get_opcode
(
priv
,
opcode_token
);
if
(
!
opcode_info
)
{
FIXME
(
"Unrecognized opcode: token=0x%08x
\n
"
,
opcode_token
);
ins
->
handler_idx
=
WINED3DSIH_TABLE_SIZE
;
*
param_size
=
shader_skip_unrecognized
(
priv
,
*
ptr
);
return
;
}
ins
->
handler_idx
=
opcode_info
->
handler_idx
;
ins
->
flags
=
(
opcode_token
&
WINED3D_OPCODESPECIFICCONTROL_MASK
)
>>
WINED3D_OPCODESPECIFICCONTROL_SHIFT
;
ins
->
coissue
=
opcode_token
&
WINED3DSI_COISSUE
;
ins
->
predicate
=
opcode_token
&
WINED3DSHADER_INSTRUCTION_PREDICATED
;
ins
->
dst_count
=
opcode_info
->
dst_count
?
1
:
0
;
ins
->
src_count
=
opcode_info
->
param_count
-
opcode_info
->
dst_count
;
*
param_size
=
shader_skip_opcode
(
priv
,
opcode_info
,
opcode_token
);
}
static
void
shader_sm1_read_src_param
(
void
*
data
,
const
DWORD
**
ptr
,
struct
wined3d_shader_src_param
*
src_param
,
struct
wined3d_shader_src_param
*
src_rel_addr
)
{
struct
wined3d_sm1_data
*
priv
=
data
;
DWORD
token
,
addr_token
;
*
ptr
+=
shader_get_param
(
priv
,
*
ptr
,
&
token
,
&
addr_token
);
...
...
@@ -612,10 +592,9 @@ static void shader_sm1_read_src_param(void *data, const DWORD **ptr, struct wine
}
}
static
void
shader_sm1_read_dst_param
(
void
*
data
,
const
DWORD
**
ptr
,
struct
wined3d_shader_dst_param
*
dst_param
,
struct
wined3d_shader_src_param
*
dst_rel_addr
)
static
void
shader_sm1_read_dst_param
(
struct
wined3d_sm1_data
*
priv
,
const
DWORD
**
ptr
,
struct
wined3d_shader_
dst_param
*
dst_param
,
struct
wined3d_shader_
src_param
*
dst_rel_addr
)
{
struct
wined3d_sm1_data
*
priv
=
data
;
DWORD
token
,
addr_token
;
*
ptr
+=
shader_get_param
(
priv
,
*
ptr
,
&
token
,
&
addr_token
);
...
...
@@ -641,6 +620,84 @@ static void shader_sm1_read_semantic(const DWORD **ptr, struct wined3d_shader_se
shader_parse_dst_param
(
dst_token
,
NULL
,
&
semantic
->
reg
);
}
static
void
shader_sm1_read_immconst
(
const
DWORD
**
ptr
,
struct
wined3d_shader_src_param
*
src_param
,
enum
wined3d_immconst_type
type
)
{
UINT
count
=
type
==
WINED3D_IMMCONST_VEC4
?
4
:
1
;
src_param
->
reg
.
type
=
WINED3DSPR_IMMCONST
;
src_param
->
reg
.
idx
=
~
0U
;
src_param
->
reg
.
array_idx
=
~
0U
;
src_param
->
reg
.
rel_addr
=
NULL
;
src_param
->
reg
.
immconst_type
=
type
;
memcpy
(
src_param
->
reg
.
immconst_data
,
*
ptr
,
count
*
sizeof
(
DWORD
));
src_param
->
swizzle
=
WINED3DSP_NOSWIZZLE
;
src_param
->
modifiers
=
0
;
*
ptr
+=
count
;
}
static
void
shader_sm1_read_instruction
(
void
*
data
,
const
DWORD
**
ptr
,
struct
wined3d_shader_instruction
*
ins
)
{
const
struct
wined3d_sm1_opcode_info
*
opcode_info
;
struct
wined3d_sm1_data
*
priv
=
data
;
DWORD
opcode_token
;
unsigned
int
i
;
const
DWORD
*
p
;
opcode_token
=
*
(
*
ptr
)
++
;
if
(
!
(
opcode_info
=
shader_get_opcode
(
priv
,
opcode_token
)))
{
FIXME
(
"Unrecognized opcode: token=0x%08x.
\n
"
,
opcode_token
);
ins
->
handler_idx
=
WINED3DSIH_TABLE_SIZE
;
*
ptr
+=
shader_skip_unrecognized
(
priv
,
*
ptr
);
return
;
}
ins
->
handler_idx
=
opcode_info
->
handler_idx
;
ins
->
flags
=
(
opcode_token
&
WINED3D_OPCODESPECIFICCONTROL_MASK
)
>>
WINED3D_OPCODESPECIFICCONTROL_SHIFT
;
ins
->
coissue
=
opcode_token
&
WINED3DSI_COISSUE
;
ins
->
predicate
=
opcode_token
&
WINED3DSHADER_INSTRUCTION_PREDICATED
?
&
priv
->
pred_param
:
NULL
;
ins
->
dst_count
=
opcode_info
->
dst_count
?
1
:
0
;
ins
->
dst
=
&
priv
->
dst_param
;
ins
->
src_count
=
opcode_info
->
param_count
-
opcode_info
->
dst_count
;
ins
->
src
=
priv
->
src_param
;
p
=
*
ptr
;
*
ptr
+=
shader_skip_opcode
(
priv
,
opcode_info
,
opcode_token
);
if
(
ins
->
handler_idx
==
WINED3DSIH_DCL
)
{
shader_sm1_read_semantic
(
&
p
,
&
ins
->
semantic
);
}
else
if
(
ins
->
handler_idx
==
WINED3DSIH_DEF
||
ins
->
handler_idx
==
WINED3DSIH_DEFI
)
{
shader_sm1_read_dst_param
(
priv
,
&
p
,
&
priv
->
dst_param
,
&
priv
->
dst_rel_addr
);
shader_sm1_read_immconst
(
&
p
,
&
priv
->
src_param
[
0
],
WINED3D_IMMCONST_VEC4
);
}
else
if
(
ins
->
handler_idx
==
WINED3DSIH_DEFB
)
{
shader_sm1_read_dst_param
(
priv
,
&
p
,
&
priv
->
dst_param
,
&
priv
->
dst_rel_addr
);
shader_sm1_read_immconst
(
&
p
,
&
priv
->
src_param
[
0
],
WINED3D_IMMCONST_SCALAR
);
}
else
{
/* Destination token */
if
(
ins
->
dst_count
)
shader_sm1_read_dst_param
(
priv
,
&
p
,
&
priv
->
dst_param
,
&
priv
->
dst_rel_addr
);
/* Predication token */
if
(
ins
->
predicate
)
shader_sm1_read_src_param
(
priv
,
&
p
,
&
priv
->
pred_param
,
&
priv
->
pred_rel_addr
);
/* Other source tokens */
for
(
i
=
0
;
i
<
ins
->
src_count
;
++
i
)
{
shader_sm1_read_src_param
(
priv
,
&
p
,
&
priv
->
src_param
[
i
],
&
priv
->
src_rel_addr
[
i
]);
}
}
}
static
void
shader_sm1_read_comment
(
const
DWORD
**
ptr
,
const
char
**
comment
,
UINT
*
comment_size
)
{
DWORD
token
=
**
ptr
;
...
...
@@ -674,10 +731,7 @@ const struct wined3d_shader_frontend sm1_shader_frontend =
shader_sm1_init
,
shader_sm1_free
,
shader_sm1_read_header
,
shader_sm1_read_opcode
,
shader_sm1_read_src_param
,
shader_sm1_read_dst_param
,
shader_sm1_read_semantic
,
shader_sm1_read_instruction
,
shader_sm1_read_comment
,
shader_sm1_is_end
,
};
dlls/wined3d/shader_sm4.c
View file @
42582ada
...
...
@@ -122,6 +122,11 @@ struct wined3d_sm4_data
struct
wined3d_shader_version
shader_version
;
const
DWORD
*
end
;
const
struct
wined3d_shader_signature
*
output_signature
;
struct
wined3d_shader_src_param
src_rel_addr
[
5
];
struct
wined3d_shader_src_param
dst_rel_addr
[
2
];
struct
wined3d_shader_src_param
src_param
[
5
];
struct
wined3d_shader_dst_param
dst_param
[
2
];
};
struct
wined3d_sm4_opcode_info
...
...
@@ -333,41 +338,9 @@ static void shader_sm4_read_header(void *data, const DWORD **ptr, struct wined3d
*
shader_version
=
priv
->
shader_version
;
}
static
void
shader_sm4_read_
opcode
(
void
*
data
,
const
DWORD
**
ptr
,
struct
wined3d_shader_instruction
*
ins
,
UINT
*
param_size
)
static
void
shader_sm4_read_
src_param
(
struct
wined3d_sm4_data
*
priv
,
const
DWORD
**
ptr
,
struct
wined3d_shader_src_param
*
src_param
,
struct
wined3d_shader_src_param
*
src_rel_addr
)
{
const
struct
wined3d_sm4_opcode_info
*
opcode_info
;
DWORD
token
=
*
(
*
ptr
)
++
;
DWORD
opcode
=
token
&
WINED3D_SM4_OPCODE_MASK
;
*
param_size
=
((
token
&
WINED3D_SM4_INSTRUCTION_LENGTH_MASK
)
>>
WINED3D_SM4_INSTRUCTION_LENGTH_SHIFT
)
-
1
;
opcode_info
=
get_opcode_info
(
opcode
);
if
(
!
opcode_info
)
{
FIXME
(
"Unrecognized opcode %#x, token 0x%08x
\n
"
,
opcode
,
token
);
ins
->
handler_idx
=
WINED3DSIH_TABLE_SIZE
;
return
;
}
ins
->
handler_idx
=
opcode_info
->
handler_idx
;
ins
->
flags
=
0
;
ins
->
coissue
=
0
;
ins
->
predicate
=
0
;
ins
->
dst_count
=
opcode_info
->
dst_count
;
ins
->
src_count
=
opcode_info
->
src_count
;
if
(
token
&
WINED3D_SM4_INSTRUCTION_MODIFIER
)
{
DWORD
modifier
=
*
(
*
ptr
)
++
;
FIXME
(
"Skipping modifier 0x%08x.
\n
"
,
modifier
);
}
}
static
void
shader_sm4_read_src_param
(
void
*
data
,
const
DWORD
**
ptr
,
struct
wined3d_shader_src_param
*
src_param
,
struct
wined3d_shader_src_param
*
src_rel_addr
)
{
struct
wined3d_sm4_data
*
priv
=
data
;
DWORD
token
=
*
(
*
ptr
)
++
;
enum
wined3d_sm4_register_type
register_type
;
DWORD
order
;
...
...
@@ -456,10 +429,9 @@ static void shader_sm4_read_src_param(void *data, const DWORD **ptr, struct wine
map_register
(
priv
,
&
src_param
->
reg
);
}
static
void
shader_sm4_read_dst_param
(
void
*
data
,
const
DWORD
**
ptr
,
struct
wined3d_shader_dst_param
*
dst_param
,
struct
wined3d_shader_src_param
*
dst_rel_addr
)
static
void
shader_sm4_read_dst_param
(
struct
wined3d_sm4_data
*
priv
,
const
DWORD
**
ptr
,
struct
wined3d_shader_
dst_param
*
dst_param
,
struct
wined3d_shader_
src_param
*
dst_rel_addr
)
{
struct
wined3d_sm4_data
*
priv
=
data
;
DWORD
token
=
*
(
*
ptr
)
++
;
enum
wined3d_sm4_register_type
register_type
;
DWORD
order
;
...
...
@@ -493,9 +465,53 @@ static void shader_sm4_read_dst_param(void *data, const DWORD **ptr, struct wine
map_register
(
priv
,
&
dst_param
->
reg
);
}
static
void
shader_sm4_read_
semantic
(
const
DWORD
**
ptr
,
struct
wined3d_shader_semantic
*
semantic
)
static
void
shader_sm4_read_
instruction
(
void
*
data
,
const
DWORD
**
ptr
,
struct
wined3d_shader_instruction
*
ins
)
{
FIXME
(
"ptr %p, semantic %p stub!
\n
"
,
ptr
,
semantic
);
const
struct
wined3d_sm4_opcode_info
*
opcode_info
;
struct
wined3d_sm4_data
*
priv
=
data
;
DWORD
opcode_token
,
opcode
;
const
DWORD
*
p
;
UINT
i
,
len
;
opcode_token
=
*
(
*
ptr
)
++
;
opcode
=
opcode_token
&
WINED3D_SM4_OPCODE_MASK
;
len
=
((
opcode_token
&
WINED3D_SM4_INSTRUCTION_LENGTH_MASK
)
>>
WINED3D_SM4_INSTRUCTION_LENGTH_SHIFT
)
-
1
;
if
(
!
(
opcode_info
=
get_opcode_info
(
opcode
)))
{
FIXME
(
"Unrecognized opcode %#x, opcode_token 0x%08x.
\n
"
,
opcode
,
opcode_token
);
ins
->
handler_idx
=
WINED3DSIH_TABLE_SIZE
;
*
ptr
+=
len
;
return
;
}
ins
->
handler_idx
=
opcode_info
->
handler_idx
;
ins
->
flags
=
0
;
ins
->
coissue
=
0
;
ins
->
predicate
=
NULL
;
ins
->
dst_count
=
opcode_info
->
dst_count
;
ins
->
dst
=
priv
->
dst_param
;
ins
->
src_count
=
opcode_info
->
src_count
;
ins
->
src
=
priv
->
src_param
;
p
=
*
ptr
;
*
ptr
+=
len
;
if
(
opcode_token
&
WINED3D_SM4_INSTRUCTION_MODIFIER
)
{
DWORD
modifier
=
*
p
++
;
FIXME
(
"Skipping modifier 0x%08x.
\n
"
,
modifier
);
}
for
(
i
=
0
;
i
<
ins
->
dst_count
;
++
i
)
{
shader_sm4_read_dst_param
(
priv
,
&
p
,
&
priv
->
dst_param
[
i
],
&
priv
->
dst_rel_addr
[
i
]);
}
for
(
i
=
0
;
i
<
ins
->
src_count
;
++
i
)
{
shader_sm4_read_src_param
(
priv
,
&
p
,
&
priv
->
src_param
[
i
],
&
priv
->
src_rel_addr
[
i
]);
}
}
static
void
shader_sm4_read_comment
(
const
DWORD
**
ptr
,
const
char
**
comment
,
UINT
*
comment_size
)
...
...
@@ -515,10 +531,7 @@ const struct wined3d_shader_frontend sm4_shader_frontend =
shader_sm4_init
,
shader_sm4_free
,
shader_sm4_read_header
,
shader_sm4_read_opcode
,
shader_sm4_read_src_param
,
shader_sm4_read_dst_param
,
shader_sm4_read_semantic
,
shader_sm4_read_instruction
,
shader_sm4_read_comment
,
shader_sm4_is_end
,
};
dlls/wined3d/wined3d_private.h
View file @
42582ada
...
...
@@ -634,25 +634,26 @@ struct wined3d_shader_src_param
enum
wined3d_shader_src_modifier
modifiers
;
};
struct
wined3d_shader_semantic
{
enum
wined3d_decl_usage
usage
;
UINT
usage_idx
;
enum
wined3d_sampler_texture_type
sampler_type
;
struct
wined3d_shader_dst_param
reg
;
};
struct
wined3d_shader_instruction
{
const
struct
wined3d_shader_context
*
ctx
;
enum
WINED3D_SHADER_INSTRUCTION_HANDLER
handler_idx
;
DWORD
flags
;
BOOL
coissue
;
DWORD
predicate
;
const
struct
wined3d_shader_src_param
*
predicate
;
UINT
dst_count
;
const
struct
wined3d_shader_dst_param
*
dst
;
UINT
src_count
;
const
struct
wined3d_shader_src_param
*
src
;
};
struct
wined3d_shader_semantic
{
enum
wined3d_decl_usage
usage
;
UINT
usage_idx
;
enum
wined3d_sampler_texture_type
sampler_type
;
struct
wined3d_shader_dst_param
reg
;
struct
wined3d_shader_semantic
semantic
;
};
struct
wined3d_shader_attribute
...
...
@@ -673,12 +674,7 @@ struct wined3d_shader_frontend
void
*
(
*
shader_init
)(
const
DWORD
*
ptr
,
const
struct
wined3d_shader_signature
*
output_signature
);
void
(
*
shader_free
)(
void
*
data
);
void
(
*
shader_read_header
)(
void
*
data
,
const
DWORD
**
ptr
,
struct
wined3d_shader_version
*
shader_version
);
void
(
*
shader_read_opcode
)(
void
*
data
,
const
DWORD
**
ptr
,
struct
wined3d_shader_instruction
*
ins
,
UINT
*
param_size
);
void
(
*
shader_read_src_param
)(
void
*
data
,
const
DWORD
**
ptr
,
struct
wined3d_shader_src_param
*
src_param
,
struct
wined3d_shader_src_param
*
src_rel_addr
);
void
(
*
shader_read_dst_param
)(
void
*
data
,
const
DWORD
**
ptr
,
struct
wined3d_shader_dst_param
*
dst_param
,
struct
wined3d_shader_src_param
*
dst_rel_addr
);
void
(
*
shader_read_semantic
)(
const
DWORD
**
ptr
,
struct
wined3d_shader_semantic
*
semantic
);
void
(
*
shader_read_instruction
)(
void
*
data
,
const
DWORD
**
ptr
,
struct
wined3d_shader_instruction
*
ins
);
void
(
*
shader_read_comment
)(
const
DWORD
**
ptr
,
const
char
**
comment
,
UINT
*
comment_size
);
BOOL
(
*
shader_is_end
)(
void
*
data
,
const
DWORD
**
ptr
);
};
...
...
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