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
5f934aca
Commit
5f934aca
authored
May 05, 2010
by
Matteo Bruni
Committed by
Alexandre Julliard
May 06, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3dx9: Support all the remaining register types in the shader assembler.
parent
fa29e0f2
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
352 additions
and
2 deletions
+352
-2
asmshader.l
dlls/d3dx9_36/asmshader.l
+70
-0
asmshader.y
dlls/d3dx9_36/asmshader.y
+198
-0
asmutils.c
dlls/d3dx9_36/asmutils.c
+59
-0
d3dx9_36_private.h
dlls/d3dx9_36/d3dx9_36_private.h
+25
-2
No files found.
dlls/d3dx9_36/asmshader.l
View file @
5f934aca
...
...
@@ -44,7 +44,27 @@ COMPONENT [xyzw]|[rgba]
/* Registers */
REG_TEMP r[0-9]+
/* for relative addressing in the form o[x], v[x] and c[x] */
REG_OUTPUT o[0-9]*
REG_INPUT v[0-9]*
REG_CONSTFLOAT c[0-9]*
REG_CONSTINT i[0-9]+
REG_CONSTBOOL b[0-9]+
REG_TEXTURE t[0-9]+
REG_TEXCRDOUT oT[0-9]+
REG_SAMPLER s[0-9]+
REG_OPOS oPos
REG_OFOG oFog
REG_OPTS oPts
REG_VERTEXCOLOR oD[01]
REG_FRAGCOLOR oC[0-9]+
REG_FRAGDEPTH oDepth
REG_VPOS vPos
REG_VFACE vFace
REG_ADDRESS a0
REG_LOOP aL
REG_PREDICATE p0
/* Not really a register, but it is considered as such */
REG_LABEL l[0-9]+
PREPROCESSORDIRECTIVE #[^\n]*\n
...
...
@@ -71,10 +91,60 @@ mov {return INSTR_MOV; }
asmshader_lval.regnum = atoi(yytext + 1);
return REG_TEMP;
}
{REG_OUTPUT} {
asmshader_lval.regnum = atoi(yytext + 1);
return REG_OUTPUT;
}
{REG_INPUT} {
asmshader_lval.regnum = atoi(yytext + 1);
return REG_INPUT;
}
{REG_CONSTFLOAT} {
asmshader_lval.regnum = atoi(yytext + 1);
return REG_CONSTFLOAT;
}
{REG_CONSTINT} {
asmshader_lval.regnum = atoi(yytext + 1);
return REG_CONSTINT;
}
{REG_CONSTBOOL} {
asmshader_lval.regnum = atoi(yytext + 1);
return REG_CONSTBOOL;
}
{REG_TEXTURE} {
asmshader_lval.regnum = atoi(yytext + 1);
return REG_TEXTURE;
}
{REG_TEXCRDOUT} {
asmshader_lval.regnum = atoi(yytext + 2);
return REG_TEXCRDOUT;
}
{REG_SAMPLER} {
asmshader_lval.regnum = atoi(yytext + 1);
return REG_SAMPLER;
}
{REG_OPOS} {return REG_OPOS; }
{REG_OFOG} {return REG_OFOG; }
{REG_OPTS} {return REG_OPTS; }
{REG_VERTEXCOLOR} {
asmshader_lval.regnum = atoi(yytext + 2);
return REG_VERTEXCOLOR;
}
{REG_FRAGCOLOR} {
asmshader_lval.regnum = atoi(yytext + 2);
return REG_FRAGCOLOR;
}
{REG_FRAGDEPTH} {return REG_FRAGDEPTH; }
{REG_VPOS} {return REG_VPOS; }
{REG_VFACE} {return REG_VFACE; }
{REG_ADDRESS} {return REG_ADDRESS; }
{REG_LOOP} {return REG_LOOP; }
{REG_PREDICATE} {return REG_PREDICATE; }
{REG_LABEL} {
asmshader_lval.regnum = atoi(yytext + 1);
return REG_LABEL;
}
/* Shader versions. These are important to select the correct
* parser profile.
...
...
dlls/d3dx9_36/asmshader.y
View file @
5f934aca
...
...
@@ -71,7 +71,26 @@ void set_rel_reg(struct shader_reg *reg, struct rel_reg *rel) {
/* Registers */
%token <regnum> REG_TEMP
%token <regnum> REG_OUTPUT
%token <regnum> REG_INPUT
%token <regnum> REG_CONSTFLOAT
%token <regnum> REG_CONSTINT
%token <regnum> REG_CONSTBOOL
%token <regnum> REG_TEXTURE
%token <regnum> REG_SAMPLER
%token <regnum> REG_TEXCRDOUT
%token REG_OPOS
%token REG_OFOG
%token REG_OPTS
%token <regnum> REG_VERTEXCOLOR
%token <regnum> REG_FRAGCOLOR
%token REG_FRAGDEPTH
%token REG_VPOS
%token REG_VFACE
%token REG_ADDRESS
%token REG_LOOP
%token REG_PREDICATE
%token <regnum> REG_LABEL
/* Version tokens */
%token VER_VS10
...
...
@@ -237,6 +256,99 @@ dreg_name: REG_TEMP
{
$$.regnum = $1; $$.type = BWRITERSPR_TEMP;
}
| REG_OUTPUT
{
$$.regnum = $1; $$.type = BWRITERSPR_OUTPUT;
}
| REG_INPUT
{
asmparser_message(&asm_ctx, "Line %u: Register v%u is not a valid destination register\n",
asm_ctx.line_no, $1);
set_parse_status(&asm_ctx, PARSE_WARN);
}
| REG_CONSTFLOAT
{
asmparser_message(&asm_ctx, "Line %u: Register c%u is not a valid destination register\n",
asm_ctx.line_no, $1);
set_parse_status(&asm_ctx, PARSE_WARN);
}
| REG_CONSTINT
{
asmparser_message(&asm_ctx, "Line %u: Register i%u is not a valid destination register\n",
asm_ctx.line_no, $1);
set_parse_status(&asm_ctx, PARSE_WARN);
}
| REG_CONSTBOOL
{
asmparser_message(&asm_ctx, "Line %u: Register b%u is not a valid destination register\n",
asm_ctx.line_no, $1);
set_parse_status(&asm_ctx, PARSE_WARN);
}
| REG_TEXTURE
{
$$.regnum = $1; $$.type = BWRITERSPR_TEXTURE;
}
| REG_TEXCRDOUT
{
$$.regnum = $1; $$.type = BWRITERSPR_TEXCRDOUT;
}
| REG_SAMPLER
{
asmparser_message(&asm_ctx, "Line %u: Register s%u is not a valid destination register\n",
asm_ctx.line_no, $1);
set_parse_status(&asm_ctx, PARSE_WARN);
}
| REG_OPOS
{
$$.regnum = BWRITERSRO_POSITION; $$.type = BWRITERSPR_RASTOUT;
}
| REG_OPTS
{
$$.regnum = BWRITERSRO_POINT_SIZE; $$.type = BWRITERSPR_RASTOUT;
}
| REG_OFOG
{
$$.regnum = BWRITERSRO_FOG; $$.type = BWRITERSPR_RASTOUT;
}
| REG_VERTEXCOLOR
{
$$.regnum = $1; $$.type = BWRITERSPR_ATTROUT;
}
| REG_FRAGCOLOR
{
$$.regnum = $1; $$.type = BWRITERSPR_COLOROUT;
}
| REG_FRAGDEPTH
{
$$.regnum = 0; $$.type = BWRITERSPR_DEPTHOUT;
}
| REG_PREDICATE
{
$$.regnum = 0; $$.type = BWRITERSPR_PREDICATE;
}
| REG_VPOS
{
asmparser_message(&asm_ctx, "Line %u: Register vPos is not a valid destination register\n",
asm_ctx.line_no);
set_parse_status(&asm_ctx, PARSE_WARN);
}
| REG_VFACE
{
asmparser_message(&asm_ctx, "Line %u: Register vFace is not a valid destination register\n",
asm_ctx.line_no);
set_parse_status(&asm_ctx, PARSE_WARN);
}
| REG_ADDRESS
{
/* index 0 is hardcoded for the addr register */
$$.regnum = 0; $$.type = BWRITERSPR_ADDR;
}
| REG_LOOP
{
asmparser_message(&asm_ctx, "Line %u: Register aL is not a valid destination register\n",
asm_ctx.line_no);
set_parse_status(&asm_ctx, PARSE_WARN);
}
writemask: '.' wm_components
{
...
...
@@ -421,10 +533,96 @@ sreg_name: REG_TEMP
{
$$.regnum = $1; $$.type = BWRITERSPR_TEMP;
}
| REG_OUTPUT
{
asmparser_message(&asm_ctx, "Line %u: Register o%u is not a valid source register\n",
asm_ctx.line_no, $1);
set_parse_status(&asm_ctx, PARSE_WARN);
}
| REG_INPUT
{
$$.regnum = $1; $$.type = BWRITERSPR_INPUT;
}
| REG_CONSTFLOAT
{
$$.regnum = $1; $$.type = BWRITERSPR_CONST;
}
| REG_CONSTINT
{
$$.regnum = $1; $$.type = BWRITERSPR_CONSTINT;
}
| REG_CONSTBOOL
{
$$.regnum = $1; $$.type = BWRITERSPR_CONSTBOOL;
}
| REG_TEXTURE
{
$$.regnum = $1; $$.type = BWRITERSPR_TEXTURE;
}
| REG_TEXCRDOUT
{
asmparser_message(&asm_ctx, "Line %u: Register oT%u is not a valid source register\n",
asm_ctx.line_no, $1);
set_parse_status(&asm_ctx, PARSE_WARN);
}
| REG_SAMPLER
{
$$.regnum = $1; $$.type = BWRITERSPR_SAMPLER;
}
| REG_OPOS
{
asmparser_message(&asm_ctx, "Line %u: Register oPos is not a valid source register\n",
asm_ctx.line_no);
set_parse_status(&asm_ctx, PARSE_WARN);
}
| REG_OFOG
{
asmparser_message(&asm_ctx, "Line %u: Register oFog is not a valid source register\n",
asm_ctx.line_no);
set_parse_status(&asm_ctx, PARSE_WARN);
}
| REG_VERTEXCOLOR
{
asmparser_message(&asm_ctx, "Line %u: Register oD%u is not a valid source register\n",
asm_ctx.line_no, $1);
set_parse_status(&asm_ctx, PARSE_WARN);
}
| REG_FRAGCOLOR
{
asmparser_message(&asm_ctx, "Line %u: Register oC%u is not a valid source register\n",
asm_ctx.line_no, $1);
set_parse_status(&asm_ctx, PARSE_WARN);
}
| REG_FRAGDEPTH
{
asmparser_message(&asm_ctx, "Line %u: Register oDepth is not a valid source register\n",
asm_ctx.line_no);
set_parse_status(&asm_ctx, PARSE_WARN);
}
| REG_PREDICATE
{
$$.regnum = 0; $$.type = BWRITERSPR_PREDICATE;
}
| REG_VPOS
{
$$.regnum = 0; $$.type = BWRITERSPR_MISCTYPE;
}
| REG_VFACE
{
$$.regnum = 1; $$.type = BWRITERSPR_MISCTYPE;
}
| REG_ADDRESS
{
$$.regnum = 0; $$.type = BWRITERSPR_ADDR;
}
| REG_LOOP
{
$$.regnum = 0; $$.type = BWRITERSPR_LOOP;
}
| REG_LABEL
{
$$.regnum = $1; $$.type = BWRITERSPR_LABEL;
}
%%
...
...
dlls/d3dx9_36/asmutils.c
View file @
5f934aca
...
...
@@ -92,7 +92,23 @@ DWORD d3d9_dstmod(DWORD bwriter_mod) {
DWORD
d3d9_register
(
DWORD
bwriter_register
)
{
if
(
bwriter_register
==
BWRITERSPR_TEMP
)
return
D3DSPR_TEMP
;
if
(
bwriter_register
==
BWRITERSPR_INPUT
)
return
D3DSPR_INPUT
;
if
(
bwriter_register
==
BWRITERSPR_CONST
)
return
D3DSPR_CONST
;
if
(
bwriter_register
==
BWRITERSPR_ADDR
)
return
D3DSPR_ADDR
;
if
(
bwriter_register
==
BWRITERSPR_TEXTURE
)
return
D3DSPR_TEXTURE
;
if
(
bwriter_register
==
BWRITERSPR_RASTOUT
)
return
D3DSPR_RASTOUT
;
if
(
bwriter_register
==
BWRITERSPR_ATTROUT
)
return
D3DSPR_ATTROUT
;
if
(
bwriter_register
==
BWRITERSPR_TEXCRDOUT
)
return
D3DSPR_TEXCRDOUT
;
if
(
bwriter_register
==
BWRITERSPR_OUTPUT
)
return
D3DSPR_OUTPUT
;
if
(
bwriter_register
==
BWRITERSPR_CONSTINT
)
return
D3DSPR_CONSTINT
;
if
(
bwriter_register
==
BWRITERSPR_COLOROUT
)
return
D3DSPR_COLOROUT
;
if
(
bwriter_register
==
BWRITERSPR_DEPTHOUT
)
return
D3DSPR_DEPTHOUT
;
if
(
bwriter_register
==
BWRITERSPR_SAMPLER
)
return
D3DSPR_SAMPLER
;
if
(
bwriter_register
==
BWRITERSPR_CONSTBOOL
)
return
D3DSPR_CONSTBOOL
;
if
(
bwriter_register
==
BWRITERSPR_LOOP
)
return
D3DSPR_LOOP
;
if
(
bwriter_register
==
BWRITERSPR_MISCTYPE
)
return
D3DSPR_MISCTYPE
;
if
(
bwriter_register
==
BWRITERSPR_LABEL
)
return
D3DSPR_LABEL
;
if
(
bwriter_register
==
BWRITERSPR_PREDICATE
)
return
D3DSPR_PREDICATE
;
FIXME
(
"Unexpected BWRITERSPR %u
\n
"
,
bwriter_register
);
return
-
1
;
...
...
@@ -152,8 +168,51 @@ static const char *get_regname(const struct shader_reg *reg, shader_type st) {
switch
(
reg
->
type
)
{
case
BWRITERSPR_TEMP
:
return
wine_dbg_sprintf
(
"r%u"
,
reg
->
regnum
);
case
BWRITERSPR_INPUT
:
return
wine_dbg_sprintf
(
"v%u"
,
reg
->
regnum
);
case
BWRITERSPR_CONST
:
return
wine_dbg_sprintf
(
"c%u"
,
reg
->
regnum
);
/* case BWRITERSPR_ADDR: */
case
BWRITERSPR_TEXTURE
:
if
(
st
==
ST_VERTEX
)
{
return
wine_dbg_sprintf
(
"a%u"
,
reg
->
regnum
);
}
else
{
return
wine_dbg_sprintf
(
"t%u"
,
reg
->
regnum
);
}
case
BWRITERSPR_RASTOUT
:
switch
(
reg
->
regnum
)
{
case
BWRITERSRO_POSITION
:
return
"oPos"
;
case
BWRITERSRO_FOG
:
return
"oFog"
;
case
BWRITERSRO_POINT_SIZE
:
return
"oPts"
;
default:
return
"Unexpected RASTOUT"
;
}
case
BWRITERSPR_ATTROUT
:
return
wine_dbg_sprintf
(
"oD%u"
,
reg
->
regnum
);
/* case BWRITERSPR_TEXCRDOUT: */
case
BWRITERSPR_OUTPUT
:
return
wine_dbg_sprintf
(
"o[T]%u"
,
reg
->
regnum
);
case
BWRITERSPR_CONSTINT
:
return
wine_dbg_sprintf
(
"i%u"
,
reg
->
regnum
);
case
BWRITERSPR_COLOROUT
:
return
wine_dbg_sprintf
(
"oC%u"
,
reg
->
regnum
);
case
BWRITERSPR_DEPTHOUT
:
return
"oDepth"
;
case
BWRITERSPR_SAMPLER
:
return
wine_dbg_sprintf
(
"s%u"
,
reg
->
regnum
);
case
BWRITERSPR_CONSTBOOL
:
return
wine_dbg_sprintf
(
"b%u"
,
reg
->
regnum
);
case
BWRITERSPR_LOOP
:
return
"aL"
;
case
BWRITERSPR_MISCTYPE
:
switch
(
reg
->
regnum
)
{
case
0
:
return
"vPos"
;
case
1
:
return
"vFace"
;
case
2
:
return
"unexpected misctype"
;
}
case
BWRITERSPR_LABEL
:
return
wine_dbg_sprintf
(
"l%u"
,
reg
->
regnum
);
case
BWRITERSPR_PREDICATE
:
return
wine_dbg_sprintf
(
"p%u"
,
reg
->
regnum
);
default:
return
"unknown regname"
;
}
}
...
...
dlls/d3dx9_36/d3dx9_36_private.h
View file @
5f934aca
...
...
@@ -370,10 +370,33 @@ typedef enum _BWRITERSHADER_INSTRUCTION_OPCODE_TYPE {
}
BWRITERSHADER_INSTRUCTION_OPCODE_TYPE
;
typedef
enum
_BWRITERSHADER_PARAM_REGISTER_TYPE
{
BWRITERSPR_TEMP
=
0
,
BWRITERSPR_CONST
=
2
,
BWRITERSPR_TEMP
,
BWRITERSPR_INPUT
,
BWRITERSPR_CONST
,
BWRITERSPR_ADDR
,
BWRITERSPR_TEXTURE
,
BWRITERSPR_RASTOUT
,
BWRITERSPR_ATTROUT
,
BWRITERSPR_TEXCRDOUT
,
BWRITERSPR_OUTPUT
,
BWRITERSPR_CONSTINT
,
BWRITERSPR_COLOROUT
,
BWRITERSPR_DEPTHOUT
,
BWRITERSPR_SAMPLER
,
BWRITERSPR_CONSTBOOL
,
BWRITERSPR_LOOP
,
BWRITERSPR_MISCTYPE
,
BWRITERSPR_LABEL
,
BWRITERSPR_PREDICATE
}
BWRITERSHADER_PARAM_REGISTER_TYPE
;
typedef
enum
_BWRITERVS_RASTOUT_OFFSETS
{
BWRITERSRO_POSITION
,
BWRITERSRO_FOG
,
BWRITERSRO_POINT_SIZE
}
BWRITERVS_RASTOUT_OFFSETS
;
#define BWRITERSP_WRITEMASK_0 0x1
/* .x r */
#define BWRITERSP_WRITEMASK_1 0x2
/* .y g */
#define BWRITERSP_WRITEMASK_2 0x4
/* .z b */
...
...
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