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
d360a51f
Commit
d360a51f
authored
Jan 22, 2015
by
Matteo Bruni
Committed by
Alexandre Julliard
Jan 23, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Use the core version of the shader object functions.
parent
e1929396
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
319 additions
and
228 deletions
+319
-228
directx.c
dlls/wined3d/directx.c
+92
-1
glsl_shader.c
dlls/wined3d/glsl_shader.c
+227
-227
No files found.
dlls/wined3d/directx.c
View file @
d360a51f
...
...
@@ -2868,6 +2868,8 @@ static void load_gl_funcs(struct wined3d_gl_info *gl_info)
/* Newer core functions */
USE_GL_FUNC
(
glActiveTexture
)
/* OpenGL 1.3 */
USE_GL_FUNC
(
glAttachShader
)
/* OpenGL 2.0 */
USE_GL_FUNC
(
glBindAttribLocation
)
/* OpenGL 2.0 */
USE_GL_FUNC
(
glBindBuffer
)
/* OpenGL 1.5 */
USE_GL_FUNC
(
glBlendColor
)
/* OpenGL 1.4 */
USE_GL_FUNC
(
glBlendEquation
)
/* OpenGL 1.4 */
...
...
@@ -2876,24 +2878,64 @@ static void load_gl_funcs(struct wined3d_gl_info *gl_info)
USE_GL_FUNC
(
glBufferData
)
/* OpenGL 1.5 */
USE_GL_FUNC
(
glBufferSubData
)
/* OpenGL 1.5 */
USE_GL_FUNC
(
glColorMaski
)
/* OpenGL 3.0 */
USE_GL_FUNC
(
glCompileShader
)
/* OpenGL 2.0 */
USE_GL_FUNC
(
glCompressedTexImage2D
)
/* OpenGL 1.3 */
USE_GL_FUNC
(
glCompressedTexImage3D
)
/* OpenGL 1.3 */
USE_GL_FUNC
(
glCompressedTexSubImage2D
)
/* OpenGL 1.3 */
USE_GL_FUNC
(
glCompressedTexSubImage3D
)
/* OpenGL 1.3 */
USE_GL_FUNC
(
glCreateProgram
)
/* OpenGL 2.0 */
USE_GL_FUNC
(
glCreateShader
)
/* OpenGL 2.0 */
USE_GL_FUNC
(
glDeleteBuffers
)
/* OpenGL 1.5 */
USE_GL_FUNC
(
glDeleteProgram
)
/* OpenGL 2.0 */
USE_GL_FUNC
(
glDeleteShader
)
/* OpenGL 2.0 */
USE_GL_FUNC
(
glDetachShader
)
/* OpenGL 2.0 */
USE_GL_FUNC
(
glDisableVertexAttribArray
)
/* OpenGL 2.0 */
USE_GL_FUNC
(
glDrawBuffers
)
/* OpenGL 2.0 */
USE_GL_FUNC
(
glDrawElementsInstanced
)
/* OpenGL 3.1 */
USE_GL_FUNC
(
glEnableVertexAttribArray
)
/* OpenGL 2.0 */
USE_GL_FUNC
(
glGenBuffers
)
/* OpenGL 1.5 */
USE_GL_FUNC
(
glGetActiveUniform
)
/* OpenGL 2.0 */
USE_GL_FUNC
(
glGetAttachedShaders
)
/* OpenGL 2.0 */
USE_GL_FUNC
(
glGetAttribLocation
)
/* OpenGL 2.0 */
USE_GL_FUNC
(
glGetBufferSubData
)
/* OpenGL 1.5 */
USE_GL_FUNC
(
glGetCompressedTexImage
)
/* OpenGL 1.3 */
USE_GL_FUNC
(
glGetProgramInfoLog
)
/* OpenGL 2.0 */
USE_GL_FUNC
(
glGetProgramiv
)
/* OpenGL 2.0 */
USE_GL_FUNC
(
glGetShaderInfoLog
)
/* OpenGL 2.0 */
USE_GL_FUNC
(
glGetShaderiv
)
/* OpenGL 2.0 */
USE_GL_FUNC
(
glGetShaderSource
)
/* OpenGL 2.0 */
USE_GL_FUNC
(
glGetUniformfv
)
/* OpenGL 2.0 */
USE_GL_FUNC
(
glGetUniformiv
)
/* OpenGL 2.0 */
USE_GL_FUNC
(
glGetUniformLocation
)
/* OpenGL 2.0 */
USE_GL_FUNC
(
glLinkProgram
)
/* OpenGL 2.0 */
USE_GL_FUNC
(
glMapBuffer
)
/* OpenGL 1.5 */
USE_GL_FUNC
(
glPointParameteri
)
/* OpenGL 1.4 */
USE_GL_FUNC
(
glPointParameteriv
)
/* OpenGL 1.4 */
USE_GL_FUNC
(
glShaderSource
)
/* OpenGL 2.0 */
USE_GL_FUNC
(
glStencilFuncSeparate
)
/* OpenGL 2.0 */
USE_GL_FUNC
(
glStencilOpSeparate
)
/* OpenGL 2.0 */
USE_GL_FUNC
(
glUniform1f
)
/* OpenGL 2.0 */
USE_GL_FUNC
(
glUniform1fv
)
/* OpenGL 2.0 */
USE_GL_FUNC
(
glUniform1i
)
/* OpenGL 2.0 */
USE_GL_FUNC
(
glUniform1iv
)
/* OpenGL 2.0 */
USE_GL_FUNC
(
glUniform2f
)
/* OpenGL 2.0 */
USE_GL_FUNC
(
glUniform2fv
)
/* OpenGL 2.0 */
USE_GL_FUNC
(
glUniform2i
)
/* OpenGL 2.0 */
USE_GL_FUNC
(
glUniform2iv
)
/* OpenGL 2.0 */
USE_GL_FUNC
(
glUniform3f
)
/* OpenGL 2.0 */
USE_GL_FUNC
(
glUniform3fv
)
/* OpenGL 2.0 */
USE_GL_FUNC
(
glUniform3i
)
/* OpenGL 2.0 */
USE_GL_FUNC
(
glUniform3iv
)
/* OpenGL 2.0 */
USE_GL_FUNC
(
glUniform4f
)
/* OpenGL 2.0 */
USE_GL_FUNC
(
glUniform4fv
)
/* OpenGL 2.0 */
USE_GL_FUNC
(
glUniform4i
)
/* OpenGL 2.0 */
USE_GL_FUNC
(
glUniform4iv
)
/* OpenGL 2.0 */
USE_GL_FUNC
(
glUniformMatrix2fv
)
/* OpenGL 2.0 */
USE_GL_FUNC
(
glUniformMatrix3fv
)
/* OpenGL 2.0 */
USE_GL_FUNC
(
glUniformMatrix4fv
)
/* OpenGL 2.0 */
USE_GL_FUNC
(
glUnmapBuffer
)
/* OpenGL 1.5 */
USE_GL_FUNC
(
glUseProgram
)
/* OpenGL 2.0 */
USE_GL_FUNC
(
glValidateProgram
)
/* OpenGL 2.0 */
USE_GL_FUNC
(
glVertexAttrib1f
)
/* OpenGL 2.0 */
USE_GL_FUNC
(
glVertexAttrib1fv
)
/* OpenGL 2.0 */
USE_GL_FUNC
(
glVertexAttrib2f
)
/* OpenGL 2.0 */
...
...
@@ -2917,14 +2959,22 @@ static void load_gl_funcs(struct wined3d_gl_info *gl_info)
gl_info
->
gl_ops
.
ext
=
((
struct
opengl_funcs
*
)
NtCurrentTeb
()
->
glTable
)
->
ext
;
#endif
#define MAP_GL_FUNCTION(core_func, ext_func) \
#define MAP_GL_FUNCTION(core_func, ext_func)
\
do \
{ \
if (!gl_info->gl_ops.ext.p_##core_func) \
gl_info->gl_ops.ext.p_##core_func = gl_info->gl_ops.ext.p_##ext_func; \
} while (0)
#define MAP_GL_FUNCTION_CAST(core_func, ext_func) \
do \
{ \
if (!gl_info->gl_ops.ext.p_##core_func) \
gl_info->gl_ops.ext.p_##core_func = (void *)gl_info->gl_ops.ext.p_##ext_func; \
} while (0)
MAP_GL_FUNCTION
(
glActiveTexture
,
glActiveTextureARB
);
MAP_GL_FUNCTION
(
glAttachShader
,
glAttachObjectARB
);
MAP_GL_FUNCTION
(
glBindAttribLocation
,
glBindAttribLocationARB
);
MAP_GL_FUNCTION
(
glBindBuffer
,
glBindBufferARB
);
MAP_GL_FUNCTION
(
glBlendColor
,
glBlendColorEXT
);
MAP_GL_FUNCTION
(
glBlendEquation
,
glBlendEquationEXT
);
...
...
@@ -2933,20 +2983,60 @@ static void load_gl_funcs(struct wined3d_gl_info *gl_info)
MAP_GL_FUNCTION
(
glBufferData
,
glBufferDataARB
);
MAP_GL_FUNCTION
(
glBufferSubData
,
glBufferSubDataARB
);
MAP_GL_FUNCTION
(
glColorMaski
,
glColorMaskIndexedEXT
);
MAP_GL_FUNCTION
(
glCompileShader
,
glCompileShaderARB
);
MAP_GL_FUNCTION
(
glCompressedTexImage2D
,
glCompressedTexImage2DARB
);
MAP_GL_FUNCTION
(
glCompressedTexImage3D
,
glCompressedTexImage3DARB
);
MAP_GL_FUNCTION
(
glCompressedTexSubImage2D
,
glCompressedTexSubImage2DARB
);
MAP_GL_FUNCTION
(
glCompressedTexSubImage3D
,
glCompressedTexSubImage3DARB
);
MAP_GL_FUNCTION
(
glCreateProgram
,
glCreateProgramObjectARB
);
MAP_GL_FUNCTION
(
glCreateShader
,
glCreateShaderObjectARB
);
MAP_GL_FUNCTION
(
glDeleteBuffers
,
glDeleteBuffersARB
);
MAP_GL_FUNCTION
(
glDeleteProgram
,
glDeleteObjectARB
);
MAP_GL_FUNCTION
(
glDeleteShader
,
glDeleteObjectARB
);
MAP_GL_FUNCTION
(
glDetachShader
,
glDetachObjectARB
);
MAP_GL_FUNCTION
(
glDisableVertexAttribArray
,
glDisableVertexAttribArrayARB
);
MAP_GL_FUNCTION
(
glDrawBuffers
,
glDrawBuffersARB
);
MAP_GL_FUNCTION
(
glDrawElementsInstanced
,
glDrawElementsInstancedARB
);
MAP_GL_FUNCTION
(
glEnableVertexAttribArray
,
glEnableVertexAttribArrayARB
);
MAP_GL_FUNCTION
(
glGenBuffers
,
glGenBuffersARB
);
MAP_GL_FUNCTION
(
glGetActiveUniform
,
glGetActiveUniformARB
);
MAP_GL_FUNCTION
(
glGetAttachedShaders
,
glGetAttachedObjectsARB
);
MAP_GL_FUNCTION
(
glGetAttribLocation
,
glGetAttribLocationARB
);
MAP_GL_FUNCTION
(
glGetBufferSubData
,
glGetBufferSubDataARB
);
MAP_GL_FUNCTION
(
glGetCompressedTexImage
,
glGetCompressedTexImageARB
);
MAP_GL_FUNCTION
(
glGetProgramInfoLog
,
glGetInfoLogARB
);
MAP_GL_FUNCTION
(
glGetProgramiv
,
glGetObjectParameterivARB
);
MAP_GL_FUNCTION
(
glGetShaderInfoLog
,
glGetInfoLogARB
);
MAP_GL_FUNCTION
(
glGetShaderiv
,
glGetObjectParameterivARB
);
MAP_GL_FUNCTION
(
glGetShaderSource
,
glGetShaderSourceARB
);
MAP_GL_FUNCTION
(
glGetUniformfv
,
glGetUniformfvARB
);
MAP_GL_FUNCTION
(
glGetUniformiv
,
glGetUniformivARB
);
MAP_GL_FUNCTION
(
glGetUniformLocation
,
glGetUniformLocationARB
);
MAP_GL_FUNCTION
(
glLinkProgram
,
glLinkProgramARB
);
MAP_GL_FUNCTION
(
glMapBuffer
,
glMapBufferARB
);
MAP_GL_FUNCTION_CAST
(
glShaderSource
,
glShaderSourceARB
);
MAP_GL_FUNCTION
(
glUniform1f
,
glUniform1fARB
);
MAP_GL_FUNCTION
(
glUniform1fv
,
glUniform1fvARB
);
MAP_GL_FUNCTION
(
glUniform1i
,
glUniform1iARB
);
MAP_GL_FUNCTION
(
glUniform1iv
,
glUniform1ivARB
);
MAP_GL_FUNCTION
(
glUniform2f
,
glUniform2fARB
);
MAP_GL_FUNCTION
(
glUniform2fv
,
glUniform2fvARB
);
MAP_GL_FUNCTION
(
glUniform2i
,
glUniform2iARB
);
MAP_GL_FUNCTION
(
glUniform2iv
,
glUniform2ivARB
);
MAP_GL_FUNCTION
(
glUniform3f
,
glUniform3fARB
);
MAP_GL_FUNCTION
(
glUniform3fv
,
glUniform3fvARB
);
MAP_GL_FUNCTION
(
glUniform3i
,
glUniform3iARB
);
MAP_GL_FUNCTION
(
glUniform3iv
,
glUniform3ivARB
);
MAP_GL_FUNCTION
(
glUniform4f
,
glUniform4fARB
);
MAP_GL_FUNCTION
(
glUniform4fv
,
glUniform4fvARB
);
MAP_GL_FUNCTION
(
glUniform4i
,
glUniform4iARB
);
MAP_GL_FUNCTION
(
glUniform4iv
,
glUniform4ivARB
);
MAP_GL_FUNCTION
(
glUniformMatrix2fv
,
glUniformMatrix2fvARB
);
MAP_GL_FUNCTION
(
glUniformMatrix3fv
,
glUniformMatrix3fvARB
);
MAP_GL_FUNCTION
(
glUniformMatrix4fv
,
glUniformMatrix4fvARB
);
MAP_GL_FUNCTION
(
glUnmapBuffer
,
glUnmapBufferARB
);
MAP_GL_FUNCTION
(
glUseProgram
,
glUseProgramObjectARB
);
MAP_GL_FUNCTION
(
glValidateProgram
,
glValidateProgramARB
);
MAP_GL_FUNCTION
(
glVertexAttrib1f
,
glVertexAttrib1fARB
);
MAP_GL_FUNCTION
(
glVertexAttrib1fv
,
glVertexAttrib1fvARB
);
MAP_GL_FUNCTION
(
glVertexAttrib2f
,
glVertexAttrib2fARB
);
...
...
@@ -2963,6 +3053,7 @@ static void load_gl_funcs(struct wined3d_gl_info *gl_info)
MAP_GL_FUNCTION
(
glVertexAttribDivisor
,
glVertexAttribDivisorARB
);
MAP_GL_FUNCTION
(
glVertexAttribPointer
,
glVertexAttribPointerARB
);
#undef MAP_GL_FUNCTION
#undef MAP_GL_FUNCTION_CAST
}
static
void
wined3d_adapter_init_limits
(
struct
wined3d_gl_info
*
gl_info
)
...
...
dlls/wined3d/glsl_shader.c
View file @
d360a51f
...
...
@@ -96,8 +96,8 @@ struct shader_glsl_priv {
struct
constant_heap
vconst_heap
;
struct
constant_heap
pconst_heap
;
unsigned
char
*
stack
;
GL
handleARB
depth_blt_program_full
[
tex_type_count
];
GL
handleARB
depth_blt_program_masked
[
tex_type_count
];
GL
uint
depth_blt_program_full
[
tex_type_count
];
GL
uint
depth_blt_program_masked
[
tex_type_count
];
UINT
next_constant_version
;
const
struct
wined3d_vertex_pipe_ops
*
vertex_pipe
;
...
...
@@ -110,7 +110,7 @@ struct shader_glsl_priv {
struct
glsl_vs_program
{
struct
list
shader_entry
;
GL
handleARB
id
;
GL
uint
id
;
GLenum
vertex_color_clamp
;
GLint
*
uniform_f_locations
;
GLint
uniform_i_locations
[
MAX_CONST_I
];
...
...
@@ -121,13 +121,13 @@ struct glsl_vs_program
struct
glsl_gs_program
{
struct
list
shader_entry
;
GL
handleARB
id
;
GL
uint
id
;
};
struct
glsl_ps_program
{
struct
list
shader_entry
;
GL
handleARB
id
;
GL
uint
id
;
GLint
*
uniform_f_locations
;
GLint
uniform_i_locations
[
MAX_CONST_I
];
GLint
uniform_b_locations
[
MAX_CONST_B
];
...
...
@@ -149,16 +149,16 @@ struct glsl_shader_prog_link
struct
glsl_vs_program
vs
;
struct
glsl_gs_program
gs
;
struct
glsl_ps_program
ps
;
GL
handleARB
programI
d
;
GL
uint
i
d
;
DWORD
constant_update_mask
;
UINT
constant_version
;
};
struct
glsl_program_key
{
GL
handleARB
vs_id
;
GL
handleARB
gs_id
;
GL
handleARB
ps_id
;
GL
uint
vs_id
;
GL
uint
gs_id
;
GL
uint
ps_id
;
};
struct
shader_glsl_ctx_priv
{
...
...
@@ -176,18 +176,18 @@ struct glsl_ps_compiled_shader
{
struct
ps_compile_args
args
;
struct
ps_np2fixup_info
np2fixup
;
GL
handleARB
prgI
d
;
GL
uint
i
d
;
};
struct
glsl_vs_compiled_shader
{
struct
vs_compile_args
args
;
GL
handleARB
prgI
d
;
GL
uint
i
d
;
};
struct
glsl_gs_compiled_shader
{
GL
handleARB
id
;
GL
uint
id
;
};
struct
glsl_shader_private
...
...
@@ -204,14 +204,14 @@ struct glsl_shader_private
struct
glsl_ffp_vertex_shader
{
struct
wined3d_ffp_vs_desc
desc
;
GL
handleARB
id
;
GL
uint
id
;
struct
list
linked_programs
;
};
struct
glsl_ffp_fragment_shader
{
struct
ffp_frag_desc
entry
;
GL
handleARB
id
;
GL
uint
id
;
struct
list
linked_programs
;
};
...
...
@@ -226,9 +226,9 @@ static const char *debug_gl_shader_type(GLenum type)
switch
(
type
)
{
#define WINED3D_TO_STR(u) case u: return #u
WINED3D_TO_STR
(
GL_VERTEX_SHADER
_ARB
);
WINED3D_TO_STR
(
GL_GEOMETRY_SHADER
_ARB
);
WINED3D_TO_STR
(
GL_FRAGMENT_SHADER
_ARB
);
WINED3D_TO_STR
(
GL_VERTEX_SHADER
);
WINED3D_TO_STR
(
GL_GEOMETRY_SHADER
);
WINED3D_TO_STR
(
GL_FRAGMENT_SHADER
);
#undef WINED3D_TO_STR
default:
return
wine_dbg_sprintf
(
"UNKNOWN(%#x)"
,
type
);
...
...
@@ -285,80 +285,84 @@ static char *get_info_log_line(char **ptr)
}
/* Context activation is done by the caller. */
static
void
print_glsl_info_log
(
const
struct
wined3d_gl_info
*
gl_info
,
GL
handleARB
obj
)
static
void
print_glsl_info_log
(
const
struct
wined3d_gl_info
*
gl_info
,
GL
uint
id
,
BOOL
program
)
{
int
infologL
ength
=
0
;
char
*
infoL
og
;
int
l
ength
=
0
;
char
*
l
og
;
if
(
!
WARN_ON
(
d3d_shader
)
&&
!
FIXME_ON
(
d3d_shader
))
return
;
GL_EXTCALL
(
glGetObjectParameterivARB
(
obj
,
GL_OBJECT_INFO_LOG_LENGTH_ARB
,
&
infologLength
));
if
(
program
)
GL_EXTCALL
(
glGetProgramiv
(
id
,
GL_INFO_LOG_LENGTH
,
&
length
));
else
GL_EXTCALL
(
glGetShaderiv
(
id
,
GL_INFO_LOG_LENGTH
,
&
length
));
/* A size of 1 is just a null-terminated string, so the log should be bigger than
* that if there are errors. */
if
(
infologL
ength
>
1
)
if
(
l
ength
>
1
)
{
char
*
ptr
,
*
line
;
infoLog
=
HeapAlloc
(
GetProcessHeap
(),
0
,
infologL
ength
);
log
=
HeapAlloc
(
GetProcessHeap
(),
0
,
l
ength
);
/* The info log is supposed to be zero-terminated, but at least some
* versions of fglrx don't terminate the string properly. The reported
* length does include the terminator, so explicitly set it to zero
* here. */
infoLog
[
infologLength
-
1
]
=
0
;
GL_EXTCALL
(
glGetInfoLogARB
(
obj
,
infologLength
,
NULL
,
infoLog
));
log
[
length
-
1
]
=
0
;
if
(
program
)
GL_EXTCALL
(
glGetProgramInfoLog
(
id
,
length
,
NULL
,
log
));
else
GL_EXTCALL
(
glGetShaderInfoLog
(
id
,
length
,
NULL
,
log
));
ptr
=
infoL
og
;
ptr
=
l
og
;
if
(
gl_info
->
quirks
&
WINED3D_QUIRK_INFO_LOG_SPAM
)
{
WARN
(
"Info log received from GLSL shader #%u:
\n
"
,
obj
);
WARN
(
"Info log received from GLSL shader #%u:
\n
"
,
id
);
while
((
line
=
get_info_log_line
(
&
ptr
)))
WARN
(
" %s
\n
"
,
line
);
}
else
{
FIXME
(
"Info log received from GLSL shader #%u:
\n
"
,
obj
);
FIXME
(
"Info log received from GLSL shader #%u:
\n
"
,
id
);
while
((
line
=
get_info_log_line
(
&
ptr
)))
FIXME
(
" %s
\n
"
,
line
);
}
HeapFree
(
GetProcessHeap
(),
0
,
infoL
og
);
HeapFree
(
GetProcessHeap
(),
0
,
l
og
);
}
}
/* Context activation is done by the caller. */
static
void
shader_glsl_compile
(
const
struct
wined3d_gl_info
*
gl_info
,
GL
handleARB
shader
,
const
char
*
src
)
static
void
shader_glsl_compile
(
const
struct
wined3d_gl_info
*
gl_info
,
GL
uint
shader
,
const
char
*
src
)
{
TRACE
(
"Compiling shader object %u.
\n
"
,
shader
);
GL_EXTCALL
(
glShaderSource
ARB
(
shader
,
1
,
&
src
,
NULL
));
checkGLcall
(
"glShaderSource
ARB
"
);
GL_EXTCALL
(
glCompileShader
ARB
(
shader
));
checkGLcall
(
"glCompileShader
ARB
"
);
print_glsl_info_log
(
gl_info
,
shader
);
GL_EXTCALL
(
glShaderSource
(
shader
,
1
,
&
src
,
NULL
));
checkGLcall
(
"glShaderSource"
);
GL_EXTCALL
(
glCompileShader
(
shader
));
checkGLcall
(
"glCompileShader"
);
print_glsl_info_log
(
gl_info
,
shader
,
FALSE
);
}
/* Context activation is done by the caller. */
static
void
shader_glsl_dump_program_source
(
const
struct
wined3d_gl_info
*
gl_info
,
GL
handleARB
program
)
static
void
shader_glsl_dump_program_source
(
const
struct
wined3d_gl_info
*
gl_info
,
GL
uint
program
)
{
GLint
i
,
object
_count
,
source_size
=
-
1
;
GL
handleARB
*
object
s
;
GLint
i
,
shader
_count
,
source_size
=
-
1
;
GL
uint
*
shader
s
;
char
*
source
=
NULL
;
GL_EXTCALL
(
glGet
ObjectParameterivARB
(
program
,
GL_OBJECT_ATTACHED_OBJECTS_ARB
,
&
object
_count
));
objects
=
HeapAlloc
(
GetProcessHeap
(),
0
,
object_count
*
sizeof
(
*
object
s
));
if
(
!
object
s
)
GL_EXTCALL
(
glGet
Programiv
(
program
,
GL_ATTACHED_SHADERS
,
&
shader
_count
));
shaders
=
HeapAlloc
(
GetProcessHeap
(),
0
,
shader_count
*
sizeof
(
*
shader
s
));
if
(
!
shader
s
)
{
ERR
(
"Failed to allocate
object
array memory.
\n
"
);
ERR
(
"Failed to allocate
shader
array memory.
\n
"
);
return
;
}
GL_EXTCALL
(
glGetAttached
ObjectsARB
(
program
,
object_count
,
NULL
,
object
s
));
for
(
i
=
0
;
i
<
object
_count
;
++
i
)
GL_EXTCALL
(
glGetAttached
Shaders
(
program
,
shader_count
,
NULL
,
shader
s
));
for
(
i
=
0
;
i
<
shader
_count
;
++
i
)
{
char
*
ptr
,
*
line
;
GLint
tmp
;
GL_EXTCALL
(
glGet
ObjectParameterivARB
(
objects
[
i
],
GL_OBJECT_SHADER_SOURCE_LENGTH_ARB
,
&
tmp
));
GL_EXTCALL
(
glGet
Shaderiv
(
shaders
[
i
],
GL_SHADER_SOURCE_LENGTH
,
&
tmp
));
if
(
source_size
<
tmp
)
{
...
...
@@ -368,53 +372,50 @@ static void shader_glsl_dump_program_source(const struct wined3d_gl_info *gl_inf
if
(
!
source
)
{
ERR
(
"Failed to allocate %d bytes for shader source.
\n
"
,
tmp
);
HeapFree
(
GetProcessHeap
(),
0
,
object
s
);
HeapFree
(
GetProcessHeap
(),
0
,
shader
s
);
return
;
}
source_size
=
tmp
;
}
FIXME
(
"
Object %u:
\n
"
,
object
s
[
i
]);
GL_EXTCALL
(
glGet
ObjectParameterivARB
(
objects
[
i
],
GL_OBJECT_SUBTYPE_ARB
,
&
tmp
));
FIXME
(
" GL_
OBJECT_SUBTYPE_ARB
: %s.
\n
"
,
debug_gl_shader_type
(
tmp
));
GL_EXTCALL
(
glGet
ObjectParameterivARB
(
objects
[
i
],
GL_OBJECT_COMPILE_STATUS_ARB
,
&
tmp
));
FIXME
(
" GL_
OBJECT_COMPILE_STATUS_ARB
: %d.
\n
"
,
tmp
);
FIXME
(
"
Shader %u:
\n
"
,
shader
s
[
i
]);
GL_EXTCALL
(
glGet
Shaderiv
(
shaders
[
i
],
GL_SHADER_TYPE
,
&
tmp
));
FIXME
(
" GL_
SHADER_TYPE
: %s.
\n
"
,
debug_gl_shader_type
(
tmp
));
GL_EXTCALL
(
glGet
Shaderiv
(
shaders
[
i
],
GL_COMPILE_STATUS
,
&
tmp
));
FIXME
(
" GL_
COMPILE_STATUS
: %d.
\n
"
,
tmp
);
FIXME
(
"
\n
"
);
ptr
=
source
;
GL_EXTCALL
(
glGetShaderSource
ARB
(
object
s
[
i
],
source_size
,
NULL
,
source
));
GL_EXTCALL
(
glGetShaderSource
(
shader
s
[
i
],
source_size
,
NULL
,
source
));
while
((
line
=
get_info_log_line
(
&
ptr
)))
FIXME
(
" %s
\n
"
,
line
);
FIXME
(
"
\n
"
);
}
HeapFree
(
GetProcessHeap
(),
0
,
source
);
HeapFree
(
GetProcessHeap
(),
0
,
object
s
);
HeapFree
(
GetProcessHeap
(),
0
,
shader
s
);
}
/* Context activation is done by the caller. */
static
void
shader_glsl_validate_link
(
const
struct
wined3d_gl_info
*
gl_info
,
GL
handleARB
program
)
static
void
shader_glsl_validate_link
(
const
struct
wined3d_gl_info
*
gl_info
,
GL
uint
program
)
{
GLint
tmp
;
if
(
!
TRACE_ON
(
d3d_shader
)
&&
!
FIXME_ON
(
d3d_shader
))
return
;
if
(
!
TRACE_ON
(
d3d_shader
)
&&
!
FIXME_ON
(
d3d_shader
))
return
;
GL_EXTCALL
(
glGet
ObjectParameterivARB
(
program
,
GL_OBJECT_TYPE_ARB
,
&
tmp
));
if
(
tmp
==
GL_PROGRAM_OBJECT_ARB
)
GL_EXTCALL
(
glGet
Programiv
(
program
,
GL_LINK_STATUS
,
&
tmp
));
if
(
!
tmp
)
{
GL_EXTCALL
(
glGetObjectParameterivARB
(
program
,
GL_OBJECT_LINK_STATUS_ARB
,
&
tmp
));
if
(
!
tmp
)
{
FIXME
(
"Program %u link status invalid.
\n
"
,
program
);
shader_glsl_dump_program_source
(
gl_info
,
program
);
}
FIXME
(
"Program %u link status invalid.
\n
"
,
program
);
shader_glsl_dump_program_source
(
gl_info
,
program
);
}
print_glsl_info_log
(
gl_info
,
program
);
print_glsl_info_log
(
gl_info
,
program
,
TRUE
);
}
/* Context activation is done by the caller. */
static
void
shader_glsl_load_samplers
(
const
struct
wined3d_gl_info
*
gl_info
,
const
DWORD
*
tex_unit_map
,
GL
handleARB
program_id
)
const
DWORD
*
tex_unit_map
,
GL
uint
program_id
)
{
unsigned
int
mapped_unit
;
char
sampler_name
[
20
];
...
...
@@ -441,7 +442,7 @@ static void shader_glsl_load_samplers(const struct wined3d_gl_info *gl_info,
for
(
j
=
0
;
j
<
sampler_info
[
i
].
count
;
++
j
)
{
snprintf
(
sampler_name
,
sizeof
(
sampler_name
),
"%s_sampler%u"
,
prefix
,
j
);
name_loc
=
GL_EXTCALL
(
glGetUniformLocation
ARB
(
program_id
,
sampler_name
));
name_loc
=
GL_EXTCALL
(
glGetUniformLocation
(
program_id
,
sampler_name
));
if
(
name_loc
==
-
1
)
continue
;
...
...
@@ -453,10 +454,10 @@ static void shader_glsl_load_samplers(const struct wined3d_gl_info *gl_info,
}
TRACE
(
"Loading sampler %s on unit %u.
\n
"
,
sampler_name
,
mapped_unit
);
GL_EXTCALL
(
glUniform1i
ARB
(
name_loc
,
mapped_unit
));
GL_EXTCALL
(
glUniform1i
(
name_loc
,
mapped_unit
));
}
}
checkGLcall
(
"glUniform1i
ARB
"
);
checkGLcall
(
"glUniform1i"
);
}
/* Context activation is done by the caller. */
...
...
@@ -529,7 +530,7 @@ static inline void walk_constant_heap(const struct wined3d_gl_info *gl_info, con
}
}
if
(
start
<=
end
)
GL_EXTCALL
(
glUniform4fv
ARB
(
constant_locations
[
start
],
end
-
start
+
1
,
&
constants
[
start
*
4
]));
GL_EXTCALL
(
glUniform4fv
(
constant_locations
[
start
],
end
-
start
+
1
,
&
constants
[
start
*
4
]));
checkGLcall
(
"walk_constant_heap()"
);
}
...
...
@@ -545,7 +546,7 @@ static inline void apply_clamped_constant(const struct wined3d_gl_info *gl_info,
clamped_constant
[
2
]
=
data
[
2
]
<
-
1
.
0
f
?
-
1
.
0
f
:
data
[
2
]
>
1
.
0
f
?
1
.
0
f
:
data
[
2
];
clamped_constant
[
3
]
=
data
[
3
]
<
-
1
.
0
f
?
-
1
.
0
f
:
data
[
3
]
>
1
.
0
f
?
1
.
0
f
:
data
[
3
];
GL_EXTCALL
(
glUniform4fv
ARB
(
location
,
1
,
clamped_constant
));
GL_EXTCALL
(
glUniform4fv
(
location
,
1
,
clamped_constant
));
}
/* Context activation is done by the caller. */
...
...
@@ -629,9 +630,9 @@ static void shader_glsl_load_constantsF(const struct wined3d_shader *shader, con
/* Immediate constants are clamped to [-1;1] at shader creation time if needed */
LIST_FOR_EACH_ENTRY
(
lconst
,
&
shader
->
constantsF
,
struct
wined3d_shader_lconst
,
entry
)
{
GL_EXTCALL
(
glUniform4fv
ARB
(
constant_locations
[
lconst
->
idx
],
1
,
(
const
GLfloat
*
)
lconst
->
value
));
GL_EXTCALL
(
glUniform4fv
(
constant_locations
[
lconst
->
idx
],
1
,
(
const
GLfloat
*
)
lconst
->
value
));
}
checkGLcall
(
"glUniform4fv
ARB
()"
);
checkGLcall
(
"glUniform4fv()"
);
}
/* Context activation is done by the caller. */
...
...
@@ -646,7 +647,7 @@ static void shader_glsl_load_constantsI(const struct wined3d_shader *shader, con
if
(
!
(
constants_set
&
1
))
continue
;
/* We found this uniform name in the program - go ahead and send the data */
GL_EXTCALL
(
glUniform4iv
ARB
(
locations
[
i
],
1
,
&
constants
[
i
*
4
]));
GL_EXTCALL
(
glUniform4iv
(
locations
[
i
],
1
,
&
constants
[
i
*
4
]));
}
/* Load immediate constants */
...
...
@@ -658,10 +659,10 @@ static void shader_glsl_load_constantsI(const struct wined3d_shader *shader, con
const
GLint
*
values
=
(
const
GLint
*
)
lconst
->
value
;
/* We found this uniform name in the program - go ahead and send the data */
GL_EXTCALL
(
glUniform4iv
ARB
(
locations
[
idx
],
1
,
values
));
GL_EXTCALL
(
glUniform4iv
(
locations
[
idx
],
1
,
values
));
ptr
=
list_next
(
&
shader
->
constantsI
,
ptr
);
}
checkGLcall
(
"glUniform4iv
ARB
()"
);
checkGLcall
(
"glUniform4iv()"
);
}
/* Context activation is done by the caller. */
...
...
@@ -675,7 +676,7 @@ static void shader_glsl_load_constantsB(const struct wined3d_shader *shader, con
{
if
(
!
(
constants_set
&
1
))
continue
;
GL_EXTCALL
(
glUniform1iv
ARB
(
locations
[
i
],
1
,
&
constants
[
i
]));
GL_EXTCALL
(
glUniform1iv
(
locations
[
i
],
1
,
&
constants
[
i
]));
}
/* Load immediate constants */
...
...
@@ -686,10 +687,10 @@ static void shader_glsl_load_constantsB(const struct wined3d_shader *shader, con
unsigned
int
idx
=
lconst
->
idx
;
const
GLint
*
values
=
(
const
GLint
*
)
lconst
->
value
;
GL_EXTCALL
(
glUniform1iv
ARB
(
locations
[
idx
],
1
,
values
));
GL_EXTCALL
(
glUniform1iv
(
locations
[
idx
],
1
,
values
));
ptr
=
list_next
(
&
shader
->
constantsB
,
ptr
);
}
checkGLcall
(
"glUniform1iv
ARB
()"
);
checkGLcall
(
"glUniform1iv()"
);
}
static
void
reset_program_constant_version
(
struct
wine_rb_entry
*
entry
,
void
*
context
)
...
...
@@ -729,7 +730,7 @@ static void shader_glsl_load_np2fixup_constants(const struct glsl_ps_program *ps
}
}
GL_EXTCALL
(
glUniform4fv
ARB
(
ps
->
np2_fixup_location
,
ps
->
np2_fixup_info
->
num_consts
,
np2fixup_constants
));
GL_EXTCALL
(
glUniform4fv
(
ps
->
np2_fixup_location
,
ps
->
np2_fixup_info
->
num_consts
,
np2fixup_constants
));
}
/* Context activation is done by the caller (state handler). */
...
...
@@ -770,8 +771,8 @@ static void shader_glsl_load_constants(void *shader_priv, struct wined3d_context
if
(
update_mask
&
WINED3D_SHADER_CONST_VS_POS_FIXUP
)
{
shader_get_position_fixup
(
context
,
state
,
position_fixup
);
GL_EXTCALL
(
glUniform4fv
ARB
(
prog
->
vs
.
pos_fixup_location
,
1
,
position_fixup
));
checkGLcall
(
"glUniform4fv
ARB
"
);
GL_EXTCALL
(
glUniform4fv
(
prog
->
vs
.
pos_fixup_location
,
1
,
position_fixup
));
checkGLcall
(
"glUniform4fv"
);
}
if
(
update_mask
&
WINED3D_SHADER_CONST_PS_F
)
...
...
@@ -793,14 +794,14 @@ static void shader_glsl_load_constants(void *shader_priv, struct wined3d_context
if
(
prog
->
ps
.
bumpenv_mat_location
[
i
]
==
-
1
)
continue
;
GL_EXTCALL
(
glUniformMatrix2fv
ARB
(
prog
->
ps
.
bumpenv_mat_location
[
i
],
1
,
0
,
GL_EXTCALL
(
glUniformMatrix2fv
(
prog
->
ps
.
bumpenv_mat_location
[
i
],
1
,
0
,
(
const
GLfloat
*
)
&
state
->
texture_states
[
i
][
WINED3D_TSS_BUMPENV_MAT00
]));
if
(
prog
->
ps
.
bumpenv_lum_scale_location
[
i
]
!=
-
1
)
{
GL_EXTCALL
(
glUniform1fv
ARB
(
prog
->
ps
.
bumpenv_lum_scale_location
[
i
],
1
,
GL_EXTCALL
(
glUniform1fv
(
prog
->
ps
.
bumpenv_lum_scale_location
[
i
],
1
,
(
const
GLfloat
*
)
&
state
->
texture_states
[
i
][
WINED3D_TSS_BUMPENV_LSCALE
]));
GL_EXTCALL
(
glUniform1fv
ARB
(
prog
->
ps
.
bumpenv_lum_offset_location
[
i
],
1
,
GL_EXTCALL
(
glUniform1fv
(
prog
->
ps
.
bumpenv_lum_offset_location
[
i
],
1
,
(
const
GLfloat
*
)
&
state
->
texture_states
[
i
][
WINED3D_TSS_BUMPENV_LOFFSET
]));
}
}
...
...
@@ -821,7 +822,7 @@ static void shader_glsl_load_constants(void *shader_priv, struct wined3d_context
correction_params
[
0
]
=
(
float
)
context
->
current_rt
->
resource
.
height
;
correction_params
[
1
]
=
-
1
.
0
f
;
}
GL_EXTCALL
(
glUniform4fv
ARB
(
prog
->
ps
.
ycorrection_location
,
1
,
correction_params
));
GL_EXTCALL
(
glUniform4fv
(
prog
->
ps
.
ycorrection_location
,
1
,
correction_params
));
}
if
(
update_mask
&
WINED3D_SHADER_CONST_PS_NP2_FIXUP
)
...
...
@@ -834,13 +835,13 @@ static void shader_glsl_load_constants(void *shader_priv, struct wined3d_context
if
(
prog
->
ps
.
tex_factor_location
!=
-
1
)
{
D3DCOLORTOGLFLOAT4
(
state
->
render_states
[
WINED3D_RS_TEXTUREFACTOR
],
col
);
GL_EXTCALL
(
glUniform4fv
ARB
(
prog
->
ps
.
tex_factor_location
,
1
,
col
));
GL_EXTCALL
(
glUniform4fv
(
prog
->
ps
.
tex_factor_location
,
1
,
col
));
}
if
(
state
->
render_states
[
WINED3D_RS_SPECULARENABLE
])
GL_EXTCALL
(
glUniform4f
ARB
(
prog
->
ps
.
specular_enable_location
,
1
.
0
f
,
1
.
0
f
,
1
.
0
f
,
0
.
0
f
));
GL_EXTCALL
(
glUniform4f
(
prog
->
ps
.
specular_enable_location
,
1
.
0
f
,
1
.
0
f
,
1
.
0
f
,
0
.
0
f
));
else
GL_EXTCALL
(
glUniform4f
ARB
(
prog
->
ps
.
specular_enable_location
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
));
GL_EXTCALL
(
glUniform4f
(
prog
->
ps
.
specular_enable_location
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
));
for
(
i
=
0
;
i
<
MAX_TEXTURES
;
++
i
)
{
...
...
@@ -848,7 +849,7 @@ static void shader_glsl_load_constants(void *shader_priv, struct wined3d_context
continue
;
D3DCOLORTOGLFLOAT4
(
state
->
texture_states
[
i
][
WINED3D_TSS_CONSTANT
],
col
);
GL_EXTCALL
(
glUniform4fv
ARB
(
prog
->
ps
.
tss_constant_location
[
i
],
1
,
col
));
GL_EXTCALL
(
glUniform4fv
(
prog
->
ps
.
tss_constant_location
[
i
],
1
,
col
));
}
checkGLcall
(
"fixed function uniforms"
);
...
...
@@ -4205,7 +4206,7 @@ static void add_glsl_program_entry(struct shader_glsl_priv *priv, struct glsl_sh
}
static
struct
glsl_shader_prog_link
*
get_glsl_program_entry
(
const
struct
shader_glsl_priv
*
priv
,
GL
handleARB
vs_id
,
GLhandleARB
gs_id
,
GLhandleARB
ps_id
)
GL
uint
vs_id
,
GLuint
gs_id
,
GLuint
ps_id
)
{
struct
wine_rb_entry
*
entry
;
struct
glsl_program_key
key
;
...
...
@@ -4229,7 +4230,7 @@ static void delete_glsl_program_entry(struct shader_glsl_priv *priv, const struc
key
.
ps_id
=
entry
->
ps
.
id
;
wine_rb_remove
(
&
priv
->
program_lookup
,
&
key
);
GL_EXTCALL
(
glDelete
ObjectARB
(
entry
->
programI
d
));
GL_EXTCALL
(
glDelete
Program
(
entry
->
i
d
));
if
(
entry
->
vs
.
id
)
list_remove
(
&
entry
->
vs
.
shader_entry
);
if
(
entry
->
gs
.
id
)
...
...
@@ -4335,11 +4336,11 @@ static void handle_ps3_input(struct wined3d_shader_buffer *buffer,
}
/* Context activation is done by the caller. */
static
GL
handleARB
generate_param_reorder_function
(
struct
wined3d_shader_buffer
*
buffer
,
static
GL
uint
generate_param_reorder_function
(
struct
wined3d_shader_buffer
*
buffer
,
const
struct
wined3d_shader
*
vs
,
const
struct
wined3d_shader
*
ps
,
const
struct
wined3d_gl_info
*
gl_info
)
{
GL
handleARB
ret
=
0
;
GL
uint
ret
=
0
;
DWORD
ps_major
=
ps
?
ps
->
reg_maps
.
shader_version
.
major
:
0
;
unsigned
int
i
;
const
char
*
semantic_name
;
...
...
@@ -4438,8 +4439,8 @@ static GLhandleARB generate_param_reorder_function(struct wined3d_shader_buffer
shader_addline
(
buffer
,
"}
\n
"
);
}
ret
=
GL_EXTCALL
(
glCreateShader
ObjectARB
(
GL_VERTEX_SHADER_ARB
));
checkGLcall
(
"glCreateShader
ObjectARB(GL_VERTEX_SHADER_ARB
)"
);
ret
=
GL_EXTCALL
(
glCreateShader
(
GL_VERTEX_SHADER
));
checkGLcall
(
"glCreateShader
(GL_VERTEX_SHADER
)"
);
shader_glsl_compile
(
gl_info
,
ret
,
buffer
->
buffer
);
return
ret
;
...
...
@@ -4495,7 +4496,7 @@ static GLuint shader_glsl_generate_pshader(const struct wined3d_context *context
struct
shader_glsl_ctx_priv
priv_ctx
;
/* Create the hw GLSL shader object and assign it as the shader->prgId */
GL
handleARB
shader_obj
=
GL_EXTCALL
(
glCreateShaderObjectARB
(
GL_FRAGMENT_SHADER_ARB
));
GL
uint
shader_id
=
GL_EXTCALL
(
glCreateShader
(
GL_FRAGMENT_SHADER
));
memset
(
&
priv_ctx
,
0
,
sizeof
(
priv_ctx
));
priv_ctx
.
cur_ps_args
=
args
;
...
...
@@ -4542,11 +4543,10 @@ static GLuint shader_glsl_generate_pshader(const struct wined3d_context *context
shader_addline
(
buffer
,
"}
\n
"
);
TRACE
(
"Compiling shader object %u
\n
"
,
shader_obj
);
shader_glsl_compile
(
gl_info
,
shader_
obj
,
buffer
->
buffer
);
TRACE
(
"Compiling shader object %u
.
\n
"
,
shader_id
);
shader_glsl_compile
(
gl_info
,
shader_
id
,
buffer
->
buffer
);
/* Store the shader object */
return
shader_obj
;
return
shader_id
;
}
/* Context activation is done by the caller. */
...
...
@@ -4560,7 +4560,7 @@ static GLuint shader_glsl_generate_vshader(const struct wined3d_context *context
struct
shader_glsl_ctx_priv
priv_ctx
;
/* Create the hw GLSL shader program and assign it as the shader->prgId */
GL
handleARB
shader_obj
=
GL_EXTCALL
(
glCreateShaderObjectARB
(
GL_VERTEX_SHADER_ARB
));
GL
uint
shader_id
=
GL_EXTCALL
(
glCreateShader
(
GL_VERTEX_SHADER
));
shader_addline
(
buffer
,
"#version 120
\n
"
);
...
...
@@ -4617,23 +4617,23 @@ static GLuint shader_glsl_generate_vshader(const struct wined3d_context *context
shader_addline
(
buffer
,
"}
\n
"
);
TRACE
(
"Compiling shader object %u
\n
"
,
shader_obj
);
shader_glsl_compile
(
gl_info
,
shader_
obj
,
buffer
->
buffer
);
TRACE
(
"Compiling shader object %u
.
\n
"
,
shader_id
);
shader_glsl_compile
(
gl_info
,
shader_
id
,
buffer
->
buffer
);
return
shader_
obj
;
return
shader_
id
;
}
/* Context activation is done by the caller. */
static
GL
handleARB
shader_glsl_generate_geometry_shader
(
const
struct
wined3d_context
*
context
,
static
GL
uint
shader_glsl_generate_geometry_shader
(
const
struct
wined3d_context
*
context
,
struct
wined3d_shader_buffer
*
buffer
,
const
struct
wined3d_shader
*
shader
)
{
const
struct
wined3d_shader_reg_maps
*
reg_maps
=
&
shader
->
reg_maps
;
const
struct
wined3d_gl_info
*
gl_info
=
context
->
gl_info
;
const
DWORD
*
function
=
shader
->
function
;
struct
shader_glsl_ctx_priv
priv_ctx
;
GL
handleARB
shader_id
;
GL
uint
shader_id
;
shader_id
=
GL_EXTCALL
(
glCreateShader
ObjectARB
(
GL_GEOMETRY_SHADER_ARB
));
shader_id
=
GL_EXTCALL
(
glCreateShader
(
GL_GEOMETRY_SHADER
));
shader_addline
(
buffer
,
"#version 120
\n
"
);
...
...
@@ -4657,7 +4657,7 @@ static GLhandleARB shader_glsl_generate_geometry_shader(const struct wined3d_con
return
shader_id
;
}
static
GL
handleARB
find_glsl_pshader
(
const
struct
wined3d_context
*
context
,
static
GL
uint
find_glsl_pshader
(
const
struct
wined3d_context
*
context
,
struct
wined3d_shader_buffer
*
buffer
,
struct
wined3d_shader
*
shader
,
const
struct
ps_compile_args
*
args
,
const
struct
ps_np2fixup_info
**
np2fixup_info
)
{
...
...
@@ -4666,7 +4666,7 @@ static GLhandleARB find_glsl_pshader(const struct wined3d_context *context,
struct
ps_np2fixup_info
*
np2fixup
;
UINT
i
;
DWORD
new_size
;
GL
handleARB
ret
;
GL
uint
ret
;
if
(
!
shader
->
backend_data
)
{
...
...
@@ -4690,7 +4690,7 @@ static GLhandleARB find_glsl_pshader(const struct wined3d_context *context,
{
if
(
args
->
np2_fixup
)
*
np2fixup_info
=
&
gl_shaders
[
i
].
np2fixup
;
return
gl_shaders
[
i
].
prgI
d
;
return
gl_shaders
[
i
].
i
d
;
}
}
...
...
@@ -4727,7 +4727,7 @@ static GLhandleARB find_glsl_pshader(const struct wined3d_context *context,
shader_buffer_clear
(
buffer
);
ret
=
shader_glsl_generate_pshader
(
context
,
buffer
,
shader
,
args
,
np2fixup
);
gl_shaders
[
shader_data
->
num_gl_shaders
++
].
prgI
d
=
ret
;
gl_shaders
[
shader_data
->
num_gl_shaders
++
].
i
d
=
ret
;
return
ret
;
}
...
...
@@ -4739,7 +4739,7 @@ static inline BOOL vs_args_equal(const struct vs_compile_args *stored, const str
return
stored
->
fog_src
==
new
->
fog_src
;
}
static
GL
handleARB
find_glsl_vshader
(
const
struct
wined3d_context
*
context
,
static
GL
uint
find_glsl_vshader
(
const
struct
wined3d_context
*
context
,
struct
wined3d_shader_buffer
*
buffer
,
struct
wined3d_shader
*
shader
,
const
struct
vs_compile_args
*
args
)
{
...
...
@@ -4748,7 +4748,7 @@ static GLhandleARB find_glsl_vshader(const struct wined3d_context *context,
DWORD
use_map
=
context
->
stream_info
.
use_map
;
struct
glsl_vs_compiled_shader
*
gl_shaders
,
*
new_array
;
struct
glsl_shader_private
*
shader_data
;
GL
handleARB
ret
;
GL
uint
ret
;
if
(
!
shader
->
backend_data
)
{
...
...
@@ -4769,7 +4769,7 @@ static GLhandleARB find_glsl_vshader(const struct wined3d_context *context,
for
(
i
=
0
;
i
<
shader_data
->
num_gl_shaders
;
++
i
)
{
if
(
vs_args_equal
(
&
gl_shaders
[
i
].
args
,
args
,
use_map
))
return
gl_shaders
[
i
].
prgI
d
;
return
gl_shaders
[
i
].
i
d
;
}
TRACE
(
"No matching GL shader found for shader %p, compiling a new shader.
\n
"
,
shader
);
...
...
@@ -4800,17 +4800,17 @@ static GLhandleARB find_glsl_vshader(const struct wined3d_context *context,
shader_buffer_clear
(
buffer
);
ret
=
shader_glsl_generate_vshader
(
context
,
buffer
,
shader
,
args
);
gl_shaders
[
shader_data
->
num_gl_shaders
++
].
prgI
d
=
ret
;
gl_shaders
[
shader_data
->
num_gl_shaders
++
].
i
d
=
ret
;
return
ret
;
}
static
GL
handleARB
find_glsl_geometry_shader
(
const
struct
wined3d_context
*
context
,
static
GL
uint
find_glsl_geometry_shader
(
const
struct
wined3d_context
*
context
,
struct
wined3d_shader_buffer
*
buffer
,
struct
wined3d_shader
*
shader
)
{
struct
glsl_gs_compiled_shader
*
gl_shaders
;
struct
glsl_shader_private
*
shader_data
;
GL
handleARB
ret
;
GL
uint
ret
;
if
(
!
shader
->
backend_data
)
{
...
...
@@ -4961,10 +4961,10 @@ static void shader_glsl_ffp_vertex_lighting(struct wined3d_shader_buffer *buffer
}
/* Context activation is done by the caller. */
static
GL
handleARB
shader_glsl_generate_ffp_vertex_shader
(
struct
wined3d_shader_buffer
*
buffer
,
static
GL
uint
shader_glsl_generate_ffp_vertex_shader
(
struct
wined3d_shader_buffer
*
buffer
,
const
struct
wined3d_ffp_vs_settings
*
settings
,
const
struct
wined3d_gl_info
*
gl_info
)
{
GL
handleARB
shader_obj
;
GL
uint
shader_obj
;
unsigned
int
i
;
shader_buffer_clear
(
buffer
);
...
...
@@ -5073,7 +5073,7 @@ static GLhandleARB shader_glsl_generate_ffp_vertex_shader(struct wined3d_shader_
shader_addline
(
buffer
,
"}
\n
"
);
shader_obj
=
GL_EXTCALL
(
glCreateShader
ObjectARB
(
GL_VERTEX_SHADER_ARB
));
shader_obj
=
GL_EXTCALL
(
glCreateShader
(
GL_VERTEX_SHADER
));
shader_glsl_compile
(
gl_info
,
shader_obj
,
buffer
->
buffer
);
return
shader_obj
;
...
...
@@ -5334,7 +5334,7 @@ static GLuint shader_glsl_generate_ffp_fragment_shader(struct wined3d_shader_buf
BOOL
tempreg_used
=
FALSE
,
tfactor_used
=
FALSE
;
const
char
*
final_combiner_src
=
"ret"
;
UINT
lowest_disabled_stage
;
GL
handleARB
shader_obj
;
GL
uint
shader_id
;
DWORD
arg0
,
arg1
,
arg2
;
unsigned
int
stage
;
...
...
@@ -5674,9 +5674,9 @@ static GLuint shader_glsl_generate_ffp_fragment_shader(struct wined3d_shader_buf
shader_addline
(
buffer
,
"}
\n
"
);
shader_
obj
=
GL_EXTCALL
(
glCreateShaderObjectARB
(
GL_FRAGMENT_SHADER_ARB
));
shader_glsl_compile
(
gl_info
,
shader_
obj
,
buffer
->
buffer
);
return
shader_
obj
;
shader_
id
=
GL_EXTCALL
(
glCreateShader
(
GL_FRAGMENT_SHADER
));
shader_glsl_compile
(
gl_info
,
shader_
id
,
buffer
->
buffer
);
return
shader_
id
;
}
static
struct
glsl_ffp_vertex_shader
*
shader_glsl_find_ffp_vertex_shader
(
struct
shader_glsl_priv
*
priv
,
...
...
@@ -5722,83 +5722,83 @@ static struct glsl_ffp_fragment_shader *shader_glsl_find_ffp_fragment_shader(str
static
void
shader_glsl_init_vs_uniform_locations
(
const
struct
wined3d_gl_info
*
gl_info
,
GL
handleARB
program_id
,
struct
glsl_vs_program
*
vs
,
unsigned
int
vs_c_count
)
GL
uint
program_id
,
struct
glsl_vs_program
*
vs
,
unsigned
int
vs_c_count
)
{
unsigned
int
i
;
char
name
[
32
];
vs
->
uniform_f_locations
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
GL
handleARB
)
*
gl_info
->
limits
.
glsl_vs_float_constants
);
sizeof
(
GL
uint
)
*
gl_info
->
limits
.
glsl_vs_float_constants
);
for
(
i
=
0
;
i
<
vs_c_count
;
++
i
)
{
snprintf
(
name
,
sizeof
(
name
),
"vs_c[%u]"
,
i
);
vs
->
uniform_f_locations
[
i
]
=
GL_EXTCALL
(
glGetUniformLocation
ARB
(
program_id
,
name
));
vs
->
uniform_f_locations
[
i
]
=
GL_EXTCALL
(
glGetUniformLocation
(
program_id
,
name
));
}
memset
(
&
vs
->
uniform_f_locations
[
vs_c_count
],
0xff
,
(
gl_info
->
limits
.
glsl_vs_float_constants
-
vs_c_count
)
*
sizeof
(
GL
handleARB
));
(
gl_info
->
limits
.
glsl_vs_float_constants
-
vs_c_count
)
*
sizeof
(
GL
uint
));
for
(
i
=
0
;
i
<
MAX_CONST_I
;
++
i
)
{
snprintf
(
name
,
sizeof
(
name
),
"vs_i[%u]"
,
i
);
vs
->
uniform_i_locations
[
i
]
=
GL_EXTCALL
(
glGetUniformLocation
ARB
(
program_id
,
name
));
vs
->
uniform_i_locations
[
i
]
=
GL_EXTCALL
(
glGetUniformLocation
(
program_id
,
name
));
}
for
(
i
=
0
;
i
<
MAX_CONST_B
;
++
i
)
{
snprintf
(
name
,
sizeof
(
name
),
"vs_b[%u]"
,
i
);
vs
->
uniform_b_locations
[
i
]
=
GL_EXTCALL
(
glGetUniformLocation
ARB
(
program_id
,
name
));
vs
->
uniform_b_locations
[
i
]
=
GL_EXTCALL
(
glGetUniformLocation
(
program_id
,
name
));
}
vs
->
pos_fixup_location
=
GL_EXTCALL
(
glGetUniformLocation
ARB
(
program_id
,
"posFixup"
));
vs
->
pos_fixup_location
=
GL_EXTCALL
(
glGetUniformLocation
(
program_id
,
"posFixup"
));
}
static
void
shader_glsl_init_ps_uniform_locations
(
const
struct
wined3d_gl_info
*
gl_info
,
GL
handleARB
program_id
,
struct
glsl_ps_program
*
ps
,
unsigned
int
ps_c_count
)
GL
uint
program_id
,
struct
glsl_ps_program
*
ps
,
unsigned
int
ps_c_count
)
{
unsigned
int
i
;
char
name
[
32
];
ps
->
uniform_f_locations
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
GL
handleARB
)
*
gl_info
->
limits
.
glsl_ps_float_constants
);
sizeof
(
GL
uint
)
*
gl_info
->
limits
.
glsl_ps_float_constants
);
for
(
i
=
0
;
i
<
ps_c_count
;
++
i
)
{
snprintf
(
name
,
sizeof
(
name
),
"ps_c[%u]"
,
i
);
ps
->
uniform_f_locations
[
i
]
=
GL_EXTCALL
(
glGetUniformLocation
ARB
(
program_id
,
name
));
ps
->
uniform_f_locations
[
i
]
=
GL_EXTCALL
(
glGetUniformLocation
(
program_id
,
name
));
}
memset
(
&
ps
->
uniform_f_locations
[
ps_c_count
],
0xff
,
(
gl_info
->
limits
.
glsl_ps_float_constants
-
ps_c_count
)
*
sizeof
(
GL
handleARB
));
(
gl_info
->
limits
.
glsl_ps_float_constants
-
ps_c_count
)
*
sizeof
(
GL
uint
));
for
(
i
=
0
;
i
<
MAX_CONST_I
;
++
i
)
{
snprintf
(
name
,
sizeof
(
name
),
"ps_i[%u]"
,
i
);
ps
->
uniform_i_locations
[
i
]
=
GL_EXTCALL
(
glGetUniformLocation
ARB
(
program_id
,
name
));
ps
->
uniform_i_locations
[
i
]
=
GL_EXTCALL
(
glGetUniformLocation
(
program_id
,
name
));
}
for
(
i
=
0
;
i
<
MAX_CONST_B
;
++
i
)
{
snprintf
(
name
,
sizeof
(
name
),
"ps_b[%u]"
,
i
);
ps
->
uniform_b_locations
[
i
]
=
GL_EXTCALL
(
glGetUniformLocation
ARB
(
program_id
,
name
));
ps
->
uniform_b_locations
[
i
]
=
GL_EXTCALL
(
glGetUniformLocation
(
program_id
,
name
));
}
for
(
i
=
0
;
i
<
MAX_TEXTURES
;
++
i
)
{
snprintf
(
name
,
sizeof
(
name
),
"bumpenv_mat%u"
,
i
);
ps
->
bumpenv_mat_location
[
i
]
=
GL_EXTCALL
(
glGetUniformLocation
ARB
(
program_id
,
name
));
ps
->
bumpenv_mat_location
[
i
]
=
GL_EXTCALL
(
glGetUniformLocation
(
program_id
,
name
));
snprintf
(
name
,
sizeof
(
name
),
"bumpenv_lum_scale%u"
,
i
);
ps
->
bumpenv_lum_scale_location
[
i
]
=
GL_EXTCALL
(
glGetUniformLocation
ARB
(
program_id
,
name
));
ps
->
bumpenv_lum_scale_location
[
i
]
=
GL_EXTCALL
(
glGetUniformLocation
(
program_id
,
name
));
snprintf
(
name
,
sizeof
(
name
),
"bumpenv_lum_offset%u"
,
i
);
ps
->
bumpenv_lum_offset_location
[
i
]
=
GL_EXTCALL
(
glGetUniformLocation
ARB
(
program_id
,
name
));
ps
->
bumpenv_lum_offset_location
[
i
]
=
GL_EXTCALL
(
glGetUniformLocation
(
program_id
,
name
));
snprintf
(
name
,
sizeof
(
name
),
"tss_const%u"
,
i
);
ps
->
tss_constant_location
[
i
]
=
GL_EXTCALL
(
glGetUniformLocation
ARB
(
program_id
,
name
));
ps
->
tss_constant_location
[
i
]
=
GL_EXTCALL
(
glGetUniformLocation
(
program_id
,
name
));
}
ps
->
tex_factor_location
=
GL_EXTCALL
(
glGetUniformLocation
ARB
(
program_id
,
"tex_factor"
));
ps
->
specular_enable_location
=
GL_EXTCALL
(
glGetUniformLocation
ARB
(
program_id
,
"specular_enable"
));
ps
->
np2_fixup_location
=
GL_EXTCALL
(
glGetUniformLocation
ARB
(
program_id
,
"ps_samplerNP2Fixup"
));
ps
->
ycorrection_location
=
GL_EXTCALL
(
glGetUniformLocation
ARB
(
program_id
,
"ycorrection"
));
ps
->
tex_factor_location
=
GL_EXTCALL
(
glGetUniformLocation
(
program_id
,
"tex_factor"
));
ps
->
specular_enable_location
=
GL_EXTCALL
(
glGetUniformLocation
(
program_id
,
"specular_enable"
));
ps
->
np2_fixup_location
=
GL_EXTCALL
(
glGetUniformLocation
(
program_id
,
"ps_samplerNP2Fixup"
));
ps
->
ycorrection_location
=
GL_EXTCALL
(
glGetUniformLocation
(
program_id
,
"ycorrection"
));
}
static
void
shader_glsl_init_uniform_block_bindings
(
const
struct
wined3d_gl_info
*
gl_info
,
GL
handleARB
program_id
,
static
void
shader_glsl_init_uniform_block_bindings
(
const
struct
wined3d_gl_info
*
gl_info
,
GL
uint
program_id
,
const
struct
wined3d_shader_reg_maps
*
reg_maps
,
unsigned
int
base
,
unsigned
int
count
)
{
const
char
*
prefix
=
shader_glsl_get_prefix
(
reg_maps
->
shader_version
.
type
);
...
...
@@ -5828,12 +5828,12 @@ static void set_glsl_shader_program(const struct wined3d_context *context, const
struct
wined3d_shader
*
vshader
=
NULL
;
struct
wined3d_shader
*
gshader
=
NULL
;
struct
wined3d_shader
*
pshader
=
NULL
;
GL
handleARB
programId
=
0
;
GL
handleARB
reorder_shader_id
=
0
;
GL
uint
program_id
=
0
;
GL
uint
reorder_shader_id
=
0
;
unsigned
int
i
;
GL
handleARB
vs_id
=
0
;
GL
handleARB
gs_id
=
0
;
GL
handleARB
ps_id
=
0
;
GL
uint
vs_id
=
0
;
GL
uint
gs_id
=
0
;
GL
uint
ps_id
=
0
;
struct
list
*
ps_list
,
*
vs_list
;
if
(
!
(
context
->
shader_update_mask
&
(
1
<<
WINED3D_SHADER_TYPE_VERTEX
)))
...
...
@@ -5911,12 +5911,12 @@ static void set_glsl_shader_program(const struct wined3d_context *context, const
}
/* If we get to this point, then no matching program exists, so we create one */
program
Id
=
GL_EXTCALL
(
glCreateProgramObjectARB
());
TRACE
(
"Created new GLSL shader program %u
\n
"
,
programI
d
);
program
_id
=
GL_EXTCALL
(
glCreateProgram
());
TRACE
(
"Created new GLSL shader program %u
.
\n
"
,
program_i
d
);
/* Create the entry */
entry
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
struct
glsl_shader_prog_link
));
entry
->
programId
=
programI
d
;
entry
->
id
=
program_i
d
;
entry
->
vs
.
id
=
vs_id
;
entry
->
gs
.
id
=
gs_id
;
entry
->
ps
.
id
=
ps_id
;
...
...
@@ -5931,9 +5931,9 @@ static void set_glsl_shader_program(const struct wined3d_context *context, const
/* Attach GLSL vshader */
if
(
vs_id
)
{
TRACE
(
"Attaching GLSL shader object %u to program %u.
\n
"
,
vs_id
,
program
I
d
);
GL_EXTCALL
(
glAttach
ObjectARB
(
programI
d
,
vs_id
));
checkGLcall
(
"glAttach
ObjectARB
"
);
TRACE
(
"Attaching GLSL shader object %u to program %u.
\n
"
,
vs_id
,
program
_i
d
);
GL_EXTCALL
(
glAttach
Shader
(
program_i
d
,
vs_id
));
checkGLcall
(
"glAttach
Shader
"
);
list_add_head
(
vs_list
,
&
entry
->
vs
.
shader_entry
);
}
...
...
@@ -5944,13 +5944,13 @@ static void set_glsl_shader_program(const struct wined3d_context *context, const
char
tmp_name
[
10
];
reorder_shader_id
=
generate_param_reorder_function
(
&
priv
->
shader_buffer
,
vshader
,
pshader
,
gl_info
);
TRACE
(
"Attaching GLSL shader object %u to program %u
\n
"
,
reorder_shader_id
,
programI
d
);
GL_EXTCALL
(
glAttach
ObjectARB
(
programI
d
,
reorder_shader_id
));
checkGLcall
(
"glAttach
ObjectARB
"
);
TRACE
(
"Attaching GLSL shader object %u to program %u
.
\n
"
,
reorder_shader_id
,
program_i
d
);
GL_EXTCALL
(
glAttach
Shader
(
program_i
d
,
reorder_shader_id
));
checkGLcall
(
"glAttach
Shader
"
);
/* Flag the reorder function for deletion, then it will be freed automatically when the program
* is destroyed
*/
GL_EXTCALL
(
glDelete
ObjectARB
(
reorder_shader_id
));
GL_EXTCALL
(
glDelete
Shader
(
reorder_shader_id
));
/* Bind vertex attributes to a corresponding index number to match
* the same index numbers as ARB_vertex_programs (makes loading
...
...
@@ -5966,26 +5966,26 @@ static void set_glsl_shader_program(const struct wined3d_context *context, const
if
(
!
(
map
&
1
))
continue
;
snprintf
(
tmp_name
,
sizeof
(
tmp_name
),
"vs_in%u"
,
i
);
GL_EXTCALL
(
glBindAttribLocation
ARB
(
programI
d
,
i
,
tmp_name
));
GL_EXTCALL
(
glBindAttribLocation
(
program_i
d
,
i
,
tmp_name
));
}
checkGLcall
(
"glBindAttribLocation
ARB
"
);
checkGLcall
(
"glBindAttribLocation"
);
}
if
(
gshader
)
{
TRACE
(
"Attaching GLSL geometry shader object %u to program %u.
\n
"
,
gs_id
,
program
I
d
);
GL_EXTCALL
(
glAttach
ObjectARB
(
programI
d
,
gs_id
));
checkGLcall
(
"glAttach
ObjectARB
"
);
TRACE
(
"Attaching GLSL geometry shader object %u to program %u.
\n
"
,
gs_id
,
program
_i
d
);
GL_EXTCALL
(
glAttach
Shader
(
program_i
d
,
gs_id
));
checkGLcall
(
"glAttach
Shader
"
);
TRACE
(
"input type %s, output type %s, vertices out %u.
\n
"
,
debug_d3dprimitivetype
(
gshader
->
u
.
gs
.
input_type
),
debug_d3dprimitivetype
(
gshader
->
u
.
gs
.
output_type
),
gshader
->
u
.
gs
.
vertices_out
);
GL_EXTCALL
(
glProgramParameteriARB
(
program
I
d
,
GL_GEOMETRY_INPUT_TYPE_ARB
,
GL_EXTCALL
(
glProgramParameteriARB
(
program
_i
d
,
GL_GEOMETRY_INPUT_TYPE_ARB
,
gl_primitive_type_from_d3d
(
gshader
->
u
.
gs
.
input_type
)));
GL_EXTCALL
(
glProgramParameteriARB
(
program
I
d
,
GL_GEOMETRY_OUTPUT_TYPE_ARB
,
GL_EXTCALL
(
glProgramParameteriARB
(
program
_i
d
,
GL_GEOMETRY_OUTPUT_TYPE_ARB
,
gl_primitive_type_from_d3d
(
gshader
->
u
.
gs
.
output_type
)));
GL_EXTCALL
(
glProgramParameteriARB
(
program
I
d
,
GL_GEOMETRY_VERTICES_OUT_ARB
,
GL_EXTCALL
(
glProgramParameteriARB
(
program
_i
d
,
GL_GEOMETRY_VERTICES_OUT_ARB
,
gshader
->
u
.
gs
.
vertices_out
));
checkGLcall
(
"glProgramParameteriARB"
);
...
...
@@ -5995,28 +5995,28 @@ static void set_glsl_shader_program(const struct wined3d_context *context, const
/* Attach GLSL pshader */
if
(
ps_id
)
{
TRACE
(
"Attaching GLSL shader object %u to program %u.
\n
"
,
ps_id
,
program
I
d
);
GL_EXTCALL
(
glAttach
ObjectARB
(
programI
d
,
ps_id
));
checkGLcall
(
"glAttach
ObjectARB
"
);
TRACE
(
"Attaching GLSL shader object %u to program %u.
\n
"
,
ps_id
,
program
_i
d
);
GL_EXTCALL
(
glAttach
Shader
(
program_i
d
,
ps_id
));
checkGLcall
(
"glAttach
Shader
"
);
list_add_head
(
ps_list
,
&
entry
->
ps
.
shader_entry
);
}
/* Link the program */
TRACE
(
"Linking GLSL shader program %u
\n
"
,
programI
d
);
GL_EXTCALL
(
glLinkProgram
ARB
(
programI
d
));
shader_glsl_validate_link
(
gl_info
,
program
I
d
);
TRACE
(
"Linking GLSL shader program %u
.
\n
"
,
program_i
d
);
GL_EXTCALL
(
glLinkProgram
(
program_i
d
));
shader_glsl_validate_link
(
gl_info
,
program
_i
d
);
shader_glsl_init_vs_uniform_locations
(
gl_info
,
program
I
d
,
&
entry
->
vs
,
shader_glsl_init_vs_uniform_locations
(
gl_info
,
program
_i
d
,
&
entry
->
vs
,
vshader
?
min
(
vshader
->
limits
->
constant_float
,
gl_info
->
limits
.
glsl_vs_float_constants
)
:
0
);
shader_glsl_init_ps_uniform_locations
(
gl_info
,
program
I
d
,
&
entry
->
ps
,
shader_glsl_init_ps_uniform_locations
(
gl_info
,
program
_i
d
,
&
entry
->
ps
,
pshader
?
min
(
pshader
->
limits
->
constant_float
,
gl_info
->
limits
.
glsl_ps_float_constants
)
:
0
);
checkGLcall
(
"Find glsl program uniform locations"
);
if
(
pshader
&&
pshader
->
reg_maps
.
shader_version
.
major
>=
3
&&
pshader
->
u
.
ps
.
declared_in_count
>
vec4_varyings
(
3
,
gl_info
))
{
TRACE
(
"Shader %d needs vertex color clamping disabled
\n
"
,
programI
d
);
TRACE
(
"Shader %d needs vertex color clamping disabled
.
\n
"
,
program_i
d
);
entry
->
vs
.
vertex_color_clamp
=
GL_FALSE
;
}
else
...
...
@@ -6025,8 +6025,8 @@ static void set_glsl_shader_program(const struct wined3d_context *context, const
}
/* Set the shader to allow uniform loading on it */
GL_EXTCALL
(
glUseProgram
ObjectARB
(
programI
d
));
checkGLcall
(
"glUseProgram
ObjectARB(programId)
"
);
GL_EXTCALL
(
glUseProgram
(
program_i
d
));
checkGLcall
(
"glUseProgram"
);
/* Load the vertex and pixel samplers now. The function that finds the mappings makes sure
* that it stays the same for each vertexshader-pixelshader pair(=linked glsl program). If
...
...
@@ -6035,7 +6035,7 @@ static void set_glsl_shader_program(const struct wined3d_context *context, const
* supports enough samplers to allow the max number of vertex samplers with all possible
* fixed function fragment processing setups. So once the program is linked these samplers
* won't change. */
shader_glsl_load_samplers
(
gl_info
,
context
->
tex_unit_map
,
program
I
d
);
shader_glsl_load_samplers
(
gl_info
,
context
->
tex_unit_map
,
program
_i
d
);
entry
->
constant_update_mask
=
0
;
if
(
vshader
)
...
...
@@ -6047,12 +6047,12 @@ static void set_glsl_shader_program(const struct wined3d_context *context, const
entry
->
constant_update_mask
|=
WINED3D_SHADER_CONST_VS_B
;
entry
->
constant_update_mask
|=
WINED3D_SHADER_CONST_VS_POS_FIXUP
;
shader_glsl_init_uniform_block_bindings
(
gl_info
,
program
I
d
,
&
vshader
->
reg_maps
,
shader_glsl_init_uniform_block_bindings
(
gl_info
,
program
_i
d
,
&
vshader
->
reg_maps
,
0
,
gl_info
->
limits
.
vertex_uniform_blocks
);
}
if
(
gshader
)
shader_glsl_init_uniform_block_bindings
(
gl_info
,
program
I
d
,
&
gshader
->
reg_maps
,
shader_glsl_init_uniform_block_bindings
(
gl_info
,
program
_i
d
,
&
gshader
->
reg_maps
,
gl_info
->
limits
.
vertex_uniform_blocks
,
gl_info
->
limits
.
geometry_uniform_blocks
);
if
(
ps_id
)
...
...
@@ -6067,7 +6067,7 @@ static void set_glsl_shader_program(const struct wined3d_context *context, const
if
(
entry
->
ps
.
ycorrection_location
!=
-
1
)
entry
->
constant_update_mask
|=
WINED3D_SHADER_CONST_PS_Y_CORR
;
shader_glsl_init_uniform_block_bindings
(
gl_info
,
program
I
d
,
&
pshader
->
reg_maps
,
shader_glsl_init_uniform_block_bindings
(
gl_info
,
program
_i
d
,
&
pshader
->
reg_maps
,
gl_info
->
limits
.
vertex_uniform_blocks
+
gl_info
->
limits
.
geometry_uniform_blocks
,
gl_info
->
limits
.
fragment_uniform_blocks
);
}
...
...
@@ -6091,10 +6091,10 @@ static void set_glsl_shader_program(const struct wined3d_context *context, const
}
/* Context activation is done by the caller. */
static
GL
handleARB
create_glsl_blt_shader
(
const
struct
wined3d_gl_info
*
gl_info
,
enum
tex_types
tex_type
,
BOOL
masked
)
static
GL
uint
create_glsl_blt_shader
(
const
struct
wined3d_gl_info
*
gl_info
,
enum
tex_types
tex_type
,
BOOL
masked
)
{
GL
handleARB
program_id
;
GL
handleARB
vshader_id
,
pshader_id
;
GL
uint
program_id
;
GL
uint
vshader_id
,
pshader_id
;
const
char
*
blt_pshader
;
static
const
char
blt_vshader
[]
=
...
...
@@ -6179,24 +6179,24 @@ static GLhandleARB create_glsl_blt_shader(const struct wined3d_gl_info *gl_info,
return
0
;
}
vshader_id
=
GL_EXTCALL
(
glCreateShader
ObjectARB
(
GL_VERTEX_SHADER_ARB
));
vshader_id
=
GL_EXTCALL
(
glCreateShader
(
GL_VERTEX_SHADER
));
shader_glsl_compile
(
gl_info
,
vshader_id
,
blt_vshader
);
pshader_id
=
GL_EXTCALL
(
glCreateShader
ObjectARB
(
GL_FRAGMENT_SHADER_ARB
));
pshader_id
=
GL_EXTCALL
(
glCreateShader
(
GL_FRAGMENT_SHADER
));
shader_glsl_compile
(
gl_info
,
pshader_id
,
blt_pshader
);
program_id
=
GL_EXTCALL
(
glCreateProgram
ObjectARB
());
GL_EXTCALL
(
glAttach
ObjectARB
(
program_id
,
vshader_id
));
GL_EXTCALL
(
glAttach
ObjectARB
(
program_id
,
pshader_id
));
GL_EXTCALL
(
glLinkProgram
ARB
(
program_id
));
program_id
=
GL_EXTCALL
(
glCreateProgram
());
GL_EXTCALL
(
glAttach
Shader
(
program_id
,
vshader_id
));
GL_EXTCALL
(
glAttach
Shader
(
program_id
,
pshader_id
));
GL_EXTCALL
(
glLinkProgram
(
program_id
));
shader_glsl_validate_link
(
gl_info
,
program_id
);
/* Once linked we can mark the shaders for deletion. They will be deleted once the program
* is destroyed
*/
GL_EXTCALL
(
glDelete
ObjectARB
(
vshader_id
));
GL_EXTCALL
(
glDelete
ObjectARB
(
pshader_id
));
GL_EXTCALL
(
glDelete
Shader
(
vshader_id
));
GL_EXTCALL
(
glDelete
Shader
(
pshader_id
));
return
program_id
;
}
...
...
@@ -6207,7 +6207,7 @@ static void shader_glsl_select(void *shader_priv, struct wined3d_context *contex
struct
glsl_context_data
*
ctx_data
=
context
->
shader_backend_data
;
const
struct
wined3d_gl_info
*
gl_info
=
context
->
gl_info
;
struct
shader_glsl_priv
*
priv
=
shader_priv
;
GL
handleARB
program_id
=
0
,
prev_id
=
0
;
GL
uint
program_id
=
0
,
prev_id
=
0
;
GLenum
old_vertex_color_clamp
,
current_vertex_color_clamp
;
priv
->
vertex_pipe
->
vp_enable
(
gl_info
,
!
use_vs
(
state
));
...
...
@@ -6215,7 +6215,7 @@ static void shader_glsl_select(void *shader_priv, struct wined3d_context *contex
if
(
ctx_data
->
glsl_program
)
{
prev_id
=
ctx_data
->
glsl_program
->
programI
d
;
prev_id
=
ctx_data
->
glsl_program
->
i
d
;
old_vertex_color_clamp
=
ctx_data
->
glsl_program
->
vs
.
vertex_color_clamp
;
}
else
...
...
@@ -6228,7 +6228,7 @@ static void shader_glsl_select(void *shader_priv, struct wined3d_context *contex
if
(
ctx_data
->
glsl_program
)
{
program_id
=
ctx_data
->
glsl_program
->
programI
d
;
program_id
=
ctx_data
->
glsl_program
->
i
d
;
current_vertex_color_clamp
=
ctx_data
->
glsl_program
->
vs
.
vertex_color_clamp
;
}
else
...
...
@@ -6254,8 +6254,8 @@ static void shader_glsl_select(void *shader_priv, struct wined3d_context *contex
if
(
prev_id
!=
program_id
)
{
GL_EXTCALL
(
glUseProgram
ObjectARB
(
program_id
));
checkGLcall
(
"glUseProgram
ObjectARB
"
);
GL_EXTCALL
(
glUseProgram
(
program_id
));
checkGLcall
(
"glUseProgram"
);
if
(
program_id
)
context
->
constant_update_mask
|=
ctx_data
->
glsl_program
->
constant_update_mask
;
...
...
@@ -6280,8 +6280,8 @@ static void shader_glsl_disable(void *shader_priv, struct wined3d_context *conte
struct
shader_glsl_priv
*
priv
=
shader_priv
;
shader_glsl_invalidate_current_program
(
context
);
GL_EXTCALL
(
glUseProgram
ObjectARB
(
0
));
checkGLcall
(
"glUseProgram
ObjectARB
"
);
GL_EXTCALL
(
glUseProgram
(
0
));
checkGLcall
(
"glUseProgram"
);
priv
->
vertex_pipe
->
vp_enable
(
gl_info
,
FALSE
);
priv
->
fragment_pipe
->
enable_extension
(
gl_info
,
FALSE
);
...
...
@@ -6299,26 +6299,26 @@ static void shader_glsl_select_depth_blt(void *shader_priv, const struct wined3d
{
BOOL
masked
=
ds_mask_size
->
cx
&&
ds_mask_size
->
cy
;
struct
shader_glsl_priv
*
priv
=
shader_priv
;
GL
handleARB
*
blt_program
;
GL
uint
*
blt_program
;
GLint
loc
;
blt_program
=
masked
?
&
priv
->
depth_blt_program_masked
[
tex_type
]
:
&
priv
->
depth_blt_program_full
[
tex_type
];
if
(
!*
blt_program
)
{
*
blt_program
=
create_glsl_blt_shader
(
gl_info
,
tex_type
,
masked
);
loc
=
GL_EXTCALL
(
glGetUniformLocation
ARB
(
*
blt_program
,
"sampler"
));
GL_EXTCALL
(
glUseProgram
ObjectARB
(
*
blt_program
));
GL_EXTCALL
(
glUniform1i
ARB
(
loc
,
0
));
loc
=
GL_EXTCALL
(
glGetUniformLocation
(
*
blt_program
,
"sampler"
));
GL_EXTCALL
(
glUseProgram
(
*
blt_program
));
GL_EXTCALL
(
glUniform1i
(
loc
,
0
));
}
else
{
GL_EXTCALL
(
glUseProgram
ObjectARB
(
*
blt_program
));
GL_EXTCALL
(
glUseProgram
(
*
blt_program
));
}
if
(
masked
)
{
loc
=
GL_EXTCALL
(
glGetUniformLocation
ARB
(
*
blt_program
,
"mask"
));
GL_EXTCALL
(
glUniform4f
ARB
(
loc
,
0
.
0
f
,
0
.
0
f
,
(
float
)
ds_mask_size
->
cx
,
(
float
)
ds_mask_size
->
cy
));
loc
=
GL_EXTCALL
(
glGetUniformLocation
(
*
blt_program
,
"mask"
));
GL_EXTCALL
(
glUniform4f
(
loc
,
0
.
0
f
,
0
.
0
f
,
(
float
)
ds_mask_size
->
cx
,
(
float
)
ds_mask_size
->
cy
));
}
}
...
...
@@ -6326,13 +6326,13 @@ static void shader_glsl_select_depth_blt(void *shader_priv, const struct wined3d
static
void
shader_glsl_deselect_depth_blt
(
void
*
shader_priv
,
const
struct
wined3d_gl_info
*
gl_info
)
{
const
struct
glsl_context_data
*
ctx_data
=
context_get_current
()
->
shader_backend_data
;
GL
handleARB
program_id
;
GL
uint
program_id
;
program_id
=
ctx_data
->
glsl_program
?
ctx_data
->
glsl_program
->
programI
d
:
0
;
program_id
=
ctx_data
->
glsl_program
?
ctx_data
->
glsl_program
->
i
d
:
0
;
if
(
program_id
)
TRACE
(
"Using GLSL program %u
\n
"
,
program_id
);
GL_EXTCALL
(
glUseProgram
ObjectARB
(
program_id
));
checkGLcall
(
"glUseProgram
ObjectARB
"
);
GL_EXTCALL
(
glUseProgram
(
program_id
));
checkGLcall
(
"glUseProgram"
);
}
static
void
shader_glsl_invalidate_contexts_program
(
struct
wined3d_device
*
device
,
...
...
@@ -6386,9 +6386,9 @@ static void shader_glsl_destroy(struct wined3d_shader *shader)
for
(
i
=
0
;
i
<
shader_data
->
num_gl_shaders
;
++
i
)
{
TRACE
(
"Deleting pixel shader %u.
\n
"
,
gl_shaders
[
i
].
prgI
d
);
GL_EXTCALL
(
glDelete
ObjectARB
(
gl_shaders
[
i
].
prgI
d
));
checkGLcall
(
"glDelete
ObjectARB
"
);
TRACE
(
"Deleting pixel shader %u.
\n
"
,
gl_shaders
[
i
].
i
d
);
GL_EXTCALL
(
glDelete
Shader
(
gl_shaders
[
i
].
i
d
));
checkGLcall
(
"glDelete
Shader
"
);
}
HeapFree
(
GetProcessHeap
(),
0
,
shader_data
->
gl_shaders
.
ps
);
...
...
@@ -6408,9 +6408,9 @@ 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
].
prgI
d
);
GL_EXTCALL
(
glDelete
ObjectARB
(
gl_shaders
[
i
].
prgI
d
));
checkGLcall
(
"glDelete
ObjectARB
"
);
TRACE
(
"Deleting vertex shader %u.
\n
"
,
gl_shaders
[
i
].
i
d
);
GL_EXTCALL
(
glDelete
Shader
(
gl_shaders
[
i
].
i
d
));
checkGLcall
(
"glDelete
Shader
"
);
}
HeapFree
(
GetProcessHeap
(),
0
,
shader_data
->
gl_shaders
.
vs
);
...
...
@@ -6431,8 +6431,8 @@ static void shader_glsl_destroy(struct wined3d_shader *shader)
for
(
i
=
0
;
i
<
shader_data
->
num_gl_shaders
;
++
i
)
{
TRACE
(
"Deleting geometry shader %u.
\n
"
,
gl_shaders
[
i
].
id
);
GL_EXTCALL
(
glDelete
ObjectARB
(
gl_shaders
[
i
].
id
));
checkGLcall
(
"glDelete
ObjectARB
"
);
GL_EXTCALL
(
glDelete
Shader
(
gl_shaders
[
i
].
id
));
checkGLcall
(
"glDelete
Shader
"
);
}
HeapFree
(
GetProcessHeap
(),
0
,
shader_data
->
gl_shaders
.
gs
);
...
...
@@ -6602,11 +6602,11 @@ static void shader_glsl_free(struct wined3d_device *device)
{
if
(
priv
->
depth_blt_program_full
[
i
])
{
GL_EXTCALL
(
glDelete
ObjectARB
(
priv
->
depth_blt_program_full
[
i
]));
GL_EXTCALL
(
glDelete
Program
(
priv
->
depth_blt_program_full
[
i
]));
}
if
(
priv
->
depth_blt_program_masked
[
i
])
{
GL_EXTCALL
(
glDelete
ObjectARB
(
priv
->
depth_blt_program_masked
[
i
]));
GL_EXTCALL
(
glDelete
Program
(
priv
->
depth_blt_program_masked
[
i
]));
}
}
...
...
@@ -6923,7 +6923,7 @@ static void shader_glsl_free_ffp_vertex_shader(struct wine_rb_entry *entry, void
{
delete_glsl_program_entry
(
ctx
->
priv
,
ctx
->
gl_info
,
program
);
}
ctx
->
gl_info
->
gl_ops
.
ext
.
p_glDelete
ObjectARB
(
shader
->
id
);
ctx
->
gl_info
->
gl_ops
.
ext
.
p_glDelete
Shader
(
shader
->
id
);
HeapFree
(
GetProcessHeap
(),
0
,
shader
);
}
...
...
@@ -7195,7 +7195,7 @@ static void shader_glsl_free_ffp_fragment_shader(struct wine_rb_entry *entry, vo
{
delete_glsl_program_entry
(
ctx
->
priv
,
ctx
->
gl_info
,
program
);
}
ctx
->
gl_info
->
gl_ops
.
ext
.
p_glDelete
ObjectARB
(
shader
->
id
);
ctx
->
gl_info
->
gl_ops
.
ext
.
p_glDelete
Shader
(
shader
->
id
);
HeapFree
(
GetProcessHeap
(),
0
,
shader
);
}
...
...
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