Setting the return type of various wined3d refcounting functions to void These patches modify: - wined3d_incref - wined3d_decref - wined3d_resource_incref - wined3d_resource_decref
From: Max Figura maxfigura5061@gmail.com
--- dlls/wined3d/directx.c | 4 +--- include/wine/wined3d.h | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index a6e9e57269a..5101c93bf41 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -185,13 +185,11 @@ void wined3d_adapter_cleanup(struct wined3d_adapter *adapter) D3DKMTCloseAdapter(&close_adapter_desc); }
-ULONG CDECL wined3d_incref(struct wined3d *wined3d) +void CDECL wined3d_incref(struct wined3d *wined3d) { unsigned int refcount = InterlockedIncrement(&wined3d->ref);
TRACE("%p increasing refcount to %u.\n", wined3d, refcount); - - return refcount; }
ULONG CDECL wined3d_decref(struct wined3d *wined3d) diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index d20157b1223..1bd4c693a00 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -2313,7 +2313,7 @@ struct wined3d_adapter * __cdecl wined3d_get_adapter(const struct wined3d *wined UINT __cdecl wined3d_get_adapter_count(const struct wined3d *wined3d); HRESULT __cdecl wined3d_get_device_caps(const struct wined3d_adapter *adapter, enum wined3d_device_type device_type, struct wined3d_caps *caps); -ULONG __cdecl wined3d_incref(struct wined3d *wined3d); +void __cdecl wined3d_incref(struct wined3d *wined3d); HRESULT __cdecl wined3d_register_software_device(struct wined3d *wined3d, void *init_function); BOOL __cdecl wined3d_register_window(struct wined3d *wined3d, HWND window, struct wined3d_device *device, unsigned int flags);
From: Max Figura maxfigura5061@gmail.com
--- dlls/wined3d/directx.c | 4 +--- include/wine/wined3d.h | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index 5101c93bf41..b9b0fff9c16 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -192,7 +192,7 @@ void CDECL wined3d_incref(struct wined3d *wined3d) TRACE("%p increasing refcount to %u.\n", wined3d, refcount); }
-ULONG CDECL wined3d_decref(struct wined3d *wined3d) +void CDECL wined3d_decref(struct wined3d *wined3d) { unsigned int refcount = InterlockedDecrement(&wined3d->ref);
@@ -212,8 +212,6 @@ ULONG CDECL wined3d_decref(struct wined3d *wined3d) heap_free(wined3d); wined3d_mutex_unlock(); } - - return refcount; }
/* Certain applications (e.g. Steam) complain if we report an outdated driver diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index 1bd4c693a00..efce8448d69 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -2307,7 +2307,7 @@ HRESULT __cdecl wined3d_check_device_type(const struct wined3d *wined3d, enum wined3d_format_id display_format_id, enum wined3d_format_id backbuffer_format_id, BOOL windowed); struct wined3d * __cdecl wined3d_create(uint32_t flags); -ULONG __cdecl wined3d_decref(struct wined3d *wined3d); +void __cdecl wined3d_decref(struct wined3d *wined3d); struct wined3d_adapter * __cdecl wined3d_get_adapter(const struct wined3d *wined3d, unsigned int idx); UINT __cdecl wined3d_get_adapter_count(const struct wined3d *wined3d);
From: Max Figura maxfigura5061@gmail.com
--- dlls/wined3d/wined3d_private.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index f7c9c75364c..878f9fa77ca 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -4441,9 +4441,9 @@ struct wined3d_resource LONG rtv_bind_count_device; };
-static inline ULONG wined3d_resource_incref(struct wined3d_resource *resource) +static inline void wined3d_resource_incref(struct wined3d_resource *resource) { - return resource->resource_ops->resource_incref(resource); + resource->resource_ops->resource_incref(resource); }
static inline ULONG wined3d_resource_decref(struct wined3d_resource *resource)
From: Max Figura maxfigura5061@gmail.com
--- dlls/wined3d/wined3d_private.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 878f9fa77ca..e177a447a5b 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -4446,9 +4446,9 @@ static inline void wined3d_resource_incref(struct wined3d_resource *resource) resource->resource_ops->resource_incref(resource); }
-static inline ULONG wined3d_resource_decref(struct wined3d_resource *resource) +static inline void wined3d_resource_decref(struct wined3d_resource *resource) { - return resource->resource_ops->resource_decref(resource); + resource->resource_ops->resource_decref(resource); }
static inline HRESULT wined3d_resource_get_sub_resource_desc(struct wined3d_resource *resource,
That's fine I guess, but is there any issue with returning the refcounts? It appears that we use them sporadically, like `wined3d_stateblock_decref` return value is used to print an error in `d3d_device7_DeleteStateBlock`. I'd rather not do the work unless there's some reason to.
As might have been guessed this was my idea. It was brought on during the long types conversion; I figured there wasn't really reason for the refcounting functions to return any value, since a well-behaved program should never care, and a few ERR messages wasn't really worth it. I don't mind dropping these patches, though.
I don't really mind including these either, just don't see the upside - I don't think returning the values costs anything in terms of runtime? On the other hand I could imagine using them for debugging reference count underflows.
This merge request was closed by Zebediah Figura.
Yeah, if it's not clearly an improvement it's probably better to close it rather than spend time discussing it.