Not sure about the extension replacement mechanism. Also, should tests be failing when extensions aren't supported?
-- v5: opengl32: Expose GL_EXT_memory_object_win32. win32u/opengl: Implement glImportMemoryWin32(Handle/Name)EXT for opaque handle types. opengl32, win32u: Move gl_error to wgl_context. win32u/opengl: Implement GL_DEVICE_LUID_EXT and GL_DEVICE_NODE_MASK_EXT. opengl32: Cleanup glGet* and fix typo in glGetDoublev.
From: Derek Lesho dlesho@codeweavers.com
Signed-off-by: Derek Lesho dlesho@codeweavers.com --- dlls/opengl32/unix_wgl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/opengl32/unix_wgl.c b/dlls/opengl32/unix_wgl.c index 6b00e22c0d1..8878aae8a54 100644 --- a/dlls/opengl32/unix_wgl.c +++ b/dlls/opengl32/unix_wgl.c @@ -2017,7 +2017,7 @@ void wrap_glGetIntegerv( TEB *teb, GLenum pname, GLint *data ) { const struct opengl_funcs *funcs = teb->glTable; if (get_integer( teb, pname, data )) return; - funcs->p_glGetIntegerv( pname, data ); + else funcs->p_glGetIntegerv( pname, data ); }
void wrap_glGetBooleanv( TEB *teb, GLenum pname, GLboolean *data ) @@ -2033,7 +2033,7 @@ void wrap_glGetDoublev( TEB *teb, GLenum pname, GLdouble *data ) const struct opengl_funcs *funcs = teb->glTable; GLint value; if (get_integer( teb, pname, &value )) *data = value; - funcs->p_glGetDoublev( pname, data ); + else funcs->p_glGetDoublev( pname, data ); }
void wrap_glGetFloatv( TEB *teb, GLenum pname, GLfloat *data )
From: Derek Lesho dlesho@codeweavers.com
Signed-off-by: Derek Lesho dlesho@codeweavers.com --- dlls/win32u/opengl.c | 52 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+)
diff --git a/dlls/win32u/opengl.c b/dlls/win32u/opengl.c index 57a0c773cbc..09e2214f2ff 100644 --- a/dlls/win32u/opengl.c +++ b/dlls/win32u/opengl.c @@ -2439,6 +2439,54 @@ static const char *win32u_wglQueryCurrentRendererStringWINE( GLenum attribute ) return query_renderer_string( LIST_ENTRY( ptr, struct egl_platform, entry ), attribute ); }
+static BOOL get_luid( LUID *luid, UINT32 *node_mask ) +{ + struct opengl_funcs *funcs = &display_funcs; + GLint uuid_count = 0; + GUID uuid; + + funcs->p_glGetIntegerv( GL_NUM_DEVICE_UUIDS_EXT, &uuid_count ); + if (!uuid_count) + return FALSE; + + funcs->p_glGetUnsignedBytei_vEXT( GL_DEVICE_UUID_EXT, 0, (GLubyte *) &uuid ); + return get_luid_from_vulkan_uuid(&uuid, luid, node_mask); +} + +#define HOST_GL_FUNC(func) ((typeof(display_funcs.p_##func)) driver_funcs->p_get_proc_address( #func )) + +static void win32u_glGetIntegerv( GLenum pname, GLint *data ) +{ + if (pname == GL_DEVICE_NODE_MASK_EXT) + { + LUID luid; + UINT32 node_mask; + + if (get_luid( &luid, &node_mask )) + *data = node_mask; + } + else + { + HOST_GL_FUNC(glGetIntegerv)( pname, data ); + } +} + +static void win32u_glGetUnsignedBytevEXT( GLenum pname, GLubyte *data ) +{ + if (pname == GL_DEVICE_LUID_EXT) + { + LUID luid; + UINT32 node_mask; + + if (get_luid( &luid, &node_mask )) + memcpy( data, &luid, GL_LUID_SIZE_EXT ); + } + else + { + HOST_GL_FUNC(glGetUnsignedBytevEXT)( pname, data ); + } +} + static void display_funcs_init(void) { struct egl_platform *egl; @@ -2540,6 +2588,10 @@ static void display_funcs_init(void) display_funcs.p_wglSwapIntervalEXT = win32u_wglSwapIntervalEXT; display_funcs.p_wglGetSwapIntervalEXT = win32u_wglGetSwapIntervalEXT;
+ /* EXT_external_objects_win32 */ + display_funcs.p_glGetIntegerv = win32u_glGetIntegerv; + display_funcs.p_glGetUnsignedBytevEXT = win32u_glGetUnsignedBytevEXT; + if (!list_empty( &devices_egl )) { register_extension( wgl_extensions, ARRAY_SIZE(wgl_extensions), "WGL_WINE_query_renderer" );
From: Derek Lesho dlesho@codeweavers.com
Signed-off-by: Derek Lesho dlesho@codeweavers.com --- dlls/opengl32/make_opengl | 2 +- dlls/opengl32/unix_thunks.c | 5 ++--- dlls/opengl32/unix_thunks.h | 2 +- dlls/opengl32/unix_wgl.c | 35 ++++++++++++----------------------- include/wine/opengl_driver.h | 10 ++++++++++ 5 files changed, 26 insertions(+), 28 deletions(-)
diff --git a/dlls/opengl32/make_opengl b/dlls/opengl32/make_opengl index 61eafbec33e..87bff92c310 100755 --- a/dlls/opengl32/make_opengl +++ b/dlls/opengl32/make_opengl @@ -200,6 +200,7 @@ my %manual_unix_thunks = "glFramebufferReadBufferEXT" => 1, "glGetBooleanv" => 1, "glGetDoublev" => 1, + "glGetError" => 1, "glGetFloatv" => 1, "glGetFramebufferParameterivEXT" => 1, "glGetInteger64v" => 1, @@ -288,7 +289,6 @@ my %manual_wow64_wrappers = "glFlushMappedNamedBufferRangeEXT" => 0, "glGetBufferPointerv" => 0, "glGetBufferPointervARB" => 0, - "glGetError" => 0, "glGetNamedBufferPointerv" => 0, "glGetNamedBufferPointervEXT" => 0, "glGetSynciv" => 0, diff --git a/dlls/opengl32/unix_thunks.c b/dlls/opengl32/unix_thunks.c index 7d4c00edbe9..835e7636d54 100644 --- a/dlls/opengl32/unix_thunks.c +++ b/dlls/opengl32/unix_thunks.c @@ -1019,8 +1019,7 @@ static NTSTATUS gl_glGetDoublev( void *args ) static NTSTATUS gl_glGetError( void *args ) { struct glGetError_params *params = args; - const struct opengl_funcs *funcs = params->teb->glTable; - params->ret = funcs->p_glGetError(); + params->ret = wrap_glGetError( params->teb ); return STATUS_SUCCESS; }
@@ -32252,7 +32251,7 @@ static NTSTATUS wow64_gl_glGetError( void *args ) GLenum ret; } *params = args; TEB *teb = get_teb64( params->teb ); - params->ret = wow64_glGetError( teb ); + params->ret = wrap_glGetError( teb ); return STATUS_SUCCESS; }
diff --git a/dlls/opengl32/unix_thunks.h b/dlls/opengl32/unix_thunks.h index 4bf2d13c476..3f00ad63832 100644 --- a/dlls/opengl32/unix_thunks.h +++ b/dlls/opengl32/unix_thunks.h @@ -16,6 +16,7 @@ extern void wrap_glFinish( TEB *teb ); extern void wrap_glFlush( TEB *teb ); extern void wrap_glGetBooleanv( TEB *teb, GLenum pname, GLboolean *data ); extern void wrap_glGetDoublev( TEB *teb, GLenum pname, GLdouble *data ); +extern GLenum wrap_glGetError( TEB *teb ); extern void wrap_glGetFloatv( TEB *teb, GLenum pname, GLfloat *data ); extern void wrap_glGetIntegerv( TEB *teb, GLenum pname, GLint *data ); extern const GLubyte *wrap_glGetString( TEB *teb, GLenum name ); @@ -47,7 +48,6 @@ extern BOOL wrap_wglReleaseTexImageARB( TEB *teb, HPBUFFERARB hPbuffer, int iBuf extern BOOL wrap_wglSetPbufferAttribARB( TEB *teb, HPBUFFERARB hPbuffer, const int *piAttribList );
#ifdef _WIN64 -extern GLenum wow64_glGetError( TEB *teb ); extern void wow64_glBufferStorage( TEB *teb, GLenum target, GLsizeiptr size, const void *data, GLbitfield flags ); extern GLenum wow64_glClientWaitSync( TEB *teb, GLsync sync, GLbitfield flags, GLuint64 timeout ); extern void wow64_glDeleteBuffers( TEB *teb, GLsizei n, const GLuint *buffers ); diff --git a/dlls/opengl32/unix_wgl.c b/dlls/opengl32/unix_wgl.c index 8878aae8a54..242bb9bdaf7 100644 --- a/dlls/opengl32/unix_wgl.c +++ b/dlls/opengl32/unix_wgl.c @@ -143,7 +143,6 @@ struct context GLubyte *extensions; /* extension string */ char *wow64_version; /* wow64 GL version override */ struct buffers *buffers; /* wow64 buffers map */ - GLenum gl_error; /* wrapped GL error */ const char **extension_array; /* array of supported extensions */ size_t extension_count; /* size of supported extensions */ BOOL use_pinned_memory; /* use GL_AMD_pinned_memory to emulate persistent maps */ @@ -2064,6 +2063,18 @@ void wrap_glGetFramebufferParameterivEXT( TEB *teb, GLuint fbo, GLenum pname, GL funcs->p_glGetFramebufferParameterivEXT( fbo, pname, params ); }
+GLenum wrap_glGetError( TEB *teb ) +{ + struct wgl_context *ctx = &get_current_context( teb, NULL, NULL )->base; + const struct opengl_funcs *funcs = teb->glTable; + GLenum gl_err, prev_err; + + gl_err = funcs->p_glGetError(); + prev_err = ctx->gl_error; + ctx->gl_error = GL_NO_ERROR; + return prev_err ? prev_err : gl_err; +} + NTSTATUS process_attach( void *args ) { struct process_attach_params *params = args; @@ -2161,28 +2172,6 @@ NTSTATUS return_wow64_string( const void *str, PTR32 *wow64_str ) return STATUS_BUFFER_TOO_SMALL; }
-GLenum wow64_glGetError( TEB *teb ) -{ - const struct opengl_funcs *funcs = teb->glTable; - GLenum gl_err, prev_err; - struct context *ctx; - - if (!(ctx = get_current_context( teb, NULL, NULL ))) return GL_INVALID_OPERATION; - gl_err = funcs->p_glGetError(); - prev_err = ctx->gl_error; - ctx->gl_error = GL_NO_ERROR; - return prev_err ? prev_err : gl_err; -} - -static void set_gl_error( TEB *teb, GLenum gl_error ) -{ - const struct opengl_funcs *funcs = teb->glTable; - struct context *ctx; - - if (!(ctx = get_current_context( teb, NULL, NULL )) || ctx->gl_error) return; - if (!(ctx->gl_error = funcs->p_glGetError())) ctx->gl_error = gl_error; -} - static struct wgl_handle *get_sync_ptr( TEB *teb, GLsync sync ) { struct wgl_handle *handle = get_handle_ptr( sync ); diff --git a/include/wine/opengl_driver.h b/include/wine/opengl_driver.h index 77d1c818438..1ee22365429 100644 --- a/include/wine/opengl_driver.h +++ b/include/wine/opengl_driver.h @@ -77,6 +77,7 @@ struct wgl_context int format; /* pixel format of the context */ struct opengl_drawable *draw; /* currently bound draw surface */ struct opengl_drawable *read; /* currently bound read surface */ + GLenum gl_error; /* wrapped GL error */ };
/* interface between opengl32 and win32u */ @@ -129,6 +130,15 @@ struct opengl_funcs void *egl_handle; };
+static inline void set_gl_error( TEB *teb, GLenum gl_error ) +{ + const struct opengl_funcs *funcs = teb->glTable; + struct wgl_context *ctx = teb->glContext; + + if (!ctx || ctx->gl_error) return; + if (!(ctx->gl_error = funcs->p_glGetError())) ctx->gl_error = gl_error; +} + struct egl_platform { struct list entry;
From: Derek Lesho dlesho@codeweavers.com
Signed-off-by: Derek Lesho dlesho@codeweavers.com --- dlls/win32u/opengl.c | 74 ++++++++++++++++++++++++++++++++++++ dlls/win32u/tests/d3dkmt.c | 38 +++++++++--------- dlls/win32u/vulkan.c | 2 +- dlls/win32u/win32u_private.h | 2 + 4 files changed, 96 insertions(+), 20 deletions(-)
diff --git a/dlls/win32u/opengl.c b/dlls/win32u/opengl.c index 09e2214f2ff..a8b18dc0613 100644 --- a/dlls/win32u/opengl.c +++ b/dlls/win32u/opengl.c @@ -26,6 +26,7 @@ #include <assert.h> #include <pthread.h> #include <dlfcn.h> +#include <unistd.h>
#include "ntstatus.h" #define WIN32_NO_STATUS @@ -2487,6 +2488,77 @@ static void win32u_glGetUnsignedBytevEXT( GLenum pname, GLubyte *data ) } }
+static void import_memory( GLuint memory, GLuint64 size, GLenum handleType, void *handle, const void *name ) +{ + struct opengl_funcs *funcs = &display_funcs; + + D3DKMT_HANDLE local, mutex, sync; + GLenum err; + int fd; + + switch (handleType) + { + case GL_HANDLE_TYPE_OPAQUE_WIN32_EXT: + if (name) handle = open_shared_resource_from_name( (const WCHAR *)name ); + if (!handle) + { + set_gl_error( NtCurrentTeb(), GL_INVALID_VALUE ); + return; + } + local = d3dkmt_open_resource( 0, handle, &mutex, &sync ); + if (name) NtClose( handle ); + break; + case GL_HANDLE_TYPE_OPAQUE_WIN32_KMT_EXT: + if (!handle) + { + set_gl_error( NtCurrentTeb(), GL_INVALID_VALUE ); + return; + } + local = d3dkmt_open_resource( PtrToUlong( handle ), NULL, &mutex, &sync ); + break; + default: + set_gl_error( NtCurrentTeb(), GL_INVALID_ENUM ); + return; + } + + if (mutex) + d3dkmt_destroy_mutex( mutex ); + if (sync) + d3dkmt_destroy_sync( sync ); + + if ((fd = d3dkmt_object_get_fd( local )) < 0) + { + set_gl_error( NtCurrentTeb(), GL_INVALID_VALUE ); + return; + } + + d3dkmt_destroy_resource( local ); + + set_gl_error( NtCurrentTeb(), funcs->p_glGetError() ); + + funcs->p_glImportMemoryFdEXT( memory, size, GL_HANDLE_TYPE_OPAQUE_FD_EXT, fd ); + + if ((err = funcs->p_glGetError()) != GL_NO_ERROR) + { + close( fd ); + set_gl_error( NtCurrentTeb(), err ); + } +} + +static void win32u_glImportMemoryWin32HandleEXT( GLuint memory, GLuint64 size, GLenum handleType, void *handle ) +{ + TRACE( "memory %u size %s handleType %#x handle %p\n", memory, wine_dbgstr_longlong( size ), handleType, handle ); + + return import_memory( memory, size, handleType, handle, NULL ); +} + +static void win32u_glImportMemoryWin32NameEXT( GLuint memory, GLuint64 size, GLenum handleType, const void *name ) +{ + TRACE( "memory %u size %s handleType %#x name %s\n", memory, wine_dbgstr_longlong( size ), handleType, debugstr_w( name ) ); + + return import_memory( memory, size, handleType, NULL, name ); +} + static void display_funcs_init(void) { struct egl_platform *egl; @@ -2591,6 +2663,8 @@ static void display_funcs_init(void) /* EXT_external_objects_win32 */ display_funcs.p_glGetIntegerv = win32u_glGetIntegerv; display_funcs.p_glGetUnsignedBytevEXT = win32u_glGetUnsignedBytevEXT; + display_funcs.p_glImportMemoryWin32HandleEXT = win32u_glImportMemoryWin32HandleEXT; + display_funcs.p_glImportMemoryWin32NameEXT = win32u_glImportMemoryWin32NameEXT;
if (!list_empty( &devices_egl )) { diff --git a/dlls/win32u/tests/d3dkmt.c b/dlls/win32u/tests/d3dkmt.c index f5f6573d0f0..a852c2f45d9 100644 --- a/dlls/win32u/tests/d3dkmt.c +++ b/dlls/win32u/tests/d3dkmt.c @@ -4328,7 +4328,7 @@ static GLuint import_opengl_image( struct opengl_device *dev, UINT width, UINT h if (name) { PFN_glImportMemoryWin32NameEXT p_glImportMemoryWin32NameEXT = (void *)wglGetProcAddress( "glImportMemoryWin32NameEXT" ); - todo_wine ok_ptr( p_glImportMemoryWin32NameEXT, !=, NULL ); + ok_ptr( p_glImportMemoryWin32NameEXT, !=, NULL ); if (!p_glImportMemoryWin32NameEXT) return 0;
p_glCreateMemoryObjectsEXT( 1, &memory ); @@ -4339,7 +4339,7 @@ static GLuint import_opengl_image( struct opengl_device *dev, UINT width, UINT h else { PFN_glImportMemoryWin32HandleEXT p_glImportMemoryWin32HandleEXT = (void *)wglGetProcAddress( "glImportMemoryWin32HandleEXT" ); - todo_wine ok_ptr( p_glImportMemoryWin32HandleEXT, !=, NULL ); + ok_ptr( p_glImportMemoryWin32HandleEXT, !=, NULL ); if (!p_glImportMemoryWin32HandleEXT) return 0;
p_glCreateMemoryObjectsEXT( 1, &memory ); @@ -5701,25 +5701,25 @@ static void test_shared_resources(void) test_import_opengl_image( opengl_imp, resource_size, 1, 1, 1, name, handle, GL_HANDLE_TYPE_OPAQUE_WIN32_KMT_EXT ); ok_x4( glGetError(), ==, 0 ); test_import_opengl_image( opengl_imp, resource_size, 1, 1, 1, name, handle, GL_HANDLE_TYPE_D3D11_IMAGE_KMT_EXT ); - ok_x4( glGetError(), ==, 0 ); + todo_wine ok_x4( glGetError(), ==, 0 ); break; case 1: test_import_opengl_image( opengl_imp, width_1d, 1, array_1d, 4, name, handle, GL_HANDLE_TYPE_OPAQUE_WIN32_KMT_EXT ); ok_x4( glGetError(), ==, 0 ); test_import_opengl_image( opengl_imp, width_1d, 1, array_1d, 4, name, handle, GL_HANDLE_TYPE_D3D11_IMAGE_KMT_EXT ); - ok_x4( glGetError(), ==, 0 ); + todo_wine ok_x4( glGetError(), ==, 0 ); break; case 2: test_import_opengl_image( opengl_imp, width_2d, height_2d, 1, 4, name, handle, GL_HANDLE_TYPE_OPAQUE_WIN32_KMT_EXT ); ok_x4( glGetError(), ==, 0 ); test_import_opengl_image( opengl_imp, width_2d, height_2d, 1, 4, name, handle, GL_HANDLE_TYPE_D3D11_IMAGE_KMT_EXT ); - ok_x4( glGetError(), ==, 0 ); + todo_wine ok_x4( glGetError(), ==, 0 ); break; case 3: test_import_opengl_image( opengl_imp, width_3d, height_3d, depth_3d, 4, name, handle, GL_HANDLE_TYPE_OPAQUE_WIN32_KMT_EXT ); ok_x4( glGetError(), ==, 0 ); test_import_opengl_image( opengl_imp, width_3d, height_3d, depth_3d, 4, name, handle, GL_HANDLE_TYPE_D3D11_IMAGE_KMT_EXT ); - ok_x4( glGetError(), ==, 0 ); + todo_wine ok_x4( glGetError(), ==, 0 ); break; } } @@ -5731,41 +5731,41 @@ static void test_shared_resources(void) test_import_opengl_image( opengl_imp, resource_size, 1, 1, 1, name, handle, GL_HANDLE_TYPE_OPAQUE_WIN32_EXT ); ok_x4( glGetError(), ==, 0 ); test_import_opengl_image( opengl_imp, resource_size, 1, 1, 1, name, handle, GL_HANDLE_TYPE_D3D11_IMAGE_EXT ); - ok_x4( glGetError(), ==, 0 ); + todo_wine ok_x4( glGetError(), ==, 0 ); test_import_opengl_image( opengl_imp, resource_size, 1, 1, 1, name, handle, GL_HANDLE_TYPE_D3D12_TILEPOOL_EXT ); - ok_x4( glGetError(), ==, 0 ); + todo_wine ok_x4( glGetError(), ==, 0 ); test_import_opengl_image( opengl_imp, resource_size, 1, 1, 1, name, handle, GL_HANDLE_TYPE_D3D12_RESOURCE_EXT ); - ok_x4( glGetError(), ==, 0 ); + todo_wine ok_x4( glGetError(), ==, 0 ); break; case 1: test_import_opengl_image( opengl_imp, width_1d, 1, array_1d, 4, name, handle, GL_HANDLE_TYPE_OPAQUE_WIN32_EXT ); ok_x4( glGetError(), ==, 0 ); test_import_opengl_image( opengl_imp, width_1d, 1, array_1d, 4, name, handle, GL_HANDLE_TYPE_D3D11_IMAGE_EXT ); - ok_x4( glGetError(), ==, 0 ); + todo_wine ok_x4( glGetError(), ==, 0 ); test_import_opengl_image( opengl_imp, width_1d, 1, array_1d, 4, name, handle, GL_HANDLE_TYPE_D3D12_TILEPOOL_EXT ); - ok_x4( glGetError(), ==, 0 ); + todo_wine ok_x4( glGetError(), ==, 0 ); test_import_opengl_image( opengl_imp, width_1d, 1, array_1d, 4, name, handle, GL_HANDLE_TYPE_D3D12_RESOURCE_EXT ); - ok_x4( glGetError(), ==, 0 ); + todo_wine ok_x4( glGetError(), ==, 0 ); break; case 2: test_import_opengl_image( opengl_imp, width_2d, height_2d, 1, 4, name, handle, GL_HANDLE_TYPE_OPAQUE_WIN32_EXT ); ok_x4( glGetError(), ==, 0 ); test_import_opengl_image( opengl_imp, width_2d, height_2d, 1, 4, name, handle, GL_HANDLE_TYPE_D3D11_IMAGE_EXT ); - ok_x4( glGetError(), ==, 0 ); + todo_wine ok_x4( glGetError(), ==, 0 ); test_import_opengl_image( opengl_imp, width_2d, height_2d, 1, 4, name, handle, GL_HANDLE_TYPE_D3D12_TILEPOOL_EXT ); - ok_x4( glGetError(), ==, 0 ); + todo_wine ok_x4( glGetError(), ==, 0 ); test_import_opengl_image( opengl_imp, width_2d, height_2d, 1, 4, name, handle, GL_HANDLE_TYPE_D3D12_RESOURCE_EXT ); - ok_x4( glGetError(), ==, 0 ); + todo_wine ok_x4( glGetError(), ==, 0 ); break; case 3: test_import_opengl_image( opengl_imp, width_3d, height_3d, depth_3d, 4, name, handle, GL_HANDLE_TYPE_OPAQUE_WIN32_EXT ); ok_x4( glGetError(), ==, 0 ); test_import_opengl_image( opengl_imp, width_3d, height_3d, depth_3d, 4, name, handle, GL_HANDLE_TYPE_D3D11_IMAGE_EXT ); - ok_x4( glGetError(), ==, 0 ); + todo_wine ok_x4( glGetError(), ==, 0 ); test_import_opengl_image( opengl_imp, width_3d, height_3d, depth_3d, 4, name, handle, GL_HANDLE_TYPE_D3D12_TILEPOOL_EXT ); - ok_x4( glGetError(), ==, 0 ); + todo_wine ok_x4( glGetError(), ==, 0 ); test_import_opengl_image( opengl_imp, width_3d, height_3d, depth_3d, 4, name, handle, GL_HANDLE_TYPE_D3D12_RESOURCE_EXT ); - ok_x4( glGetError(), ==, 0 ); + todo_wine ok_x4( glGetError(), ==, 0 ); break; } } @@ -5804,7 +5804,7 @@ static void test_shared_resources(void) if (opengl_imp && GET_DIM(test) == 2 && !opengl_imp->broken) { gl_img = import_opengl_image( opengl_imp, width_2d, height_2d, 1, 4, name, handle, GL_HANDLE_TYPE_OPAQUE_WIN32_EXT ); - ok_x4( glGetError(), ==, 0 ); + todo_wine ok_x4( glGetError(), ==, 0 );
CloseHandle( handle ); status = open_shared_resource( path, &handle ); diff --git a/dlls/win32u/vulkan.c b/dlls/win32u/vulkan.c index d0bcffcb458..98436367756 100644 --- a/dlls/win32u/vulkan.c +++ b/dlls/win32u/vulkan.c @@ -312,7 +312,7 @@ static HANDLE create_shared_resource_handle( D3DKMT_HANDLE local, const VkExport return NULL; }
-static HANDLE open_shared_resource_from_name( const WCHAR *name ) +HANDLE open_shared_resource_from_name( const WCHAR *name ) { D3DKMT_OPENNTHANDLEFROMNAME open_name = {0}; WCHAR bufferW[MAX_PATH * 2]; diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h index 0b69ccd481d..5b39b12d6c8 100644 --- a/dlls/win32u/win32u_private.h +++ b/dlls/win32u/win32u_private.h @@ -209,6 +209,8 @@ extern BOOL get_luid_from_vulkan_uuid( const GUID *uuid, LUID *luid, UINT32 *nod extern int d3dkmt_object_get_fd( D3DKMT_HANDLE local ); extern NTSTATUS d3dkmt_destroy_mutex( D3DKMT_HANDLE local );
+extern HANDLE open_shared_resource_from_name( const WCHAR *name ); + extern D3DKMT_HANDLE d3dkmt_create_resource( int fd, D3DKMT_HANDLE *global ); extern D3DKMT_HANDLE d3dkmt_open_resource( D3DKMT_HANDLE global, HANDLE shared, D3DKMT_HANDLE *mutex_local, D3DKMT_HANDLE *sync_local ); extern NTSTATUS d3dkmt_destroy_resource( D3DKMT_HANDLE local );
From: Derek Lesho dlesho@codeweavers.com
Signed-off-by: Derek Lesho dlesho@codeweavers.com --- dlls/opengl32/unix_wgl.c | 35 +++++++++++++++++++++++++++++++++-- dlls/win32u/tests/d3dkmt.c | 4 ++-- 2 files changed, 35 insertions(+), 4 deletions(-)
diff --git a/dlls/opengl32/unix_wgl.c b/dlls/opengl32/unix_wgl.c index 242bb9bdaf7..6f5a772d2ff 100644 --- a/dlls/opengl32/unix_wgl.c +++ b/dlls/opengl32/unix_wgl.c @@ -542,6 +542,12 @@ static const char *legacy_extensions[] = NULL, };
+static const char *platform_extensions[] = +{ + "GL_EXT_memory_object_fd", "GL_EXT_memory_object_win32", + NULL +}; + static const char *parse_gl_version( const char *gl_version, int *major, int *minor ) { const char *ptr = gl_version; @@ -735,6 +741,7 @@ static GLubyte *filter_extensions( struct context *ctx, const char *extensions )
size = strlen( extensions ) + 2; for (extra = legacy_extensions; *extra; extra++) size += strlen( *extra ) + 1; + for (extra = platform_extensions; *extra; extra+=2) size += strlen( extra[1] + 1 ); if (!(p = str = malloc( size ))) return NULL;
TRACE( "GL_EXTENSIONS:\n" ); @@ -748,10 +755,22 @@ static GLubyte *filter_extensions( struct context *ctx, const char *extensions ) memcpy( p, extensions, end - extensions ); p[end - extensions] = 0;
+ for (extra = platform_extensions; *extra; extra += 2) + { + if (strcmp(p, extra[0])) + continue; + + TRACE("Replace platform extension %s with:\n", p); + + size = strlen( extra[1] ); + memcpy( p, extra[1], size ); + p[size] = 0; + } + if (is_extension_supported( ctx, p )) { TRACE( "++ %s\n", p ); - p += end - extensions; + p += strlen(p); *p++ = ' '; } else @@ -1232,6 +1251,7 @@ static void make_context_current( TEB *teb, const struct opengl_funcs *funcs, HD if (ctx->major_version >= 3) { GLint extensions_count; + const char **platform_ext;
if (!funcs->p_glGetStringi) { @@ -1242,7 +1262,18 @@ static void make_context_current( TEB *teb, const struct opengl_funcs *funcs, HD funcs->p_glGetIntegerv( GL_NUM_EXTENSIONS, &extensions_count ); size += extensions_count; if (!(extensions = malloc( size * sizeof(*extensions) ))) return; - for (i = 0; i < extensions_count; i++) extensions[count++] = (const char *)funcs->p_glGetStringi( GL_EXTENSIONS, i ); + for (i = 0; i < extensions_count; i++) + { + extensions[count] = (const char *)funcs->p_glGetStringi( GL_EXTENSIONS, i ); + + for (platform_ext = platform_extensions; *platform_ext; platform_ext+=2) + { + if (!strcmp(extensions[count], platform_ext[0])) + extensions[count] = platform_ext[1]; + } + + count++; + } } else { diff --git a/dlls/win32u/tests/d3dkmt.c b/dlls/win32u/tests/d3dkmt.c index a852c2f45d9..3d102489949 100644 --- a/dlls/win32u/tests/d3dkmt.c +++ b/dlls/win32u/tests/d3dkmt.c @@ -4250,7 +4250,7 @@ static struct opengl_device *create_opengl_device( HWND hwnd, LUID *luid ) ok_ptr( extensions, !=, NULL );
ptr = find_opengl_extension( extensions, "GL_EXT_memory_object_win32" ); - todo_wine ok_ptr( ptr, !=, NULL ); + ok_ptr( ptr, !=, NULL ); ptr = find_opengl_extension( extensions, "GL_EXT_semaphore_win32" ); todo_wine ok_ptr( ptr, !=, NULL ); ptr = find_opengl_extension( extensions, "GL_EXT_win32_keyed_mutex" ); @@ -4274,7 +4274,7 @@ static struct opengl_device *create_opengl_device( HWND hwnd, LUID *luid ) ok_x4( glGetError(), ==, 0 ); ok( !IsEqualGUID( &GUID_NULL, &guid ), "got GL_DRIVER_UUID_EXT %s\n", debugstr_guid( &guid ) );
- if (!winetest_platform_is_wine) /* crashes in host drivers */ + if (find_opengl_extension( extensions, "GL_EXT_memory_object_win32" ) || find_opengl_extension( extensions, "GL_EXT_semaphore_win32" )) /* crashes in host drivers */ { LUID device_luid = {0}; unsigned int nodes = 0;
On Tue Dec 2 16:11:05 2025 +0000, Derek Lesho wrote:
changed this line in [version 5 of the diff](/wine/wine/-/merge_requests/9572/diffs?diff_id=229162&start_sha=7866f0bfc4b042b9ec104dd4b980b411c48e4f5f#f4de89b6fe59a53c44625c669ffde0c88cf41d0b_918_902)
I went the way of implementing it in win32u.
On Tue Dec 2 16:11:06 2025 +0000, Derek Lesho wrote:
changed this line in [version 5 of the diff](/wine/wine/-/merge_requests/9572/diffs?diff_id=229162&start_sha=7866f0bfc4b042b9ec104dd4b980b411c48e4f5f#832d3127ac90db21326c970af502e8c173db234b_123_123)
Done