On Mon, 25 Nov 2019 at 17:43, Conor McCarthy cmccarthy@codeweavers.com wrote:
+void CDECL wined3d_update_adapter_memory_info(const struct wined3d *wined3d, unsigned int adapter_idx,
unsigned int non_local, UINT64 bytes_total, INT64 bytes_added)
Is it ever necessary to override the total amount of video memory? I think it would make most sense to add support for events and different memory types to adapter_adjust_memory(), and then implement this function on top of that one.
+HRESULT CDECL wined3d_get_adapter_memory_info(const struct wined3d *wined3d, unsigned int adapter_idx,
unsigned int non_local, struct wined3d_adapter_memory_info *info)
If we have wined3d_get_adapter_memory_info(), the memory information in struct wined3d_adapter_identifier becomes redundant and could be removed. I'd consider splitting this patch set in a slightly different way, essentially introducing the wined3d functions in the same dxgi patch that uses them. E.g., introducing wined3d_get_adapter_memory_info() would be part of the patch that modifies dxgi_adapter_QueryVideoMemoryInfo().
+static BOOL wined3d_set_unused_event_handle(struct wined3d_adapter *adapter, HANDLE event, DWORD *cookie) +{
- DWORD i;
- for (i = 0; i < adapter->event_count; ++i)
- {
if (!adapter->memory_events[i])
{
adapter->memory_events[i] = event;
*cookie = i;
return TRUE;
}
- }
- return FALSE;
+}
+HRESULT CDECL wined3d_register_adapter_memory_event(const struct wined3d *wined3d, unsigned int adapter_idx,
HANDLE event, DWORD *cookie)
+{
<snip>
- if (!wined3d_set_unused_event_handle(adapter, event, cookie))
- {
if(!(new_buffer = heap_realloc(adapter->memory_events, (adapter->event_count + 1) * sizeof(*adapter->memory_events))))
That looks like something that should use a free-list and wined3d_array_reserve().