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
e832b57a
Commit
e832b57a
authored
Oct 29, 2010
by
Henri Verbeet
Committed by
Alexandre Julliard
Oct 29, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Move loop state to wined3d_shader_context.
parent
8a4a76f9
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
27 deletions
+43
-27
glsl_shader.c
dlls/wined3d/glsl_shader.c
+32
-26
shader.c
dlls/wined3d/shader.c
+4
-0
wined3d_private.h
dlls/wined3d/wined3d_private.h
+7
-1
No files found.
dlls/wined3d/glsl_shader.c
View file @
e832b57a
...
...
@@ -1419,7 +1419,7 @@ static void shader_glsl_get_register_name(const struct wined3d_shader_register *
break
;
case
WINED3DSPR_LOOP
:
sprintf
(
register_name
,
"aL%u"
,
This
->
baseShader
.
cur_loop_regno
-
1
);
sprintf
(
register_name
,
"aL%u"
,
ins
->
ctx
->
loop_state
->
current_reg
-
1
);
break
;
case
WINED3DSPR_SAMPLER
:
...
...
@@ -2822,6 +2822,7 @@ static void shader_glsl_sgn(const struct wined3d_shader_instruction *ins)
/* FIXME: I don't think nested loops will work correctly this way. */
static
void
shader_glsl_loop
(
const
struct
wined3d_shader_instruction
*
ins
)
{
struct
wined3d_shader_loop_state
*
loop_state
=
ins
->
ctx
->
loop_state
;
glsl_src_param_t
src1_param
;
IWineD3DBaseShaderImpl
*
shader
=
(
IWineD3DBaseShaderImpl
*
)
ins
->
ctx
->
shader
;
const
DWORD
*
control_values
=
NULL
;
...
...
@@ -2855,57 +2856,58 @@ static void shader_glsl_loop(const struct wined3d_shader_instruction *ins)
if
(
loop_control
.
step
>
0
)
{
shader_addline
(
ins
->
ctx
->
buffer
,
"for (aL%u = %u; aL%u < (%u * %d + %u); aL%u += %d) {
\n
"
,
shader
->
baseShader
.
cur_loop
_depth
,
loop_control
.
start
,
shader
->
baseShader
.
cur_loop
_depth
,
loop_control
.
count
,
loop_control
.
step
,
loop_control
.
start
,
shader
->
baseShader
.
cur_loop
_depth
,
loop_control
.
step
);
loop_state
->
current
_depth
,
loop_control
.
start
,
loop_state
->
current
_depth
,
loop_control
.
count
,
loop_control
.
step
,
loop_control
.
start
,
loop_state
->
current
_depth
,
loop_control
.
step
);
}
else
if
(
loop_control
.
step
<
0
)
{
shader_addline
(
ins
->
ctx
->
buffer
,
"for (aL%u = %u; aL%u > (%u * %d + %u); aL%u += %d) {
\n
"
,
shader
->
baseShader
.
cur_loop
_depth
,
loop_control
.
start
,
shader
->
baseShader
.
cur_loop
_depth
,
loop_control
.
count
,
loop_control
.
step
,
loop_control
.
start
,
shader
->
baseShader
.
cur_loop
_depth
,
loop_control
.
step
);
loop_state
->
current
_depth
,
loop_control
.
start
,
loop_state
->
current
_depth
,
loop_control
.
count
,
loop_control
.
step
,
loop_control
.
start
,
loop_state
->
current
_depth
,
loop_control
.
step
);
}
else
{
shader_addline
(
ins
->
ctx
->
buffer
,
"for (aL%u = %u, tmpInt%u = 0; tmpInt%u < %u; tmpInt%u++) {
\n
"
,
shader
->
baseShader
.
cur_loop_depth
,
loop_control
.
start
,
shader
->
baseShader
.
cur_loop
_depth
,
shader
->
baseShader
.
cur_loop
_depth
,
loop_control
.
count
,
shader
->
baseShader
.
cur_loop
_depth
);
loop_state
->
current_depth
,
loop_control
.
start
,
loop_state
->
current
_depth
,
loop_state
->
current
_depth
,
loop_control
.
count
,
loop_state
->
current
_depth
);
}
}
else
{
shader_addline
(
ins
->
ctx
->
buffer
,
"for (tmpInt%u = 0, aL%u = %s.y; tmpInt%u < %s.x; tmpInt%u++, aL%u += %s.z) {
\n
"
,
shader
->
baseShader
.
cur_loop_depth
,
shader
->
baseShader
.
cur_loop_regno
,
src1_param
.
reg_name
,
shader
->
baseShader
.
cur_loop
_depth
,
src1_param
.
reg_name
,
shader
->
baseShader
.
cur_loop_depth
,
shader
->
baseShader
.
cur_loop_regno
,
src1_param
.
reg_name
);
loop_state
->
current_depth
,
loop_state
->
current_reg
,
src1_param
.
reg_name
,
loop_state
->
current
_depth
,
src1_param
.
reg_name
,
loop_state
->
current_depth
,
loop_state
->
current_reg
,
src1_param
.
reg_name
);
}
shader
->
baseShader
.
cur_loop_depth
++
;
shader
->
baseShader
.
cur_loop_regno
++
;
++
loop_state
->
current_depth
;
++
loop_state
->
current_reg
;
}
static
void
shader_glsl_end
(
const
struct
wined3d_shader_instruction
*
ins
)
{
IWineD3DBaseShaderImpl
*
shader
=
(
IWineD3DBaseShaderImpl
*
)
ins
->
ctx
->
shader
;
struct
wined3d_shader_loop_state
*
loop_state
=
ins
->
ctx
->
loop_state
;
shader_addline
(
ins
->
ctx
->
buffer
,
"}
\n
"
);
if
(
ins
->
handler_idx
==
WINED3DSIH_ENDLOOP
)
{
shader
->
baseShader
.
cur_loop_depth
--
;
shader
->
baseShader
.
cur_loop_regno
--
;
--
loop_state
->
current_depth
;
--
loop_state
->
current_reg
;
}
if
(
ins
->
handler_idx
==
WINED3DSIH_ENDREP
)
{
shader
->
baseShader
.
cur_loop_depth
--
;
--
loop_state
->
current_depth
;
}
}
static
void
shader_glsl_rep
(
const
struct
wined3d_shader_instruction
*
ins
)
{
IWineD3DBaseShaderImpl
*
shader
=
(
IWineD3DBaseShaderImpl
*
)
ins
->
ctx
->
shader
;
struct
wined3d_shader_loop_state
*
loop_state
=
ins
->
ctx
->
loop_state
;
glsl_src_param_t
src0_param
;
const
DWORD
*
control_values
=
NULL
;
const
local_constant
*
constant
;
...
...
@@ -2923,17 +2925,21 @@ static void shader_glsl_rep(const struct wined3d_shader_instruction *ins)
}
}
if
(
control_values
)
{
if
(
control_values
)
{
shader_addline
(
ins
->
ctx
->
buffer
,
"for (tmpInt%d = 0; tmpInt%d < %d; tmpInt%d++) {
\n
"
,
shader
->
baseShader
.
cur_loop_depth
,
shader
->
baseShader
.
cur_loop_depth
,
control_values
[
0
],
shader
->
baseShader
.
cur_loop_depth
);
}
else
{
loop_state
->
current_depth
,
loop_state
->
current_depth
,
control_values
[
0
],
loop_state
->
current_depth
);
}
else
{
shader_glsl_add_src_param
(
ins
,
&
ins
->
src
[
0
],
WINED3DSP_WRITEMASK_0
,
&
src0_param
);
shader_addline
(
ins
->
ctx
->
buffer
,
"for (tmpInt%d = 0; tmpInt%d < %s; tmpInt%d++) {
\n
"
,
shader
->
baseShader
.
cur_loop_depth
,
shader
->
baseShader
.
cur_loop
_depth
,
src0_param
.
param_str
,
shader
->
baseShader
.
cur_loop
_depth
);
loop_state
->
current_depth
,
loop_state
->
current
_depth
,
src0_param
.
param_str
,
loop_state
->
current
_depth
);
}
shader
->
baseShader
.
cur_loop_depth
++
;
++
loop_state
->
current_depth
;
}
static
void
shader_glsl_if
(
const
struct
wined3d_shader_instruction
*
ins
)
...
...
dlls/wined3d/shader.c
View file @
e832b57a
...
...
@@ -1190,6 +1190,7 @@ void shader_generate_main(IWineD3DBaseShader *iface, struct wined3d_shader_buffe
struct
wined3d_shader_dst_param
dst_param
[
2
];
struct
wined3d_shader_src_param
src_param
[
4
];
struct
wined3d_shader_version
shader_version
;
struct
wined3d_shader_loop_state
loop_state
;
struct
wined3d_shader_instruction
ins
;
struct
wined3d_shader_tex_mx
tex_mx
;
struct
wined3d_shader_context
ctx
;
...
...
@@ -1198,12 +1199,15 @@ void shader_generate_main(IWineD3DBaseShader *iface, struct wined3d_shader_buffe
/* Initialize current parsing state. */
tex_mx
.
current_row
=
0
;
loop_state
.
current_depth
=
0
;
loop_state
.
current_reg
=
0
;
ctx
.
shader
=
iface
;
ctx
.
gl_info
=
&
device
->
adapter
->
gl_info
;
ctx
.
reg_maps
=
reg_maps
;
ctx
.
buffer
=
buffer
;
ctx
.
tex_mx
=
&
tex_mx
;
ctx
.
loop_state
=
&
loop_state
;
ctx
.
backend_data
=
backend_ctx
;
ins
.
ctx
=
&
ctx
;
...
...
dlls/wined3d/wined3d_private.h
View file @
e832b57a
...
...
@@ -573,6 +573,12 @@ struct wined3d_shader_tex_mx
DWORD
texcoord_w
[
2
];
};
struct
wined3d_shader_loop_state
{
UINT
current_depth
;
UINT
current_reg
;
};
struct
wined3d_shader_context
{
IWineD3DBaseShader
*
shader
;
...
...
@@ -580,6 +586,7 @@ struct wined3d_shader_context
const
struct
shader_reg_maps
*
reg_maps
;
struct
wined3d_shader_buffer
*
buffer
;
struct
wined3d_shader_tex_mx
*
tex_mx
;
struct
wined3d_shader_loop_state
*
loop_state
;
void
*
backend_data
;
};
...
...
@@ -2747,7 +2754,6 @@ typedef struct IWineD3DBaseShaderClass
SHADER_LIMITS
limits
;
DWORD
*
function
;
UINT
functionLength
;
UINT
cur_loop_depth
,
cur_loop_regno
;
BOOL
load_local_constsF
;
const
struct
wined3d_shader_frontend
*
frontend
;
void
*
frontend_data
;
...
...
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