I was watching some random YouTube stream and then heard a voice telling me to do this.
This can run wglgears on wow, though there's plenty of missing pieces which I don't have any idea how to fix (like buffer mapping, etc.). Opening it as a draft for now to show the whole thing, if it seems alright I'll send it in batches.
-- v7: HACK: wined3d: Disable persistent buffer mapping. HACK: wined3d: Ignore D3DKMT open errors. winex11.drv: Avoid crashing on invalid pixel format pointer. opengl32: Use the +opengl debug channel everywhere. opengl32: Implement wow64 thunks for glMapBuffer (et al.).
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/opengl32/make_opengl | 1 + dlls/opengl32/unix_thunks.c | 20 +------------------- dlls/opengl32/unix_wgl.c | 21 +++++++++++++++++++++ 3 files changed, 23 insertions(+), 19 deletions(-)
diff --git a/dlls/opengl32/make_opengl b/dlls/opengl32/make_opengl index 3155a2d797e..d41b6e7c054 100755 --- a/dlls/opengl32/make_opengl +++ b/dlls/opengl32/make_opengl @@ -171,6 +171,7 @@ my %manual_wow64_thunks = ( "glPathGlyphIndexRangeNV" => 1, "wglCreateContext" => 1, + "wglCreateContextAttribsARB" => 1, "wglDeleteContext" => 1, "wglGetProcAddress" => 1, "wglMakeContextCurrentARB" => 1, diff --git a/dlls/opengl32/unix_thunks.c b/dlls/opengl32/unix_thunks.c index 5accad6fc0b..6c8fba0b9f1 100644 --- a/dlls/opengl32/unix_thunks.c +++ b/dlls/opengl32/unix_thunks.c @@ -60644,25 +60644,6 @@ static NTSTATUS wow64_ext_wglChoosePixelFormatARB( void *args ) return status; }
-static NTSTATUS wow64_ext_wglCreateContextAttribsARB( void *args ) -{ - struct - { - PTR32 hDC; - PTR32 hShareContext; - PTR32 attribList; - PTR32 ret; - } *params32 = args; - struct wglCreateContextAttribsARB_params params = - { - .hDC = ULongToPtr(params32->hDC), - .hShareContext = ULongToPtr(params32->hShareContext), - .attribList = ULongToPtr(params32->attribList), - }; - FIXME( "params32 %p, params %p stub!\n", params32, ¶ms ); - return STATUS_NOT_IMPLEMENTED; -} - static NTSTATUS wow64_ext_wglCreatePbufferARB( void *args ) { struct @@ -61006,6 +60987,7 @@ extern NTSTATUS wow64_wgl_wglDeleteContext( void *args ) DECLSPEC_HIDDEN; extern NTSTATUS wow64_wgl_wglGetProcAddress( void *args ) DECLSPEC_HIDDEN; extern NTSTATUS wow64_wgl_wglMakeCurrent( void *args ) DECLSPEC_HIDDEN; extern NTSTATUS wow64_ext_glPathGlyphIndexRangeNV( void *args ) DECLSPEC_HIDDEN; +extern NTSTATUS wow64_ext_wglCreateContextAttribsARB( void *args ) DECLSPEC_HIDDEN; extern NTSTATUS wow64_ext_wglMakeContextCurrentARB( void *args ) DECLSPEC_HIDDEN;
const unixlib_entry_t __wine_unix_call_wow64_funcs[] = diff --git a/dlls/opengl32/unix_wgl.c b/dlls/opengl32/unix_wgl.c index 6dc659dcca5..8f5e8010ea8 100644 --- a/dlls/opengl32/unix_wgl.c +++ b/dlls/opengl32/unix_wgl.c @@ -1090,6 +1090,27 @@ NTSTATUS wow64_wgl_wglCreateContext( void *args ) return STATUS_SUCCESS; }
+NTSTATUS wow64_ext_wglCreateContextAttribsARB( void *args ) +{ + struct + { + PTR32 hDC; + PTR32 hShareContext; + PTR32 attribList; + PTR32 ret; + } *params32 = args; + struct wglCreateContextAttribsARB_params params = + { + .hDC = ULongToPtr(params32->hDC), + .hShareContext = ULongToPtr(params32->hShareContext), + .attribList = ULongToPtr(params32->attribList), + }; + NTSTATUS status; + if ((status = ext_wglCreateContextAttribsARB( ¶ms ))) return status; + params32->ret = (UINT_PTR)params.ret; + return STATUS_SUCCESS; +} + NTSTATUS wow64_wgl_wglDeleteContext( void *args ) { struct
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/opengl32/make_opengl | 1 + dlls/opengl32/unix_thunks.c | 24 +----------------------- dlls/opengl32/unix_wgl.c | 25 +++++++++++++++++++++++++ 3 files changed, 27 insertions(+), 23 deletions(-)
diff --git a/dlls/opengl32/make_opengl b/dlls/opengl32/make_opengl index d41b6e7c054..85e01379b59 100755 --- a/dlls/opengl32/make_opengl +++ b/dlls/opengl32/make_opengl @@ -172,6 +172,7 @@ my %manual_wow64_thunks = "glPathGlyphIndexRangeNV" => 1, "wglCreateContext" => 1, "wglCreateContextAttribsARB" => 1, + "wglCreatePbufferARB" => 1, "wglDeleteContext" => 1, "wglGetProcAddress" => 1, "wglMakeContextCurrentARB" => 1, diff --git a/dlls/opengl32/unix_thunks.c b/dlls/opengl32/unix_thunks.c index 6c8fba0b9f1..e891b59ac3e 100644 --- a/dlls/opengl32/unix_thunks.c +++ b/dlls/opengl32/unix_thunks.c @@ -60644,29 +60644,6 @@ static NTSTATUS wow64_ext_wglChoosePixelFormatARB( void *args ) return status; }
-static NTSTATUS wow64_ext_wglCreatePbufferARB( void *args ) -{ - struct - { - PTR32 hDC; - int iPixelFormat; - int iWidth; - int iHeight; - PTR32 piAttribList; - PTR32 ret; - } *params32 = args; - struct wglCreatePbufferARB_params params = - { - .hDC = ULongToPtr(params32->hDC), - .iPixelFormat = params32->iPixelFormat, - .iWidth = params32->iWidth, - .iHeight = params32->iHeight, - .piAttribList = ULongToPtr(params32->piAttribList), - }; - FIXME( "params32 %p, params %p stub!\n", params32, ¶ms ); - return STATUS_NOT_IMPLEMENTED; -} - static NTSTATUS wow64_ext_wglDestroyPbufferARB( void *args ) { struct @@ -60988,6 +60965,7 @@ extern NTSTATUS wow64_wgl_wglGetProcAddress( void *args ) DECLSPEC_HIDDEN; extern NTSTATUS wow64_wgl_wglMakeCurrent( void *args ) DECLSPEC_HIDDEN; extern NTSTATUS wow64_ext_glPathGlyphIndexRangeNV( void *args ) DECLSPEC_HIDDEN; extern NTSTATUS wow64_ext_wglCreateContextAttribsARB( void *args ) DECLSPEC_HIDDEN; +extern NTSTATUS wow64_ext_wglCreatePbufferARB( void *args ) DECLSPEC_HIDDEN; extern NTSTATUS wow64_ext_wglMakeContextCurrentARB( void *args ) DECLSPEC_HIDDEN;
const unixlib_entry_t __wine_unix_call_wow64_funcs[] = diff --git a/dlls/opengl32/unix_wgl.c b/dlls/opengl32/unix_wgl.c index 8f5e8010ea8..905cd4472be 100644 --- a/dlls/opengl32/unix_wgl.c +++ b/dlls/opengl32/unix_wgl.c @@ -1111,6 +1111,31 @@ NTSTATUS wow64_ext_wglCreateContextAttribsARB( void *args ) return STATUS_SUCCESS; }
+NTSTATUS wow64_ext_wglCreatePbufferARB( void *args ) +{ + struct + { + PTR32 hDC; + GLint iPixelFormat; + GLint iWidth; + GLint iHeight; + PTR32 piAttribList; + PTR32 ret; + } *params32 = args; + struct wglCreatePbufferARB_params params = + { + .hDC = ULongToPtr(params32->hDC), + .iPixelFormat = params32->iPixelFormat, + .iWidth = params32->iWidth, + .iHeight = params32->iHeight, + .piAttribList = ULongToPtr(params32->piAttribList), + }; + NTSTATUS status; + if ((status = ext_wglCreatePbufferARB( ¶ms ))) return status; + params32->ret = (UINT_PTR)params.ret; + return STATUS_SUCCESS; +} + NTSTATUS wow64_wgl_wglDeleteContext( void *args ) { struct
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/opengl32/make_opengl | 1 + dlls/opengl32/unix_thunks.c | 16 +--------------- dlls/opengl32/unix_wgl.c | 17 +++++++++++++++++ 3 files changed, 19 insertions(+), 15 deletions(-)
diff --git a/dlls/opengl32/make_opengl b/dlls/opengl32/make_opengl index 85e01379b59..1d15234b73d 100755 --- a/dlls/opengl32/make_opengl +++ b/dlls/opengl32/make_opengl @@ -174,6 +174,7 @@ my %manual_wow64_thunks = "wglCreateContextAttribsARB" => 1, "wglCreatePbufferARB" => 1, "wglDeleteContext" => 1, + "wglGetPbufferDCARB" => 1, "wglGetProcAddress" => 1, "wglMakeContextCurrentARB" => 1, "wglMakeCurrent" => 1, diff --git a/dlls/opengl32/unix_thunks.c b/dlls/opengl32/unix_thunks.c index e891b59ac3e..09d1c145bd1 100644 --- a/dlls/opengl32/unix_thunks.c +++ b/dlls/opengl32/unix_thunks.c @@ -60717,21 +60717,6 @@ static NTSTATUS wow64_ext_wglGetExtensionsStringEXT( void *args ) return STATUS_NOT_IMPLEMENTED; }
-static NTSTATUS wow64_ext_wglGetPbufferDCARB( void *args ) -{ - struct - { - PTR32 hPbuffer; - PTR32 ret; - } *params32 = args; - struct wglGetPbufferDCARB_params params = - { - .hPbuffer = ULongToPtr(params32->hPbuffer), - }; - FIXME( "params32 %p, params %p stub!\n", params32, ¶ms ); - return STATUS_NOT_IMPLEMENTED; -} - static NTSTATUS wow64_ext_wglGetPixelFormatAttribfvARB( void *args ) { struct @@ -60966,6 +60951,7 @@ extern NTSTATUS wow64_wgl_wglMakeCurrent( void *args ) DECLSPEC_HIDDEN; extern NTSTATUS wow64_ext_glPathGlyphIndexRangeNV( void *args ) DECLSPEC_HIDDEN; extern NTSTATUS wow64_ext_wglCreateContextAttribsARB( void *args ) DECLSPEC_HIDDEN; extern NTSTATUS wow64_ext_wglCreatePbufferARB( void *args ) DECLSPEC_HIDDEN; +extern NTSTATUS wow64_ext_wglGetPbufferDCARB( void *args ) DECLSPEC_HIDDEN; extern NTSTATUS wow64_ext_wglMakeContextCurrentARB( void *args ) DECLSPEC_HIDDEN;
const unixlib_entry_t __wine_unix_call_wow64_funcs[] = diff --git a/dlls/opengl32/unix_wgl.c b/dlls/opengl32/unix_wgl.c index 905cd4472be..8bf15b47bfe 100644 --- a/dlls/opengl32/unix_wgl.c +++ b/dlls/opengl32/unix_wgl.c @@ -1193,6 +1193,23 @@ NTSTATUS wow64_ext_wglMakeContextCurrentARB( void *args ) return status; }
+NTSTATUS wow64_ext_wglGetPbufferDCARB( void *args ) +{ + struct + { + PTR32 hPbuffer; + PTR32 ret; + } *params32 = args; + struct wglGetPbufferDCARB_params params = + { + .hPbuffer = (HPBUFFERARB)ULongToPtr(params32->hPbuffer), + }; + NTSTATUS status; + if ((status = ext_wglGetPbufferDCARB( ¶ms ))) return status; + params32->ret = (UINT_PTR)params.ret; + return STATUS_SUCCESS; +} + NTSTATUS wow64_wgl_wglGetProcAddress( void *args ) { struct
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/opengl32/make_opengl | 40 +++++++++++- dlls/opengl32/unix_private.h | 11 ++++ dlls/opengl32/unix_thunks.c | 122 +++++++++++++++++++++++++---------- 3 files changed, 138 insertions(+), 35 deletions(-)
diff --git a/dlls/opengl32/make_opengl b/dlls/opengl32/make_opengl index 1d15234b73d..6748350529c 100755 --- a/dlls/opengl32/make_opengl +++ b/dlls/opengl32/make_opengl @@ -179,6 +179,26 @@ my %manual_wow64_thunks = "wglMakeContextCurrentARB" => 1, "wglMakeCurrent" => 1, ); +my %pointer_array_count = + ( + "glCompileShaderIncludeARB" => "count", + "glCreateShaderProgramv" => "count", + "glGetUniformIndices" => "uniformCount", + "glMultiDrawElements" => "drawcount", + "glMultiDrawElementsBaseVertex" => "drawcount", + "glMultiDrawElementsEXT" => "primcount", + "glMultiModeDrawElementsIBM" => "primcount", + "glTransformFeedbackVaryings" => "count", + "glTransformFeedbackVaryingsEXT" => "count", + "glShaderSource" => "count", + "glShaderSourceARB" => "count", + "glBindBuffersRange" => "count", + "glBindVertexBuffers" => "count", + "glDrawCommandsNV" => "count", + "glVertexArrayVertexBuffers" => "count", + "glDrawCommandsStatesNV" => "count", + "glListDrawCommandsStatesClientNV" => "count", + );
# # Used to convert some types @@ -364,7 +384,7 @@ sub generate_wow64_thunk($$$) my $ptype = get_wow64_arg_type( $arg ); my $pname = get_arg_name( $arg ); $ret .= " $ptype $pname;\n"; - $need_manual_thunk = 1 if $arg->textContent() =~ /(*.**|[)/ || $arg->textContent() =~ /(sizei|int)ptr.**/; + $need_manual_thunk = 1 if ($arg->textContent() =~ /(*.**|[)/ || $arg->textContent() =~ /(sizei|int)ptr.**/) && !defined $pointer_array_count{$_}; } if (!is_void_func($func)) { @@ -403,6 +423,15 @@ sub generate_wow64_thunk($$$) }
$ret .= " NTSTATUS status;\n"; + + foreach my $arg (@{$func->[1]}) + { + next unless $arg->textContent() =~ /*.**/ || $arg->textContent() =~ /(sizei|int)ptr.**/; + next unless defined $pointer_array_count{$_}; + my $pname = get_arg_name( $arg ); + $ret .= " params.$pname = copy_wow64_ptr32s( (UINT_PTR)params32->$pname, params32->$pointer_array_count{$_} );\n"; + } + $ret .= " status = $prefix_$name( ¶ms );\n"; if (!is_void_func( $func )) { @@ -410,6 +439,15 @@ sub generate_wow64_thunk($$$) $ret .= "(UINT_PTR)" if get_wow64_arg_type( $func->[0] ) =~ /PTR32/; $ret .= "params.ret;\n"; } + + foreach my $arg (@{$func->[1]}) + { + next unless $arg->textContent() =~ /*.**/ || $arg->textContent() =~ /(sizei|int)ptr.**/; + next unless defined $pointer_array_count{$_}; + my $pname = get_arg_name( $arg ); + $ret .= " free( (void *)params.$pname );\n"; + } + $ret .= " return status;\n"; $ret .= "}\n\n";
diff --git a/dlls/opengl32/unix_private.h b/dlls/opengl32/unix_private.h index cab4b8fc502..f67372f4c2f 100644 --- a/dlls/opengl32/unix_private.h +++ b/dlls/opengl32/unix_private.h @@ -20,6 +20,7 @@
#include <stdarg.h> #include <stddef.h> +#include <stdlib.h>
#include "ntstatus.h" #define WIN32_NO_STATUS @@ -50,4 +51,14 @@ static inline struct opengl_funcs *get_dc_funcs( HDC hdc ) return funcs; }
+static inline void *copy_wow64_ptr32s( UINT_PTR address, ULONG count ) +{ + ULONG *ptrs = (ULONG *)address; + void **tmp; + + if (!ptrs || !(tmp = calloc( count, sizeof(*tmp) ))) return NULL; + while (count--) tmp[count] = ULongToPtr(ptrs[count]); + return tmp; +} + #endif /* __WINE_OPENGL32_UNIX_PRIVATE_H */ diff --git a/dlls/opengl32/unix_thunks.c b/dlls/opengl32/unix_thunks.c index 09d1c145bd1..f00ae443216 100644 --- a/dlls/opengl32/unix_thunks.c +++ b/dlls/opengl32/unix_thunks.c @@ -30337,8 +30337,13 @@ static NTSTATUS wow64_ext_glBindBuffersRange( void *args ) .count = params32->count, .buffers = ULongToPtr(params32->buffers), }; - FIXME( "params32 %p, params %p stub!\n", params32, ¶ms ); - return STATUS_NOT_IMPLEMENTED; + NTSTATUS status; + params.offsets = copy_wow64_ptr32s( (UINT_PTR)params32->offsets, params32->count ); + params.sizes = copy_wow64_ptr32s( (UINT_PTR)params32->sizes, params32->count ); + status = ext_glBindBuffersRange( ¶ms ); + free( (void *)params.offsets ); + free( (void *)params.sizes ); + return status; }
static NTSTATUS wow64_ext_glBindFragDataLocation( void *args ) @@ -30495,8 +30500,11 @@ static NTSTATUS wow64_ext_glBindVertexBuffers( void *args ) .buffers = ULongToPtr(params32->buffers), .strides = ULongToPtr(params32->strides), }; - FIXME( "params32 %p, params %p stub!\n", params32, ¶ms ); - return STATUS_NOT_IMPLEMENTED; + NTSTATUS status; + params.offsets = copy_wow64_ptr32s( (UINT_PTR)params32->offsets, params32->count ); + status = ext_glBindVertexBuffers( ¶ms ); + free( (void *)params.offsets ); + return status; }
static NTSTATUS wow64_ext_glBindVideoCaptureStreamBufferNV( void *args ) @@ -31728,8 +31736,11 @@ static NTSTATUS wow64_ext_glCompileShaderIncludeARB( void *args ) .count = params32->count, .length = ULongToPtr(params32->length), }; - FIXME( "params32 %p, params %p stub!\n", params32, ¶ms ); - return STATUS_NOT_IMPLEMENTED; + NTSTATUS status; + params.path = copy_wow64_ptr32s( (UINT_PTR)params32->path, params32->count ); + status = ext_glCompileShaderIncludeARB( ¶ms ); + free( (void *)params.path ); + return status; }
static NTSTATUS wow64_ext_glCompressedMultiTexImage1DEXT( void *args ) @@ -33073,8 +33084,12 @@ static NTSTATUS wow64_ext_glCreateShaderProgramv( void *args ) .type = params32->type, .count = params32->count, }; - FIXME( "params32 %p, params %p stub!\n", params32, ¶ms ); - return STATUS_NOT_IMPLEMENTED; + NTSTATUS status; + params.strings = copy_wow64_ptr32s( (UINT_PTR)params32->strings, params32->count ); + status = ext_glCreateShaderProgramv( ¶ms ); + params32->ret = params.ret; + free( (void *)params.strings ); + return status; }
static NTSTATUS wow64_ext_glCreateStatesNV( void *args ) @@ -34150,8 +34165,11 @@ static NTSTATUS wow64_ext_glDrawCommandsNV( void *args ) .sizes = ULongToPtr(params32->sizes), .count = params32->count, }; - FIXME( "params32 %p, params %p stub!\n", params32, ¶ms ); - return STATUS_NOT_IMPLEMENTED; + NTSTATUS status; + params.indirects = copy_wow64_ptr32s( (UINT_PTR)params32->indirects, params32->count ); + status = ext_glDrawCommandsNV( ¶ms ); + free( (void *)params.indirects ); + return status; }
static NTSTATUS wow64_ext_glDrawCommandsStatesAddressNV( void *args ) @@ -34196,8 +34214,11 @@ static NTSTATUS wow64_ext_glDrawCommandsStatesNV( void *args ) .fbos = ULongToPtr(params32->fbos), .count = params32->count, }; - FIXME( "params32 %p, params %p stub!\n", params32, ¶ms ); - return STATUS_NOT_IMPLEMENTED; + NTSTATUS status; + params.indirects = copy_wow64_ptr32s( (UINT_PTR)params32->indirects, params32->count ); + status = ext_glDrawCommandsStatesNV( ¶ms ); + free( (void *)params.indirects ); + return status; }
static NTSTATUS wow64_ext_glDrawElementsBaseVertex( void *args ) @@ -41899,8 +41920,11 @@ static NTSTATUS wow64_ext_glGetUniformIndices( void *args ) .uniformCount = params32->uniformCount, .uniformIndices = ULongToPtr(params32->uniformIndices), }; - FIXME( "params32 %p, params %p stub!\n", params32, ¶ms ); - return STATUS_NOT_IMPLEMENTED; + NTSTATUS status; + params.uniformNames = copy_wow64_ptr32s( (UINT_PTR)params32->uniformNames, params32->uniformCount ); + status = ext_glGetUniformIndices( ¶ms ); + free( (void *)params.uniformNames ); + return status; }
static NTSTATUS wow64_ext_glGetUniformLocation( void *args ) @@ -44411,8 +44435,11 @@ static NTSTATUS wow64_ext_glListDrawCommandsStatesClientNV( void *args ) .fbos = ULongToPtr(params32->fbos), .count = params32->count, }; - FIXME( "params32 %p, params %p stub!\n", params32, ¶ms ); - return STATUS_NOT_IMPLEMENTED; + NTSTATUS status; + params.indirects = copy_wow64_ptr32s( (UINT_PTR)params32->indirects, params32->count ); + status = ext_glListDrawCommandsStatesClientNV( ¶ms ); + free( (void *)params.indirects ); + return status; }
static NTSTATUS wow64_ext_glListParameterfvSGIX( void *args ) @@ -45597,8 +45624,11 @@ static NTSTATUS wow64_ext_glMultiDrawElements( void *args ) .type = params32->type, .drawcount = params32->drawcount, }; - FIXME( "params32 %p, params %p stub!\n", params32, ¶ms ); - return STATUS_NOT_IMPLEMENTED; + NTSTATUS status; + params.indices = copy_wow64_ptr32s( (UINT_PTR)params32->indices, params32->drawcount ); + status = ext_glMultiDrawElements( ¶ms ); + free( (void *)params.indices ); + return status; }
static NTSTATUS wow64_ext_glMultiDrawElementsBaseVertex( void *args ) @@ -45620,8 +45650,11 @@ static NTSTATUS wow64_ext_glMultiDrawElementsBaseVertex( void *args ) .drawcount = params32->drawcount, .basevertex = ULongToPtr(params32->basevertex), }; - FIXME( "params32 %p, params %p stub!\n", params32, ¶ms ); - return STATUS_NOT_IMPLEMENTED; + NTSTATUS status; + params.indices = copy_wow64_ptr32s( (UINT_PTR)params32->indices, params32->drawcount ); + status = ext_glMultiDrawElementsBaseVertex( ¶ms ); + free( (void *)params.indices ); + return status; }
static NTSTATUS wow64_ext_glMultiDrawElementsEXT( void *args ) @@ -45641,8 +45674,11 @@ static NTSTATUS wow64_ext_glMultiDrawElementsEXT( void *args ) .type = params32->type, .primcount = params32->primcount, }; - FIXME( "params32 %p, params %p stub!\n", params32, ¶ms ); - return STATUS_NOT_IMPLEMENTED; + NTSTATUS status; + params.indices = copy_wow64_ptr32s( (UINT_PTR)params32->indices, params32->primcount ); + status = ext_glMultiDrawElementsEXT( ¶ms ); + free( (void *)params.indices ); + return status; }
static NTSTATUS wow64_ext_glMultiDrawElementsIndirect( void *args ) @@ -45900,8 +45936,11 @@ static NTSTATUS wow64_ext_glMultiModeDrawElementsIBM( void *args ) .primcount = params32->primcount, .modestride = params32->modestride, }; - FIXME( "params32 %p, params %p stub!\n", params32, ¶ms ); - return STATUS_NOT_IMPLEMENTED; + NTSTATUS status; + params.indices = copy_wow64_ptr32s( (UINT_PTR)params32->indices, params32->primcount ); + status = ext_glMultiModeDrawElementsIBM( ¶ms ); + free( (void *)params.indices ); + return status; }
static NTSTATUS wow64_ext_glMultiTexCoord1bvOES( void *args ) @@ -52761,8 +52800,11 @@ static NTSTATUS wow64_ext_glShaderSource( void *args ) .count = params32->count, .length = ULongToPtr(params32->length), }; - FIXME( "params32 %p, params %p stub!\n", params32, ¶ms ); - return STATUS_NOT_IMPLEMENTED; + NTSTATUS status; + params.string = copy_wow64_ptr32s( (UINT_PTR)params32->string, params32->count ); + status = ext_glShaderSource( ¶ms ); + free( (void *)params.string ); + return status; }
static NTSTATUS wow64_ext_glShaderSourceARB( void *args ) @@ -52780,8 +52822,11 @@ static NTSTATUS wow64_ext_glShaderSourceARB( void *args ) .count = params32->count, .length = ULongToPtr(params32->length), }; - FIXME( "params32 %p, params %p stub!\n", params32, ¶ms ); - return STATUS_NOT_IMPLEMENTED; + NTSTATUS status; + params.string = copy_wow64_ptr32s( (UINT_PTR)params32->string, params32->count ); + status = ext_glShaderSourceARB( ¶ms ); + free( (void *)params.string ); + return status; }
static NTSTATUS wow64_ext_glShadingRateImagePaletteNV( void *args ) @@ -54719,8 +54764,11 @@ static NTSTATUS wow64_ext_glTransformFeedbackVaryings( void *args ) .count = params32->count, .bufferMode = params32->bufferMode, }; - FIXME( "params32 %p, params %p stub!\n", params32, ¶ms ); - return STATUS_NOT_IMPLEMENTED; + NTSTATUS status; + params.varyings = copy_wow64_ptr32s( (UINT_PTR)params32->varyings, params32->count ); + status = ext_glTransformFeedbackVaryings( ¶ms ); + free( (void *)params.varyings ); + return status; }
static NTSTATUS wow64_ext_glTransformFeedbackVaryingsEXT( void *args ) @@ -54738,8 +54786,11 @@ static NTSTATUS wow64_ext_glTransformFeedbackVaryingsEXT( void *args ) .count = params32->count, .bufferMode = params32->bufferMode, }; - FIXME( "params32 %p, params %p stub!\n", params32, ¶ms ); - return STATUS_NOT_IMPLEMENTED; + NTSTATUS status; + params.varyings = copy_wow64_ptr32s( (UINT_PTR)params32->varyings, params32->count ); + status = ext_glTransformFeedbackVaryingsEXT( ¶ms ); + free( (void *)params.varyings ); + return status; }
static NTSTATUS wow64_ext_glTransformFeedbackVaryingsNV( void *args ) @@ -56971,8 +57022,11 @@ static NTSTATUS wow64_ext_glVertexArrayVertexBuffers( void *args ) .buffers = ULongToPtr(params32->buffers), .strides = ULongToPtr(params32->strides), }; - FIXME( "params32 %p, params %p stub!\n", params32, ¶ms ); - return STATUS_NOT_IMPLEMENTED; + NTSTATUS status; + params.offsets = copy_wow64_ptr32s( (UINT_PTR)params32->offsets, params32->count ); + status = ext_glVertexArrayVertexBuffers( ¶ms ); + free( (void *)params.offsets ); + return status; }
static NTSTATUS wow64_ext_glVertexArrayVertexOffsetEXT( void *args )
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/opengl32/make_opengl | 6 ++ dlls/opengl32/unix_thunks.c | 130 +++--------------------- dlls/opengl32/unix_wgl.c | 194 +++++++++++++++++++++++++++++++++++- 3 files changed, 211 insertions(+), 119 deletions(-)
diff --git a/dlls/opengl32/make_opengl b/dlls/opengl32/make_opengl index 6748350529c..6c1ab65fb7b 100755 --- a/dlls/opengl32/make_opengl +++ b/dlls/opengl32/make_opengl @@ -169,7 +169,13 @@ my %manual_win_thunks = ); my %manual_wow64_thunks = ( + "glClientWaitSync" => 1, + "glDeleteSync" => 1, + "glFenceSync" => 1, + "glGetSynciv" => 1, + "glIsSync" => 1, "glPathGlyphIndexRangeNV" => 1, + "glWaitSync" => 1, "wglCreateContext" => 1, "wglCreateContextAttribsARB" => 1, "wglCreatePbufferARB" => 1, diff --git a/dlls/opengl32/unix_thunks.c b/dlls/opengl32/unix_thunks.c index f00ae443216..c5e4aedbc6a 100644 --- a/dlls/opengl32/unix_thunks.c +++ b/dlls/opengl32/unix_thunks.c @@ -4146,7 +4146,7 @@ static NTSTATUS ext_glClientWaitSemaphoreui64NVX( void *args ) return STATUS_SUCCESS; }
-static NTSTATUS ext_glClientWaitSync( void *args ) +NTSTATUS ext_glClientWaitSync( void *args ) { struct glClientWaitSync_params *params = args; const struct opengl_funcs *funcs = NtCurrentTeb()->glTable; @@ -5746,7 +5746,7 @@ static NTSTATUS ext_glDeleteStatesNV( void *args ) return STATUS_SUCCESS; }
-static NTSTATUS ext_glDeleteSync( void *args ) +NTSTATUS ext_glDeleteSync( void *args ) { struct glDeleteSync_params *params = args; const struct opengl_funcs *funcs = NtCurrentTeb()->glTable; @@ -6656,7 +6656,7 @@ static NTSTATUS ext_glFeedbackBufferxOES( void *args ) return STATUS_SUCCESS; }
-static NTSTATUS ext_glFenceSync( void *args ) +NTSTATUS ext_glFenceSync( void *args ) { struct glFenceSync_params *params = args; const struct opengl_funcs *funcs = NtCurrentTeb()->glTable; @@ -9803,7 +9803,7 @@ static NTSTATUS ext_glGetSubroutineUniformLocation( void *args ) return STATUS_SUCCESS; }
-static NTSTATUS ext_glGetSynciv( void *args ) +NTSTATUS ext_glGetSynciv( void *args ) { struct glGetSynciv_params *params = args; const struct opengl_funcs *funcs = NtCurrentTeb()->glTable; @@ -11555,7 +11555,7 @@ static NTSTATUS ext_glIsStateNV( void *args ) return STATUS_SUCCESS; }
-static NTSTATUS ext_glIsSync( void *args ) +NTSTATUS ext_glIsSync( void *args ) { struct glIsSync_params *params = args; const struct opengl_funcs *funcs = NtCurrentTeb()->glTable; @@ -23465,7 +23465,7 @@ static NTSTATUS ext_glWaitSemaphoreui64NVX( void *args ) return STATUS_SUCCESS; }
-static NTSTATUS ext_glWaitSync( void *args ) +NTSTATUS ext_glWaitSync( void *args ) { struct glWaitSync_params *params = args; const struct opengl_funcs *funcs = NtCurrentTeb()->glTable; @@ -31187,27 +31187,6 @@ static NTSTATUS wow64_ext_glClientWaitSemaphoreui64NVX( void *args ) return status; }
-static NTSTATUS wow64_ext_glClientWaitSync( void *args ) -{ - struct - { - PTR32 sync; - GLbitfield flags; - GLuint64 timeout; - GLenum ret; - } *params32 = args; - struct glClientWaitSync_params params = - { - .sync = ULongToPtr(params32->sync), - .flags = params32->flags, - .timeout = params32->timeout, - }; - NTSTATUS status; - status = ext_glClientWaitSync( ¶ms ); - params32->ret = params.ret; - return status; -} - static NTSTATUS wow64_ext_glClipPlanefOES( void *args ) { struct @@ -33887,21 +33866,6 @@ static NTSTATUS wow64_ext_glDeleteStatesNV( void *args ) return status; }
-static NTSTATUS wow64_ext_glDeleteSync( void *args ) -{ - struct - { - PTR32 sync; - } *params32 = args; - struct glDeleteSync_params params = - { - .sync = ULongToPtr(params32->sync), - }; - NTSTATUS status; - status = ext_glDeleteSync( ¶ms ); - return status; -} - static NTSTATUS wow64_ext_glDeleteTexturesEXT( void *args ) { struct @@ -34677,23 +34641,6 @@ static NTSTATUS wow64_ext_glFeedbackBufferxOES( void *args ) return status; }
-static NTSTATUS wow64_ext_glFenceSync( void *args ) -{ - struct - { - GLenum condition; - GLbitfield flags; - PTR32 ret; - } *params32 = args; - struct glFenceSync_params params = - { - .condition = params32->condition, - .flags = params32->flags, - }; - FIXME( "params32 %p, params %p stub!\n", params32, ¶ms ); - return STATUS_NOT_IMPLEMENTED; -} - static NTSTATUS wow64_ext_glFinishAsyncSGIX( void *args ) { struct @@ -41149,29 +41096,6 @@ static NTSTATUS wow64_ext_glGetSubroutineUniformLocation( void *args ) return status; }
-static NTSTATUS wow64_ext_glGetSynciv( void *args ) -{ - struct - { - PTR32 sync; - GLenum pname; - GLsizei count; - PTR32 length; - PTR32 values; - } *params32 = args; - struct glGetSynciv_params params = - { - .sync = ULongToPtr(params32->sync), - .pname = params32->pname, - .count = params32->count, - .length = ULongToPtr(params32->length), - .values = ULongToPtr(params32->values), - }; - NTSTATUS status; - status = ext_glGetSynciv( ¶ms ); - return status; -} - static NTSTATUS wow64_ext_glGetTexBumpParameterfvATI( void *args ) { struct @@ -44317,23 +44241,6 @@ static NTSTATUS wow64_ext_glIsNamedStringARB( void *args ) return status; }
-static NTSTATUS wow64_ext_glIsSync( void *args ) -{ - struct - { - PTR32 sync; - GLboolean ret; - } *params32 = args; - struct glIsSync_params params = - { - .sync = ULongToPtr(params32->sync), - }; - NTSTATUS status; - status = ext_glIsSync( ¶ms ); - params32->ret = params.ret; - return status; -} - static NTSTATUS wow64_ext_glLGPUNamedBufferSubDataNVX( void *args ) { struct @@ -59995,25 +59902,6 @@ static NTSTATUS wow64_ext_glWaitSemaphoreui64NVX( void *args ) return status; }
-static NTSTATUS wow64_ext_glWaitSync( void *args ) -{ - struct - { - PTR32 sync; - GLbitfield flags; - GLuint64 timeout; - } *params32 = args; - struct glWaitSync_params params = - { - .sync = ULongToPtr(params32->sync), - .flags = params32->flags, - .timeout = params32->timeout, - }; - NTSTATUS status; - status = ext_glWaitSync( ¶ms ); - return status; -} - static NTSTATUS wow64_ext_glWeightPathsNV( void *args ) { struct @@ -61002,7 +60890,13 @@ extern NTSTATUS wow64_wgl_wglCreateContext( void *args ) DECLSPEC_HIDDEN; extern NTSTATUS wow64_wgl_wglDeleteContext( void *args ) DECLSPEC_HIDDEN; extern NTSTATUS wow64_wgl_wglGetProcAddress( void *args ) DECLSPEC_HIDDEN; extern NTSTATUS wow64_wgl_wglMakeCurrent( void *args ) DECLSPEC_HIDDEN; +extern NTSTATUS wow64_ext_glClientWaitSync( void *args ) DECLSPEC_HIDDEN; +extern NTSTATUS wow64_ext_glDeleteSync( void *args ) DECLSPEC_HIDDEN; +extern NTSTATUS wow64_ext_glFenceSync( void *args ) DECLSPEC_HIDDEN; +extern NTSTATUS wow64_ext_glGetSynciv( void *args ) DECLSPEC_HIDDEN; +extern NTSTATUS wow64_ext_glIsSync( void *args ) DECLSPEC_HIDDEN; extern NTSTATUS wow64_ext_glPathGlyphIndexRangeNV( void *args ) DECLSPEC_HIDDEN; +extern NTSTATUS wow64_ext_glWaitSync( void *args ) DECLSPEC_HIDDEN; extern NTSTATUS wow64_ext_wglCreateContextAttribsARB( void *args ) DECLSPEC_HIDDEN; extern NTSTATUS wow64_ext_wglCreatePbufferARB( void *args ) DECLSPEC_HIDDEN; extern NTSTATUS wow64_ext_wglGetPbufferDCARB( void *args ) DECLSPEC_HIDDEN; diff --git a/dlls/opengl32/unix_wgl.c b/dlls/opengl32/unix_wgl.c index 8bf15b47bfe..b53c754be50 100644 --- a/dlls/opengl32/unix_wgl.c +++ b/dlls/opengl32/unix_wgl.c @@ -52,7 +52,8 @@ enum wgl_handle_type HANDLE_PBUFFER = 0 << 12, HANDLE_CONTEXT = 1 << 12, HANDLE_CONTEXT_V3 = 3 << 12, - HANDLE_TYPE_MASK = 15 << 12 + HANDLE_GLSYNC = 4 << 12, + HANDLE_TYPE_MASK = 15 << 12, };
struct opengl_context @@ -1058,7 +1059,13 @@ NTSTATUS WINAPI thread_attach( void *args )
typedef ULONG PTR32;
+extern NTSTATUS ext_glClientWaitSync( void *args ) DECLSPEC_HIDDEN; +extern NTSTATUS ext_glDeleteSync( void *args ) DECLSPEC_HIDDEN; +extern NTSTATUS ext_glFenceSync( void *args ) DECLSPEC_HIDDEN; +extern NTSTATUS ext_glGetSynciv( void *args ) DECLSPEC_HIDDEN; +extern NTSTATUS ext_glIsSync( void *args ) DECLSPEC_HIDDEN; extern NTSTATUS ext_glPathGlyphIndexRangeNV( void *args ) DECLSPEC_HIDDEN; +extern NTSTATUS ext_glWaitSync( void *args ) DECLSPEC_HIDDEN;
static inline void update_teb32_context(void) { @@ -1254,4 +1261,189 @@ NTSTATUS wow64_ext_glPathGlyphIndexRangeNV( void *args ) return status; }
+NTSTATUS wow64_ext_glClientWaitSync( void *args ) +{ + struct wgl_handle *handle; + struct + { + PTR32 sync; + GLbitfield flags; + GLuint64 timeout; + GLenum ret; + } *params32 = args; + NTSTATUS status; + + pthread_mutex_lock( &wgl_lock ); + + if (!(handle = get_handle_ptr( ULongToPtr(params32->sync), HANDLE_GLSYNC ))) + status = STATUS_INVALID_HANDLE; + else + { + struct glClientWaitSync_params params = + { + .sync = (GLsync)handle->u.context, + .flags = params32->flags, + .timeout = params32->timeout, + }; + status = ext_glClientWaitSync( ¶ms ); + params32->ret = params.ret; + } + + pthread_mutex_unlock( &wgl_lock ); + return status; +} + +NTSTATUS wow64_ext_glDeleteSync( void *args ) +{ + struct wgl_handle *handle; + struct + { + PTR32 sync; + } *params32 = args; + NTSTATUS status; + + pthread_mutex_lock( &wgl_lock ); + + if (!(handle = get_handle_ptr( ULongToPtr(params32->sync), HANDLE_GLSYNC ))) + status = STATUS_INVALID_HANDLE; + else + { + struct glDeleteSync_params params = + { + .sync = (GLsync)handle->u.context, + }; + status = ext_glDeleteSync( ¶ms ); + free_handle_ptr( handle ); + } + + pthread_mutex_unlock( &wgl_lock ); + return status; +} + +NTSTATUS wow64_ext_glFenceSync( void *args ) +{ + struct + { + GLenum condition; + GLbitfield flags; + PTR32 ret; + } *params32 = args; + struct glFenceSync_params params = + { + .condition = params32->condition, + .flags = params32->flags, + }; + NTSTATUS status; + + if ((status = ext_glFenceSync( ¶ms ))) return status; + + pthread_mutex_lock( &wgl_lock ); + + if (!(params32->ret = (UINT_PTR)alloc_handle( HANDLE_GLSYNC, NULL, params.ret ))) + { + struct glDeleteSync_params delete_params = + { + .sync = params.ret, + }; + + ext_glDeleteSync( &delete_params ); + status = STATUS_NO_MEMORY; + } + + pthread_mutex_unlock( &wgl_lock ); + return status; +} + +NTSTATUS wow64_ext_glGetSynciv( void *args ) +{ + struct wgl_handle *handle; + struct + { + PTR32 sync; + GLenum pname; + GLsizei count; + PTR32 length; + PTR32 values; + } *params32 = args; + NTSTATUS status; + + pthread_mutex_lock( &wgl_lock ); + + if (!(handle = get_handle_ptr( ULongToPtr(params32->sync), HANDLE_GLSYNC ))) + status = STATUS_INVALID_HANDLE; + else + { + struct glGetSynciv_params params = + { + .sync = (GLsync)handle->u.context, + .pname = params32->pname, + .count = params32->count, + .length = ULongToPtr(params32->length), + .values = ULongToPtr(params32->values), + }; + status = ext_glGetSynciv( ¶ms ); + } + + pthread_mutex_unlock( &wgl_lock ); + return status; +} + +NTSTATUS wow64_ext_glIsSync( void *args ) +{ + struct wgl_handle *handle; + struct + { + PTR32 sync; + GLboolean ret; + } *params32 = args; + NTSTATUS status; + + pthread_mutex_lock( &wgl_lock ); + + if (!(handle = get_handle_ptr( ULongToPtr(params32->sync), HANDLE_GLSYNC ))) + status = STATUS_INVALID_HANDLE; + else + { + struct glIsSync_params params = + { + .sync = (GLsync)handle->u.context, + }; + status = ext_glIsSync( ¶ms ); + params32->ret = params.ret; + } + + pthread_mutex_unlock( &wgl_lock ); + return status; +} + +NTSTATUS wow64_ext_glWaitSync( void *args ) +{ + struct wgl_handle *handle; + struct + { + PTR32 sync; + GLbitfield flags; + GLuint64 timeout; + } *params32 = args; + NTSTATUS status; + + pthread_mutex_lock( &wgl_lock ); + + if (!(handle = get_handle_ptr( ULongToPtr(params32->sync), HANDLE_GLSYNC ))) + status = STATUS_INVALID_HANDLE; + else + { + struct glWaitSync_params params = + { + .sync = (GLsync)handle->u.context, + .flags = params32->flags, + .timeout = params32->timeout, + }; + status = ext_glWaitSync( ¶ms ); + } + + pthread_mutex_unlock( &wgl_lock ); + return status; +} + #endif
From: Rémi Bernon rbernon@codeweavers.com
This is a bit tricky because the strings are supposed to be static, but we also cannot return the unix strings directly either.
So instead we keep track, on the unix side, of known unix / wow64 string associations, and return the known wow64 string if the unix string was already requested before.
If the string wasn't found, the syscall returns STATUS_BUFFER_TOO_SMALL, and the PE side allocates the required memory, calling the syscall once again with the wow64 string pointer to copy the string to.
On concurrent calls, the syscall may return a different wow64 string, in which case the PE side uses it instead and frees the one it allocated.
Lastly, the PE side also keeps record of wow64 strings it had allocated, so that we can free them on process detach. The unix side also does some cleanup of its mapping buffer, as there's no guarantee that it will be completely unloaded. --- dlls/opengl32/make_opengl | 18 ++++ dlls/opengl32/thunks.c | 59 +--------- dlls/opengl32/unix_thunks.c | 112 +++---------------- dlls/opengl32/unix_wgl.c | 207 ++++++++++++++++++++++++++++++++++++ dlls/opengl32/unixlib.h | 1 + dlls/opengl32/wgl.c | 192 ++++++++++++++++++++++++++++++++- 6 files changed, 436 insertions(+), 153 deletions(-)
diff --git a/dlls/opengl32/make_opengl b/dlls/opengl32/make_opengl index 6c1ab65fb7b..861fd104c08 100755 --- a/dlls/opengl32/make_opengl +++ b/dlls/opengl32/make_opengl @@ -162,9 +162,15 @@ my %manual_win_functions = ); my %manual_win_thunks = ( + "glGetString" => 1, + "glGetStringi" => 1, "wglGetCurrentReadDCARB" => 1, + "wglGetExtensionsStringARB" => 1, + "wglGetExtensionsStringEXT" => 1, "wglGetPixelFormat" => 1, "wglGetProcAddress" => 1, + "wglQueryCurrentRendererStringWINE" => 1, + "wglQueryRendererStringWINE" => 1, "wglSwapBuffers" => 1, ); my %manual_wow64_thunks = @@ -172,6 +178,8 @@ my %manual_wow64_thunks = "glClientWaitSync" => 1, "glDeleteSync" => 1, "glFenceSync" => 1, + "glGetString" => 1, + "glGetStringi" => 1, "glGetSynciv" => 1, "glIsSync" => 1, "glPathGlyphIndexRangeNV" => 1, @@ -180,10 +188,15 @@ my %manual_wow64_thunks = "wglCreateContextAttribsARB" => 1, "wglCreatePbufferARB" => 1, "wglDeleteContext" => 1, + "wglGetExtensionsStringARB" => 1, + "wglGetExtensionsStringEXT" => 1, "wglGetPbufferDCARB" => 1, "wglGetProcAddress" => 1, + "wglGetProcAddress" => 1, "wglMakeContextCurrentARB" => 1, "wglMakeCurrent" => 1, + "wglQueryCurrentRendererStringWINE" => 1, + "wglQueryRendererStringWINE" => 1, ); my %pointer_array_count = ( @@ -967,6 +980,7 @@ foreach (sort keys %ext_functions) print OUT "enum unix_funcs\n"; print OUT "{\n"; print OUT " unix_thread_attach,\n"; +print OUT " unix_process_detach,\n"; foreach (sort keys %wgl_functions) { next if defined $manual_win_functions{$_}; @@ -1090,6 +1104,7 @@ print OUT "WINE_DEFAULT_DEBUG_CHANNEL(wgl);\n"; print OUT "#endif\n\n";
print OUT "extern NTSTATUS thread_attach( void *args ) DECLSPEC_HIDDEN;\n"; +print OUT "extern NTSTATUS process_detach( void *args ) DECLSPEC_HIDDEN;\n"; foreach (sort keys %wgl_functions) { next if defined $manual_win_functions{$_}; @@ -1135,6 +1150,7 @@ foreach (sort keys %ext_functions) print OUT "const unixlib_entry_t __wine_unix_call_funcs[] =\n"; print OUT "{\n"; print OUT " &thread_attach,\n"; +print OUT " &process_detach,\n"; foreach (sort keys %wgl_functions) { next if defined $manual_win_functions{$_}; @@ -1155,6 +1171,7 @@ print OUT "\n";
print OUT "#ifdef _WIN64\n\n"; print OUT "typedef ULONG PTR32;\n\n"; +print OUT "extern NTSTATUS wow64_process_detach( void *args ) DECLSPEC_HIDDEN;\n"; foreach (sort keys %wgl_functions) { next if defined $manual_win_functions{$_}; @@ -1196,6 +1213,7 @@ foreach (sort keys %ext_functions) print OUT "\nconst unixlib_entry_t __wine_unix_call_wow64_funcs[] =\n"; print OUT "{\n"; print OUT " &thread_attach,\n"; +print OUT " &wow64_process_detach,\n"; foreach (sort keys %wgl_functions) { next if defined $manual_win_functions{$_}; diff --git a/dlls/opengl32/thunks.c b/dlls/opengl32/thunks.c index 78aef27722f..3f9c68f4f6f 100644 --- a/dlls/opengl32/thunks.c +++ b/dlls/opengl32/thunks.c @@ -1018,15 +1018,6 @@ void WINAPI glGetPolygonStipple( GLubyte *mask ) if ((status = UNIX_CALL( glGetPolygonStipple, &args ))) WARN( "glGetPolygonStipple returned %#lx\n", status ); }
-const GLubyte * WINAPI glGetString( GLenum name ) -{ - struct glGetString_params args = { .name = name, }; - NTSTATUS status; - TRACE( "name %d\n", name ); - if ((status = UNIX_CALL( glGetString, &args ))) WARN( "glGetString returned %#lx\n", status ); - return args.ret; -} - void WINAPI glGetTexEnvfv( GLenum target, GLenum pname, GLfloat *params ) { struct glGetTexEnvfv_params args = { .target = target, .pname = pname, .params = params, }; @@ -9914,15 +9905,6 @@ static GLushort WINAPI glGetStageIndexNV( GLenum shadertype ) return args.ret; }
-static const GLubyte * WINAPI glGetStringi( GLenum name, GLuint index ) -{ - struct glGetStringi_params args = { .name = name, .index = index, }; - NTSTATUS status; - TRACE( "name %d, index %d\n", name, index ); - if ((status = UNIX_CALL( glGetStringi, &args ))) WARN( "glGetStringi returned %#lx\n", status ); - return args.ret; -} - static GLuint WINAPI glGetSubroutineIndex( GLuint program, GLenum shadertype, const GLchar *name ) { struct glGetSubroutineIndex_params args = { .program = program, .shadertype = shadertype, .name = name, }; @@ -24334,24 +24316,6 @@ static void WINAPI wglFreeMemoryNV( void *pointer ) if ((status = UNIX_CALL( wglFreeMemoryNV, &args ))) WARN( "wglFreeMemoryNV returned %#lx\n", status ); }
-static const char * WINAPI wglGetExtensionsStringARB( HDC hdc ) -{ - struct wglGetExtensionsStringARB_params args = { .hdc = hdc, }; - NTSTATUS status; - TRACE( "hdc %p\n", hdc ); - if ((status = UNIX_CALL( wglGetExtensionsStringARB, &args ))) WARN( "wglGetExtensionsStringARB returned %#lx\n", status ); - return args.ret; -} - -static const char * WINAPI wglGetExtensionsStringEXT(void) -{ - struct wglGetExtensionsStringEXT_params args = {0}; - NTSTATUS status; - TRACE( "\n" ); - if ((status = UNIX_CALL( wglGetExtensionsStringEXT, &args ))) WARN( "wglGetExtensionsStringEXT returned %#lx\n", status ); - return args.ret; -} - static HDC WINAPI wglGetPbufferDCARB( HPBUFFERARB hPbuffer ) { struct wglGetPbufferDCARB_params args = { .hPbuffer = hPbuffer, }; @@ -24406,15 +24370,6 @@ static BOOL WINAPI wglQueryCurrentRendererIntegerWINE( GLenum attribute, GLuint return args.ret; }
-static const GLchar * WINAPI wglQueryCurrentRendererStringWINE( GLenum attribute ) -{ - struct wglQueryCurrentRendererStringWINE_params args = { .attribute = attribute, }; - NTSTATUS status; - TRACE( "attribute %d\n", attribute ); - if ((status = UNIX_CALL( wglQueryCurrentRendererStringWINE, &args ))) WARN( "wglQueryCurrentRendererStringWINE returned %#lx\n", status ); - return args.ret; -} - static BOOL WINAPI wglQueryPbufferARB( HPBUFFERARB hPbuffer, int iAttribute, int *piValue ) { struct wglQueryPbufferARB_params args = { .hPbuffer = hPbuffer, .iAttribute = iAttribute, .piValue = piValue, }; @@ -24433,15 +24388,6 @@ static BOOL WINAPI wglQueryRendererIntegerWINE( HDC dc, GLint renderer, GLenum a return args.ret; }
-static const GLchar * WINAPI wglQueryRendererStringWINE( HDC dc, GLint renderer, GLenum attribute ) -{ - struct wglQueryRendererStringWINE_params args = { .dc = dc, .renderer = renderer, .attribute = attribute, }; - NTSTATUS status; - TRACE( "dc %p, renderer %d, attribute %d\n", dc, renderer, attribute ); - if ((status = UNIX_CALL( wglQueryRendererStringWINE, &args ))) WARN( "wglQueryRendererStringWINE returned %#lx\n", status ); - return args.ret; -} - static int WINAPI wglReleasePbufferDCARB( HPBUFFERARB hPbuffer, HDC hDC ) { struct wglReleasePbufferDCARB_params args = { .hPbuffer = hPbuffer, .hDC = hDC, }; @@ -24487,7 +24433,12 @@ static BOOL WINAPI wglSwapIntervalEXT( int interval ) return args.ret; }
+extern const GLubyte * WINAPI glGetStringi( GLenum name, GLuint index ) DECLSPEC_HIDDEN; extern HDC WINAPI wglGetCurrentReadDCARB(void) DECLSPEC_HIDDEN; +extern const char * WINAPI wglGetExtensionsStringARB( HDC hdc ) DECLSPEC_HIDDEN; +extern const char * WINAPI wglGetExtensionsStringEXT(void) DECLSPEC_HIDDEN; +extern const GLchar * WINAPI wglQueryCurrentRendererStringWINE( GLenum attribute ) DECLSPEC_HIDDEN; +extern const GLchar * WINAPI wglQueryRendererStringWINE( HDC dc, GLint renderer, GLenum attribute ) DECLSPEC_HIDDEN; const void *extension_procs[] = { glAccumxOES, diff --git a/dlls/opengl32/unix_thunks.c b/dlls/opengl32/unix_thunks.c index c5e4aedbc6a..ea8d7910450 100644 --- a/dlls/opengl32/unix_thunks.c +++ b/dlls/opengl32/unix_thunks.c @@ -23,6 +23,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(wgl); #endif
extern NTSTATUS thread_attach( void *args ) DECLSPEC_HIDDEN; +extern NTSTATUS process_detach( void *args ) DECLSPEC_HIDDEN; extern NTSTATUS wgl_wglCopyContext( void *args ) DECLSPEC_HIDDEN; extern NTSTATUS wgl_wglCreateContext( void *args ) DECLSPEC_HIDDEN; extern NTSTATUS wgl_wglDeleteContext( void *args ) DECLSPEC_HIDDEN; @@ -24058,7 +24059,7 @@ static NTSTATUS ext_wglGetCurrentReadDCARB( void *args ) return STATUS_SUCCESS; }
-static NTSTATUS ext_wglGetExtensionsStringARB( void *args ) +NTSTATUS ext_wglGetExtensionsStringARB( void *args ) { struct wglGetExtensionsStringARB_params *params = args; const struct opengl_funcs *funcs = get_dc_funcs( params->hdc ); @@ -24067,7 +24068,7 @@ static NTSTATUS ext_wglGetExtensionsStringARB( void *args ) return STATUS_SUCCESS; }
-static NTSTATUS ext_wglGetExtensionsStringEXT( void *args ) +NTSTATUS ext_wglGetExtensionsStringEXT( void *args ) { struct wglGetExtensionsStringEXT_params *params = args; const struct opengl_funcs *funcs = NtCurrentTeb()->glTable; @@ -24109,7 +24110,7 @@ static NTSTATUS ext_wglQueryCurrentRendererIntegerWINE( void *args ) return STATUS_SUCCESS; }
-static NTSTATUS ext_wglQueryCurrentRendererStringWINE( void *args ) +NTSTATUS ext_wglQueryCurrentRendererStringWINE( void *args ) { struct wglQueryCurrentRendererStringWINE_params *params = args; const struct opengl_funcs *funcs = NtCurrentTeb()->glTable; @@ -24126,7 +24127,7 @@ static NTSTATUS ext_wglQueryRendererIntegerWINE( void *args ) return STATUS_SUCCESS; }
-static NTSTATUS ext_wglQueryRendererStringWINE( void *args ) +NTSTATUS ext_wglQueryRendererStringWINE( void *args ) { struct wglQueryRendererStringWINE_params *params = args; const struct opengl_funcs *funcs = get_dc_funcs( params->dc ); @@ -24155,6 +24156,7 @@ static NTSTATUS ext_wglSwapIntervalEXT( void *args ) const unixlib_entry_t __wine_unix_call_funcs[] = { &thread_attach, + &process_detach, &wgl_wglCopyContext, &wgl_wglCreateContext, &wgl_wglDeleteContext, @@ -27201,6 +27203,7 @@ const unixlib_entry_t __wine_unix_call_funcs[] =
typedef ULONG PTR32;
+extern NTSTATUS wow64_process_detach( void *args ) DECLSPEC_HIDDEN; static NTSTATUS wow64_wgl_wglCopyContext( void *args ) { struct @@ -28186,21 +28189,6 @@ static NTSTATUS wow64_gl_glGetPolygonStipple( void *args ) return status; }
-static NTSTATUS wow64_gl_glGetString( void *args ) -{ - struct - { - GLenum name; - PTR32 ret; - } *params32 = args; - struct glGetString_params params = - { - .name = params32->name, - }; - FIXME( "params32 %p, params %p stub!\n", params32, ¶ms ); - return STATUS_NOT_IMPLEMENTED; -} - static NTSTATUS wow64_gl_glGetTexEnvfv( void *args ) { struct @@ -41037,23 +41025,6 @@ static NTSTATUS wow64_ext_glGetSharpenTexFuncSGIS( void *args ) return status; }
-static NTSTATUS wow64_ext_glGetStringi( void *args ) -{ - struct - { - GLenum name; - GLuint index; - PTR32 ret; - } *params32 = args; - struct glGetStringi_params params = - { - .name = params32->name, - .index = params32->index, - }; - FIXME( "params32 %p, params %p stub!\n", params32, ¶ms ); - return STATUS_NOT_IMPLEMENTED; -} - static NTSTATUS wow64_ext_glGetSubroutineIndex( void *args ) { struct @@ -60631,34 +60602,6 @@ static NTSTATUS wow64_ext_wglGetCurrentReadDCARB( void *args ) return STATUS_NOT_IMPLEMENTED; }
-static NTSTATUS wow64_ext_wglGetExtensionsStringARB( void *args ) -{ - struct - { - PTR32 hdc; - PTR32 ret; - } *params32 = args; - struct wglGetExtensionsStringARB_params params = - { - .hdc = ULongToPtr(params32->hdc), - }; - FIXME( "params32 %p, params %p stub!\n", params32, ¶ms ); - return STATUS_NOT_IMPLEMENTED; -} - -static NTSTATUS wow64_ext_wglGetExtensionsStringEXT( void *args ) -{ - struct - { - PTR32 ret; - } *params32 = args; - struct wglGetExtensionsStringEXT_params params = - { - }; - FIXME( "params32 %p, params %p stub!\n", params32, ¶ms ); - return STATUS_NOT_IMPLEMENTED; -} - static NTSTATUS wow64_ext_wglGetPixelFormatAttribfvARB( void *args ) { struct @@ -60732,21 +60675,6 @@ static NTSTATUS wow64_ext_wglQueryCurrentRendererIntegerWINE( void *args ) return status; }
-static NTSTATUS wow64_ext_wglQueryCurrentRendererStringWINE( void *args ) -{ - struct - { - GLenum attribute; - PTR32 ret; - } *params32 = args; - struct wglQueryCurrentRendererStringWINE_params params = - { - .attribute = params32->attribute, - }; - FIXME( "params32 %p, params %p stub!\n", params32, ¶ms ); - return STATUS_NOT_IMPLEMENTED; -} - static NTSTATUS wow64_ext_wglQueryPbufferARB( void *args ) { struct @@ -60791,25 +60719,6 @@ static NTSTATUS wow64_ext_wglQueryRendererIntegerWINE( void *args ) return status; }
-static NTSTATUS wow64_ext_wglQueryRendererStringWINE( void *args ) -{ - struct - { - PTR32 dc; - GLint renderer; - GLenum attribute; - PTR32 ret; - } *params32 = args; - struct wglQueryRendererStringWINE_params params = - { - .dc = ULongToPtr(params32->dc), - .renderer = params32->renderer, - .attribute = params32->attribute, - }; - FIXME( "params32 %p, params %p stub!\n", params32, ¶ms ); - return STATUS_NOT_IMPLEMENTED; -} - static NTSTATUS wow64_ext_wglReleasePbufferDCARB( void *args ) { struct @@ -60890,21 +60799,28 @@ extern NTSTATUS wow64_wgl_wglCreateContext( void *args ) DECLSPEC_HIDDEN; extern NTSTATUS wow64_wgl_wglDeleteContext( void *args ) DECLSPEC_HIDDEN; extern NTSTATUS wow64_wgl_wglGetProcAddress( void *args ) DECLSPEC_HIDDEN; extern NTSTATUS wow64_wgl_wglMakeCurrent( void *args ) DECLSPEC_HIDDEN; +extern NTSTATUS wow64_gl_glGetString( void *args ) DECLSPEC_HIDDEN; extern NTSTATUS wow64_ext_glClientWaitSync( void *args ) DECLSPEC_HIDDEN; extern NTSTATUS wow64_ext_glDeleteSync( void *args ) DECLSPEC_HIDDEN; extern NTSTATUS wow64_ext_glFenceSync( void *args ) DECLSPEC_HIDDEN; +extern NTSTATUS wow64_ext_glGetStringi( void *args ) DECLSPEC_HIDDEN; extern NTSTATUS wow64_ext_glGetSynciv( void *args ) DECLSPEC_HIDDEN; extern NTSTATUS wow64_ext_glIsSync( void *args ) DECLSPEC_HIDDEN; extern NTSTATUS wow64_ext_glPathGlyphIndexRangeNV( void *args ) DECLSPEC_HIDDEN; extern NTSTATUS wow64_ext_glWaitSync( void *args ) DECLSPEC_HIDDEN; extern NTSTATUS wow64_ext_wglCreateContextAttribsARB( void *args ) DECLSPEC_HIDDEN; extern NTSTATUS wow64_ext_wglCreatePbufferARB( void *args ) DECLSPEC_HIDDEN; +extern NTSTATUS wow64_ext_wglGetExtensionsStringARB( void *args ) DECLSPEC_HIDDEN; +extern NTSTATUS wow64_ext_wglGetExtensionsStringEXT( void *args ) DECLSPEC_HIDDEN; extern NTSTATUS wow64_ext_wglGetPbufferDCARB( void *args ) DECLSPEC_HIDDEN; extern NTSTATUS wow64_ext_wglMakeContextCurrentARB( void *args ) DECLSPEC_HIDDEN; +extern NTSTATUS wow64_ext_wglQueryCurrentRendererStringWINE( void *args ) DECLSPEC_HIDDEN; +extern NTSTATUS wow64_ext_wglQueryRendererStringWINE( void *args ) DECLSPEC_HIDDEN;
const unixlib_entry_t __wine_unix_call_wow64_funcs[] = { &thread_attach, + &wow64_process_detach, &wow64_wgl_wglCopyContext, &wow64_wgl_wglCreateContext, &wow64_wgl_wglDeleteContext, diff --git a/dlls/opengl32/unix_wgl.c b/dlls/opengl32/unix_wgl.c index b53c754be50..4c1533fa55e 100644 --- a/dlls/opengl32/unix_wgl.c +++ b/dlls/opengl32/unix_wgl.c @@ -1055,6 +1055,11 @@ NTSTATUS WINAPI thread_attach( void *args ) return STATUS_SUCCESS; }
+NTSTATUS WINAPI process_detach( void *args ) +{ + return STATUS_SUCCESS; +} + #ifdef _WIN64
typedef ULONG PTR32; @@ -1066,6 +1071,47 @@ extern NTSTATUS ext_glGetSynciv( void *args ) DECLSPEC_HIDDEN; extern NTSTATUS ext_glIsSync( void *args ) DECLSPEC_HIDDEN; extern NTSTATUS ext_glPathGlyphIndexRangeNV( void *args ) DECLSPEC_HIDDEN; extern NTSTATUS ext_glWaitSync( void *args ) DECLSPEC_HIDDEN; +extern NTSTATUS ext_wglGetExtensionsStringARB( void *args ) DECLSPEC_HIDDEN; +extern NTSTATUS ext_wglGetExtensionsStringEXT( void *args ) DECLSPEC_HIDDEN; +extern NTSTATUS ext_wglQueryCurrentRendererStringWINE( void *args ) DECLSPEC_HIDDEN; +extern NTSTATUS ext_wglQueryRendererStringWINE( void *args ) DECLSPEC_HIDDEN; + +struct wow64_string_entry +{ + const char *str; + PTR32 wow64_str; +}; +static struct wow64_string_entry *wow64_strings; +static SIZE_T wow64_strings_count; + +static PTR32 find_wow64_string( const char *str, PTR32 wow64_str ) +{ + void *tmp; + SIZE_T i; + + pthread_mutex_lock( &wgl_lock ); + + for (i = 0; i < wow64_strings_count; i++) if (wow64_strings[i].str == str) break; + if (i == wow64_strings_count && (tmp = realloc( wow64_strings, (i + 1) * sizeof(*wow64_strings) ))) + { + wow64_strings = tmp; + wow64_strings[i].str = str; + wow64_strings[i].wow64_str = 0; + wow64_strings_count += 1; + } + + if (i == wow64_strings_count) ERR( "Failed to allocate memory for wow64 strings\n" ); + else if (wow64_strings[i].wow64_str) wow64_str = wow64_strings[i].wow64_str; + else if (wow64_str) + { + strcpy( UlongToPtr(wow64_str), (char *)str ); + wow64_strings[i].wow64_str = wow64_str; + } + + pthread_mutex_unlock( &wgl_lock ); + + return wow64_str; +}
static inline void update_teb32_context(void) { @@ -1234,6 +1280,56 @@ NTSTATUS wow64_wgl_wglGetProcAddress( void *args ) return STATUS_SUCCESS; }
+NTSTATUS wow64_gl_glGetString( void *args ) +{ + struct + { + GLenum name; + PTR32 ret; + } *params32 = args; + struct glGetString_params params = + { + .name = params32->name, + }; + NTSTATUS status; + + if ((status = gl_glGetString( ¶ms ))) return status; + + if (!(params32->ret = find_wow64_string( (char *)params.ret, params32->ret ))) + { + params32->ret = strlen( (char *)params.ret ) + 1; + return STATUS_BUFFER_TOO_SMALL; + } + + return STATUS_SUCCESS; +} + +NTSTATUS wow64_ext_glGetStringi( void *args ) +{ + struct + { + GLenum name; + GLuint index; + PTR32 ret; + } *params32 = args; + struct glGetStringi_params params = + { + .name = params32->name, + .index = params32->index, + }; + NTSTATUS status; + + if ((status = ext_glGetStringi( ¶ms ))) return status; + + if (!(params32->ret = find_wow64_string( (char *)params.ret, params32->ret ))) + { + params32->ret = strlen( (char *)params.ret ) + 1; + return STATUS_BUFFER_TOO_SMALL; + } + + return STATUS_SUCCESS; +} + NTSTATUS wow64_ext_glPathGlyphIndexRangeNV( void *args ) { struct @@ -1261,6 +1357,104 @@ NTSTATUS wow64_ext_glPathGlyphIndexRangeNV( void *args ) return status; }
+NTSTATUS wow64_ext_wglGetExtensionsStringARB( void *args ) +{ + struct + { + PTR32 hdc; + PTR32 ret; + } *params32 = args; + struct wglGetExtensionsStringARB_params params = + { + .hdc = ULongToPtr(params32->hdc), + }; + NTSTATUS status; + + if ((status = ext_wglGetExtensionsStringARB( ¶ms ))) return status; + + if (!(params32->ret = find_wow64_string( params.ret, params32->ret ))) + { + params32->ret = strlen( params.ret ) + 1; + return STATUS_BUFFER_TOO_SMALL; + } + + return STATUS_SUCCESS; +} + +NTSTATUS wow64_ext_wglGetExtensionsStringEXT( void *args ) +{ + struct + { + PTR32 ret; + } *params32 = args; + struct wglGetExtensionsStringEXT_params params = + { + }; + NTSTATUS status; + + if ((status = ext_wglGetExtensionsStringEXT( ¶ms ))) return status; + + if (!(params32->ret = find_wow64_string( params.ret, params32->ret ))) + { + params32->ret = strlen( params.ret ) + 1; + return STATUS_BUFFER_TOO_SMALL; + } + + return STATUS_SUCCESS; +} + +NTSTATUS wow64_ext_wglQueryCurrentRendererStringWINE( void *args ) +{ + struct + { + GLenum attribute; + PTR32 ret; + } *params32 = args; + struct wglQueryCurrentRendererStringWINE_params params = + { + .attribute = params32->attribute, + }; + NTSTATUS status; + + if ((status = ext_wglQueryCurrentRendererStringWINE( ¶ms ))) return status; + + if (!(params32->ret = find_wow64_string( params.ret, params32->ret ))) + { + params32->ret = strlen( params.ret ) + 1; + return STATUS_BUFFER_TOO_SMALL; + } + + return STATUS_SUCCESS; +} + +NTSTATUS wow64_ext_wglQueryRendererStringWINE( void *args ) +{ + struct + { + PTR32 dc; + GLint renderer; + GLenum attribute; + PTR32 ret; + } *params32 = args; + struct wglQueryRendererStringWINE_params params = + { + .dc = ULongToPtr(params32->dc), + .renderer = params32->renderer, + .attribute = params32->attribute, + }; + NTSTATUS status; + + if ((status = ext_wglQueryRendererStringWINE( ¶ms ))) return status; + + if (!(params32->ret = find_wow64_string( params.ret, params32->ret ))) + { + params32->ret = strlen( params.ret ) + 1; + return STATUS_BUFFER_TOO_SMALL; + } + + return STATUS_SUCCESS; +} + NTSTATUS wow64_ext_glClientWaitSync( void *args ) { struct wgl_handle *handle; @@ -1446,4 +1640,17 @@ NTSTATUS wow64_ext_glWaitSync( void *args ) return status; }
+NTSTATUS WINAPI wow64_process_detach( void *args ) +{ + NTSTATUS status; + + if ((status = process_detach( NULL ))) return status; + + free( wow64_strings ); + wow64_strings = NULL; + wow64_strings_count = 0; + + return STATUS_SUCCESS; +} + #endif diff --git a/dlls/opengl32/unixlib.h b/dlls/opengl32/unixlib.h index b76858a2e13..e7f21383f86 100644 --- a/dlls/opengl32/unixlib.h +++ b/dlls/opengl32/unixlib.h @@ -22294,6 +22294,7 @@ struct wglSwapIntervalEXT_params enum unix_funcs { unix_thread_attach, + unix_process_detach, unix_wglCopyContext, unix_wglCreateContext, unix_wglDeleteContext, diff --git a/dlls/opengl32/wgl.c b/dlls/opengl32/wgl.c index 617ea8a54a7..6d433659e99 100644 --- a/dlls/opengl32/wgl.c +++ b/dlls/opengl32/wgl.c @@ -38,10 +38,50 @@ WINE_DEFAULT_DEBUG_CHANNEL(wgl); WINE_DECLARE_DEBUG_CHANNEL(fps);
-unixlib_handle_t unixlib_handle; +unixlib_handle_t unixlib_handle = 0;
static const MAT2 identity = { {0,1},{0,0},{0,0},{0,1} };
+#ifndef _WIN64 + +static char **wow64_strings; +static SIZE_T wow64_strings_count; + +static CRITICAL_SECTION wow64_cs; +static CRITICAL_SECTION_DEBUG wow64_cs_debug = +{ + 0, 0, &wow64_cs, + { &wow64_cs_debug.ProcessLocksList, &wow64_cs_debug.ProcessLocksList }, + 0, 0, { (DWORD_PTR)(__FILE__ ": wow64_cs") } +}; +static CRITICAL_SECTION wow64_cs = { &wow64_cs_debug, -1, 0, 0, 0, 0 }; + +static void append_wow64_string( char *str ) +{ + char **tmp; + + EnterCriticalSection( &wow64_cs ); + + if (!(tmp = realloc( wow64_strings, (wow64_strings_count + 1) * sizeof(*wow64_strings) ))) + ERR( "Failed to allocate memory for wow64 strings\n" ); + else + { + wow64_strings = tmp; + wow64_strings[wow64_strings_count] = str; + wow64_strings_count += 1; + } + + LeaveCriticalSection( &wow64_cs ); +} + +static void cleanup_wow64_strings(void) +{ + while (wow64_strings_count--) free( wow64_strings[wow64_strings_count] ); + free( wow64_strings ); +} + +#endif + /*********************************************************************** * wglGetCurrentReadDCARB * @@ -858,6 +898,144 @@ GLint WINAPI glDebugEntry( GLint unknown1, GLint unknown2 ) return 0; }
+const GLubyte * WINAPI glGetStringi( GLenum name, GLuint index ) +{ + struct glGetStringi_params args = + { + .name = name, + .index = index, + }; + NTSTATUS status; +#ifndef _WIN64 + GLubyte *wow64_str = NULL; +#endif + + TRACE( "name %d, index %d\n", name, index ); + +#ifndef _WIN64 + if (UNIX_CALL( glGetStringi, &args ) == STATUS_BUFFER_TOO_SMALL) args.ret = wow64_str = malloc( (size_t)args.ret ); +#endif + if ((status = UNIX_CALL( glGetStringi, &args ))) WARN( "glGetStringi returned %#lx\n", status ); +#ifndef _WIN64 + if (args.ret != wow64_str) free( wow64_str ); + else if (args.ret) append_wow64_string( (char *)args.ret ); +#endif + return args.ret; +} + +/*********************************************************************** + * glGetString (OPENGL32.@) + */ +const GLubyte * WINAPI glGetString( GLenum name ) +{ + struct glGetString_params args = { .name = name, }; + NTSTATUS status; +#ifndef _WIN64 + GLubyte *wow64_str = NULL; +#endif + + TRACE( "name %d\n", name ); + +#ifndef _WIN64 + if (UNIX_CALL( glGetString, &args ) == STATUS_BUFFER_TOO_SMALL) args.ret = wow64_str = malloc( (size_t)args.ret ); +#endif + if ((status = UNIX_CALL( glGetString, &args ))) WARN( "glGetString returned %#lx\n", status ); +#ifndef _WIN64 + if (args.ret != wow64_str) free( wow64_str ); + else if (args.ret) append_wow64_string( (char *)args.ret ); +#endif + return args.ret; +} + +const char * WINAPI wglGetExtensionsStringARB( HDC hdc ) +{ + struct wglGetExtensionsStringARB_params args = { .hdc = hdc, }; + NTSTATUS status; +#ifndef _WIN64 + char *wow64_str = NULL; +#endif + + TRACE( "hdc %p\n", hdc ); + +#ifndef _WIN64 + if (UNIX_CALL( wglGetExtensionsStringARB, &args ) == STATUS_BUFFER_TOO_SMALL) args.ret = wow64_str = malloc( (size_t)args.ret ); +#endif + if ((status = UNIX_CALL( wglGetExtensionsStringARB, &args ))) WARN( "wglGetExtensionsStringARB returned %#lx\n", status ); +#ifndef _WIN64 + if (args.ret != wow64_str) free( wow64_str ); + else if (args.ret) append_wow64_string( wow64_str ); +#endif + return args.ret; +} + +const char * WINAPI wglGetExtensionsStringEXT(void) +{ + struct wglGetExtensionsStringEXT_params args = {0}; + NTSTATUS status; +#ifndef _WIN64 + char *wow64_str = NULL; +#endif + + TRACE( "\n" ); + +#ifndef _WIN64 + if (UNIX_CALL( wglGetExtensionsStringEXT, &args ) == STATUS_BUFFER_TOO_SMALL) args.ret = wow64_str = malloc( (size_t)args.ret ); +#endif + if ((status = UNIX_CALL( wglGetExtensionsStringEXT, &args ))) WARN( "wglGetExtensionsStringEXT returned %#lx\n", status ); +#ifndef _WIN64 + if (args.ret != wow64_str) free( wow64_str ); + else if (args.ret) append_wow64_string( wow64_str ); +#endif + return args.ret; +} + +const GLchar * WINAPI wglQueryCurrentRendererStringWINE( GLenum attribute ) +{ + struct wglQueryCurrentRendererStringWINE_params args = { .attribute = attribute, }; + NTSTATUS status; +#ifndef _WIN64 + char *wow64_str = NULL; +#endif + + TRACE( "attribute %d\n", attribute ); + +#ifndef _WIN64 + if (UNIX_CALL( wglQueryCurrentRendererStringWINE, &args ) == STATUS_BUFFER_TOO_SMALL) args.ret = wow64_str = malloc( (size_t)args.ret ); +#endif + if ((status = UNIX_CALL( wglQueryCurrentRendererStringWINE, &args ))) WARN( "wglQueryCurrentRendererStringWINE returned %#lx\n", status ); +#ifndef _WIN64 + if (args.ret != wow64_str) free( wow64_str ); + else if (args.ret) append_wow64_string( wow64_str ); +#endif + return args.ret; +} + +const GLchar * WINAPI wglQueryRendererStringWINE( HDC dc, GLint renderer, GLenum attribute ) +{ + struct wglQueryRendererStringWINE_params args = + { + .dc = dc, + .renderer = renderer, + .attribute = attribute, + }; + NTSTATUS status; +#ifndef _WIN64 + char *wow64_str = NULL; +#endif + + TRACE( "dc %p, renderer %d, attribute %d\n", dc, renderer, attribute ); + +#ifndef _WIN64 + if (UNIX_CALL( wglQueryCurrentRendererStringWINE, &args ) == STATUS_BUFFER_TOO_SMALL) args.ret = wow64_str = malloc( (size_t)args.ret ); +#endif + if ((status = UNIX_CALL( wglQueryRendererStringWINE, &args ))) WARN( "wglQueryRendererStringWINE returned %#lx\n", status ); +#ifndef _WIN64 + if (args.ret != wow64_str) free( wow64_str ); + else if (args.ret) append_wow64_string( wow64_str ); +#endif + return args.ret; +} + static BOOL WINAPI call_opengl_debug_message_callback( struct wine_gl_debug_message_params *params, ULONG size ) { params->user_callback( params->source, params->type, params->id, params->severity, @@ -893,6 +1071,18 @@ BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved ) return FALSE; } break; + + case DLL_PROCESS_DETACH: + if (!unixlib_handle) return TRUE; + if ((status = UNIX_CALL( process_detach, NULL ))) + { + WARN( "Failed to detach opengl32 unixlib, status %#lx\n", status ); + return FALSE; + } +#ifndef _WIN64 + cleanup_wow64_strings(); +#endif + return TRUE; } return TRUE; }
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/opengl32/make_opengl | 11 ++++ dlls/opengl32/thunks.c | 110 ++++------------------------------ dlls/opengl32/wgl.c | 123 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 145 insertions(+), 99 deletions(-)
diff --git a/dlls/opengl32/make_opengl b/dlls/opengl32/make_opengl index 861fd104c08..7bfe0f219a2 100755 --- a/dlls/opengl32/make_opengl +++ b/dlls/opengl32/make_opengl @@ -164,6 +164,17 @@ my %manual_win_thunks = ( "glGetString" => 1, "glGetStringi" => 1, + "glMapBuffer" => 1, + "glMapBufferARB" => 1, + "glMapBufferRange" => 1, + "glMapNamedBuffer" => 1, + "glMapNamedBufferEXT" => 1, + "glMapNamedBufferRange" => 1, + "glMapNamedBufferRangeEXT" => 1, + "glUnmapBuffer" => 1, + "glUnmapBufferARB" => 1, + "glUnmapNamedBuffer" => 1, + "glUnmapNamedBufferEXT" => 1, "wglGetCurrentReadDCARB" => 1, "wglGetExtensionsStringARB" => 1, "wglGetExtensionsStringEXT" => 1, diff --git a/dlls/opengl32/thunks.c b/dlls/opengl32/thunks.c index 3f9c68f4f6f..bf1e961e53c 100644 --- a/dlls/opengl32/thunks.c +++ b/dlls/opengl32/thunks.c @@ -12147,33 +12147,6 @@ static void WINAPI glMap2xOES( GLenum target, GLfixed u1, GLfixed u2, GLint ustr if ((status = UNIX_CALL( glMap2xOES, &args ))) WARN( "glMap2xOES returned %#lx\n", status ); }
-static void * WINAPI glMapBuffer( GLenum target, GLenum access ) -{ - struct glMapBuffer_params args = { .target = target, .access = access, }; - NTSTATUS status; - TRACE( "target %d, access %d\n", target, access ); - if ((status = UNIX_CALL( glMapBuffer, &args ))) WARN( "glMapBuffer returned %#lx\n", status ); - return args.ret; -} - -static void * WINAPI glMapBufferARB( GLenum target, GLenum access ) -{ - struct glMapBufferARB_params args = { .target = target, .access = access, }; - NTSTATUS status; - TRACE( "target %d, access %d\n", target, access ); - if ((status = UNIX_CALL( glMapBufferARB, &args ))) WARN( "glMapBufferARB returned %#lx\n", status ); - return args.ret; -} - -static void * WINAPI glMapBufferRange( GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access ) -{ - struct glMapBufferRange_params args = { .target = target, .offset = offset, .length = length, .access = access, }; - NTSTATUS status; - TRACE( "target %d, offset %Id, length %Id, access %d\n", target, offset, length, access ); - if ((status = UNIX_CALL( glMapBufferRange, &args ))) WARN( "glMapBufferRange returned %#lx\n", status ); - return args.ret; -} - static void WINAPI glMapControlPointsNV( GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLint uorder, GLint vorder, GLboolean packed, const void *points ) { struct glMapControlPointsNV_params args = { .target = target, .index = index, .type = type, .ustride = ustride, .vstride = vstride, .uorder = uorder, .vorder = vorder, .packed = packed, .points = points, }; @@ -12198,42 +12171,6 @@ static void WINAPI glMapGrid2xOES( GLint n, GLfixed u1, GLfixed u2, GLfixed v1, if ((status = UNIX_CALL( glMapGrid2xOES, &args ))) WARN( "glMapGrid2xOES returned %#lx\n", status ); }
-static void * WINAPI glMapNamedBuffer( GLuint buffer, GLenum access ) -{ - struct glMapNamedBuffer_params args = { .buffer = buffer, .access = access, }; - NTSTATUS status; - TRACE( "buffer %d, access %d\n", buffer, access ); - if ((status = UNIX_CALL( glMapNamedBuffer, &args ))) WARN( "glMapNamedBuffer returned %#lx\n", status ); - return args.ret; -} - -static void * WINAPI glMapNamedBufferEXT( GLuint buffer, GLenum access ) -{ - struct glMapNamedBufferEXT_params args = { .buffer = buffer, .access = access, }; - NTSTATUS status; - TRACE( "buffer %d, access %d\n", buffer, access ); - if ((status = UNIX_CALL( glMapNamedBufferEXT, &args ))) WARN( "glMapNamedBufferEXT returned %#lx\n", status ); - return args.ret; -} - -static void * WINAPI glMapNamedBufferRange( GLuint buffer, GLintptr offset, GLsizeiptr length, GLbitfield access ) -{ - struct glMapNamedBufferRange_params args = { .buffer = buffer, .offset = offset, .length = length, .access = access, }; - NTSTATUS status; - TRACE( "buffer %d, offset %Id, length %Id, access %d\n", buffer, offset, length, access ); - if ((status = UNIX_CALL( glMapNamedBufferRange, &args ))) WARN( "glMapNamedBufferRange returned %#lx\n", status ); - return args.ret; -} - -static void * WINAPI glMapNamedBufferRangeEXT( GLuint buffer, GLintptr offset, GLsizeiptr length, GLbitfield access ) -{ - struct glMapNamedBufferRangeEXT_params args = { .buffer = buffer, .offset = offset, .length = length, .access = access, }; - NTSTATUS status; - TRACE( "buffer %d, offset %Id, length %Id, access %d\n", buffer, offset, length, access ); - if ((status = UNIX_CALL( glMapNamedBufferRangeEXT, &args ))) WARN( "glMapNamedBufferRangeEXT returned %#lx\n", status ); - return args.ret; -} - static void * WINAPI glMapObjectBufferATI( GLuint buffer ) { struct glMapObjectBufferATI_params args = { .buffer = buffer, }; @@ -20733,42 +20670,6 @@ static void WINAPI glUnlockArraysEXT(void) if ((status = UNIX_CALL( glUnlockArraysEXT, &args ))) WARN( "glUnlockArraysEXT returned %#lx\n", status ); }
-static GLboolean WINAPI glUnmapBuffer( GLenum target ) -{ - struct glUnmapBuffer_params args = { .target = target, }; - NTSTATUS status; - TRACE( "target %d\n", target ); - if ((status = UNIX_CALL( glUnmapBuffer, &args ))) WARN( "glUnmapBuffer returned %#lx\n", status ); - return args.ret; -} - -static GLboolean WINAPI glUnmapBufferARB( GLenum target ) -{ - struct glUnmapBufferARB_params args = { .target = target, }; - NTSTATUS status; - TRACE( "target %d\n", target ); - if ((status = UNIX_CALL( glUnmapBufferARB, &args ))) WARN( "glUnmapBufferARB returned %#lx\n", status ); - return args.ret; -} - -static GLboolean WINAPI glUnmapNamedBuffer( GLuint buffer ) -{ - struct glUnmapNamedBuffer_params args = { .buffer = buffer, }; - NTSTATUS status; - TRACE( "buffer %d\n", buffer ); - if ((status = UNIX_CALL( glUnmapNamedBuffer, &args ))) WARN( "glUnmapNamedBuffer returned %#lx\n", status ); - return args.ret; -} - -static GLboolean WINAPI glUnmapNamedBufferEXT( GLuint buffer ) -{ - struct glUnmapNamedBufferEXT_params args = { .buffer = buffer, }; - NTSTATUS status; - TRACE( "buffer %d\n", buffer ); - if ((status = UNIX_CALL( glUnmapNamedBufferEXT, &args ))) WARN( "glUnmapNamedBufferEXT returned %#lx\n", status ); - return args.ret; -} - static void WINAPI glUnmapObjectBufferATI( GLuint buffer ) { struct glUnmapObjectBufferATI_params args = { .buffer = buffer, }; @@ -24434,6 +24335,17 @@ static BOOL WINAPI wglSwapIntervalEXT( int interval ) }
extern const GLubyte * WINAPI glGetStringi( GLenum name, GLuint index ) DECLSPEC_HIDDEN; +extern void * WINAPI glMapBuffer( GLenum target, GLenum access ) DECLSPEC_HIDDEN; +extern void * WINAPI glMapBufferARB( GLenum target, GLenum access ) DECLSPEC_HIDDEN; +extern void * WINAPI glMapBufferRange( GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access ) DECLSPEC_HIDDEN; +extern void * WINAPI glMapNamedBuffer( GLuint buffer, GLenum access ) DECLSPEC_HIDDEN; +extern void * WINAPI glMapNamedBufferEXT( GLuint buffer, GLenum access ) DECLSPEC_HIDDEN; +extern void * WINAPI glMapNamedBufferRange( GLuint buffer, GLintptr offset, GLsizeiptr length, GLbitfield access ) DECLSPEC_HIDDEN; +extern void * WINAPI glMapNamedBufferRangeEXT( GLuint buffer, GLintptr offset, GLsizeiptr length, GLbitfield access ) DECLSPEC_HIDDEN; +extern GLboolean WINAPI glUnmapBuffer( GLenum target ) DECLSPEC_HIDDEN; +extern GLboolean WINAPI glUnmapBufferARB( GLenum target ) DECLSPEC_HIDDEN; +extern GLboolean WINAPI glUnmapNamedBuffer( GLuint buffer ) DECLSPEC_HIDDEN; +extern GLboolean WINAPI glUnmapNamedBufferEXT( GLuint buffer ) DECLSPEC_HIDDEN; extern HDC WINAPI wglGetCurrentReadDCARB(void) DECLSPEC_HIDDEN; extern const char * WINAPI wglGetExtensionsStringARB( HDC hdc ) DECLSPEC_HIDDEN; extern const char * WINAPI wglGetExtensionsStringEXT(void) DECLSPEC_HIDDEN; diff --git a/dlls/opengl32/wgl.c b/dlls/opengl32/wgl.c index 6d433659e99..ff9e6164c89 100644 --- a/dlls/opengl32/wgl.c +++ b/dlls/opengl32/wgl.c @@ -1036,6 +1036,129 @@ const GLchar * WINAPI wglQueryRendererStringWINE( HDC dc, GLint renderer, GLenum return args.ret; }
+void * WINAPI glMapBuffer( GLenum target, GLenum access ) +{ + struct glMapBuffer_params args = + { + .target = target, + .access = access, + }; + NTSTATUS status; + + TRACE( "target %d, access %d\n", target, access ); + + if (!(status = UNIX_CALL( glMapBuffer, &args ))) return args.ret; + WARN( "glMapBuffer returned %#lx\n", status ); + return args.ret; +} + +void * WINAPI glMapBufferARB( GLenum target, GLenum access ) +{ + return glMapBuffer( target, access ); +} + +void * WINAPI glMapBufferRange( GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access ) +{ + struct glMapBufferRange_params args = + { + .target = target, + .offset = offset, + .length = length, + .access = access, + }; + NTSTATUS status; + + TRACE( "target %d, offset %Id, length %Id, access %d\n", target, offset, length, access ); + + if (!(status = UNIX_CALL( glMapBufferRange, &args ))) return args.ret; + WARN( "glMapBufferRange returned %#lx\n", status ); + return args.ret; +} + +void * WINAPI glMapNamedBuffer( GLuint buffer, GLenum access ) +{ + struct glMapNamedBuffer_params args = + { + .buffer = buffer, + .access = access, + }; + NTSTATUS status; + + TRACE( "(%d, %d)\n", buffer, access ); + + if (!(status = UNIX_CALL( glMapNamedBuffer, &args ))) return args.ret; + WARN( "glMapNamedBuffer returned %#lx\n", status ); + return args.ret; +} + +void * WINAPI glMapNamedBufferEXT( GLuint buffer, GLenum access ) +{ + return glMapNamedBuffer( buffer, access ); +} + +void * WINAPI glMapNamedBufferRange( GLuint buffer, GLintptr offset, GLsizeiptr length, GLbitfield access ) +{ + struct glMapNamedBufferRange_params args = + { + .buffer = buffer, + .offset = offset, + .length = length, + .access = access, + }; + NTSTATUS status; + + TRACE( "buffer %d, offset %Id, length %Id, access %d\n", buffer, offset, length, access ); + + if (!(status = UNIX_CALL( glMapNamedBufferRange, &args ))) return args.ret; + WARN( "glMapNamedBufferRange returned %#lx\n", status ); + return args.ret; +} + +void * WINAPI glMapNamedBufferRangeEXT( GLuint buffer, GLintptr offset, GLsizeiptr length, GLbitfield access ) +{ + return glMapNamedBufferRange( buffer, offset, length, access ); +} + +GLboolean WINAPI glUnmapBuffer( GLenum target ) +{ + struct glUnmapBuffer_params args = + { + .target = target, + }; + NTSTATUS status; + + TRACE( "target %d\n", target ); + + if (!(status = UNIX_CALL( glUnmapBuffer, &args ))) return args.ret; + WARN( "glUnmapBuffer returned %#lx\n", status ); + return args.ret; +} + +GLboolean WINAPI glUnmapBufferARB( GLenum target ) +{ + return glUnmapBuffer( target ); +} + +GLboolean WINAPI glUnmapNamedBuffer( GLuint buffer ) +{ + struct glUnmapNamedBuffer_params args = + { + .buffer = buffer, + }; + NTSTATUS status; + + TRACE( "buffer %d\n", buffer ); + + if (!(status = UNIX_CALL( glUnmapNamedBuffer, &args ))) return args.ret; + WARN( "glUnmapNamedBuffer returned %#lx\n", status ); + return args.ret; +} + +GLboolean WINAPI glUnmapNamedBufferEXT( GLuint buffer ) +{ + return glUnmapNamedBuffer( buffer ); +} + static BOOL WINAPI call_opengl_debug_message_callback( struct wine_gl_debug_message_params *params, ULONG size ) { params->user_callback( params->source, params->type, params->id, params->severity,
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/opengl32/make_opengl | 15 ++ dlls/opengl32/unix_thunks.c | 252 ++++---------------------- dlls/opengl32/unix_wgl.c | 346 ++++++++++++++++++++++++++++++++++++ dlls/opengl32/wgl.c | 79 ++++++++ 4 files changed, 474 insertions(+), 218 deletions(-)
diff --git a/dlls/opengl32/make_opengl b/dlls/opengl32/make_opengl index 7bfe0f219a2..43199f56981 100755 --- a/dlls/opengl32/make_opengl +++ b/dlls/opengl32/make_opengl @@ -189,11 +189,26 @@ my %manual_wow64_thunks = "glClientWaitSync" => 1, "glDeleteSync" => 1, "glFenceSync" => 1, + "glGetBufferPointerv" => 1, + "glGetBufferPointervARB" => 1, + "glGetNamedBufferPointerv" => 1, + "glGetNamedBufferPointervEXT" => 1, "glGetString" => 1, "glGetStringi" => 1, "glGetSynciv" => 1, "glIsSync" => 1, + "glMapBuffer" => 1, + "glMapBufferARB" => 1, + "glMapBufferRange" => 1, + "glMapNamedBuffer" => 1, + "glMapNamedBufferEXT" => 1, + "glMapNamedBufferRange" => 1, + "glMapNamedBufferRangeEXT" => 1, "glPathGlyphIndexRangeNV" => 1, + "glUnmapBuffer" => 1, + "glUnmapBufferARB" => 1, + "glUnmapNamedBuffer" => 1, + "glUnmapNamedBufferEXT" => 1, "glWaitSync" => 1, "wglCreateContext" => 1, "wglCreateContextAttribsARB" => 1, diff --git a/dlls/opengl32/unix_thunks.c b/dlls/opengl32/unix_thunks.c index ea8d7910450..1ba8fc3bf2f 100644 --- a/dlls/opengl32/unix_thunks.c +++ b/dlls/opengl32/unix_thunks.c @@ -7748,7 +7748,7 @@ static NTSTATUS ext_glGetBufferParameterui64vNV( void *args ) return STATUS_SUCCESS; }
-static NTSTATUS ext_glGetBufferPointerv( void *args ) +NTSTATUS ext_glGetBufferPointerv( void *args ) { struct glGetBufferPointerv_params *params = args; const struct opengl_funcs *funcs = NtCurrentTeb()->glTable; @@ -7756,7 +7756,7 @@ static NTSTATUS ext_glGetBufferPointerv( void *args ) return STATUS_SUCCESS; }
-static NTSTATUS ext_glGetBufferPointervARB( void *args ) +NTSTATUS ext_glGetBufferPointervARB( void *args ) { struct glGetBufferPointervARB_params *params = args; const struct opengl_funcs *funcs = NtCurrentTeb()->glTable; @@ -8796,7 +8796,7 @@ static NTSTATUS ext_glGetNamedBufferParameterui64vNV( void *args ) return STATUS_SUCCESS; }
-static NTSTATUS ext_glGetNamedBufferPointerv( void *args ) +NTSTATUS ext_glGetNamedBufferPointerv( void *args ) { struct glGetNamedBufferPointerv_params *params = args; const struct opengl_funcs *funcs = NtCurrentTeb()->glTable; @@ -8804,7 +8804,7 @@ static NTSTATUS ext_glGetNamedBufferPointerv( void *args ) return STATUS_SUCCESS; }
-static NTSTATUS ext_glGetNamedBufferPointervEXT( void *args ) +NTSTATUS ext_glGetNamedBufferPointervEXT( void *args ) { struct glGetNamedBufferPointervEXT_params *params = args; const struct opengl_funcs *funcs = NtCurrentTeb()->glTable; @@ -11971,7 +11971,7 @@ static NTSTATUS ext_glMap2xOES( void *args ) return STATUS_SUCCESS; }
-static NTSTATUS ext_glMapBuffer( void *args ) +NTSTATUS ext_glMapBuffer( void *args ) { struct glMapBuffer_params *params = args; const struct opengl_funcs *funcs = NtCurrentTeb()->glTable; @@ -11979,7 +11979,7 @@ static NTSTATUS ext_glMapBuffer( void *args ) return STATUS_SUCCESS; }
-static NTSTATUS ext_glMapBufferARB( void *args ) +NTSTATUS ext_glMapBufferARB( void *args ) { struct glMapBufferARB_params *params = args; const struct opengl_funcs *funcs = NtCurrentTeb()->glTable; @@ -11987,7 +11987,7 @@ static NTSTATUS ext_glMapBufferARB( void *args ) return STATUS_SUCCESS; }
-static NTSTATUS ext_glMapBufferRange( void *args ) +NTSTATUS ext_glMapBufferRange( void *args ) { struct glMapBufferRange_params *params = args; const struct opengl_funcs *funcs = NtCurrentTeb()->glTable; @@ -12019,7 +12019,7 @@ static NTSTATUS ext_glMapGrid2xOES( void *args ) return STATUS_SUCCESS; }
-static NTSTATUS ext_glMapNamedBuffer( void *args ) +NTSTATUS ext_glMapNamedBuffer( void *args ) { struct glMapNamedBuffer_params *params = args; const struct opengl_funcs *funcs = NtCurrentTeb()->glTable; @@ -12027,7 +12027,7 @@ static NTSTATUS ext_glMapNamedBuffer( void *args ) return STATUS_SUCCESS; }
-static NTSTATUS ext_glMapNamedBufferEXT( void *args ) +NTSTATUS ext_glMapNamedBufferEXT( void *args ) { struct glMapNamedBufferEXT_params *params = args; const struct opengl_funcs *funcs = NtCurrentTeb()->glTable; @@ -12035,7 +12035,7 @@ static NTSTATUS ext_glMapNamedBufferEXT( void *args ) return STATUS_SUCCESS; }
-static NTSTATUS ext_glMapNamedBufferRange( void *args ) +NTSTATUS ext_glMapNamedBufferRange( void *args ) { struct glMapNamedBufferRange_params *params = args; const struct opengl_funcs *funcs = NtCurrentTeb()->glTable; @@ -12043,7 +12043,7 @@ static NTSTATUS ext_glMapNamedBufferRange( void *args ) return STATUS_SUCCESS; }
-static NTSTATUS ext_glMapNamedBufferRangeEXT( void *args ) +NTSTATUS ext_glMapNamedBufferRangeEXT( void *args ) { struct glMapNamedBufferRangeEXT_params *params = args; const struct opengl_funcs *funcs = NtCurrentTeb()->glTable; @@ -20515,7 +20515,7 @@ static NTSTATUS ext_glUnlockArraysEXT( void *args ) return STATUS_SUCCESS; }
-static NTSTATUS ext_glUnmapBuffer( void *args ) +NTSTATUS ext_glUnmapBuffer( void *args ) { struct glUnmapBuffer_params *params = args; const struct opengl_funcs *funcs = NtCurrentTeb()->glTable; @@ -20523,7 +20523,7 @@ static NTSTATUS ext_glUnmapBuffer( void *args ) return STATUS_SUCCESS; }
-static NTSTATUS ext_glUnmapBufferARB( void *args ) +NTSTATUS ext_glUnmapBufferARB( void *args ) { struct glUnmapBufferARB_params *params = args; const struct opengl_funcs *funcs = NtCurrentTeb()->glTable; @@ -20531,7 +20531,7 @@ static NTSTATUS ext_glUnmapBufferARB( void *args ) return STATUS_SUCCESS; }
-static NTSTATUS ext_glUnmapNamedBuffer( void *args ) +NTSTATUS ext_glUnmapNamedBuffer( void *args ) { struct glUnmapNamedBuffer_params *params = args; const struct opengl_funcs *funcs = NtCurrentTeb()->glTable; @@ -20539,7 +20539,7 @@ static NTSTATUS ext_glUnmapNamedBuffer( void *args ) return STATUS_SUCCESS; }
-static NTSTATUS ext_glUnmapNamedBufferEXT( void *args ) +NTSTATUS ext_glUnmapNamedBufferEXT( void *args ) { struct glUnmapNamedBufferEXT_params *params = args; const struct opengl_funcs *funcs = NtCurrentTeb()->glTable; @@ -36058,40 +36058,6 @@ static NTSTATUS wow64_ext_glGetBufferParameterui64vNV( void *args ) return status; }
-static NTSTATUS wow64_ext_glGetBufferPointerv( void *args ) -{ - struct - { - GLenum target; - GLenum pname; - PTR32 params; - } *params32 = args; - struct glGetBufferPointerv_params params = - { - .target = params32->target, - .pname = params32->pname, - }; - FIXME( "params32 %p, params %p stub!\n", params32, ¶ms ); - return STATUS_NOT_IMPLEMENTED; -} - -static NTSTATUS wow64_ext_glGetBufferPointervARB( void *args ) -{ - struct - { - GLenum target; - GLenum pname; - PTR32 params; - } *params32 = args; - struct glGetBufferPointervARB_params params = - { - .target = params32->target, - .pname = params32->pname, - }; - FIXME( "params32 %p, params %p stub!\n", params32, ¶ms ); - return STATUS_NOT_IMPLEMENTED; -} - static NTSTATUS wow64_ext_glGetBufferSubData( void *args ) { struct @@ -38539,40 +38505,6 @@ static NTSTATUS wow64_ext_glGetNamedBufferParameterui64vNV( void *args ) return status; }
-static NTSTATUS wow64_ext_glGetNamedBufferPointerv( void *args ) -{ - struct - { - GLuint buffer; - GLenum pname; - PTR32 params; - } *params32 = args; - struct glGetNamedBufferPointerv_params params = - { - .buffer = params32->buffer, - .pname = params32->pname, - }; - FIXME( "params32 %p, params %p stub!\n", params32, ¶ms ); - return STATUS_NOT_IMPLEMENTED; -} - -static NTSTATUS wow64_ext_glGetNamedBufferPointervEXT( void *args ) -{ - struct - { - GLuint buffer; - GLenum pname; - PTR32 params; - } *params32 = args; - struct glGetNamedBufferPointervEXT_params params = - { - .buffer = params32->buffer, - .pname = params32->pname, - }; - FIXME( "params32 %p, params %p stub!\n", params32, ¶ms ); - return STATUS_NOT_IMPLEMENTED; -} - static NTSTATUS wow64_ext_glGetNamedBufferSubData( void *args ) { struct @@ -44486,61 +44418,6 @@ static NTSTATUS wow64_ext_glMTexCoord2fvSGIS( void *args ) return status; }
-static NTSTATUS wow64_ext_glMapBuffer( void *args ) -{ - struct - { - GLenum target; - GLenum access; - PTR32 ret; - } *params32 = args; - struct glMapBuffer_params params = - { - .target = params32->target, - .access = params32->access, - }; - FIXME( "params32 %p, params %p stub!\n", params32, ¶ms ); - return STATUS_NOT_IMPLEMENTED; -} - -static NTSTATUS wow64_ext_glMapBufferARB( void *args ) -{ - struct - { - GLenum target; - GLenum access; - PTR32 ret; - } *params32 = args; - struct glMapBufferARB_params params = - { - .target = params32->target, - .access = params32->access, - }; - FIXME( "params32 %p, params %p stub!\n", params32, ¶ms ); - return STATUS_NOT_IMPLEMENTED; -} - -static NTSTATUS wow64_ext_glMapBufferRange( void *args ) -{ - struct - { - GLenum target; - PTR32 offset; - PTR32 length; - GLbitfield access; - PTR32 ret; - } *params32 = args; - struct glMapBufferRange_params params = - { - .target = params32->target, - .offset = (GLintptr)ULongToPtr(params32->offset), - .length = (GLsizeiptr)ULongToPtr(params32->length), - .access = params32->access, - }; - FIXME( "params32 %p, params %p stub!\n", params32, ¶ms ); - return STATUS_NOT_IMPLEMENTED; -} - static NTSTATUS wow64_ext_glMapControlPointsNV( void *args ) { struct @@ -44572,82 +44449,6 @@ static NTSTATUS wow64_ext_glMapControlPointsNV( void *args ) return status; }
-static NTSTATUS wow64_ext_glMapNamedBuffer( void *args ) -{ - struct - { - GLuint buffer; - GLenum access; - PTR32 ret; - } *params32 = args; - struct glMapNamedBuffer_params params = - { - .buffer = params32->buffer, - .access = params32->access, - }; - FIXME( "params32 %p, params %p stub!\n", params32, ¶ms ); - return STATUS_NOT_IMPLEMENTED; -} - -static NTSTATUS wow64_ext_glMapNamedBufferEXT( void *args ) -{ - struct - { - GLuint buffer; - GLenum access; - PTR32 ret; - } *params32 = args; - struct glMapNamedBufferEXT_params params = - { - .buffer = params32->buffer, - .access = params32->access, - }; - FIXME( "params32 %p, params %p stub!\n", params32, ¶ms ); - return STATUS_NOT_IMPLEMENTED; -} - -static NTSTATUS wow64_ext_glMapNamedBufferRange( void *args ) -{ - struct - { - GLuint buffer; - PTR32 offset; - PTR32 length; - GLbitfield access; - PTR32 ret; - } *params32 = args; - struct glMapNamedBufferRange_params params = - { - .buffer = params32->buffer, - .offset = (GLintptr)ULongToPtr(params32->offset), - .length = (GLsizeiptr)ULongToPtr(params32->length), - .access = params32->access, - }; - FIXME( "params32 %p, params %p stub!\n", params32, ¶ms ); - return STATUS_NOT_IMPLEMENTED; -} - -static NTSTATUS wow64_ext_glMapNamedBufferRangeEXT( void *args ) -{ - struct - { - GLuint buffer; - PTR32 offset; - PTR32 length; - GLbitfield access; - PTR32 ret; - } *params32 = args; - struct glMapNamedBufferRangeEXT_params params = - { - .buffer = params32->buffer, - .offset = (GLintptr)ULongToPtr(params32->offset), - .length = (GLsizeiptr)ULongToPtr(params32->length), - .access = params32->access, - }; - FIXME( "params32 %p, params %p stub!\n", params32, ¶ms ); - return STATUS_NOT_IMPLEMENTED; -} - static NTSTATUS wow64_ext_glMapObjectBufferATI( void *args ) { struct @@ -60803,10 +60604,25 @@ extern NTSTATUS wow64_gl_glGetString( void *args ) DECLSPEC_HIDDEN; extern NTSTATUS wow64_ext_glClientWaitSync( void *args ) DECLSPEC_HIDDEN; extern NTSTATUS wow64_ext_glDeleteSync( void *args ) DECLSPEC_HIDDEN; extern NTSTATUS wow64_ext_glFenceSync( void *args ) DECLSPEC_HIDDEN; +extern NTSTATUS wow64_ext_glGetBufferPointerv( void *args ) DECLSPEC_HIDDEN; +extern NTSTATUS wow64_ext_glGetBufferPointervARB( void *args ) DECLSPEC_HIDDEN; +extern NTSTATUS wow64_ext_glGetNamedBufferPointerv( void *args ) DECLSPEC_HIDDEN; +extern NTSTATUS wow64_ext_glGetNamedBufferPointervEXT( void *args ) DECLSPEC_HIDDEN; extern NTSTATUS wow64_ext_glGetStringi( void *args ) DECLSPEC_HIDDEN; extern NTSTATUS wow64_ext_glGetSynciv( void *args ) DECLSPEC_HIDDEN; extern NTSTATUS wow64_ext_glIsSync( void *args ) DECLSPEC_HIDDEN; +extern NTSTATUS wow64_ext_glMapBuffer( void *args ) DECLSPEC_HIDDEN; +extern NTSTATUS wow64_ext_glMapBufferARB( void *args ) DECLSPEC_HIDDEN; +extern NTSTATUS wow64_ext_glMapBufferRange( void *args ) DECLSPEC_HIDDEN; +extern NTSTATUS wow64_ext_glMapNamedBuffer( void *args ) DECLSPEC_HIDDEN; +extern NTSTATUS wow64_ext_glMapNamedBufferEXT( void *args ) DECLSPEC_HIDDEN; +extern NTSTATUS wow64_ext_glMapNamedBufferRange( void *args ) DECLSPEC_HIDDEN; +extern NTSTATUS wow64_ext_glMapNamedBufferRangeEXT( void *args ) DECLSPEC_HIDDEN; extern NTSTATUS wow64_ext_glPathGlyphIndexRangeNV( void *args ) DECLSPEC_HIDDEN; +extern NTSTATUS wow64_ext_glUnmapBuffer( void *args ) DECLSPEC_HIDDEN; +extern NTSTATUS wow64_ext_glUnmapBufferARB( void *args ) DECLSPEC_HIDDEN; +extern NTSTATUS wow64_ext_glUnmapNamedBuffer( void *args ) DECLSPEC_HIDDEN; +extern NTSTATUS wow64_ext_glUnmapNamedBufferEXT( void *args ) DECLSPEC_HIDDEN; extern NTSTATUS wow64_ext_glWaitSync( void *args ) DECLSPEC_HIDDEN; extern NTSTATUS wow64_ext_wglCreateContextAttribsARB( void *args ) DECLSPEC_HIDDEN; extern NTSTATUS wow64_ext_wglCreatePbufferARB( void *args ) DECLSPEC_HIDDEN; @@ -63397,10 +63213,10 @@ const unixlib_entry_t __wine_unix_call_wow64_funcs[] = &ext_glUniformui64NV, &wow64_ext_glUniformui64vNV, &ext_glUnlockArraysEXT, - &ext_glUnmapBuffer, - &ext_glUnmapBufferARB, - &ext_glUnmapNamedBuffer, - &ext_glUnmapNamedBufferEXT, + &wow64_ext_glUnmapBuffer, + &wow64_ext_glUnmapBufferARB, + &wow64_ext_glUnmapNamedBuffer, + &wow64_ext_glUnmapNamedBufferEXT, &ext_glUnmapObjectBufferATI, &ext_glUnmapTexture2DINTEL, &wow64_ext_glUpdateObjectBufferATI, diff --git a/dlls/opengl32/unix_wgl.c b/dlls/opengl32/unix_wgl.c index 4c1533fa55e..cc3c6a47e1d 100644 --- a/dlls/opengl32/unix_wgl.c +++ b/dlls/opengl32/unix_wgl.c @@ -1067,8 +1067,25 @@ typedef ULONG PTR32; extern NTSTATUS ext_glClientWaitSync( void *args ) DECLSPEC_HIDDEN; extern NTSTATUS ext_glDeleteSync( void *args ) DECLSPEC_HIDDEN; extern NTSTATUS ext_glFenceSync( void *args ) DECLSPEC_HIDDEN; +extern NTSTATUS ext_glGetBufferPointerv( void *args ) DECLSPEC_HIDDEN; +extern NTSTATUS ext_glGetBufferPointervARB( void *args ) DECLSPEC_HIDDEN; +extern NTSTATUS ext_glGetNamedBufferPointerv( void *args ) DECLSPEC_HIDDEN; +extern NTSTATUS ext_glGetNamedBufferPointervEXT( void *args ) DECLSPEC_HIDDEN; extern NTSTATUS ext_glGetSynciv( void *args ) DECLSPEC_HIDDEN; extern NTSTATUS ext_glIsSync( void *args ) DECLSPEC_HIDDEN; +extern NTSTATUS ext_glMapBuffer( void *args ) DECLSPEC_HIDDEN; + +extern NTSTATUS ext_glUnmapBuffer( void *args ) DECLSPEC_HIDDEN; +extern NTSTATUS ext_glUnmapBufferARB( void *args ) DECLSPEC_HIDDEN; +extern NTSTATUS ext_glUnmapNamedBuffer( void *args ) DECLSPEC_HIDDEN; +extern NTSTATUS ext_glUnmapNamedBufferEXT( void *args ) DECLSPEC_HIDDEN; + +extern NTSTATUS ext_glMapBufferARB( void *args ) DECLSPEC_HIDDEN; +extern NTSTATUS ext_glMapBufferRange( void *args ) DECLSPEC_HIDDEN; +extern NTSTATUS ext_glMapNamedBuffer( void *args ) DECLSPEC_HIDDEN; +extern NTSTATUS ext_glMapNamedBufferEXT( void *args ) DECLSPEC_HIDDEN; +extern NTSTATUS ext_glMapNamedBufferRange( void *args ) DECLSPEC_HIDDEN; +extern NTSTATUS ext_glMapNamedBufferRangeEXT( void *args ) DECLSPEC_HIDDEN; extern NTSTATUS ext_glPathGlyphIndexRangeNV( void *args ) DECLSPEC_HIDDEN; extern NTSTATUS ext_glWaitSync( void *args ) DECLSPEC_HIDDEN; extern NTSTATUS ext_wglGetExtensionsStringARB( void *args ) DECLSPEC_HIDDEN; @@ -1640,6 +1657,335 @@ NTSTATUS wow64_ext_glWaitSync( void *args ) return status; }
+static GLint get_buffer_param( GLenum target, GLenum param ) +{ + const struct opengl_funcs *funcs = NtCurrentTeb()->glTable; + typeof(*funcs->ext.p_glGetBufferParameteriv) *func; + GLint size = 0; + if (!(func = funcs->ext.p_glGetBufferParameteriv)) func = (void *)funcs->wgl.p_wglGetProcAddress( "glGetBufferParameteriv" ); + if (func) func( target, param, &size ); + return size; +} + +static void *get_buffer_pointer( GLenum target ) +{ + const struct opengl_funcs *funcs = NtCurrentTeb()->glTable; + typeof(*funcs->ext.p_glGetBufferPointerv) *func; + void *ptr = NULL; + if (!(func = funcs->ext.p_glGetBufferPointerv)) func = (void *)funcs->wgl.p_wglGetProcAddress( "glGetBufferPointerv" ); + if (func) func( target, GL_BUFFER_MAP_POINTER, &ptr ); + return ptr; +} + +static GLint get_named_buffer_param( GLint buffer, GLenum param ) +{ + const struct opengl_funcs *funcs = NtCurrentTeb()->glTable; + typeof(*funcs->ext.p_glGetNamedBufferParameteriv) *func; + GLint size = 0; + if (!(func = funcs->ext.p_glGetNamedBufferParameteriv)) func = (void *)funcs->wgl.p_wglGetProcAddress( "glGetNamedBufferParameteriv" ); + if (func) func( buffer, param, &size ); + return size; +} + +static void *get_named_buffer_pointer( GLint buffer ) +{ + const struct opengl_funcs *funcs = NtCurrentTeb()->glTable; + typeof(*funcs->ext.p_glGetNamedBufferPointerv) *func; + void *ptr = NULL; + if (!(func = funcs->ext.p_glGetNamedBufferPointerv)) func = (void *)funcs->wgl.p_wglGetProcAddress( "glGetNamedBufferPointerv" ); + if (func) func( buffer, GL_BUFFER_MAP_POINTER, &ptr ); + return ptr; +} + +static NTSTATUS wow64_map_buffer( GLint buffer, GLenum target, void *ptr, SIZE_T size, GLbitfield access, PTR32 *ret ) +{ + if (*ret) /* wow64 pointer provided, map buffer to it */ + { + if (access & GL_MAP_READ_BIT) + { + TRACE( "Copying %#zx from buffer at %p to wow64 buffer %p\n", size, ptr, UlongToPtr(*ret) ); + memcpy( UlongToPtr(*ret), ptr, size ); + } + + /* save the wow64 pointer in the buffer data, we'll overwrite it on unmap */ + *(PTR32 *)ptr = (UINT_PTR)*ret; + return STATUS_SUCCESS; + } + + if (ULongToPtr(*ret = PtrToUlong(ptr)) == ptr) return STATUS_SUCCESS; /* we're lucky */ + if (access & GL_MAP_PERSISTENT_BIT) + { + FIXME( "GL_MAP_PERSISTENT_BIT not supported!\n" ); + return STATUS_NOT_SUPPORTED; + } + + if (!size) size = buffer ? get_named_buffer_param( buffer, GL_BUFFER_SIZE ) : get_buffer_param( target, GL_BUFFER_SIZE ); + if ((PTR32)size != size) return STATUS_NO_MEMORY; /* overflow */ + if (size < sizeof(PTR32)) + { + FIXME( "Buffer too small for metadata!\n" ); + return STATUS_BUFFER_TOO_SMALL; + } + + *ret = size; + return STATUS_INVALID_ADDRESS; +} + +static NTSTATUS wow64_unmap_buffer( void *ptr, SIZE_T size, GLbitfield access ) +{ + void *wow_ptr; + + if (ULongToPtr(PtrToUlong(ptr)) == ptr) return STATUS_SUCCESS; /* we're lucky */ + + wow_ptr = UlongToPtr(*(PTR32 *)ptr); + if (access & GL_MAP_WRITE_BIT) + { + TRACE( "Copying %#zx from wow64 buffer %p to buffer %p\n", size, wow_ptr, ptr ); + memcpy( ptr, wow_ptr, size ); + } + + return STATUS_INVALID_ADDRESS; +} + +NTSTATUS wow64_ext_glGetBufferPointerv( void *args ) +{ + PTR32 *ptr; /* pointer to the buffer data, where we saved the wow64 pointer */ + struct + { + GLenum target; + GLenum pname; + PTR32 params; + } *params32 = args; + struct glGetBufferPointerv_params params = + { + .target = params32->target, + .pname = params32->pname, + .params = (void **)&ptr, + }; + PTR32 *wow_ptr = UlongToPtr(params32->params); + NTSTATUS status; + + if ((status = ext_glGetBufferPointerv( ¶ms ))) return status; + if (params.pname != GL_BUFFER_MAP_POINTER) return STATUS_NOT_IMPLEMENTED; + if (ULongToPtr(*wow_ptr = PtrToUlong(ptr)) == ptr) return STATUS_SUCCESS; /* we're lucky */ + *wow_ptr = ptr[0]; + return STATUS_SUCCESS; +} + +NTSTATUS wow64_ext_glGetBufferPointervARB( void *args ) +{ + return wow64_ext_glGetBufferPointerv( args ); +} + +NTSTATUS wow64_ext_glGetNamedBufferPointerv( void *args ) +{ + PTR32 *ptr; /* pointer to the buffer data, where we saved the wow64 pointer */ + struct + { + GLuint buffer; + GLenum pname; + PTR32 params; + } *params32 = args; + struct glGetNamedBufferPointerv_params params = + { + .buffer = params32->buffer, + .pname = params32->pname, + .params = (void **)&ptr, + }; + PTR32 *wow_ptr = UlongToPtr(params32->params); + NTSTATUS status; + + if ((status = ext_glGetNamedBufferPointerv( ¶ms ))) return status; + if (params.pname != GL_BUFFER_MAP_POINTER) return STATUS_NOT_IMPLEMENTED; + if (ULongToPtr(*wow_ptr = PtrToUlong(ptr)) == ptr) return STATUS_SUCCESS; /* we're lucky */ + *wow_ptr = ptr[0]; + return STATUS_SUCCESS; +} + +NTSTATUS wow64_ext_glGetNamedBufferPointervEXT( void *args ) +{ + return wow64_ext_glGetNamedBufferPointerv( args ); +} + +NTSTATUS wow64_ext_glMapBuffer( void *args ) +{ + struct + { + GLenum target; + GLenum access; + PTR32 ret; + } *params32 = args; + struct glMapBuffer_params params = + { + .target = params32->target, + .access = params32->access, + }; + struct glUnmapBuffer_params unmap_params = { .target = params.target }; + NTSTATUS status; + + /* already mapped, we're being called again with a wow64 pointer */ + if (params32->ret) params.ret = get_buffer_pointer( params.target ); + else if ((status = ext_glMapBuffer( ¶ms ))) return status; + + status = wow64_map_buffer( 0, params.target, params.ret, 0, params.access, ¶ms32->ret ); + if (!status || status == STATUS_INVALID_ADDRESS) return status; + + ext_glUnmapBuffer( &unmap_params ); + return status; +} + +NTSTATUS wow64_ext_glMapBufferARB( void *args ) +{ + return wow64_ext_glMapBuffer( args ); +} + +NTSTATUS wow64_ext_glMapBufferRange( void *args ) +{ + struct + { + GLenum target; + PTR32 offset; + PTR32 length; + GLbitfield access; + PTR32 ret; + } *params32 = args; + struct glMapBufferRange_params params = + { + .target = params32->target, + .offset = (GLintptr)ULongToPtr(params32->offset), + .length = (GLsizeiptr)ULongToPtr(params32->length), + .access = params32->access, + }; + struct glUnmapBuffer_params unmap_params = { .target = params.target }; + NTSTATUS status; + + /* already mapped, we're being called again with a wow64 pointer */ + if (params32->ret) params.ret = (char *)get_buffer_pointer( params.target ); + else if ((status = ext_glMapBufferRange( ¶ms ))) return status; + + status = wow64_map_buffer( 0, params.target, params.ret, params.length, params.access, ¶ms32->ret ); + if (!status || status == STATUS_INVALID_ADDRESS) return status; + + ext_glUnmapBuffer( &unmap_params ); + return status; +} + +NTSTATUS wow64_ext_glMapNamedBuffer( void *args ) +{ + struct + { + GLuint buffer; + GLenum access; + PTR32 ret; + } *params32 = args; + struct glMapNamedBuffer_params params = + { + .buffer = params32->buffer, + .access = params32->access, + }; + struct glUnmapNamedBuffer_params unmap_params = { .buffer = params.buffer }; + NTSTATUS status; + + /* already mapped, we're being called again with a wow64 pointer */ + if (params32->ret) params.ret = get_named_buffer_pointer( params.buffer ); + else if ((status = ext_glMapNamedBuffer( ¶ms ))) return status; + + status = wow64_map_buffer( params.buffer, 0, params.ret, 0, params.access, ¶ms32->ret ); + if (!status || status == STATUS_INVALID_ADDRESS) return status; + + ext_glUnmapNamedBuffer( &unmap_params ); + return status; +} + +NTSTATUS wow64_ext_glMapNamedBufferEXT( void *args ) +{ + return wow64_ext_glMapNamedBuffer( args ); +} + +NTSTATUS wow64_ext_glMapNamedBufferRange( void *args ) +{ + struct + { + GLuint buffer; + PTR32 offset; + PTR32 length; + GLbitfield access; + PTR32 ret; + } *params32 = args; + struct glMapNamedBufferRange_params params = + { + .buffer = params32->buffer, + .offset = (GLintptr)ULongToPtr(params32->offset), + .length = (GLsizeiptr)ULongToPtr(params32->length), + .access = params32->access, + }; + struct glUnmapNamedBuffer_params unmap_params = { .buffer = params.buffer }; + NTSTATUS status; + + /* already mapped, we're being called again with a wow64 pointer */ + if (params32->ret) params.ret = get_named_buffer_pointer( params.buffer ); + else if ((status = ext_glMapNamedBufferRange( ¶ms ))) return status; + + status = wow64_map_buffer( params.buffer, 0, params.ret, params.length, params.access, ¶ms32->ret ); + if (!status || status == STATUS_INVALID_ADDRESS) return status; + + ext_glUnmapNamedBuffer( &unmap_params ); + return status; +} + +NTSTATUS wow64_ext_glMapNamedBufferRangeEXT( void *args ) +{ + return wow64_ext_glMapNamedBufferRange( args ); +} + +NTSTATUS wow64_ext_glUnmapBuffer( void *args ) +{ + PTR32 *ptr; + struct + { + GLenum target; + GLboolean ret; + } *params32 = args; + NTSTATUS status; + + if (!(ptr = get_buffer_pointer( params32->target ))) return STATUS_SUCCESS; + + status = wow64_unmap_buffer( ptr, get_buffer_param( params32->target, GL_BUFFER_MAP_LENGTH ), + get_buffer_param( params32->target, GL_BUFFER_ACCESS_FLAGS ) ); + ext_glUnmapBuffer( args ); + + return status; +} + +NTSTATUS wow64_ext_glUnmapBufferARB( void *args ) +{ + return wow64_ext_glUnmapBuffer( args ); +} + +NTSTATUS wow64_ext_glUnmapNamedBuffer( void *args ) +{ + PTR32 *ptr; + struct + { + GLint buffer; + GLboolean ret; + } *params32 = args; + NTSTATUS status; + + if (!(ptr = get_named_buffer_pointer( params32->buffer ))) return STATUS_SUCCESS; + + status = wow64_unmap_buffer( ptr, get_named_buffer_param( params32->buffer, GL_BUFFER_MAP_LENGTH ), + get_named_buffer_param( params32->buffer, GL_BUFFER_ACCESS_FLAGS ) ); + ext_glUnmapNamedBuffer( args ); + + return status; +} + +NTSTATUS wow64_ext_glUnmapNamedBufferEXT( void *args ) +{ + return wow64_ext_glUnmapNamedBuffer( args ); +} + NTSTATUS WINAPI wow64_process_detach( void *args ) { NTSTATUS status; diff --git a/dlls/opengl32/wgl.c b/dlls/opengl32/wgl.c index ff9e6164c89..2ffdc20c057 100644 --- a/dlls/opengl32/wgl.c +++ b/dlls/opengl32/wgl.c @@ -28,6 +28,7 @@ #include "winbase.h" #include "winreg.h" #include "ntuser.h" +#include "malloc.h"
#include "unixlib.h" #include "private.h" @@ -1036,6 +1037,26 @@ const GLchar * WINAPI wglQueryRendererStringWINE( HDC dc, GLint renderer, GLenum return args.ret; }
+#ifndef _WIN64 +static void *get_buffer_pointer( GLenum target ) +{ + void (WINAPI *p_glGetBufferPointerv)( GLenum target, GLenum pname, void **params ); + void *ptr; + if (!(p_glGetBufferPointerv = (void *)wglGetProcAddress( "glGetBufferPointerv" ))) return 0; + p_glGetBufferPointerv( target, GL_BUFFER_MAP_POINTER, &ptr ); + return ptr; +} + +static void *get_named_buffer_pointer( GLint buffer ) +{ + void (WINAPI *p_glGetNamedBufferPointerv)( GLuint buffer, GLenum pname, void **params ); + void *ptr; + if (!(p_glGetNamedBufferPointerv = (void *)wglGetProcAddress( "glGetNamedBufferPointerv" ))) return 0; + p_glGetNamedBufferPointerv( buffer, GL_BUFFER_MAP_POINTER, &ptr ); + return ptr; +} +#endif + void * WINAPI glMapBuffer( GLenum target, GLenum access ) { struct glMapBuffer_params args = @@ -1048,6 +1069,15 @@ void * WINAPI glMapBuffer( GLenum target, GLenum access ) TRACE( "target %d, access %d\n", target, access );
if (!(status = UNIX_CALL( glMapBuffer, &args ))) return args.ret; +#ifndef _WIN64 + if (status == STATUS_INVALID_ADDRESS) + { + TRACE( "Unable to map wow64 buffer directly, using copy buffer!\n" ); + if (!(args.ret = _aligned_malloc( (size_t)args.ret, 16 ))) status = STATUS_NO_MEMORY; + else if (!(status = UNIX_CALL( glMapBuffer, &args ))) return args.ret; + _aligned_free( args.ret ); + } +#endif WARN( "glMapBuffer returned %#lx\n", status ); return args.ret; } @@ -1071,6 +1101,15 @@ void * WINAPI glMapBufferRange( GLenum target, GLintptr offset, GLsizeiptr lengt TRACE( "target %d, offset %Id, length %Id, access %d\n", target, offset, length, access );
if (!(status = UNIX_CALL( glMapBufferRange, &args ))) return args.ret; +#ifndef _WIN64 + if (status == STATUS_INVALID_ADDRESS) + { + TRACE( "Unable to map wow64 buffer directly, using copy buffer!\n" ); + if (!(args.ret = _aligned_malloc( length, 16 ))) status = STATUS_NO_MEMORY; + else if (!(status = UNIX_CALL( glMapBufferRange, &args ))) return args.ret; + _aligned_free( args.ret ); + } +#endif WARN( "glMapBufferRange returned %#lx\n", status ); return args.ret; } @@ -1087,6 +1126,15 @@ void * WINAPI glMapNamedBuffer( GLuint buffer, GLenum access ) TRACE( "(%d, %d)\n", buffer, access );
if (!(status = UNIX_CALL( glMapNamedBuffer, &args ))) return args.ret; +#ifndef _WIN64 + if (status == STATUS_INVALID_ADDRESS) + { + TRACE( "Unable to map wow64 buffer directly, using copy buffer!\n" ); + if (!(args.ret = _aligned_malloc( (size_t)args.ret, 16 ))) status = STATUS_NO_MEMORY; + else if (!(status = UNIX_CALL( glMapNamedBuffer, &args ))) return args.ret; + _aligned_free( args.ret ); + } +#endif WARN( "glMapNamedBuffer returned %#lx\n", status ); return args.ret; } @@ -1110,6 +1158,15 @@ void * WINAPI glMapNamedBufferRange( GLuint buffer, GLintptr offset, GLsizeiptr TRACE( "buffer %d, offset %Id, length %Id, access %d\n", buffer, offset, length, access );
if (!(status = UNIX_CALL( glMapNamedBufferRange, &args ))) return args.ret; +#ifndef _WIN64 + if (status == STATUS_INVALID_ADDRESS) + { + TRACE( "Unable to map wow64 buffer directly, using copy buffer!\n" ); + if (!(args.ret = _aligned_malloc( length, 16 ))) status = STATUS_NO_MEMORY; + else if (!(status = UNIX_CALL( glMapNamedBufferRange, &args ))) return args.ret; + _aligned_free( args.ret ); + } +#endif WARN( "glMapNamedBufferRange returned %#lx\n", status ); return args.ret; } @@ -1126,10 +1183,21 @@ GLboolean WINAPI glUnmapBuffer( GLenum target ) .target = target, }; NTSTATUS status; +#ifndef _WIN64 + void *ptr = get_buffer_pointer( target ); +#endif
TRACE( "target %d\n", target );
if (!(status = UNIX_CALL( glUnmapBuffer, &args ))) return args.ret; +#ifndef _WIN64 + if (status == STATUS_INVALID_ADDRESS) + { + TRACE( "Releasing wow64 copy buffer %p\n", ptr ); + _aligned_free( ptr ); + return args.ret; + } +#endif WARN( "glUnmapBuffer returned %#lx\n", status ); return args.ret; } @@ -1146,10 +1214,21 @@ GLboolean WINAPI glUnmapNamedBuffer( GLuint buffer ) .buffer = buffer, }; NTSTATUS status; +#ifndef _WIN64 + void *ptr = get_named_buffer_pointer( buffer ); +#endif
TRACE( "buffer %d\n", buffer );
if (!(status = UNIX_CALL( glUnmapNamedBuffer, &args ))) return args.ret; +#ifndef _WIN64 + if (status == STATUS_INVALID_ADDRESS) + { + TRACE( "Releasing wow64 copy buffer %p\n", ptr ); + _aligned_free( ptr ); + return args.ret; + } +#endif WARN( "glUnmapNamedBuffer returned %#lx\n", status ); return args.ret; }
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/opengl32/make_opengl | 2 +- dlls/opengl32/unix_thunks.c | 2 +- dlls/opengl32/unix_wgl.c | 2 +- dlls/opengl32/wgl.c | 15 ++++++++------- 4 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/dlls/opengl32/make_opengl b/dlls/opengl32/make_opengl index 43199f56981..a6b1a974003 100755 --- a/dlls/opengl32/make_opengl +++ b/dlls/opengl32/make_opengl @@ -1126,7 +1126,7 @@ print OUT "#include "unix_private.h"\n\n"; print OUT "#include "wine/debug.h"\n\n";
print OUT "#ifdef _WIN64\n"; -print OUT "WINE_DEFAULT_DEBUG_CHANNEL(wgl);\n"; +print OUT "WINE_DEFAULT_DEBUG_CHANNEL(opengl);\n"; print OUT "#endif\n\n";
print OUT "extern NTSTATUS thread_attach( void *args ) DECLSPEC_HIDDEN;\n"; diff --git a/dlls/opengl32/unix_thunks.c b/dlls/opengl32/unix_thunks.c index 1ba8fc3bf2f..d75acc8eee9 100644 --- a/dlls/opengl32/unix_thunks.c +++ b/dlls/opengl32/unix_thunks.c @@ -19,7 +19,7 @@ #include "wine/debug.h"
#ifdef _WIN64 -WINE_DEFAULT_DEBUG_CHANNEL(wgl); +WINE_DEFAULT_DEBUG_CHANNEL(opengl); #endif
extern NTSTATUS thread_attach( void *args ) DECLSPEC_HIDDEN; diff --git a/dlls/opengl32/unix_wgl.c b/dlls/opengl32/unix_wgl.c index cc3c6a47e1d..b0874af546e 100644 --- a/dlls/opengl32/unix_wgl.c +++ b/dlls/opengl32/unix_wgl.c @@ -41,7 +41,7 @@
#include "wine/debug.h"
-WINE_DEFAULT_DEBUG_CHANNEL(wgl); +WINE_DEFAULT_DEBUG_CHANNEL(opengl);
static pthread_mutex_t wgl_lock = PTHREAD_MUTEX_INITIALIZER;
diff --git a/dlls/opengl32/wgl.c b/dlls/opengl32/wgl.c index 2ffdc20c057..27efa6df745 100644 --- a/dlls/opengl32/wgl.c +++ b/dlls/opengl32/wgl.c @@ -36,7 +36,7 @@ #include "wine/glu.h" #include "wine/debug.h"
-WINE_DEFAULT_DEBUG_CHANNEL(wgl); +WINE_DEFAULT_DEBUG_CHANNEL(opengl); WINE_DECLARE_DEBUG_CHANNEL(fps);
unixlib_handle_t unixlib_handle = 0; @@ -120,11 +120,11 @@ INT WINAPI wglChoosePixelFormat(HDC hdc, const PIXELFORMATDESCRIPTOR* ppfd) int i, count, best_format; int bestDBuffer = -1, bestStereo = -1;
- TRACE_(wgl)( "%p %p: size %u version %u flags %lu type %u color %u %u,%u,%u,%u " - "accum %u depth %u stencil %u aux %u\n", - hdc, ppfd, ppfd->nSize, ppfd->nVersion, ppfd->dwFlags, ppfd->iPixelType, - ppfd->cColorBits, ppfd->cRedBits, ppfd->cGreenBits, ppfd->cBlueBits, ppfd->cAlphaBits, - ppfd->cAccumBits, ppfd->cDepthBits, ppfd->cStencilBits, ppfd->cAuxBuffers ); + TRACE( "%p %p: size %u version %u flags %lu type %u color %u %u,%u,%u,%u " + "accum %u depth %u stencil %u aux %u\n", + hdc, ppfd, ppfd->nSize, ppfd->nVersion, ppfd->dwFlags, ppfd->iPixelType, + ppfd->cColorBits, ppfd->cRedBits, ppfd->cGreenBits, ppfd->cBlueBits, ppfd->cAlphaBits, + ppfd->cAccumBits, ppfd->cDepthBits, ppfd->cStencilBits, ppfd->cAuxBuffers );
count = wglDescribePixelFormat( hdc, 0, 0, NULL ); if (!count) return 0; @@ -486,7 +486,8 @@ static BOOL wglUseFontBitmaps_common( HDC hdc, DWORD first, DWORD count, DWORD l if (!ret) break; }
- if (TRACE_ON(wgl)) { + if (TRACE_ON(opengl)) + { unsigned int bitmask; unsigned char *bitmap_ = bitmap;
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/winex11.drv/opengl.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index c74c317f6ff..616d580ab34 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -2824,6 +2824,7 @@ static BOOL X11DRV_wglGetPixelFormatAttribivARB( HDC hdc, int iPixelFormat, int case WGL_SWAP_METHOD_ARB: if (has_swap_method) { + if (!fmt) goto pix_error; hTest = pglXGetFBConfigAttrib(gdi_display, fmt->fbconfig, GLX_SWAP_METHOD_OML, &tmp); if (hTest) goto get_error; switch (tmp)
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/wined3d/directx.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index 8590bd4800a..c59741f2dc6 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -135,13 +135,13 @@ static HRESULT wined3d_output_init(struct wined3d_output *output, unsigned int o
lstrcpyW(open_adapter_desc.DeviceName, device_name); if (D3DKMTOpenAdapterFromGdiDisplayName(&open_adapter_desc)) - return E_INVALIDARG; + FIXME("D3DKMTOpenAdapterFromGdiDisplayName failed!\n"); close_adapter_desc.hAdapter = open_adapter_desc.hAdapter; D3DKMTCloseAdapter(&close_adapter_desc);
create_device_desc.u.hAdapter = adapter->kmt_adapter; if (D3DKMTCreateDevice(&create_device_desc)) - return E_FAIL; + FIXME("D3DKMTCreateDevice failed!\n");
output->ordinal = ordinal; lstrcpyW(output->device_name, device_name); @@ -3459,7 +3459,7 @@ BOOL wined3d_adapter_init(struct wined3d_adapter *adapter, unsigned int ordinal,
open_adapter_desc.AdapterLuid = adapter->luid; if (D3DKMTOpenAdapterFromLuid(&open_adapter_desc)) - return FALSE; + FIXME("D3DKMTOpenAdapterFromLuid failed!\n"); adapter->kmt_adapter = open_adapter_desc.hAdapter;
display_device.cb = sizeof(display_device);
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/wined3d/adapter_gl.c | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/dlls/wined3d/adapter_gl.c b/dlls/wined3d/adapter_gl.c index 60a168b5cef..fefe406f6e4 100644 --- a/dlls/wined3d/adapter_gl.c +++ b/dlls/wined3d/adapter_gl.c @@ -3704,6 +3704,10 @@ static BOOL wined3d_adapter_init_gl_caps(struct wined3d_adapter *adapter, gl_info->supported[EXT_PACKED_DEPTH_STENCIL] = TRUE; }
+#ifndef _WIN64 + gl_info->supported[ARB_BUFFER_STORAGE] = FALSE; +#endif + wined3d_adapter_init_limits(gl_info);
if (gl_info->supported[ARB_VERTEX_PROGRAM] && test_arb_vs_offset_limit(gl_info)) @@ -5227,6 +5231,9 @@ static void wined3d_adapter_gl_init_d3d_info(struct wined3d_adapter_gl *adapter_ d3d_info->feature_level = feature_level_from_caps(gl_info, &shader_caps, &fragment_caps); d3d_info->filling_convention_offset = gl_info->filling_convention_offset; d3d_info->persistent_map = !!gl_info->supported[ARB_BUFFER_STORAGE]; +#ifndef _WIN64 + d3d_info->persistent_map = FALSE; +#endif
if (gl_info->supported[ARB_TEXTURE_MULTISAMPLE]) d3d_info->multisample_draw_location = WINED3D_LOCATION_TEXTURE_RGB;
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=126364
Your paranoid android.
=== debian11 (32 bit report) ===
d3d11: d3d11.c:28750: Test succeeded inside todo block: Feature level 0xb000: Got 0xffffffff, expected 0xffffffff at (640, 480, 1), sub-resource 0. d3d11.c:28759: Test succeeded inside todo block: Feature level 0xb000: Got 0xffffffff, expected 0xffffffff at (640, 480, 1), sub-resource 0. d3d11.c:28750: Test failed: Feature level 0xa100: Got 0xffffffff, expected 0xff00ff00 at (639, 479, 0), sub-resource 0. d3d11.c:28759: Test failed: Feature level 0xa100: Got 0xffffffff, expected 0xff00ff00 at (639, 479, 0), sub-resource 0. d3d11.c:28750: Test failed: Feature level 0xa000: Got 0xffffffff, expected 0xff00ff00 at (639, 479, 0), sub-resource 0. d3d11.c:28759: Test failed: Feature level 0xa000: Got 0xffffffff, expected 0xff00ff00 at (639, 479, 0), sub-resource 0.
d3d8: visual.c:10670: Test failed: Expected unsynchronised map for flags 0x1000. visual.c:10670: Test failed: Expected unsynchronised map for flags 0x3000.
d3d9: visual.c:25693: Test failed: Expected unsynchronised map for flags 0x1000. visual.c:25693: Test failed: Expected unsynchronised map for flags 0x3000.
Was actually broken, this should work better now. It can run Unigine benchmarks, with fine GL performance but abysmal D3D9 perf because of buffer copies.
This merge request was closed by Rémi Bernon.
Most of this has been merged now.