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
25b90769
Commit
25b90769
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 224 pixel shader vec4's.
Signed-off-by:
Henri Verbeet
<
hverbeet@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
aa5ccba8
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
33 additions
and
102 deletions
+33
-102
arb_program_shader.c
dlls/wined3d/arb_program_shader.c
+7
-17
cs.c
dlls/wined3d/cs.c
+4
-11
device.c
dlls/wined3d/device.c
+6
-11
glsl_shader.c
dlls/wined3d/glsl_shader.c
+6
-10
stateblock.c
dlls/wined3d/stateblock.c
+5
-49
wined3d_private.h
dlls/wined3d/wined3d_private.h
+5
-4
No files found.
dlls/wined3d/arb_program_shader.c
View file @
25b90769
...
@@ -304,7 +304,7 @@ struct shader_arb_priv
...
@@ -304,7 +304,7 @@ struct shader_arb_priv
unsigned
int
highest_dirty_ps_const
,
highest_dirty_vs_const
;
unsigned
int
highest_dirty_ps_const
,
highest_dirty_vs_const
;
char
vshader_const_dirty
[
WINED3D_MAX_VS_CONSTS_F
];
char
vshader_const_dirty
[
WINED3D_MAX_VS_CONSTS_F
];
char
*
pshader_const_dirty
;
char
pshader_const_dirty
[
WINED3D_MAX_PS_CONSTS_F
]
;
const
struct
wined3d_context
*
last_context
;
const
struct
wined3d_context
*
last_context
;
const
struct
wined3d_vertex_pipe_ops
*
vertex_pipe
;
const
struct
wined3d_vertex_pipe_ops
*
vertex_pipe
;
...
@@ -5001,18 +5001,16 @@ static HRESULT shader_arb_alloc(struct wined3d_device *device, const struct wine
...
@@ -5001,18 +5001,16 @@ static HRESULT shader_arb_alloc(struct wined3d_device *device, const struct wine
memset
(
priv
->
vshader_const_dirty
,
1
,
memset
(
priv
->
vshader_const_dirty
,
1
,
sizeof
(
*
priv
->
vshader_const_dirty
)
*
d3d_info
->
limits
.
vs_uniform_count
);
sizeof
(
*
priv
->
vshader_const_dirty
)
*
d3d_info
->
limits
.
vs_uniform_count
);
priv
->
pshader_const_dirty
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
priv
->
pshader_const_dirty
)
*
d3d_info
->
limits
.
ps_uniform_count
);
if
(
!
priv
->
pshader_const_dirty
)
goto
fail
;
memset
(
priv
->
pshader_const_dirty
,
1
,
memset
(
priv
->
pshader_const_dirty
,
1
,
sizeof
(
*
priv
->
pshader_const_dirty
)
*
d3d_info
->
limits
.
ps_uniform_count
);
sizeof
(
*
priv
->
pshader_const_dirty
)
*
d3d_info
->
limits
.
ps_uniform_count
);
if
(
wine_rb_init
(
&
priv
->
signature_tree
,
&
sig_tree_functions
)
==
-
1
)
if
(
wine_rb_init
(
&
priv
->
signature_tree
,
&
sig_tree_functions
)
==
-
1
)
{
{
ERR
(
"RB tree init failed
\n
"
);
ERR
(
"RB tree init failed
\n
"
);
goto
fail
;
fragment_pipe
->
free_private
(
device
);
vertex_pipe
->
vp_free
(
device
);
HeapFree
(
GetProcessHeap
(),
0
,
priv
);
return
E_OUTOFMEMORY
;
}
}
priv
->
vertex_pipe
=
vertex_pipe
;
priv
->
vertex_pipe
=
vertex_pipe
;
...
@@ -5025,13 +5023,6 @@ static HRESULT shader_arb_alloc(struct wined3d_device *device, const struct wine
...
@@ -5025,13 +5023,6 @@ static HRESULT shader_arb_alloc(struct wined3d_device *device, const struct wine
device
->
shader_priv
=
priv
;
device
->
shader_priv
=
priv
;
return
WINED3D_OK
;
return
WINED3D_OK
;
fail:
HeapFree
(
GetProcessHeap
(),
0
,
priv
->
pshader_const_dirty
);
fragment_pipe
->
free_private
(
device
);
vertex_pipe
->
vp_free
(
device
);
HeapFree
(
GetProcessHeap
(),
0
,
priv
);
return
E_OUTOFMEMORY
;
}
}
static
void
release_signature
(
struct
wine_rb_entry
*
entry
,
void
*
context
)
static
void
release_signature
(
struct
wine_rb_entry
*
entry
,
void
*
context
)
...
@@ -5070,7 +5061,6 @@ static void shader_arb_free(struct wined3d_device *device)
...
@@ -5070,7 +5061,6 @@ static void shader_arb_free(struct wined3d_device *device)
}
}
wine_rb_destroy
(
&
priv
->
signature_tree
,
release_signature
,
NULL
);
wine_rb_destroy
(
&
priv
->
signature_tree
,
release_signature
,
NULL
);
HeapFree
(
GetProcessHeap
(),
0
,
priv
->
pshader_const_dirty
);
priv
->
fragment_pipe
->
free_private
(
device
);
priv
->
fragment_pipe
->
free_private
(
device
);
priv
->
vertex_pipe
->
vp_free
(
device
);
priv
->
vertex_pipe
->
vp_free
(
device
);
HeapFree
(
GetProcessHeap
(),
0
,
device
->
shader_priv
);
HeapFree
(
GetProcessHeap
(),
0
,
device
->
shader_priv
);
...
@@ -5169,7 +5159,7 @@ static void shader_arb_get_caps(const struct wined3d_gl_info *gl_info, struct sh
...
@@ -5169,7 +5159,7 @@ static void shader_arb_get_caps(const struct wined3d_gl_info *gl_info, struct sh
TRACE
(
"Hardware pixel shader version 1.4 enabled (ARB_PROGRAM)
\n
"
);
TRACE
(
"Hardware pixel shader version 1.4 enabled (ARB_PROGRAM)
\n
"
);
}
}
caps
->
ps_version
=
min
(
wined3d_settings
.
max_sm_ps
,
ps_version
);
caps
->
ps_version
=
min
(
wined3d_settings
.
max_sm_ps
,
ps_version
);
caps
->
ps_uniform_count
=
ps_consts
;
caps
->
ps_uniform_count
=
min
(
WINED3D_MAX_PS_CONSTS_F
,
ps_consts
)
;
caps
->
ps_1x_max_value
=
8
.
0
f
;
caps
->
ps_1x_max_value
=
8
.
0
f
;
}
}
else
else
...
...
dlls/wined3d/cs.c
View file @
25b90769
...
@@ -999,13 +999,11 @@ void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_ma
...
@@ -999,13 +999,11 @@ void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_ma
static
void
wined3d_cs_exec_reset_state
(
struct
wined3d_cs
*
cs
,
const
void
*
data
)
static
void
wined3d_cs_exec_reset_state
(
struct
wined3d_cs
*
cs
,
const
void
*
data
)
{
{
struct
wined3d_adapter
*
adapter
=
cs
->
device
->
adapter
;
struct
wined3d_adapter
*
adapter
=
cs
->
device
->
adapter
;
HRESULT
hr
;
state_cleanup
(
&
cs
->
state
);
state_cleanup
(
&
cs
->
state
);
memset
(
&
cs
->
state
,
0
,
sizeof
(
cs
->
state
));
memset
(
&
cs
->
state
,
0
,
sizeof
(
cs
->
state
));
if
(
FAILED
(
hr
=
state_init
(
&
cs
->
state
,
&
cs
->
fb
,
&
adapter
->
gl_info
,
&
adapter
->
d3d_info
,
state_init
(
&
cs
->
state
,
&
cs
->
fb
,
&
adapter
->
gl_info
,
&
adapter
->
d3d_info
,
WINED3D_STATE_NO_REF
|
WINED3D_STATE_INIT_DEFAULT
)))
WINED3D_STATE_NO_REF
|
WINED3D_STATE_INIT_DEFAULT
);
ERR
(
"Failed to initialize CS state, hr %#x.
\n
"
,
hr
);
}
}
void
wined3d_cs_emit_reset_state
(
struct
wined3d_cs
*
cs
)
void
wined3d_cs_emit_reset_state
(
struct
wined3d_cs
*
cs
)
...
@@ -1093,13 +1091,8 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
...
@@ -1093,13 +1091,8 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
return
NULL
;
return
NULL
;
}
}
if
(
FAILED
(
state_init
(
&
cs
->
state
,
&
cs
->
fb
,
gl_info
,
&
device
->
adapter
->
d3d_info
,
state_init
(
&
cs
->
state
,
&
cs
->
fb
,
gl_info
,
&
device
->
adapter
->
d3d_info
,
WINED3D_STATE_NO_REF
|
WINED3D_STATE_INIT_DEFAULT
)))
WINED3D_STATE_NO_REF
|
WINED3D_STATE_INIT_DEFAULT
);
{
HeapFree
(
GetProcessHeap
(),
0
,
cs
->
fb
.
render_targets
);
HeapFree
(
GetProcessHeap
(),
0
,
cs
);
return
NULL
;
}
cs
->
ops
=
&
wined3d_cs_st_ops
;
cs
->
ops
=
&
wined3d_cs_st_ops
;
cs
->
device
=
device
;
cs
->
device
=
device
;
...
...
dlls/wined3d/device.c
View file @
25b90769
...
@@ -2713,8 +2713,8 @@ HRESULT CDECL wined3d_device_set_ps_consts_f(struct wined3d_device *device,
...
@@ -2713,8 +2713,8 @@ HRESULT CDECL wined3d_device_set_ps_consts_f(struct wined3d_device *device,
}
}
if
(
device
->
recording
)
if
(
device
->
recording
)
memset
(
&
device
->
recording
->
changed
.
p
ixelShaderConstantsF
[
start_idx
],
1
,
memset
(
&
device
->
recording
->
changed
.
p
s_consts_f
[
start_idx
],
1
,
count
*
sizeof
(
*
device
->
recording
->
changed
.
p
ixelShaderConstantsF
));
count
*
sizeof
(
*
device
->
recording
->
changed
.
p
s_consts_f
));
else
else
device
->
shader_backend
->
shader_update_float_pixel_constants
(
device
,
start_idx
,
count
);
device
->
shader_backend
->
shader_update_float_pixel_constants
(
device
,
start_idx
,
count
);
...
@@ -4887,9 +4887,8 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
...
@@ -4887,9 +4887,8 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
if
(
device
->
d3d_initialized
)
if
(
device
->
d3d_initialized
)
delete_opengl_contexts
(
device
,
swapchain
);
delete_opengl_contexts
(
device
,
swapchain
);
if
(
FAILED
(
hr
=
state_init
(
&
device
->
state
,
&
device
->
fb
,
&
device
->
adapter
->
gl_info
,
state_init
(
&
device
->
state
,
&
device
->
fb
,
&
device
->
adapter
->
gl_info
,
&
device
->
adapter
->
d3d_info
,
WINED3D_STATE_INIT_DEFAULT
)))
&
device
->
adapter
->
d3d_info
,
WINED3D_STATE_INIT_DEFAULT
);
ERR
(
"Failed to initialize device state, hr %#x.
\n
"
,
hr
);
device
->
update_state
=
&
device
->
state
;
device
->
update_state
=
&
device
->
state
;
device_init_swapchain_state
(
device
,
swapchain
);
device_init_swapchain_state
(
device
,
swapchain
);
...
@@ -5143,12 +5142,8 @@ HRESULT device_init(struct wined3d_device *device, struct wined3d *wined3d,
...
@@ -5143,12 +5142,8 @@ HRESULT device_init(struct wined3d_device *device, struct wined3d *wined3d,
device
->
blitter
=
adapter
->
blitter
;
device
->
blitter
=
adapter
->
blitter
;
if
(
FAILED
(
hr
=
state_init
(
&
device
->
state
,
&
device
->
fb
,
&
adapter
->
gl_info
,
state_init
(
&
device
->
state
,
&
device
->
fb
,
&
adapter
->
gl_info
,
&
adapter
->
d3d_info
,
WINED3D_STATE_INIT_DEFAULT
)))
&
adapter
->
d3d_info
,
WINED3D_STATE_INIT_DEFAULT
);
{
ERR
(
"Failed to initialize device state, hr %#x.
\n
"
,
hr
);
goto
err
;
}
device
->
update_state
=
&
device
->
state
;
device
->
update_state
=
&
device
->
state
;
if
(
!
(
device
->
cs
=
wined3d_cs_create
(
device
)))
if
(
!
(
device
->
cs
=
wined3d_cs_create
(
device
)))
...
...
dlls/wined3d/glsl_shader.c
View file @
25b90769
...
@@ -165,7 +165,7 @@ struct glsl_ps_program
...
@@ -165,7 +165,7 @@ struct glsl_ps_program
{
{
struct
list
shader_entry
;
struct
list
shader_entry
;
GLuint
id
;
GLuint
id
;
GLint
*
uniform_f_locations
;
GLint
uniform_f_locations
[
WINED3D_MAX_PS_CONSTS_F
]
;
GLint
uniform_i_locations
[
MAX_CONST_I
];
GLint
uniform_i_locations
[
MAX_CONST_I
];
GLint
uniform_b_locations
[
MAX_CONST_B
];
GLint
uniform_b_locations
[
MAX_CONST_B
];
GLint
bumpenv_mat_location
[
MAX_TEXTURES
];
GLint
bumpenv_mat_location
[
MAX_TEXTURES
];
...
@@ -5137,7 +5137,6 @@ static void delete_glsl_program_entry(struct shader_glsl_priv *priv, const struc
...
@@ -5137,7 +5137,6 @@ static void delete_glsl_program_entry(struct shader_glsl_priv *priv, const struc
list_remove
(
&
entry
->
gs
.
shader_entry
);
list_remove
(
&
entry
->
gs
.
shader_entry
);
if
(
entry
->
ps
.
id
)
if
(
entry
->
ps
.
id
)
list_remove
(
&
entry
->
ps
.
shader_entry
);
list_remove
(
&
entry
->
ps
.
shader_entry
);
HeapFree
(
GetProcessHeap
(),
0
,
entry
->
ps
.
uniform_f_locations
);
HeapFree
(
GetProcessHeap
(),
0
,
entry
);
HeapFree
(
GetProcessHeap
(),
0
,
entry
);
}
}
...
@@ -7096,15 +7095,12 @@ static void shader_glsl_init_ps_uniform_locations(const struct wined3d_gl_info *
...
@@ -7096,15 +7095,12 @@ static void shader_glsl_init_ps_uniform_locations(const struct wined3d_gl_info *
unsigned
int
i
;
unsigned
int
i
;
struct
wined3d_string_buffer
*
name
=
string_buffer_get
(
&
priv
->
string_buffers
);
struct
wined3d_string_buffer
*
name
=
string_buffer_get
(
&
priv
->
string_buffers
);
ps
->
uniform_f_locations
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
GLuint
)
*
gl_info
->
limits
.
glsl_ps_float_constants
);
for
(
i
=
0
;
i
<
ps_c_count
;
++
i
)
for
(
i
=
0
;
i
<
ps_c_count
;
++
i
)
{
{
string_buffer_sprintf
(
name
,
"ps_c[%u]"
,
i
);
string_buffer_sprintf
(
name
,
"ps_c[%u]"
,
i
);
ps
->
uniform_f_locations
[
i
]
=
GL_EXTCALL
(
glGetUniformLocation
(
program_id
,
name
->
buffer
));
ps
->
uniform_f_locations
[
i
]
=
GL_EXTCALL
(
glGetUniformLocation
(
program_id
,
name
->
buffer
));
}
}
memset
(
&
ps
->
uniform_f_locations
[
ps_c_count
],
0xff
,
memset
(
&
ps
->
uniform_f_locations
[
ps_c_count
],
0xff
,
(
WINED3D_MAX_PS_CONSTS_F
-
ps_c_count
)
*
sizeof
(
GLuint
));
(
gl_info
->
limits
.
glsl_ps_float_constants
-
ps_c_count
)
*
sizeof
(
GLuint
));
for
(
i
=
0
;
i
<
MAX_CONST_I
;
++
i
)
for
(
i
=
0
;
i
<
MAX_CONST_I
;
++
i
)
{
{
...
@@ -7371,7 +7367,7 @@ static void set_glsl_shader_program(const struct wined3d_context *context, const
...
@@ -7371,7 +7367,7 @@ static void set_glsl_shader_program(const struct wined3d_context *context, const
shader_glsl_init_vs_uniform_locations
(
gl_info
,
priv
,
program_id
,
&
entry
->
vs
,
shader_glsl_init_vs_uniform_locations
(
gl_info
,
priv
,
program_id
,
&
entry
->
vs
,
vshader
?
vshader
->
limits
->
constant_float
:
0
);
vshader
?
vshader
->
limits
->
constant_float
:
0
);
shader_glsl_init_ps_uniform_locations
(
gl_info
,
priv
,
program_id
,
&
entry
->
ps
,
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
);
pshader
?
pshader
->
limits
->
constant_float
:
0
);
checkGLcall
(
"Find glsl program uniform locations"
);
checkGLcall
(
"Find glsl program uniform locations"
);
if
(
gl_info
->
supported
[
WINED3D_GL_LEGACY_CONTEXT
])
if
(
gl_info
->
supported
[
WINED3D_GL_LEGACY_CONTEXT
])
...
@@ -7930,7 +7926,7 @@ static HRESULT shader_glsl_alloc(struct wined3d_device *device, const struct win
...
@@ -7930,7 +7926,7 @@ static HRESULT shader_glsl_alloc(struct wined3d_device *device, const struct win
{
{
const
struct
wined3d_gl_info
*
gl_info
=
&
device
->
adapter
->
gl_info
;
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
));
struct
shader_glsl_priv
*
priv
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
struct
shader_glsl_priv
));
SIZE_T
stack_size
=
wined3d_log2i
(
max
(
WINED3D_MAX_VS_CONSTS_F
,
gl_info
->
limits
.
glsl_ps_float_constants
))
+
1
;
SIZE_T
stack_size
=
wined3d_log2i
(
max
(
WINED3D_MAX_VS_CONSTS_F
,
WINED3D_MAX_PS_CONSTS_F
))
+
1
;
struct
fragment_caps
fragment_caps
;
struct
fragment_caps
fragment_caps
;
void
*
vertex_priv
,
*
fragment_priv
;
void
*
vertex_priv
,
*
fragment_priv
;
...
@@ -7970,7 +7966,7 @@ static HRESULT shader_glsl_alloc(struct wined3d_device *device, const struct win
...
@@ -7970,7 +7966,7 @@ static HRESULT shader_glsl_alloc(struct wined3d_device *device, const struct win
goto
fail
;
goto
fail
;
}
}
if
(
!
constant_heap_init
(
&
priv
->
pconst_heap
,
gl_info
->
limits
.
glsl_ps_float_constants
))
if
(
!
constant_heap_init
(
&
priv
->
pconst_heap
,
WINED3D_MAX_PS_CONSTS_F
))
{
{
ERR
(
"Failed to initialize pixel shader constant heap
\n
"
);
ERR
(
"Failed to initialize pixel shader constant heap
\n
"
);
goto
fail
;
goto
fail
;
...
@@ -8086,7 +8082,7 @@ static void shader_glsl_get_caps(const struct wined3d_gl_info *gl_info, struct s
...
@@ -8086,7 +8082,7 @@ static void shader_glsl_get_caps(const struct wined3d_gl_info *gl_info, struct s
caps
->
ps_version
=
min
(
wined3d_settings
.
max_sm_ps
,
shader_model
);
caps
->
ps_version
=
min
(
wined3d_settings
.
max_sm_ps
,
shader_model
);
caps
->
vs_uniform_count
=
min
(
WINED3D_MAX_VS_CONSTS_F
,
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
->
ps_uniform_count
=
min
(
WINED3D_MAX_PS_CONSTS_F
,
gl_info
->
limits
.
glsl_ps_float_constants
)
;
caps
->
varying_count
=
gl_info
->
limits
.
glsl_varyings
;
caps
->
varying_count
=
gl_info
->
limits
.
glsl_varyings
;
/* FIXME: The following line is card dependent. -8.0 to 8.0 is the
/* FIXME: The following line is card dependent. -8.0 to 8.0 is the
...
...
dlls/wined3d/stateblock.c
View file @
25b90769
...
@@ -189,30 +189,6 @@ static const DWORD vertex_states_sampler[] =
...
@@ -189,30 +189,6 @@ static const DWORD vertex_states_sampler[] =
WINED3D_SAMP_DMAP_OFFSET
,
WINED3D_SAMP_DMAP_OFFSET
,
};
};
/* Allocates the correct amount of space for pixel and vertex shader constants,
* along with their set/changed flags on the given stateblock object
*/
static
HRESULT
stateblock_allocate_shader_constants
(
struct
wined3d_stateblock
*
object
)
{
const
struct
wined3d_d3d_info
*
d3d_info
=
&
object
->
device
->
adapter
->
d3d_info
;
object
->
changed
.
pixelShaderConstantsF
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
BOOL
)
*
d3d_info
->
limits
.
ps_uniform_count
);
if
(
!
object
->
changed
.
pixelShaderConstantsF
)
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
;
return
WINED3D_OK
;
fail:
ERR
(
"Failed to allocate memory
\n
"
);
HeapFree
(
GetProcessHeap
(),
0
,
object
->
changed
.
pixelShaderConstantsF
);
HeapFree
(
GetProcessHeap
(),
0
,
object
->
contained_ps_consts_f
);
return
E_OUTOFMEMORY
;
}
static
inline
void
stateblock_set_bits
(
DWORD
*
map
,
UINT
map_size
)
static
inline
void
stateblock_set_bits
(
DWORD
*
map
,
UINT
map_size
)
{
{
DWORD
mask
=
(
1u
<<
(
map_size
&
0x1f
))
-
1
;
DWORD
mask
=
(
1u
<<
(
map_size
&
0x1f
))
-
1
;
...
@@ -250,7 +226,7 @@ static void stateblock_savedstates_set_all(struct wined3d_saved_states *states,
...
@@ -250,7 +226,7 @@ static void stateblock_savedstates_set_all(struct wined3d_saved_states *states,
states
->
vertexShaderConstantsI
=
0xffff
;
states
->
vertexShaderConstantsI
=
0xffff
;
/* Dynamically sized arrays */
/* Dynamically sized arrays */
memset
(
states
->
p
ixelShaderConstantsF
,
TRUE
,
sizeof
(
BOOL
)
*
ps_consts
);
memset
(
states
->
p
s_consts_f
,
TRUE
,
sizeof
(
BOOL
)
*
ps_consts
);
memset
(
states
->
vs_consts_f
,
TRUE
,
sizeof
(
BOOL
)
*
vs_consts
);
memset
(
states
->
vs_consts_f
,
TRUE
,
sizeof
(
BOOL
)
*
vs_consts
);
}
}
...
@@ -277,7 +253,7 @@ static void stateblock_savedstates_set_pixel(struct wined3d_saved_states *states
...
@@ -277,7 +253,7 @@ static void stateblock_savedstates_set_pixel(struct wined3d_saved_states *states
states
->
pixelShaderConstantsB
=
0xffff
;
states
->
pixelShaderConstantsB
=
0xffff
;
states
->
pixelShaderConstantsI
=
0xffff
;
states
->
pixelShaderConstantsI
=
0xffff
;
memset
(
states
->
p
ixelShaderConstantsF
,
TRUE
,
sizeof
(
BOOL
)
*
num_constants
);
memset
(
states
->
p
s_consts_f
,
TRUE
,
sizeof
(
BOOL
)
*
num_constants
);
}
}
static
void
stateblock_savedstates_set_vertex
(
struct
wined3d_saved_states
*
states
,
const
DWORD
num_constants
)
static
void
stateblock_savedstates_set_vertex
(
struct
wined3d_saved_states
*
states
,
const
DWORD
num_constants
)
...
@@ -365,7 +341,7 @@ void stateblock_init_contained_states(struct wined3d_stateblock *stateblock)
...
@@ -365,7 +341,7 @@ void stateblock_init_contained_states(struct wined3d_stateblock *stateblock)
for
(
i
=
0
;
i
<
d3d_info
->
limits
.
ps_uniform_count
;
++
i
)
for
(
i
=
0
;
i
<
d3d_info
->
limits
.
ps_uniform_count
;
++
i
)
{
{
if
(
stateblock
->
changed
.
p
ixelShaderConstantsF
[
i
])
if
(
stateblock
->
changed
.
p
s_consts_f
[
i
])
{
{
stateblock
->
contained_ps_consts_f
[
stateblock
->
num_contained_ps_consts_f
]
=
i
;
stateblock
->
contained_ps_consts_f
[
stateblock
->
num_contained_ps_consts_f
]
=
i
;
++
stateblock
->
num_contained_ps_consts_f
;
++
stateblock
->
num_contained_ps_consts_f
;
...
@@ -554,8 +530,6 @@ void state_cleanup(struct wined3d_state *state)
...
@@ -554,8 +530,6 @@ void state_cleanup(struct wined3d_state *state)
HeapFree
(
GetProcessHeap
(),
0
,
light
);
HeapFree
(
GetProcessHeap
(),
0
,
light
);
}
}
}
}
HeapFree
(
GetProcessHeap
(),
0
,
state
->
ps_consts_f
);
}
}
ULONG
CDECL
wined3d_stateblock_decref
(
struct
wined3d_stateblock
*
stateblock
)
ULONG
CDECL
wined3d_stateblock_decref
(
struct
wined3d_stateblock
*
stateblock
)
...
@@ -567,9 +541,6 @@ ULONG CDECL wined3d_stateblock_decref(struct wined3d_stateblock *stateblock)
...
@@ -567,9 +541,6 @@ ULONG CDECL wined3d_stateblock_decref(struct wined3d_stateblock *stateblock)
if
(
!
refcount
)
if
(
!
refcount
)
{
{
state_cleanup
(
&
stateblock
->
state
);
state_cleanup
(
&
stateblock
->
state
);
HeapFree
(
GetProcessHeap
(),
0
,
stateblock
->
changed
.
pixelShaderConstantsF
);
HeapFree
(
GetProcessHeap
(),
0
,
stateblock
->
contained_ps_consts_f
);
HeapFree
(
GetProcessHeap
(),
0
,
stateblock
);
HeapFree
(
GetProcessHeap
(),
0
,
stateblock
);
}
}
...
@@ -1283,7 +1254,7 @@ static void state_init_default(struct wined3d_state *state, const struct wined3d
...
@@ -1283,7 +1254,7 @@ static void state_init_default(struct wined3d_state *state, const struct wined3d
}
}
}
}
HRESULT
state_init
(
struct
wined3d_state
*
state
,
struct
wined3d_fb_state
*
fb
,
void
state_init
(
struct
wined3d_state
*
state
,
struct
wined3d_fb_state
*
fb
,
const
struct
wined3d_gl_info
*
gl_info
,
const
struct
wined3d_d3d_info
*
d3d_info
,
const
struct
wined3d_gl_info
*
gl_info
,
const
struct
wined3d_d3d_info
*
d3d_info
,
DWORD
flags
)
DWORD
flags
)
{
{
...
@@ -1297,33 +1268,18 @@ HRESULT state_init(struct wined3d_state *state, struct wined3d_fb_state *fb,
...
@@ -1297,33 +1268,18 @@ HRESULT state_init(struct wined3d_state *state, struct wined3d_fb_state *fb,
list_init
(
&
state
->
light_map
[
i
]);
list_init
(
&
state
->
light_map
[
i
]);
}
}
if
(
!
(
state
->
ps_consts_f
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
state
->
ps_consts_f
)
*
d3d_info
->
limits
.
ps_uniform_count
)))
return
E_OUTOFMEMORY
;
if
(
flags
&
WINED3D_STATE_INIT_DEFAULT
)
if
(
flags
&
WINED3D_STATE_INIT_DEFAULT
)
state_init_default
(
state
,
gl_info
);
state_init_default
(
state
,
gl_info
);
return
WINED3D_OK
;
}
}
static
HRESULT
stateblock_init
(
struct
wined3d_stateblock
*
stateblock
,
static
HRESULT
stateblock_init
(
struct
wined3d_stateblock
*
stateblock
,
struct
wined3d_device
*
device
,
enum
wined3d_stateblock_type
type
)
struct
wined3d_device
*
device
,
enum
wined3d_stateblock_type
type
)
{
{
HRESULT
hr
;
const
struct
wined3d_d3d_info
*
d3d_info
=
&
device
->
adapter
->
d3d_info
;
const
struct
wined3d_d3d_info
*
d3d_info
=
&
device
->
adapter
->
d3d_info
;
stateblock
->
ref
=
1
;
stateblock
->
ref
=
1
;
stateblock
->
device
=
device
;
stateblock
->
device
=
device
;
state_init
(
&
stateblock
->
state
,
NULL
,
&
device
->
adapter
->
gl_info
,
d3d_info
,
0
);
if
(
FAILED
(
hr
=
state_init
(
&
stateblock
->
state
,
NULL
,
&
device
->
adapter
->
gl_info
,
d3d_info
,
0
)))
return
hr
;
if
(
FAILED
(
hr
=
stateblock_allocate_shader_constants
(
stateblock
)))
{
state_cleanup
(
&
stateblock
->
state
);
return
hr
;
}
if
(
type
==
WINED3D_SBT_RECORDED
)
if
(
type
==
WINED3D_SBT_RECORDED
)
return
WINED3D_OK
;
return
WINED3D_OK
;
...
...
dlls/wined3d/wined3d_private.h
View file @
25b90769
...
@@ -514,6 +514,7 @@ enum wined3d_shader_rel_op
...
@@ -514,6 +514,7 @@ enum wined3d_shader_rel_op
#define MAX_CONST_B 16
#define MAX_CONST_B 16
#define WINED3D_MAX_CBS 15
#define WINED3D_MAX_CBS 15
#define WINED3D_MAX_VS_CONSTS_F 256
#define WINED3D_MAX_VS_CONSTS_F 256
#define WINED3D_MAX_PS_CONSTS_F 224
/* FIXME: This needs to go up to 2048 for
/* FIXME: This needs to go up to 2048 for
* Shader model 3 according to msdn (and for software shaders) */
* Shader model 3 according to msdn (and for software shaders) */
...
@@ -2217,7 +2218,7 @@ struct wined3d_state
...
@@ -2217,7 +2218,7 @@ struct wined3d_state
BOOL
ps_consts_b
[
MAX_CONST_B
];
BOOL
ps_consts_b
[
MAX_CONST_B
];
INT
ps_consts_i
[
MAX_CONST_I
*
4
];
INT
ps_consts_i
[
MAX_CONST_I
*
4
];
struct
wined3d_vec4
*
ps_consts_f
;
struct
wined3d_vec4
ps_consts_f
[
WINED3D_MAX_PS_CONSTS_F
]
;
struct
wined3d_texture
*
textures
[
MAX_COMBINED_SAMPLERS
];
struct
wined3d_texture
*
textures
[
MAX_COMBINED_SAMPLERS
];
DWORD
sampler_states
[
MAX_COMBINED_SAMPLERS
][
WINED3D_HIGHEST_SAMPLER_STATE
+
1
];
DWORD
sampler_states
[
MAX_COMBINED_SAMPLERS
][
WINED3D_HIGHEST_SAMPLER_STATE
+
1
];
...
@@ -2777,7 +2778,7 @@ struct wined3d_saved_states
...
@@ -2777,7 +2778,7 @@ struct wined3d_saved_states
DWORD
clipplane
;
/* WINED3DMAXUSERCLIPPLANES, 32 */
DWORD
clipplane
;
/* WINED3DMAXUSERCLIPPLANES, 32 */
WORD
pixelShaderConstantsB
;
/* MAX_CONST_B, 16 */
WORD
pixelShaderConstantsB
;
/* MAX_CONST_B, 16 */
WORD
pixelShaderConstantsI
;
/* MAX_CONST_I, 16 */
WORD
pixelShaderConstantsI
;
/* MAX_CONST_I, 16 */
BOOL
*
pixelShaderConstantsF
;
BOOL
ps_consts_f
[
WINED3D_MAX_PS_CONSTS_F
]
;
WORD
vertexShaderConstantsB
;
/* MAX_CONST_B, 16 */
WORD
vertexShaderConstantsB
;
/* MAX_CONST_B, 16 */
WORD
vertexShaderConstantsI
;
/* MAX_CONST_I, 16 */
WORD
vertexShaderConstantsI
;
/* MAX_CONST_I, 16 */
BOOL
vs_consts_f
[
WINED3D_MAX_VS_CONSTS_F
];
BOOL
vs_consts_f
[
WINED3D_MAX_VS_CONSTS_F
];
...
@@ -2822,7 +2823,7 @@ struct wined3d_stateblock
...
@@ -2822,7 +2823,7 @@ struct wined3d_stateblock
unsigned
int
num_contained_ps_consts_i
;
unsigned
int
num_contained_ps_consts_i
;
DWORD
contained_ps_consts_b
[
MAX_CONST_B
];
DWORD
contained_ps_consts_b
[
MAX_CONST_B
];
unsigned
int
num_contained_ps_consts_b
;
unsigned
int
num_contained_ps_consts_b
;
DWORD
*
contained_ps_consts_f
;
DWORD
contained_ps_consts_f
[
WINED3D_MAX_PS_CONSTS_F
]
;
unsigned
int
num_contained_ps_consts_f
;
unsigned
int
num_contained_ps_consts_f
;
struct
StageState
contained_tss_states
[
MAX_TEXTURES
*
(
WINED3D_HIGHEST_TEXTURE_STATE
+
1
)];
struct
StageState
contained_tss_states
[
MAX_TEXTURES
*
(
WINED3D_HIGHEST_TEXTURE_STATE
+
1
)];
unsigned
int
num_contained_tss_states
;
unsigned
int
num_contained_tss_states
;
...
@@ -2833,7 +2834,7 @@ struct wined3d_stateblock
...
@@ -2833,7 +2834,7 @@ struct wined3d_stateblock
void
stateblock_init_contained_states
(
struct
wined3d_stateblock
*
stateblock
)
DECLSPEC_HIDDEN
;
void
stateblock_init_contained_states
(
struct
wined3d_stateblock
*
stateblock
)
DECLSPEC_HIDDEN
;
void
state_cleanup
(
struct
wined3d_state
*
state
)
DECLSPEC_HIDDEN
;
void
state_cleanup
(
struct
wined3d_state
*
state
)
DECLSPEC_HIDDEN
;
HRESULT
state_init
(
struct
wined3d_state
*
state
,
struct
wined3d_fb_state
*
fb
,
void
state_init
(
struct
wined3d_state
*
state
,
struct
wined3d_fb_state
*
fb
,
const
struct
wined3d_gl_info
*
gl_info
,
const
struct
wined3d_d3d_info
*
d3d_info
,
const
struct
wined3d_gl_info
*
gl_info
,
const
struct
wined3d_d3d_info
*
d3d_info
,
DWORD
flags
)
DECLSPEC_HIDDEN
;
DWORD
flags
)
DECLSPEC_HIDDEN
;
void
state_unbind_resources
(
struct
wined3d_state
*
state
)
DECLSPEC_HIDDEN
;
void
state_unbind_resources
(
struct
wined3d_state
*
state
)
DECLSPEC_HIDDEN
;
...
...
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