summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/nine/iunknown.h
diff options
context:
space:
mode:
authorAxel Davy <[email protected]>2016-12-03 19:41:40 +0100
committerAxel Davy <[email protected]>2016-12-20 23:47:08 +0100
commit1843e36b03ed04d24a8baaac81eda3a84e676c72 (patch)
treed233bed2f5096b45de3e2b305bd4254fe797f438 /src/gallium/state_trackers/nine/iunknown.h
parent2fc8ef1401d455e3861bb233f09de4158d56a6be (diff)
st/nine: Do not bind the container if forward is false
This doesn't make sense to bind the container in that specific case. Signed-off-by: Axel Davy <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers/nine/iunknown.h')
-rw-r--r--src/gallium/state_trackers/nine/iunknown.h12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/gallium/state_trackers/nine/iunknown.h b/src/gallium/state_trackers/nine/iunknown.h
index f827b138b52..4b9edaa355e 100644
--- a/src/gallium/state_trackers/nine/iunknown.h
+++ b/src/gallium/state_trackers/nine/iunknown.h
@@ -52,8 +52,8 @@ struct NineUnknown
/* container: for surfaces and volumes only.
* Can be a texture, a volume texture or a swapchain.
* forward is set to false for the swapchain case.
- * Refs are passed to the container if forward is set.
- * The container has bind increased if the object has non null bind. */
+ * If forward is set, refs are passed to the container if forward is set
+ * and the container has bind increased if the object has non null bind. */
struct NineUnknown *container;
struct NineDevice9 *device; /* referenced if (refs) */
@@ -136,7 +136,7 @@ NineUnknown_Bind( struct NineUnknown *This )
UINT b = p_atomic_inc_return(&This->bind);
assert(b);
- if (b == 1 && This->container)
+ if (b == 1 && This->forward)
NineUnknown_Bind(This->container);
return b;
@@ -147,9 +147,9 @@ NineUnknown_Unbind( struct NineUnknown *This )
{
UINT b = p_atomic_dec_return(&This->bind);
- if (b == 0 && This->container)
+ if (b == 0 && This->forward)
NineUnknown_Unbind(This->container);
- else if (b == 0 && This->refs == 0)
+ else if (b == 0 && This->refs == 0 && !This->container)
This->dtor(This);
return b;
@@ -168,8 +168,6 @@ NineUnknown_Detach( struct NineUnknown *This )
{
assert(This->container && !This->forward);
- if (This->bind)
- NineUnknown_Unbind(This->container);
This->container = NULL;
if (!(This->refs | This->bind))
This->dtor(This);