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
9a8ffc91
Commit
9a8ffc91
authored
Jun 08, 2010
by
Matteo Bruni
Committed by
Alexandre Julliard
Jun 09, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3dx9: Mark builtin compatibility declarations in the shader assembler.
This way we can output declarations in the bytecode without polluting them with the builtin ones.
parent
a2b21781
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
27 deletions
+40
-27
asmparser.c
dlls/d3dx9_36/asmparser.c
+25
-25
bytecodewriter.c
dlls/d3dx9_36/bytecodewriter.c
+11
-1
d3dx9_36_private.h
dlls/d3dx9_36/d3dx9_36_private.h
+4
-1
No files found.
dlls/d3dx9_36/asmparser.c
View file @
9a8ffc91
...
...
@@ -110,7 +110,7 @@ static void asmparser_dcl_output(struct asm_parser *This, DWORD usage, DWORD num
asmparser_message
(
This
,
"Line %u: Output register declared in a pixel shader
\n
"
,
This
->
line_no
);
set_parse_status
(
This
,
PARSE_ERR
);
}
if
(
!
record_declaration
(
This
->
shader
,
usage
,
num
,
0
,
TRUE
,
reg
->
regnum
,
reg
->
writemask
))
{
if
(
!
record_declaration
(
This
->
shader
,
usage
,
num
,
0
,
TRUE
,
reg
->
regnum
,
reg
->
writemask
,
FALSE
))
{
ERR
(
"Out of memory
\n
"
);
set_parse_status
(
This
,
PARSE_ERR
);
}
...
...
@@ -127,7 +127,7 @@ static void asmparser_dcl_input(struct asm_parser *This, DWORD usage, DWORD num,
set_parse_status
(
This
,
PARSE_ERR
);
return
;
}
if
(
!
record_declaration
(
This
->
shader
,
usage
,
num
,
mod
,
FALSE
,
reg
->
regnum
,
reg
->
writemask
))
{
if
(
!
record_declaration
(
This
->
shader
,
usage
,
num
,
mod
,
FALSE
,
reg
->
regnum
,
reg
->
writemask
,
FALSE
))
{
ERR
(
"Out of memory
\n
"
);
set_parse_status
(
This
,
PARSE_ERR
);
}
...
...
@@ -860,34 +860,34 @@ static const struct asmparser_backend parser_ps_3 = {
};
static
void
gen_oldvs_output
(
struct
bwriter_shader
*
shader
)
{
record_declaration
(
shader
,
BWRITERDECLUSAGE_POSITION
,
0
,
0
,
TRUE
,
OPOS_REG
,
BWRITERSP_WRITEMASK_ALL
);
record_declaration
(
shader
,
BWRITERDECLUSAGE_TEXCOORD
,
0
,
0
,
TRUE
,
OT0_REG
,
BWRITERSP_WRITEMASK_ALL
);
record_declaration
(
shader
,
BWRITERDECLUSAGE_TEXCOORD
,
1
,
0
,
TRUE
,
OT1_REG
,
BWRITERSP_WRITEMASK_ALL
);
record_declaration
(
shader
,
BWRITERDECLUSAGE_TEXCOORD
,
2
,
0
,
TRUE
,
OT2_REG
,
BWRITERSP_WRITEMASK_ALL
);
record_declaration
(
shader
,
BWRITERDECLUSAGE_TEXCOORD
,
3
,
0
,
TRUE
,
OT3_REG
,
BWRITERSP_WRITEMASK_ALL
);
record_declaration
(
shader
,
BWRITERDECLUSAGE_TEXCOORD
,
4
,
0
,
TRUE
,
OT4_REG
,
BWRITERSP_WRITEMASK_ALL
);
record_declaration
(
shader
,
BWRITERDECLUSAGE_TEXCOORD
,
5
,
0
,
TRUE
,
OT5_REG
,
BWRITERSP_WRITEMASK_ALL
);
record_declaration
(
shader
,
BWRITERDECLUSAGE_TEXCOORD
,
6
,
0
,
TRUE
,
OT6_REG
,
BWRITERSP_WRITEMASK_ALL
);
record_declaration
(
shader
,
BWRITERDECLUSAGE_TEXCOORD
,
7
,
0
,
TRUE
,
OT7_REG
,
BWRITERSP_WRITEMASK_ALL
);
record_declaration
(
shader
,
BWRITERDECLUSAGE_FOG
,
0
,
0
,
TRUE
,
OFOG_REG
,
OFOG_WRITEMASK
);
record_declaration
(
shader
,
BWRITERDECLUSAGE_PSIZE
,
0
,
0
,
TRUE
,
OPTS_REG
,
OPTS_WRITEMASK
);
record_declaration
(
shader
,
BWRITERDECLUSAGE_COLOR
,
0
,
0
,
TRUE
,
OD0_REG
,
BWRITERSP_WRITEMASK_ALL
);
record_declaration
(
shader
,
BWRITERDECLUSAGE_COLOR
,
1
,
0
,
TRUE
,
OD1_REG
,
BWRITERSP_WRITEMASK_ALL
);
record_declaration
(
shader
,
BWRITERDECLUSAGE_POSITION
,
0
,
0
,
TRUE
,
OPOS_REG
,
BWRITERSP_WRITEMASK_ALL
,
TRUE
);
record_declaration
(
shader
,
BWRITERDECLUSAGE_TEXCOORD
,
0
,
0
,
TRUE
,
OT0_REG
,
BWRITERSP_WRITEMASK_ALL
,
TRUE
);
record_declaration
(
shader
,
BWRITERDECLUSAGE_TEXCOORD
,
1
,
0
,
TRUE
,
OT1_REG
,
BWRITERSP_WRITEMASK_ALL
,
TRUE
);
record_declaration
(
shader
,
BWRITERDECLUSAGE_TEXCOORD
,
2
,
0
,
TRUE
,
OT2_REG
,
BWRITERSP_WRITEMASK_ALL
,
TRUE
);
record_declaration
(
shader
,
BWRITERDECLUSAGE_TEXCOORD
,
3
,
0
,
TRUE
,
OT3_REG
,
BWRITERSP_WRITEMASK_ALL
,
TRUE
);
record_declaration
(
shader
,
BWRITERDECLUSAGE_TEXCOORD
,
4
,
0
,
TRUE
,
OT4_REG
,
BWRITERSP_WRITEMASK_ALL
,
TRUE
);
record_declaration
(
shader
,
BWRITERDECLUSAGE_TEXCOORD
,
5
,
0
,
TRUE
,
OT5_REG
,
BWRITERSP_WRITEMASK_ALL
,
TRUE
);
record_declaration
(
shader
,
BWRITERDECLUSAGE_TEXCOORD
,
6
,
0
,
TRUE
,
OT6_REG
,
BWRITERSP_WRITEMASK_ALL
,
TRUE
);
record_declaration
(
shader
,
BWRITERDECLUSAGE_TEXCOORD
,
7
,
0
,
TRUE
,
OT7_REG
,
BWRITERSP_WRITEMASK_ALL
,
TRUE
);
record_declaration
(
shader
,
BWRITERDECLUSAGE_FOG
,
0
,
0
,
TRUE
,
OFOG_REG
,
OFOG_WRITEMASK
,
TRUE
);
record_declaration
(
shader
,
BWRITERDECLUSAGE_PSIZE
,
0
,
0
,
TRUE
,
OPTS_REG
,
OPTS_WRITEMASK
,
TRUE
);
record_declaration
(
shader
,
BWRITERDECLUSAGE_COLOR
,
0
,
0
,
TRUE
,
OD0_REG
,
BWRITERSP_WRITEMASK_ALL
,
TRUE
);
record_declaration
(
shader
,
BWRITERDECLUSAGE_COLOR
,
1
,
0
,
TRUE
,
OD1_REG
,
BWRITERSP_WRITEMASK_ALL
,
TRUE
);
}
static
void
gen_oldps_input
(
struct
bwriter_shader
*
shader
,
DWORD
texcoords
)
{
switch
(
texcoords
)
{
case
8
:
record_declaration
(
shader
,
BWRITERDECLUSAGE_TEXCOORD
,
7
,
0
,
FALSE
,
T7_VARYING
,
BWRITERSP_WRITEMASK_ALL
);
case
7
:
record_declaration
(
shader
,
BWRITERDECLUSAGE_TEXCOORD
,
6
,
0
,
FALSE
,
T6_VARYING
,
BWRITERSP_WRITEMASK_ALL
);
case
6
:
record_declaration
(
shader
,
BWRITERDECLUSAGE_TEXCOORD
,
5
,
0
,
FALSE
,
T5_VARYING
,
BWRITERSP_WRITEMASK_ALL
);
case
5
:
record_declaration
(
shader
,
BWRITERDECLUSAGE_TEXCOORD
,
4
,
0
,
FALSE
,
T4_VARYING
,
BWRITERSP_WRITEMASK_ALL
);
case
4
:
record_declaration
(
shader
,
BWRITERDECLUSAGE_TEXCOORD
,
3
,
0
,
FALSE
,
T3_VARYING
,
BWRITERSP_WRITEMASK_ALL
);
case
3
:
record_declaration
(
shader
,
BWRITERDECLUSAGE_TEXCOORD
,
2
,
0
,
FALSE
,
T2_VARYING
,
BWRITERSP_WRITEMASK_ALL
);
case
2
:
record_declaration
(
shader
,
BWRITERDECLUSAGE_TEXCOORD
,
1
,
0
,
FALSE
,
T1_VARYING
,
BWRITERSP_WRITEMASK_ALL
);
case
1
:
record_declaration
(
shader
,
BWRITERDECLUSAGE_TEXCOORD
,
0
,
0
,
FALSE
,
T0_VARYING
,
BWRITERSP_WRITEMASK_ALL
);
case
8
:
record_declaration
(
shader
,
BWRITERDECLUSAGE_TEXCOORD
,
7
,
0
,
FALSE
,
T7_VARYING
,
BWRITERSP_WRITEMASK_ALL
,
TRUE
);
case
7
:
record_declaration
(
shader
,
BWRITERDECLUSAGE_TEXCOORD
,
6
,
0
,
FALSE
,
T6_VARYING
,
BWRITERSP_WRITEMASK_ALL
,
TRUE
);
case
6
:
record_declaration
(
shader
,
BWRITERDECLUSAGE_TEXCOORD
,
5
,
0
,
FALSE
,
T5_VARYING
,
BWRITERSP_WRITEMASK_ALL
,
TRUE
);
case
5
:
record_declaration
(
shader
,
BWRITERDECLUSAGE_TEXCOORD
,
4
,
0
,
FALSE
,
T4_VARYING
,
BWRITERSP_WRITEMASK_ALL
,
TRUE
);
case
4
:
record_declaration
(
shader
,
BWRITERDECLUSAGE_TEXCOORD
,
3
,
0
,
FALSE
,
T3_VARYING
,
BWRITERSP_WRITEMASK_ALL
,
TRUE
);
case
3
:
record_declaration
(
shader
,
BWRITERDECLUSAGE_TEXCOORD
,
2
,
0
,
FALSE
,
T2_VARYING
,
BWRITERSP_WRITEMASK_ALL
,
TRUE
);
case
2
:
record_declaration
(
shader
,
BWRITERDECLUSAGE_TEXCOORD
,
1
,
0
,
FALSE
,
T1_VARYING
,
BWRITERSP_WRITEMASK_ALL
,
TRUE
);
case
1
:
record_declaration
(
shader
,
BWRITERDECLUSAGE_TEXCOORD
,
0
,
0
,
FALSE
,
T0_VARYING
,
BWRITERSP_WRITEMASK_ALL
,
TRUE
);
};
record_declaration
(
shader
,
BWRITERDECLUSAGE_COLOR
,
0
,
0
,
FALSE
,
C0_VARYING
,
BWRITERSP_WRITEMASK_ALL
);
record_declaration
(
shader
,
BWRITERDECLUSAGE_COLOR
,
1
,
0
,
FALSE
,
C1_VARYING
,
BWRITERSP_WRITEMASK_ALL
);
record_declaration
(
shader
,
BWRITERDECLUSAGE_COLOR
,
0
,
0
,
FALSE
,
C0_VARYING
,
BWRITERSP_WRITEMASK_ALL
,
TRUE
);
record_declaration
(
shader
,
BWRITERDECLUSAGE_COLOR
,
1
,
0
,
FALSE
,
C1_VARYING
,
BWRITERSP_WRITEMASK_ALL
,
TRUE
);
}
void
create_vs10_parser
(
struct
asm_parser
*
ret
)
{
...
...
dlls/d3dx9_36/bytecodewriter.c
View file @
9a8ffc91
...
...
@@ -209,7 +209,9 @@ BOOL add_constB(struct bwriter_shader *shader, DWORD reg, BOOL x) {
return
TRUE
;
}
BOOL
record_declaration
(
struct
bwriter_shader
*
shader
,
DWORD
usage
,
DWORD
usage_idx
,
DWORD
mod
,
BOOL
output
,
DWORD
regnum
,
DWORD
writemask
)
{
BOOL
record_declaration
(
struct
bwriter_shader
*
shader
,
DWORD
usage
,
DWORD
usage_idx
,
DWORD
mod
,
BOOL
output
,
DWORD
regnum
,
DWORD
writemask
,
BOOL
builtin
)
{
unsigned
int
*
num
;
struct
declaration
**
decl
;
unsigned
int
i
;
...
...
@@ -252,6 +254,7 @@ BOOL record_declaration(struct bwriter_shader *shader, DWORD usage, DWORD usage_
(
*
decl
)[
*
num
].
regnum
=
regnum
;
(
*
decl
)[
*
num
].
mod
=
mod
;
(
*
decl
)[
*
num
].
writemask
=
writemask
;
(
*
decl
)[
*
num
].
builtin
=
builtin
;
(
*
num
)
++
;
return
TRUE
;
...
...
@@ -351,6 +354,8 @@ static void write_declarations(struct bytecode_buffer *buffer, BOOL len,
}
for
(
i
=
0
;
i
<
num
;
i
++
)
{
if
(
decls
[
i
].
builtin
)
continue
;
/* Write the DCL instruction */
put_dword
(
buffer
,
instr_dcl
);
...
...
@@ -403,11 +408,14 @@ static void write_constF(const struct bwriter_shader *shader, struct bytecode_bu
write_const
(
shader
->
constF
,
shader
->
num_cf
,
D3DSIO_DEF
,
D3DSPR_CONST
,
buffer
,
len
);
}
/* This function looks for VS 1/2 registers mapping to VS 3 output registers */
static
HRESULT
vs_find_builtin_varyings
(
struct
bc_writer
*
This
,
const
struct
bwriter_shader
*
shader
)
{
DWORD
i
;
DWORD
usage
,
usage_idx
,
writemask
,
regnum
;
for
(
i
=
0
;
i
<
shader
->
num_outputs
;
i
++
)
{
if
(
!
shader
->
outputs
[
i
].
builtin
)
continue
;
usage
=
shader
->
outputs
[
i
].
usage
;
usage_idx
=
shader
->
outputs
[
i
].
usage_idx
;
writemask
=
shader
->
outputs
[
i
].
writemask
;
...
...
@@ -521,6 +529,8 @@ static HRESULT find_ps_builtin_semantics(struct bc_writer *This,
for
(
i
=
0
;
i
<
8
;
i
++
)
This
->
t_regnum
[
i
]
=
-
1
;
for
(
i
=
0
;
i
<
shader
->
num_inputs
;
i
++
)
{
if
(
!
shader
->
inputs
[
i
].
builtin
)
continue
;
usage
=
shader
->
inputs
[
i
].
usage
;
usage_idx
=
shader
->
inputs
[
i
].
usage_idx
;
writemask
=
shader
->
inputs
[
i
].
writemask
;
...
...
dlls/d3dx9_36/d3dx9_36_private.h
View file @
9a8ffc91
...
...
@@ -186,6 +186,7 @@ struct declaration {
DWORD
regnum
;
DWORD
mod
;
DWORD
writemask
;
BOOL
builtin
;
};
struct
samplerdecl
{
...
...
@@ -288,7 +289,9 @@ BOOL add_instruction(struct bwriter_shader *shader, struct instruction *instr);
BOOL
add_constF
(
struct
bwriter_shader
*
shader
,
DWORD
reg
,
float
x
,
float
y
,
float
z
,
float
w
);
BOOL
add_constI
(
struct
bwriter_shader
*
shader
,
DWORD
reg
,
INT
x
,
INT
y
,
INT
z
,
INT
w
);
BOOL
add_constB
(
struct
bwriter_shader
*
shader
,
DWORD
reg
,
BOOL
x
);
BOOL
record_declaration
(
struct
bwriter_shader
*
shader
,
DWORD
usage
,
DWORD
usage_idx
,
DWORD
mod
,
BOOL
output
,
DWORD
regnum
,
DWORD
writemask
);
BOOL
record_declaration
(
struct
bwriter_shader
*
shader
,
DWORD
usage
,
DWORD
usage_idx
,
DWORD
mod
,
BOOL
output
,
DWORD
regnum
,
DWORD
writemask
,
BOOL
builtin
);
BOOL
record_sampler
(
struct
bwriter_shader
*
shader
,
DWORD
samptype
,
DWORD
mod
,
DWORD
regnum
);
...
...
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