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
3c3272dc
Commit
3c3272dc
authored
Jan 19, 2009
by
Stefan Dösinger
Committed by
Alexandre Julliard
Jan 20, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Don't single-allocate new gl shaders.
parent
3a352719
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
13 deletions
+22
-13
arb_program_shader.c
dlls/wined3d/arb_program_shader.c
+1
-0
glsl_shader.c
dlls/wined3d/glsl_shader.c
+1
-0
pixelshader.c
dlls/wined3d/pixelshader.c
+19
-12
wined3d_private.h
dlls/wined3d/wined3d_private.h
+1
-1
No files found.
dlls/wined3d/arb_program_shader.c
View file @
3c3272dc
...
...
@@ -1857,6 +1857,7 @@ static void shader_arb_destroy(IWineD3DBaseShader *iface) {
HeapFree
(
GetProcessHeap
(),
0
,
This
->
gl_shaders
);
This
->
gl_shaders
=
NULL
;
This
->
num_gl_shaders
=
0
;
This
->
shader_array_size
=
0
;
}
else
{
IWineD3DVertexShaderImpl
*
This
=
(
IWineD3DVertexShaderImpl
*
)
iface
;
...
...
dlls/wined3d/glsl_shader.c
View file @
3c3272dc
...
...
@@ -3652,6 +3652,7 @@ static void shader_glsl_destroy(IWineD3DBaseShader *iface) {
HeapFree
(
GetProcessHeap
(),
0
,
ps
->
gl_shaders
);
ps
->
gl_shaders
=
NULL
;
ps
->
num_gl_shaders
=
0
;
ps
->
shader_array_size
=
0
;
}
else
{
TRACE
(
"Deleting shader object %u
\n
"
,
vs
->
prgId
);
ENTER_GL
();
...
...
dlls/wined3d/pixelshader.c
View file @
3c3272dc
...
...
@@ -520,10 +520,12 @@ void find_ps_compile_args(IWineD3DPixelShaderImpl *shader, IWineD3DStateBlockImp
GLuint
find_gl_pshader
(
IWineD3DPixelShaderImpl
*
shader
,
const
struct
ps_compile_args
*
args
)
{
UINT
i
;
struct
ps_compiled_shader
*
old_array
;
DWORD
new_size
;
struct
ps_compiled_shader
*
new_array
;
/* Usually we have very few GL shaders for each d3d shader(just 1 or maybe 2),
* so a linear search is more performant than a hashmap
* so a linear search is more performant than a hashmap or a binary search
* (cache coherency etc)
*/
for
(
i
=
0
;
i
<
shader
->
num_gl_shaders
;
i
++
)
{
if
(
memcmp
(
&
shader
->
gl_shaders
[
i
].
args
,
args
,
sizeof
(
*
args
))
==
0
)
{
...
...
@@ -532,17 +534,22 @@ GLuint find_gl_pshader(IWineD3DPixelShaderImpl *shader, const struct ps_compile_
}
TRACE
(
"No matching GL shader found, compiling a new shader
\n
"
);
old_array
=
shader
->
gl_shaders
;
if
(
old_array
)
{
shader
->
gl_shaders
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
old_array
,
(
shader
->
num_gl_shaders
+
1
)
*
sizeof
(
*
shader
->
gl_shaders
));
}
else
{
shader
->
gl_shaders
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
shader
->
gl_shaders
));
}
if
(
shader
->
shader_array_size
==
shader
->
num_gl_shaders
)
{
if
(
shader
->
gl_shaders
)
{
new_size
=
shader
->
shader_array_size
+
max
(
1
,
shader
->
shader_array_size
/
2
);
new_array
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
shader
->
gl_shaders
,
new_size
*
sizeof
(
*
shader
->
gl_shaders
));
}
else
{
new_array
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
shader
->
gl_shaders
));
new_size
=
1
;
}
if
(
!
shader
->
gl_shaders
)
{
ERR
(
"Out of memory
\n
"
);
return
0
;
if
(
!
new_array
)
{
ERR
(
"Out of memory
\n
"
);
return
0
;
}
shader
->
gl_shaders
=
new_array
;
shader
->
shader_array_size
=
new_size
;
}
shader
->
gl_shaders
[
shader
->
num_gl_shaders
].
args
=
*
args
;
...
...
dlls/wined3d/wined3d_private.h
View file @
3c3272dc
...
...
@@ -2382,7 +2382,7 @@ typedef struct IWineD3DPixelShaderImpl {
/* The GL shader */
struct
ps_compiled_shader
*
gl_shaders
;
UINT
num_gl_shaders
;
UINT
num_gl_shaders
,
shader_array_size
;
/* Some information about the shader behavior */
struct
stb_const_desc
bumpenvmatconst
[
MAX_TEXTURES
];
...
...
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