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
e3c8e650
Commit
e3c8e650
authored
Apr 15, 2006
by
Ivan Gyurdiev
Committed by
Alexandre Julliard
Apr 18, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Use correct register number mask.
The regmask currently being used is wrong - 0x1FFF includes the high two bits of the register type.
parent
e0a1442f
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
31 deletions
+30
-31
pixelshader.c
dlls/wined3d/pixelshader.c
+20
-22
vertexshader.c
dlls/wined3d/vertexshader.c
+10
-9
No files found.
dlls/wined3d/pixelshader.c
View file @
e3c8e650
...
...
@@ -40,8 +40,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d_shader);
/* The maximum size of the program */
#define PGMSIZE 65535
#define REGMASK 0x00001FFF
#define GLNAME_REQUIRE_GLSL ((const char *)1)
/* *******************************************
IWineD3DPixelShader IUnknown parts follow
...
...
@@ -776,7 +774,7 @@ inline static BOOL pshader_is_comment_token(DWORD token) {
inline
static
void
get_register_name
(
const
DWORD
param
,
char
*
regstr
,
char
constants
[
WINED3D_PSHADER_MAX_CONSTANTS
])
{
static
const
char
*
rastout_reg_names
[]
=
{
"oC0"
,
"oC1"
,
"oC2"
,
"oC3"
,
"oDepth"
};
DWORD
reg
=
param
&
REG
MASK
;
DWORD
reg
=
param
&
D3DSP_REGNUM_
MASK
;
DWORD
regtype
=
((
param
&
D3DSP_REGTYPE_MASK
)
>>
D3DSP_REGTYPE_SHIFT
);
switch
(
regtype
)
{
...
...
@@ -1109,7 +1107,7 @@ inline static VOID IWineD3DPixelShaderImpl_GenerateProgramArbHW(IWineD3DPixelSha
/* Handle definitions here, they don't fit well with the
* other instructions below [for now ] */
DWORD
reg
=
*
pToken
&
REG
MASK
;
DWORD
reg
=
*
pToken
&
D3DSP_REGNUM_
MASK
;
TRACE
(
"Found opcode D3D:%s GL:%s, PARAMS:%d,
\n
"
,
curOpcode
->
name
,
curOpcode
->
glname
,
curOpcode
->
num_params
);
...
...
@@ -1173,13 +1171,13 @@ inline static VOID IWineD3DPixelShaderImpl_GenerateProgramArbHW(IWineD3DPixelSha
char
tmp
[
20
];
get_write_mask
(
*
pToken
,
tmp
);
if
(
version
!=
14
)
{
DWORD
reg
=
*
pToken
&
REG
MASK
;
DWORD
reg
=
*
pToken
&
D3DSP_REGNUM_
MASK
;
sprintf
(
tmpLine
,
"TEX T%lu%s, T%lu, texture[%lu], 2D;
\n
"
,
reg
,
tmp
,
reg
,
reg
);
addline
(
&
lineNum
,
pgmStr
,
&
pgmLength
,
tmpLine
);
++
pToken
;
}
else
{
char
reg2
[
20
];
DWORD
reg1
=
*
pToken
&
REG
MASK
;
DWORD
reg1
=
*
pToken
&
D3DSP_REGNUM_
MASK
;
if
(
gen_input_modifier_line
(
*++
pToken
,
0
,
reg2
,
tmpLine
,
This
->
constants
))
{
addline
(
&
lineNum
,
pgmStr
,
&
pgmLength
,
tmpLine
);
}
...
...
@@ -1195,13 +1193,13 @@ inline static VOID IWineD3DPixelShaderImpl_GenerateProgramArbHW(IWineD3DPixelSha
char
tmp
[
20
];
get_write_mask
(
*
pToken
,
tmp
);
if
(
version
!=
14
)
{
DWORD
reg
=
*
pToken
&
REG
MASK
;
DWORD
reg
=
*
pToken
&
D3DSP_REGNUM_
MASK
;
sprintf
(
tmpLine
,
"MOV T%lu%s, fragment.texcoord[%lu];
\n
"
,
reg
,
tmp
,
reg
);
addline
(
&
lineNum
,
pgmStr
,
&
pgmLength
,
tmpLine
);
++
pToken
;
}
else
{
DWORD
reg1
=
*
pToken
&
REG
MASK
;
DWORD
reg2
=
*++
pToken
&
REG
MASK
;
DWORD
reg1
=
*
pToken
&
D3DSP_REGNUM_
MASK
;
DWORD
reg2
=
*++
pToken
&
D3DSP_REGNUM_
MASK
;
sprintf
(
tmpLine
,
"MOV R%lu%s, fragment.texcoord[%lu];
\n
"
,
reg1
,
tmp
,
reg2
);
addline
(
&
lineNum
,
pgmStr
,
&
pgmLength
,
tmpLine
);
++
pToken
;
...
...
@@ -1211,7 +1209,7 @@ inline static VOID IWineD3DPixelShaderImpl_GenerateProgramArbHW(IWineD3DPixelSha
break
;
case
D3DSIO_TEXM3x2PAD
:
{
DWORD
reg
=
*
pToken
&
REG
MASK
;
DWORD
reg
=
*
pToken
&
D3DSP_REGNUM_
MASK
;
char
buf
[
50
];
if
(
gen_input_modifier_line
(
*++
pToken
,
0
,
buf
,
tmpLine
,
This
->
constants
))
{
addline
(
&
lineNum
,
pgmStr
,
&
pgmLength
,
tmpLine
);
...
...
@@ -1224,7 +1222,7 @@ inline static VOID IWineD3DPixelShaderImpl_GenerateProgramArbHW(IWineD3DPixelSha
break
;
case
D3DSIO_TEXM3x2TEX
:
{
DWORD
reg
=
*
pToken
&
REG
MASK
;
DWORD
reg
=
*
pToken
&
D3DSP_REGNUM_
MASK
;
char
buf
[
50
];
if
(
gen_input_modifier_line
(
*++
pToken
,
0
,
buf
,
tmpLine
,
This
->
constants
))
{
addline
(
&
lineNum
,
pgmStr
,
&
pgmLength
,
tmpLine
);
...
...
@@ -1239,8 +1237,8 @@ inline static VOID IWineD3DPixelShaderImpl_GenerateProgramArbHW(IWineD3DPixelSha
break
;
case
D3DSIO_TEXREG2AR
:
{
DWORD
reg1
=
*
pToken
&
REG
MASK
;
DWORD
reg2
=
*++
pToken
&
REG
MASK
;
DWORD
reg1
=
*
pToken
&
D3DSP_REGNUM_
MASK
;
DWORD
reg2
=
*++
pToken
&
D3DSP_REGNUM_
MASK
;
sprintf
(
tmpLine
,
"MOV TMP.r, T%lu.a;
\n
"
,
reg2
);
addline
(
&
lineNum
,
pgmStr
,
&
pgmLength
,
tmpLine
);
sprintf
(
tmpLine
,
"MOV TMP.g, T%lu.r;
\n
"
,
reg2
);
...
...
@@ -1253,8 +1251,8 @@ inline static VOID IWineD3DPixelShaderImpl_GenerateProgramArbHW(IWineD3DPixelSha
break
;
case
D3DSIO_TEXREG2GB
:
{
DWORD
reg1
=
*
pToken
&
REG
MASK
;
DWORD
reg2
=
*++
pToken
&
REG
MASK
;
DWORD
reg1
=
*
pToken
&
D3DSP_REGNUM_
MASK
;
DWORD
reg2
=
*++
pToken
&
D3DSP_REGNUM_
MASK
;
sprintf
(
tmpLine
,
"MOV TMP.r, T%lu.g;
\n
"
,
reg2
);
addline
(
&
lineNum
,
pgmStr
,
&
pgmLength
,
tmpLine
);
sprintf
(
tmpLine
,
"MOV TMP.g, T%lu.b;
\n
"
,
reg2
);
...
...
@@ -1267,8 +1265,8 @@ inline static VOID IWineD3DPixelShaderImpl_GenerateProgramArbHW(IWineD3DPixelSha
break
;
case
D3DSIO_TEXBEM
:
{
DWORD
reg1
=
*
pToken
&
REG
MASK
;
DWORD
reg2
=
*++
pToken
&
REG
MASK
;
DWORD
reg1
=
*
pToken
&
D3DSP_REGNUM_
MASK
;
DWORD
reg2
=
*++
pToken
&
D3DSP_REGNUM_
MASK
;
/* FIXME: Should apply the BUMPMAPENV matrix */
sprintf
(
tmpLine
,
"ADD TMP.rg, fragment.texcoord[%lu], T%lu;
\n
"
,
reg1
,
reg2
);
...
...
@@ -1281,7 +1279,7 @@ inline static VOID IWineD3DPixelShaderImpl_GenerateProgramArbHW(IWineD3DPixelSha
break
;
case
D3DSIO_TEXM3x3PAD
:
{
DWORD
reg
=
*
pToken
&
REG
MASK
;
DWORD
reg
=
*
pToken
&
D3DSP_REGNUM_
MASK
;
char
buf
[
50
];
if
(
gen_input_modifier_line
(
*++
pToken
,
0
,
buf
,
tmpLine
,
This
->
constants
))
{
addline
(
&
lineNum
,
pgmStr
,
&
pgmLength
,
tmpLine
);
...
...
@@ -1295,7 +1293,7 @@ inline static VOID IWineD3DPixelShaderImpl_GenerateProgramArbHW(IWineD3DPixelSha
break
;
case
D3DSIO_TEXM3x3TEX
:
{
DWORD
reg
=
*
pToken
&
REG
MASK
;
DWORD
reg
=
*
pToken
&
D3DSP_REGNUM_
MASK
;
char
buf
[
50
];
if
(
gen_input_modifier_line
(
*++
pToken
,
0
,
buf
,
tmpLine
,
This
->
constants
))
{
addline
(
&
lineNum
,
pgmStr
,
&
pgmLength
,
tmpLine
);
...
...
@@ -1313,7 +1311,7 @@ inline static VOID IWineD3DPixelShaderImpl_GenerateProgramArbHW(IWineD3DPixelSha
}
case
D3DSIO_TEXM3x3VSPEC
:
{
DWORD
reg
=
*
pToken
&
REG
MASK
;
DWORD
reg
=
*
pToken
&
D3DSP_REGNUM_
MASK
;
char
buf
[
50
];
if
(
gen_input_modifier_line
(
*++
pToken
,
0
,
buf
,
tmpLine
,
This
->
constants
))
{
addline
(
&
lineNum
,
pgmStr
,
&
pgmLength
,
tmpLine
);
...
...
@@ -1347,8 +1345,8 @@ inline static VOID IWineD3DPixelShaderImpl_GenerateProgramArbHW(IWineD3DPixelSha
break
;
case
D3DSIO_TEXM3x3SPEC
:
{
DWORD
reg
=
*
pToken
&
REG
MASK
;
DWORD
reg3
=
*
(
pToken
+
2
)
&
REG
MASK
;
DWORD
reg
=
*
pToken
&
D3DSP_REGNUM_
MASK
;
DWORD
reg3
=
*
(
pToken
+
2
)
&
D3DSP_REGNUM_
MASK
;
char
buf
[
50
];
if
(
gen_input_modifier_line
(
*
(
pToken
+
1
),
0
,
buf
,
tmpLine
,
This
->
constants
))
{
addline
(
&
lineNum
,
pgmStr
,
&
pgmLength
,
tmpLine
);
...
...
dlls/wined3d/vertexshader.c
View file @
e3c8e650
...
...
@@ -711,7 +711,7 @@ inline static void vshader_program_dump_param(const DWORD param, int input) {
static
const
char
*
rastout_reg_names
[]
=
{
"oPos"
,
"oFog"
,
"oPts"
};
static
const
char
swizzle_reg_chars
[]
=
"xyzw"
;
DWORD
reg
=
param
&
0x00001FFF
;
DWORD
reg
=
param
&
D3DSP_REGNUM_MASK
;
DWORD
regtype
=
((
param
&
D3DSP_REGTYPE_MASK
)
>>
D3DSP_REGTYPE_SHIFT
);
if
((
param
&
D3DSP_SRCMOD_MASK
)
==
D3DSPSM_NEG
)
TRACE
(
"-"
);
...
...
@@ -787,7 +787,7 @@ inline static void vshader_program_dump_vs_param(const DWORD param, int input) {
/* for registeres about 7 we have to add on bits 11 and 12 to get the correct register */
#define EXTENDED_REG 0x1800
DWORD
reg
=
param
&
D3DSP_REGNUM_MASK
;
/* 0x00001FFF; isn't this D3DSP_REGNUM_MASK? */
DWORD
reg
=
param
&
D3DSP_REGNUM_MASK
;
DWORD
regtype
=
((
param
&
D3DSP_REGTYPE_MASK
)
>>
D3DSP_REGTYPE_SHIFT
)
|
((
param
&
EXTENDED_REG
)
>>
8
);
if
(
param
&
UNKNOWN_MASK
)
{
/* if this register has any of the unknown bits set then report them*/
...
...
@@ -997,7 +997,7 @@ inline static void vshader_program_add_param(IWineD3DVertexShaderImpl *This, con
/* oPos, oFog and oPts in D3D */
static
const
char
*
hwrastout_reg_names
[]
=
{
"result.position"
,
"result.fogcoord"
,
"result.pointsize"
};
DWORD
reg
=
param
&
0x00001FFF
;
DWORD
reg
=
param
&
D3DSP_REGNUM_MASK
;
DWORD
regtype
=
((
param
&
D3DSP_REGTYPE_MASK
)
>>
D3DSP_REGTYPE_SHIFT
);
char
tmpReg
[
255
];
BOOL
is_color
=
FALSE
;
...
...
@@ -1323,7 +1323,7 @@ inline static VOID IWineD3DVertexShaderImpl_GenerateProgramArbHW(IWineD3DVertexS
}
else
{
if
(
curOpcode
->
opcode
==
D3DSIO_DCL
){
INT
usage
=
*
pToken
++
;
INT
arrayNo
=
(
*
pToken
++
&
0x00001FFF
);
INT
arrayNo
=
(
*
pToken
++
&
D3DSP_REGNUM_MASK
);
parse_decl_usage
(
This
,
usage
,
arrayNo
);
}
else
if
(
curOpcode
->
opcode
==
D3DSIO_DEF
)
{
This
->
constantsUsedBitmap
[
*
pToken
&
0xFF
]
=
VS_CONSTANT_CONSTANT
;
...
...
@@ -1338,7 +1338,7 @@ inline static VOID IWineD3DVertexShaderImpl_GenerateProgramArbHW(IWineD3DVertexS
/* Check to see if and tmp or addressing redisters are used */
if
(
curOpcode
->
num_params
>
0
)
{
regtype
=
((((
*
pToken
)
&
D3DSP_REGTYPE_MASK
)
>>
D3DSP_REGTYPE_SHIFT
));
reg
=
((
*
pToken
)
&
0x00001FFF
);
reg
=
((
*
pToken
)
&
D3DSP_REGNUM_MASK
);
if
(
D3DSPR_ADDR
==
regtype
&&
nUseAddressRegister
<=
reg
)
nUseAddressRegister
=
reg
+
1
;
if
(
D3DSPR_TEMP
==
regtype
){
tmpsUsed
[
reg
]
=
TRUE
;
...
...
@@ -1347,7 +1347,7 @@ inline static VOID IWineD3DVertexShaderImpl_GenerateProgramArbHW(IWineD3DVertexS
++
pToken
;
for
(
i
=
1
;
i
<
curOpcode
->
num_params
;
++
i
)
{
regtype
=
((((
*
pToken
)
&
D3DSP_REGTYPE_MASK
)
>>
D3DSP_REGTYPE_SHIFT
));
reg
=
((
*
pToken
)
&
0x00001FFF
);
reg
=
((
*
pToken
)
&
D3DSP_REGNUM_MASK
);
if
(
D3DSPR_ADDR
==
regtype
&&
nUseAddressRegister
<=
reg
)
nUseAddressRegister
=
reg
+
1
;
if
(
D3DSPR_TEMP
==
regtype
){
tmpsUsed
[
reg
]
=
TRUE
;
...
...
@@ -1626,11 +1626,12 @@ inline static VOID IWineD3DVertexShaderImpl_GenerateProgramArbHW(IWineD3DVertexS
case
D3DSIO_MOV
:
/* Address registers must be loaded with the ARL instruction */
if
((((
*
pToken
)
&
D3DSP_REGTYPE_MASK
)
>>
D3DSP_REGTYPE_SHIFT
)
==
D3DSPR_ADDR
)
{
if
(((
*
pToken
)
&
0x00001FFF
)
<
nUseAddressRegister
)
{
if
(((
*
pToken
)
&
D3DSP_REGNUM_MASK
)
<
nUseAddressRegister
)
{
strcpy
(
tmpLine
,
"ARL"
);
break
;
}
else
FIXME
(
"(%p) Try to load A%ld an undeclared address register!
\n
"
,
This
,
((
*
pToken
)
&
0x00001FFF
));
FIXME
(
"(%p) Try to load A%ld an undeclared address register!
\n
"
,
This
,
((
*
pToken
)
&
D3DSP_REGNUM_MASK
));
}
/* fall through */
case
D3DSIO_ADD
:
...
...
@@ -1818,7 +1819,7 @@ HRESULT WINAPI IWineD3DVertexShaderImpl_ExecuteSW(IWineD3DVertexShader* iface, W
if
(
curOpcode
->
num_params
>
0
)
{
/* TRACE(">> execting opcode: pos=%d opcode_name=%s token=%08lX\n", pToken - vshader->function, curOpcode->name, *pToken); */
for
(
i
=
0
;
i
<
curOpcode
->
num_params
;
++
i
)
{
DWORD
reg
=
pToken
[
i
]
&
0x00001FFF
;
DWORD
reg
=
pToken
[
i
]
&
D3DSP_REGNUM_MASK
;
DWORD
regtype
=
((
pToken
[
i
]
&
D3DSP_REGTYPE_MASK
)
>>
D3DSP_REGTYPE_SHIFT
);
switch
(
regtype
<<
D3DSP_REGTYPE_SHIFT
)
{
...
...
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