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
6fd4f8f6
Commit
6fd4f8f6
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 integer uniform locations.
parent
bfec6c35
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
23 deletions
+23
-23
glsl_shader.c
dlls/wined3d/glsl_shader.c
+21
-23
wined3d_private.h
dlls/wined3d/wined3d_private.h
+2
-0
No files found.
dlls/wined3d/glsl_shader.c
View file @
6fd4f8f6
...
...
@@ -230,15 +230,12 @@ static void shader_glsl_load_constantsI(
IWineD3DBaseShaderImpl
*
This
,
WineD3D_GL_Info
*
gl_info
,
GLhandleARB
programId
,
GLhandleARB
locations
[
MAX_CONST_I
],
unsigned
max_constants
,
int
*
constants
,
BOOL
*
constants_set
)
{
GLhandleARB
tmp_loc
;
int
i
;
char
tmp_name
[
8
];
char
is_pshader
=
shader_is_pshader_version
(
This
->
baseShader
.
hex_version
);
const
char
*
prefix
=
is_pshader
?
"PI"
:
"VI"
;
struct
list
*
ptr
;
for
(
i
=
0
;
i
<
max_constants
;
++
i
)
{
...
...
@@ -247,15 +244,9 @@ static void shader_glsl_load_constantsI(
TRACE_
(
d3d_constants
)(
"Loading constants %i: %i, %i, %i, %i
\n
"
,
i
,
constants
[
i
*
4
],
constants
[
i
*
4
+
1
],
constants
[
i
*
4
+
2
],
constants
[
i
*
4
+
3
]);
/* TODO: Benchmark and see if it would be beneficial to store the
* locations of the constants to avoid looking up each time */
snprintf
(
tmp_name
,
sizeof
(
tmp_name
),
"%s[%i]"
,
prefix
,
i
);
tmp_loc
=
GL_EXTCALL
(
glGetUniformLocationARB
(
programId
,
tmp_name
));
if
(
tmp_loc
!=
-
1
)
{
/* We found this uniform name in the program - go ahead and send the data */
GL_EXTCALL
(
glUniform4ivARB
(
tmp_loc
,
1
,
&
constants
[
i
*
4
]));
checkGLcall
(
"glUniform4ivARB"
);
}
/* We found this uniform name in the program - go ahead and send the data */
GL_EXTCALL
(
glUniform4ivARB
(
locations
[
i
],
1
,
&
constants
[
i
*
4
]));
checkGLcall
(
"glUniform4ivARB"
);
}
}
...
...
@@ -269,13 +260,9 @@ static void shader_glsl_load_constantsI(
TRACE_
(
d3d_constants
)(
"Loading local constants %i: %i, %i, %i, %i
\n
"
,
idx
,
values
[
0
],
values
[
1
],
values
[
2
],
values
[
3
]);
snprintf
(
tmp_name
,
sizeof
(
tmp_name
),
"%s[%i]"
,
prefix
,
idx
);
tmp_loc
=
GL_EXTCALL
(
glGetUniformLocationARB
(
programId
,
tmp_name
));
if
(
tmp_loc
!=
-
1
)
{
/* We found this uniform name in the program - go ahead and send the data */
GL_EXTCALL
(
glUniform4ivARB
(
tmp_loc
,
1
,
values
));
checkGLcall
(
"glUniform4ivARB"
);
}
/* We found this uniform name in the program - go ahead and send the data */
GL_EXTCALL
(
glUniform4ivARB
(
locations
[
idx
],
1
,
values
));
checkGLcall
(
"glUniform4ivARB"
);
ptr
=
list_next
(
&
This
->
baseShader
.
constantsI
,
ptr
);
}
}
...
...
@@ -375,7 +362,8 @@ void shader_glsl_load_constants(
stateBlock
->
vertexShaderConstantF
,
constant_locations
,
constant_list
);
/* Load DirectX 9 integer constants/uniforms for vertex shader */
shader_glsl_load_constantsI
(
vshader
,
gl_info
,
programId
,
MAX_CONST_I
,
shader_glsl_load_constantsI
(
vshader
,
gl_info
,
programId
,
prog
->
vuniformI_locations
,
MAX_CONST_I
,
stateBlock
->
vertexShaderConstantI
,
stateBlock
->
changed
.
vertexShaderConstantsI
);
...
...
@@ -393,7 +381,7 @@ void shader_glsl_load_constants(
IWineD3DBaseShaderImpl
*
pshader
=
(
IWineD3DBaseShaderImpl
*
)
stateBlock
->
pixelShader
;
constant_locations
=
stateBlock
->
glsl_program
->
puniformF_locations
;
constant_locations
=
prog
->
puniformF_locations
;
constant_list
=
&
stateBlock
->
set_pconstantsF
;
/* Load pixel shader samplers */
...
...
@@ -404,7 +392,8 @@ void shader_glsl_load_constants(
stateBlock
->
pixelShaderConstantF
,
constant_locations
,
constant_list
);
/* Load DirectX 9 integer constants/uniforms for pixel shader */
shader_glsl_load_constantsI
(
pshader
,
gl_info
,
programId
,
MAX_CONST_I
,
shader_glsl_load_constantsI
(
pshader
,
gl_info
,
programId
,
prog
->
puniformI_locations
,
MAX_CONST_I
,
stateBlock
->
pixelShaderConstantI
,
stateBlock
->
changed
.
pixelShaderConstantsI
);
...
...
@@ -3036,11 +3025,19 @@ static void set_glsl_shader_program(IWineD3DDevice *iface, BOOL use_ps, BOOL use
snprintf
(
glsl_name
,
sizeof
(
glsl_name
),
"VC[%i]"
,
i
);
entry
->
vuniformF_locations
[
i
]
=
GL_EXTCALL
(
glGetUniformLocationARB
(
programId
,
glsl_name
));
}
for
(
i
=
0
;
i
<
MAX_CONST_I
;
++
i
)
{
snprintf
(
glsl_name
,
sizeof
(
glsl_name
),
"VI[%i]"
,
i
);
entry
->
vuniformI_locations
[
i
]
=
GL_EXTCALL
(
glGetUniformLocationARB
(
programId
,
glsl_name
));
}
entry
->
puniformF_locations
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
GLhandleARB
)
*
GL_LIMITS
(
pshader_constantsF
));
for
(
i
=
0
;
i
<
GL_LIMITS
(
pshader_constantsF
);
++
i
)
{
snprintf
(
glsl_name
,
sizeof
(
glsl_name
),
"PC[%i]"
,
i
);
entry
->
puniformF_locations
[
i
]
=
GL_EXTCALL
(
glGetUniformLocationARB
(
programId
,
glsl_name
));
}
for
(
i
=
0
;
i
<
MAX_CONST_I
;
++
i
)
{
snprintf
(
glsl_name
,
sizeof
(
glsl_name
),
"PI[%i]"
,
i
);
entry
->
puniformI_locations
[
i
]
=
GL_EXTCALL
(
glGetUniformLocationARB
(
programId
,
glsl_name
));
}
entry
->
posFixup_location
=
GL_EXTCALL
(
glGetUniformLocationARB
(
programId
,
"posFixup"
));
entry
->
bumpenvmat_location
=
GL_EXTCALL
(
glGetUniformLocationARB
(
programId
,
"bumpenvmat"
));
...
...
@@ -3049,6 +3046,7 @@ static void set_glsl_shader_program(IWineD3DDevice *iface, BOOL use_ps, BOOL use
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"
));
checkGLcall
(
"Find glsl program uniform locations"
);
}
static
GLhandleARB
create_glsl_blt_shader
(
WineD3D_GL_Info
*
gl_info
)
{
...
...
dlls/wined3d/wined3d_private.h
View file @
6fd4f8f6
...
...
@@ -1611,6 +1611,8 @@ struct glsl_shader_prog_link {
GLhandleARB
programId
;
GLhandleARB
*
vuniformF_locations
;
GLhandleARB
*
puniformF_locations
;
GLhandleARB
vuniformI_locations
[
MAX_CONST_I
];
GLhandleARB
puniformI_locations
[
MAX_CONST_I
];
GLhandleARB
posFixup_location
;
GLhandleARB
bumpenvmat_location
;
GLhandleARB
luminancescale_location
;
...
...
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