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
bfec6c35
Commit
bfec6c35
authored
Nov 06, 2007
by
Stefan Dösinger
Committed by
Alexandre Julliard
Nov 09, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Store the special uniforms' locations in the linked program.
parent
cd1812b4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
26 deletions
+26
-26
glsl_shader.c
dlls/wined3d/glsl_shader.c
+19
-26
wined3d_private.h
dlls/wined3d/wined3d_private.h
+7
-0
No files found.
dlls/wined3d/glsl_shader.c
View file @
bfec6c35
...
...
@@ -353,19 +353,18 @@ void shader_glsl_load_constants(
GLhandleARB
*
constant_locations
;
struct
list
*
constant_list
;
GLhandleARB
programId
;
GLint
pos
;
struct
glsl_shader_prog_link
*
prog
=
stateBlock
->
glsl_program
;
if
(
!
stateBlock
->
glsl_program
)
{
if
(
!
prog
)
{
/* No GLSL program set - nothing to do. */
return
;
}
programId
=
stateBlock
->
glsl_program
->
programId
;
programId
=
prog
->
programId
;
if
(
useVertexShader
)
{
IWineD3DBaseShaderImpl
*
vshader
=
(
IWineD3DBaseShaderImpl
*
)
stateBlock
->
vertexShader
;
GLint
pos
;
constant_locations
=
stateBlock
->
glsl_program
->
vuniformF_locations
;
constant_locations
=
prog
->
vuniformF_locations
;
constant_list
=
&
stateBlock
->
set_vconstantsF
;
/* Load vertex shader samplers */
...
...
@@ -386,9 +385,7 @@ void shader_glsl_load_constants(
stateBlock
->
changed
.
vertexShaderConstantsB
);
/* Upload the position fixup params */
pos
=
GL_EXTCALL
(
glGetUniformLocationARB
(
programId
,
"posFixup"
));
checkGLcall
(
"glGetUniformLocationARB"
);
GL_EXTCALL
(
glUniform4fvARB
(
pos
,
1
,
&
deviceImpl
->
posFixup
[
0
]));
GL_EXTCALL
(
glUniform4fvARB
(
prog
->
posFixup_location
,
1
,
&
deviceImpl
->
posFixup
[
0
]));
checkGLcall
(
"glUniform4fvARB"
);
}
...
...
@@ -421,9 +418,7 @@ void shader_glsl_load_constants(
*/
if
(((
IWineD3DPixelShaderImpl
*
)
pshader
)
->
needsbumpmat
!=
-
1
)
{
float
*
data
=
(
float
*
)
&
stateBlock
->
textureState
[(
int
)
((
IWineD3DPixelShaderImpl
*
)
pshader
)
->
needsbumpmat
][
WINED3DTSS_BUMPENVMAT00
];
pos
=
GL_EXTCALL
(
glGetUniformLocationARB
(
programId
,
"bumpenvmat"
));
checkGLcall
(
"glGetUniformLocationARB"
);
GL_EXTCALL
(
glUniformMatrix2fvARB
(
pos
,
1
,
0
,
data
));
GL_EXTCALL
(
glUniformMatrix2fvARB
(
prog
->
bumpenvmat_location
,
1
,
0
,
data
));
checkGLcall
(
"glUniformMatrix2fvARB"
);
/* texbeml needs the luminance scale and offset too. If texbeml is used, needsbumpmat
...
...
@@ -434,13 +429,9 @@ void shader_glsl_load_constants(
GLfloat
*
scale
=
(
GLfloat
*
)
&
stateBlock
->
textureState
[
stage
][
WINED3DTSS_BUMPENVLSCALE
];
GLfloat
*
offset
=
(
GLfloat
*
)
&
stateBlock
->
textureState
[
stage
][
WINED3DTSS_BUMPENVLOFFSET
];
pos
=
GL_EXTCALL
(
glGetUniformLocationARB
(
programId
,
"luminancescale"
));
checkGLcall
(
"glGetUniformLocationARB"
);
GL_EXTCALL
(
glUniform1fvARB
(
pos
,
1
,
scale
));
GL_EXTCALL
(
glUniform1fvARB
(
prog
->
luminancescale_location
,
1
,
scale
));
checkGLcall
(
"glUniform1fvARB"
);
pos
=
GL_EXTCALL
(
glGetUniformLocationARB
(
programId
,
"luminanceoffset"
));
checkGLcall
(
"glGetUniformLocationARB"
);
GL_EXTCALL
(
glUniform1fvARB
(
pos
,
1
,
offset
));
GL_EXTCALL
(
glUniform1fvARB
(
prog
->
luminanceoffset_location
,
1
,
offset
));
checkGLcall
(
"glUniform1fvARB"
);
}
}
else
if
(((
IWineD3DPixelShaderImpl
*
)
pshader
)
->
srgb_enabled
&&
...
...
@@ -462,17 +453,11 @@ void shader_glsl_load_constants(
mul_low
[
2
]
=
1
.
0
;
mul_low
[
3
]
=
1
.
0
;
}
pos
=
GL_EXTCALL
(
glGetUniformLocationARB
(
programId
,
"srgb_comparison"
));
checkGLcall
(
"glGetUniformLocationARB"
);
GL_EXTCALL
(
glUniform4fvARB
(
pos
,
1
,
comparison
));
pos
=
GL_EXTCALL
(
glGetUniformLocationARB
(
programId
,
"srgb_mul_low"
));
checkGLcall
(
"glGetUniformLocationARB"
);
GL_EXTCALL
(
glUniform4fvARB
(
pos
,
1
,
mul_low
));
GL_EXTCALL
(
glUniform4fvARB
(
prog
->
srgb_comparison_location
,
1
,
comparison
));
GL_EXTCALL
(
glUniform4fvARB
(
prog
->
srgb_mul_low_location
,
1
,
mul_low
));
}
if
(((
IWineD3DPixelShaderImpl
*
)
pshader
)
->
vpos_uniform
)
{
float
correction_params
[
4
];
pos
=
GL_EXTCALL
(
glGetUniformLocationARB
(
programId
,
"ycorrection"
));
checkGLcall
(
"glGetUniformLocationARB"
);
if
(
deviceImpl
->
render_offscreen
)
{
correction_params
[
0
]
=
0
.
0
;
correction_params
[
1
]
=
1
.
0
;
...
...
@@ -481,7 +466,7 @@ void shader_glsl_load_constants(
correction_params
[
0
]
=
((
IWineD3DSurfaceImpl
*
)
deviceImpl
->
render_targets
[
0
])
->
currentDesc
.
Height
;
correction_params
[
1
]
=
-
1
.
0
;
}
GL_EXTCALL
(
glUniform4fvARB
(
p
os
,
1
,
correction_params
));
GL_EXTCALL
(
glUniform4fvARB
(
p
rog
->
ycorrection_location
,
1
,
correction_params
));
}
}
}
...
...
@@ -3056,6 +3041,14 @@ static void set_glsl_shader_program(IWineD3DDevice *iface, BOOL use_ps, BOOL use
snprintf
(
glsl_name
,
sizeof
(
glsl_name
),
"PC[%i]"
,
i
);
entry
->
puniformF_locations
[
i
]
=
GL_EXTCALL
(
glGetUniformLocationARB
(
programId
,
glsl_name
));
}
entry
->
posFixup_location
=
GL_EXTCALL
(
glGetUniformLocationARB
(
programId
,
"posFixup"
));
entry
->
bumpenvmat_location
=
GL_EXTCALL
(
glGetUniformLocationARB
(
programId
,
"bumpenvmat"
));
entry
->
luminancescale_location
=
GL_EXTCALL
(
glGetUniformLocationARB
(
programId
,
"luminancescale"
));
entry
->
luminanceoffset_location
=
GL_EXTCALL
(
glGetUniformLocationARB
(
programId
,
"luminanceoffset"
));
entry
->
srgb_comparison_location
=
GL_EXTCALL
(
glGetUniformLocationARB
(
programId
,
"srgb_comparison"
));
entry
->
srgb_mul_low_location
=
GL_EXTCALL
(
glGetUniformLocationARB
(
programId
,
"srgb_mul_low"
));
entry
->
ycorrection_location
=
GL_EXTCALL
(
glGetUniformLocationARB
(
programId
,
"ycorrection"
));
}
static
GLhandleARB
create_glsl_blt_shader
(
WineD3D_GL_Info
*
gl_info
)
{
...
...
dlls/wined3d/wined3d_private.h
View file @
bfec6c35
...
...
@@ -1611,6 +1611,13 @@ struct glsl_shader_prog_link {
GLhandleARB
programId
;
GLhandleARB
*
vuniformF_locations
;
GLhandleARB
*
puniformF_locations
;
GLhandleARB
posFixup_location
;
GLhandleARB
bumpenvmat_location
;
GLhandleARB
luminancescale_location
;
GLhandleARB
luminanceoffset_location
;
GLhandleARB
srgb_comparison_location
;
GLhandleARB
srgb_mul_low_location
;
GLhandleARB
ycorrection_location
;
GLhandleARB
vshader
;
GLhandleARB
pshader
;
};
...
...
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