summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAxel Davy <[email protected]>2018-09-09 12:36:28 +0200
committerAxel Davy <[email protected]>2018-09-25 22:05:24 +0200
commitfd86ce7c1464c74c167a850e77bc6fb073a143d5 (patch)
tree4d049722651649823e051c3cafaa7b5f148f6158
parenta9bf82ecf4c284989c40e4e6c1f6962bc9bd58d2 (diff)
st/nine: Add parameter to start with bind
Add a parameter to start new object with a bind instead of a refcount. Signed-off-by: Axel Davy <[email protected]>
-rw-r--r--src/gallium/state_trackers/nine/iunknown.c18
-rw-r--r--src/gallium/state_trackers/nine/iunknown.h1
-rw-r--r--src/gallium/state_trackers/nine/nine_helpers.h2
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)) { \