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
ffd5e3eb
Commit
ffd5e3eb
authored
Nov 05, 2012
by
Henri Verbeet
Committed by
Alexandre Julliard
Nov 06, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Introduce a separate structure for the vs specific fields in struct glsl_shader_prog_link.
parent
b8bb2a4f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
31 deletions
+39
-31
glsl_shader.c
dlls/wined3d/glsl_shader.c
+39
-31
No files found.
dlls/wined3d/glsl_shader.c
View file @
ffd5e3eb
...
...
@@ -100,24 +100,30 @@ struct shader_glsl_priv {
const
struct
fragment_pipeline
*
fragment_pipe
;
};
struct
glsl_vs_program
{
struct
list
shader_entry
;
GLhandleARB
id
;
GLenum
vertex_color_clamp
;
GLint
*
uniform_f_locations
;
GLint
uniform_i_locations
[
MAX_CONST_I
];
GLint
pos_fixup_location
;
};
/* Struct to maintain data about a linked GLSL program */
struct
glsl_shader_prog_link
{
struct
wine_rb_entry
program_lookup_entry
;
struct
list
vshader_entry
;
struct
glsl_shader_prog_link
{
struct
wine_rb_entry
program_lookup_entry
;
struct
glsl_vs_program
vs
;
struct
list
pshader_entry
;
GLhandleARB
programId
;
GLint
*
vuniformF_locations
;
GLint
*
puniformF_locations
;
GLint
vuniformI_locations
[
MAX_CONST_I
];
GLint
puniformI_locations
[
MAX_CONST_I
];
GLint
posFixup_location
;
GLint
np2Fixup_location
;
GLint
bumpenvmat_location
[
MAX_TEXTURES
];
GLint
luminancescale_location
[
MAX_TEXTURES
];
GLint
luminanceoffset_location
[
MAX_TEXTURES
];
GLint
ycorrection_location
;
GLenum
vertex_color_clamp
;
GLhandleARB
vs_id
;
GLhandleARB
ps_id
;
UINT
constant_version
;
const
struct
ps_np2fixup_info
*
np2Fixup_info
;
...
...
@@ -737,10 +743,10 @@ static void shader_glsl_load_constants(const struct wined3d_context *context,
/* Load DirectX 9 float constants/uniforms for vertex shader */
shader_glsl_load_constantsF
(
vshader
,
gl_info
,
state
->
vs_consts_f
,
prog
->
v
uniformF
_locations
,
&
priv
->
vconst_heap
,
priv
->
stack
,
constant_version
);
prog
->
v
s
.
uniform_f
_locations
,
&
priv
->
vconst_heap
,
priv
->
stack
,
constant_version
);
/* Load DirectX 9 integer constants/uniforms for vertex shader */
shader_glsl_load_constantsI
(
vshader
,
gl_info
,
prog
->
v
uniformI
_locations
,
state
->
vs_consts_i
,
shader_glsl_load_constantsI
(
vshader
,
gl_info
,
prog
->
v
s
.
uniform_i
_locations
,
state
->
vs_consts_i
,
stateBlock
->
changed
.
vertexShaderConstantsI
&
vshader
->
reg_maps
.
integer_constants
);
/* Load DirectX 9 boolean constants/uniforms for vertex shader */
...
...
@@ -749,7 +755,7 @@ static void shader_glsl_load_constants(const struct wined3d_context *context,
/* Upload the position fixup params */
shader_get_position_fixup
(
context
,
state
,
position_fixup
);
GL_EXTCALL
(
glUniform4fvARB
(
prog
->
posF
ixup_location
,
1
,
position_fixup
));
GL_EXTCALL
(
glUniform4fvARB
(
prog
->
vs
.
pos_f
ixup_location
,
1
,
position_fixup
));
checkGLcall
(
"glUniform4fvARB"
);
}
...
...
@@ -4100,7 +4106,7 @@ static void add_glsl_program_entry(struct shader_glsl_priv *priv, struct glsl_sh
{
struct
glsl_program_key
key
;
key
.
vs_id
=
entry
->
vs
_
id
;
key
.
vs_id
=
entry
->
vs
.
id
;
key
.
ps_id
=
entry
->
ps_id
;
if
(
wine_rb_put
(
&
priv
->
program_lookup
,
&
key
,
&
entry
->
program_lookup_entry
)
==
-
1
)
...
...
@@ -4128,16 +4134,16 @@ static void delete_glsl_program_entry(struct shader_glsl_priv *priv, const struc
{
struct
glsl_program_key
key
;
key
.
vs_id
=
entry
->
vs
_
id
;
key
.
vs_id
=
entry
->
vs
.
id
;
key
.
ps_id
=
entry
->
ps_id
;
wine_rb_remove
(
&
priv
->
program_lookup
,
&
key
);
GL_EXTCALL
(
glDeleteObjectARB
(
entry
->
programId
));
if
(
entry
->
vs
_
id
)
list_remove
(
&
entry
->
vshader_entry
);
if
(
entry
->
vs
.
id
)
list_remove
(
&
entry
->
vs
.
s
hader_entry
);
if
(
entry
->
ps_id
)
list_remove
(
&
entry
->
pshader_entry
);
HeapFree
(
GetProcessHeap
(),
0
,
entry
->
v
uniformF
_locations
);
HeapFree
(
GetProcessHeap
(),
0
,
entry
->
v
s
.
uniform_f
_locations
);
HeapFree
(
GetProcessHeap
(),
0
,
entry
->
puniformF_locations
);
HeapFree
(
GetProcessHeap
(),
0
,
entry
);
}
...
...
@@ -4744,7 +4750,7 @@ static void set_glsl_shader_program(const struct wined3d_context *context,
/* Create the entry */
entry
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
struct
glsl_shader_prog_link
));
entry
->
programId
=
programId
;
entry
->
vs
_
id
=
vs_id
;
entry
->
vs
.
id
=
vs_id
;
entry
->
ps_id
=
ps_id
;
entry
->
constant_version
=
0
;
entry
->
np2Fixup_info
=
np2fixup_info
;
...
...
@@ -4791,7 +4797,7 @@ static void set_glsl_shader_program(const struct wined3d_context *context,
}
checkGLcall
(
"glBindAttribLocationARB"
);
list_add_head
(
&
vshader
->
linked_programs
,
&
entry
->
vshader_entry
);
list_add_head
(
&
vshader
->
linked_programs
,
&
entry
->
vs
.
s
hader_entry
);
}
/* Attach GLSL pshader */
...
...
@@ -4809,17 +4815,17 @@ static void set_glsl_shader_program(const struct wined3d_context *context,
GL_EXTCALL
(
glLinkProgramARB
(
programId
));
shader_glsl_validate_link
(
gl_info
,
programId
);
entry
->
v
uniformF
_locations
=
HeapAlloc
(
GetProcessHeap
(),
0
,
entry
->
v
s
.
uniform_f
_locations
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
GLhandleARB
)
*
gl_info
->
limits
.
glsl_vs_float_constants
);
for
(
i
=
0
;
i
<
gl_info
->
limits
.
glsl_vs_float_constants
;
++
i
)
{
snprintf
(
glsl_name
,
sizeof
(
glsl_name
),
"vs_c[%u]"
,
i
);
entry
->
v
uniformF
_locations
[
i
]
=
GL_EXTCALL
(
glGetUniformLocationARB
(
programId
,
glsl_name
));
entry
->
v
s
.
uniform_f
_locations
[
i
]
=
GL_EXTCALL
(
glGetUniformLocationARB
(
programId
,
glsl_name
));
}
for
(
i
=
0
;
i
<
MAX_CONST_I
;
++
i
)
{
snprintf
(
glsl_name
,
sizeof
(
glsl_name
),
"vs_i[%u]"
,
i
);
entry
->
v
uniformI
_locations
[
i
]
=
GL_EXTCALL
(
glGetUniformLocationARB
(
programId
,
glsl_name
));
entry
->
v
s
.
uniform_i
_locations
[
i
]
=
GL_EXTCALL
(
glGetUniformLocationARB
(
programId
,
glsl_name
));
}
entry
->
puniformF_locations
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
GLhandleARB
)
*
gl_info
->
limits
.
glsl_ps_float_constants
);
...
...
@@ -4855,7 +4861,7 @@ static void set_glsl_shader_program(const struct wined3d_context *context,
}
}
entry
->
posF
ixup_location
=
GL_EXTCALL
(
glGetUniformLocationARB
(
programId
,
"posFixup"
));
entry
->
vs
.
pos_f
ixup_location
=
GL_EXTCALL
(
glGetUniformLocationARB
(
programId
,
"posFixup"
));
entry
->
ycorrection_location
=
GL_EXTCALL
(
glGetUniformLocationARB
(
programId
,
"ycorrection"
));
checkGLcall
(
"Find glsl program uniform locations"
);
...
...
@@ -4863,9 +4869,11 @@ static void set_glsl_shader_program(const struct wined3d_context *context,
&&
pshader
->
u
.
ps
.
declared_in_count
>
vec4_varyings
(
3
,
gl_info
))
{
TRACE
(
"Shader %d needs vertex color clamping disabled
\n
"
,
programId
);
entry
->
vertex_color_clamp
=
GL_FALSE
;
}
else
{
entry
->
vertex_color_clamp
=
GL_FIXED_ONLY_ARB
;
entry
->
vs
.
vertex_color_clamp
=
GL_FALSE
;
}
else
{
entry
->
vs
.
vertex_color_clamp
=
GL_FIXED_ONLY_ARB
;
}
/* Set the shader to allow uniform loading on it */
...
...
@@ -5015,13 +5023,13 @@ static void shader_glsl_select(const struct wined3d_context *context, enum wined
BOOL
useVS
=
vertex_mode
==
WINED3D_SHADER_MODE_SHADER
;
BOOL
usePS
=
fragment_mode
==
WINED3D_SHADER_MODE_SHADER
;
old_vertex_color_clamp
=
priv
->
glsl_program
?
priv
->
glsl_program
->
vertex_color_clamp
:
GL_FIXED_ONLY_ARB
;
old_vertex_color_clamp
=
priv
->
glsl_program
?
priv
->
glsl_program
->
v
s
.
v
ertex_color_clamp
:
GL_FIXED_ONLY_ARB
;
priv
->
fragment_pipe
->
enable_extension
(
gl_info
,
fragment_mode
==
WINED3D_SHADER_MODE_FFP
);
if
(
useVS
||
usePS
)
set_glsl_shader_program
(
context
,
device
,
usePS
,
useVS
);
else
priv
->
glsl_program
=
NULL
;
current_vertex_color_clamp
=
priv
->
glsl_program
?
priv
->
glsl_program
->
vertex_color_clamp
:
GL_FIXED_ONLY_ARB
;
current_vertex_color_clamp
=
priv
->
glsl_program
?
priv
->
glsl_program
->
v
s
.
v
ertex_color_clamp
:
GL_FIXED_ONLY_ARB
;
if
(
old_vertex_color_clamp
!=
current_vertex_color_clamp
)
{
...
...
@@ -5150,7 +5158,7 @@ static void shader_glsl_destroy(struct wined3d_shader *shader)
struct
glsl_vs_compiled_shader
*
gl_shaders
=
shader_data
->
gl_shaders
.
vs
;
LIST_FOR_EACH_ENTRY_SAFE
(
entry
,
entry2
,
linked_programs
,
struct
glsl_shader_prog_link
,
vshader_entry
)
struct
glsl_shader_prog_link
,
vs
.
s
hader_entry
)
{
delete_glsl_program_entry
(
priv
,
gl_info
,
entry
);
}
...
...
@@ -5158,7 +5166,7 @@ static void shader_glsl_destroy(struct wined3d_shader *shader)
for
(
i
=
0
;
i
<
shader_data
->
num_gl_shaders
;
++
i
)
{
TRACE
(
"Deleting vertex shader %u.
\n
"
,
gl_shaders
[
i
].
prgId
);
if
(
priv
->
glsl_program
&&
priv
->
glsl_program
->
vs
_
id
==
gl_shaders
[
i
].
prgId
)
if
(
priv
->
glsl_program
&&
priv
->
glsl_program
->
vs
.
id
==
gl_shaders
[
i
].
prgId
)
shader_glsl_select
(
context
,
WINED3D_SHADER_MODE_NONE
,
WINED3D_SHADER_MODE_NONE
);
GL_EXTCALL
(
glDeleteObjectARB
(
gl_shaders
[
i
].
prgId
));
checkGLcall
(
"glDeleteObjectARB"
);
...
...
@@ -5188,8 +5196,8 @@ static int glsl_program_key_compare(const void *key, const struct wine_rb_entry
const
struct
glsl_shader_prog_link
*
prog
=
WINE_RB_ENTRY_VALUE
(
entry
,
const
struct
glsl_shader_prog_link
,
program_lookup_entry
);
if
(
k
->
vs_id
>
prog
->
vs
_
id
)
return
1
;
else
if
(
k
->
vs_id
<
prog
->
vs
_
id
)
return
-
1
;
if
(
k
->
vs_id
>
prog
->
vs
.
id
)
return
1
;
else
if
(
k
->
vs_id
<
prog
->
vs
.
id
)
return
-
1
;
if
(
k
->
ps_id
>
prog
->
ps_id
)
return
1
;
else
if
(
k
->
ps_id
<
prog
->
ps_id
)
return
-
1
;
...
...
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