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
3f455832
Commit
3f455832
authored
Dec 06, 2011
by
Henri Verbeet
Committed by
Alexandre Julliard
Dec 07, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Unbind stateblock resources in wined3d_device_uninit_3d().
parent
5b17ba88
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
57 additions
and
47 deletions
+57
-47
device.c
dlls/wined3d/device.c
+4
-10
stateblock.c
dlls/wined3d/stateblock.c
+52
-37
wined3d_private.h
dlls/wined3d/wined3d_private.h
+1
-0
No files found.
dlls/wined3d/device.c
View file @
3f455832
...
...
@@ -1427,6 +1427,8 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device)
if
(
device
->
logo_surface
)
wined3d_surface_decref
(
device
->
logo_surface
);
stateblock_unbind_resources
(
device
->
stateBlock
);
/* Unload resources */
LIST_FOR_EACH_ENTRY_SAFE
(
resource
,
cursor
,
&
device
->
resources
,
struct
wined3d_resource
,
resource_list_entry
)
{
...
...
@@ -5412,20 +5414,12 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
struct
wined3d_display_mode
mode
;
BOOL
DisplayModeChanged
=
FALSE
;
BOOL
update_desc
=
FALSE
;
unsigned
int
i
;
HRESULT
hr
;
TRACE
(
"device %p, swapchain_desc %p.
\n
"
,
device
,
swapchain_desc
);
wined3d_device_set_index_buffer
(
device
,
NULL
,
WINED3DFMT_UNKNOWN
);
for
(
i
=
0
;
i
<
MAX_STREAMS
;
++
i
)
{
wined3d_device_set_stream_source
(
device
,
i
,
NULL
,
0
,
0
);
}
for
(
i
=
0
;
i
<
MAX_COMBINED_SAMPLERS
;
++
i
)
{
wined3d_device_set_texture
(
device
,
i
,
NULL
);
}
stateblock_unbind_resources
(
device
->
stateBlock
);
if
(
device
->
onscreen_depth_stencil
)
{
wined3d_surface_decref
(
device
->
onscreen_depth_stencil
);
...
...
dlls/wined3d/stateblock.c
View file @
3f455832
...
...
@@ -466,54 +466,69 @@ ULONG CDECL wined3d_stateblock_incref(struct wined3d_stateblock *stateblock)
return
refcount
;
}
ULONG
CDECL
wined3d_stateblock_decref
(
struct
wined3d_stateblock
*
stateblock
)
void
stateblock_unbind_resources
(
struct
wined3d_stateblock
*
stateblock
)
{
ULONG
refcount
=
InterlockedDecrement
(
&
stateblock
->
ref
);
TRACE
(
"%p decreasing refcount to %u
\n
"
,
stateblock
,
refcount
);
struct
wined3d_state
*
state
=
&
stateblock
->
state
;
struct
wined3d_vertex_declaration
*
decl
;
struct
wined3d_texture
*
texture
;
struct
wined3d_buffer
*
buffer
;
struct
wined3d_shader
*
shader
;
unsigned
int
i
;
if
(
!
refcount
)
if
(
(
decl
=
state
->
vertex_declaration
)
)
{
struct
wined3d_buffer
*
buffer
;
int
counter
;
if
(
stateblock
->
state
.
vertex_declaration
)
wined3d_vertex_declaration_decref
(
stateblock
->
state
.
vertex_declaration
);
for
(
counter
=
0
;
counter
<
MAX_COMBINED_SAMPLERS
;
counter
++
)
{
struct
wined3d_texture
*
texture
=
stateblock
->
state
.
textures
[
counter
];
if
(
texture
)
{
stateblock
->
state
.
textures
[
counter
]
=
NULL
;
wined3d_texture_decref
(
texture
);
}
}
state
->
vertex_declaration
=
NULL
;
wined3d_vertex_declaration_decref
(
decl
);
}
for
(
counter
=
0
;
counter
<
MAX_STREAMS
;
++
counter
)
for
(
i
=
0
;
i
<
MAX_COMBINED_SAMPLERS
;
++
i
)
{
if
((
texture
=
state
->
textures
[
i
]))
{
buffer
=
stateblock
->
state
.
streams
[
counter
].
buffer
;
if
(
buffer
)
{
stateblock
->
state
.
streams
[
counter
].
buffer
=
NULL
;
if
(
wined3d_buffer_decref
(
buffer
))
{
WARN
(
"Buffer %p still referenced by stateblock, stream %u.
\n
"
,
buffer
,
counter
);
}
}
state
->
textures
[
i
]
=
NULL
;
wined3d_texture_decref
(
texture
);
}
}
buffer
=
stateblock
->
state
.
index_buffer
;
if
(
buffer
)
for
(
i
=
0
;
i
<
MAX_STREAMS
;
++
i
)
{
if
((
buffer
=
state
->
streams
[
i
].
buffer
))
{
state
block
->
state
.
index_
buffer
=
NULL
;
state
->
streams
[
i
].
buffer
=
NULL
;
wined3d_buffer_decref
(
buffer
);
}
}
if
(
stateblock
->
state
.
vertex_shader
)
wined3d_shader_decref
(
stateblock
->
state
.
vertex_shader
);
if
(
stateblock
->
state
.
pixel_shader
)
wined3d_shader_decref
(
stateblock
->
state
.
pixel_shader
);
if
((
buffer
=
state
->
index_buffer
))
{
state
->
index_buffer
=
NULL
;
wined3d_buffer_decref
(
buffer
);
}
if
((
shader
=
state
->
vertex_shader
))
{
state
->
vertex_shader
=
NULL
;
wined3d_shader_decref
(
shader
);
}
if
((
shader
=
state
->
pixel_shader
))
{
state
->
pixel_shader
=
NULL
;
wined3d_shader_decref
(
shader
);
}
}
ULONG
CDECL
wined3d_stateblock_decref
(
struct
wined3d_stateblock
*
stateblock
)
{
ULONG
refcount
=
InterlockedDecrement
(
&
stateblock
->
ref
);
TRACE
(
"%p decreasing refcount to %u
\n
"
,
stateblock
,
refcount
);
if
(
!
refcount
)
{
int
counter
;
stateblock_unbind_resources
(
stateblock
);
for
(
counter
=
0
;
counter
<
LIGHTMAP_SIZE
;
++
counter
)
{
...
...
dlls/wined3d/wined3d_private.h
View file @
3f455832
...
...
@@ -2331,6 +2331,7 @@ struct wined3d_stateblock
void
stateblock_init_contained_states
(
struct
wined3d_stateblock
*
stateblock
)
DECLSPEC_HIDDEN
;
void
stateblock_init_default_state
(
struct
wined3d_stateblock
*
stateblock
)
DECLSPEC_HIDDEN
;
void
stateblock_unbind_resources
(
struct
wined3d_stateblock
*
stateblock
)
DECLSPEC_HIDDEN
;
/* Direct3D terminology with little modifications. We do not have an issued state
* because only the driver knows about it, but we have a created state because d3d
...
...
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