summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAxel Davy <[email protected]>2018-09-09 12:39:10 +0200
committerAxel Davy <[email protected]>2018-09-25 22:05:24 +0200
commite83b15cba0ef2712c51ee7b5049e364853ff3707 (patch)
tree9dbf7097b4b25bfb6db56f7000a566927841e466
parentfd86ce7c1464c74c167a850e77bc6fb073a143d5 (diff)
st/nine: Add new helper for object creation with bind
Add a new helper to create objects starting with a bind count instead of a ref count. Signed-off-by: Axel Davy <[email protected]>
-rw-r--r--src/gallium/state_trackers/nine/nine_helpers.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/gallium/state_trackers/nine/nine_helpers.h b/src/gallium/state_trackers/nine/nine_helpers.h
index a0c55bd9eed..c14dd1c04fc 100644
--- a/src/gallium/state_trackers/nine/nine_helpers.h
+++ b/src/gallium/state_trackers/nine/nine_helpers.h
@@ -99,6 +99,32 @@ static inline void _nine_bind(void **dst, void *obj)
} \
return D3D_OK
+#define NINE_DEVICE_CHILD_BIND_NEW(nine, out, dev, ...) \
+ { \
+ struct NineUnknownParams __params; \
+ struct Nine##nine *__data; \
+ \
+ __data = CALLOC_STRUCT(Nine##nine); \
+ if (!__data) { return E_OUTOFMEMORY; } \
+ \
+ __params.vtable = ((dev)->params.BehaviorFlags & D3DCREATE_MULTITHREADED) ? &Lock##nine##_vtable : &Nine##nine##_vtable; \
+ __params.guids = Nine##nine##_IIDs; \
+ __params.dtor = (void *)Nine##nine##_dtor; \
+ __params.container = NULL; \
+ __params.device = dev; \
+ __params.start_with_bind_not_ref = true; \
+ { \
+ HRESULT __hr = Nine##nine##_ctor(__data, &__params, ## __VA_ARGS__); \
+ if (FAILED(__hr)) { \
+ Nine##nine##_dtor(__data); \
+ return __hr; \
+ } \
+ } \
+ \
+ *(out) = __data; \
+ } \
+ return D3D_OK
+
#define NINE_NEW(nine, out, lock, ...) \
{ \
struct NineUnknownParams __params; \