[PATCH 1/4] wined3d: Add driver and device UUIDs to adapter identifiers.

Józef Kucia jkucia at codeweavers.com
Tue Mar 12 10:30:18 CDT 2019


Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
---
 dlls/wined3d/adapter_gl.c      | 26 ++++++++++++++++++++++++++
 dlls/wined3d/directx.c         |  7 ++++++-
 dlls/wined3d/wined3d_gl.h      |  3 ++-
 dlls/wined3d/wined3d_private.h |  4 +++-
 include/wine/wined3d.h         |  8 +++++---
 5 files changed, 42 insertions(+), 6 deletions(-)

diff --git a/dlls/wined3d/adapter_gl.c b/dlls/wined3d/adapter_gl.c
index 492d7f952305..5bcb39f59c14 100644
--- a/dlls/wined3d/adapter_gl.c
+++ b/dlls/wined3d/adapter_gl.c
@@ -179,6 +179,7 @@ static const struct wined3d_extension_map gl_extension_map[] =
     {"GL_EXT_framebuffer_blit",             EXT_FRAMEBUFFER_BLIT          },
     {"GL_EXT_framebuffer_multisample",      EXT_FRAMEBUFFER_MULTISAMPLE   },
     {"GL_EXT_framebuffer_object",           EXT_FRAMEBUFFER_OBJECT        },
+    {"GL_EXT_memory_object",                EXT_MEMORY_OBJECT             },
     {"GL_EXT_gpu_program_parameters",       EXT_GPU_PROGRAM_PARAMETERS    },
     {"GL_EXT_gpu_shader4",                  EXT_GPU_SHADER4               },
     {"GL_EXT_packed_depth_stencil",         EXT_PACKED_DEPTH_STENCIL      },
@@ -2499,6 +2500,9 @@ static void load_gl_funcs(struct wined3d_gl_info *gl_info)
     USE_GL_FUNC(glVertexAttribI4uivEXT)
     USE_GL_FUNC(glVertexAttribI4usvEXT)
     USE_GL_FUNC(glVertexAttribIPointerEXT)
+    /* GL_EXT_memory_object */
+    USE_GL_FUNC(glGetUnsignedBytei_vEXT)
+    USE_GL_FUNC(glGetUnsignedBytevEXT)
     /* GL_EXT_point_parameters */
     USE_GL_FUNC(glPointParameterfEXT)
     USE_GL_FUNC(glPointParameterfvEXT)
@@ -3871,6 +3875,28 @@ static BOOL wined3d_adapter_init_gl_caps(struct wined3d_adapter *adapter,
     adapter->vram_bytes_used = 0;
     TRACE("Emulating 0x%s bytes of video ram.\n", wine_dbgstr_longlong(driver_info->vram_bytes));
 
+    if (gl_info->supported[EXT_MEMORY_OBJECT])
+    {
+        GLint device_count = 0;
+
+        gl_info->gl_ops.gl.p_glGetIntegerv(GL_NUM_DEVICE_UUIDS_EXT, &device_count);
+        if (device_count > 0)
+        {
+            if (device_count > 1)
+                FIXME("A set of %d devices is not supported.\n", device_count);
+
+            GL_EXTCALL(glGetUnsignedBytevEXT(GL_DRIVER_UUID_EXT, (GLubyte *)&adapter->driver_uuid));
+            GL_EXTCALL(glGetUnsignedBytei_vEXT(GL_DEVICE_UUID_EXT, 0, (GLubyte *)&adapter->device_uuid));
+
+            TRACE("Driver UUID: %s, device UUID %s.\n",
+                    debugstr_guid(&adapter->driver_uuid), debugstr_guid(&adapter->device_uuid));
+        }
+        else
+        {
+            WARN("Unexpected device count %d.\n", device_count);
+        }
+    }
+
     gl_ext_emul_mask = adapter->vertex_pipe->vp_get_emul_mask(gl_info)
             | adapter->fragment_pipe->get_emul_mask(gl_info);
     if (gl_ext_emul_mask & GL_EXT_EMUL_ARB_MULTITEXTURE)
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index a05f6cccdc4a..d51e672a137e 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -1211,7 +1211,9 @@ HRESULT CDECL wined3d_get_adapter_identifier(const struct wined3d *wined3d,
     identifier->device_id = adapter->driver_info.device;
     identifier->subsystem_id = 0;
     identifier->revision = 0;
-    memcpy(&identifier->device_identifier, &IID_D3DDEVICE_D3DUID, sizeof(identifier->device_identifier));
+    identifier->device_identifier = IID_D3DDEVICE_D3DUID;
+    identifier->driver_uuid = adapter->driver_uuid;
+    identifier->device_uuid = adapter->device_uuid;
     identifier->whql_level = (flags & WINED3DENUM_NO_WHQL_LEVEL) ? 0 : 1;
     identifier->adapter_luid = adapter->luid;
     identifier->video_memory = min(~(SIZE_T)0, adapter->driver_info.vram_bytes);
@@ -2548,6 +2550,9 @@ static BOOL wined3d_adapter_init(struct wined3d_adapter *adapter, unsigned int o
     TRACE("Allocated LUID %08x:%08x for adapter %p.\n",
             adapter->luid.HighPart, adapter->luid.LowPart, adapter);
 
+    memset(&adapter->driver_uuid, 0, sizeof(adapter->driver_uuid));
+    memset(&adapter->device_uuid, 0, sizeof(adapter->device_uuid));
+
     adapter->formats = NULL;
 
     if (wined3d_creation_flags & WINED3D_NO3D)
diff --git a/dlls/wined3d/wined3d_gl.h b/dlls/wined3d/wined3d_gl.h
index a02073c28af1..ae067e65805a 100644
--- a/dlls/wined3d/wined3d_gl.h
+++ b/dlls/wined3d/wined3d_gl.h
@@ -157,14 +157,15 @@ enum wined3d_gl_extension
     EXT_BLEND_FUNC_SEPARATE,
     EXT_BLEND_MINMAX,
     EXT_BLEND_SUBTRACT,
-    EXT_DRAW_BUFFERS2,
     EXT_DEPTH_BOUNDS_TEST,
+    EXT_DRAW_BUFFERS2,
     EXT_FOG_COORD,
     EXT_FRAMEBUFFER_BLIT,
     EXT_FRAMEBUFFER_MULTISAMPLE,
     EXT_FRAMEBUFFER_OBJECT,
     EXT_GPU_PROGRAM_PARAMETERS,
     EXT_GPU_SHADER4,
+    EXT_MEMORY_OBJECT,
     EXT_PACKED_DEPTH_STENCIL,
     EXT_PACKED_FLOAT,
     EXT_POINT_PARAMETERS,
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 6907c7b2e926..d0edb8c8bd86 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2686,7 +2686,7 @@ BOOL wined3d_adapter_gl_create_context(struct wined3d_context *context,
 /* The adapter structure */
 struct wined3d_adapter
 {
-    UINT ordinal;
+    unsigned int ordinal;
     POINT monitor_position;
     enum wined3d_format_id screen_format;
 
@@ -2694,6 +2694,8 @@ struct wined3d_adapter
     struct wined3d_d3d_info d3d_info;
     struct wined3d_driver_info driver_info;
     UINT64 vram_bytes_used;
+    GUID driver_uuid;
+    GUID device_uuid;
     LUID luid;
 
     WCHAR device_name[CCHDEVICENAME]; /* for use with e.g. ChangeDisplaySettings() */
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index 07329024fefb..2f8ed5efc77f 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -1719,17 +1719,19 @@ struct wined3d_tri_patch_info
 struct wined3d_adapter_identifier
 {
     char *driver;
-    UINT driver_size;
+    unsigned int driver_size;
     char *description;
-    UINT description_size;
+    unsigned int description_size;
     char *device_name;
-    UINT device_name_size;
+    unsigned int device_name_size;
     LARGE_INTEGER driver_version;
     DWORD vendor_id;
     DWORD device_id;
     DWORD subsystem_id;
     DWORD revision;
     GUID device_identifier;
+    GUID driver_uuid;
+    GUID device_uuid;
     DWORD whql_level;
     LUID adapter_luid;
     SIZE_T video_memory;
-- 
2.19.2




More information about the wine-devel mailing list