d3dx9: Complete output dcl instruction support.

This commit is contained in:
Matteo Bruni 2010-05-13 17:21:58 +02:00 committed by Alexandre Julliard
parent b627d13ea8
commit efec8bb361
4 changed files with 224 additions and 3 deletions

View File

@ -67,6 +67,19 @@ REG_PREDICATE p0
REG_LABEL l[0-9]+
DCL_POSITION _position[0-9]*
DCL_BLENDWEIGHT _blendweight[0-9]*
DCL_BLENDINDICES _blendindices[0-9]*
DCL_NORMAL _normal[0-9]*
DCL_PSIZE _psize[0-9]*
DCL_TEXCOORD _texcoord[0-9]*
DCL_TANGENT _tangent[0-9]*
DCL_BINORMAL _binormal[0-9]*
DCL_TESSFACTOR _tessfactor[0-9]*
DCL_POSITIONT _positiont[0-9]*
DCL_COLOR _color[0-9]*
DCL_FOG _fog[0-9]*
DCL_DEPTH _depth[0-9]*
DCL_SAMPLE _sample[0-9]*
PREPROCESSORDIRECTIVE #[^\n]*\n
@ -282,6 +295,110 @@ ps_3_0 {return VER_PS30; }
}
return USAGE_POSITION;
}
{DCL_BLENDWEIGHT} {
if(yytext[strlen("_blendweight")] == '\0') {
asmshader_lval.regnum = 0;
} else {
asmshader_lval.regnum = atoi(yytext + strlen("_blendweight"));
}
return USAGE_BLENDWEIGHT;
}
{DCL_BLENDINDICES} {
if(yytext[strlen("_blendindices")] == '\0') {
asmshader_lval.regnum = 0;
} else {
asmshader_lval.regnum = atoi(yytext + strlen("_blendindices"));
}
return USAGE_BLENDINDICES;
}
{DCL_NORMAL} {
if(yytext[strlen("_normal")] == '\0') {
asmshader_lval.regnum = 0;
} else {
asmshader_lval.regnum = atoi(yytext + strlen("_normal"));
}
return USAGE_NORMAL;
}
{DCL_PSIZE} {
if(yytext[strlen("_psize")] == '\0') {
asmshader_lval.regnum = 0;
} else {
asmshader_lval.regnum = atoi(yytext + strlen("_psize"));
}
return USAGE_PSIZE;
}
{DCL_TEXCOORD} {
if(yytext[strlen("_texcoord")] == '\0') {
asmshader_lval.regnum = 0;
} else {
asmshader_lval.regnum = atoi(yytext + strlen("_texcoord"));
}
return USAGE_TEXCOORD;
}
{DCL_TANGENT} {
if(yytext[strlen("_tangent")] == '\0') {
asmshader_lval.regnum = 0;
} else {
asmshader_lval.regnum = atoi(yytext + strlen("_tangent"));
}
return USAGE_TANGENT;
}
{DCL_BINORMAL} {
if(yytext[strlen("_binormal")] == '\0') {
asmshader_lval.regnum = 0;
} else {
asmshader_lval.regnum = atoi(yytext + strlen("_binormal"));
}
return USAGE_BINORMAL;
}
{DCL_TESSFACTOR} {
if(yytext[strlen("_tessfactor")] == '\0') {
asmshader_lval.regnum = 0;
} else {
asmshader_lval.regnum = atoi(yytext + strlen("_tessfactor"));
}
return USAGE_TESSFACTOR;
}
{DCL_POSITIONT} {
if(yytext[strlen("_positiont")] == '\0') {
asmshader_lval.regnum = 0;
} else {
asmshader_lval.regnum = atoi(yytext + strlen("_positiont"));
}
return USAGE_POSITIONT;
}
{DCL_COLOR} {
if(yytext[strlen("_color")] == '\0') {
asmshader_lval.regnum = 0;
} else {
asmshader_lval.regnum = atoi(yytext + strlen("_color"));
}
return USAGE_COLOR;
}
{DCL_FOG} {
if(yytext[strlen("_fog")] == '\0') {
asmshader_lval.regnum = 0;
} else {
asmshader_lval.regnum = atoi(yytext + strlen("_fog"));
}
return USAGE_FOG;
}
{DCL_DEPTH} {
if(yytext[strlen("_depth")] == '\0') {
asmshader_lval.regnum = 0;
} else {
asmshader_lval.regnum = atoi(yytext + strlen("_depth"));
}
return USAGE_DEPTH;
}
{DCL_SAMPLE} {
if(yytext[strlen("_sample")] == '\0') {
asmshader_lval.regnum = 0;
} else {
asmshader_lval.regnum = atoi(yytext + strlen("_sample"));
}
return USAGE_SAMPLE;
}
{PREPROCESSORDIRECTIVE} {
/* TODO: update current line information */

View File

@ -200,6 +200,19 @@ void set_rel_reg(struct shader_reg *reg, struct rel_reg *rel) {
/* Usage declaration tokens */
%token <regnum> USAGE_POSITION
%token <regnum> USAGE_BLENDWEIGHT
%token <regnum> USAGE_BLENDINDICES
%token <regnum> USAGE_NORMAL
%token <regnum> USAGE_PSIZE
%token <regnum> USAGE_TEXCOORD
%token <regnum> USAGE_TANGENT
%token <regnum> USAGE_BINORMAL
%token <regnum> USAGE_TESSFACTOR
%token <regnum> USAGE_POSITIONT
%token <regnum> USAGE_COLOR
%token <regnum> USAGE_FOG
%token <regnum> USAGE_DEPTH
%token <regnum> USAGE_SAMPLE
/* Misc stuff */
%token <component> COMPONENT
@ -1080,6 +1093,84 @@ dclusage: USAGE_POSITION
$$.regnum = $1;
$$.dclusage = BWRITERDECLUSAGE_POSITION;
}
| USAGE_BLENDWEIGHT
{
TRACE("dcl_blendweight%u\n", $1);
$$.regnum = $1;
$$.dclusage = BWRITERDECLUSAGE_BLENDWEIGHT;
}
| USAGE_BLENDINDICES
{
TRACE("dcl_blendindices%u\n", $1);
$$.regnum = $1;
$$.dclusage = BWRITERDECLUSAGE_BLENDINDICES;
}
| USAGE_NORMAL
{
TRACE("dcl_normal%u\n", $1);
$$.regnum = $1;
$$.dclusage = BWRITERDECLUSAGE_NORMAL;
}
| USAGE_PSIZE
{
TRACE("dcl_psize%u\n", $1);
$$.regnum = $1;
$$.dclusage = BWRITERDECLUSAGE_PSIZE;
}
| USAGE_TEXCOORD
{
TRACE("dcl_texcoord%u\n", $1);
$$.regnum = $1;
$$.dclusage = BWRITERDECLUSAGE_TEXCOORD;
}
| USAGE_TANGENT
{
TRACE("dcl_tangent%u\n", $1);
$$.regnum = $1;
$$.dclusage = BWRITERDECLUSAGE_TANGENT;
}
| USAGE_BINORMAL
{
TRACE("dcl_binormal%u\n", $1);
$$.regnum = $1;
$$.dclusage = BWRITERDECLUSAGE_BINORMAL;
}
| USAGE_TESSFACTOR
{
TRACE("dcl_tessfactor%u\n", $1);
$$.regnum = $1;
$$.dclusage = BWRITERDECLUSAGE_TESSFACTOR;
}
| USAGE_POSITIONT
{
TRACE("dcl_positiont%u\n", $1);
$$.regnum = $1;
$$.dclusage = BWRITERDECLUSAGE_POSITIONT;
}
| USAGE_COLOR
{
TRACE("dcl_color%u\n", $1);
$$.regnum = $1;
$$.dclusage = BWRITERDECLUSAGE_COLOR;
}
| USAGE_FOG
{
TRACE("dcl_fog%u\n", $1);
$$.regnum = $1;
$$.dclusage = BWRITERDECLUSAGE_FOG;
}
| USAGE_DEPTH
{
TRACE("dcl_depth%u\n", $1);
$$.regnum = $1;
$$.dclusage = BWRITERDECLUSAGE_DEPTH;
}
| USAGE_SAMPLE
{
TRACE("dcl_sample%u\n", $1);
$$.regnum = $1;
$$.dclusage = BWRITERDECLUSAGE_SAMPLE;
}
predicate: '(' REG_PREDICATE swizzle ')'
{

View File

@ -520,6 +520,19 @@ typedef enum _BWRITERSHADER_PARAM_SRCMOD_TYPE {
typedef enum _BWRITERDECLUSAGE {
BWRITERDECLUSAGE_POSITION,
BWRITERDECLUSAGE_BLENDWEIGHT,
BWRITERDECLUSAGE_BLENDINDICES,
BWRITERDECLUSAGE_NORMAL,
BWRITERDECLUSAGE_PSIZE,
BWRITERDECLUSAGE_TEXCOORD,
BWRITERDECLUSAGE_TANGENT,
BWRITERDECLUSAGE_BINORMAL,
BWRITERDECLUSAGE_TESSFACTOR,
BWRITERDECLUSAGE_POSITIONT,
BWRITERDECLUSAGE_COLOR,
BWRITERDECLUSAGE_FOG,
BWRITERDECLUSAGE_DEPTH,
BWRITERDECLUSAGE_SAMPLE
} BWRITERDECLUSAGE;
struct bwriter_shader *SlAssembleShader(const char *text, char **messages);

View File

@ -1028,11 +1028,11 @@ static void vs_3_0_test(void) {
"dcl_position o0\n",
{0xfffe0300, 0x0200001f, 0x80000000, 0xe00f0000, 0x0000ffff}
},
/* {*/ /* shader 3 */
/* "vs_3_0\n"
{ /* shader 3 */
"vs_3_0\n"
"dcl_texcoord12 o11\n",
{0xfffe0300, 0x0200001f, 0x800c0005, 0xe00f000b, 0x0000ffff}
},*/
},
{ /* shader 4 */
"vs_3_0\n"
"texldl r0, v0, s0\n",