Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
aa5ccba8
Commit
aa5ccba8
authored
May 17, 2016
by
Henri Verbeet
Committed by
Alexandre Julliard
May 18, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Only allow 256 vertex shader vec4's.
Signed-off-by:
Henri Verbeet
<
hverbeet@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
5b8fdb97
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
18 additions
and
47 deletions
+18
-47
arb_program_shader.c
dlls/wined3d/arb_program_shader.c
+3
-8
device.c
dlls/wined3d/device.c
+2
-2
glsl_shader.c
dlls/wined3d/glsl_shader.c
+6
-11
stateblock.c
dlls/wined3d/stateblock.c
+3
-23
wined3d_private.h
dlls/wined3d/wined3d_private.h
+4
-3
No files found.
dlls/wined3d/arb_program_shader.c
View file @
aa5ccba8
...
...
@@ -303,7 +303,8 @@ struct shader_arb_priv
DWORD
ps_sig_number
;
unsigned
int
highest_dirty_ps_const
,
highest_dirty_vs_const
;
char
*
vshader_const_dirty
,
*
pshader_const_dirty
;
char
vshader_const_dirty
[
WINED3D_MAX_VS_CONSTS_F
];
char
*
pshader_const_dirty
;
const
struct
wined3d_context
*
last_context
;
const
struct
wined3d_vertex_pipe_ops
*
vertex_pipe
;
...
...
@@ -4998,10 +4999,6 @@ static HRESULT shader_arb_alloc(struct wined3d_device *device, const struct wine
return
E_FAIL
;
}
priv
->
vshader_const_dirty
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
priv
->
vshader_const_dirty
)
*
d3d_info
->
limits
.
vs_uniform_count
);
if
(
!
priv
->
vshader_const_dirty
)
goto
fail
;
memset
(
priv
->
vshader_const_dirty
,
1
,
sizeof
(
*
priv
->
vshader_const_dirty
)
*
d3d_info
->
limits
.
vs_uniform_count
);
...
...
@@ -5031,7 +5028,6 @@ static HRESULT shader_arb_alloc(struct wined3d_device *device, const struct wine
fail:
HeapFree
(
GetProcessHeap
(),
0
,
priv
->
pshader_const_dirty
);
HeapFree
(
GetProcessHeap
(),
0
,
priv
->
vshader_const_dirty
);
fragment_pipe
->
free_private
(
device
);
vertex_pipe
->
vp_free
(
device
);
HeapFree
(
GetProcessHeap
(),
0
,
priv
);
...
...
@@ -5075,7 +5071,6 @@ static void shader_arb_free(struct wined3d_device *device)
wine_rb_destroy
(
&
priv
->
signature_tree
,
release_signature
,
NULL
);
HeapFree
(
GetProcessHeap
(),
0
,
priv
->
pshader_const_dirty
);
HeapFree
(
GetProcessHeap
(),
0
,
priv
->
vshader_const_dirty
);
priv
->
fragment_pipe
->
free_private
(
device
);
priv
->
vertex_pipe
->
vp_free
(
device
);
HeapFree
(
GetProcessHeap
(),
0
,
device
->
shader_priv
);
...
...
@@ -5133,7 +5128,7 @@ static void shader_arb_get_caps(const struct wined3d_gl_info *gl_info, struct sh
TRACE
(
"Hardware vertex shader version 1.1 enabled (ARB_PROGRAM)
\n
"
);
}
caps
->
vs_version
=
min
(
wined3d_settings
.
max_sm_vs
,
vs_version
);
caps
->
vs_uniform_count
=
vs_consts
;
caps
->
vs_uniform_count
=
min
(
WINED3D_MAX_VS_CONSTS_F
,
vs_consts
)
;
}
else
{
...
...
dlls/wined3d/device.c
View file @
aa5ccba8
...
...
@@ -2485,8 +2485,8 @@ HRESULT CDECL wined3d_device_set_vs_consts_f(struct wined3d_device *device,
}
if
(
device
->
recording
)
memset
(
&
device
->
recording
->
changed
.
v
ertexShaderConstantsF
[
start_idx
],
1
,
count
*
sizeof
(
*
device
->
recording
->
changed
.
v
ertexShaderConstantsF
));
memset
(
&
device
->
recording
->
changed
.
v
s_consts_f
[
start_idx
],
1
,
count
*
sizeof
(
*
device
->
recording
->
changed
.
v
s_consts_f
));
else
device
->
shader_backend
->
shader_update_float_vertex_constants
(
device
,
start_idx
,
count
);
...
...
dlls/wined3d/glsl_shader.c
View file @
aa5ccba8
...
...
@@ -117,7 +117,7 @@ struct glsl_vs_program
struct
list
shader_entry
;
GLuint
id
;
GLenum
vertex_color_clamp
;
GLint
*
uniform_f_locations
;
GLint
uniform_f_locations
[
WINED3D_MAX_VS_CONSTS_F
]
;
GLint
uniform_i_locations
[
MAX_CONST_I
];
GLint
uniform_b_locations
[
MAX_CONST_B
];
GLint
pos_fixup_location
;
...
...
@@ -5137,7 +5137,6 @@ static void delete_glsl_program_entry(struct shader_glsl_priv *priv, const struc
list_remove
(
&
entry
->
gs
.
shader_entry
);
if
(
entry
->
ps
.
id
)
list_remove
(
&
entry
->
ps
.
shader_entry
);
HeapFree
(
GetProcessHeap
(),
0
,
entry
->
vs
.
uniform_f_locations
);
HeapFree
(
GetProcessHeap
(),
0
,
entry
->
ps
.
uniform_f_locations
);
HeapFree
(
GetProcessHeap
(),
0
,
entry
);
}
...
...
@@ -7015,15 +7014,12 @@ static void shader_glsl_init_vs_uniform_locations(const struct wined3d_gl_info *
unsigned
int
i
;
struct
wined3d_string_buffer
*
name
=
string_buffer_get
(
&
priv
->
string_buffers
);
vs
->
uniform_f_locations
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
GLuint
)
*
gl_info
->
limits
.
glsl_vs_float_constants
);
for
(
i
=
0
;
i
<
vs_c_count
;
++
i
)
{
string_buffer_sprintf
(
name
,
"vs_c[%u]"
,
i
);
vs
->
uniform_f_locations
[
i
]
=
GL_EXTCALL
(
glGetUniformLocation
(
program_id
,
name
->
buffer
));
}
memset
(
&
vs
->
uniform_f_locations
[
vs_c_count
],
0xff
,
(
gl_info
->
limits
.
glsl_vs_float_constants
-
vs_c_count
)
*
sizeof
(
GLuint
));
memset
(
&
vs
->
uniform_f_locations
[
vs_c_count
],
0xff
,
(
WINED3D_MAX_VS_CONSTS_F
-
vs_c_count
)
*
sizeof
(
GLuint
));
for
(
i
=
0
;
i
<
MAX_CONST_I
;
++
i
)
{
...
...
@@ -7373,7 +7369,7 @@ static void set_glsl_shader_program(const struct wined3d_context *context, const
shader_glsl_validate_link
(
gl_info
,
program_id
);
shader_glsl_init_vs_uniform_locations
(
gl_info
,
priv
,
program_id
,
&
entry
->
vs
,
vshader
?
min
(
vshader
->
limits
->
constant_float
,
gl_info
->
limits
.
glsl_vs_float_constants
)
:
0
);
vshader
?
vshader
->
limits
->
constant_float
:
0
);
shader_glsl_init_ps_uniform_locations
(
gl_info
,
priv
,
program_id
,
&
entry
->
ps
,
pshader
?
min
(
pshader
->
limits
->
constant_float
,
gl_info
->
limits
.
glsl_ps_float_constants
)
:
0
);
checkGLcall
(
"Find glsl program uniform locations"
);
...
...
@@ -7934,8 +7930,7 @@ static HRESULT shader_glsl_alloc(struct wined3d_device *device, const struct win
{
const
struct
wined3d_gl_info
*
gl_info
=
&
device
->
adapter
->
gl_info
;
struct
shader_glsl_priv
*
priv
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
struct
shader_glsl_priv
));
SIZE_T
stack_size
=
wined3d_log2i
(
max
(
gl_info
->
limits
.
glsl_vs_float_constants
,
gl_info
->
limits
.
glsl_ps_float_constants
))
+
1
;
SIZE_T
stack_size
=
wined3d_log2i
(
max
(
WINED3D_MAX_VS_CONSTS_F
,
gl_info
->
limits
.
glsl_ps_float_constants
))
+
1
;
struct
fragment_caps
fragment_caps
;
void
*
vertex_priv
,
*
fragment_priv
;
...
...
@@ -7969,7 +7964,7 @@ static HRESULT shader_glsl_alloc(struct wined3d_device *device, const struct win
goto
fail
;
}
if
(
!
constant_heap_init
(
&
priv
->
vconst_heap
,
gl_info
->
limits
.
glsl_vs_float_constants
))
if
(
!
constant_heap_init
(
&
priv
->
vconst_heap
,
WINED3D_MAX_VS_CONSTS_F
))
{
ERR
(
"Failed to initialize vertex shader constant heap
\n
"
);
goto
fail
;
...
...
@@ -8090,7 +8085,7 @@ static void shader_glsl_get_caps(const struct wined3d_gl_info *gl_info, struct s
caps
->
gs_version
=
min
(
wined3d_settings
.
max_sm_gs
,
shader_model
);
caps
->
ps_version
=
min
(
wined3d_settings
.
max_sm_ps
,
shader_model
);
caps
->
vs_uniform_count
=
gl_info
->
limits
.
glsl_vs_float_constants
;
caps
->
vs_uniform_count
=
min
(
WINED3D_MAX_VS_CONSTS_F
,
gl_info
->
limits
.
glsl_vs_float_constants
)
;
caps
->
ps_uniform_count
=
gl_info
->
limits
.
glsl_ps_float_constants
;
caps
->
varying_count
=
gl_info
->
limits
.
glsl_varyings
;
...
...
dlls/wined3d/stateblock.c
View file @
aa5ccba8
...
...
@@ -200,14 +200,6 @@ static HRESULT stateblock_allocate_shader_constants(struct wined3d_stateblock *o
sizeof
(
BOOL
)
*
d3d_info
->
limits
.
ps_uniform_count
);
if
(
!
object
->
changed
.
pixelShaderConstantsF
)
goto
fail
;
object
->
changed
.
vertexShaderConstantsF
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
BOOL
)
*
d3d_info
->
limits
.
vs_uniform_count
);
if
(
!
object
->
changed
.
vertexShaderConstantsF
)
goto
fail
;
object
->
contained_vs_consts_f
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
DWORD
)
*
d3d_info
->
limits
.
vs_uniform_count
);
if
(
!
object
->
contained_vs_consts_f
)
goto
fail
;
object
->
contained_ps_consts_f
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
DWORD
)
*
d3d_info
->
limits
.
ps_uniform_count
);
if
(
!
object
->
contained_ps_consts_f
)
goto
fail
;
...
...
@@ -217,8 +209,6 @@ static HRESULT stateblock_allocate_shader_constants(struct wined3d_stateblock *o
fail:
ERR
(
"Failed to allocate memory
\n
"
);
HeapFree
(
GetProcessHeap
(),
0
,
object
->
changed
.
pixelShaderConstantsF
);
HeapFree
(
GetProcessHeap
(),
0
,
object
->
changed
.
vertexShaderConstantsF
);
HeapFree
(
GetProcessHeap
(),
0
,
object
->
contained_vs_consts_f
);
HeapFree
(
GetProcessHeap
(),
0
,
object
->
contained_ps_consts_f
);
return
E_OUTOFMEMORY
;
}
...
...
@@ -261,7 +251,7 @@ static void stateblock_savedstates_set_all(struct wined3d_saved_states *states,
/* Dynamically sized arrays */
memset
(
states
->
pixelShaderConstantsF
,
TRUE
,
sizeof
(
BOOL
)
*
ps_consts
);
memset
(
states
->
v
ertexShaderConstantsF
,
TRUE
,
sizeof
(
BOOL
)
*
vs_consts
);
memset
(
states
->
v
s_consts_f
,
TRUE
,
sizeof
(
BOOL
)
*
vs_consts
);
}
static
void
stateblock_savedstates_set_pixel
(
struct
wined3d_saved_states
*
states
,
const
DWORD
num_constants
)
...
...
@@ -314,7 +304,7 @@ static void stateblock_savedstates_set_vertex(struct wined3d_saved_states *state
states
->
vertexShaderConstantsB
=
0xffff
;
states
->
vertexShaderConstantsI
=
0xffff
;
memset
(
states
->
v
ertexShaderConstantsF
,
TRUE
,
sizeof
(
BOOL
)
*
num_constants
);
memset
(
states
->
v
s_consts_f
,
TRUE
,
sizeof
(
BOOL
)
*
num_constants
);
}
void
stateblock_init_contained_states
(
struct
wined3d_stateblock
*
stateblock
)
...
...
@@ -348,7 +338,7 @@ void stateblock_init_contained_states(struct wined3d_stateblock *stateblock)
for
(
i
=
0
;
i
<
d3d_info
->
limits
.
vs_uniform_count
;
++
i
)
{
if
(
stateblock
->
changed
.
v
ertexShaderConstantsF
[
i
])
if
(
stateblock
->
changed
.
v
s_consts_f
[
i
])
{
stateblock
->
contained_vs_consts_f
[
stateblock
->
num_contained_vs_consts_f
]
=
i
;
++
stateblock
->
num_contained_vs_consts_f
;
...
...
@@ -565,7 +555,6 @@ void state_cleanup(struct wined3d_state *state)
}
}
HeapFree
(
GetProcessHeap
(),
0
,
state
->
vs_consts_f
);
HeapFree
(
GetProcessHeap
(),
0
,
state
->
ps_consts_f
);
}
...
...
@@ -579,9 +568,7 @@ ULONG CDECL wined3d_stateblock_decref(struct wined3d_stateblock *stateblock)
{
state_cleanup
(
&
stateblock
->
state
);
HeapFree
(
GetProcessHeap
(),
0
,
stateblock
->
changed
.
vertexShaderConstantsF
);
HeapFree
(
GetProcessHeap
(),
0
,
stateblock
->
changed
.
pixelShaderConstantsF
);
HeapFree
(
GetProcessHeap
(),
0
,
stateblock
->
contained_vs_consts_f
);
HeapFree
(
GetProcessHeap
(),
0
,
stateblock
->
contained_ps_consts_f
);
HeapFree
(
GetProcessHeap
(),
0
,
stateblock
);
}
...
...
@@ -1310,16 +1297,9 @@ HRESULT state_init(struct wined3d_state *state, struct wined3d_fb_state *fb,
list_init
(
&
state
->
light_map
[
i
]);
}
if
(
!
(
state
->
vs_consts_f
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
state
->
vs_consts_f
)
*
d3d_info
->
limits
.
vs_uniform_count
)))
return
E_OUTOFMEMORY
;
if
(
!
(
state
->
ps_consts_f
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
state
->
ps_consts_f
)
*
d3d_info
->
limits
.
ps_uniform_count
)))
{
HeapFree
(
GetProcessHeap
(),
0
,
state
->
vs_consts_f
);
return
E_OUTOFMEMORY
;
}
if
(
flags
&
WINED3D_STATE_INIT_DEFAULT
)
state_init_default
(
state
,
gl_info
);
...
...
dlls/wined3d/wined3d_private.h
View file @
aa5ccba8
...
...
@@ -513,6 +513,7 @@ enum wined3d_shader_rel_op
#define MAX_CONST_I 16
#define MAX_CONST_B 16
#define WINED3D_MAX_CBS 15
#define WINED3D_MAX_VS_CONSTS_F 256
/* FIXME: This needs to go up to 2048 for
* Shader model 3 according to msdn (and for software shaders) */
...
...
@@ -2212,7 +2213,7 @@ struct wined3d_state
BOOL
vs_consts_b
[
MAX_CONST_B
];
INT
vs_consts_i
[
MAX_CONST_I
*
4
];
struct
wined3d_vec4
*
vs_consts_f
;
struct
wined3d_vec4
vs_consts_f
[
WINED3D_MAX_VS_CONSTS_F
]
;
BOOL
ps_consts_b
[
MAX_CONST_B
];
INT
ps_consts_i
[
MAX_CONST_I
*
4
];
...
...
@@ -2779,7 +2780,7 @@ struct wined3d_saved_states
BOOL
*
pixelShaderConstantsF
;
WORD
vertexShaderConstantsB
;
/* MAX_CONST_B, 16 */
WORD
vertexShaderConstantsI
;
/* MAX_CONST_I, 16 */
BOOL
*
vertexShaderConstantsF
;
BOOL
vs_consts_f
[
WINED3D_MAX_VS_CONSTS_F
]
;
DWORD
textures
:
20
;
/* MAX_COMBINED_SAMPLERS, 20 */
DWORD
primitive_type
:
1
;
DWORD
indices
:
1
;
...
...
@@ -2815,7 +2816,7 @@ struct wined3d_stateblock
unsigned
int
num_contained_vs_consts_i
;
DWORD
contained_vs_consts_b
[
MAX_CONST_B
];
unsigned
int
num_contained_vs_consts_b
;
DWORD
*
contained_vs_consts_f
;
DWORD
contained_vs_consts_f
[
WINED3D_MAX_VS_CONSTS_F
]
;
unsigned
int
num_contained_vs_consts_f
;
DWORD
contained_ps_consts_i
[
MAX_CONST_I
];
unsigned
int
num_contained_ps_consts_i
;
...
...
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