diff options
-rw-r--r-- | src/gallium/state_trackers/nine/iunknown.c | 18 | ||||
-rw-r--r-- | src/gallium/state_trackers/nine/iunknown.h | 1 | ||||
-rw-r--r-- | src/gallium/state_trackers/nine/nine_helpers.h | 2 |
3 files changed, 18 insertions, 3 deletions
diff --git a/src/gallium/state_trackers/nine/iunknown.c b/src/gallium/state_trackers/nine/iunknown.c index d76d6447896..3835651f536 100644 --- a/src/gallium/state_trackers/nine/iunknown.c +++ b/src/gallium/state_trackers/nine/iunknown.c @@ -34,9 +34,21 @@ HRESULT NineUnknown_ctor( struct NineUnknown *This, struct NineUnknownParams *pParams ) { - This->refs = pParams->container ? 0 : 1; - This->bind = 0; - This->forward = !This->refs; + if (pParams->container) { + This->refs = 0; + This->forward = true; + This->bind = 0; + assert(!pParams->start_with_bind_not_ref); + } else if (pParams->start_with_bind_not_ref) { + This->refs = 0; + This->forward = false; + This->bind = 1; + } else { + This->refs = 1; + This->forward = false; + This->bind = 0; + } + This->container = pParams->container; This->device = pParams->device; if (This->refs && This->device) diff --git a/src/gallium/state_trackers/nine/iunknown.h b/src/gallium/state_trackers/nine/iunknown.h index f9ce7b50c97..2f7582ae477 100644 --- a/src/gallium/state_trackers/nine/iunknown.h +++ b/src/gallium/state_trackers/nine/iunknown.h @@ -78,6 +78,7 @@ struct NineUnknownParams void (*dtor)(void *data); struct NineUnknown *container; struct NineDevice9 *device; + bool start_with_bind_not_ref; }; HRESULT diff --git a/src/gallium/state_trackers/nine/nine_helpers.h b/src/gallium/state_trackers/nine/nine_helpers.h index b382c5b72b3..a0c55bd9eed 100644 --- a/src/gallium/state_trackers/nine/nine_helpers.h +++ b/src/gallium/state_trackers/nine/nine_helpers.h @@ -86,6 +86,7 @@ static inline void _nine_bind(void **dst, void *obj) __params.dtor = (void *)Nine##nine##_dtor; \ __params.container = NULL; \ __params.device = dev; \ + __params.start_with_bind_not_ref = false; \ { \ HRESULT __hr = Nine##nine##_ctor(__data, &__params, ## __VA_ARGS__); \ if (FAILED(__hr)) { \ @@ -111,6 +112,7 @@ static inline void _nine_bind(void **dst, void *obj) __params.dtor = (void *)Nine##nine##_dtor; \ __params.container = NULL; \ __params.device = NULL; \ + __params.start_with_bind_not_ref = false; \ { \ HRESULT __hr = Nine##nine##_ctor(__data, &__params, ## __VA_ARGS__); \ if (FAILED(__hr)) { \ |