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
5e473cb1
Commit
5e473cb1
authored
15 years ago
by
Henri Verbeet
Committed by
Alexandre Julliard
15 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Group register information into struct wined3d_shader_register.
parent
0bc112cf
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
61 additions
and
58 deletions
+61
-58
arb_program_shader.c
dlls/wined3d/arb_program_shader.c
+0
-0
baseshader.c
dlls/wined3d/baseshader.c
+29
-29
glsl_shader.c
dlls/wined3d/glsl_shader.c
+0
-0
shader_sm1.c
dlls/wined3d/shader_sm1.c
+6
-6
shader_sm4.c
dlls/wined3d/shader_sm4.c
+12
-12
vertexshader.c
dlls/wined3d/vertexshader.c
+3
-3
wined3d_private.h
dlls/wined3d/wined3d_private.h
+11
-8
No files found.
dlls/wined3d/arb_program_shader.c
View file @
5e473cb1
This diff is collapsed.
Click to expand it.
dlls/wined3d/baseshader.c
View file @
5e473cb1
...
...
@@ -366,30 +366,30 @@ HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, const struct wined3
fe
->
shader_read_semantic
(
&
pToken
,
&
semantic
);
switch
(
semantic
.
reg
.
reg
ister_
type
)
switch
(
semantic
.
reg
.
reg
.
type
)
{
/* Vshader: mark attributes used
* Pshader: mark 3.0 input registers used, save token */
case
WINED3DSPR_INPUT
:
if
(
!
pshader
)
reg_maps
->
attributes
[
semantic
.
reg
.
reg
ister_
idx
]
=
1
;
else
reg_maps
->
packed_input
[
semantic
.
reg
.
reg
ister_
idx
]
=
1
;
semantics_in
[
semantic
.
reg
.
reg
ister_
idx
]
=
semantic
;
if
(
!
pshader
)
reg_maps
->
attributes
[
semantic
.
reg
.
reg
.
idx
]
=
1
;
else
reg_maps
->
packed_input
[
semantic
.
reg
.
reg
.
idx
]
=
1
;
semantics_in
[
semantic
.
reg
.
reg
.
idx
]
=
semantic
;
break
;
/* Vshader: mark 3.0 output registers used, save token */
case
WINED3DSPR_OUTPUT
:
reg_maps
->
packed_output
[
semantic
.
reg
.
reg
ister_
idx
]
=
1
;
semantics_out
[
semantic
.
reg
.
reg
ister_
idx
]
=
semantic
;
reg_maps
->
packed_output
[
semantic
.
reg
.
reg
.
idx
]
=
1
;
semantics_out
[
semantic
.
reg
.
reg
.
idx
]
=
semantic
;
if
(
semantic
.
usage
==
WINED3DDECLUSAGE_FOG
)
reg_maps
->
fog
=
1
;
break
;
/* Save sampler usage token */
case
WINED3DSPR_SAMPLER
:
reg_maps
->
sampler_type
[
semantic
.
reg
.
reg
ister_
idx
]
=
semantic
.
sampler_type
;
reg_maps
->
sampler_type
[
semantic
.
reg
.
reg
.
idx
]
=
semantic
.
sampler_type
;
break
;
default:
TRACE
(
"Not recording DCL register type %#x.
\n
"
,
semantic
.
reg
.
reg
ister_
type
);
TRACE
(
"Not recording DCL register type %#x.
\n
"
,
semantic
.
reg
.
reg
.
type
);
break
;
}
}
...
...
@@ -402,7 +402,7 @@ HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, const struct wined3
if
(
!
lconst
)
return
E_OUTOFMEMORY
;
fe
->
shader_read_dst_param
(
fe_data
,
&
pToken
,
&
dst
,
&
rel_addr
);
lconst
->
idx
=
dst
.
reg
ister_
idx
;
lconst
->
idx
=
dst
.
reg
.
idx
;
memcpy
(
lconst
->
value
,
pToken
,
4
*
sizeof
(
DWORD
));
pToken
+=
4
;
...
...
@@ -432,7 +432,7 @@ HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, const struct wined3
if
(
!
lconst
)
return
E_OUTOFMEMORY
;
fe
->
shader_read_dst_param
(
fe_data
,
&
pToken
,
&
dst
,
&
rel_addr
);
lconst
->
idx
=
dst
.
reg
ister_
idx
;
lconst
->
idx
=
dst
.
reg
.
idx
;
memcpy
(
lconst
->
value
,
pToken
,
4
*
sizeof
(
DWORD
));
pToken
+=
4
;
...
...
@@ -448,7 +448,7 @@ HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, const struct wined3
if
(
!
lconst
)
return
E_OUTOFMEMORY
;
fe
->
shader_read_dst_param
(
fe_data
,
&
pToken
,
&
dst
,
&
rel_addr
);
lconst
->
idx
=
dst
.
reg
ister_
idx
;
lconst
->
idx
=
dst
.
reg
.
idx
;
memcpy
(
lconst
->
value
,
pToken
,
sizeof
(
DWORD
));
++
pToken
;
...
...
@@ -466,12 +466,12 @@ HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, const struct wined3
/* Rep and Loop always use an integer constant for the control parameters */
if
(
ins
.
handler_idx
==
WINED3DSIH_REP
)
{
reg_maps
->
integer_constants
|=
1
<<
src
.
reg
ister_
idx
;
reg_maps
->
integer_constants
|=
1
<<
src
.
reg
.
idx
;
}
else
{
fe
->
shader_read_src_param
(
fe_data
,
&
pToken
,
&
src
,
&
rel_addr
);
reg_maps
->
integer_constants
|=
1
<<
src
.
reg
ister_
idx
;
reg_maps
->
integer_constants
|=
1
<<
src
.
reg
.
idx
;
}
cur_loop_depth
++
;
...
...
@@ -489,7 +489,7 @@ HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, const struct wined3
struct
wined3d_shader_src_param
src
,
rel_addr
;
fe
->
shader_read_src_param
(
fe_data
,
&
pToken
,
&
src
,
&
rel_addr
);
reg_maps
->
labels
[
src
.
reg
ister_
idx
]
=
1
;
reg_maps
->
labels
[
src
.
reg
.
idx
]
=
1
;
}
/* Set texture, address, temporary registers */
else
...
...
@@ -513,14 +513,14 @@ HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, const struct wined3
/* WINED3DSPR_TEXCRDOUT is the same as WINED3DSPR_OUTPUT. _OUTPUT can be > MAX_REG_TEXCRD and
* is used in >= 3.0 shaders. Filter 3.0 shaders to prevent overflows, and also filter pixel
* shaders because TECRDOUT isn't used in them, but future register types might cause issues */
if
(
!
pshader
&&
shader_version
.
major
<
3
&&
dst_param
.
reg
ister_
type
==
WINED3DSPR_TEXCRDOUT
)
if
(
!
pshader
&&
shader_version
.
major
<
3
&&
dst_param
.
reg
.
type
==
WINED3DSPR_TEXCRDOUT
)
{
reg_maps
->
texcoord_mask
[
dst_param
.
reg
ister_
type
]
|=
dst_param
.
write_mask
;
reg_maps
->
texcoord_mask
[
dst_param
.
reg
.
type
]
|=
dst_param
.
write_mask
;
}
else
{
shader_record_register_usage
(
This
,
reg_maps
,
dst_param
.
reg
ister_
type
,
dst_param
.
reg
ister_idx
,
!!
dst_param
.
rel_addr
,
pshader
);
shader_record_register_usage
(
This
,
reg_maps
,
dst_param
.
reg
.
type
,
dst_param
.
reg
.
idx
,
!!
dst_param
.
reg
.
rel_addr
,
pshader
);
}
/* Declare 1.X samplers implicitly, based on the destination reg. number */
...
...
@@ -539,7 +539,7 @@ HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, const struct wined3
||
ins
.
handler_idx
==
WINED3DSIH_TEXREG2RGB
))
{
/* Fake sampler usage, only set reserved bit and ttype */
DWORD
sampler_code
=
dst_param
.
reg
ister_
idx
;
DWORD
sampler_code
=
dst_param
.
reg
.
idx
;
TRACE
(
"Setting fake 2D sampler for 1.x pixelshader
\n
"
);
reg_maps
->
sampler_type
[
sampler_code
]
=
WINED3DSTT_2D
;
...
...
@@ -557,7 +557,7 @@ HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, const struct wined3
}
else
if
(
pshader
&&
ins
.
handler_idx
==
WINED3DSIH_BEM
)
{
reg_maps
->
bumpmat
[
dst_param
.
reg
ister_
idx
]
=
TRUE
;
reg_maps
->
bumpmat
[
dst_param
.
reg
.
idx
]
=
TRUE
;
}
}
...
...
@@ -580,8 +580,8 @@ HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, const struct wined3
struct
wined3d_shader_src_param
src_param
,
src_rel_addr
;
fe
->
shader_read_src_param
(
fe_data
,
&
pToken
,
&
src_param
,
&
src_rel_addr
);
shader_record_register_usage
(
This
,
reg_maps
,
src_param
.
reg
ister_
type
,
src_param
.
reg
ister_idx
,
!!
src_param
.
rel_addr
,
pshader
);
shader_record_register_usage
(
This
,
reg_maps
,
src_param
.
reg
.
type
,
src_param
.
reg
.
idx
,
!!
src_param
.
reg
.
rel_addr
,
pshader
);
}
}
}
...
...
@@ -597,7 +597,7 @@ static void shader_dump_decl_usage(const struct wined3d_shader_semantic *semanti
{
TRACE
(
"dcl"
);
if
(
semantic
->
reg
.
reg
ister_
type
==
WINED3DSPR_SAMPLER
)
if
(
semantic
->
reg
.
reg
.
type
==
WINED3DSPR_SAMPLER
)
{
switch
(
semantic
->
sampler_type
)
{
...
...
@@ -796,7 +796,7 @@ void shader_dump_dst_param(const struct wined3d_shader_dst_param *param,
{
DWORD
write_mask
=
param
->
write_mask
;
shader_dump_register
(
param
->
reg
ister_type
,
param
->
register_idx
,
0
,
NULL
,
param
->
rel_addr
,
shader_version
);
shader_dump_register
(
param
->
reg
.
type
,
param
->
reg
.
idx
,
0
,
NULL
,
param
->
reg
.
rel_addr
,
shader_version
);
if
(
write_mask
!=
WINED3DSP_WRITEMASK_ALL
)
{
...
...
@@ -830,8 +830,8 @@ void shader_dump_src_param(const struct wined3d_shader_src_param *param,
if
(
src_modifier
==
WINED3DSPSM_ABS
||
src_modifier
==
WINED3DSPSM_ABSNEG
)
TRACE
(
"abs("
);
shader_dump_register
(
param
->
reg
ister_type
,
param
->
register_idx
,
param
->
immconst_type
,
param
->
immconst_data
,
param
->
rel_addr
,
shader_version
);
shader_dump_register
(
param
->
reg
.
type
,
param
->
reg
.
idx
,
param
->
reg
.
immconst_type
,
param
->
reg
.
immconst_data
,
param
->
reg
.
rel_addr
,
shader_version
);
if
(
src_modifier
)
{
...
...
@@ -1055,7 +1055,7 @@ void shader_trace_init(const struct wined3d_shader_frontend *fe, void *fe_data,
fe
->
shader_read_dst_param
(
fe_data
,
&
pToken
,
&
dst
,
&
rel_addr
);
TRACE
(
"def c%u = %f, %f, %f, %f"
,
shader_get_float_offset
(
dst
.
reg
ister_type
,
dst
.
register_
idx
),
TRACE
(
"def c%u = %f, %f, %f, %f"
,
shader_get_float_offset
(
dst
.
reg
.
type
,
dst
.
reg
.
idx
),
*
(
const
float
*
)(
pToken
),
*
(
const
float
*
)(
pToken
+
1
),
*
(
const
float
*
)(
pToken
+
2
),
...
...
@@ -1069,7 +1069,7 @@ void shader_trace_init(const struct wined3d_shader_frontend *fe, void *fe_data,
fe
->
shader_read_dst_param
(
fe_data
,
&
pToken
,
&
dst
,
&
rel_addr
);
TRACE
(
"defi i%u = %d, %d, %d, %d"
,
dst
.
reg
ister_
idx
,
TRACE
(
"defi i%u = %d, %d, %d, %d"
,
dst
.
reg
.
idx
,
*
(
pToken
),
*
(
pToken
+
1
),
*
(
pToken
+
2
),
...
...
@@ -1083,7 +1083,7 @@ void shader_trace_init(const struct wined3d_shader_frontend *fe, void *fe_data,
fe
->
shader_read_dst_param
(
fe_data
,
&
pToken
,
&
dst
,
&
rel_addr
);
TRACE
(
"defb b%u = %s"
,
dst
.
reg
ister_
idx
,
*
pToken
?
"true"
:
"false"
);
TRACE
(
"defb b%u = %s"
,
dst
.
reg
.
idx
,
*
pToken
?
"true"
:
"false"
);
++
pToken
;
}
else
...
...
This diff is collapsed.
Click to expand it.
dlls/wined3d/glsl_shader.c
View file @
5e473cb1
This diff is collapsed.
Click to expand it.
dlls/wined3d/shader_sm1.c
View file @
5e473cb1
...
...
@@ -346,24 +346,24 @@ static int shader_skip_opcode(const struct wined3d_sm1_data *priv,
static
void
shader_parse_src_param
(
DWORD
param
,
const
struct
wined3d_shader_src_param
*
rel_addr
,
struct
wined3d_shader_src_param
*
src
)
{
src
->
reg
ister_
type
=
((
param
&
WINED3DSP_REGTYPE_MASK
)
>>
WINED3DSP_REGTYPE_SHIFT
)
src
->
reg
.
type
=
((
param
&
WINED3DSP_REGTYPE_MASK
)
>>
WINED3DSP_REGTYPE_SHIFT
)
|
((
param
&
WINED3DSP_REGTYPE_MASK2
)
>>
WINED3DSP_REGTYPE_SHIFT2
);
src
->
reg
ister_
idx
=
param
&
WINED3DSP_REGNUM_MASK
;
src
->
reg
.
idx
=
param
&
WINED3DSP_REGNUM_MASK
;
src
->
swizzle
=
(
param
&
WINED3DSP_SWIZZLE_MASK
)
>>
WINED3DSP_SWIZZLE_SHIFT
;
src
->
modifiers
=
(
param
&
WINED3DSP_SRCMOD_MASK
)
>>
WINED3DSP_SRCMOD_SHIFT
;
src
->
rel_addr
=
rel_addr
;
src
->
re
g
.
re
l_addr
=
rel_addr
;
}
static
void
shader_parse_dst_param
(
DWORD
param
,
const
struct
wined3d_shader_src_param
*
rel_addr
,
struct
wined3d_shader_dst_param
*
dst
)
{
dst
->
reg
ister_
type
=
((
param
&
WINED3DSP_REGTYPE_MASK
)
>>
WINED3DSP_REGTYPE_SHIFT
)
dst
->
reg
.
type
=
((
param
&
WINED3DSP_REGTYPE_MASK
)
>>
WINED3DSP_REGTYPE_SHIFT
)
|
((
param
&
WINED3DSP_REGTYPE_MASK2
)
>>
WINED3DSP_REGTYPE_SHIFT2
);
dst
->
reg
ister_
idx
=
param
&
WINED3DSP_REGNUM_MASK
;
dst
->
reg
.
idx
=
param
&
WINED3DSP_REGNUM_MASK
;
dst
->
write_mask
=
(
param
&
WINED3D_SM1_WRITEMASK_MASK
)
>>
WINED3D_SM1_WRITEMASK_SHIFT
;
dst
->
modifiers
=
(
param
&
WINED3DSP_DSTMOD_MASK
)
>>
WINED3DSP_DSTMOD_SHIFT
;
dst
->
shift
=
(
param
&
WINED3DSP_DSTSHIFT_MASK
)
>>
WINED3DSP_DSTSHIFT_SHIFT
;
dst
->
rel_addr
=
rel_addr
;
dst
->
re
g
.
re
l_addr
=
rel_addr
;
}
/* Read the parameters of an unrecognized opcode from the input stream
...
...
This diff is collapsed.
Click to expand it.
dlls/wined3d/shader_sm4.c
View file @
5e473cb1
...
...
@@ -200,11 +200,11 @@ static void shader_sm4_read_src_param(void *data, const DWORD **ptr, struct wine
if
(
register_type
>=
sizeof
(
register_type_table
)
/
sizeof
(
*
register_type_table
))
{
FIXME
(
"Unhandled register type %#x
\n
"
,
register_type
);
src_param
->
reg
ister_
type
=
WINED3DSPR_TEMP
;
src_param
->
reg
.
type
=
WINED3DSPR_TEMP
;
}
else
{
src_param
->
reg
ister_
type
=
register_type_table
[
register_type
];
src_param
->
reg
.
type
=
register_type_table
[
register_type
];
}
if
(
register_type
==
WINED3D_SM4_RT_IMMCONST
)
...
...
@@ -216,14 +216,14 @@ static void shader_sm4_read_src_param(void *data, const DWORD **ptr, struct wine
switch
(
immconst_type
)
{
case
WINED3D_SM4_IMMCONST_FLOAT
:
src_param
->
immconst_type
=
WINED3D_IMMCONST_FLOAT
;
memcpy
(
src_param
->
immconst_data
,
*
ptr
,
1
*
sizeof
(
DWORD
));
src_param
->
reg
.
immconst_type
=
WINED3D_IMMCONST_FLOAT
;
memcpy
(
src_param
->
reg
.
immconst_data
,
*
ptr
,
1
*
sizeof
(
DWORD
));
*
ptr
+=
1
;
break
;
case
WINED3D_SM4_IMMCONST_FLOAT4
:
src_param
->
immconst_type
=
WINED3D_IMMCONST_FLOAT4
;
memcpy
(
src_param
->
immconst_data
,
*
ptr
,
4
*
sizeof
(
DWORD
));
src_param
->
reg
.
immconst_type
=
WINED3D_IMMCONST_FLOAT4
;
memcpy
(
src_param
->
reg
.
immconst_data
,
*
ptr
,
4
*
sizeof
(
DWORD
));
*
ptr
+=
4
;
break
;
...
...
@@ -234,12 +234,12 @@ static void shader_sm4_read_src_param(void *data, const DWORD **ptr, struct wine
}
else
{
src_param
->
reg
ister_
idx
=
*
(
*
ptr
)
++
;
src_param
->
reg
.
idx
=
*
(
*
ptr
)
++
;
src_param
->
swizzle
=
(
token
&
WINED3D_SM4_SWIZZLE_MASK
)
>>
WINED3D_SM4_SWIZZLE_SHIFT
;
}
src_param
->
modifiers
=
0
;
src_param
->
rel_addr
=
NULL
;
src_param
->
re
g
.
re
l_addr
=
NULL
;
}
static
void
shader_sm4_read_dst_param
(
void
*
data
,
const
DWORD
**
ptr
,
struct
wined3d_shader_dst_param
*
dst_param
,
...
...
@@ -253,18 +253,18 @@ static void shader_sm4_read_dst_param(void *data, const DWORD **ptr, struct wine
if
(
register_type
>=
sizeof
(
register_type_table
)
/
sizeof
(
*
register_type_table
))
{
FIXME
(
"Unhandled register type %#x
\n
"
,
register_type
);
dst_param
->
reg
ister_
type
=
WINED3DSPR_TEMP
;
dst_param
->
reg
.
type
=
WINED3DSPR_TEMP
;
}
else
{
dst_param
->
reg
ister_
type
=
register_type_table
[
register_type
];
dst_param
->
reg
.
type
=
register_type_table
[
register_type
];
}
dst_param
->
reg
ister_
idx
=
register_idx
;
dst_param
->
reg
.
idx
=
register_idx
;
dst_param
->
write_mask
=
(
token
&
WINED3D_SM4_WRITEMASK_MASK
)
>>
WINED3D_SM4_WRITEMASK_SHIFT
;
dst_param
->
modifiers
=
0
;
dst_param
->
shift
=
0
;
dst_param
->
rel_addr
=
NULL
;
dst_param
->
re
g
.
re
l_addr
=
NULL
;
}
static
void
shader_sm4_read_semantic
(
const
DWORD
**
ptr
,
struct
wined3d_shader_semantic
*
semantic
)
...
...
This diff is collapsed.
Click to expand it.
dlls/wined3d/vertexshader.c
View file @
5e473cb1
...
...
@@ -113,12 +113,12 @@ static void vshader_set_input(
This
->
semantics_in
[
regnum
].
usage
=
usage
;
This
->
semantics_in
[
regnum
].
usage_idx
=
usage_idx
;
This
->
semantics_in
[
regnum
].
reg
.
reg
ister_
type
=
WINED3DSPR_INPUT
;
This
->
semantics_in
[
regnum
].
reg
.
reg
ister_
idx
=
regnum
;
This
->
semantics_in
[
regnum
].
reg
.
reg
.
type
=
WINED3DSPR_INPUT
;
This
->
semantics_in
[
regnum
].
reg
.
reg
.
idx
=
regnum
;
This
->
semantics_in
[
regnum
].
reg
.
write_mask
=
WINED3DSP_WRITEMASK_ALL
;
This
->
semantics_in
[
regnum
].
reg
.
modifiers
=
0
;
This
->
semantics_in
[
regnum
].
reg
.
shift
=
0
;
This
->
semantics_in
[
regnum
].
reg
.
rel_addr
=
NULL
;
This
->
semantics_in
[
regnum
].
reg
.
re
g
.
re
l_addr
=
NULL
;
}
static
BOOL
match_usage
(
BYTE
usage1
,
BYTE
usage_idx1
,
BYTE
usage2
,
BYTE
usage_idx2
)
{
...
...
This diff is collapsed.
Click to expand it.
dlls/wined3d/wined3d_private.h
View file @
5e473cb1
...
...
@@ -649,25 +649,28 @@ struct wined3d_shader_context
SHADER_BUFFER
*
buffer
;
};
struct
wined3d_shader_register
{
WINED3DSHADER_PARAM_REGISTER_TYPE
type
;
UINT
idx
;
const
struct
wined3d_shader_src_param
*
rel_addr
;
enum
wined3d_immconst_type
immconst_type
;
DWORD
immconst_data
[
4
];
};
struct
wined3d_shader_dst_param
{
WINED3DSHADER_PARAM_REGISTER_TYPE
register_type
;
UINT
register_idx
;
struct
wined3d_shader_register
reg
;
DWORD
write_mask
;
DWORD
modifiers
;
DWORD
shift
;
const
struct
wined3d_shader_src_param
*
rel_addr
;
};
struct
wined3d_shader_src_param
{
WINED3DSHADER_PARAM_REGISTER_TYPE
register_type
;
UINT
register_idx
;
struct
wined3d_shader_register
reg
;
DWORD
swizzle
;
DWORD
modifiers
;
const
struct
wined3d_shader_src_param
*
rel_addr
;
enum
wined3d_immconst_type
immconst_type
;
DWORD
immconst_data
[
4
];
};
struct
wined3d_shader_instruction
...
...
This diff is collapsed.
Click to expand it.
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