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
cc85c6af
Commit
cc85c6af
authored
Aug 27, 2013
by
Henri Verbeet
Committed by
Alexandre Julliard
Aug 27, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Introduce a separate function for initializing a wined3d_state structure.
parent
c192885d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
17 deletions
+29
-17
stateblock.c
dlls/wined3d/stateblock.c
+29
-17
No files found.
dlls/wined3d/stateblock.c
View file @
cc85c6af
...
@@ -196,19 +196,10 @@ static HRESULT stateblock_allocate_shader_constants(struct wined3d_stateblock *o
...
@@ -196,19 +196,10 @@ static HRESULT stateblock_allocate_shader_constants(struct wined3d_stateblock *o
{
{
const
struct
wined3d_d3d_info
*
d3d_info
=
&
object
->
device
->
adapter
->
d3d_info
;
const
struct
wined3d_d3d_info
*
d3d_info
=
&
object
->
device
->
adapter
->
d3d_info
;
/* Allocate space for floating point constants */
object
->
state
.
ps_consts_f
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
float
)
*
d3d_info
->
limits
.
ps_uniform_count
*
4
);
if
(
!
object
->
state
.
ps_consts_f
)
goto
fail
;
object
->
changed
.
pixelShaderConstantsF
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
object
->
changed
.
pixelShaderConstantsF
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
BOOL
)
*
d3d_info
->
limits
.
ps_uniform_count
);
sizeof
(
BOOL
)
*
d3d_info
->
limits
.
ps_uniform_count
);
if
(
!
object
->
changed
.
pixelShaderConstantsF
)
goto
fail
;
if
(
!
object
->
changed
.
pixelShaderConstantsF
)
goto
fail
;
object
->
state
.
vs_consts_f
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
float
)
*
d3d_info
->
limits
.
vs_uniform_count
*
4
);
if
(
!
object
->
state
.
vs_consts_f
)
goto
fail
;
object
->
changed
.
vertexShaderConstantsF
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
object
->
changed
.
vertexShaderConstantsF
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
BOOL
)
*
d3d_info
->
limits
.
vs_uniform_count
);
sizeof
(
BOOL
)
*
d3d_info
->
limits
.
vs_uniform_count
);
if
(
!
object
->
changed
.
vertexShaderConstantsF
)
goto
fail
;
if
(
!
object
->
changed
.
vertexShaderConstantsF
)
goto
fail
;
...
@@ -225,9 +216,7 @@ static HRESULT stateblock_allocate_shader_constants(struct wined3d_stateblock *o
...
@@ -225,9 +216,7 @@ static HRESULT stateblock_allocate_shader_constants(struct wined3d_stateblock *o
fail:
fail:
ERR
(
"Failed to allocate memory
\n
"
);
ERR
(
"Failed to allocate memory
\n
"
);
HeapFree
(
GetProcessHeap
(),
0
,
object
->
state
.
ps_consts_f
);
HeapFree
(
GetProcessHeap
(),
0
,
object
->
changed
.
pixelShaderConstantsF
);
HeapFree
(
GetProcessHeap
(),
0
,
object
->
changed
.
pixelShaderConstantsF
);
HeapFree
(
GetProcessHeap
(),
0
,
object
->
state
.
vs_consts_f
);
HeapFree
(
GetProcessHeap
(),
0
,
object
->
changed
.
vertexShaderConstantsF
);
HeapFree
(
GetProcessHeap
(),
0
,
object
->
changed
.
vertexShaderConstantsF
);
HeapFree
(
GetProcessHeap
(),
0
,
object
->
contained_vs_consts_f
);
HeapFree
(
GetProcessHeap
(),
0
,
object
->
contained_vs_consts_f
);
HeapFree
(
GetProcessHeap
(),
0
,
object
->
contained_ps_consts_f
);
HeapFree
(
GetProcessHeap
(),
0
,
object
->
contained_ps_consts_f
);
...
@@ -609,6 +598,29 @@ static void state_cleanup(struct wined3d_state *state)
...
@@ -609,6 +598,29 @@ static void state_cleanup(struct wined3d_state *state)
HeapFree
(
GetProcessHeap
(),
0
,
state
->
ps_consts_f
);
HeapFree
(
GetProcessHeap
(),
0
,
state
->
ps_consts_f
);
}
}
static
HRESULT
state_init
(
struct
wined3d_state
*
state
,
const
struct
wined3d_d3d_info
*
d3d_info
)
{
unsigned
int
i
;
for
(
i
=
0
;
i
<
LIGHTMAP_SIZE
;
i
++
)
{
list_init
(
&
state
->
light_map
[
i
]);
}
if
(
!
(
state
->
vs_consts_f
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
4
*
sizeof
(
float
)
*
d3d_info
->
limits
.
vs_uniform_count
)))
return
E_OUTOFMEMORY
;
if
(
!
(
state
->
ps_consts_f
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
4
*
sizeof
(
float
)
*
d3d_info
->
limits
.
ps_uniform_count
)))
{
HeapFree
(
GetProcessHeap
(),
0
,
state
->
vs_consts_f
);
return
E_OUTOFMEMORY
;
}
return
WINED3D_OK
;
}
ULONG
CDECL
wined3d_stateblock_decref
(
struct
wined3d_stateblock
*
stateblock
)
ULONG
CDECL
wined3d_stateblock_decref
(
struct
wined3d_stateblock
*
stateblock
)
{
{
ULONG
refcount
=
InterlockedDecrement
(
&
stateblock
->
ref
);
ULONG
refcount
=
InterlockedDecrement
(
&
stateblock
->
ref
);
...
@@ -1407,21 +1419,21 @@ void stateblock_init_default_state(struct wined3d_stateblock *stateblock)
...
@@ -1407,21 +1419,21 @@ void stateblock_init_default_state(struct wined3d_stateblock *stateblock)
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
)
{
{
unsigned
int
i
;
HRESULT
hr
;
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
;
for
(
i
=
0
;
i
<
LIGHTMAP_SIZE
;
i
++
)
if
(
FAILED
(
hr
=
state_init
(
&
stateblock
->
state
,
d3d_info
)))
return
hr
;
if
(
FAILED
(
hr
=
stateblock_allocate_shader_constants
(
stateblock
)))
{
{
list_init
(
&
stateblock
->
state
.
light_map
[
i
]);
state_cleanup
(
&
stateblock
->
state
);
return
hr
;
}
}
hr
=
stateblock_allocate_shader_constants
(
stateblock
);
if
(
FAILED
(
hr
))
return
hr
;
/* The WINED3D_SBT_INIT stateblock type is used during initialization to
/* The WINED3D_SBT_INIT stateblock type is used during initialization to
* produce a placeholder stateblock so other functions called can update a
* produce a placeholder stateblock so other functions called can update a
* state block. */
* state block. */
...
...
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