[PATCH 0/7] MR11125: opengl32: Implement display lists for framebuffer, renderbuffer, textures and samplers.
From: Rémi Bernon <rbernon@codeweavers.com> --- dlls/opengl32/make_opengl | 8 +- dlls/opengl32/private.h | 1 + dlls/opengl32/tests/opengl.c | 6 +- dlls/opengl32/thunks.c | 177 +++++++++++++++++++++++++---------- dlls/opengl32/wgl.c | 5 + 5 files changed, 146 insertions(+), 51 deletions(-) diff --git a/dlls/opengl32/make_opengl b/dlls/opengl32/make_opengl index 86d8a2604be..bab1d739e76 100755 --- a/dlls/opengl32/make_opengl +++ b/dlls/opengl32/make_opengl @@ -685,7 +685,8 @@ sub get_object_type($$$$) return "OBJ_TYPE_BUFFER" if $class eq "buffer"; return "OBJ_TYPE_BUFFER" if $func eq "glDeleteObjectBufferATI" and $pname eq "buffer"; return "OBJ_TYPE_BUFFER" if $func eq "glDrawCommandsNV" and $pname eq "buffer"; - return 0 if $class eq "framebuffer"; + return "OBJ_TYPE_FRAMEBUFFER" if $class eq "framebuffer"; + return "OBJ_TYPE_FRAMEBUFFER" if $pname =~ "fbo"; return 0 if $class eq "renderbuffer"; return 0 if $class eq "SelectName"; @@ -695,6 +696,7 @@ sub get_object_type($$$$) return 0 if $ptype !~ /GLuint|GLhandleARB/; print "Missing possible buffer: $func $ptype $pname $class\n" if lc( $pname ) =~ /buffer/; + print "Missing possible framebuffer: $func $ptype $pname $class\n" if lc( $pname ) =~ /fbo/; return 0; } @@ -705,6 +707,7 @@ sub allocate_object_names($) return "TRUE" if has_extension( $name, "GL_EXT_direct_state_access" ); return $ret if $name =~ /^glBindBuffer/; + return $ret if $name =~ /^glBindFramebuffer/; return 0; } @@ -740,6 +743,9 @@ sub generate_win_thunk($$) my $addr = $len eq "1" ? "&" : ""; my $deref = $len eq "1" ? "*" : ""; + $len = "count" if $name =~ /^glDrawCommandsStates/ and $pname eq "fbos"; + $addr = "" if $name =~ /^glDrawCommandsStates/ and $pname eq "fbos"; + if ($name =~ /^(glGen|glCreate)/) { $params .= ", .$pname = $pname"; diff --git a/dlls/opengl32/private.h b/dlls/opengl32/private.h index 334ce6b7868..f9f9f613d81 100644 --- a/dlls/opengl32/private.h +++ b/dlls/opengl32/private.h @@ -49,6 +49,7 @@ extern BOOL get_integer( GLenum pname, GLuint index, GLint value, GLint *data ); enum object_type { OBJ_TYPE_BUFFER, + OBJ_TYPE_FRAMEBUFFER, OBJ_TYPE_COUNT, }; diff --git a/dlls/opengl32/tests/opengl.c b/dlls/opengl32/tests/opengl.c index 352c21fa2c7..9b51b3cabe2 100644 --- a/dlls/opengl32/tests/opengl.c +++ b/dlls/opengl32/tests/opengl.c @@ -2021,7 +2021,7 @@ static void test_sharelists(HDC winhdc) ok_ret( GL_NO_ERROR, glGetError() ); /* cannot overwrite non-empty lists with some other */ - todo_wine_if( i >= 2 ) ok_ret( FALSE, wglShareLists( ctx1, ctx3 ) ); + todo_wine_if( i >= 4 ) ok_ret( FALSE, wglShareLists( ctx1, ctx3 ) ); ok_ret( GL_NO_ERROR, glGetError() ); ok_ret( FALSE, wglShareLists( ctx2, ctx1 ) ); ok_ret( GL_NO_ERROR, glGetError() ); @@ -2069,7 +2069,7 @@ static void test_sharelists(HDC winhdc) ok_ret( GL_NO_ERROR, glGetError() ); ok_ret( TRUE, wglMakeCurrent( winhdc, ctx2 ) ); ok_ret( GL_NO_ERROR, glGetError() ); - todo_wine_if( i >= 2 ) ok_ret( FALSE, test->exists( obj1 ) ); + todo_wine_if( i >= 4 ) ok_ret( FALSE, test->exists( obj1 ) ); ok_ret( GL_NO_ERROR, glGetError() ); ok_ret( FALSE, test->exists( obj2 ) ); ok_ret( GL_NO_ERROR, glGetError() ); @@ -2080,7 +2080,7 @@ static void test_sharelists(HDC winhdc) ok_ret( TRUE, wglDeleteContext( ctx3 ) ); /* objects are still valid after shared context destruction */ - todo_wine_if( i >= 2 ) ok_ret( FALSE, test->exists( obj1 ) ); + todo_wine_if( i >= 4 ) ok_ret( FALSE, test->exists( obj1 ) ); ok_ret( GL_NO_ERROR, glGetError() ); ok_ret( FALSE, test->exists( obj2 ) ); ok_ret( GL_NO_ERROR, glGetError() ); diff --git a/dlls/opengl32/thunks.c b/dlls/opengl32/thunks.c index cc40a29554a..4aa89af190f 100644 --- a/dlls/opengl32/thunks.c +++ b/dlls/opengl32/thunks.c @@ -3241,17 +3241,21 @@ static void WINAPI glBindFragmentShaderATI( GLuint id ) static void WINAPI glBindFramebuffer( GLenum target, GLuint framebuffer ) { - struct glBindFramebuffer_params args = { .teb = NtCurrentTeb(), .target = target, .framebuffer = framebuffer }; + struct glBindFramebuffer_params args = { .teb = NtCurrentTeb(), .target = target }; NTSTATUS status; TRACE( "target %d, framebuffer %d\n", target, framebuffer ); + if (!alloc_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &framebuffer, FALSE )) return; + args.framebuffer = *map_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &framebuffer ); if ((status = UNIX_CALL( glBindFramebuffer, &args ))) WARN( "glBindFramebuffer returned %#lx\n", status ); } static void WINAPI glBindFramebufferEXT( GLenum target, GLuint framebuffer ) { - struct glBindFramebufferEXT_params args = { .teb = NtCurrentTeb(), .target = target, .framebuffer = framebuffer }; + struct glBindFramebufferEXT_params args = { .teb = NtCurrentTeb(), .target = target }; NTSTATUS status; TRACE( "target %d, framebuffer %d\n", target, framebuffer ); + if (!alloc_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &framebuffer, TRUE )) return; + args.framebuffer = *map_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &framebuffer ); if ((status = UNIX_CALL( glBindFramebufferEXT, &args ))) WARN( "glBindFramebufferEXT returned %#lx\n", status ); } @@ -3835,9 +3839,11 @@ static void WINAPI glBlitFramebufferLayersEXT( GLint srcX0, GLint srcY0, GLint s static void WINAPI glBlitNamedFramebuffer( GLuint readFramebuffer, GLuint drawFramebuffer, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter ) { - struct glBlitNamedFramebuffer_params args = { .teb = NtCurrentTeb(), .readFramebuffer = readFramebuffer, .drawFramebuffer = drawFramebuffer, .srcX0 = srcX0, .srcY0 = srcY0, .srcX1 = srcX1, .srcY1 = srcY1, .dstX0 = dstX0, .dstY0 = dstY0, .dstX1 = dstX1, .dstY1 = dstY1, .mask = mask, .filter = filter }; + struct glBlitNamedFramebuffer_params args = { .teb = NtCurrentTeb(), .srcX0 = srcX0, .srcY0 = srcY0, .srcX1 = srcX1, .srcY1 = srcY1, .dstX0 = dstX0, .dstY0 = dstY0, .dstX1 = dstX1, .dstY1 = dstY1, .mask = mask, .filter = filter }; NTSTATUS status; TRACE( "readFramebuffer %d, drawFramebuffer %d, srcX0 %d, srcY0 %d, srcX1 %d, srcY1 %d, dstX0 %d, dstY0 %d, dstX1 %d, dstY1 %d, mask %d, filter %d\n", readFramebuffer, drawFramebuffer, srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter ); + args.readFramebuffer = *map_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &readFramebuffer ); + args.drawFramebuffer = *map_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &drawFramebuffer ); if ((status = UNIX_CALL( glBlitNamedFramebuffer, &args ))) WARN( "glBlitNamedFramebuffer returned %#lx\n", status ); } @@ -3974,18 +3980,21 @@ static GLenum WINAPI glCheckFramebufferStatusEXT( GLenum target ) static GLenum WINAPI glCheckNamedFramebufferStatus( GLuint framebuffer, GLenum target ) { - struct glCheckNamedFramebufferStatus_params args = { .teb = NtCurrentTeb(), .framebuffer = framebuffer, .target = target }; + struct glCheckNamedFramebufferStatus_params args = { .teb = NtCurrentTeb(), .target = target }; NTSTATUS status; TRACE( "framebuffer %d, target %d\n", framebuffer, target ); + args.framebuffer = *map_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &framebuffer ); if ((status = UNIX_CALL( glCheckNamedFramebufferStatus, &args ))) WARN( "glCheckNamedFramebufferStatus returned %#lx\n", status ); return args.ret; } static GLenum WINAPI glCheckNamedFramebufferStatusEXT( GLuint framebuffer, GLenum target ) { - struct glCheckNamedFramebufferStatusEXT_params args = { .teb = NtCurrentTeb(), .framebuffer = framebuffer, .target = target }; + struct glCheckNamedFramebufferStatusEXT_params args = { .teb = NtCurrentTeb(), .target = target }; NTSTATUS status; TRACE( "framebuffer %d, target %d\n", framebuffer, target ); + if (!alloc_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &framebuffer, TRUE )) return args.ret; + args.framebuffer = *map_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &framebuffer ); if ((status = UNIX_CALL( glCheckNamedFramebufferStatusEXT, &args ))) WARN( "glCheckNamedFramebufferStatusEXT returned %#lx\n", status ); return args.ret; } @@ -4174,33 +4183,37 @@ static void WINAPI glClearNamedBufferSubDataEXT( GLuint buffer, GLenum internalf static void WINAPI glClearNamedFramebufferfi( GLuint framebuffer, GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil ) { - struct glClearNamedFramebufferfi_params args = { .teb = NtCurrentTeb(), .framebuffer = framebuffer, .buffer = buffer, .drawbuffer = drawbuffer, .depth = depth, .stencil = stencil }; + struct glClearNamedFramebufferfi_params args = { .teb = NtCurrentTeb(), .buffer = buffer, .drawbuffer = drawbuffer, .depth = depth, .stencil = stencil }; NTSTATUS status; TRACE( "framebuffer %d, buffer %d, drawbuffer %d, depth %f, stencil %d\n", framebuffer, buffer, drawbuffer, depth, stencil ); + args.framebuffer = *map_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &framebuffer ); if ((status = UNIX_CALL( glClearNamedFramebufferfi, &args ))) WARN( "glClearNamedFramebufferfi returned %#lx\n", status ); } static void WINAPI glClearNamedFramebufferfv( GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLfloat *value ) { - struct glClearNamedFramebufferfv_params args = { .teb = NtCurrentTeb(), .framebuffer = framebuffer, .buffer = buffer, .drawbuffer = drawbuffer, .value = value }; + struct glClearNamedFramebufferfv_params args = { .teb = NtCurrentTeb(), .buffer = buffer, .drawbuffer = drawbuffer, .value = value }; NTSTATUS status; TRACE( "framebuffer %d, buffer %d, drawbuffer %d, value %p\n", framebuffer, buffer, drawbuffer, value ); + args.framebuffer = *map_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &framebuffer ); if ((status = UNIX_CALL( glClearNamedFramebufferfv, &args ))) WARN( "glClearNamedFramebufferfv returned %#lx\n", status ); } static void WINAPI glClearNamedFramebufferiv( GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLint *value ) { - struct glClearNamedFramebufferiv_params args = { .teb = NtCurrentTeb(), .framebuffer = framebuffer, .buffer = buffer, .drawbuffer = drawbuffer, .value = value }; + struct glClearNamedFramebufferiv_params args = { .teb = NtCurrentTeb(), .buffer = buffer, .drawbuffer = drawbuffer, .value = value }; NTSTATUS status; TRACE( "framebuffer %d, buffer %d, drawbuffer %d, value %p\n", framebuffer, buffer, drawbuffer, value ); + args.framebuffer = *map_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &framebuffer ); if ((status = UNIX_CALL( glClearNamedFramebufferiv, &args ))) WARN( "glClearNamedFramebufferiv returned %#lx\n", status ); } static void WINAPI glClearNamedFramebufferuiv( GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLuint *value ) { - struct glClearNamedFramebufferuiv_params args = { .teb = NtCurrentTeb(), .framebuffer = framebuffer, .buffer = buffer, .drawbuffer = drawbuffer, .value = value }; + struct glClearNamedFramebufferuiv_params args = { .teb = NtCurrentTeb(), .buffer = buffer, .drawbuffer = drawbuffer, .value = value }; NTSTATUS status; TRACE( "framebuffer %d, buffer %d, drawbuffer %d, value %p\n", framebuffer, buffer, drawbuffer, value ); + args.framebuffer = *map_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &framebuffer ); if ((status = UNIX_CALL( glClearNamedFramebufferuiv, &args ))) WARN( "glClearNamedFramebufferuiv returned %#lx\n", status ); } @@ -5391,6 +5404,7 @@ static void WINAPI glCreateFramebuffers( GLsizei n, GLuint *framebuffers ) NTSTATUS status; TRACE( "n %d, framebuffers %p\n", n, framebuffers ); if ((status = UNIX_CALL( glCreateFramebuffers, &args ))) WARN( "glCreateFramebuffers returned %#lx\n", status ); + if (n > 0) put_context_objects( OBJ_TYPE_FRAMEBUFFER, n, framebuffers ); } static void WINAPI glCreateMemoryObjectsEXT( GLsizei n, GLuint *memoryObjects ) @@ -5738,18 +5752,26 @@ static void WINAPI glDeleteFragmentShaderATI( GLuint id ) static void WINAPI glDeleteFramebuffers( GLsizei n, const GLuint *framebuffers ) { - struct glDeleteFramebuffers_params args = { .teb = NtCurrentTeb(), .n = n, .framebuffers = framebuffers }; + GLuint framebuffers_buf[64], *framebuffers_tmp; + struct glDeleteFramebuffers_params args = { .teb = NtCurrentTeb(), .n = n }; NTSTATUS status; TRACE( "n %d, framebuffers %p\n", n, framebuffers ); + framebuffers_tmp = n > 0 ? memdup_objects( n, framebuffers, framebuffers_buf, ARRAY_SIZE(framebuffers_buf) ) : NULL; + args.framebuffers = n > 0 ? del_context_objects( OBJ_TYPE_FRAMEBUFFER, n, framebuffers_tmp ) : NULL; if ((status = UNIX_CALL( glDeleteFramebuffers, &args ))) WARN( "glDeleteFramebuffers returned %#lx\n", status ); + if (framebuffers_tmp != framebuffers_buf) free( framebuffers_tmp ); } static void WINAPI glDeleteFramebuffersEXT( GLsizei n, const GLuint *framebuffers ) { - struct glDeleteFramebuffersEXT_params args = { .teb = NtCurrentTeb(), .n = n, .framebuffers = framebuffers }; + GLuint framebuffers_buf[64], *framebuffers_tmp; + struct glDeleteFramebuffersEXT_params args = { .teb = NtCurrentTeb(), .n = n }; NTSTATUS status; TRACE( "n %d, framebuffers %p\n", n, framebuffers ); + framebuffers_tmp = n > 0 ? memdup_objects( n, framebuffers, framebuffers_buf, ARRAY_SIZE(framebuffers_buf) ) : NULL; + args.framebuffers = n > 0 ? del_context_objects( OBJ_TYPE_FRAMEBUFFER, n, framebuffers_tmp ) : NULL; if ((status = UNIX_CALL( glDeleteFramebuffersEXT, &args ))) WARN( "glDeleteFramebuffersEXT returned %#lx\n", status ); + if (framebuffers_tmp != framebuffers_buf) free( framebuffers_tmp ); } static void WINAPI glDeleteMemoryObjectsEXT( GLsizei n, const GLuint *memoryObjects ) @@ -6300,19 +6322,27 @@ static void WINAPI glDrawCommandsNV( GLenum primitiveMode, GLuint buffer, const static void WINAPI glDrawCommandsStatesAddressNV( const GLuint64 *indirects, const GLsizei *sizes, const GLuint *states, const GLuint *fbos, GLuint count ) { - struct glDrawCommandsStatesAddressNV_params args = { .teb = NtCurrentTeb(), .indirects = indirects, .sizes = sizes, .states = states, .fbos = fbos, .count = count }; + GLuint fbos_buf[64], *fbos_tmp; + struct glDrawCommandsStatesAddressNV_params args = { .teb = NtCurrentTeb(), .indirects = indirects, .sizes = sizes, .states = states, .count = count }; NTSTATUS status; TRACE( "indirects %p, sizes %p, states %p, fbos %p, count %d\n", indirects, sizes, states, fbos, count ); + fbos_tmp = count > 0 ? memdup_objects( count, fbos, fbos_buf, ARRAY_SIZE(fbos_buf) ) : NULL; + args.fbos = count > 0 ? map_context_objects( OBJ_TYPE_FRAMEBUFFER, count, fbos_tmp ) : NULL; if ((status = UNIX_CALL( glDrawCommandsStatesAddressNV, &args ))) WARN( "glDrawCommandsStatesAddressNV returned %#lx\n", status ); + if (fbos_tmp != fbos_buf) free( fbos_tmp ); } static void WINAPI glDrawCommandsStatesNV( GLuint buffer, const GLintptr *indirects, const GLsizei *sizes, const GLuint *states, const GLuint *fbos, GLuint count ) { - struct glDrawCommandsStatesNV_params args = { .teb = NtCurrentTeb(), .indirects = indirects, .sizes = sizes, .states = states, .fbos = fbos, .count = count }; + GLuint fbos_buf[64], *fbos_tmp; + struct glDrawCommandsStatesNV_params args = { .teb = NtCurrentTeb(), .indirects = indirects, .sizes = sizes, .states = states, .count = count }; NTSTATUS status; TRACE( "buffer %d, indirects %p, sizes %p, states %p, fbos %p, count %d\n", buffer, indirects, sizes, states, fbos, count ); args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); + fbos_tmp = count > 0 ? memdup_objects( count, fbos, fbos_buf, ARRAY_SIZE(fbos_buf) ) : NULL; + args.fbos = count > 0 ? map_context_objects( OBJ_TYPE_FRAMEBUFFER, count, fbos_tmp ) : NULL; if ((status = UNIX_CALL( glDrawCommandsStatesNV, &args ))) WARN( "glDrawCommandsStatesNV returned %#lx\n", status ); + if (fbos_tmp != fbos_buf) free( fbos_tmp ); } static void WINAPI glDrawElementArrayAPPLE( GLenum mode, GLint first, GLsizei count ) @@ -7273,17 +7303,21 @@ static void WINAPI glFrameZoomSGIX( GLint factor ) static void WINAPI glFramebufferDrawBufferEXT( GLuint framebuffer, GLenum mode ) { - struct glFramebufferDrawBufferEXT_params args = { .teb = NtCurrentTeb(), .framebuffer = framebuffer, .mode = mode }; + struct glFramebufferDrawBufferEXT_params args = { .teb = NtCurrentTeb(), .mode = mode }; NTSTATUS status; TRACE( "framebuffer %d, mode %d\n", framebuffer, mode ); + if (!alloc_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &framebuffer, TRUE )) return; + args.framebuffer = *map_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &framebuffer ); if ((status = UNIX_CALL( glFramebufferDrawBufferEXT, &args ))) WARN( "glFramebufferDrawBufferEXT returned %#lx\n", status ); } static void WINAPI glFramebufferDrawBuffersEXT( GLuint framebuffer, GLsizei n, const GLenum *bufs ) { - struct glFramebufferDrawBuffersEXT_params args = { .teb = NtCurrentTeb(), .framebuffer = framebuffer, .n = n, .bufs = bufs }; + struct glFramebufferDrawBuffersEXT_params args = { .teb = NtCurrentTeb(), .n = n, .bufs = bufs }; NTSTATUS status; TRACE( "framebuffer %d, n %d, bufs %p\n", framebuffer, n, bufs ); + if (!alloc_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &framebuffer, TRUE )) return; + args.framebuffer = *map_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &framebuffer ); if ((status = UNIX_CALL( glFramebufferDrawBuffersEXT, &args ))) WARN( "glFramebufferDrawBuffersEXT returned %#lx\n", status ); } @@ -7313,9 +7347,11 @@ static void WINAPI glFramebufferParameteriMESA( GLenum target, GLenum pname, GLi static void WINAPI glFramebufferReadBufferEXT( GLuint framebuffer, GLenum mode ) { - struct glFramebufferReadBufferEXT_params args = { .teb = NtCurrentTeb(), .framebuffer = framebuffer, .mode = mode }; + struct glFramebufferReadBufferEXT_params args = { .teb = NtCurrentTeb(), .mode = mode }; NTSTATUS status; TRACE( "framebuffer %d, mode %d\n", framebuffer, mode ); + if (!alloc_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &framebuffer, TRUE )) return; + args.framebuffer = *map_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &framebuffer ); if ((status = UNIX_CALL( glFramebufferReadBufferEXT, &args ))) WARN( "glFramebufferReadBufferEXT returned %#lx\n", status ); } @@ -7586,6 +7622,7 @@ static void WINAPI glGenFramebuffers( GLsizei n, GLuint *framebuffers ) NTSTATUS status; TRACE( "n %d, framebuffers %p\n", n, framebuffers ); if ((status = UNIX_CALL( glGenFramebuffers, &args ))) WARN( "glGenFramebuffers returned %#lx\n", status ); + if (n > 0) put_context_objects( OBJ_TYPE_FRAMEBUFFER, n, framebuffers ); } static void WINAPI glGenFramebuffersEXT( GLsizei n, GLuint *framebuffers ) @@ -7594,6 +7631,7 @@ static void WINAPI glGenFramebuffersEXT( GLsizei n, GLuint *framebuffers ) NTSTATUS status; TRACE( "n %d, framebuffers %p\n", n, framebuffers ); if ((status = UNIX_CALL( glGenFramebuffersEXT, &args ))) WARN( "glGenFramebuffersEXT returned %#lx\n", status ); + if (n > 0) put_context_objects( OBJ_TYPE_FRAMEBUFFER, n, framebuffers ); } static void WINAPI glGenNamesAMD( GLenum identifier, GLuint num, GLuint *names ) @@ -8570,9 +8608,11 @@ static void WINAPI glGetFramebufferParameteriv( GLenum target, GLenum pname, GLi static void WINAPI glGetFramebufferParameterivEXT( GLuint framebuffer, GLenum pname, GLint *params ) { - struct glGetFramebufferParameterivEXT_params args = { .teb = NtCurrentTeb(), .framebuffer = framebuffer, .pname = pname, .params = params }; + struct glGetFramebufferParameterivEXT_params args = { .teb = NtCurrentTeb(), .pname = pname, .params = params }; NTSTATUS status; TRACE( "framebuffer %d, pname %d, params %p\n", framebuffer, pname, params ); + if (!alloc_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &framebuffer, TRUE )) return; + args.framebuffer = *map_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &framebuffer ); if ((status = UNIX_CALL( glGetFramebufferParameterivEXT, &args ))) WARN( "glGetFramebufferParameterivEXT returned %#lx\n", status ); } @@ -9203,45 +9243,52 @@ static void WINAPI glGetNamedBufferSubDataEXT( GLuint buffer, GLintptr offset, G static void WINAPI glGetNamedFramebufferAttachmentParameteriv( GLuint framebuffer, GLenum attachment, GLenum pname, GLint *params ) { - struct glGetNamedFramebufferAttachmentParameteriv_params args = { .teb = NtCurrentTeb(), .framebuffer = framebuffer, .attachment = attachment, .pname = pname, .params = params }; + struct glGetNamedFramebufferAttachmentParameteriv_params args = { .teb = NtCurrentTeb(), .attachment = attachment, .pname = pname, .params = params }; NTSTATUS status; int integer; TRACE( "framebuffer %d, attachment %d, pname %d, params %p\n", framebuffer, attachment, pname, params ); + args.framebuffer = *map_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &framebuffer ); if ((status = UNIX_CALL( glGetNamedFramebufferAttachmentParameteriv, &args ))) WARN( "glGetNamedFramebufferAttachmentParameteriv returned %#lx\n", status ); else if (get_integer( pname, 0, *params, &integer )) *params = integer; } static void WINAPI glGetNamedFramebufferAttachmentParameterivEXT( GLuint framebuffer, GLenum attachment, GLenum pname, GLint *params ) { - struct glGetNamedFramebufferAttachmentParameterivEXT_params args = { .teb = NtCurrentTeb(), .framebuffer = framebuffer, .attachment = attachment, .pname = pname, .params = params }; + struct glGetNamedFramebufferAttachmentParameterivEXT_params args = { .teb = NtCurrentTeb(), .attachment = attachment, .pname = pname, .params = params }; NTSTATUS status; int integer; TRACE( "framebuffer %d, attachment %d, pname %d, params %p\n", framebuffer, attachment, pname, params ); + if (!alloc_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &framebuffer, TRUE )) return; + args.framebuffer = *map_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &framebuffer ); if ((status = UNIX_CALL( glGetNamedFramebufferAttachmentParameterivEXT, &args ))) WARN( "glGetNamedFramebufferAttachmentParameterivEXT returned %#lx\n", status ); else if (get_integer( pname, 0, *params, &integer )) *params = integer; } static void WINAPI glGetNamedFramebufferParameterfvAMD( GLuint framebuffer, GLenum pname, GLuint numsamples, GLuint pixelindex, GLsizei size, GLfloat *values ) { - struct glGetNamedFramebufferParameterfvAMD_params args = { .teb = NtCurrentTeb(), .framebuffer = framebuffer, .pname = pname, .numsamples = numsamples, .pixelindex = pixelindex, .size = size, .values = values }; + struct glGetNamedFramebufferParameterfvAMD_params args = { .teb = NtCurrentTeb(), .pname = pname, .numsamples = numsamples, .pixelindex = pixelindex, .size = size, .values = values }; NTSTATUS status; TRACE( "framebuffer %d, pname %d, numsamples %d, pixelindex %d, size %d, values %p\n", framebuffer, pname, numsamples, pixelindex, size, values ); + args.framebuffer = *map_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &framebuffer ); if ((status = UNIX_CALL( glGetNamedFramebufferParameterfvAMD, &args ))) WARN( "glGetNamedFramebufferParameterfvAMD returned %#lx\n", status ); } static void WINAPI glGetNamedFramebufferParameteriv( GLuint framebuffer, GLenum pname, GLint *param ) { - struct glGetNamedFramebufferParameteriv_params args = { .teb = NtCurrentTeb(), .framebuffer = framebuffer, .pname = pname, .param = param }; + struct glGetNamedFramebufferParameteriv_params args = { .teb = NtCurrentTeb(), .pname = pname, .param = param }; NTSTATUS status; TRACE( "framebuffer %d, pname %d, param %p\n", framebuffer, pname, param ); + args.framebuffer = *map_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &framebuffer ); if ((status = UNIX_CALL( glGetNamedFramebufferParameteriv, &args ))) WARN( "glGetNamedFramebufferParameteriv returned %#lx\n", status ); } static void WINAPI glGetNamedFramebufferParameterivEXT( GLuint framebuffer, GLenum pname, GLint *params ) { - struct glGetNamedFramebufferParameterivEXT_params args = { .teb = NtCurrentTeb(), .framebuffer = framebuffer, .pname = pname, .params = params }; + struct glGetNamedFramebufferParameterivEXT_params args = { .teb = NtCurrentTeb(), .pname = pname, .params = params }; NTSTATUS status; TRACE( "framebuffer %d, pname %d, params %p\n", framebuffer, pname, params ); + if (!alloc_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &framebuffer, TRUE )) return; + args.framebuffer = *map_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &framebuffer ); if ((status = UNIX_CALL( glGetNamedFramebufferParameterivEXT, &args ))) WARN( "glGetNamedFramebufferParameterivEXT returned %#lx\n", status ); } @@ -11740,17 +11787,19 @@ static void WINAPI glInvalidateFramebuffer( GLenum target, GLsizei numAttachment static void WINAPI glInvalidateNamedFramebufferData( GLuint framebuffer, GLsizei numAttachments, const GLenum *attachments ) { - struct glInvalidateNamedFramebufferData_params args = { .teb = NtCurrentTeb(), .framebuffer = framebuffer, .numAttachments = numAttachments, .attachments = attachments }; + struct glInvalidateNamedFramebufferData_params args = { .teb = NtCurrentTeb(), .numAttachments = numAttachments, .attachments = attachments }; NTSTATUS status; TRACE( "framebuffer %d, numAttachments %d, attachments %p\n", framebuffer, numAttachments, attachments ); + args.framebuffer = *map_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &framebuffer ); if ((status = UNIX_CALL( glInvalidateNamedFramebufferData, &args ))) WARN( "glInvalidateNamedFramebufferData returned %#lx\n", status ); } static void WINAPI glInvalidateNamedFramebufferSubData( GLuint framebuffer, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height ) { - struct glInvalidateNamedFramebufferSubData_params args = { .teb = NtCurrentTeb(), .framebuffer = framebuffer, .numAttachments = numAttachments, .attachments = attachments, .x = x, .y = y, .width = width, .height = height }; + struct glInvalidateNamedFramebufferSubData_params args = { .teb = NtCurrentTeb(), .numAttachments = numAttachments, .attachments = attachments, .x = x, .y = y, .width = width, .height = height }; NTSTATUS status; TRACE( "framebuffer %d, numAttachments %d, attachments %p, x %d, y %d, width %d, height %d\n", framebuffer, numAttachments, attachments, x, y, width, height ); + args.framebuffer = *map_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &framebuffer ); if ((status = UNIX_CALL( glInvalidateNamedFramebufferSubData, &args ))) WARN( "glInvalidateNamedFramebufferSubData returned %#lx\n", status ); } @@ -11863,18 +11912,20 @@ static GLboolean WINAPI glIsFenceNV( GLuint fence ) static GLboolean WINAPI glIsFramebuffer( GLuint framebuffer ) { - struct glIsFramebuffer_params args = { .teb = NtCurrentTeb(), .framebuffer = framebuffer }; + struct glIsFramebuffer_params args = { .teb = NtCurrentTeb() }; NTSTATUS status; TRACE( "framebuffer %d\n", framebuffer ); + args.framebuffer = *map_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &framebuffer ); if ((status = UNIX_CALL( glIsFramebuffer, &args ))) WARN( "glIsFramebuffer returned %#lx\n", status ); return args.ret; } static GLboolean WINAPI glIsFramebufferEXT( GLuint framebuffer ) { - struct glIsFramebufferEXT_params args = { .teb = NtCurrentTeb(), .framebuffer = framebuffer }; + struct glIsFramebufferEXT_params args = { .teb = NtCurrentTeb() }; NTSTATUS status; TRACE( "framebuffer %d\n", framebuffer ); + args.framebuffer = *map_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &framebuffer ); if ((status = UNIX_CALL( glIsFramebufferEXT, &args ))) WARN( "glIsFramebufferEXT returned %#lx\n", status ); return args.ret; } @@ -12318,10 +12369,14 @@ static void WINAPI glLinkProgramARB( GLhandleARB programObj ) static void WINAPI glListDrawCommandsStatesClientNV( GLuint list, GLuint segment, const void **indirects, const GLsizei *sizes, const GLuint *states, const GLuint *fbos, GLuint count ) { - struct glListDrawCommandsStatesClientNV_params args = { .teb = NtCurrentTeb(), .list = list, .segment = segment, .indirects = indirects, .sizes = sizes, .states = states, .fbos = fbos, .count = count }; + GLuint fbos_buf[64], *fbos_tmp; + struct glListDrawCommandsStatesClientNV_params args = { .teb = NtCurrentTeb(), .list = list, .segment = segment, .indirects = indirects, .sizes = sizes, .states = states, .count = count }; NTSTATUS status; TRACE( "list %d, segment %d, indirects %p, sizes %p, states %p, fbos %p, count %d\n", list, segment, indirects, sizes, states, fbos, count ); + fbos_tmp = count > 0 ? memdup_objects( count, fbos, fbos_buf, ARRAY_SIZE(fbos_buf) ) : NULL; + args.fbos = count > 0 ? map_context_objects( OBJ_TYPE_FRAMEBUFFER, count, fbos_tmp ) : NULL; if ((status = UNIX_CALL( glListDrawCommandsStatesClientNV, &args ))) WARN( "glListDrawCommandsStatesClientNV returned %#lx\n", status ); + if (fbos_tmp != fbos_buf) free( fbos_tmp ); } static void WINAPI glListParameterfSGIX( GLuint list, GLenum pname, GLfloat param ) @@ -14613,9 +14668,10 @@ static void WINAPI glMulticastCopyImageSubDataNV( GLuint srcGpu, GLbitfield dstG static void WINAPI glMulticastFramebufferSampleLocationsfvNV( GLuint gpu, GLuint framebuffer, GLuint start, GLsizei count, const GLfloat *v ) { - struct glMulticastFramebufferSampleLocationsfvNV_params args = { .teb = NtCurrentTeb(), .gpu = gpu, .framebuffer = framebuffer, .start = start, .count = count, .v = v }; + struct glMulticastFramebufferSampleLocationsfvNV_params args = { .teb = NtCurrentTeb(), .gpu = gpu, .start = start, .count = count, .v = v }; NTSTATUS status; TRACE( "gpu %d, framebuffer %d, start %d, count %d, v %p\n", gpu, framebuffer, start, count, v ); + args.framebuffer = *map_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &framebuffer ); if ((status = UNIX_CALL( glMulticastFramebufferSampleLocationsfvNV, &args ))) WARN( "glMulticastFramebufferSampleLocationsfvNV returned %#lx\n", status ); } @@ -14808,153 +14864,180 @@ static void WINAPI glNamedCopyBufferSubDataEXT( GLuint readBuffer, GLuint writeB static void WINAPI glNamedFramebufferDrawBuffer( GLuint framebuffer, GLenum buf ) { - struct glNamedFramebufferDrawBuffer_params args = { .teb = NtCurrentTeb(), .framebuffer = framebuffer, .buf = buf }; + struct glNamedFramebufferDrawBuffer_params args = { .teb = NtCurrentTeb(), .buf = buf }; NTSTATUS status; TRACE( "framebuffer %d, buf %d\n", framebuffer, buf ); + args.framebuffer = *map_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &framebuffer ); if ((status = UNIX_CALL( glNamedFramebufferDrawBuffer, &args ))) WARN( "glNamedFramebufferDrawBuffer returned %#lx\n", status ); } static void WINAPI glNamedFramebufferDrawBuffers( GLuint framebuffer, GLsizei n, const GLenum *bufs ) { - struct glNamedFramebufferDrawBuffers_params args = { .teb = NtCurrentTeb(), .framebuffer = framebuffer, .n = n, .bufs = bufs }; + struct glNamedFramebufferDrawBuffers_params args = { .teb = NtCurrentTeb(), .n = n, .bufs = bufs }; NTSTATUS status; TRACE( "framebuffer %d, n %d, bufs %p\n", framebuffer, n, bufs ); + args.framebuffer = *map_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &framebuffer ); if ((status = UNIX_CALL( glNamedFramebufferDrawBuffers, &args ))) WARN( "glNamedFramebufferDrawBuffers returned %#lx\n", status ); } static void WINAPI glNamedFramebufferParameteri( GLuint framebuffer, GLenum pname, GLint param ) { - struct glNamedFramebufferParameteri_params args = { .teb = NtCurrentTeb(), .framebuffer = framebuffer, .pname = pname, .param = param }; + struct glNamedFramebufferParameteri_params args = { .teb = NtCurrentTeb(), .pname = pname, .param = param }; NTSTATUS status; TRACE( "framebuffer %d, pname %d, param %d\n", framebuffer, pname, param ); + args.framebuffer = *map_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &framebuffer ); if ((status = UNIX_CALL( glNamedFramebufferParameteri, &args ))) WARN( "glNamedFramebufferParameteri returned %#lx\n", status ); } static void WINAPI glNamedFramebufferParameteriEXT( GLuint framebuffer, GLenum pname, GLint param ) { - struct glNamedFramebufferParameteriEXT_params args = { .teb = NtCurrentTeb(), .framebuffer = framebuffer, .pname = pname, .param = param }; + struct glNamedFramebufferParameteriEXT_params args = { .teb = NtCurrentTeb(), .pname = pname, .param = param }; NTSTATUS status; TRACE( "framebuffer %d, pname %d, param %d\n", framebuffer, pname, param ); + if (!alloc_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &framebuffer, TRUE )) return; + args.framebuffer = *map_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &framebuffer ); if ((status = UNIX_CALL( glNamedFramebufferParameteriEXT, &args ))) WARN( "glNamedFramebufferParameteriEXT returned %#lx\n", status ); } static void WINAPI glNamedFramebufferReadBuffer( GLuint framebuffer, GLenum src ) { - struct glNamedFramebufferReadBuffer_params args = { .teb = NtCurrentTeb(), .framebuffer = framebuffer, .src = src }; + struct glNamedFramebufferReadBuffer_params args = { .teb = NtCurrentTeb(), .src = src }; NTSTATUS status; TRACE( "framebuffer %d, src %d\n", framebuffer, src ); + args.framebuffer = *map_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &framebuffer ); if ((status = UNIX_CALL( glNamedFramebufferReadBuffer, &args ))) WARN( "glNamedFramebufferReadBuffer returned %#lx\n", status ); } static void WINAPI glNamedFramebufferRenderbuffer( GLuint framebuffer, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer ) { - struct glNamedFramebufferRenderbuffer_params args = { .teb = NtCurrentTeb(), .framebuffer = framebuffer, .attachment = attachment, .renderbuffertarget = renderbuffertarget, .renderbuffer = renderbuffer }; + struct glNamedFramebufferRenderbuffer_params args = { .teb = NtCurrentTeb(), .attachment = attachment, .renderbuffertarget = renderbuffertarget, .renderbuffer = renderbuffer }; NTSTATUS status; TRACE( "framebuffer %d, attachment %d, renderbuffertarget %d, renderbuffer %d\n", framebuffer, attachment, renderbuffertarget, renderbuffer ); + args.framebuffer = *map_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &framebuffer ); if ((status = UNIX_CALL( glNamedFramebufferRenderbuffer, &args ))) WARN( "glNamedFramebufferRenderbuffer returned %#lx\n", status ); } static void WINAPI glNamedFramebufferRenderbufferEXT( GLuint framebuffer, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer ) { - struct glNamedFramebufferRenderbufferEXT_params args = { .teb = NtCurrentTeb(), .framebuffer = framebuffer, .attachment = attachment, .renderbuffertarget = renderbuffertarget, .renderbuffer = renderbuffer }; + struct glNamedFramebufferRenderbufferEXT_params args = { .teb = NtCurrentTeb(), .attachment = attachment, .renderbuffertarget = renderbuffertarget, .renderbuffer = renderbuffer }; NTSTATUS status; TRACE( "framebuffer %d, attachment %d, renderbuffertarget %d, renderbuffer %d\n", framebuffer, attachment, renderbuffertarget, renderbuffer ); + if (!alloc_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &framebuffer, TRUE )) return; + args.framebuffer = *map_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &framebuffer ); if ((status = UNIX_CALL( glNamedFramebufferRenderbufferEXT, &args ))) WARN( "glNamedFramebufferRenderbufferEXT returned %#lx\n", status ); } static void WINAPI glNamedFramebufferSampleLocationsfvARB( GLuint framebuffer, GLuint start, GLsizei count, const GLfloat *v ) { - struct glNamedFramebufferSampleLocationsfvARB_params args = { .teb = NtCurrentTeb(), .framebuffer = framebuffer, .start = start, .count = count, .v = v }; + struct glNamedFramebufferSampleLocationsfvARB_params args = { .teb = NtCurrentTeb(), .start = start, .count = count, .v = v }; NTSTATUS status; TRACE( "framebuffer %d, start %d, count %d, v %p\n", framebuffer, start, count, v ); + args.framebuffer = *map_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &framebuffer ); if ((status = UNIX_CALL( glNamedFramebufferSampleLocationsfvARB, &args ))) WARN( "glNamedFramebufferSampleLocationsfvARB returned %#lx\n", status ); } static void WINAPI glNamedFramebufferSampleLocationsfvNV( GLuint framebuffer, GLuint start, GLsizei count, const GLfloat *v ) { - struct glNamedFramebufferSampleLocationsfvNV_params args = { .teb = NtCurrentTeb(), .framebuffer = framebuffer, .start = start, .count = count, .v = v }; + struct glNamedFramebufferSampleLocationsfvNV_params args = { .teb = NtCurrentTeb(), .start = start, .count = count, .v = v }; NTSTATUS status; TRACE( "framebuffer %d, start %d, count %d, v %p\n", framebuffer, start, count, v ); + args.framebuffer = *map_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &framebuffer ); if ((status = UNIX_CALL( glNamedFramebufferSampleLocationsfvNV, &args ))) WARN( "glNamedFramebufferSampleLocationsfvNV returned %#lx\n", status ); } static void WINAPI glNamedFramebufferSamplePositionsfvAMD( GLuint framebuffer, GLuint numsamples, GLuint pixelindex, const GLfloat *values ) { - struct glNamedFramebufferSamplePositionsfvAMD_params args = { .teb = NtCurrentTeb(), .framebuffer = framebuffer, .numsamples = numsamples, .pixelindex = pixelindex, .values = values }; + struct glNamedFramebufferSamplePositionsfvAMD_params args = { .teb = NtCurrentTeb(), .numsamples = numsamples, .pixelindex = pixelindex, .values = values }; NTSTATUS status; TRACE( "framebuffer %d, numsamples %d, pixelindex %d, values %p\n", framebuffer, numsamples, pixelindex, values ); + args.framebuffer = *map_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &framebuffer ); if ((status = UNIX_CALL( glNamedFramebufferSamplePositionsfvAMD, &args ))) WARN( "glNamedFramebufferSamplePositionsfvAMD returned %#lx\n", status ); } static void WINAPI glNamedFramebufferTexture( GLuint framebuffer, GLenum attachment, GLuint texture, GLint level ) { - struct glNamedFramebufferTexture_params args = { .teb = NtCurrentTeb(), .framebuffer = framebuffer, .attachment = attachment, .texture = texture, .level = level }; + struct glNamedFramebufferTexture_params args = { .teb = NtCurrentTeb(), .attachment = attachment, .texture = texture, .level = level }; NTSTATUS status; TRACE( "framebuffer %d, attachment %d, texture %d, level %d\n", framebuffer, attachment, texture, level ); + args.framebuffer = *map_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &framebuffer ); if ((status = UNIX_CALL( glNamedFramebufferTexture, &args ))) WARN( "glNamedFramebufferTexture returned %#lx\n", status ); } static void WINAPI glNamedFramebufferTexture1DEXT( GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level ) { - struct glNamedFramebufferTexture1DEXT_params args = { .teb = NtCurrentTeb(), .framebuffer = framebuffer, .attachment = attachment, .textarget = textarget, .texture = texture, .level = level }; + struct glNamedFramebufferTexture1DEXT_params args = { .teb = NtCurrentTeb(), .attachment = attachment, .textarget = textarget, .texture = texture, .level = level }; NTSTATUS status; TRACE( "framebuffer %d, attachment %d, textarget %d, texture %d, level %d\n", framebuffer, attachment, textarget, texture, level ); + if (!alloc_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &framebuffer, TRUE )) return; + args.framebuffer = *map_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &framebuffer ); if ((status = UNIX_CALL( glNamedFramebufferTexture1DEXT, &args ))) WARN( "glNamedFramebufferTexture1DEXT returned %#lx\n", status ); } static void WINAPI glNamedFramebufferTexture2DEXT( GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level ) { - struct glNamedFramebufferTexture2DEXT_params args = { .teb = NtCurrentTeb(), .framebuffer = framebuffer, .attachment = attachment, .textarget = textarget, .texture = texture, .level = level }; + struct glNamedFramebufferTexture2DEXT_params args = { .teb = NtCurrentTeb(), .attachment = attachment, .textarget = textarget, .texture = texture, .level = level }; NTSTATUS status; TRACE( "framebuffer %d, attachment %d, textarget %d, texture %d, level %d\n", framebuffer, attachment, textarget, texture, level ); + if (!alloc_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &framebuffer, TRUE )) return; + args.framebuffer = *map_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &framebuffer ); if ((status = UNIX_CALL( glNamedFramebufferTexture2DEXT, &args ))) WARN( "glNamedFramebufferTexture2DEXT returned %#lx\n", status ); } static void WINAPI glNamedFramebufferTexture3DEXT( GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset ) { - struct glNamedFramebufferTexture3DEXT_params args = { .teb = NtCurrentTeb(), .framebuffer = framebuffer, .attachment = attachment, .textarget = textarget, .texture = texture, .level = level, .zoffset = zoffset }; + struct glNamedFramebufferTexture3DEXT_params args = { .teb = NtCurrentTeb(), .attachment = attachment, .textarget = textarget, .texture = texture, .level = level, .zoffset = zoffset }; NTSTATUS status; TRACE( "framebuffer %d, attachment %d, textarget %d, texture %d, level %d, zoffset %d\n", framebuffer, attachment, textarget, texture, level, zoffset ); + if (!alloc_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &framebuffer, TRUE )) return; + args.framebuffer = *map_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &framebuffer ); if ((status = UNIX_CALL( glNamedFramebufferTexture3DEXT, &args ))) WARN( "glNamedFramebufferTexture3DEXT returned %#lx\n", status ); } static void WINAPI glNamedFramebufferTextureEXT( GLuint framebuffer, GLenum attachment, GLuint texture, GLint level ) { - struct glNamedFramebufferTextureEXT_params args = { .teb = NtCurrentTeb(), .framebuffer = framebuffer, .attachment = attachment, .texture = texture, .level = level }; + struct glNamedFramebufferTextureEXT_params args = { .teb = NtCurrentTeb(), .attachment = attachment, .texture = texture, .level = level }; NTSTATUS status; TRACE( "framebuffer %d, attachment %d, texture %d, level %d\n", framebuffer, attachment, texture, level ); + if (!alloc_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &framebuffer, TRUE )) return; + args.framebuffer = *map_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &framebuffer ); if ((status = UNIX_CALL( glNamedFramebufferTextureEXT, &args ))) WARN( "glNamedFramebufferTextureEXT returned %#lx\n", status ); } static void WINAPI glNamedFramebufferTextureFaceEXT( GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLenum face ) { - struct glNamedFramebufferTextureFaceEXT_params args = { .teb = NtCurrentTeb(), .framebuffer = framebuffer, .attachment = attachment, .texture = texture, .level = level, .face = face }; + struct glNamedFramebufferTextureFaceEXT_params args = { .teb = NtCurrentTeb(), .attachment = attachment, .texture = texture, .level = level, .face = face }; NTSTATUS status; TRACE( "framebuffer %d, attachment %d, texture %d, level %d, face %d\n", framebuffer, attachment, texture, level, face ); + if (!alloc_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &framebuffer, TRUE )) return; + args.framebuffer = *map_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &framebuffer ); if ((status = UNIX_CALL( glNamedFramebufferTextureFaceEXT, &args ))) WARN( "glNamedFramebufferTextureFaceEXT returned %#lx\n", status ); } static void WINAPI glNamedFramebufferTextureLayer( GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLint layer ) { - struct glNamedFramebufferTextureLayer_params args = { .teb = NtCurrentTeb(), .framebuffer = framebuffer, .attachment = attachment, .texture = texture, .level = level, .layer = layer }; + struct glNamedFramebufferTextureLayer_params args = { .teb = NtCurrentTeb(), .attachment = attachment, .texture = texture, .level = level, .layer = layer }; NTSTATUS status; TRACE( "framebuffer %d, attachment %d, texture %d, level %d, layer %d\n", framebuffer, attachment, texture, level, layer ); + args.framebuffer = *map_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &framebuffer ); if ((status = UNIX_CALL( glNamedFramebufferTextureLayer, &args ))) WARN( "glNamedFramebufferTextureLayer returned %#lx\n", status ); } static void WINAPI glNamedFramebufferTextureLayerEXT( GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLint layer ) { - struct glNamedFramebufferTextureLayerEXT_params args = { .teb = NtCurrentTeb(), .framebuffer = framebuffer, .attachment = attachment, .texture = texture, .level = level, .layer = layer }; + struct glNamedFramebufferTextureLayerEXT_params args = { .teb = NtCurrentTeb(), .attachment = attachment, .texture = texture, .level = level, .layer = layer }; NTSTATUS status; TRACE( "framebuffer %d, attachment %d, texture %d, level %d, layer %d\n", framebuffer, attachment, texture, level, layer ); + if (!alloc_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &framebuffer, TRUE )) return; + args.framebuffer = *map_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &framebuffer ); if ((status = UNIX_CALL( glNamedFramebufferTextureLayerEXT, &args ))) WARN( "glNamedFramebufferTextureLayerEXT returned %#lx\n", status ); } static void WINAPI glNamedFramebufferTextureMultiviewOVR( GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLint baseViewIndex, GLsizei numViews ) { - struct glNamedFramebufferTextureMultiviewOVR_params args = { .teb = NtCurrentTeb(), .framebuffer = framebuffer, .attachment = attachment, .texture = texture, .level = level, .baseViewIndex = baseViewIndex, .numViews = numViews }; + struct glNamedFramebufferTextureMultiviewOVR_params args = { .teb = NtCurrentTeb(), .attachment = attachment, .texture = texture, .level = level, .baseViewIndex = baseViewIndex, .numViews = numViews }; NTSTATUS status; TRACE( "framebuffer %d, attachment %d, texture %d, level %d, baseViewIndex %d, numViews %d\n", framebuffer, attachment, texture, level, baseViewIndex, numViews ); + args.framebuffer = *map_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &framebuffer ); if ((status = UNIX_CALL( glNamedFramebufferTextureMultiviewOVR, &args ))) WARN( "glNamedFramebufferTextureMultiviewOVR returned %#lx\n", status ); } diff --git a/dlls/opengl32/wgl.c b/dlls/opengl32/wgl.c index 97216492ac1..436fa9db7a8 100644 --- a/dlls/opengl32/wgl.c +++ b/dlls/opengl32/wgl.c @@ -106,6 +106,7 @@ static const char *debugstr_object_type( enum object_type type ) switch (type) { case OBJ_TYPE_BUFFER: return "buffer"; + case OBJ_TYPE_FRAMEBUFFER: return "framebuffer"; case OBJ_TYPE_COUNT: break; } return wine_dbg_sprintf( "object (type %u)", type ); @@ -386,6 +387,7 @@ static GLuint create_object( enum object_type type ) switch (type) { case OBJ_TYPE_BUFFER: { MAKE_OBJECT_CALL( glGenBuffers, .n = 1, .buffers = &object ); return object; } + case OBJ_TYPE_FRAMEBUFFER: { MAKE_OBJECT_CALL( glGenFramebuffers, .n = 1, .framebuffers = &object ); return object; } case OBJ_TYPE_COUNT: break; } @@ -647,6 +649,9 @@ static GLuint get_pname_object_type( GLenum pname ) case GL_WEIGHT_ARRAY_BUFFER_BINDING: case GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES: return OBJ_TYPE_BUFFER; + case GL_READ_FRAMEBUFFER_BINDING: + case GL_DRAW_FRAMEBUFFER_BINDING: + return OBJ_TYPE_FRAMEBUFFER; } return OBJ_TYPE_COUNT; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/11125
From: Rémi Bernon <rbernon@codeweavers.com> --- dlls/opengl32/tests/opengl.c | 6 +++--- dlls/opengl32/wgl.c | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/dlls/opengl32/tests/opengl.c b/dlls/opengl32/tests/opengl.c index 9b51b3cabe2..ab40a2c17b7 100644 --- a/dlls/opengl32/tests/opengl.c +++ b/dlls/opengl32/tests/opengl.c @@ -1483,9 +1483,9 @@ static void test_object_creation( HDC winhdc ) } if (!is_implicit_allowed( i, TRUE )) { - todo_wine_if( i == OBJ_FRAMEBUFFER || i == OBJ_RENDERBUFFER ) + todo_wine_if( i == OBJ_RENDERBUFFER ) ok_ret( GL_INVALID_OPERATION, glGetError() ); - if (!winetest_platform_is_wine || (i != OBJ_FRAMEBUFFER && i != OBJ_RENDERBUFFER)) + if (!winetest_platform_is_wine || i != OBJ_RENDERBUFFER) ok_ret( TRUE, create_object( i, 0, &obj ) ); } ok_ret( GL_NO_ERROR, glGetError() ); @@ -1514,7 +1514,7 @@ static void test_object_creation( HDC winhdc ) else { /* Wine never allows implicit allocation in core contexts */ - todo_wine_if( i == OBJ_FENCE_APPLE || i == OBJ_FENCE_NV || i == OBJ_FRAMEBUFFER_EXT || i == OBJ_PATH_NV || + todo_wine_if( i == OBJ_FENCE_APPLE || i == OBJ_FENCE_NV || i == OBJ_PATH_NV || i == OBJ_PROGRAM_ARB || i == OBJ_PROGRAM_NV || i == OBJ_SHADER_EXT || i == OBJ_SHADER_ATI || i == OBJ_RENDERBUFFER_EXT || i == OBJ_SEMAPHORE_EXT || i == OBJ_TRANSFORM_FEEDBACK_NV || i == OBJ_VERTEX_ARRAY_APPLE ) diff --git a/dlls/opengl32/wgl.c b/dlls/opengl32/wgl.c index 436fa9db7a8..1afa0eadcbb 100644 --- a/dlls/opengl32/wgl.c +++ b/dlls/opengl32/wgl.c @@ -570,6 +570,7 @@ BOOL alloc_context_objects( enum object_type type, UINT n, const GLuint *handles /* only allow explicit allocation in some cases, use host allocated ids directly in that case */ if (ctx->base.profile_mask & WGL_CONTEXT_CORE_PROFILE_BIT_ARB) alloc_client = FALSE; + if (type == OBJ_TYPE_FRAMEBUFFER) alloc_client = extension; AcquireSRWLockShared( &table->lock ); for (UINT i = 0; i < n && !needs_client; i++) -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/11125
From: Rémi Bernon <rbernon@codeweavers.com> --- dlls/opengl32/make_opengl | 10 ++- dlls/opengl32/private.h | 1 + dlls/opengl32/tests/opengl.c | 6 +- dlls/opengl32/thunks.c | 144 ++++++++++++++++++----------------- dlls/opengl32/thunks.h | 4 + dlls/opengl32/wgl.c | 72 ++++++++++++++++++ 6 files changed, 164 insertions(+), 73 deletions(-) diff --git a/dlls/opengl32/make_opengl b/dlls/opengl32/make_opengl index bab1d739e76..0b66c1cf6e5 100755 --- a/dlls/opengl32/make_opengl +++ b/dlls/opengl32/make_opengl @@ -161,6 +161,10 @@ my %manual_win_thunks = "glGetString" => 1, "glGetStringi" => 1, "glImportSyncEXT" => 1, + "glGetFramebufferAttachmentParameteriv" => 1, + "glGetFramebufferAttachmentParameterivEXT" => 1, + "glGetNamedFramebufferAttachmentParameteriv" => 1, + "glGetNamedFramebufferAttachmentParameterivEXT" => 1, "wglChoosePixelFormatARB" => 1, "wglCreateContextAttribsARB" => 1, "wglCreatePbufferARB" => 1, @@ -682,12 +686,15 @@ sub get_object_type($$$$) { my ($func, $ptype, $pname, $class) = @_; + return "srcTarget == GL_RENDERBUFFER ? OBJ_TYPE_RENDERBUFFER : OBJ_TYPE_COUNT" if $pname eq "srcName"; + return "dstTarget == GL_RENDERBUFFER ? OBJ_TYPE_RENDERBUFFER : OBJ_TYPE_COUNT" if $pname eq "dstName"; + return "OBJ_TYPE_BUFFER" if $class eq "buffer"; return "OBJ_TYPE_BUFFER" if $func eq "glDeleteObjectBufferATI" and $pname eq "buffer"; return "OBJ_TYPE_BUFFER" if $func eq "glDrawCommandsNV" and $pname eq "buffer"; return "OBJ_TYPE_FRAMEBUFFER" if $class eq "framebuffer"; return "OBJ_TYPE_FRAMEBUFFER" if $pname =~ "fbo"; - return 0 if $class eq "renderbuffer"; + return "OBJ_TYPE_RENDERBUFFER" if $class eq "renderbuffer"; return 0 if $class eq "SelectName"; return 0 if $func eq "glGetActiveAtomicCounterBufferiv" and $pname eq "bufferIndex"; @@ -708,6 +715,7 @@ sub allocate_object_names($) return "TRUE" if has_extension( $name, "GL_EXT_direct_state_access" ); return $ret if $name =~ /^glBindBuffer/; return $ret if $name =~ /^glBindFramebuffer/; + return $ret if $name =~ /^glBindRenderbuffer/; return 0; } diff --git a/dlls/opengl32/private.h b/dlls/opengl32/private.h index f9f9f613d81..af9b0726756 100644 --- a/dlls/opengl32/private.h +++ b/dlls/opengl32/private.h @@ -50,6 +50,7 @@ enum object_type { OBJ_TYPE_BUFFER, OBJ_TYPE_FRAMEBUFFER, + OBJ_TYPE_RENDERBUFFER, OBJ_TYPE_COUNT, }; diff --git a/dlls/opengl32/tests/opengl.c b/dlls/opengl32/tests/opengl.c index ab40a2c17b7..a89aac5a544 100644 --- a/dlls/opengl32/tests/opengl.c +++ b/dlls/opengl32/tests/opengl.c @@ -2021,7 +2021,7 @@ static void test_sharelists(HDC winhdc) ok_ret( GL_NO_ERROR, glGetError() ); /* cannot overwrite non-empty lists with some other */ - todo_wine_if( i >= 4 ) ok_ret( FALSE, wglShareLists( ctx1, ctx3 ) ); + todo_wine_if( i >= 6 ) ok_ret( FALSE, wglShareLists( ctx1, ctx3 ) ); ok_ret( GL_NO_ERROR, glGetError() ); ok_ret( FALSE, wglShareLists( ctx2, ctx1 ) ); ok_ret( GL_NO_ERROR, glGetError() ); @@ -2069,7 +2069,7 @@ static void test_sharelists(HDC winhdc) ok_ret( GL_NO_ERROR, glGetError() ); ok_ret( TRUE, wglMakeCurrent( winhdc, ctx2 ) ); ok_ret( GL_NO_ERROR, glGetError() ); - todo_wine_if( i >= 4 ) ok_ret( FALSE, test->exists( obj1 ) ); + todo_wine_if( i >= 6 ) ok_ret( FALSE, test->exists( obj1 ) ); ok_ret( GL_NO_ERROR, glGetError() ); ok_ret( FALSE, test->exists( obj2 ) ); ok_ret( GL_NO_ERROR, glGetError() ); @@ -2080,7 +2080,7 @@ static void test_sharelists(HDC winhdc) ok_ret( TRUE, wglDeleteContext( ctx3 ) ); /* objects are still valid after shared context destruction */ - todo_wine_if( i >= 4 ) ok_ret( FALSE, test->exists( obj1 ) ); + todo_wine_if( i >= 6 ) ok_ret( FALSE, test->exists( obj1 ) ); ok_ret( GL_NO_ERROR, glGetError() ); ok_ret( FALSE, test->exists( obj2 ) ); ok_ret( GL_NO_ERROR, glGetError() ); diff --git a/dlls/opengl32/thunks.c b/dlls/opengl32/thunks.c index 4aa89af190f..80eeafe0998 100644 --- a/dlls/opengl32/thunks.c +++ b/dlls/opengl32/thunks.c @@ -2914,9 +2914,11 @@ static GLuint WINAPI glAsyncCopyBufferSubDataNVX( GLsizei waitSemaphoreCount, co static GLuint WINAPI glAsyncCopyImageSubDataNVX( GLsizei waitSemaphoreCount, const GLuint *waitSemaphoreArray, const GLuint64 *waitValueArray, GLuint srcGpu, GLbitfield dstGpuMask, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth, GLsizei signalSemaphoreCount, const GLuint *signalSemaphoreArray, const GLuint64 *signalValueArray ) { - struct glAsyncCopyImageSubDataNVX_params args = { .teb = NtCurrentTeb(), .waitSemaphoreCount = waitSemaphoreCount, .waitSemaphoreArray = waitSemaphoreArray, .waitValueArray = waitValueArray, .srcGpu = srcGpu, .dstGpuMask = dstGpuMask, .srcName = srcName, .srcTarget = srcTarget, .srcLevel = srcLevel, .srcX = srcX, .srcY = srcY, .srcZ = srcZ, .dstName = dstName, .dstTarget = dstTarget, .dstLevel = dstLevel, .dstX = dstX, .dstY = dstY, .dstZ = dstZ, .srcWidth = srcWidth, .srcHeight = srcHeight, .srcDepth = srcDepth, .signalSemaphoreCount = signalSemaphoreCount, .signalSemaphoreArray = signalSemaphoreArray, .signalValueArray = signalValueArray }; + struct glAsyncCopyImageSubDataNVX_params args = { .teb = NtCurrentTeb(), .waitSemaphoreCount = waitSemaphoreCount, .waitSemaphoreArray = waitSemaphoreArray, .waitValueArray = waitValueArray, .srcGpu = srcGpu, .dstGpuMask = dstGpuMask, .srcTarget = srcTarget, .srcLevel = srcLevel, .srcX = srcX, .srcY = srcY, .srcZ = srcZ, .dstTarget = dstTarget, .dstLevel = dstLevel, .dstX = dstX, .dstY = dstY, .dstZ = dstZ, .srcWidth = srcWidth, .srcHeight = srcHeight, .srcDepth = srcDepth, .signalSemaphoreCount = signalSemaphoreCount, .signalSemaphoreArray = signalSemaphoreArray, .signalValueArray = signalValueArray }; NTSTATUS status; TRACE( "waitSemaphoreCount %d, waitSemaphoreArray %p, waitValueArray %p, srcGpu %d, dstGpuMask %d, srcName %d, srcTarget %d, srcLevel %d, srcX %d, srcY %d, srcZ %d, dstName %d, dstTarget %d, dstLevel %d, dstX %d, dstY %d, dstZ %d, srcWidth %d, srcHeight %d, srcDepth %d, signalSemaphoreCount %d, signalSemaphoreArray %p, signalValueArray %p\n", waitSemaphoreCount, waitSemaphoreArray, waitValueArray, srcGpu, dstGpuMask, srcName, srcTarget, srcLevel, srcX, srcY, srcZ, dstName, dstTarget, dstLevel, dstX, dstY, dstZ, srcWidth, srcHeight, srcDepth, signalSemaphoreCount, signalSemaphoreArray, signalValueArray ); + args.srcName = *map_context_objects( srcTarget == GL_RENDERBUFFER ? OBJ_TYPE_RENDERBUFFER : OBJ_TYPE_COUNT, 1, &srcName ); + args.dstName = *map_context_objects( dstTarget == GL_RENDERBUFFER ? OBJ_TYPE_RENDERBUFFER : OBJ_TYPE_COUNT, 1, &dstName ); if ((status = UNIX_CALL( glAsyncCopyImageSubDataNVX, &args ))) WARN( "glAsyncCopyImageSubDataNVX returned %#lx\n", status ); return args.ret; } @@ -3344,17 +3346,21 @@ static void WINAPI glBindProgramPipeline( GLuint pipeline ) static void WINAPI glBindRenderbuffer( GLenum target, GLuint renderbuffer ) { - struct glBindRenderbuffer_params args = { .teb = NtCurrentTeb(), .target = target, .renderbuffer = renderbuffer }; + struct glBindRenderbuffer_params args = { .teb = NtCurrentTeb(), .target = target }; NTSTATUS status; TRACE( "target %d, renderbuffer %d\n", target, renderbuffer ); + if (!alloc_context_objects( OBJ_TYPE_RENDERBUFFER, 1, &renderbuffer, FALSE )) return; + args.renderbuffer = *map_context_objects( OBJ_TYPE_RENDERBUFFER, 1, &renderbuffer ); if ((status = UNIX_CALL( glBindRenderbuffer, &args ))) WARN( "glBindRenderbuffer returned %#lx\n", status ); } static void WINAPI glBindRenderbufferEXT( GLenum target, GLuint renderbuffer ) { - struct glBindRenderbufferEXT_params args = { .teb = NtCurrentTeb(), .target = target, .renderbuffer = renderbuffer }; + struct glBindRenderbufferEXT_params args = { .teb = NtCurrentTeb(), .target = target }; NTSTATUS status; TRACE( "target %d, renderbuffer %d\n", target, renderbuffer ); + if (!alloc_context_objects( OBJ_TYPE_RENDERBUFFER, 1, &renderbuffer, TRUE )) return; + args.renderbuffer = *map_context_objects( OBJ_TYPE_RENDERBUFFER, 1, &renderbuffer ); if ((status = UNIX_CALL( glBindRenderbufferEXT, &args ))) WARN( "glBindRenderbufferEXT returned %#lx\n", status ); } @@ -5149,17 +5155,21 @@ static void WINAPI glCopyConvolutionFilter2DEXT( GLenum target, GLenum internalf static void WINAPI glCopyImageSubData( GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth ) { - struct glCopyImageSubData_params args = { .teb = NtCurrentTeb(), .srcName = srcName, .srcTarget = srcTarget, .srcLevel = srcLevel, .srcX = srcX, .srcY = srcY, .srcZ = srcZ, .dstName = dstName, .dstTarget = dstTarget, .dstLevel = dstLevel, .dstX = dstX, .dstY = dstY, .dstZ = dstZ, .srcWidth = srcWidth, .srcHeight = srcHeight, .srcDepth = srcDepth }; + struct glCopyImageSubData_params args = { .teb = NtCurrentTeb(), .srcTarget = srcTarget, .srcLevel = srcLevel, .srcX = srcX, .srcY = srcY, .srcZ = srcZ, .dstTarget = dstTarget, .dstLevel = dstLevel, .dstX = dstX, .dstY = dstY, .dstZ = dstZ, .srcWidth = srcWidth, .srcHeight = srcHeight, .srcDepth = srcDepth }; NTSTATUS status; TRACE( "srcName %d, srcTarget %d, srcLevel %d, srcX %d, srcY %d, srcZ %d, dstName %d, dstTarget %d, dstLevel %d, dstX %d, dstY %d, dstZ %d, srcWidth %d, srcHeight %d, srcDepth %d\n", srcName, srcTarget, srcLevel, srcX, srcY, srcZ, dstName, dstTarget, dstLevel, dstX, dstY, dstZ, srcWidth, srcHeight, srcDepth ); + args.srcName = *map_context_objects( srcTarget == GL_RENDERBUFFER ? OBJ_TYPE_RENDERBUFFER : OBJ_TYPE_COUNT, 1, &srcName ); + args.dstName = *map_context_objects( dstTarget == GL_RENDERBUFFER ? OBJ_TYPE_RENDERBUFFER : OBJ_TYPE_COUNT, 1, &dstName ); if ((status = UNIX_CALL( glCopyImageSubData, &args ))) WARN( "glCopyImageSubData returned %#lx\n", status ); } static void WINAPI glCopyImageSubDataNV( GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth ) { - struct glCopyImageSubDataNV_params args = { .teb = NtCurrentTeb(), .srcName = srcName, .srcTarget = srcTarget, .srcLevel = srcLevel, .srcX = srcX, .srcY = srcY, .srcZ = srcZ, .dstName = dstName, .dstTarget = dstTarget, .dstLevel = dstLevel, .dstX = dstX, .dstY = dstY, .dstZ = dstZ, .width = width, .height = height, .depth = depth }; + struct glCopyImageSubDataNV_params args = { .teb = NtCurrentTeb(), .srcTarget = srcTarget, .srcLevel = srcLevel, .srcX = srcX, .srcY = srcY, .srcZ = srcZ, .dstTarget = dstTarget, .dstLevel = dstLevel, .dstX = dstX, .dstY = dstY, .dstZ = dstZ, .width = width, .height = height, .depth = depth }; NTSTATUS status; TRACE( "srcName %d, srcTarget %d, srcLevel %d, srcX %d, srcY %d, srcZ %d, dstName %d, dstTarget %d, dstLevel %d, dstX %d, dstY %d, dstZ %d, width %d, height %d, depth %d\n", srcName, srcTarget, srcLevel, srcX, srcY, srcZ, dstName, dstTarget, dstLevel, dstX, dstY, dstZ, width, height, depth ); + args.srcName = *map_context_objects( srcTarget == GL_RENDERBUFFER ? OBJ_TYPE_RENDERBUFFER : OBJ_TYPE_COUNT, 1, &srcName ); + args.dstName = *map_context_objects( dstTarget == GL_RENDERBUFFER ? OBJ_TYPE_RENDERBUFFER : OBJ_TYPE_COUNT, 1, &dstName ); if ((status = UNIX_CALL( glCopyImageSubDataNV, &args ))) WARN( "glCopyImageSubDataNV returned %#lx\n", status ); } @@ -5472,6 +5482,7 @@ static void WINAPI glCreateRenderbuffers( GLsizei n, GLuint *renderbuffers ) NTSTATUS status; TRACE( "n %d, renderbuffers %p\n", n, renderbuffers ); if ((status = UNIX_CALL( glCreateRenderbuffers, &args ))) WARN( "glCreateRenderbuffers returned %#lx\n", status ); + if (n > 0) put_context_objects( OBJ_TYPE_RENDERBUFFER, n, renderbuffers ); } static void WINAPI glCreateSamplers( GLsizei n, GLuint *samplers ) @@ -5905,18 +5916,26 @@ static void WINAPI glDeleteQueryResourceTagNV( GLsizei n, const GLint *tagIds ) static void WINAPI glDeleteRenderbuffers( GLsizei n, const GLuint *renderbuffers ) { - struct glDeleteRenderbuffers_params args = { .teb = NtCurrentTeb(), .n = n, .renderbuffers = renderbuffers }; + GLuint renderbuffers_buf[64], *renderbuffers_tmp; + struct glDeleteRenderbuffers_params args = { .teb = NtCurrentTeb(), .n = n }; NTSTATUS status; TRACE( "n %d, renderbuffers %p\n", n, renderbuffers ); + renderbuffers_tmp = n > 0 ? memdup_objects( n, renderbuffers, renderbuffers_buf, ARRAY_SIZE(renderbuffers_buf) ) : NULL; + args.renderbuffers = n > 0 ? del_context_objects( OBJ_TYPE_RENDERBUFFER, n, renderbuffers_tmp ) : NULL; if ((status = UNIX_CALL( glDeleteRenderbuffers, &args ))) WARN( "glDeleteRenderbuffers returned %#lx\n", status ); + if (renderbuffers_tmp != renderbuffers_buf) free( renderbuffers_tmp ); } static void WINAPI glDeleteRenderbuffersEXT( GLsizei n, const GLuint *renderbuffers ) { - struct glDeleteRenderbuffersEXT_params args = { .teb = NtCurrentTeb(), .n = n, .renderbuffers = renderbuffers }; + GLuint renderbuffers_buf[64], *renderbuffers_tmp; + struct glDeleteRenderbuffersEXT_params args = { .teb = NtCurrentTeb(), .n = n }; NTSTATUS status; TRACE( "n %d, renderbuffers %p\n", n, renderbuffers ); + renderbuffers_tmp = n > 0 ? memdup_objects( n, renderbuffers, renderbuffers_buf, ARRAY_SIZE(renderbuffers_buf) ) : NULL; + args.renderbuffers = n > 0 ? del_context_objects( OBJ_TYPE_RENDERBUFFER, n, renderbuffers_tmp ) : NULL; if ((status = UNIX_CALL( glDeleteRenderbuffersEXT, &args ))) WARN( "glDeleteRenderbuffersEXT returned %#lx\n", status ); + if (renderbuffers_tmp != renderbuffers_buf) free( renderbuffers_tmp ); } static void WINAPI glDeleteSamplers( GLsizei count, const GLuint *samplers ) @@ -7357,17 +7376,19 @@ static void WINAPI glFramebufferReadBufferEXT( GLuint framebuffer, GLenum mode ) static void WINAPI glFramebufferRenderbuffer( GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer ) { - struct glFramebufferRenderbuffer_params args = { .teb = NtCurrentTeb(), .target = target, .attachment = attachment, .renderbuffertarget = renderbuffertarget, .renderbuffer = renderbuffer }; + struct glFramebufferRenderbuffer_params args = { .teb = NtCurrentTeb(), .target = target, .attachment = attachment, .renderbuffertarget = renderbuffertarget }; NTSTATUS status; TRACE( "target %d, attachment %d, renderbuffertarget %d, renderbuffer %d\n", target, attachment, renderbuffertarget, renderbuffer ); + args.renderbuffer = *map_context_objects( OBJ_TYPE_RENDERBUFFER, 1, &renderbuffer ); if ((status = UNIX_CALL( glFramebufferRenderbuffer, &args ))) WARN( "glFramebufferRenderbuffer returned %#lx\n", status ); } static void WINAPI glFramebufferRenderbufferEXT( GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer ) { - struct glFramebufferRenderbufferEXT_params args = { .teb = NtCurrentTeb(), .target = target, .attachment = attachment, .renderbuffertarget = renderbuffertarget, .renderbuffer = renderbuffer }; + struct glFramebufferRenderbufferEXT_params args = { .teb = NtCurrentTeb(), .target = target, .attachment = attachment, .renderbuffertarget = renderbuffertarget }; NTSTATUS status; TRACE( "target %d, attachment %d, renderbuffertarget %d, renderbuffer %d\n", target, attachment, renderbuffertarget, renderbuffer ); + args.renderbuffer = *map_context_objects( OBJ_TYPE_RENDERBUFFER, 1, &renderbuffer ); if ((status = UNIX_CALL( glFramebufferRenderbufferEXT, &args ))) WARN( "glFramebufferRenderbufferEXT returned %#lx\n", status ); } @@ -7721,6 +7742,7 @@ static void WINAPI glGenRenderbuffers( GLsizei n, GLuint *renderbuffers ) NTSTATUS status; TRACE( "n %d, renderbuffers %p\n", n, renderbuffers ); if ((status = UNIX_CALL( glGenRenderbuffers, &args ))) WARN( "glGenRenderbuffers returned %#lx\n", status ); + if (n > 0) put_context_objects( OBJ_TYPE_RENDERBUFFER, n, renderbuffers ); } static void WINAPI glGenRenderbuffersEXT( GLsizei n, GLuint *renderbuffers ) @@ -7729,6 +7751,7 @@ static void WINAPI glGenRenderbuffersEXT( GLsizei n, GLuint *renderbuffers ) NTSTATUS status; TRACE( "n %d, renderbuffers %p\n", n, renderbuffers ); if ((status = UNIX_CALL( glGenRenderbuffersEXT, &args ))) WARN( "glGenRenderbuffersEXT returned %#lx\n", status ); + if (n > 0) put_context_objects( OBJ_TYPE_RENDERBUFFER, n, renderbuffers ); } static void WINAPI glGenSamplers( GLsizei count, GLuint *samplers ) @@ -8570,26 +8593,6 @@ static void WINAPI glGetFragmentShadingRatesEXT( GLsizei samples, GLsizei maxCou if ((status = UNIX_CALL( glGetFragmentShadingRatesEXT, &args ))) WARN( "glGetFragmentShadingRatesEXT returned %#lx\n", status ); } -static void WINAPI glGetFramebufferAttachmentParameteriv( GLenum target, GLenum attachment, GLenum pname, GLint *params ) -{ - struct glGetFramebufferAttachmentParameteriv_params args = { .teb = NtCurrentTeb(), .target = target, .attachment = attachment, .pname = pname, .params = params }; - NTSTATUS status; - int integer; - TRACE( "target %d, attachment %d, pname %d, params %p\n", target, attachment, pname, params ); - if ((status = UNIX_CALL( glGetFramebufferAttachmentParameteriv, &args ))) WARN( "glGetFramebufferAttachmentParameteriv returned %#lx\n", status ); - else if (get_integer( pname, 0, *params, &integer )) *params = integer; -} - -static void WINAPI glGetFramebufferAttachmentParameterivEXT( GLenum target, GLenum attachment, GLenum pname, GLint *params ) -{ - struct glGetFramebufferAttachmentParameterivEXT_params args = { .teb = NtCurrentTeb(), .target = target, .attachment = attachment, .pname = pname, .params = params }; - NTSTATUS status; - int integer; - TRACE( "target %d, attachment %d, pname %d, params %p\n", target, attachment, pname, params ); - if ((status = UNIX_CALL( glGetFramebufferAttachmentParameterivEXT, &args ))) WARN( "glGetFramebufferAttachmentParameterivEXT returned %#lx\n", status ); - else if (get_integer( pname, 0, *params, &integer )) *params = integer; -} - static void WINAPI glGetFramebufferParameterfvAMD( GLenum target, GLenum pname, GLuint numsamples, GLuint pixelindex, GLsizei size, GLfloat *values ) { struct glGetFramebufferParameterfvAMD_params args = { .teb = NtCurrentTeb(), .target = target, .pname = pname, .numsamples = numsamples, .pixelindex = pixelindex, .size = size, .values = values }; @@ -9241,29 +9244,6 @@ static void WINAPI glGetNamedBufferSubDataEXT( GLuint buffer, GLintptr offset, G if ((status = UNIX_CALL( glGetNamedBufferSubDataEXT, &args ))) WARN( "glGetNamedBufferSubDataEXT returned %#lx\n", status ); } -static void WINAPI glGetNamedFramebufferAttachmentParameteriv( GLuint framebuffer, GLenum attachment, GLenum pname, GLint *params ) -{ - struct glGetNamedFramebufferAttachmentParameteriv_params args = { .teb = NtCurrentTeb(), .attachment = attachment, .pname = pname, .params = params }; - NTSTATUS status; - int integer; - TRACE( "framebuffer %d, attachment %d, pname %d, params %p\n", framebuffer, attachment, pname, params ); - args.framebuffer = *map_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &framebuffer ); - if ((status = UNIX_CALL( glGetNamedFramebufferAttachmentParameteriv, &args ))) WARN( "glGetNamedFramebufferAttachmentParameteriv returned %#lx\n", status ); - else if (get_integer( pname, 0, *params, &integer )) *params = integer; -} - -static void WINAPI glGetNamedFramebufferAttachmentParameterivEXT( GLuint framebuffer, GLenum attachment, GLenum pname, GLint *params ) -{ - struct glGetNamedFramebufferAttachmentParameterivEXT_params args = { .teb = NtCurrentTeb(), .attachment = attachment, .pname = pname, .params = params }; - NTSTATUS status; - int integer; - TRACE( "framebuffer %d, attachment %d, pname %d, params %p\n", framebuffer, attachment, pname, params ); - if (!alloc_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &framebuffer, TRUE )) return; - args.framebuffer = *map_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &framebuffer ); - if ((status = UNIX_CALL( glGetNamedFramebufferAttachmentParameterivEXT, &args ))) WARN( "glGetNamedFramebufferAttachmentParameterivEXT returned %#lx\n", status ); - else if (get_integer( pname, 0, *params, &integer )) *params = integer; -} - static void WINAPI glGetNamedFramebufferParameterfvAMD( GLuint framebuffer, GLenum pname, GLuint numsamples, GLuint pixelindex, GLsizei size, GLfloat *values ) { struct glGetNamedFramebufferParameterfvAMD_params args = { .teb = NtCurrentTeb(), .pname = pname, .numsamples = numsamples, .pixelindex = pixelindex, .size = size, .values = values }; @@ -9342,17 +9322,20 @@ static void WINAPI glGetNamedProgramivEXT( GLuint program, GLenum target, GLenum static void WINAPI glGetNamedRenderbufferParameteriv( GLuint renderbuffer, GLenum pname, GLint *params ) { - struct glGetNamedRenderbufferParameteriv_params args = { .teb = NtCurrentTeb(), .renderbuffer = renderbuffer, .pname = pname, .params = params }; + struct glGetNamedRenderbufferParameteriv_params args = { .teb = NtCurrentTeb(), .pname = pname, .params = params }; NTSTATUS status; TRACE( "renderbuffer %d, pname %d, params %p\n", renderbuffer, pname, params ); + args.renderbuffer = *map_context_objects( OBJ_TYPE_RENDERBUFFER, 1, &renderbuffer ); if ((status = UNIX_CALL( glGetNamedRenderbufferParameteriv, &args ))) WARN( "glGetNamedRenderbufferParameteriv returned %#lx\n", status ); } static void WINAPI glGetNamedRenderbufferParameterivEXT( GLuint renderbuffer, GLenum pname, GLint *params ) { - struct glGetNamedRenderbufferParameterivEXT_params args = { .teb = NtCurrentTeb(), .renderbuffer = renderbuffer, .pname = pname, .params = params }; + struct glGetNamedRenderbufferParameterivEXT_params args = { .teb = NtCurrentTeb(), .pname = pname, .params = params }; NTSTATUS status; TRACE( "renderbuffer %d, pname %d, params %p\n", renderbuffer, pname, params ); + if (!alloc_context_objects( OBJ_TYPE_RENDERBUFFER, 1, &renderbuffer, TRUE )) return; + args.renderbuffer = *map_context_objects( OBJ_TYPE_RENDERBUFFER, 1, &renderbuffer ); if ((status = UNIX_CALL( glGetNamedRenderbufferParameterivEXT, &args ))) WARN( "glGetNamedRenderbufferParameterivEXT returned %#lx\n", status ); } @@ -12087,18 +12070,20 @@ static GLboolean WINAPI glIsQueryARB( GLuint id ) static GLboolean WINAPI glIsRenderbuffer( GLuint renderbuffer ) { - struct glIsRenderbuffer_params args = { .teb = NtCurrentTeb(), .renderbuffer = renderbuffer }; + struct glIsRenderbuffer_params args = { .teb = NtCurrentTeb() }; NTSTATUS status; TRACE( "renderbuffer %d\n", renderbuffer ); + args.renderbuffer = *map_context_objects( OBJ_TYPE_RENDERBUFFER, 1, &renderbuffer ); if ((status = UNIX_CALL( glIsRenderbuffer, &args ))) WARN( "glIsRenderbuffer returned %#lx\n", status ); return args.ret; } static GLboolean WINAPI glIsRenderbufferEXT( GLuint renderbuffer ) { - struct glIsRenderbufferEXT_params args = { .teb = NtCurrentTeb(), .renderbuffer = renderbuffer }; + struct glIsRenderbufferEXT_params args = { .teb = NtCurrentTeb() }; NTSTATUS status; TRACE( "renderbuffer %d\n", renderbuffer ); + args.renderbuffer = *map_context_objects( OBJ_TYPE_RENDERBUFFER, 1, &renderbuffer ); if ((status = UNIX_CALL( glIsRenderbufferEXT, &args ))) WARN( "glIsRenderbufferEXT returned %#lx\n", status ); return args.ret; } @@ -12232,9 +12217,11 @@ static GLboolean WINAPI glIsVertexAttribEnabledAPPLE( GLuint index, GLenum pname static void WINAPI glLGPUCopyImageSubDataNVX( GLuint sourceGpu, GLbitfield destinationGpuMask, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srxY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth ) { - struct glLGPUCopyImageSubDataNVX_params args = { .teb = NtCurrentTeb(), .sourceGpu = sourceGpu, .destinationGpuMask = destinationGpuMask, .srcName = srcName, .srcTarget = srcTarget, .srcLevel = srcLevel, .srcX = srcX, .srxY = srxY, .srcZ = srcZ, .dstName = dstName, .dstTarget = dstTarget, .dstLevel = dstLevel, .dstX = dstX, .dstY = dstY, .dstZ = dstZ, .width = width, .height = height, .depth = depth }; + struct glLGPUCopyImageSubDataNVX_params args = { .teb = NtCurrentTeb(), .sourceGpu = sourceGpu, .destinationGpuMask = destinationGpuMask, .srcTarget = srcTarget, .srcLevel = srcLevel, .srcX = srcX, .srxY = srxY, .srcZ = srcZ, .dstTarget = dstTarget, .dstLevel = dstLevel, .dstX = dstX, .dstY = dstY, .dstZ = dstZ, .width = width, .height = height, .depth = depth }; NTSTATUS status; TRACE( "sourceGpu %d, destinationGpuMask %d, srcName %d, srcTarget %d, srcLevel %d, srcX %d, srxY %d, srcZ %d, dstName %d, dstTarget %d, dstLevel %d, dstX %d, dstY %d, dstZ %d, width %d, height %d, depth %d\n", sourceGpu, destinationGpuMask, srcName, srcTarget, srcLevel, srcX, srxY, srcZ, dstName, dstTarget, dstLevel, dstX, dstY, dstZ, width, height, depth ); + args.srcName = *map_context_objects( srcTarget == GL_RENDERBUFFER ? OBJ_TYPE_RENDERBUFFER : OBJ_TYPE_COUNT, 1, &srcName ); + args.dstName = *map_context_objects( dstTarget == GL_RENDERBUFFER ? OBJ_TYPE_RENDERBUFFER : OBJ_TYPE_COUNT, 1, &dstName ); if ((status = UNIX_CALL( glLGPUCopyImageSubDataNVX, &args ))) WARN( "glLGPUCopyImageSubDataNVX returned %#lx\n", status ); } @@ -14593,9 +14580,11 @@ static void WINAPI glMultiTexParameterivEXT( GLenum texunit, GLenum target, GLen static void WINAPI glMultiTexRenderbufferEXT( GLenum texunit, GLenum target, GLuint renderbuffer ) { - struct glMultiTexRenderbufferEXT_params args = { .teb = NtCurrentTeb(), .texunit = texunit, .target = target, .renderbuffer = renderbuffer }; + struct glMultiTexRenderbufferEXT_params args = { .teb = NtCurrentTeb(), .texunit = texunit, .target = target }; NTSTATUS status; TRACE( "texunit %d, target %d, renderbuffer %d\n", texunit, target, renderbuffer ); + if (!alloc_context_objects( OBJ_TYPE_RENDERBUFFER, 1, &renderbuffer, TRUE )) return; + args.renderbuffer = *map_context_objects( OBJ_TYPE_RENDERBUFFER, 1, &renderbuffer ); if ((status = UNIX_CALL( glMultiTexRenderbufferEXT, &args ))) WARN( "glMultiTexRenderbufferEXT returned %#lx\n", status ); } @@ -14660,9 +14649,11 @@ static void WINAPI glMulticastCopyBufferSubDataNV( GLuint readGpu, GLbitfield wr static void WINAPI glMulticastCopyImageSubDataNV( GLuint srcGpu, GLbitfield dstGpuMask, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth ) { - struct glMulticastCopyImageSubDataNV_params args = { .teb = NtCurrentTeb(), .srcGpu = srcGpu, .dstGpuMask = dstGpuMask, .srcName = srcName, .srcTarget = srcTarget, .srcLevel = srcLevel, .srcX = srcX, .srcY = srcY, .srcZ = srcZ, .dstName = dstName, .dstTarget = dstTarget, .dstLevel = dstLevel, .dstX = dstX, .dstY = dstY, .dstZ = dstZ, .srcWidth = srcWidth, .srcHeight = srcHeight, .srcDepth = srcDepth }; + struct glMulticastCopyImageSubDataNV_params args = { .teb = NtCurrentTeb(), .srcGpu = srcGpu, .dstGpuMask = dstGpuMask, .srcTarget = srcTarget, .srcLevel = srcLevel, .srcX = srcX, .srcY = srcY, .srcZ = srcZ, .dstTarget = dstTarget, .dstLevel = dstLevel, .dstX = dstX, .dstY = dstY, .dstZ = dstZ, .srcWidth = srcWidth, .srcHeight = srcHeight, .srcDepth = srcDepth }; NTSTATUS status; TRACE( "srcGpu %d, dstGpuMask %d, srcName %d, srcTarget %d, srcLevel %d, srcX %d, srcY %d, srcZ %d, dstName %d, dstTarget %d, dstLevel %d, dstX %d, dstY %d, dstZ %d, srcWidth %d, srcHeight %d, srcDepth %d\n", srcGpu, dstGpuMask, srcName, srcTarget, srcLevel, srcX, srcY, srcZ, dstName, dstTarget, dstLevel, dstX, dstY, dstZ, srcWidth, srcHeight, srcDepth ); + args.srcName = *map_context_objects( srcTarget == GL_RENDERBUFFER ? OBJ_TYPE_RENDERBUFFER : OBJ_TYPE_COUNT, 1, &srcName ); + args.dstName = *map_context_objects( dstTarget == GL_RENDERBUFFER ? OBJ_TYPE_RENDERBUFFER : OBJ_TYPE_COUNT, 1, &dstName ); if ((status = UNIX_CALL( glMulticastCopyImageSubDataNV, &args ))) WARN( "glMulticastCopyImageSubDataNV returned %#lx\n", status ); } @@ -14910,20 +14901,23 @@ static void WINAPI glNamedFramebufferReadBuffer( GLuint framebuffer, GLenum src static void WINAPI glNamedFramebufferRenderbuffer( GLuint framebuffer, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer ) { - struct glNamedFramebufferRenderbuffer_params args = { .teb = NtCurrentTeb(), .attachment = attachment, .renderbuffertarget = renderbuffertarget, .renderbuffer = renderbuffer }; + struct glNamedFramebufferRenderbuffer_params args = { .teb = NtCurrentTeb(), .attachment = attachment, .renderbuffertarget = renderbuffertarget }; NTSTATUS status; TRACE( "framebuffer %d, attachment %d, renderbuffertarget %d, renderbuffer %d\n", framebuffer, attachment, renderbuffertarget, renderbuffer ); args.framebuffer = *map_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &framebuffer ); + args.renderbuffer = *map_context_objects( OBJ_TYPE_RENDERBUFFER, 1, &renderbuffer ); if ((status = UNIX_CALL( glNamedFramebufferRenderbuffer, &args ))) WARN( "glNamedFramebufferRenderbuffer returned %#lx\n", status ); } static void WINAPI glNamedFramebufferRenderbufferEXT( GLuint framebuffer, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer ) { - struct glNamedFramebufferRenderbufferEXT_params args = { .teb = NtCurrentTeb(), .attachment = attachment, .renderbuffertarget = renderbuffertarget, .renderbuffer = renderbuffer }; + struct glNamedFramebufferRenderbufferEXT_params args = { .teb = NtCurrentTeb(), .attachment = attachment, .renderbuffertarget = renderbuffertarget }; NTSTATUS status; TRACE( "framebuffer %d, attachment %d, renderbuffertarget %d, renderbuffer %d\n", framebuffer, attachment, renderbuffertarget, renderbuffer ); if (!alloc_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &framebuffer, TRUE )) return; + if (!alloc_context_objects( OBJ_TYPE_RENDERBUFFER, 1, &renderbuffer, TRUE )) return; args.framebuffer = *map_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &framebuffer ); + args.renderbuffer = *map_context_objects( OBJ_TYPE_RENDERBUFFER, 1, &renderbuffer ); if ((status = UNIX_CALL( glNamedFramebufferRenderbufferEXT, &args ))) WARN( "glNamedFramebufferRenderbufferEXT returned %#lx\n", status ); } @@ -15139,49 +15133,58 @@ static void WINAPI glNamedProgramStringEXT( GLuint program, GLenum target, GLenu static void WINAPI glNamedRenderbufferStorage( GLuint renderbuffer, GLenum internalformat, GLsizei width, GLsizei height ) { - struct glNamedRenderbufferStorage_params args = { .teb = NtCurrentTeb(), .renderbuffer = renderbuffer, .internalformat = internalformat, .width = width, .height = height }; + struct glNamedRenderbufferStorage_params args = { .teb = NtCurrentTeb(), .internalformat = internalformat, .width = width, .height = height }; NTSTATUS status; TRACE( "renderbuffer %d, internalformat %d, width %d, height %d\n", renderbuffer, internalformat, width, height ); + args.renderbuffer = *map_context_objects( OBJ_TYPE_RENDERBUFFER, 1, &renderbuffer ); if ((status = UNIX_CALL( glNamedRenderbufferStorage, &args ))) WARN( "glNamedRenderbufferStorage returned %#lx\n", status ); } static void WINAPI glNamedRenderbufferStorageEXT( GLuint renderbuffer, GLenum internalformat, GLsizei width, GLsizei height ) { - struct glNamedRenderbufferStorageEXT_params args = { .teb = NtCurrentTeb(), .renderbuffer = renderbuffer, .internalformat = internalformat, .width = width, .height = height }; + struct glNamedRenderbufferStorageEXT_params args = { .teb = NtCurrentTeb(), .internalformat = internalformat, .width = width, .height = height }; NTSTATUS status; TRACE( "renderbuffer %d, internalformat %d, width %d, height %d\n", renderbuffer, internalformat, width, height ); + if (!alloc_context_objects( OBJ_TYPE_RENDERBUFFER, 1, &renderbuffer, TRUE )) return; + args.renderbuffer = *map_context_objects( OBJ_TYPE_RENDERBUFFER, 1, &renderbuffer ); if ((status = UNIX_CALL( glNamedRenderbufferStorageEXT, &args ))) WARN( "glNamedRenderbufferStorageEXT returned %#lx\n", status ); } static void WINAPI glNamedRenderbufferStorageMultisample( GLuint renderbuffer, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height ) { - struct glNamedRenderbufferStorageMultisample_params args = { .teb = NtCurrentTeb(), .renderbuffer = renderbuffer, .samples = samples, .internalformat = internalformat, .width = width, .height = height }; + struct glNamedRenderbufferStorageMultisample_params args = { .teb = NtCurrentTeb(), .samples = samples, .internalformat = internalformat, .width = width, .height = height }; NTSTATUS status; TRACE( "renderbuffer %d, samples %d, internalformat %d, width %d, height %d\n", renderbuffer, samples, internalformat, width, height ); + args.renderbuffer = *map_context_objects( OBJ_TYPE_RENDERBUFFER, 1, &renderbuffer ); if ((status = UNIX_CALL( glNamedRenderbufferStorageMultisample, &args ))) WARN( "glNamedRenderbufferStorageMultisample returned %#lx\n", status ); } static void WINAPI glNamedRenderbufferStorageMultisampleAdvancedAMD( GLuint renderbuffer, GLsizei samples, GLsizei storageSamples, GLenum internalformat, GLsizei width, GLsizei height ) { - struct glNamedRenderbufferStorageMultisampleAdvancedAMD_params args = { .teb = NtCurrentTeb(), .renderbuffer = renderbuffer, .samples = samples, .storageSamples = storageSamples, .internalformat = internalformat, .width = width, .height = height }; + struct glNamedRenderbufferStorageMultisampleAdvancedAMD_params args = { .teb = NtCurrentTeb(), .samples = samples, .storageSamples = storageSamples, .internalformat = internalformat, .width = width, .height = height }; NTSTATUS status; TRACE( "renderbuffer %d, samples %d, storageSamples %d, internalformat %d, width %d, height %d\n", renderbuffer, samples, storageSamples, internalformat, width, height ); + args.renderbuffer = *map_context_objects( OBJ_TYPE_RENDERBUFFER, 1, &renderbuffer ); if ((status = UNIX_CALL( glNamedRenderbufferStorageMultisampleAdvancedAMD, &args ))) WARN( "glNamedRenderbufferStorageMultisampleAdvancedAMD returned %#lx\n", status ); } static void WINAPI glNamedRenderbufferStorageMultisampleCoverageEXT( GLuint renderbuffer, GLsizei coverageSamples, GLsizei colorSamples, GLenum internalformat, GLsizei width, GLsizei height ) { - struct glNamedRenderbufferStorageMultisampleCoverageEXT_params args = { .teb = NtCurrentTeb(), .renderbuffer = renderbuffer, .coverageSamples = coverageSamples, .colorSamples = colorSamples, .internalformat = internalformat, .width = width, .height = height }; + struct glNamedRenderbufferStorageMultisampleCoverageEXT_params args = { .teb = NtCurrentTeb(), .coverageSamples = coverageSamples, .colorSamples = colorSamples, .internalformat = internalformat, .width = width, .height = height }; NTSTATUS status; TRACE( "renderbuffer %d, coverageSamples %d, colorSamples %d, internalformat %d, width %d, height %d\n", renderbuffer, coverageSamples, colorSamples, internalformat, width, height ); + if (!alloc_context_objects( OBJ_TYPE_RENDERBUFFER, 1, &renderbuffer, TRUE )) return; + args.renderbuffer = *map_context_objects( OBJ_TYPE_RENDERBUFFER, 1, &renderbuffer ); if ((status = UNIX_CALL( glNamedRenderbufferStorageMultisampleCoverageEXT, &args ))) WARN( "glNamedRenderbufferStorageMultisampleCoverageEXT returned %#lx\n", status ); } static void WINAPI glNamedRenderbufferStorageMultisampleEXT( GLuint renderbuffer, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height ) { - struct glNamedRenderbufferStorageMultisampleEXT_params args = { .teb = NtCurrentTeb(), .renderbuffer = renderbuffer, .samples = samples, .internalformat = internalformat, .width = width, .height = height }; + struct glNamedRenderbufferStorageMultisampleEXT_params args = { .teb = NtCurrentTeb(), .samples = samples, .internalformat = internalformat, .width = width, .height = height }; NTSTATUS status; TRACE( "renderbuffer %d, samples %d, internalformat %d, width %d, height %d\n", renderbuffer, samples, internalformat, width, height ); + if (!alloc_context_objects( OBJ_TYPE_RENDERBUFFER, 1, &renderbuffer, TRUE )) return; + args.renderbuffer = *map_context_objects( OBJ_TYPE_RENDERBUFFER, 1, &renderbuffer ); if ((status = UNIX_CALL( glNamedRenderbufferStorageMultisampleEXT, &args ))) WARN( "glNamedRenderbufferStorageMultisampleEXT returned %#lx\n", status ); } @@ -19875,9 +19878,10 @@ static void WINAPI glTexParameterxvOES( GLenum target, GLenum pname, const GLfix static void WINAPI glTexRenderbufferNV( GLenum target, GLuint renderbuffer ) { - struct glTexRenderbufferNV_params args = { .teb = NtCurrentTeb(), .target = target, .renderbuffer = renderbuffer }; + struct glTexRenderbufferNV_params args = { .teb = NtCurrentTeb(), .target = target }; NTSTATUS status; TRACE( "target %d, renderbuffer %d\n", target, renderbuffer ); + args.renderbuffer = *map_context_objects( OBJ_TYPE_RENDERBUFFER, 1, &renderbuffer ); if ((status = UNIX_CALL( glTexRenderbufferNV, &args ))) WARN( "glTexRenderbufferNV returned %#lx\n", status ); } @@ -20305,9 +20309,11 @@ static void WINAPI glTextureRangeAPPLE( GLenum target, GLsizei length, const voi static void WINAPI glTextureRenderbufferEXT( GLuint texture, GLenum target, GLuint renderbuffer ) { - struct glTextureRenderbufferEXT_params args = { .teb = NtCurrentTeb(), .texture = texture, .target = target, .renderbuffer = renderbuffer }; + struct glTextureRenderbufferEXT_params args = { .teb = NtCurrentTeb(), .texture = texture, .target = target }; NTSTATUS status; TRACE( "texture %d, target %d, renderbuffer %d\n", texture, target, renderbuffer ); + if (!alloc_context_objects( OBJ_TYPE_RENDERBUFFER, 1, &renderbuffer, TRUE )) return; + args.renderbuffer = *map_context_objects( OBJ_TYPE_RENDERBUFFER, 1, &renderbuffer ); if ((status = UNIX_CALL( glTextureRenderbufferEXT, &args ))) WARN( "glTextureRenderbufferEXT returned %#lx\n", status ); } diff --git a/dlls/opengl32/thunks.h b/dlls/opengl32/thunks.h index 67d5691ed8c..52a406e90ed 100644 --- a/dlls/opengl32/thunks.h +++ b/dlls/opengl32/thunks.h @@ -3,6 +3,10 @@ extern GLsync WINAPI glCreateSyncFromCLeventARB( struct _cl_context *context, struct _cl_event *event, GLbitfield flags ); extern void WINAPI glDeleteSync( GLsync sync ); extern GLsync WINAPI glFenceSync( GLenum condition, GLbitfield flags ); +extern void WINAPI glGetFramebufferAttachmentParameteriv( GLenum target, GLenum attachment, GLenum pname, GLint *params ); +extern void WINAPI glGetFramebufferAttachmentParameterivEXT( GLenum target, GLenum attachment, GLenum pname, GLint *params ); +extern void WINAPI glGetNamedFramebufferAttachmentParameteriv( GLuint framebuffer, GLenum attachment, GLenum pname, GLint *params ); +extern void WINAPI glGetNamedFramebufferAttachmentParameterivEXT( GLuint framebuffer, GLenum attachment, GLenum pname, GLint *params ); extern const GLubyte * WINAPI glGetStringi( GLenum name, GLuint index ); extern GLsync WINAPI glImportSyncEXT( GLenum external_sync_type, GLintptr external_sync, GLbitfield flags ); extern BOOL WINAPI wglChoosePixelFormatARB( HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats ); diff --git a/dlls/opengl32/wgl.c b/dlls/opengl32/wgl.c index 1afa0eadcbb..b4a1b454d7f 100644 --- a/dlls/opengl32/wgl.c +++ b/dlls/opengl32/wgl.c @@ -107,6 +107,7 @@ static const char *debugstr_object_type( enum object_type type ) { case OBJ_TYPE_BUFFER: return "buffer"; case OBJ_TYPE_FRAMEBUFFER: return "framebuffer"; + case OBJ_TYPE_RENDERBUFFER: return "renderbuffer"; case OBJ_TYPE_COUNT: break; } return wine_dbg_sprintf( "object (type %u)", type ); @@ -388,6 +389,7 @@ static GLuint create_object( enum object_type type ) { case OBJ_TYPE_BUFFER: { MAKE_OBJECT_CALL( glGenBuffers, .n = 1, .buffers = &object ); return object; } case OBJ_TYPE_FRAMEBUFFER: { MAKE_OBJECT_CALL( glGenFramebuffers, .n = 1, .framebuffers = &object ); return object; } + case OBJ_TYPE_RENDERBUFFER: { MAKE_OBJECT_CALL( glGenRenderbuffers, .n = 1, .renderbuffers = &object ); return object; } case OBJ_TYPE_COUNT: break; } @@ -653,6 +655,9 @@ static GLuint get_pname_object_type( GLenum pname ) case GL_READ_FRAMEBUFFER_BINDING: case GL_DRAW_FRAMEBUFFER_BINDING: return OBJ_TYPE_FRAMEBUFFER; + case GL_RENDERBUFFER_BINDING: + case GL_TEXTURE_RENDERBUFFER_DATA_STORE_BINDING_NV: + return OBJ_TYPE_RENDERBUFFER; } return OBJ_TYPE_COUNT; @@ -676,6 +681,73 @@ static BOOL map_client_objects( enum object_type type, GLuint host_id, GLuint *r return TRUE; } +static void map_framebuffer_attachment_param( GLenum target, GLenum attachment, GLenum pname, GLint *params ) +{ + GLint type, value; + + if (pname != GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME) return; + glGetFramebufferAttachmentParameteriv( target, attachment, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, &type ); + if (type == GL_RENDERBUFFER && map_client_objects( OBJ_TYPE_RENDERBUFFER, *params, (GLuint *)&value )) *params = value; +} + +void WINAPI glGetFramebufferAttachmentParameteriv( GLenum target, GLenum attachment, GLenum pname, GLint *params ) +{ + struct glGetFramebufferAttachmentParameteriv_params args = { .teb = NtCurrentTeb(), .target = target, .attachment = attachment, .pname = pname, .params = params }; + NTSTATUS status; + + TRACE( "target %d, attachment %d, pname %d, params %p\n", target, attachment, pname, params ); + + if ((status = UNIX_CALL( glGetFramebufferAttachmentParameteriv, &args ))) WARN( "glGetFramebufferAttachmentParameteriv returned %#lx\n", status ); + map_framebuffer_attachment_param( target, attachment, pname, params ); +} + +void WINAPI glGetFramebufferAttachmentParameterivEXT( GLenum target, GLenum attachment, GLenum pname, GLint *params ) +{ + struct glGetFramebufferAttachmentParameterivEXT_params args = { .teb = NtCurrentTeb(), .target = target, .attachment = attachment, .pname = pname, .params = params }; + NTSTATUS status; + + TRACE( "target %d, attachment %d, pname %d, params %p\n", target, attachment, pname, params ); + + if ((status = UNIX_CALL( glGetFramebufferAttachmentParameterivEXT, &args ))) WARN( "glGetFramebufferAttachmentParameterivEXT returned %#lx\n", status ); + map_framebuffer_attachment_param( target, attachment, pname, params ); +} + +static void map_named_framebuffer_attachment_param( GLuint framebuffer, GLenum attachment, GLenum pname, GLint *params ) +{ + GLint type, value; + + if (pname != GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME) return; + glGetNamedFramebufferAttachmentParameteriv( framebuffer, attachment, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, &type ); + if (type == GL_RENDERBUFFER && map_client_objects( OBJ_TYPE_RENDERBUFFER, *params, (GLuint *)&value )) *params = value; +} + +void WINAPI glGetNamedFramebufferAttachmentParameteriv( GLuint framebuffer, GLenum attachment, GLenum pname, GLint *params ) +{ + struct glGetNamedFramebufferAttachmentParameteriv_params args = { .teb = NtCurrentTeb(), .attachment = attachment, .pname = pname, .params = params }; + GLuint host_framebuffer = framebuffer; + NTSTATUS status; + + TRACE( "framebuffer %d, attachment %d, pname %d, params %p\n", framebuffer, attachment, pname, params ); + + args.framebuffer = *map_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &host_framebuffer ); + if ((status = UNIX_CALL( glGetNamedFramebufferAttachmentParameteriv, &args ))) WARN( "glGetNamedFramebufferAttachmentParameteriv returned %#lx\n", status ); + map_named_framebuffer_attachment_param( framebuffer, attachment, pname, params ); +} + +void WINAPI glGetNamedFramebufferAttachmentParameterivEXT( GLuint framebuffer, GLenum attachment, GLenum pname, GLint *params ) +{ + struct glGetNamedFramebufferAttachmentParameterivEXT_params args = { .teb = NtCurrentTeb(), .attachment = attachment, .pname = pname, .params = params }; + GLuint host_framebuffer = framebuffer; + NTSTATUS status; + + TRACE( "framebuffer %d, attachment %d, pname %d, params %p\n", framebuffer, attachment, pname, params ); + + if (!alloc_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &host_framebuffer, TRUE )) return; + args.framebuffer = *map_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &host_framebuffer ); + if ((status = UNIX_CALL( glGetNamedFramebufferAttachmentParameterivEXT, &args ))) WARN( "glGetNamedFramebufferAttachmentParameterivEXT returned %#lx\n", status ); + map_named_framebuffer_attachment_param( framebuffer, attachment, pname, params ); +} + HGLRC WINAPI wglCreateContext( HDC hdc ) { static const int attribs[] = { WGL_CONTEXT_PROFILE_MASK_ARB, WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB, 0, 0 }; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/11125
From: Rémi Bernon <rbernon@codeweavers.com> --- dlls/opengl32/tests/opengl.c | 4 +--- dlls/opengl32/wgl.c | 1 + 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/dlls/opengl32/tests/opengl.c b/dlls/opengl32/tests/opengl.c index a89aac5a544..a9094c853b4 100644 --- a/dlls/opengl32/tests/opengl.c +++ b/dlls/opengl32/tests/opengl.c @@ -1483,9 +1483,7 @@ static void test_object_creation( HDC winhdc ) } if (!is_implicit_allowed( i, TRUE )) { - todo_wine_if( i == OBJ_RENDERBUFFER ) ok_ret( GL_INVALID_OPERATION, glGetError() ); - if (!winetest_platform_is_wine || i != OBJ_RENDERBUFFER) ok_ret( TRUE, create_object( i, 0, &obj ) ); } ok_ret( GL_NO_ERROR, glGetError() ); @@ -1516,7 +1514,7 @@ static void test_object_creation( HDC winhdc ) /* Wine never allows implicit allocation in core contexts */ todo_wine_if( i == OBJ_FENCE_APPLE || i == OBJ_FENCE_NV || i == OBJ_PATH_NV || i == OBJ_PROGRAM_ARB || i == OBJ_PROGRAM_NV || i == OBJ_SHADER_EXT || i == OBJ_SHADER_ATI || - i == OBJ_RENDERBUFFER_EXT || i == OBJ_SEMAPHORE_EXT || i == OBJ_TRANSFORM_FEEDBACK_NV || + i == OBJ_SEMAPHORE_EXT || i == OBJ_TRANSFORM_FEEDBACK_NV || i == OBJ_VERTEX_ARRAY_APPLE ) ok_ret( GL_NO_ERROR, glGetError() ); ok_u4( obj, ==, 1 ); diff --git a/dlls/opengl32/wgl.c b/dlls/opengl32/wgl.c index b4a1b454d7f..f4026318fea 100644 --- a/dlls/opengl32/wgl.c +++ b/dlls/opengl32/wgl.c @@ -573,6 +573,7 @@ BOOL alloc_context_objects( enum object_type type, UINT n, const GLuint *handles /* only allow explicit allocation in some cases, use host allocated ids directly in that case */ if (ctx->base.profile_mask & WGL_CONTEXT_CORE_PROFILE_BIT_ARB) alloc_client = FALSE; if (type == OBJ_TYPE_FRAMEBUFFER) alloc_client = extension; + if (type == OBJ_TYPE_RENDERBUFFER) alloc_client = extension; AcquireSRWLockShared( &table->lock ); for (UINT i = 0; i < n && !needs_client; i++) -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/11125
From: Rémi Bernon <rbernon@codeweavers.com> --- dlls/opengl32/make_opengl | 11 +- dlls/opengl32/private.h | 1 + dlls/opengl32/tests/opengl.c | 6 +- dlls/opengl32/thunks.c | 571 +++++++++++++++++++++++++---------- dlls/opengl32/wgl.c | 25 ++ 5 files changed, 447 insertions(+), 167 deletions(-) diff --git a/dlls/opengl32/make_opengl b/dlls/opengl32/make_opengl index 0b66c1cf6e5..c9ad56a4977 100755 --- a/dlls/opengl32/make_opengl +++ b/dlls/opengl32/make_opengl @@ -686,8 +686,8 @@ sub get_object_type($$$$) { my ($func, $ptype, $pname, $class) = @_; - return "srcTarget == GL_RENDERBUFFER ? OBJ_TYPE_RENDERBUFFER : OBJ_TYPE_COUNT" if $pname eq "srcName"; - return "dstTarget == GL_RENDERBUFFER ? OBJ_TYPE_RENDERBUFFER : OBJ_TYPE_COUNT" if $pname eq "dstName"; + return "srcTarget == GL_RENDERBUFFER ? OBJ_TYPE_RENDERBUFFER : OBJ_TYPE_TEXTURE" if $pname eq "srcName"; + return "dstTarget == GL_RENDERBUFFER ? OBJ_TYPE_RENDERBUFFER : OBJ_TYPE_TEXTURE" if $pname eq "dstName"; return "OBJ_TYPE_BUFFER" if $class eq "buffer"; return "OBJ_TYPE_BUFFER" if $func eq "glDeleteObjectBufferATI" and $pname eq "buffer"; @@ -695,6 +695,9 @@ sub get_object_type($$$$) return "OBJ_TYPE_FRAMEBUFFER" if $class eq "framebuffer"; return "OBJ_TYPE_FRAMEBUFFER" if $pname =~ "fbo"; return "OBJ_TYPE_RENDERBUFFER" if $class eq "renderbuffer"; + return "OBJ_TYPE_TEXTURE" if $class eq "texture"; + return "OBJ_TYPE_TEXTURE" if $func =~ /^glVDPAURegister/ and $pname eq "textureNames"; + return "OBJ_TYPE_TEXTURE" if $func =~ /^gl(LGPU|Multicast|Async|)CopyImageSubData/ and $pname =~ /^(src|dst)Name$/; return 0 if $class eq "SelectName"; return 0 if $func eq "glGetActiveAtomicCounterBufferiv" and $pname eq "bufferIndex"; @@ -704,6 +707,7 @@ sub get_object_type($$$$) print "Missing possible buffer: $func $ptype $pname $class\n" if lc( $pname ) =~ /buffer/; print "Missing possible framebuffer: $func $ptype $pname $class\n" if lc( $pname ) =~ /fbo/; + print "Missing possible texture: $func $ptype $pname $class\n" if lc( $pname ) =~ /texture/; return 0; } @@ -716,6 +720,7 @@ sub allocate_object_names($) return $ret if $name =~ /^glBindBuffer/; return $ret if $name =~ /^glBindFramebuffer/; return $ret if $name =~ /^glBindRenderbuffer/; + return $ret if $name =~ /^glBindTexture/; return 0; } @@ -754,7 +759,7 @@ sub generate_win_thunk($$) $len = "count" if $name =~ /^glDrawCommandsStates/ and $pname eq "fbos"; $addr = "" if $name =~ /^glDrawCommandsStates/ and $pname eq "fbos"; - if ($name =~ /^(glGen|glCreate)/) + if ($name =~ /^(glGen|glCreate)/ and $name !~ /^glGenerate/) { $params .= ", .$pname = $pname"; $post_call .= " if ($len > 0) put_context_objects( $map_type, $len, $addr$pname );\n"; diff --git a/dlls/opengl32/private.h b/dlls/opengl32/private.h index af9b0726756..f6bfb18fb92 100644 --- a/dlls/opengl32/private.h +++ b/dlls/opengl32/private.h @@ -51,6 +51,7 @@ enum object_type OBJ_TYPE_BUFFER, OBJ_TYPE_FRAMEBUFFER, OBJ_TYPE_RENDERBUFFER, + OBJ_TYPE_TEXTURE, OBJ_TYPE_COUNT, }; diff --git a/dlls/opengl32/tests/opengl.c b/dlls/opengl32/tests/opengl.c index a9094c853b4..7350a744990 100644 --- a/dlls/opengl32/tests/opengl.c +++ b/dlls/opengl32/tests/opengl.c @@ -2019,7 +2019,7 @@ static void test_sharelists(HDC winhdc) ok_ret( GL_NO_ERROR, glGetError() ); /* cannot overwrite non-empty lists with some other */ - todo_wine_if( i >= 6 ) ok_ret( FALSE, wglShareLists( ctx1, ctx3 ) ); + todo_wine_if( i >= 8 ) ok_ret( FALSE, wglShareLists( ctx1, ctx3 ) ); ok_ret( GL_NO_ERROR, glGetError() ); ok_ret( FALSE, wglShareLists( ctx2, ctx1 ) ); ok_ret( GL_NO_ERROR, glGetError() ); @@ -2067,7 +2067,7 @@ static void test_sharelists(HDC winhdc) ok_ret( GL_NO_ERROR, glGetError() ); ok_ret( TRUE, wglMakeCurrent( winhdc, ctx2 ) ); ok_ret( GL_NO_ERROR, glGetError() ); - todo_wine_if( i >= 6 ) ok_ret( FALSE, test->exists( obj1 ) ); + todo_wine_if( i >= 8 ) ok_ret( FALSE, test->exists( obj1 ) ); ok_ret( GL_NO_ERROR, glGetError() ); ok_ret( FALSE, test->exists( obj2 ) ); ok_ret( GL_NO_ERROR, glGetError() ); @@ -2078,7 +2078,7 @@ static void test_sharelists(HDC winhdc) ok_ret( TRUE, wglDeleteContext( ctx3 ) ); /* objects are still valid after shared context destruction */ - todo_wine_if( i >= 6 ) ok_ret( FALSE, test->exists( obj1 ) ); + todo_wine_if( i >= 8 ) ok_ret( FALSE, test->exists( obj1 ) ); ok_ret( GL_NO_ERROR, glGetError() ); ok_ret( FALSE, test->exists( obj2 ) ); ok_ret( GL_NO_ERROR, glGetError() ); diff --git a/dlls/opengl32/thunks.c b/dlls/opengl32/thunks.c index 80eeafe0998..0cd50ca1a4b 100644 --- a/dlls/opengl32/thunks.c +++ b/dlls/opengl32/thunks.c @@ -54,10 +54,14 @@ void WINAPI glAlphaFunc( GLenum func, GLfloat ref ) GLboolean WINAPI glAreTexturesResident( GLsizei n, const GLuint *textures, GLboolean *residences ) { - struct glAreTexturesResident_params args = { .teb = NtCurrentTeb(), .n = n, .textures = textures, .residences = residences }; + GLuint textures_buf[64], *textures_tmp; + struct glAreTexturesResident_params args = { .teb = NtCurrentTeb(), .n = n, .residences = residences }; NTSTATUS status; TRACE( "n %d, textures %p, residences %p\n", n, textures, residences ); + textures_tmp = n > 0 ? memdup_objects( n, textures, textures_buf, ARRAY_SIZE(textures_buf) ) : NULL; + args.textures = n > 0 ? map_context_objects( OBJ_TYPE_TEXTURE, n, textures_tmp ) : NULL; if ((status = UNIX_CALL( glAreTexturesResident, &args ))) WARN( "glAreTexturesResident returned %#lx\n", status ); + if (textures_tmp != textures_buf) free( textures_tmp ); return args.ret; } @@ -79,9 +83,11 @@ void WINAPI glBegin( GLenum mode ) void WINAPI glBindTexture( GLenum target, GLuint texture ) { - struct glBindTexture_params args = { .teb = NtCurrentTeb(), .target = target, .texture = texture }; + struct glBindTexture_params args = { .teb = NtCurrentTeb(), .target = target }; NTSTATUS status; TRACE( "target %d, texture %d\n", target, texture ); + if (!alloc_context_objects( OBJ_TYPE_TEXTURE, 1, &texture, FALSE )) return; + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glBindTexture, &args ))) WARN( "glBindTexture returned %#lx\n", status ); } @@ -511,10 +517,14 @@ void WINAPI glDeleteLists( GLuint list, GLsizei range ) void WINAPI glDeleteTextures( GLsizei n, const GLuint *textures ) { - struct glDeleteTextures_params args = { .teb = NtCurrentTeb(), .n = n, .textures = textures }; + GLuint textures_buf[64], *textures_tmp; + struct glDeleteTextures_params args = { .teb = NtCurrentTeb(), .n = n }; NTSTATUS status; TRACE( "n %d, textures %p\n", n, textures ); + textures_tmp = n > 0 ? memdup_objects( n, textures, textures_buf, ARRAY_SIZE(textures_buf) ) : NULL; + args.textures = n > 0 ? del_context_objects( OBJ_TYPE_TEXTURE, n, textures_tmp ) : NULL; if ((status = UNIX_CALL( glDeleteTextures, &args ))) WARN( "glDeleteTextures returned %#lx\n", status ); + if (textures_tmp != textures_buf) free( textures_tmp ); } void WINAPI glDepthFunc( GLenum func ) @@ -828,6 +838,7 @@ void WINAPI glGenTextures( GLsizei n, GLuint *textures ) NTSTATUS status; TRACE( "n %d, textures %p\n", n, textures ); if ((status = UNIX_CALL( glGenTextures, &args ))) WARN( "glGenTextures returned %#lx\n", status ); + if (n > 0) put_context_objects( OBJ_TYPE_TEXTURE, n, textures ); } void WINAPI glGetBooleanv( GLenum pname, GLboolean *data ) @@ -1209,9 +1220,10 @@ GLboolean WINAPI glIsList( GLuint list ) GLboolean WINAPI glIsTexture( GLuint texture ) { - struct glIsTexture_params args = { .teb = NtCurrentTeb(), .texture = texture }; + struct glIsTexture_params args = { .teb = NtCurrentTeb() }; NTSTATUS status; TRACE( "texture %d\n", texture ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glIsTexture, &args ))) WARN( "glIsTexture returned %#lx\n", status ); return args.ret; } @@ -1706,10 +1718,14 @@ void WINAPI glPopName(void) void WINAPI glPrioritizeTextures( GLsizei n, const GLuint *textures, const GLfloat *priorities ) { - struct glPrioritizeTextures_params args = { .teb = NtCurrentTeb(), .n = n, .textures = textures, .priorities = priorities }; + GLuint textures_buf[64], *textures_tmp; + struct glPrioritizeTextures_params args = { .teb = NtCurrentTeb(), .n = n, .priorities = priorities }; NTSTATUS status; TRACE( "n %d, textures %p, priorities %p\n", n, textures, priorities ); + textures_tmp = n > 0 ? memdup_objects( n, textures, textures_buf, ARRAY_SIZE(textures_buf) ) : NULL; + args.textures = n > 0 ? map_context_objects( OBJ_TYPE_TEXTURE, n, textures_tmp ) : NULL; if ((status = UNIX_CALL( glPrioritizeTextures, &args ))) WARN( "glPrioritizeTextures returned %#lx\n", status ); + if (textures_tmp != textures_buf) free( textures_tmp ); } void WINAPI glPushAttrib( GLbitfield mask ) @@ -2877,10 +2893,14 @@ static GLboolean WINAPI glAreProgramsResidentNV( GLsizei n, const GLuint *progra static GLboolean WINAPI glAreTexturesResidentEXT( GLsizei n, const GLuint *textures, GLboolean *residences ) { - struct glAreTexturesResidentEXT_params args = { .teb = NtCurrentTeb(), .n = n, .textures = textures, .residences = residences }; + GLuint textures_buf[64], *textures_tmp; + struct glAreTexturesResidentEXT_params args = { .teb = NtCurrentTeb(), .n = n, .residences = residences }; NTSTATUS status; TRACE( "n %d, textures %p, residences %p\n", n, textures, residences ); + textures_tmp = n > 0 ? memdup_objects( n, textures, textures_buf, ARRAY_SIZE(textures_buf) ) : NULL; + args.textures = n > 0 ? map_context_objects( OBJ_TYPE_TEXTURE, n, textures_tmp ) : NULL; if ((status = UNIX_CALL( glAreTexturesResidentEXT, &args ))) WARN( "glAreTexturesResidentEXT returned %#lx\n", status ); + if (textures_tmp != textures_buf) free( textures_tmp ); return args.ret; } @@ -2917,8 +2937,8 @@ static GLuint WINAPI glAsyncCopyImageSubDataNVX( GLsizei waitSemaphoreCount, con struct glAsyncCopyImageSubDataNVX_params args = { .teb = NtCurrentTeb(), .waitSemaphoreCount = waitSemaphoreCount, .waitSemaphoreArray = waitSemaphoreArray, .waitValueArray = waitValueArray, .srcGpu = srcGpu, .dstGpuMask = dstGpuMask, .srcTarget = srcTarget, .srcLevel = srcLevel, .srcX = srcX, .srcY = srcY, .srcZ = srcZ, .dstTarget = dstTarget, .dstLevel = dstLevel, .dstX = dstX, .dstY = dstY, .dstZ = dstZ, .srcWidth = srcWidth, .srcHeight = srcHeight, .srcDepth = srcDepth, .signalSemaphoreCount = signalSemaphoreCount, .signalSemaphoreArray = signalSemaphoreArray, .signalValueArray = signalValueArray }; NTSTATUS status; TRACE( "waitSemaphoreCount %d, waitSemaphoreArray %p, waitValueArray %p, srcGpu %d, dstGpuMask %d, srcName %d, srcTarget %d, srcLevel %d, srcX %d, srcY %d, srcZ %d, dstName %d, dstTarget %d, dstLevel %d, dstX %d, dstY %d, dstZ %d, srcWidth %d, srcHeight %d, srcDepth %d, signalSemaphoreCount %d, signalSemaphoreArray %p, signalValueArray %p\n", waitSemaphoreCount, waitSemaphoreArray, waitValueArray, srcGpu, dstGpuMask, srcName, srcTarget, srcLevel, srcX, srcY, srcZ, dstName, dstTarget, dstLevel, dstX, dstY, dstZ, srcWidth, srcHeight, srcDepth, signalSemaphoreCount, signalSemaphoreArray, signalValueArray ); - args.srcName = *map_context_objects( srcTarget == GL_RENDERBUFFER ? OBJ_TYPE_RENDERBUFFER : OBJ_TYPE_COUNT, 1, &srcName ); - args.dstName = *map_context_objects( dstTarget == GL_RENDERBUFFER ? OBJ_TYPE_RENDERBUFFER : OBJ_TYPE_COUNT, 1, &dstName ); + args.srcName = *map_context_objects( srcTarget == GL_RENDERBUFFER ? OBJ_TYPE_RENDERBUFFER : OBJ_TYPE_TEXTURE, 1, &srcName ); + args.dstName = *map_context_objects( dstTarget == GL_RENDERBUFFER ? OBJ_TYPE_RENDERBUFFER : OBJ_TYPE_TEXTURE, 1, &dstName ); if ((status = UNIX_CALL( glAsyncCopyImageSubDataNVX, &args ))) WARN( "glAsyncCopyImageSubDataNVX returned %#lx\n", status ); return args.ret; } @@ -3263,26 +3283,32 @@ static void WINAPI glBindFramebufferEXT( GLenum target, GLuint framebuffer ) static void WINAPI glBindImageTexture( GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format ) { - struct glBindImageTexture_params args = { .teb = NtCurrentTeb(), .unit = unit, .texture = texture, .level = level, .layered = layered, .layer = layer, .access = access, .format = format }; + struct glBindImageTexture_params args = { .teb = NtCurrentTeb(), .unit = unit, .level = level, .layered = layered, .layer = layer, .access = access, .format = format }; NTSTATUS status; TRACE( "unit %d, texture %d, level %d, layered %d, layer %d, access %d, format %d\n", unit, texture, level, layered, layer, access, format ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glBindImageTexture, &args ))) WARN( "glBindImageTexture returned %#lx\n", status ); } static void WINAPI glBindImageTextureEXT( GLuint index, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLint format ) { - struct glBindImageTextureEXT_params args = { .teb = NtCurrentTeb(), .index = index, .texture = texture, .level = level, .layered = layered, .layer = layer, .access = access, .format = format }; + struct glBindImageTextureEXT_params args = { .teb = NtCurrentTeb(), .index = index, .level = level, .layered = layered, .layer = layer, .access = access, .format = format }; NTSTATUS status; TRACE( "index %d, texture %d, level %d, layered %d, layer %d, access %d, format %d\n", index, texture, level, layered, layer, access, format ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glBindImageTextureEXT, &args ))) WARN( "glBindImageTextureEXT returned %#lx\n", status ); } static void WINAPI glBindImageTextures( GLuint first, GLsizei count, const GLuint *textures ) { - struct glBindImageTextures_params args = { .teb = NtCurrentTeb(), .first = first, .count = count, .textures = textures }; + GLuint textures_buf[64], *textures_tmp; + struct glBindImageTextures_params args = { .teb = NtCurrentTeb(), .first = first, .count = count }; NTSTATUS status; TRACE( "first %d, count %d, textures %p\n", first, count, textures ); + textures_tmp = count > 0 ? memdup_objects( count, textures, textures_buf, ARRAY_SIZE(textures_buf) ) : NULL; + args.textures = count > 0 ? map_context_objects( OBJ_TYPE_TEXTURE, count, textures_tmp ) : NULL; if ((status = UNIX_CALL( glBindImageTextures, &args ))) WARN( "glBindImageTextures returned %#lx\n", status ); + if (textures_tmp != textures_buf) free( textures_tmp ); } static GLuint WINAPI glBindLightParameterEXT( GLenum light, GLenum value ) @@ -3305,9 +3331,11 @@ static GLuint WINAPI glBindMaterialParameterEXT( GLenum face, GLenum value ) static void WINAPI glBindMultiTextureEXT( GLenum texunit, GLenum target, GLuint texture ) { - struct glBindMultiTextureEXT_params args = { .teb = NtCurrentTeb(), .texunit = texunit, .target = target, .texture = texture }; + struct glBindMultiTextureEXT_params args = { .teb = NtCurrentTeb(), .texunit = texunit, .target = target }; NTSTATUS status; TRACE( "texunit %d, target %d, texture %d\n", texunit, target, texture ); + if (!alloc_context_objects( OBJ_TYPE_TEXTURE, 1, &texture, TRUE )) return; + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glBindMultiTextureEXT, &args ))) WARN( "glBindMultiTextureEXT returned %#lx\n", status ); } @@ -3382,9 +3410,10 @@ static void WINAPI glBindSamplers( GLuint first, GLsizei count, const GLuint *sa static void WINAPI glBindShadingRateImageNV( GLuint texture ) { - struct glBindShadingRateImageNV_params args = { .teb = NtCurrentTeb(), .texture = texture }; + struct glBindShadingRateImageNV_params args = { .teb = NtCurrentTeb() }; NTSTATUS status; TRACE( "texture %d\n", texture ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glBindShadingRateImageNV, &args ))) WARN( "glBindShadingRateImageNV returned %#lx\n", status ); } @@ -3399,17 +3428,21 @@ static GLuint WINAPI glBindTexGenParameterEXT( GLenum unit, GLenum coord, GLenum static void WINAPI glBindTextureEXT( GLenum target, GLuint texture ) { - struct glBindTextureEXT_params args = { .teb = NtCurrentTeb(), .target = target, .texture = texture }; + struct glBindTextureEXT_params args = { .teb = NtCurrentTeb(), .target = target }; NTSTATUS status; TRACE( "target %d, texture %d\n", target, texture ); + if (!alloc_context_objects( OBJ_TYPE_TEXTURE, 1, &texture, TRUE )) return; + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glBindTextureEXT, &args ))) WARN( "glBindTextureEXT returned %#lx\n", status ); } static void WINAPI glBindTextureUnit( GLuint unit, GLuint texture ) { - struct glBindTextureUnit_params args = { .teb = NtCurrentTeb(), .unit = unit, .texture = texture }; + struct glBindTextureUnit_params args = { .teb = NtCurrentTeb(), .unit = unit }; NTSTATUS status; TRACE( "unit %d, texture %d\n", unit, texture ); + if (!alloc_context_objects( OBJ_TYPE_TEXTURE, 1, &texture, FALSE )) return; + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glBindTextureUnit, &args ))) WARN( "glBindTextureUnit returned %#lx\n", status ); } @@ -3424,10 +3457,15 @@ static GLuint WINAPI glBindTextureUnitParameterEXT( GLenum unit, GLenum value ) static void WINAPI glBindTextures( GLuint first, GLsizei count, const GLuint *textures ) { - struct glBindTextures_params args = { .teb = NtCurrentTeb(), .first = first, .count = count, .textures = textures }; + GLuint textures_buf[64], *textures_tmp; + struct glBindTextures_params args = { .teb = NtCurrentTeb(), .first = first, .count = count }; NTSTATUS status; TRACE( "first %d, count %d, textures %p\n", first, count, textures ); + if (!alloc_context_objects( OBJ_TYPE_TEXTURE, count, textures, FALSE )) return; + textures_tmp = count > 0 ? memdup_objects( count, textures, textures_buf, ARRAY_SIZE(textures_buf) ) : NULL; + args.textures = count > 0 ? map_context_objects( OBJ_TYPE_TEXTURE, count, textures_tmp ) : NULL; if ((status = UNIX_CALL( glBindTextures, &args ))) WARN( "glBindTextures returned %#lx\n", status ); + if (textures_tmp != textures_buf) free( textures_tmp ); } static void WINAPI glBindTransformFeedback( GLenum target, GLuint id ) @@ -3501,9 +3539,10 @@ static void WINAPI glBindVideoCaptureStreamBufferNV( GLuint video_capture_slot, static void WINAPI glBindVideoCaptureStreamTextureNV( GLuint video_capture_slot, GLuint stream, GLenum frame_region, GLenum target, GLuint texture ) { - struct glBindVideoCaptureStreamTextureNV_params args = { .teb = NtCurrentTeb(), .video_capture_slot = video_capture_slot, .stream = stream, .frame_region = frame_region, .target = target, .texture = texture }; + struct glBindVideoCaptureStreamTextureNV_params args = { .teb = NtCurrentTeb(), .video_capture_slot = video_capture_slot, .stream = stream, .frame_region = frame_region, .target = target }; NTSTATUS status; TRACE( "video_capture_slot %d, stream %d, frame_region %d, target %d, texture %d\n", video_capture_slot, stream, frame_region, target, texture ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glBindVideoCaptureStreamTextureNV, &args ))) WARN( "glBindVideoCaptureStreamTextureNV returned %#lx\n", status ); } @@ -4225,17 +4264,19 @@ static void WINAPI glClearNamedFramebufferuiv( GLuint framebuffer, GLenum buffer static void WINAPI glClearTexImage( GLuint texture, GLint level, GLenum format, GLenum type, const void *data ) { - struct glClearTexImage_params args = { .teb = NtCurrentTeb(), .texture = texture, .level = level, .format = format, .type = type, .data = data }; + struct glClearTexImage_params args = { .teb = NtCurrentTeb(), .level = level, .format = format, .type = type, .data = data }; NTSTATUS status; TRACE( "texture %d, level %d, format %d, type %d, data %p\n", texture, level, format, type, data ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glClearTexImage, &args ))) WARN( "glClearTexImage returned %#lx\n", status ); } static void WINAPI glClearTexSubImage( GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *data ) { - struct glClearTexSubImage_params args = { .teb = NtCurrentTeb(), .texture = texture, .level = level, .xoffset = xoffset, .yoffset = yoffset, .zoffset = zoffset, .width = width, .height = height, .depth = depth, .format = format, .type = type, .data = data }; + struct glClearTexSubImage_params args = { .teb = NtCurrentTeb(), .level = level, .xoffset = xoffset, .yoffset = yoffset, .zoffset = zoffset, .width = width, .height = height, .depth = depth, .format = format, .type = type, .data = data }; NTSTATUS status; TRACE( "texture %d, level %d, xoffset %d, yoffset %d, zoffset %d, width %d, height %d, depth %d, format %d, type %d, data %p\n", texture, level, xoffset, yoffset, zoffset, width, height, depth, format, type, data ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glClearTexSubImage, &args ))) WARN( "glClearTexSubImage returned %#lx\n", status ); } @@ -4883,73 +4924,88 @@ static void WINAPI glCompressedTexSubImage3DARB( GLenum target, GLint level, GLi static void WINAPI glCompressedTextureImage1DEXT( GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *bits ) { - struct glCompressedTextureImage1DEXT_params args = { .teb = NtCurrentTeb(), .texture = texture, .target = target, .level = level, .internalformat = internalformat, .width = width, .border = border, .imageSize = imageSize, .bits = bits }; + struct glCompressedTextureImage1DEXT_params args = { .teb = NtCurrentTeb(), .target = target, .level = level, .internalformat = internalformat, .width = width, .border = border, .imageSize = imageSize, .bits = bits }; NTSTATUS status; TRACE( "texture %d, target %d, level %d, internalformat %d, width %d, border %d, imageSize %d, bits %p\n", texture, target, level, internalformat, width, border, imageSize, bits ); + if (!alloc_context_objects( OBJ_TYPE_TEXTURE, 1, &texture, TRUE )) return; + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glCompressedTextureImage1DEXT, &args ))) WARN( "glCompressedTextureImage1DEXT returned %#lx\n", status ); } static void WINAPI glCompressedTextureImage2DEXT( GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *bits ) { - struct glCompressedTextureImage2DEXT_params args = { .teb = NtCurrentTeb(), .texture = texture, .target = target, .level = level, .internalformat = internalformat, .width = width, .height = height, .border = border, .imageSize = imageSize, .bits = bits }; + struct glCompressedTextureImage2DEXT_params args = { .teb = NtCurrentTeb(), .target = target, .level = level, .internalformat = internalformat, .width = width, .height = height, .border = border, .imageSize = imageSize, .bits = bits }; NTSTATUS status; TRACE( "texture %d, target %d, level %d, internalformat %d, width %d, height %d, border %d, imageSize %d, bits %p\n", texture, target, level, internalformat, width, height, border, imageSize, bits ); + if (!alloc_context_objects( OBJ_TYPE_TEXTURE, 1, &texture, TRUE )) return; + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glCompressedTextureImage2DEXT, &args ))) WARN( "glCompressedTextureImage2DEXT returned %#lx\n", status ); } static void WINAPI glCompressedTextureImage3DEXT( GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *bits ) { - struct glCompressedTextureImage3DEXT_params args = { .teb = NtCurrentTeb(), .texture = texture, .target = target, .level = level, .internalformat = internalformat, .width = width, .height = height, .depth = depth, .border = border, .imageSize = imageSize, .bits = bits }; + struct glCompressedTextureImage3DEXT_params args = { .teb = NtCurrentTeb(), .target = target, .level = level, .internalformat = internalformat, .width = width, .height = height, .depth = depth, .border = border, .imageSize = imageSize, .bits = bits }; NTSTATUS status; TRACE( "texture %d, target %d, level %d, internalformat %d, width %d, height %d, depth %d, border %d, imageSize %d, bits %p\n", texture, target, level, internalformat, width, height, depth, border, imageSize, bits ); + if (!alloc_context_objects( OBJ_TYPE_TEXTURE, 1, &texture, TRUE )) return; + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glCompressedTextureImage3DEXT, &args ))) WARN( "glCompressedTextureImage3DEXT returned %#lx\n", status ); } static void WINAPI glCompressedTextureSubImage1D( GLuint texture, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data ) { - struct glCompressedTextureSubImage1D_params args = { .teb = NtCurrentTeb(), .texture = texture, .level = level, .xoffset = xoffset, .width = width, .format = format, .imageSize = imageSize, .data = data }; + struct glCompressedTextureSubImage1D_params args = { .teb = NtCurrentTeb(), .level = level, .xoffset = xoffset, .width = width, .format = format, .imageSize = imageSize, .data = data }; NTSTATUS status; TRACE( "texture %d, level %d, xoffset %d, width %d, format %d, imageSize %d, data %p\n", texture, level, xoffset, width, format, imageSize, data ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glCompressedTextureSubImage1D, &args ))) WARN( "glCompressedTextureSubImage1D returned %#lx\n", status ); } static void WINAPI glCompressedTextureSubImage1DEXT( GLuint texture, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *bits ) { - struct glCompressedTextureSubImage1DEXT_params args = { .teb = NtCurrentTeb(), .texture = texture, .target = target, .level = level, .xoffset = xoffset, .width = width, .format = format, .imageSize = imageSize, .bits = bits }; + struct glCompressedTextureSubImage1DEXT_params args = { .teb = NtCurrentTeb(), .target = target, .level = level, .xoffset = xoffset, .width = width, .format = format, .imageSize = imageSize, .bits = bits }; NTSTATUS status; TRACE( "texture %d, target %d, level %d, xoffset %d, width %d, format %d, imageSize %d, bits %p\n", texture, target, level, xoffset, width, format, imageSize, bits ); + if (!alloc_context_objects( OBJ_TYPE_TEXTURE, 1, &texture, TRUE )) return; + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glCompressedTextureSubImage1DEXT, &args ))) WARN( "glCompressedTextureSubImage1DEXT returned %#lx\n", status ); } static void WINAPI glCompressedTextureSubImage2D( GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data ) { - struct glCompressedTextureSubImage2D_params args = { .teb = NtCurrentTeb(), .texture = texture, .level = level, .xoffset = xoffset, .yoffset = yoffset, .width = width, .height = height, .format = format, .imageSize = imageSize, .data = data }; + struct glCompressedTextureSubImage2D_params args = { .teb = NtCurrentTeb(), .level = level, .xoffset = xoffset, .yoffset = yoffset, .width = width, .height = height, .format = format, .imageSize = imageSize, .data = data }; NTSTATUS status; TRACE( "texture %d, level %d, xoffset %d, yoffset %d, width %d, height %d, format %d, imageSize %d, data %p\n", texture, level, xoffset, yoffset, width, height, format, imageSize, data ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glCompressedTextureSubImage2D, &args ))) WARN( "glCompressedTextureSubImage2D returned %#lx\n", status ); } static void WINAPI glCompressedTextureSubImage2DEXT( GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *bits ) { - struct glCompressedTextureSubImage2DEXT_params args = { .teb = NtCurrentTeb(), .texture = texture, .target = target, .level = level, .xoffset = xoffset, .yoffset = yoffset, .width = width, .height = height, .format = format, .imageSize = imageSize, .bits = bits }; + struct glCompressedTextureSubImage2DEXT_params args = { .teb = NtCurrentTeb(), .target = target, .level = level, .xoffset = xoffset, .yoffset = yoffset, .width = width, .height = height, .format = format, .imageSize = imageSize, .bits = bits }; NTSTATUS status; TRACE( "texture %d, target %d, level %d, xoffset %d, yoffset %d, width %d, height %d, format %d, imageSize %d, bits %p\n", texture, target, level, xoffset, yoffset, width, height, format, imageSize, bits ); + if (!alloc_context_objects( OBJ_TYPE_TEXTURE, 1, &texture, TRUE )) return; + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glCompressedTextureSubImage2DEXT, &args ))) WARN( "glCompressedTextureSubImage2DEXT returned %#lx\n", status ); } static void WINAPI glCompressedTextureSubImage3D( GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data ) { - struct glCompressedTextureSubImage3D_params args = { .teb = NtCurrentTeb(), .texture = texture, .level = level, .xoffset = xoffset, .yoffset = yoffset, .zoffset = zoffset, .width = width, .height = height, .depth = depth, .format = format, .imageSize = imageSize, .data = data }; + struct glCompressedTextureSubImage3D_params args = { .teb = NtCurrentTeb(), .level = level, .xoffset = xoffset, .yoffset = yoffset, .zoffset = zoffset, .width = width, .height = height, .depth = depth, .format = format, .imageSize = imageSize, .data = data }; NTSTATUS status; TRACE( "texture %d, level %d, xoffset %d, yoffset %d, zoffset %d, width %d, height %d, depth %d, format %d, imageSize %d, data %p\n", texture, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glCompressedTextureSubImage3D, &args ))) WARN( "glCompressedTextureSubImage3D returned %#lx\n", status ); } static void WINAPI glCompressedTextureSubImage3DEXT( GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *bits ) { - struct glCompressedTextureSubImage3DEXT_params args = { .teb = NtCurrentTeb(), .texture = texture, .target = target, .level = level, .xoffset = xoffset, .yoffset = yoffset, .zoffset = zoffset, .width = width, .height = height, .depth = depth, .format = format, .imageSize = imageSize, .bits = bits }; + struct glCompressedTextureSubImage3DEXT_params args = { .teb = NtCurrentTeb(), .target = target, .level = level, .xoffset = xoffset, .yoffset = yoffset, .zoffset = zoffset, .width = width, .height = height, .depth = depth, .format = format, .imageSize = imageSize, .bits = bits }; NTSTATUS status; TRACE( "texture %d, target %d, level %d, xoffset %d, yoffset %d, zoffset %d, width %d, height %d, depth %d, format %d, imageSize %d, bits %p\n", texture, target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, bits ); + if (!alloc_context_objects( OBJ_TYPE_TEXTURE, 1, &texture, TRUE )) return; + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glCompressedTextureSubImage3DEXT, &args ))) WARN( "glCompressedTextureSubImage3DEXT returned %#lx\n", status ); } @@ -5158,8 +5214,8 @@ static void WINAPI glCopyImageSubData( GLuint srcName, GLenum srcTarget, GLint s struct glCopyImageSubData_params args = { .teb = NtCurrentTeb(), .srcTarget = srcTarget, .srcLevel = srcLevel, .srcX = srcX, .srcY = srcY, .srcZ = srcZ, .dstTarget = dstTarget, .dstLevel = dstLevel, .dstX = dstX, .dstY = dstY, .dstZ = dstZ, .srcWidth = srcWidth, .srcHeight = srcHeight, .srcDepth = srcDepth }; NTSTATUS status; TRACE( "srcName %d, srcTarget %d, srcLevel %d, srcX %d, srcY %d, srcZ %d, dstName %d, dstTarget %d, dstLevel %d, dstX %d, dstY %d, dstZ %d, srcWidth %d, srcHeight %d, srcDepth %d\n", srcName, srcTarget, srcLevel, srcX, srcY, srcZ, dstName, dstTarget, dstLevel, dstX, dstY, dstZ, srcWidth, srcHeight, srcDepth ); - args.srcName = *map_context_objects( srcTarget == GL_RENDERBUFFER ? OBJ_TYPE_RENDERBUFFER : OBJ_TYPE_COUNT, 1, &srcName ); - args.dstName = *map_context_objects( dstTarget == GL_RENDERBUFFER ? OBJ_TYPE_RENDERBUFFER : OBJ_TYPE_COUNT, 1, &dstName ); + args.srcName = *map_context_objects( srcTarget == GL_RENDERBUFFER ? OBJ_TYPE_RENDERBUFFER : OBJ_TYPE_TEXTURE, 1, &srcName ); + args.dstName = *map_context_objects( dstTarget == GL_RENDERBUFFER ? OBJ_TYPE_RENDERBUFFER : OBJ_TYPE_TEXTURE, 1, &dstName ); if ((status = UNIX_CALL( glCopyImageSubData, &args ))) WARN( "glCopyImageSubData returned %#lx\n", status ); } @@ -5168,8 +5224,8 @@ static void WINAPI glCopyImageSubDataNV( GLuint srcName, GLenum srcTarget, GLint struct glCopyImageSubDataNV_params args = { .teb = NtCurrentTeb(), .srcTarget = srcTarget, .srcLevel = srcLevel, .srcX = srcX, .srcY = srcY, .srcZ = srcZ, .dstTarget = dstTarget, .dstLevel = dstLevel, .dstX = dstX, .dstY = dstY, .dstZ = dstZ, .width = width, .height = height, .depth = depth }; NTSTATUS status; TRACE( "srcName %d, srcTarget %d, srcLevel %d, srcX %d, srcY %d, srcZ %d, dstName %d, dstTarget %d, dstLevel %d, dstX %d, dstY %d, dstZ %d, width %d, height %d, depth %d\n", srcName, srcTarget, srcLevel, srcX, srcY, srcZ, dstName, dstTarget, dstLevel, dstX, dstY, dstZ, width, height, depth ); - args.srcName = *map_context_objects( srcTarget == GL_RENDERBUFFER ? OBJ_TYPE_RENDERBUFFER : OBJ_TYPE_COUNT, 1, &srcName ); - args.dstName = *map_context_objects( dstTarget == GL_RENDERBUFFER ? OBJ_TYPE_RENDERBUFFER : OBJ_TYPE_COUNT, 1, &dstName ); + args.srcName = *map_context_objects( srcTarget == GL_RENDERBUFFER ? OBJ_TYPE_RENDERBUFFER : OBJ_TYPE_TEXTURE, 1, &srcName ); + args.dstName = *map_context_objects( dstTarget == GL_RENDERBUFFER ? OBJ_TYPE_RENDERBUFFER : OBJ_TYPE_TEXTURE, 1, &dstName ); if ((status = UNIX_CALL( glCopyImageSubDataNV, &args ))) WARN( "glCopyImageSubDataNV returned %#lx\n", status ); } @@ -5281,65 +5337,78 @@ static void WINAPI glCopyTexSubImage3DEXT( GLenum target, GLint level, GLint xof static void WINAPI glCopyTextureImage1DEXT( GLuint texture, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border ) { - struct glCopyTextureImage1DEXT_params args = { .teb = NtCurrentTeb(), .texture = texture, .target = target, .level = level, .internalformat = internalformat, .x = x, .y = y, .width = width, .border = border }; + struct glCopyTextureImage1DEXT_params args = { .teb = NtCurrentTeb(), .target = target, .level = level, .internalformat = internalformat, .x = x, .y = y, .width = width, .border = border }; NTSTATUS status; TRACE( "texture %d, target %d, level %d, internalformat %d, x %d, y %d, width %d, border %d\n", texture, target, level, internalformat, x, y, width, border ); + if (!alloc_context_objects( OBJ_TYPE_TEXTURE, 1, &texture, TRUE )) return; + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glCopyTextureImage1DEXT, &args ))) WARN( "glCopyTextureImage1DEXT returned %#lx\n", status ); } static void WINAPI glCopyTextureImage2DEXT( GLuint texture, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border ) { - struct glCopyTextureImage2DEXT_params args = { .teb = NtCurrentTeb(), .texture = texture, .target = target, .level = level, .internalformat = internalformat, .x = x, .y = y, .width = width, .height = height, .border = border }; + struct glCopyTextureImage2DEXT_params args = { .teb = NtCurrentTeb(), .target = target, .level = level, .internalformat = internalformat, .x = x, .y = y, .width = width, .height = height, .border = border }; NTSTATUS status; TRACE( "texture %d, target %d, level %d, internalformat %d, x %d, y %d, width %d, height %d, border %d\n", texture, target, level, internalformat, x, y, width, height, border ); + if (!alloc_context_objects( OBJ_TYPE_TEXTURE, 1, &texture, TRUE )) return; + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glCopyTextureImage2DEXT, &args ))) WARN( "glCopyTextureImage2DEXT returned %#lx\n", status ); } static void WINAPI glCopyTextureSubImage1D( GLuint texture, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width ) { - struct glCopyTextureSubImage1D_params args = { .teb = NtCurrentTeb(), .texture = texture, .level = level, .xoffset = xoffset, .x = x, .y = y, .width = width }; + struct glCopyTextureSubImage1D_params args = { .teb = NtCurrentTeb(), .level = level, .xoffset = xoffset, .x = x, .y = y, .width = width }; NTSTATUS status; TRACE( "texture %d, level %d, xoffset %d, x %d, y %d, width %d\n", texture, level, xoffset, x, y, width ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glCopyTextureSubImage1D, &args ))) WARN( "glCopyTextureSubImage1D returned %#lx\n", status ); } static void WINAPI glCopyTextureSubImage1DEXT( GLuint texture, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width ) { - struct glCopyTextureSubImage1DEXT_params args = { .teb = NtCurrentTeb(), .texture = texture, .target = target, .level = level, .xoffset = xoffset, .x = x, .y = y, .width = width }; + struct glCopyTextureSubImage1DEXT_params args = { .teb = NtCurrentTeb(), .target = target, .level = level, .xoffset = xoffset, .x = x, .y = y, .width = width }; NTSTATUS status; TRACE( "texture %d, target %d, level %d, xoffset %d, x %d, y %d, width %d\n", texture, target, level, xoffset, x, y, width ); + if (!alloc_context_objects( OBJ_TYPE_TEXTURE, 1, &texture, TRUE )) return; + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glCopyTextureSubImage1DEXT, &args ))) WARN( "glCopyTextureSubImage1DEXT returned %#lx\n", status ); } static void WINAPI glCopyTextureSubImage2D( GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height ) { - struct glCopyTextureSubImage2D_params args = { .teb = NtCurrentTeb(), .texture = texture, .level = level, .xoffset = xoffset, .yoffset = yoffset, .x = x, .y = y, .width = width, .height = height }; + struct glCopyTextureSubImage2D_params args = { .teb = NtCurrentTeb(), .level = level, .xoffset = xoffset, .yoffset = yoffset, .x = x, .y = y, .width = width, .height = height }; NTSTATUS status; TRACE( "texture %d, level %d, xoffset %d, yoffset %d, x %d, y %d, width %d, height %d\n", texture, level, xoffset, yoffset, x, y, width, height ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glCopyTextureSubImage2D, &args ))) WARN( "glCopyTextureSubImage2D returned %#lx\n", status ); } static void WINAPI glCopyTextureSubImage2DEXT( GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height ) { - struct glCopyTextureSubImage2DEXT_params args = { .teb = NtCurrentTeb(), .texture = texture, .target = target, .level = level, .xoffset = xoffset, .yoffset = yoffset, .x = x, .y = y, .width = width, .height = height }; + struct glCopyTextureSubImage2DEXT_params args = { .teb = NtCurrentTeb(), .target = target, .level = level, .xoffset = xoffset, .yoffset = yoffset, .x = x, .y = y, .width = width, .height = height }; NTSTATUS status; TRACE( "texture %d, target %d, level %d, xoffset %d, yoffset %d, x %d, y %d, width %d, height %d\n", texture, target, level, xoffset, yoffset, x, y, width, height ); + if (!alloc_context_objects( OBJ_TYPE_TEXTURE, 1, &texture, TRUE )) return; + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glCopyTextureSubImage2DEXT, &args ))) WARN( "glCopyTextureSubImage2DEXT returned %#lx\n", status ); } static void WINAPI glCopyTextureSubImage3D( GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height ) { - struct glCopyTextureSubImage3D_params args = { .teb = NtCurrentTeb(), .texture = texture, .level = level, .xoffset = xoffset, .yoffset = yoffset, .zoffset = zoffset, .x = x, .y = y, .width = width, .height = height }; + struct glCopyTextureSubImage3D_params args = { .teb = NtCurrentTeb(), .level = level, .xoffset = xoffset, .yoffset = yoffset, .zoffset = zoffset, .x = x, .y = y, .width = width, .height = height }; NTSTATUS status; TRACE( "texture %d, level %d, xoffset %d, yoffset %d, zoffset %d, x %d, y %d, width %d, height %d\n", texture, level, xoffset, yoffset, zoffset, x, y, width, height ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glCopyTextureSubImage3D, &args ))) WARN( "glCopyTextureSubImage3D returned %#lx\n", status ); } static void WINAPI glCopyTextureSubImage3DEXT( GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height ) { - struct glCopyTextureSubImage3DEXT_params args = { .teb = NtCurrentTeb(), .texture = texture, .target = target, .level = level, .xoffset = xoffset, .yoffset = yoffset, .zoffset = zoffset, .x = x, .y = y, .width = width, .height = height }; + struct glCopyTextureSubImage3DEXT_params args = { .teb = NtCurrentTeb(), .target = target, .level = level, .xoffset = xoffset, .yoffset = yoffset, .zoffset = zoffset, .x = x, .y = y, .width = width, .height = height }; NTSTATUS status; TRACE( "texture %d, target %d, level %d, xoffset %d, yoffset %d, zoffset %d, x %d, y %d, width %d, height %d\n", texture, target, level, xoffset, yoffset, zoffset, x, y, width, height ); + if (!alloc_context_objects( OBJ_TYPE_TEXTURE, 1, &texture, TRUE )) return; + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glCopyTextureSubImage3DEXT, &args ))) WARN( "glCopyTextureSubImage3DEXT returned %#lx\n", status ); } @@ -5551,6 +5620,7 @@ static void WINAPI glCreateTextures( GLenum target, GLsizei n, GLuint *textures NTSTATUS status; TRACE( "target %d, n %d, textures %p\n", target, n, textures ); if ((status = UNIX_CALL( glCreateTextures, &args ))) WARN( "glCreateTextures returned %#lx\n", status ); + if (n > 0) put_context_objects( OBJ_TYPE_TEXTURE, n, textures ); } static void WINAPI glCreateTransformFeedbacks( GLsizei n, GLuint *ids ) @@ -5972,10 +6042,14 @@ static void WINAPI glDeleteStatesNV( GLsizei n, const GLuint *states ) static void WINAPI glDeleteTexturesEXT( GLsizei n, const GLuint *textures ) { - struct glDeleteTexturesEXT_params args = { .teb = NtCurrentTeb(), .n = n, .textures = textures }; + GLuint textures_buf[64], *textures_tmp; + struct glDeleteTexturesEXT_params args = { .teb = NtCurrentTeb(), .n = n }; NTSTATUS status; TRACE( "n %d, textures %p\n", n, textures ); + textures_tmp = n > 0 ? memdup_objects( n, textures, textures_buf, ARRAY_SIZE(textures_buf) ) : NULL; + args.textures = n > 0 ? del_context_objects( OBJ_TYPE_TEXTURE, n, textures_tmp ) : NULL; if ((status = UNIX_CALL( glDeleteTexturesEXT, &args ))) WARN( "glDeleteTexturesEXT returned %#lx\n", status ); + if (textures_tmp != textures_buf) free( textures_tmp ); } static void WINAPI glDeleteTransformFeedbacks( GLsizei n, const GLuint *ids ) @@ -6526,9 +6600,10 @@ static void WINAPI glDrawRangeElementsEXT( GLenum mode, GLuint start, GLuint end static void WINAPI glDrawTextureNV( GLuint texture, GLuint sampler, GLfloat x0, GLfloat y0, GLfloat x1, GLfloat y1, GLfloat z, GLfloat s0, GLfloat t0, GLfloat s1, GLfloat t1 ) { - struct glDrawTextureNV_params args = { .teb = NtCurrentTeb(), .texture = texture, .sampler = sampler, .x0 = x0, .y0 = y0, .x1 = x1, .y1 = y1, .z = z, .s0 = s0, .t0 = t0, .s1 = s1, .t1 = t1 }; + struct glDrawTextureNV_params args = { .teb = NtCurrentTeb(), .sampler = sampler, .x0 = x0, .y0 = y0, .x1 = x1, .y1 = y1, .z = z, .s0 = s0, .t0 = t0, .s1 = s1, .t1 = t1 }; NTSTATUS status; TRACE( "texture %d, sampler %d, x0 %f, y0 %f, x1 %f, y1 %f, z %f, s0 %f, t0 %f, s1 %f, t1 %f\n", texture, sampler, x0, y0, x1, y1, z, s0, t0, s1, t1 ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glDrawTextureNV, &args ))) WARN( "glDrawTextureNV returned %#lx\n", status ); } @@ -6590,9 +6665,10 @@ static void WINAPI glEGLImageTargetTexStorageEXT( GLenum target, GLeglImageOES i static void WINAPI glEGLImageTargetTextureStorageEXT( GLuint texture, GLeglImageOES image, const GLint* attrib_list ) { - struct glEGLImageTargetTextureStorageEXT_params args = { .teb = NtCurrentTeb(), .texture = texture, .image = image, .attrib_list = attrib_list }; + struct glEGLImageTargetTextureStorageEXT_params args = { .teb = NtCurrentTeb(), .image = image, .attrib_list = attrib_list }; NTSTATUS status; TRACE( "texture %d, image %p, attrib_list %p\n", texture, image, attrib_list ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glEGLImageTargetTextureStorageEXT, &args ))) WARN( "glEGLImageTargetTextureStorageEXT returned %#lx\n", status ); } @@ -7418,129 +7494,145 @@ static void WINAPI glFramebufferSamplePositionsfvAMD( GLenum target, GLuint nums static void WINAPI glFramebufferShadingRateEXT( GLenum target, GLenum attachment, GLuint texture, GLint baseLayer, GLsizei numLayers, GLsizei texelWidth, GLsizei texelHeight ) { - struct glFramebufferShadingRateEXT_params args = { .teb = NtCurrentTeb(), .target = target, .attachment = attachment, .texture = texture, .baseLayer = baseLayer, .numLayers = numLayers, .texelWidth = texelWidth, .texelHeight = texelHeight }; + struct glFramebufferShadingRateEXT_params args = { .teb = NtCurrentTeb(), .target = target, .attachment = attachment, .baseLayer = baseLayer, .numLayers = numLayers, .texelWidth = texelWidth, .texelHeight = texelHeight }; NTSTATUS status; TRACE( "target %d, attachment %d, texture %d, baseLayer %d, numLayers %d, texelWidth %d, texelHeight %d\n", target, attachment, texture, baseLayer, numLayers, texelWidth, texelHeight ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glFramebufferShadingRateEXT, &args ))) WARN( "glFramebufferShadingRateEXT returned %#lx\n", status ); } static void WINAPI glFramebufferTexture( GLenum target, GLenum attachment, GLuint texture, GLint level ) { - struct glFramebufferTexture_params args = { .teb = NtCurrentTeb(), .target = target, .attachment = attachment, .texture = texture, .level = level }; + struct glFramebufferTexture_params args = { .teb = NtCurrentTeb(), .target = target, .attachment = attachment, .level = level }; NTSTATUS status; TRACE( "target %d, attachment %d, texture %d, level %d\n", target, attachment, texture, level ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glFramebufferTexture, &args ))) WARN( "glFramebufferTexture returned %#lx\n", status ); } static void WINAPI glFramebufferTexture1D( GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level ) { - struct glFramebufferTexture1D_params args = { .teb = NtCurrentTeb(), .target = target, .attachment = attachment, .textarget = textarget, .texture = texture, .level = level }; + struct glFramebufferTexture1D_params args = { .teb = NtCurrentTeb(), .target = target, .attachment = attachment, .textarget = textarget, .level = level }; NTSTATUS status; TRACE( "target %d, attachment %d, textarget %d, texture %d, level %d\n", target, attachment, textarget, texture, level ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glFramebufferTexture1D, &args ))) WARN( "glFramebufferTexture1D returned %#lx\n", status ); } static void WINAPI glFramebufferTexture1DEXT( GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level ) { - struct glFramebufferTexture1DEXT_params args = { .teb = NtCurrentTeb(), .target = target, .attachment = attachment, .textarget = textarget, .texture = texture, .level = level }; + struct glFramebufferTexture1DEXT_params args = { .teb = NtCurrentTeb(), .target = target, .attachment = attachment, .textarget = textarget, .level = level }; NTSTATUS status; TRACE( "target %d, attachment %d, textarget %d, texture %d, level %d\n", target, attachment, textarget, texture, level ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glFramebufferTexture1DEXT, &args ))) WARN( "glFramebufferTexture1DEXT returned %#lx\n", status ); } static void WINAPI glFramebufferTexture2D( GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level ) { - struct glFramebufferTexture2D_params args = { .teb = NtCurrentTeb(), .target = target, .attachment = attachment, .textarget = textarget, .texture = texture, .level = level }; + struct glFramebufferTexture2D_params args = { .teb = NtCurrentTeb(), .target = target, .attachment = attachment, .textarget = textarget, .level = level }; NTSTATUS status; TRACE( "target %d, attachment %d, textarget %d, texture %d, level %d\n", target, attachment, textarget, texture, level ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glFramebufferTexture2D, &args ))) WARN( "glFramebufferTexture2D returned %#lx\n", status ); } static void WINAPI glFramebufferTexture2DEXT( GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level ) { - struct glFramebufferTexture2DEXT_params args = { .teb = NtCurrentTeb(), .target = target, .attachment = attachment, .textarget = textarget, .texture = texture, .level = level }; + struct glFramebufferTexture2DEXT_params args = { .teb = NtCurrentTeb(), .target = target, .attachment = attachment, .textarget = textarget, .level = level }; NTSTATUS status; TRACE( "target %d, attachment %d, textarget %d, texture %d, level %d\n", target, attachment, textarget, texture, level ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glFramebufferTexture2DEXT, &args ))) WARN( "glFramebufferTexture2DEXT returned %#lx\n", status ); } static void WINAPI glFramebufferTexture3D( GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset ) { - struct glFramebufferTexture3D_params args = { .teb = NtCurrentTeb(), .target = target, .attachment = attachment, .textarget = textarget, .texture = texture, .level = level, .zoffset = zoffset }; + struct glFramebufferTexture3D_params args = { .teb = NtCurrentTeb(), .target = target, .attachment = attachment, .textarget = textarget, .level = level, .zoffset = zoffset }; NTSTATUS status; TRACE( "target %d, attachment %d, textarget %d, texture %d, level %d, zoffset %d\n", target, attachment, textarget, texture, level, zoffset ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glFramebufferTexture3D, &args ))) WARN( "glFramebufferTexture3D returned %#lx\n", status ); } static void WINAPI glFramebufferTexture3DEXT( GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset ) { - struct glFramebufferTexture3DEXT_params args = { .teb = NtCurrentTeb(), .target = target, .attachment = attachment, .textarget = textarget, .texture = texture, .level = level, .zoffset = zoffset }; + struct glFramebufferTexture3DEXT_params args = { .teb = NtCurrentTeb(), .target = target, .attachment = attachment, .textarget = textarget, .level = level, .zoffset = zoffset }; NTSTATUS status; TRACE( "target %d, attachment %d, textarget %d, texture %d, level %d, zoffset %d\n", target, attachment, textarget, texture, level, zoffset ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glFramebufferTexture3DEXT, &args ))) WARN( "glFramebufferTexture3DEXT returned %#lx\n", status ); } static void WINAPI glFramebufferTextureARB( GLenum target, GLenum attachment, GLuint texture, GLint level ) { - struct glFramebufferTextureARB_params args = { .teb = NtCurrentTeb(), .target = target, .attachment = attachment, .texture = texture, .level = level }; + struct glFramebufferTextureARB_params args = { .teb = NtCurrentTeb(), .target = target, .attachment = attachment, .level = level }; NTSTATUS status; TRACE( "target %d, attachment %d, texture %d, level %d\n", target, attachment, texture, level ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glFramebufferTextureARB, &args ))) WARN( "glFramebufferTextureARB returned %#lx\n", status ); } static void WINAPI glFramebufferTextureEXT( GLenum target, GLenum attachment, GLuint texture, GLint level ) { - struct glFramebufferTextureEXT_params args = { .teb = NtCurrentTeb(), .target = target, .attachment = attachment, .texture = texture, .level = level }; + struct glFramebufferTextureEXT_params args = { .teb = NtCurrentTeb(), .target = target, .attachment = attachment, .level = level }; NTSTATUS status; TRACE( "target %d, attachment %d, texture %d, level %d\n", target, attachment, texture, level ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glFramebufferTextureEXT, &args ))) WARN( "glFramebufferTextureEXT returned %#lx\n", status ); } static void WINAPI glFramebufferTextureFaceARB( GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face ) { - struct glFramebufferTextureFaceARB_params args = { .teb = NtCurrentTeb(), .target = target, .attachment = attachment, .texture = texture, .level = level, .face = face }; + struct glFramebufferTextureFaceARB_params args = { .teb = NtCurrentTeb(), .target = target, .attachment = attachment, .level = level, .face = face }; NTSTATUS status; TRACE( "target %d, attachment %d, texture %d, level %d, face %d\n", target, attachment, texture, level, face ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glFramebufferTextureFaceARB, &args ))) WARN( "glFramebufferTextureFaceARB returned %#lx\n", status ); } static void WINAPI glFramebufferTextureFaceEXT( GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face ) { - struct glFramebufferTextureFaceEXT_params args = { .teb = NtCurrentTeb(), .target = target, .attachment = attachment, .texture = texture, .level = level, .face = face }; + struct glFramebufferTextureFaceEXT_params args = { .teb = NtCurrentTeb(), .target = target, .attachment = attachment, .level = level, .face = face }; NTSTATUS status; TRACE( "target %d, attachment %d, texture %d, level %d, face %d\n", target, attachment, texture, level, face ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glFramebufferTextureFaceEXT, &args ))) WARN( "glFramebufferTextureFaceEXT returned %#lx\n", status ); } static void WINAPI glFramebufferTextureLayer( GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer ) { - struct glFramebufferTextureLayer_params args = { .teb = NtCurrentTeb(), .target = target, .attachment = attachment, .texture = texture, .level = level, .layer = layer }; + struct glFramebufferTextureLayer_params args = { .teb = NtCurrentTeb(), .target = target, .attachment = attachment, .level = level, .layer = layer }; NTSTATUS status; TRACE( "target %d, attachment %d, texture %d, level %d, layer %d\n", target, attachment, texture, level, layer ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glFramebufferTextureLayer, &args ))) WARN( "glFramebufferTextureLayer returned %#lx\n", status ); } static void WINAPI glFramebufferTextureLayerARB( GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer ) { - struct glFramebufferTextureLayerARB_params args = { .teb = NtCurrentTeb(), .target = target, .attachment = attachment, .texture = texture, .level = level, .layer = layer }; + struct glFramebufferTextureLayerARB_params args = { .teb = NtCurrentTeb(), .target = target, .attachment = attachment, .level = level, .layer = layer }; NTSTATUS status; TRACE( "target %d, attachment %d, texture %d, level %d, layer %d\n", target, attachment, texture, level, layer ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glFramebufferTextureLayerARB, &args ))) WARN( "glFramebufferTextureLayerARB returned %#lx\n", status ); } static void WINAPI glFramebufferTextureLayerEXT( GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer ) { - struct glFramebufferTextureLayerEXT_params args = { .teb = NtCurrentTeb(), .target = target, .attachment = attachment, .texture = texture, .level = level, .layer = layer }; + struct glFramebufferTextureLayerEXT_params args = { .teb = NtCurrentTeb(), .target = target, .attachment = attachment, .level = level, .layer = layer }; NTSTATUS status; TRACE( "target %d, attachment %d, texture %d, level %d, layer %d\n", target, attachment, texture, level, layer ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glFramebufferTextureLayerEXT, &args ))) WARN( "glFramebufferTextureLayerEXT returned %#lx\n", status ); } static void WINAPI glFramebufferTextureMultiviewOVR( GLenum target, GLenum attachment, GLuint texture, GLint level, GLint baseViewIndex, GLsizei numViews ) { - struct glFramebufferTextureMultiviewOVR_params args = { .teb = NtCurrentTeb(), .target = target, .attachment = attachment, .texture = texture, .level = level, .baseViewIndex = baseViewIndex, .numViews = numViews }; + struct glFramebufferTextureMultiviewOVR_params args = { .teb = NtCurrentTeb(), .target = target, .attachment = attachment, .level = level, .baseViewIndex = baseViewIndex, .numViews = numViews }; NTSTATUS status; TRACE( "target %d, attachment %d, texture %d, level %d, baseViewIndex %d, numViews %d\n", target, attachment, texture, level, baseViewIndex, numViews ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glFramebufferTextureMultiviewOVR, &args ))) WARN( "glFramebufferTextureMultiviewOVR returned %#lx\n", status ); } @@ -7785,6 +7877,7 @@ static void WINAPI glGenTexturesEXT( GLsizei n, GLuint *textures ) NTSTATUS status; TRACE( "n %d, textures %p\n", n, textures ); if ((status = UNIX_CALL( glGenTexturesEXT, &args ))) WARN( "glGenTexturesEXT returned %#lx\n", status ); + if (n > 0) put_context_objects( OBJ_TYPE_TEXTURE, n, textures ); } static void WINAPI glGenTransformFeedbacks( GLsizei n, GLuint *ids ) @@ -7854,17 +7947,20 @@ static void WINAPI glGenerateMultiTexMipmapEXT( GLenum texunit, GLenum target ) static void WINAPI glGenerateTextureMipmap( GLuint texture ) { - struct glGenerateTextureMipmap_params args = { .teb = NtCurrentTeb(), .texture = texture }; + struct glGenerateTextureMipmap_params args = { .teb = NtCurrentTeb() }; NTSTATUS status; TRACE( "texture %d\n", texture ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glGenerateTextureMipmap, &args ))) WARN( "glGenerateTextureMipmap returned %#lx\n", status ); } static void WINAPI glGenerateTextureMipmapEXT( GLuint texture, GLenum target ) { - struct glGenerateTextureMipmapEXT_params args = { .teb = NtCurrentTeb(), .texture = texture, .target = target }; + struct glGenerateTextureMipmapEXT_params args = { .teb = NtCurrentTeb(), .target = target }; NTSTATUS status; TRACE( "texture %d, target %d\n", texture, target ); + if (!alloc_context_objects( OBJ_TYPE_TEXTURE, 1, &texture, TRUE )) return; + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glGenerateTextureMipmapEXT, &args ))) WARN( "glGenerateTextureMipmapEXT returned %#lx\n", status ); } @@ -8285,25 +8381,29 @@ static void WINAPI glGetCompressedTexImageARB( GLenum target, GLint level, void static void WINAPI glGetCompressedTextureImage( GLuint texture, GLint level, GLsizei bufSize, void *pixels ) { - struct glGetCompressedTextureImage_params args = { .teb = NtCurrentTeb(), .texture = texture, .level = level, .bufSize = bufSize, .pixels = pixels }; + struct glGetCompressedTextureImage_params args = { .teb = NtCurrentTeb(), .level = level, .bufSize = bufSize, .pixels = pixels }; NTSTATUS status; TRACE( "texture %d, level %d, bufSize %d, pixels %p\n", texture, level, bufSize, pixels ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glGetCompressedTextureImage, &args ))) WARN( "glGetCompressedTextureImage returned %#lx\n", status ); } static void WINAPI glGetCompressedTextureImageEXT( GLuint texture, GLenum target, GLint lod, void *img ) { - struct glGetCompressedTextureImageEXT_params args = { .teb = NtCurrentTeb(), .texture = texture, .target = target, .lod = lod, .img = img }; + struct glGetCompressedTextureImageEXT_params args = { .teb = NtCurrentTeb(), .target = target, .lod = lod, .img = img }; NTSTATUS status; TRACE( "texture %d, target %d, lod %d, img %p\n", texture, target, lod, img ); + if (!alloc_context_objects( OBJ_TYPE_TEXTURE, 1, &texture, TRUE )) return; + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glGetCompressedTextureImageEXT, &args ))) WARN( "glGetCompressedTextureImageEXT returned %#lx\n", status ); } static void WINAPI glGetCompressedTextureSubImage( GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei bufSize, void *pixels ) { - struct glGetCompressedTextureSubImage_params args = { .teb = NtCurrentTeb(), .texture = texture, .level = level, .xoffset = xoffset, .yoffset = yoffset, .zoffset = zoffset, .width = width, .height = height, .depth = depth, .bufSize = bufSize, .pixels = pixels }; + struct glGetCompressedTextureSubImage_params args = { .teb = NtCurrentTeb(), .level = level, .xoffset = xoffset, .yoffset = yoffset, .zoffset = zoffset, .width = width, .height = height, .depth = depth, .bufSize = bufSize, .pixels = pixels }; NTSTATUS status; TRACE( "texture %d, level %d, xoffset %d, yoffset %d, zoffset %d, width %d, height %d, depth %d, bufSize %d, pixels %p\n", texture, level, xoffset, yoffset, zoffset, width, height, depth, bufSize, pixels ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glGetCompressedTextureSubImage, &args ))) WARN( "glGetCompressedTextureSubImage returned %#lx\n", status ); } @@ -8712,18 +8812,20 @@ static void WINAPI glGetHistogramParameterxvOES( GLenum target, GLenum pname, GL static GLuint64 WINAPI glGetImageHandleARB( GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum format ) { - struct glGetImageHandleARB_params args = { .teb = NtCurrentTeb(), .texture = texture, .level = level, .layered = layered, .layer = layer, .format = format }; + struct glGetImageHandleARB_params args = { .teb = NtCurrentTeb(), .level = level, .layered = layered, .layer = layer, .format = format }; NTSTATUS status; TRACE( "texture %d, level %d, layered %d, layer %d, format %d\n", texture, level, layered, layer, format ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glGetImageHandleARB, &args ))) WARN( "glGetImageHandleARB returned %#lx\n", status ); return args.ret; } static GLuint64 WINAPI glGetImageHandleNV( GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum format ) { - struct glGetImageHandleNV_params args = { .teb = NtCurrentTeb(), .texture = texture, .level = level, .layered = layered, .layer = layer, .format = format }; + struct glGetImageHandleNV_params args = { .teb = NtCurrentTeb(), .level = level, .layered = layered, .layer = layer, .format = format }; NTSTATUS status; TRACE( "texture %d, level %d, layered %d, layer %d, format %d\n", texture, level, layered, layer, format ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glGetImageHandleNV, &args ))) WARN( "glGetImageHandleNV returned %#lx\n", status ); return args.ret; } @@ -10367,165 +10469,191 @@ static void WINAPI glGetTexParameterxvOES( GLenum target, GLenum pname, GLfixed static GLuint64 WINAPI glGetTextureHandleARB( GLuint texture ) { - struct glGetTextureHandleARB_params args = { .teb = NtCurrentTeb(), .texture = texture }; + struct glGetTextureHandleARB_params args = { .teb = NtCurrentTeb() }; NTSTATUS status; TRACE( "texture %d\n", texture ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glGetTextureHandleARB, &args ))) WARN( "glGetTextureHandleARB returned %#lx\n", status ); return args.ret; } static GLuint64 WINAPI glGetTextureHandleNV( GLuint texture ) { - struct glGetTextureHandleNV_params args = { .teb = NtCurrentTeb(), .texture = texture }; + struct glGetTextureHandleNV_params args = { .teb = NtCurrentTeb() }; NTSTATUS status; TRACE( "texture %d\n", texture ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glGetTextureHandleNV, &args ))) WARN( "glGetTextureHandleNV returned %#lx\n", status ); return args.ret; } static void WINAPI glGetTextureImage( GLuint texture, GLint level, GLenum format, GLenum type, GLsizei bufSize, void *pixels ) { - struct glGetTextureImage_params args = { .teb = NtCurrentTeb(), .texture = texture, .level = level, .format = format, .type = type, .bufSize = bufSize, .pixels = pixels }; + struct glGetTextureImage_params args = { .teb = NtCurrentTeb(), .level = level, .format = format, .type = type, .bufSize = bufSize, .pixels = pixels }; NTSTATUS status; TRACE( "texture %d, level %d, format %d, type %d, bufSize %d, pixels %p\n", texture, level, format, type, bufSize, pixels ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glGetTextureImage, &args ))) WARN( "glGetTextureImage returned %#lx\n", status ); } static void WINAPI glGetTextureImageEXT( GLuint texture, GLenum target, GLint level, GLenum format, GLenum type, void *pixels ) { - struct glGetTextureImageEXT_params args = { .teb = NtCurrentTeb(), .texture = texture, .target = target, .level = level, .format = format, .type = type, .pixels = pixels }; + struct glGetTextureImageEXT_params args = { .teb = NtCurrentTeb(), .target = target, .level = level, .format = format, .type = type, .pixels = pixels }; NTSTATUS status; TRACE( "texture %d, target %d, level %d, format %d, type %d, pixels %p\n", texture, target, level, format, type, pixels ); + if (!alloc_context_objects( OBJ_TYPE_TEXTURE, 1, &texture, TRUE )) return; + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glGetTextureImageEXT, &args ))) WARN( "glGetTextureImageEXT returned %#lx\n", status ); } static void WINAPI glGetTextureLevelParameterfv( GLuint texture, GLint level, GLenum pname, GLfloat *params ) { - struct glGetTextureLevelParameterfv_params args = { .teb = NtCurrentTeb(), .texture = texture, .level = level, .pname = pname, .params = params }; + struct glGetTextureLevelParameterfv_params args = { .teb = NtCurrentTeb(), .level = level, .pname = pname, .params = params }; NTSTATUS status; int integer; TRACE( "texture %d, level %d, pname %d, params %p\n", texture, level, pname, params ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glGetTextureLevelParameterfv, &args ))) WARN( "glGetTextureLevelParameterfv returned %#lx\n", status ); else if (get_integer( pname, 0, *params, &integer )) *params = integer; } static void WINAPI glGetTextureLevelParameterfvEXT( GLuint texture, GLenum target, GLint level, GLenum pname, GLfloat *params ) { - struct glGetTextureLevelParameterfvEXT_params args = { .teb = NtCurrentTeb(), .texture = texture, .target = target, .level = level, .pname = pname, .params = params }; + struct glGetTextureLevelParameterfvEXT_params args = { .teb = NtCurrentTeb(), .target = target, .level = level, .pname = pname, .params = params }; NTSTATUS status; int integer; TRACE( "texture %d, target %d, level %d, pname %d, params %p\n", texture, target, level, pname, params ); + if (!alloc_context_objects( OBJ_TYPE_TEXTURE, 1, &texture, TRUE )) return; + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glGetTextureLevelParameterfvEXT, &args ))) WARN( "glGetTextureLevelParameterfvEXT returned %#lx\n", status ); else if (get_integer( pname, 0, *params, &integer )) *params = integer; } static void WINAPI glGetTextureLevelParameteriv( GLuint texture, GLint level, GLenum pname, GLint *params ) { - struct glGetTextureLevelParameteriv_params args = { .teb = NtCurrentTeb(), .texture = texture, .level = level, .pname = pname, .params = params }; + struct glGetTextureLevelParameteriv_params args = { .teb = NtCurrentTeb(), .level = level, .pname = pname, .params = params }; NTSTATUS status; int integer; TRACE( "texture %d, level %d, pname %d, params %p\n", texture, level, pname, params ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glGetTextureLevelParameteriv, &args ))) WARN( "glGetTextureLevelParameteriv returned %#lx\n", status ); else if (get_integer( pname, 0, *params, &integer )) *params = integer; } static void WINAPI glGetTextureLevelParameterivEXT( GLuint texture, GLenum target, GLint level, GLenum pname, GLint *params ) { - struct glGetTextureLevelParameterivEXT_params args = { .teb = NtCurrentTeb(), .texture = texture, .target = target, .level = level, .pname = pname, .params = params }; + struct glGetTextureLevelParameterivEXT_params args = { .teb = NtCurrentTeb(), .target = target, .level = level, .pname = pname, .params = params }; NTSTATUS status; int integer; TRACE( "texture %d, target %d, level %d, pname %d, params %p\n", texture, target, level, pname, params ); + if (!alloc_context_objects( OBJ_TYPE_TEXTURE, 1, &texture, TRUE )) return; + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glGetTextureLevelParameterivEXT, &args ))) WARN( "glGetTextureLevelParameterivEXT returned %#lx\n", status ); else if (get_integer( pname, 0, *params, &integer )) *params = integer; } static void WINAPI glGetTextureParameterIiv( GLuint texture, GLenum pname, GLint *params ) { - struct glGetTextureParameterIiv_params args = { .teb = NtCurrentTeb(), .texture = texture, .pname = pname, .params = params }; + struct glGetTextureParameterIiv_params args = { .teb = NtCurrentTeb(), .pname = pname, .params = params }; NTSTATUS status; TRACE( "texture %d, pname %d, params %p\n", texture, pname, params ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glGetTextureParameterIiv, &args ))) WARN( "glGetTextureParameterIiv returned %#lx\n", status ); } static void WINAPI glGetTextureParameterIivEXT( GLuint texture, GLenum target, GLenum pname, GLint *params ) { - struct glGetTextureParameterIivEXT_params args = { .teb = NtCurrentTeb(), .texture = texture, .target = target, .pname = pname, .params = params }; + struct glGetTextureParameterIivEXT_params args = { .teb = NtCurrentTeb(), .target = target, .pname = pname, .params = params }; NTSTATUS status; TRACE( "texture %d, target %d, pname %d, params %p\n", texture, target, pname, params ); + if (!alloc_context_objects( OBJ_TYPE_TEXTURE, 1, &texture, TRUE )) return; + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glGetTextureParameterIivEXT, &args ))) WARN( "glGetTextureParameterIivEXT returned %#lx\n", status ); } static void WINAPI glGetTextureParameterIuiv( GLuint texture, GLenum pname, GLuint *params ) { - struct glGetTextureParameterIuiv_params args = { .teb = NtCurrentTeb(), .texture = texture, .pname = pname, .params = params }; + struct glGetTextureParameterIuiv_params args = { .teb = NtCurrentTeb(), .pname = pname, .params = params }; NTSTATUS status; TRACE( "texture %d, pname %d, params %p\n", texture, pname, params ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glGetTextureParameterIuiv, &args ))) WARN( "glGetTextureParameterIuiv returned %#lx\n", status ); } static void WINAPI glGetTextureParameterIuivEXT( GLuint texture, GLenum target, GLenum pname, GLuint *params ) { - struct glGetTextureParameterIuivEXT_params args = { .teb = NtCurrentTeb(), .texture = texture, .target = target, .pname = pname, .params = params }; + struct glGetTextureParameterIuivEXT_params args = { .teb = NtCurrentTeb(), .target = target, .pname = pname, .params = params }; NTSTATUS status; TRACE( "texture %d, target %d, pname %d, params %p\n", texture, target, pname, params ); + if (!alloc_context_objects( OBJ_TYPE_TEXTURE, 1, &texture, TRUE )) return; + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glGetTextureParameterIuivEXT, &args ))) WARN( "glGetTextureParameterIuivEXT returned %#lx\n", status ); } static void WINAPI glGetTextureParameterfv( GLuint texture, GLenum pname, GLfloat *params ) { - struct glGetTextureParameterfv_params args = { .teb = NtCurrentTeb(), .texture = texture, .pname = pname, .params = params }; + struct glGetTextureParameterfv_params args = { .teb = NtCurrentTeb(), .pname = pname, .params = params }; NTSTATUS status; TRACE( "texture %d, pname %d, params %p\n", texture, pname, params ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glGetTextureParameterfv, &args ))) WARN( "glGetTextureParameterfv returned %#lx\n", status ); } static void WINAPI glGetTextureParameterfvEXT( GLuint texture, GLenum target, GLenum pname, GLfloat *params ) { - struct glGetTextureParameterfvEXT_params args = { .teb = NtCurrentTeb(), .texture = texture, .target = target, .pname = pname, .params = params }; + struct glGetTextureParameterfvEXT_params args = { .teb = NtCurrentTeb(), .target = target, .pname = pname, .params = params }; NTSTATUS status; TRACE( "texture %d, target %d, pname %d, params %p\n", texture, target, pname, params ); + if (!alloc_context_objects( OBJ_TYPE_TEXTURE, 1, &texture, TRUE )) return; + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glGetTextureParameterfvEXT, &args ))) WARN( "glGetTextureParameterfvEXT returned %#lx\n", status ); } static void WINAPI glGetTextureParameteriv( GLuint texture, GLenum pname, GLint *params ) { - struct glGetTextureParameteriv_params args = { .teb = NtCurrentTeb(), .texture = texture, .pname = pname, .params = params }; + struct glGetTextureParameteriv_params args = { .teb = NtCurrentTeb(), .pname = pname, .params = params }; NTSTATUS status; TRACE( "texture %d, pname %d, params %p\n", texture, pname, params ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glGetTextureParameteriv, &args ))) WARN( "glGetTextureParameteriv returned %#lx\n", status ); } static void WINAPI glGetTextureParameterivEXT( GLuint texture, GLenum target, GLenum pname, GLint *params ) { - struct glGetTextureParameterivEXT_params args = { .teb = NtCurrentTeb(), .texture = texture, .target = target, .pname = pname, .params = params }; + struct glGetTextureParameterivEXT_params args = { .teb = NtCurrentTeb(), .target = target, .pname = pname, .params = params }; NTSTATUS status; TRACE( "texture %d, target %d, pname %d, params %p\n", texture, target, pname, params ); + if (!alloc_context_objects( OBJ_TYPE_TEXTURE, 1, &texture, TRUE )) return; + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glGetTextureParameterivEXT, &args ))) WARN( "glGetTextureParameterivEXT returned %#lx\n", status ); } static GLuint64 WINAPI glGetTextureSamplerHandleARB( GLuint texture, GLuint sampler ) { - struct glGetTextureSamplerHandleARB_params args = { .teb = NtCurrentTeb(), .texture = texture, .sampler = sampler }; + struct glGetTextureSamplerHandleARB_params args = { .teb = NtCurrentTeb(), .sampler = sampler }; NTSTATUS status; TRACE( "texture %d, sampler %d\n", texture, sampler ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glGetTextureSamplerHandleARB, &args ))) WARN( "glGetTextureSamplerHandleARB returned %#lx\n", status ); return args.ret; } static GLuint64 WINAPI glGetTextureSamplerHandleNV( GLuint texture, GLuint sampler ) { - struct glGetTextureSamplerHandleNV_params args = { .teb = NtCurrentTeb(), .texture = texture, .sampler = sampler }; + struct glGetTextureSamplerHandleNV_params args = { .teb = NtCurrentTeb(), .sampler = sampler }; NTSTATUS status; TRACE( "texture %d, sampler %d\n", texture, sampler ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glGetTextureSamplerHandleNV, &args ))) WARN( "glGetTextureSamplerHandleNV returned %#lx\n", status ); return args.ret; } static void WINAPI glGetTextureSubImage( GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLsizei bufSize, void *pixels ) { - struct glGetTextureSubImage_params args = { .teb = NtCurrentTeb(), .texture = texture, .level = level, .xoffset = xoffset, .yoffset = yoffset, .zoffset = zoffset, .width = width, .height = height, .depth = depth, .format = format, .type = type, .bufSize = bufSize, .pixels = pixels }; + struct glGetTextureSubImage_params args = { .teb = NtCurrentTeb(), .level = level, .xoffset = xoffset, .yoffset = yoffset, .zoffset = zoffset, .width = width, .height = height, .depth = depth, .format = format, .type = type, .bufSize = bufSize, .pixels = pixels }; NTSTATUS status; TRACE( "texture %d, level %d, xoffset %d, yoffset %d, zoffset %d, width %d, height %d, depth %d, format %d, type %d, bufSize %d, pixels %p\n", texture, level, xoffset, yoffset, zoffset, width, height, depth, format, type, bufSize, pixels ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glGetTextureSubImage, &args ))) WARN( "glGetTextureSubImage returned %#lx\n", status ); } @@ -11796,17 +11924,19 @@ static void WINAPI glInvalidateSubFramebuffer( GLenum target, GLsizei numAttachm static void WINAPI glInvalidateTexImage( GLuint texture, GLint level ) { - struct glInvalidateTexImage_params args = { .teb = NtCurrentTeb(), .texture = texture, .level = level }; + struct glInvalidateTexImage_params args = { .teb = NtCurrentTeb(), .level = level }; NTSTATUS status; TRACE( "texture %d, level %d\n", texture, level ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glInvalidateTexImage, &args ))) WARN( "glInvalidateTexImage returned %#lx\n", status ); } static void WINAPI glInvalidateTexSubImage( GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth ) { - struct glInvalidateTexSubImage_params args = { .teb = NtCurrentTeb(), .texture = texture, .level = level, .xoffset = xoffset, .yoffset = yoffset, .zoffset = zoffset, .width = width, .height = height, .depth = depth }; + struct glInvalidateTexSubImage_params args = { .teb = NtCurrentTeb(), .level = level, .xoffset = xoffset, .yoffset = yoffset, .zoffset = zoffset, .width = width, .height = height, .depth = depth }; NTSTATUS status; TRACE( "texture %d, level %d, xoffset %d, yoffset %d, zoffset %d, width %d, height %d, depth %d\n", texture, level, xoffset, yoffset, zoffset, width, height, depth ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glInvalidateTexSubImage, &args ))) WARN( "glInvalidateTexSubImage returned %#lx\n", status ); } @@ -12136,9 +12266,10 @@ static GLboolean WINAPI glIsSync( GLsync sync ) static GLboolean WINAPI glIsTextureEXT( GLuint texture ) { - struct glIsTextureEXT_params args = { .teb = NtCurrentTeb(), .texture = texture }; + struct glIsTextureEXT_params args = { .teb = NtCurrentTeb() }; NTSTATUS status; TRACE( "texture %d\n", texture ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glIsTextureEXT, &args ))) WARN( "glIsTextureEXT returned %#lx\n", status ); return args.ret; } @@ -12220,8 +12351,8 @@ static void WINAPI glLGPUCopyImageSubDataNVX( GLuint sourceGpu, GLbitfield desti struct glLGPUCopyImageSubDataNVX_params args = { .teb = NtCurrentTeb(), .sourceGpu = sourceGpu, .destinationGpuMask = destinationGpuMask, .srcTarget = srcTarget, .srcLevel = srcLevel, .srcX = srcX, .srxY = srxY, .srcZ = srcZ, .dstTarget = dstTarget, .dstLevel = dstLevel, .dstX = dstX, .dstY = dstY, .dstZ = dstZ, .width = width, .height = height, .depth = depth }; NTSTATUS status; TRACE( "sourceGpu %d, destinationGpuMask %d, srcName %d, srcTarget %d, srcLevel %d, srcX %d, srxY %d, srcZ %d, dstName %d, dstTarget %d, dstLevel %d, dstX %d, dstY %d, dstZ %d, width %d, height %d, depth %d\n", sourceGpu, destinationGpuMask, srcName, srcTarget, srcLevel, srcX, srxY, srcZ, dstName, dstTarget, dstLevel, dstX, dstY, dstZ, width, height, depth ); - args.srcName = *map_context_objects( srcTarget == GL_RENDERBUFFER ? OBJ_TYPE_RENDERBUFFER : OBJ_TYPE_COUNT, 1, &srcName ); - args.dstName = *map_context_objects( dstTarget == GL_RENDERBUFFER ? OBJ_TYPE_RENDERBUFFER : OBJ_TYPE_COUNT, 1, &dstName ); + args.srcName = *map_context_objects( srcTarget == GL_RENDERBUFFER ? OBJ_TYPE_RENDERBUFFER : OBJ_TYPE_TEXTURE, 1, &srcName ); + args.dstName = *map_context_objects( dstTarget == GL_RENDERBUFFER ? OBJ_TYPE_RENDERBUFFER : OBJ_TYPE_TEXTURE, 1, &dstName ); if ((status = UNIX_CALL( glLGPUCopyImageSubDataNVX, &args ))) WARN( "glLGPUCopyImageSubDataNVX returned %#lx\n", status ); } @@ -12729,9 +12860,10 @@ static void WINAPI glMapParameterivNV( GLenum target, GLenum pname, const GLint static void * WINAPI glMapTexture2DINTEL( GLuint texture, GLint level, GLbitfield access, GLint *stride, GLenum *layout ) { - struct glMapTexture2DINTEL_params args = { .teb = NtCurrentTeb(), .texture = texture, .level = level, .access = access, .stride = stride, .layout = layout }; + struct glMapTexture2DINTEL_params args = { .teb = NtCurrentTeb(), .level = level, .access = access, .stride = stride, .layout = layout }; NTSTATUS status; TRACE( "texture %d, level %d, access %d, stride %p, layout %p\n", texture, level, access, stride, layout ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glMapTexture2DINTEL, &args ))) WARN( "glMapTexture2DINTEL returned %#lx\n", status ); return args.ret; } @@ -14652,8 +14784,8 @@ static void WINAPI glMulticastCopyImageSubDataNV( GLuint srcGpu, GLbitfield dstG struct glMulticastCopyImageSubDataNV_params args = { .teb = NtCurrentTeb(), .srcGpu = srcGpu, .dstGpuMask = dstGpuMask, .srcTarget = srcTarget, .srcLevel = srcLevel, .srcX = srcX, .srcY = srcY, .srcZ = srcZ, .dstTarget = dstTarget, .dstLevel = dstLevel, .dstX = dstX, .dstY = dstY, .dstZ = dstZ, .srcWidth = srcWidth, .srcHeight = srcHeight, .srcDepth = srcDepth }; NTSTATUS status; TRACE( "srcGpu %d, dstGpuMask %d, srcName %d, srcTarget %d, srcLevel %d, srcX %d, srcY %d, srcZ %d, dstName %d, dstTarget %d, dstLevel %d, dstX %d, dstY %d, dstZ %d, srcWidth %d, srcHeight %d, srcDepth %d\n", srcGpu, dstGpuMask, srcName, srcTarget, srcLevel, srcX, srcY, srcZ, dstName, dstTarget, dstLevel, dstX, dstY, dstZ, srcWidth, srcHeight, srcDepth ); - args.srcName = *map_context_objects( srcTarget == GL_RENDERBUFFER ? OBJ_TYPE_RENDERBUFFER : OBJ_TYPE_COUNT, 1, &srcName ); - args.dstName = *map_context_objects( dstTarget == GL_RENDERBUFFER ? OBJ_TYPE_RENDERBUFFER : OBJ_TYPE_COUNT, 1, &dstName ); + args.srcName = *map_context_objects( srcTarget == GL_RENDERBUFFER ? OBJ_TYPE_RENDERBUFFER : OBJ_TYPE_TEXTURE, 1, &srcName ); + args.dstName = *map_context_objects( dstTarget == GL_RENDERBUFFER ? OBJ_TYPE_RENDERBUFFER : OBJ_TYPE_TEXTURE, 1, &dstName ); if ((status = UNIX_CALL( glMulticastCopyImageSubDataNV, &args ))) WARN( "glMulticastCopyImageSubDataNV returned %#lx\n", status ); } @@ -14950,88 +15082,103 @@ static void WINAPI glNamedFramebufferSamplePositionsfvAMD( GLuint framebuffer, G static void WINAPI glNamedFramebufferTexture( GLuint framebuffer, GLenum attachment, GLuint texture, GLint level ) { - struct glNamedFramebufferTexture_params args = { .teb = NtCurrentTeb(), .attachment = attachment, .texture = texture, .level = level }; + struct glNamedFramebufferTexture_params args = { .teb = NtCurrentTeb(), .attachment = attachment, .level = level }; NTSTATUS status; TRACE( "framebuffer %d, attachment %d, texture %d, level %d\n", framebuffer, attachment, texture, level ); args.framebuffer = *map_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &framebuffer ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glNamedFramebufferTexture, &args ))) WARN( "glNamedFramebufferTexture returned %#lx\n", status ); } static void WINAPI glNamedFramebufferTexture1DEXT( GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level ) { - struct glNamedFramebufferTexture1DEXT_params args = { .teb = NtCurrentTeb(), .attachment = attachment, .textarget = textarget, .texture = texture, .level = level }; + struct glNamedFramebufferTexture1DEXT_params args = { .teb = NtCurrentTeb(), .attachment = attachment, .textarget = textarget, .level = level }; NTSTATUS status; TRACE( "framebuffer %d, attachment %d, textarget %d, texture %d, level %d\n", framebuffer, attachment, textarget, texture, level ); if (!alloc_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &framebuffer, TRUE )) return; + if (!alloc_context_objects( OBJ_TYPE_TEXTURE, 1, &texture, TRUE )) return; args.framebuffer = *map_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &framebuffer ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glNamedFramebufferTexture1DEXT, &args ))) WARN( "glNamedFramebufferTexture1DEXT returned %#lx\n", status ); } static void WINAPI glNamedFramebufferTexture2DEXT( GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level ) { - struct glNamedFramebufferTexture2DEXT_params args = { .teb = NtCurrentTeb(), .attachment = attachment, .textarget = textarget, .texture = texture, .level = level }; + struct glNamedFramebufferTexture2DEXT_params args = { .teb = NtCurrentTeb(), .attachment = attachment, .textarget = textarget, .level = level }; NTSTATUS status; TRACE( "framebuffer %d, attachment %d, textarget %d, texture %d, level %d\n", framebuffer, attachment, textarget, texture, level ); if (!alloc_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &framebuffer, TRUE )) return; + if (!alloc_context_objects( OBJ_TYPE_TEXTURE, 1, &texture, TRUE )) return; args.framebuffer = *map_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &framebuffer ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glNamedFramebufferTexture2DEXT, &args ))) WARN( "glNamedFramebufferTexture2DEXT returned %#lx\n", status ); } static void WINAPI glNamedFramebufferTexture3DEXT( GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset ) { - struct glNamedFramebufferTexture3DEXT_params args = { .teb = NtCurrentTeb(), .attachment = attachment, .textarget = textarget, .texture = texture, .level = level, .zoffset = zoffset }; + struct glNamedFramebufferTexture3DEXT_params args = { .teb = NtCurrentTeb(), .attachment = attachment, .textarget = textarget, .level = level, .zoffset = zoffset }; NTSTATUS status; TRACE( "framebuffer %d, attachment %d, textarget %d, texture %d, level %d, zoffset %d\n", framebuffer, attachment, textarget, texture, level, zoffset ); if (!alloc_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &framebuffer, TRUE )) return; + if (!alloc_context_objects( OBJ_TYPE_TEXTURE, 1, &texture, TRUE )) return; args.framebuffer = *map_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &framebuffer ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glNamedFramebufferTexture3DEXT, &args ))) WARN( "glNamedFramebufferTexture3DEXT returned %#lx\n", status ); } static void WINAPI glNamedFramebufferTextureEXT( GLuint framebuffer, GLenum attachment, GLuint texture, GLint level ) { - struct glNamedFramebufferTextureEXT_params args = { .teb = NtCurrentTeb(), .attachment = attachment, .texture = texture, .level = level }; + struct glNamedFramebufferTextureEXT_params args = { .teb = NtCurrentTeb(), .attachment = attachment, .level = level }; NTSTATUS status; TRACE( "framebuffer %d, attachment %d, texture %d, level %d\n", framebuffer, attachment, texture, level ); if (!alloc_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &framebuffer, TRUE )) return; + if (!alloc_context_objects( OBJ_TYPE_TEXTURE, 1, &texture, TRUE )) return; args.framebuffer = *map_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &framebuffer ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glNamedFramebufferTextureEXT, &args ))) WARN( "glNamedFramebufferTextureEXT returned %#lx\n", status ); } static void WINAPI glNamedFramebufferTextureFaceEXT( GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLenum face ) { - struct glNamedFramebufferTextureFaceEXT_params args = { .teb = NtCurrentTeb(), .attachment = attachment, .texture = texture, .level = level, .face = face }; + struct glNamedFramebufferTextureFaceEXT_params args = { .teb = NtCurrentTeb(), .attachment = attachment, .level = level, .face = face }; NTSTATUS status; TRACE( "framebuffer %d, attachment %d, texture %d, level %d, face %d\n", framebuffer, attachment, texture, level, face ); if (!alloc_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &framebuffer, TRUE )) return; + if (!alloc_context_objects( OBJ_TYPE_TEXTURE, 1, &texture, TRUE )) return; args.framebuffer = *map_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &framebuffer ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glNamedFramebufferTextureFaceEXT, &args ))) WARN( "glNamedFramebufferTextureFaceEXT returned %#lx\n", status ); } static void WINAPI glNamedFramebufferTextureLayer( GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLint layer ) { - struct glNamedFramebufferTextureLayer_params args = { .teb = NtCurrentTeb(), .attachment = attachment, .texture = texture, .level = level, .layer = layer }; + struct glNamedFramebufferTextureLayer_params args = { .teb = NtCurrentTeb(), .attachment = attachment, .level = level, .layer = layer }; NTSTATUS status; TRACE( "framebuffer %d, attachment %d, texture %d, level %d, layer %d\n", framebuffer, attachment, texture, level, layer ); args.framebuffer = *map_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &framebuffer ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glNamedFramebufferTextureLayer, &args ))) WARN( "glNamedFramebufferTextureLayer returned %#lx\n", status ); } static void WINAPI glNamedFramebufferTextureLayerEXT( GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLint layer ) { - struct glNamedFramebufferTextureLayerEXT_params args = { .teb = NtCurrentTeb(), .attachment = attachment, .texture = texture, .level = level, .layer = layer }; + struct glNamedFramebufferTextureLayerEXT_params args = { .teb = NtCurrentTeb(), .attachment = attachment, .level = level, .layer = layer }; NTSTATUS status; TRACE( "framebuffer %d, attachment %d, texture %d, level %d, layer %d\n", framebuffer, attachment, texture, level, layer ); if (!alloc_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &framebuffer, TRUE )) return; + if (!alloc_context_objects( OBJ_TYPE_TEXTURE, 1, &texture, TRUE )) return; args.framebuffer = *map_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &framebuffer ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glNamedFramebufferTextureLayerEXT, &args ))) WARN( "glNamedFramebufferTextureLayerEXT returned %#lx\n", status ); } static void WINAPI glNamedFramebufferTextureMultiviewOVR( GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLint baseViewIndex, GLsizei numViews ) { - struct glNamedFramebufferTextureMultiviewOVR_params args = { .teb = NtCurrentTeb(), .attachment = attachment, .texture = texture, .level = level, .baseViewIndex = baseViewIndex, .numViews = numViews }; + struct glNamedFramebufferTextureMultiviewOVR_params args = { .teb = NtCurrentTeb(), .attachment = attachment, .level = level, .baseViewIndex = baseViewIndex, .numViews = numViews }; NTSTATUS status; TRACE( "framebuffer %d, attachment %d, texture %d, level %d, baseViewIndex %d, numViews %d\n", framebuffer, attachment, texture, level, baseViewIndex, numViews ); args.framebuffer = *map_context_objects( OBJ_TYPE_FRAMEBUFFER, 1, &framebuffer ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glNamedFramebufferTextureMultiviewOVR, &args ))) WARN( "glNamedFramebufferTextureMultiviewOVR returned %#lx\n", status ); } @@ -16088,18 +16235,26 @@ static void WINAPI glPrimitiveRestartNV(void) static void WINAPI glPrioritizeTexturesEXT( GLsizei n, const GLuint *textures, const GLclampf *priorities ) { - struct glPrioritizeTexturesEXT_params args = { .teb = NtCurrentTeb(), .n = n, .textures = textures, .priorities = priorities }; + GLuint textures_buf[64], *textures_tmp; + struct glPrioritizeTexturesEXT_params args = { .teb = NtCurrentTeb(), .n = n, .priorities = priorities }; NTSTATUS status; TRACE( "n %d, textures %p, priorities %p\n", n, textures, priorities ); + textures_tmp = n > 0 ? memdup_objects( n, textures, textures_buf, ARRAY_SIZE(textures_buf) ) : NULL; + args.textures = n > 0 ? map_context_objects( OBJ_TYPE_TEXTURE, n, textures_tmp ) : NULL; if ((status = UNIX_CALL( glPrioritizeTexturesEXT, &args ))) WARN( "glPrioritizeTexturesEXT returned %#lx\n", status ); + if (textures_tmp != textures_buf) free( textures_tmp ); } static void WINAPI glPrioritizeTexturesxOES( GLsizei n, const GLuint *textures, const GLfixed *priorities ) { - struct glPrioritizeTexturesxOES_params args = { .teb = NtCurrentTeb(), .n = n, .textures = textures, .priorities = priorities }; + GLuint textures_buf[64], *textures_tmp; + struct glPrioritizeTexturesxOES_params args = { .teb = NtCurrentTeb(), .n = n, .priorities = priorities }; NTSTATUS status; TRACE( "n %d, textures %p, priorities %p\n", n, textures, priorities ); + textures_tmp = n > 0 ? memdup_objects( n, textures, textures_buf, ARRAY_SIZE(textures_buf) ) : NULL; + args.textures = n > 0 ? map_context_objects( OBJ_TYPE_TEXTURE, n, textures_tmp ) : NULL; if ((status = UNIX_CALL( glPrioritizeTexturesxOES, &args ))) WARN( "glPrioritizeTexturesxOES returned %#lx\n", status ); + if (textures_tmp != textures_buf) free( textures_tmp ); } static void WINAPI glProgramBinary( GLuint program, GLenum binaryFormat, const void *binary, GLsizei length ) @@ -18820,13 +18975,17 @@ static void WINAPI glSharpenTexFuncSGIS( GLenum target, GLsizei n, const GLfloat static void WINAPI glSignalSemaphoreEXT( GLuint semaphore, GLuint numBufferBarriers, const GLuint *buffers, GLuint numTextureBarriers, const GLuint *textures, const GLenum *dstLayouts ) { GLuint buffers_buf[64], *buffers_tmp; - struct glSignalSemaphoreEXT_params args = { .teb = NtCurrentTeb(), .semaphore = semaphore, .numBufferBarriers = numBufferBarriers, .numTextureBarriers = numTextureBarriers, .textures = textures, .dstLayouts = dstLayouts }; + GLuint textures_buf[64], *textures_tmp; + struct glSignalSemaphoreEXT_params args = { .teb = NtCurrentTeb(), .semaphore = semaphore, .numBufferBarriers = numBufferBarriers, .numTextureBarriers = numTextureBarriers, .dstLayouts = dstLayouts }; NTSTATUS status; TRACE( "semaphore %d, numBufferBarriers %d, buffers %p, numTextureBarriers %d, textures %p, dstLayouts %p\n", semaphore, numBufferBarriers, buffers, numTextureBarriers, textures, dstLayouts ); buffers_tmp = numBufferBarriers > 0 ? memdup_objects( numBufferBarriers, buffers, buffers_buf, ARRAY_SIZE(buffers_buf) ) : NULL; args.buffers = numBufferBarriers > 0 ? map_context_objects( OBJ_TYPE_BUFFER, numBufferBarriers, buffers_tmp ) : NULL; + textures_tmp = numTextureBarriers > 0 ? memdup_objects( numTextureBarriers, textures, textures_buf, ARRAY_SIZE(textures_buf) ) : NULL; + args.textures = numTextureBarriers > 0 ? map_context_objects( OBJ_TYPE_TEXTURE, numTextureBarriers, textures_tmp ) : NULL; if ((status = UNIX_CALL( glSignalSemaphoreEXT, &args ))) WARN( "glSignalSemaphoreEXT returned %#lx\n", status ); if (buffers_tmp != buffers_buf) free( buffers_tmp ); + if (textures_tmp != textures_buf) free( textures_tmp ); } static void WINAPI glSignalSemaphoreui64NVX( GLuint signalGpu, GLsizei fenceObjectCount, const GLuint *semaphoreArray, const GLuint64 *fenceValueArray ) @@ -19071,9 +19230,10 @@ static void WINAPI glSwizzleEXT( GLuint res, GLuint in, GLenum outX, GLenum outY static void WINAPI glSyncTextureINTEL( GLuint texture ) { - struct glSyncTextureINTEL_params args = { .teb = NtCurrentTeb(), .texture = texture }; + struct glSyncTextureINTEL_params args = { .teb = NtCurrentTeb() }; NTSTATUS status; TRACE( "texture %d\n", texture ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glSyncTextureINTEL, &args ))) WARN( "glSyncTextureINTEL returned %#lx\n", status ); } @@ -20039,9 +20199,10 @@ static void WINAPI glTexSubImage4DSGIS( GLenum target, GLint level, GLint xoffse static void WINAPI glTextureAttachMemoryNV( GLuint texture, GLuint memory, GLuint64 offset ) { - struct glTextureAttachMemoryNV_params args = { .teb = NtCurrentTeb(), .texture = texture, .memory = memory, .offset = offset }; + struct glTextureAttachMemoryNV_params args = { .teb = NtCurrentTeb(), .memory = memory, .offset = offset }; NTSTATUS status; TRACE( "texture %d, memory %d, offset %s\n", texture, memory, wine_dbgstr_longlong(offset) ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glTextureAttachMemoryNV, &args ))) WARN( "glTextureAttachMemoryNV returned %#lx\n", status ); } @@ -20063,38 +20224,44 @@ static void WINAPI glTextureBarrierNV(void) static void WINAPI glTextureBuffer( GLuint texture, GLenum internalformat, GLuint buffer ) { - struct glTextureBuffer_params args = { .teb = NtCurrentTeb(), .texture = texture, .internalformat = internalformat }; + struct glTextureBuffer_params args = { .teb = NtCurrentTeb(), .internalformat = internalformat }; NTSTATUS status; TRACE( "texture %d, internalformat %d, buffer %d\n", texture, internalformat, buffer ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glTextureBuffer, &args ))) WARN( "glTextureBuffer returned %#lx\n", status ); } static void WINAPI glTextureBufferEXT( GLuint texture, GLenum target, GLenum internalformat, GLuint buffer ) { - struct glTextureBufferEXT_params args = { .teb = NtCurrentTeb(), .texture = texture, .target = target, .internalformat = internalformat }; + struct glTextureBufferEXT_params args = { .teb = NtCurrentTeb(), .target = target, .internalformat = internalformat }; NTSTATUS status; TRACE( "texture %d, target %d, internalformat %d, buffer %d\n", texture, target, internalformat, buffer ); + if (!alloc_context_objects( OBJ_TYPE_TEXTURE, 1, &texture, TRUE )) return; if (!alloc_context_objects( OBJ_TYPE_BUFFER, 1, &buffer, TRUE )) return; + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glTextureBufferEXT, &args ))) WARN( "glTextureBufferEXT returned %#lx\n", status ); } static void WINAPI glTextureBufferRange( GLuint texture, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size ) { - struct glTextureBufferRange_params args = { .teb = NtCurrentTeb(), .texture = texture, .internalformat = internalformat, .offset = offset, .size = size }; + struct glTextureBufferRange_params args = { .teb = NtCurrentTeb(), .internalformat = internalformat, .offset = offset, .size = size }; NTSTATUS status; TRACE( "texture %d, internalformat %d, buffer %d, offset %Id, size %Id\n", texture, internalformat, buffer, offset, size ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glTextureBufferRange, &args ))) WARN( "glTextureBufferRange returned %#lx\n", status ); } static void WINAPI glTextureBufferRangeEXT( GLuint texture, GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size ) { - struct glTextureBufferRangeEXT_params args = { .teb = NtCurrentTeb(), .texture = texture, .target = target, .internalformat = internalformat, .offset = offset, .size = size }; + struct glTextureBufferRangeEXT_params args = { .teb = NtCurrentTeb(), .target = target, .internalformat = internalformat, .offset = offset, .size = size }; NTSTATUS status; TRACE( "texture %d, target %d, internalformat %d, buffer %d, offset %Id, size %Id\n", texture, target, internalformat, buffer, offset, size ); + if (!alloc_context_objects( OBJ_TYPE_TEXTURE, 1, &texture, TRUE )) return; if (!alloc_context_objects( OBJ_TYPE_BUFFER, 1, &buffer, TRUE )) return; + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glTextureBufferRangeEXT, &args ))) WARN( "glTextureBufferRangeEXT returned %#lx\n", status ); } @@ -20109,57 +20276,67 @@ static void WINAPI glTextureColorMaskSGIS( GLboolean red, GLboolean green, GLboo static void WINAPI glTextureImage1DEXT( GLuint texture, GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const void *pixels ) { - struct glTextureImage1DEXT_params args = { .teb = NtCurrentTeb(), .texture = texture, .target = target, .level = level, .internalformat = internalformat, .width = width, .border = border, .format = format, .type = type, .pixels = pixels }; + struct glTextureImage1DEXT_params args = { .teb = NtCurrentTeb(), .target = target, .level = level, .internalformat = internalformat, .width = width, .border = border, .format = format, .type = type, .pixels = pixels }; NTSTATUS status; TRACE( "texture %d, target %d, level %d, internalformat %d, width %d, border %d, format %d, type %d, pixels %p\n", texture, target, level, internalformat, width, border, format, type, pixels ); + if (!alloc_context_objects( OBJ_TYPE_TEXTURE, 1, &texture, TRUE )) return; + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glTextureImage1DEXT, &args ))) WARN( "glTextureImage1DEXT returned %#lx\n", status ); } static void WINAPI glTextureImage2DEXT( GLuint texture, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels ) { - struct glTextureImage2DEXT_params args = { .teb = NtCurrentTeb(), .texture = texture, .target = target, .level = level, .internalformat = internalformat, .width = width, .height = height, .border = border, .format = format, .type = type, .pixels = pixels }; + struct glTextureImage2DEXT_params args = { .teb = NtCurrentTeb(), .target = target, .level = level, .internalformat = internalformat, .width = width, .height = height, .border = border, .format = format, .type = type, .pixels = pixels }; NTSTATUS status; TRACE( "texture %d, target %d, level %d, internalformat %d, width %d, height %d, border %d, format %d, type %d, pixels %p\n", texture, target, level, internalformat, width, height, border, format, type, pixels ); + if (!alloc_context_objects( OBJ_TYPE_TEXTURE, 1, &texture, TRUE )) return; + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glTextureImage2DEXT, &args ))) WARN( "glTextureImage2DEXT returned %#lx\n", status ); } static void WINAPI glTextureImage2DMultisampleCoverageNV( GLuint texture, GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations ) { - struct glTextureImage2DMultisampleCoverageNV_params args = { .teb = NtCurrentTeb(), .texture = texture, .target = target, .coverageSamples = coverageSamples, .colorSamples = colorSamples, .internalFormat = internalFormat, .width = width, .height = height, .fixedSampleLocations = fixedSampleLocations }; + struct glTextureImage2DMultisampleCoverageNV_params args = { .teb = NtCurrentTeb(), .target = target, .coverageSamples = coverageSamples, .colorSamples = colorSamples, .internalFormat = internalFormat, .width = width, .height = height, .fixedSampleLocations = fixedSampleLocations }; NTSTATUS status; TRACE( "texture %d, target %d, coverageSamples %d, colorSamples %d, internalFormat %d, width %d, height %d, fixedSampleLocations %d\n", texture, target, coverageSamples, colorSamples, internalFormat, width, height, fixedSampleLocations ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glTextureImage2DMultisampleCoverageNV, &args ))) WARN( "glTextureImage2DMultisampleCoverageNV returned %#lx\n", status ); } static void WINAPI glTextureImage2DMultisampleNV( GLuint texture, GLenum target, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations ) { - struct glTextureImage2DMultisampleNV_params args = { .teb = NtCurrentTeb(), .texture = texture, .target = target, .samples = samples, .internalFormat = internalFormat, .width = width, .height = height, .fixedSampleLocations = fixedSampleLocations }; + struct glTextureImage2DMultisampleNV_params args = { .teb = NtCurrentTeb(), .target = target, .samples = samples, .internalFormat = internalFormat, .width = width, .height = height, .fixedSampleLocations = fixedSampleLocations }; NTSTATUS status; TRACE( "texture %d, target %d, samples %d, internalFormat %d, width %d, height %d, fixedSampleLocations %d\n", texture, target, samples, internalFormat, width, height, fixedSampleLocations ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glTextureImage2DMultisampleNV, &args ))) WARN( "glTextureImage2DMultisampleNV returned %#lx\n", status ); } static void WINAPI glTextureImage3DEXT( GLuint texture, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels ) { - struct glTextureImage3DEXT_params args = { .teb = NtCurrentTeb(), .texture = texture, .target = target, .level = level, .internalformat = internalformat, .width = width, .height = height, .depth = depth, .border = border, .format = format, .type = type, .pixels = pixels }; + struct glTextureImage3DEXT_params args = { .teb = NtCurrentTeb(), .target = target, .level = level, .internalformat = internalformat, .width = width, .height = height, .depth = depth, .border = border, .format = format, .type = type, .pixels = pixels }; NTSTATUS status; TRACE( "texture %d, target %d, level %d, internalformat %d, width %d, height %d, depth %d, border %d, format %d, type %d, pixels %p\n", texture, target, level, internalformat, width, height, depth, border, format, type, pixels ); + if (!alloc_context_objects( OBJ_TYPE_TEXTURE, 1, &texture, TRUE )) return; + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glTextureImage3DEXT, &args ))) WARN( "glTextureImage3DEXT returned %#lx\n", status ); } static void WINAPI glTextureImage3DMultisampleCoverageNV( GLuint texture, GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations ) { - struct glTextureImage3DMultisampleCoverageNV_params args = { .teb = NtCurrentTeb(), .texture = texture, .target = target, .coverageSamples = coverageSamples, .colorSamples = colorSamples, .internalFormat = internalFormat, .width = width, .height = height, .depth = depth, .fixedSampleLocations = fixedSampleLocations }; + struct glTextureImage3DMultisampleCoverageNV_params args = { .teb = NtCurrentTeb(), .target = target, .coverageSamples = coverageSamples, .colorSamples = colorSamples, .internalFormat = internalFormat, .width = width, .height = height, .depth = depth, .fixedSampleLocations = fixedSampleLocations }; NTSTATUS status; TRACE( "texture %d, target %d, coverageSamples %d, colorSamples %d, internalFormat %d, width %d, height %d, depth %d, fixedSampleLocations %d\n", texture, target, coverageSamples, colorSamples, internalFormat, width, height, depth, fixedSampleLocations ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glTextureImage3DMultisampleCoverageNV, &args ))) WARN( "glTextureImage3DMultisampleCoverageNV returned %#lx\n", status ); } static void WINAPI glTextureImage3DMultisampleNV( GLuint texture, GLenum target, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations ) { - struct glTextureImage3DMultisampleNV_params args = { .teb = NtCurrentTeb(), .texture = texture, .target = target, .samples = samples, .internalFormat = internalFormat, .width = width, .height = height, .depth = depth, .fixedSampleLocations = fixedSampleLocations }; + struct glTextureImage3DMultisampleNV_params args = { .teb = NtCurrentTeb(), .target = target, .samples = samples, .internalFormat = internalFormat, .width = width, .height = height, .depth = depth, .fixedSampleLocations = fixedSampleLocations }; NTSTATUS status; TRACE( "texture %d, target %d, samples %d, internalFormat %d, width %d, height %d, depth %d, fixedSampleLocations %d\n", texture, target, samples, internalFormat, width, height, depth, fixedSampleLocations ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glTextureImage3DMultisampleNV, &args ))) WARN( "glTextureImage3DMultisampleNV returned %#lx\n", status ); } @@ -20189,113 +20366,134 @@ static void WINAPI glTextureNormalEXT( GLenum mode ) static void WINAPI glTexturePageCommitmentEXT( GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLboolean commit ) { - struct glTexturePageCommitmentEXT_params args = { .teb = NtCurrentTeb(), .texture = texture, .level = level, .xoffset = xoffset, .yoffset = yoffset, .zoffset = zoffset, .width = width, .height = height, .depth = depth, .commit = commit }; + struct glTexturePageCommitmentEXT_params args = { .teb = NtCurrentTeb(), .level = level, .xoffset = xoffset, .yoffset = yoffset, .zoffset = zoffset, .width = width, .height = height, .depth = depth, .commit = commit }; NTSTATUS status; TRACE( "texture %d, level %d, xoffset %d, yoffset %d, zoffset %d, width %d, height %d, depth %d, commit %d\n", texture, level, xoffset, yoffset, zoffset, width, height, depth, commit ); + if (!alloc_context_objects( OBJ_TYPE_TEXTURE, 1, &texture, TRUE )) return; + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glTexturePageCommitmentEXT, &args ))) WARN( "glTexturePageCommitmentEXT returned %#lx\n", status ); } static void WINAPI glTexturePageCommitmentMemNV( GLuint texture, GLint layer, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLuint memory, GLuint64 offset, GLboolean commit ) { - struct glTexturePageCommitmentMemNV_params args = { .teb = NtCurrentTeb(), .texture = texture, .layer = layer, .level = level, .xoffset = xoffset, .yoffset = yoffset, .zoffset = zoffset, .width = width, .height = height, .depth = depth, .memory = memory, .offset = offset, .commit = commit }; + struct glTexturePageCommitmentMemNV_params args = { .teb = NtCurrentTeb(), .layer = layer, .level = level, .xoffset = xoffset, .yoffset = yoffset, .zoffset = zoffset, .width = width, .height = height, .depth = depth, .memory = memory, .offset = offset, .commit = commit }; NTSTATUS status; TRACE( "texture %d, layer %d, level %d, xoffset %d, yoffset %d, zoffset %d, width %d, height %d, depth %d, memory %d, offset %s, commit %d\n", texture, layer, level, xoffset, yoffset, zoffset, width, height, depth, memory, wine_dbgstr_longlong(offset), commit ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glTexturePageCommitmentMemNV, &args ))) WARN( "glTexturePageCommitmentMemNV returned %#lx\n", status ); } static void WINAPI glTextureParameterIiv( GLuint texture, GLenum pname, const GLint *params ) { - struct glTextureParameterIiv_params args = { .teb = NtCurrentTeb(), .texture = texture, .pname = pname, .params = params }; + struct glTextureParameterIiv_params args = { .teb = NtCurrentTeb(), .pname = pname, .params = params }; NTSTATUS status; TRACE( "texture %d, pname %d, params %p\n", texture, pname, params ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glTextureParameterIiv, &args ))) WARN( "glTextureParameterIiv returned %#lx\n", status ); } static void WINAPI glTextureParameterIivEXT( GLuint texture, GLenum target, GLenum pname, const GLint *params ) { - struct glTextureParameterIivEXT_params args = { .teb = NtCurrentTeb(), .texture = texture, .target = target, .pname = pname, .params = params }; + struct glTextureParameterIivEXT_params args = { .teb = NtCurrentTeb(), .target = target, .pname = pname, .params = params }; NTSTATUS status; TRACE( "texture %d, target %d, pname %d, params %p\n", texture, target, pname, params ); + if (!alloc_context_objects( OBJ_TYPE_TEXTURE, 1, &texture, TRUE )) return; + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glTextureParameterIivEXT, &args ))) WARN( "glTextureParameterIivEXT returned %#lx\n", status ); } static void WINAPI glTextureParameterIuiv( GLuint texture, GLenum pname, const GLuint *params ) { - struct glTextureParameterIuiv_params args = { .teb = NtCurrentTeb(), .texture = texture, .pname = pname, .params = params }; + struct glTextureParameterIuiv_params args = { .teb = NtCurrentTeb(), .pname = pname, .params = params }; NTSTATUS status; TRACE( "texture %d, pname %d, params %p\n", texture, pname, params ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glTextureParameterIuiv, &args ))) WARN( "glTextureParameterIuiv returned %#lx\n", status ); } static void WINAPI glTextureParameterIuivEXT( GLuint texture, GLenum target, GLenum pname, const GLuint *params ) { - struct glTextureParameterIuivEXT_params args = { .teb = NtCurrentTeb(), .texture = texture, .target = target, .pname = pname, .params = params }; + struct glTextureParameterIuivEXT_params args = { .teb = NtCurrentTeb(), .target = target, .pname = pname, .params = params }; NTSTATUS status; TRACE( "texture %d, target %d, pname %d, params %p\n", texture, target, pname, params ); + if (!alloc_context_objects( OBJ_TYPE_TEXTURE, 1, &texture, TRUE )) return; + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glTextureParameterIuivEXT, &args ))) WARN( "glTextureParameterIuivEXT returned %#lx\n", status ); } static void WINAPI glTextureParameterf( GLuint texture, GLenum pname, GLfloat param ) { - struct glTextureParameterf_params args = { .teb = NtCurrentTeb(), .texture = texture, .pname = pname, .param = param }; + struct glTextureParameterf_params args = { .teb = NtCurrentTeb(), .pname = pname, .param = param }; NTSTATUS status; TRACE( "texture %d, pname %d, param %f\n", texture, pname, param ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glTextureParameterf, &args ))) WARN( "glTextureParameterf returned %#lx\n", status ); } static void WINAPI glTextureParameterfEXT( GLuint texture, GLenum target, GLenum pname, GLfloat param ) { - struct glTextureParameterfEXT_params args = { .teb = NtCurrentTeb(), .texture = texture, .target = target, .pname = pname, .param = param }; + struct glTextureParameterfEXT_params args = { .teb = NtCurrentTeb(), .target = target, .pname = pname, .param = param }; NTSTATUS status; TRACE( "texture %d, target %d, pname %d, param %f\n", texture, target, pname, param ); + if (!alloc_context_objects( OBJ_TYPE_TEXTURE, 1, &texture, TRUE )) return; + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glTextureParameterfEXT, &args ))) WARN( "glTextureParameterfEXT returned %#lx\n", status ); } static void WINAPI glTextureParameterfv( GLuint texture, GLenum pname, const GLfloat *param ) { - struct glTextureParameterfv_params args = { .teb = NtCurrentTeb(), .texture = texture, .pname = pname, .param = param }; + struct glTextureParameterfv_params args = { .teb = NtCurrentTeb(), .pname = pname, .param = param }; NTSTATUS status; TRACE( "texture %d, pname %d, param %p\n", texture, pname, param ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glTextureParameterfv, &args ))) WARN( "glTextureParameterfv returned %#lx\n", status ); } static void WINAPI glTextureParameterfvEXT( GLuint texture, GLenum target, GLenum pname, const GLfloat *params ) { - struct glTextureParameterfvEXT_params args = { .teb = NtCurrentTeb(), .texture = texture, .target = target, .pname = pname, .params = params }; + struct glTextureParameterfvEXT_params args = { .teb = NtCurrentTeb(), .target = target, .pname = pname, .params = params }; NTSTATUS status; TRACE( "texture %d, target %d, pname %d, params %p\n", texture, target, pname, params ); + if (!alloc_context_objects( OBJ_TYPE_TEXTURE, 1, &texture, TRUE )) return; + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glTextureParameterfvEXT, &args ))) WARN( "glTextureParameterfvEXT returned %#lx\n", status ); } static void WINAPI glTextureParameteri( GLuint texture, GLenum pname, GLint param ) { - struct glTextureParameteri_params args = { .teb = NtCurrentTeb(), .texture = texture, .pname = pname, .param = param }; + struct glTextureParameteri_params args = { .teb = NtCurrentTeb(), .pname = pname, .param = param }; NTSTATUS status; TRACE( "texture %d, pname %d, param %d\n", texture, pname, param ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glTextureParameteri, &args ))) WARN( "glTextureParameteri returned %#lx\n", status ); } static void WINAPI glTextureParameteriEXT( GLuint texture, GLenum target, GLenum pname, GLint param ) { - struct glTextureParameteriEXT_params args = { .teb = NtCurrentTeb(), .texture = texture, .target = target, .pname = pname, .param = param }; + struct glTextureParameteriEXT_params args = { .teb = NtCurrentTeb(), .target = target, .pname = pname, .param = param }; NTSTATUS status; TRACE( "texture %d, target %d, pname %d, param %d\n", texture, target, pname, param ); + if (!alloc_context_objects( OBJ_TYPE_TEXTURE, 1, &texture, TRUE )) return; + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glTextureParameteriEXT, &args ))) WARN( "glTextureParameteriEXT returned %#lx\n", status ); } static void WINAPI glTextureParameteriv( GLuint texture, GLenum pname, const GLint *param ) { - struct glTextureParameteriv_params args = { .teb = NtCurrentTeb(), .texture = texture, .pname = pname, .param = param }; + struct glTextureParameteriv_params args = { .teb = NtCurrentTeb(), .pname = pname, .param = param }; NTSTATUS status; TRACE( "texture %d, pname %d, param %p\n", texture, pname, param ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glTextureParameteriv, &args ))) WARN( "glTextureParameteriv returned %#lx\n", status ); } static void WINAPI glTextureParameterivEXT( GLuint texture, GLenum target, GLenum pname, const GLint *params ) { - struct glTextureParameterivEXT_params args = { .teb = NtCurrentTeb(), .texture = texture, .target = target, .pname = pname, .params = params }; + struct glTextureParameterivEXT_params args = { .teb = NtCurrentTeb(), .target = target, .pname = pname, .params = params }; NTSTATUS status; TRACE( "texture %d, target %d, pname %d, params %p\n", texture, target, pname, params ); + if (!alloc_context_objects( OBJ_TYPE_TEXTURE, 1, &texture, TRUE )) return; + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glTextureParameterivEXT, &args ))) WARN( "glTextureParameterivEXT returned %#lx\n", status ); } @@ -20309,195 +20507,229 @@ static void WINAPI glTextureRangeAPPLE( GLenum target, GLsizei length, const voi static void WINAPI glTextureRenderbufferEXT( GLuint texture, GLenum target, GLuint renderbuffer ) { - struct glTextureRenderbufferEXT_params args = { .teb = NtCurrentTeb(), .texture = texture, .target = target }; + struct glTextureRenderbufferEXT_params args = { .teb = NtCurrentTeb(), .target = target }; NTSTATUS status; TRACE( "texture %d, target %d, renderbuffer %d\n", texture, target, renderbuffer ); + if (!alloc_context_objects( OBJ_TYPE_TEXTURE, 1, &texture, TRUE )) return; if (!alloc_context_objects( OBJ_TYPE_RENDERBUFFER, 1, &renderbuffer, TRUE )) return; + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); args.renderbuffer = *map_context_objects( OBJ_TYPE_RENDERBUFFER, 1, &renderbuffer ); if ((status = UNIX_CALL( glTextureRenderbufferEXT, &args ))) WARN( "glTextureRenderbufferEXT returned %#lx\n", status ); } static void WINAPI glTextureStorage1D( GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width ) { - struct glTextureStorage1D_params args = { .teb = NtCurrentTeb(), .texture = texture, .levels = levels, .internalformat = internalformat, .width = width }; + struct glTextureStorage1D_params args = { .teb = NtCurrentTeb(), .levels = levels, .internalformat = internalformat, .width = width }; NTSTATUS status; TRACE( "texture %d, levels %d, internalformat %d, width %d\n", texture, levels, internalformat, width ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glTextureStorage1D, &args ))) WARN( "glTextureStorage1D returned %#lx\n", status ); } static void WINAPI glTextureStorage1DEXT( GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width ) { - struct glTextureStorage1DEXT_params args = { .teb = NtCurrentTeb(), .texture = texture, .target = target, .levels = levels, .internalformat = internalformat, .width = width }; + struct glTextureStorage1DEXT_params args = { .teb = NtCurrentTeb(), .target = target, .levels = levels, .internalformat = internalformat, .width = width }; NTSTATUS status; TRACE( "texture %d, target %d, levels %d, internalformat %d, width %d\n", texture, target, levels, internalformat, width ); + if (!alloc_context_objects( OBJ_TYPE_TEXTURE, 1, &texture, TRUE )) return; + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glTextureStorage1DEXT, &args ))) WARN( "glTextureStorage1DEXT returned %#lx\n", status ); } static void WINAPI glTextureStorage2D( GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height ) { - struct glTextureStorage2D_params args = { .teb = NtCurrentTeb(), .texture = texture, .levels = levels, .internalformat = internalformat, .width = width, .height = height }; + struct glTextureStorage2D_params args = { .teb = NtCurrentTeb(), .levels = levels, .internalformat = internalformat, .width = width, .height = height }; NTSTATUS status; TRACE( "texture %d, levels %d, internalformat %d, width %d, height %d\n", texture, levels, internalformat, width, height ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glTextureStorage2D, &args ))) WARN( "glTextureStorage2D returned %#lx\n", status ); } static void WINAPI glTextureStorage2DEXT( GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height ) { - struct glTextureStorage2DEXT_params args = { .teb = NtCurrentTeb(), .texture = texture, .target = target, .levels = levels, .internalformat = internalformat, .width = width, .height = height }; + struct glTextureStorage2DEXT_params args = { .teb = NtCurrentTeb(), .target = target, .levels = levels, .internalformat = internalformat, .width = width, .height = height }; NTSTATUS status; TRACE( "texture %d, target %d, levels %d, internalformat %d, width %d, height %d\n", texture, target, levels, internalformat, width, height ); + if (!alloc_context_objects( OBJ_TYPE_TEXTURE, 1, &texture, TRUE )) return; + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glTextureStorage2DEXT, &args ))) WARN( "glTextureStorage2DEXT returned %#lx\n", status ); } static void WINAPI glTextureStorage2DMultisample( GLuint texture, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations ) { - struct glTextureStorage2DMultisample_params args = { .teb = NtCurrentTeb(), .texture = texture, .samples = samples, .internalformat = internalformat, .width = width, .height = height, .fixedsamplelocations = fixedsamplelocations }; + struct glTextureStorage2DMultisample_params args = { .teb = NtCurrentTeb(), .samples = samples, .internalformat = internalformat, .width = width, .height = height, .fixedsamplelocations = fixedsamplelocations }; NTSTATUS status; TRACE( "texture %d, samples %d, internalformat %d, width %d, height %d, fixedsamplelocations %d\n", texture, samples, internalformat, width, height, fixedsamplelocations ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glTextureStorage2DMultisample, &args ))) WARN( "glTextureStorage2DMultisample returned %#lx\n", status ); } static void WINAPI glTextureStorage2DMultisampleEXT( GLuint texture, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations ) { - struct glTextureStorage2DMultisampleEXT_params args = { .teb = NtCurrentTeb(), .texture = texture, .target = target, .samples = samples, .internalformat = internalformat, .width = width, .height = height, .fixedsamplelocations = fixedsamplelocations }; + struct glTextureStorage2DMultisampleEXT_params args = { .teb = NtCurrentTeb(), .target = target, .samples = samples, .internalformat = internalformat, .width = width, .height = height, .fixedsamplelocations = fixedsamplelocations }; NTSTATUS status; TRACE( "texture %d, target %d, samples %d, internalformat %d, width %d, height %d, fixedsamplelocations %d\n", texture, target, samples, internalformat, width, height, fixedsamplelocations ); + if (!alloc_context_objects( OBJ_TYPE_TEXTURE, 1, &texture, TRUE )) return; + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glTextureStorage2DMultisampleEXT, &args ))) WARN( "glTextureStorage2DMultisampleEXT returned %#lx\n", status ); } static void WINAPI glTextureStorage3D( GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth ) { - struct glTextureStorage3D_params args = { .teb = NtCurrentTeb(), .texture = texture, .levels = levels, .internalformat = internalformat, .width = width, .height = height, .depth = depth }; + struct glTextureStorage3D_params args = { .teb = NtCurrentTeb(), .levels = levels, .internalformat = internalformat, .width = width, .height = height, .depth = depth }; NTSTATUS status; TRACE( "texture %d, levels %d, internalformat %d, width %d, height %d, depth %d\n", texture, levels, internalformat, width, height, depth ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glTextureStorage3D, &args ))) WARN( "glTextureStorage3D returned %#lx\n", status ); } static void WINAPI glTextureStorage3DEXT( GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth ) { - struct glTextureStorage3DEXT_params args = { .teb = NtCurrentTeb(), .texture = texture, .target = target, .levels = levels, .internalformat = internalformat, .width = width, .height = height, .depth = depth }; + struct glTextureStorage3DEXT_params args = { .teb = NtCurrentTeb(), .target = target, .levels = levels, .internalformat = internalformat, .width = width, .height = height, .depth = depth }; NTSTATUS status; TRACE( "texture %d, target %d, levels %d, internalformat %d, width %d, height %d, depth %d\n", texture, target, levels, internalformat, width, height, depth ); + if (!alloc_context_objects( OBJ_TYPE_TEXTURE, 1, &texture, TRUE )) return; + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glTextureStorage3DEXT, &args ))) WARN( "glTextureStorage3DEXT returned %#lx\n", status ); } static void WINAPI glTextureStorage3DMultisample( GLuint texture, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations ) { - struct glTextureStorage3DMultisample_params args = { .teb = NtCurrentTeb(), .texture = texture, .samples = samples, .internalformat = internalformat, .width = width, .height = height, .depth = depth, .fixedsamplelocations = fixedsamplelocations }; + struct glTextureStorage3DMultisample_params args = { .teb = NtCurrentTeb(), .samples = samples, .internalformat = internalformat, .width = width, .height = height, .depth = depth, .fixedsamplelocations = fixedsamplelocations }; NTSTATUS status; TRACE( "texture %d, samples %d, internalformat %d, width %d, height %d, depth %d, fixedsamplelocations %d\n", texture, samples, internalformat, width, height, depth, fixedsamplelocations ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glTextureStorage3DMultisample, &args ))) WARN( "glTextureStorage3DMultisample returned %#lx\n", status ); } static void WINAPI glTextureStorage3DMultisampleEXT( GLuint texture, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations ) { - struct glTextureStorage3DMultisampleEXT_params args = { .teb = NtCurrentTeb(), .texture = texture, .target = target, .samples = samples, .internalformat = internalformat, .width = width, .height = height, .depth = depth, .fixedsamplelocations = fixedsamplelocations }; + struct glTextureStorage3DMultisampleEXT_params args = { .teb = NtCurrentTeb(), .target = target, .samples = samples, .internalformat = internalformat, .width = width, .height = height, .depth = depth, .fixedsamplelocations = fixedsamplelocations }; NTSTATUS status; TRACE( "texture %d, target %d, samples %d, internalformat %d, width %d, height %d, depth %d, fixedsamplelocations %d\n", texture, target, samples, internalformat, width, height, depth, fixedsamplelocations ); + if (!alloc_context_objects( OBJ_TYPE_TEXTURE, 1, &texture, TRUE )) return; + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glTextureStorage3DMultisampleEXT, &args ))) WARN( "glTextureStorage3DMultisampleEXT returned %#lx\n", status ); } static void WINAPI glTextureStorageMem1DEXT( GLuint texture, GLsizei levels, GLenum internalFormat, GLsizei width, GLuint memory, GLuint64 offset ) { - struct glTextureStorageMem1DEXT_params args = { .teb = NtCurrentTeb(), .texture = texture, .levels = levels, .internalFormat = internalFormat, .width = width, .memory = memory, .offset = offset }; + struct glTextureStorageMem1DEXT_params args = { .teb = NtCurrentTeb(), .levels = levels, .internalFormat = internalFormat, .width = width, .memory = memory, .offset = offset }; NTSTATUS status; TRACE( "texture %d, levels %d, internalFormat %d, width %d, memory %d, offset %s\n", texture, levels, internalFormat, width, memory, wine_dbgstr_longlong(offset) ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glTextureStorageMem1DEXT, &args ))) WARN( "glTextureStorageMem1DEXT returned %#lx\n", status ); } static void WINAPI glTextureStorageMem2DEXT( GLuint texture, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLuint memory, GLuint64 offset ) { - struct glTextureStorageMem2DEXT_params args = { .teb = NtCurrentTeb(), .texture = texture, .levels = levels, .internalFormat = internalFormat, .width = width, .height = height, .memory = memory, .offset = offset }; + struct glTextureStorageMem2DEXT_params args = { .teb = NtCurrentTeb(), .levels = levels, .internalFormat = internalFormat, .width = width, .height = height, .memory = memory, .offset = offset }; NTSTATUS status; TRACE( "texture %d, levels %d, internalFormat %d, width %d, height %d, memory %d, offset %s\n", texture, levels, internalFormat, width, height, memory, wine_dbgstr_longlong(offset) ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glTextureStorageMem2DEXT, &args ))) WARN( "glTextureStorageMem2DEXT returned %#lx\n", status ); } static void WINAPI glTextureStorageMem2DMultisampleEXT( GLuint texture, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset ) { - struct glTextureStorageMem2DMultisampleEXT_params args = { .teb = NtCurrentTeb(), .texture = texture, .samples = samples, .internalFormat = internalFormat, .width = width, .height = height, .fixedSampleLocations = fixedSampleLocations, .memory = memory, .offset = offset }; + struct glTextureStorageMem2DMultisampleEXT_params args = { .teb = NtCurrentTeb(), .samples = samples, .internalFormat = internalFormat, .width = width, .height = height, .fixedSampleLocations = fixedSampleLocations, .memory = memory, .offset = offset }; NTSTATUS status; TRACE( "texture %d, samples %d, internalFormat %d, width %d, height %d, fixedSampleLocations %d, memory %d, offset %s\n", texture, samples, internalFormat, width, height, fixedSampleLocations, memory, wine_dbgstr_longlong(offset) ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glTextureStorageMem2DMultisampleEXT, &args ))) WARN( "glTextureStorageMem2DMultisampleEXT returned %#lx\n", status ); } static void WINAPI glTextureStorageMem3DEXT( GLuint texture, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLuint memory, GLuint64 offset ) { - struct glTextureStorageMem3DEXT_params args = { .teb = NtCurrentTeb(), .texture = texture, .levels = levels, .internalFormat = internalFormat, .width = width, .height = height, .depth = depth, .memory = memory, .offset = offset }; + struct glTextureStorageMem3DEXT_params args = { .teb = NtCurrentTeb(), .levels = levels, .internalFormat = internalFormat, .width = width, .height = height, .depth = depth, .memory = memory, .offset = offset }; NTSTATUS status; TRACE( "texture %d, levels %d, internalFormat %d, width %d, height %d, depth %d, memory %d, offset %s\n", texture, levels, internalFormat, width, height, depth, memory, wine_dbgstr_longlong(offset) ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glTextureStorageMem3DEXT, &args ))) WARN( "glTextureStorageMem3DEXT returned %#lx\n", status ); } static void WINAPI glTextureStorageMem3DMultisampleEXT( GLuint texture, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset ) { - struct glTextureStorageMem3DMultisampleEXT_params args = { .teb = NtCurrentTeb(), .texture = texture, .samples = samples, .internalFormat = internalFormat, .width = width, .height = height, .depth = depth, .fixedSampleLocations = fixedSampleLocations, .memory = memory, .offset = offset }; + struct glTextureStorageMem3DMultisampleEXT_params args = { .teb = NtCurrentTeb(), .samples = samples, .internalFormat = internalFormat, .width = width, .height = height, .depth = depth, .fixedSampleLocations = fixedSampleLocations, .memory = memory, .offset = offset }; NTSTATUS status; TRACE( "texture %d, samples %d, internalFormat %d, width %d, height %d, depth %d, fixedSampleLocations %d, memory %d, offset %s\n", texture, samples, internalFormat, width, height, depth, fixedSampleLocations, memory, wine_dbgstr_longlong(offset) ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glTextureStorageMem3DMultisampleEXT, &args ))) WARN( "glTextureStorageMem3DMultisampleEXT returned %#lx\n", status ); } static void WINAPI glTextureStorageSparseAMD( GLuint texture, GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLsizei layers, GLbitfield flags ) { - struct glTextureStorageSparseAMD_params args = { .teb = NtCurrentTeb(), .texture = texture, .target = target, .internalFormat = internalFormat, .width = width, .height = height, .depth = depth, .layers = layers, .flags = flags }; + struct glTextureStorageSparseAMD_params args = { .teb = NtCurrentTeb(), .target = target, .internalFormat = internalFormat, .width = width, .height = height, .depth = depth, .layers = layers, .flags = flags }; NTSTATUS status; TRACE( "texture %d, target %d, internalFormat %d, width %d, height %d, depth %d, layers %d, flags %d\n", texture, target, internalFormat, width, height, depth, layers, flags ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glTextureStorageSparseAMD, &args ))) WARN( "glTextureStorageSparseAMD returned %#lx\n", status ); } static void WINAPI glTextureSubImage1D( GLuint texture, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels ) { - struct glTextureSubImage1D_params args = { .teb = NtCurrentTeb(), .texture = texture, .level = level, .xoffset = xoffset, .width = width, .format = format, .type = type, .pixels = pixels }; + struct glTextureSubImage1D_params args = { .teb = NtCurrentTeb(), .level = level, .xoffset = xoffset, .width = width, .format = format, .type = type, .pixels = pixels }; NTSTATUS status; TRACE( "texture %d, level %d, xoffset %d, width %d, format %d, type %d, pixels %p\n", texture, level, xoffset, width, format, type, pixels ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glTextureSubImage1D, &args ))) WARN( "glTextureSubImage1D returned %#lx\n", status ); } static void WINAPI glTextureSubImage1DEXT( GLuint texture, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels ) { - struct glTextureSubImage1DEXT_params args = { .teb = NtCurrentTeb(), .texture = texture, .target = target, .level = level, .xoffset = xoffset, .width = width, .format = format, .type = type, .pixels = pixels }; + struct glTextureSubImage1DEXT_params args = { .teb = NtCurrentTeb(), .target = target, .level = level, .xoffset = xoffset, .width = width, .format = format, .type = type, .pixels = pixels }; NTSTATUS status; TRACE( "texture %d, target %d, level %d, xoffset %d, width %d, format %d, type %d, pixels %p\n", texture, target, level, xoffset, width, format, type, pixels ); + if (!alloc_context_objects( OBJ_TYPE_TEXTURE, 1, &texture, TRUE )) return; + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glTextureSubImage1DEXT, &args ))) WARN( "glTextureSubImage1DEXT returned %#lx\n", status ); } static void WINAPI glTextureSubImage2D( GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels ) { - struct glTextureSubImage2D_params args = { .teb = NtCurrentTeb(), .texture = texture, .level = level, .xoffset = xoffset, .yoffset = yoffset, .width = width, .height = height, .format = format, .type = type, .pixels = pixels }; + struct glTextureSubImage2D_params args = { .teb = NtCurrentTeb(), .level = level, .xoffset = xoffset, .yoffset = yoffset, .width = width, .height = height, .format = format, .type = type, .pixels = pixels }; NTSTATUS status; TRACE( "texture %d, level %d, xoffset %d, yoffset %d, width %d, height %d, format %d, type %d, pixels %p\n", texture, level, xoffset, yoffset, width, height, format, type, pixels ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glTextureSubImage2D, &args ))) WARN( "glTextureSubImage2D returned %#lx\n", status ); } static void WINAPI glTextureSubImage2DEXT( GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels ) { - struct glTextureSubImage2DEXT_params args = { .teb = NtCurrentTeb(), .texture = texture, .target = target, .level = level, .xoffset = xoffset, .yoffset = yoffset, .width = width, .height = height, .format = format, .type = type, .pixels = pixels }; + struct glTextureSubImage2DEXT_params args = { .teb = NtCurrentTeb(), .target = target, .level = level, .xoffset = xoffset, .yoffset = yoffset, .width = width, .height = height, .format = format, .type = type, .pixels = pixels }; NTSTATUS status; TRACE( "texture %d, target %d, level %d, xoffset %d, yoffset %d, width %d, height %d, format %d, type %d, pixels %p\n", texture, target, level, xoffset, yoffset, width, height, format, type, pixels ); + if (!alloc_context_objects( OBJ_TYPE_TEXTURE, 1, &texture, TRUE )) return; + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glTextureSubImage2DEXT, &args ))) WARN( "glTextureSubImage2DEXT returned %#lx\n", status ); } static void WINAPI glTextureSubImage3D( GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels ) { - struct glTextureSubImage3D_params args = { .teb = NtCurrentTeb(), .texture = texture, .level = level, .xoffset = xoffset, .yoffset = yoffset, .zoffset = zoffset, .width = width, .height = height, .depth = depth, .format = format, .type = type, .pixels = pixels }; + struct glTextureSubImage3D_params args = { .teb = NtCurrentTeb(), .level = level, .xoffset = xoffset, .yoffset = yoffset, .zoffset = zoffset, .width = width, .height = height, .depth = depth, .format = format, .type = type, .pixels = pixels }; NTSTATUS status; TRACE( "texture %d, level %d, xoffset %d, yoffset %d, zoffset %d, width %d, height %d, depth %d, format %d, type %d, pixels %p\n", texture, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glTextureSubImage3D, &args ))) WARN( "glTextureSubImage3D returned %#lx\n", status ); } static void WINAPI glTextureSubImage3DEXT( GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels ) { - struct glTextureSubImage3DEXT_params args = { .teb = NtCurrentTeb(), .texture = texture, .target = target, .level = level, .xoffset = xoffset, .yoffset = yoffset, .zoffset = zoffset, .width = width, .height = height, .depth = depth, .format = format, .type = type, .pixels = pixels }; + struct glTextureSubImage3DEXT_params args = { .teb = NtCurrentTeb(), .target = target, .level = level, .xoffset = xoffset, .yoffset = yoffset, .zoffset = zoffset, .width = width, .height = height, .depth = depth, .format = format, .type = type, .pixels = pixels }; NTSTATUS status; TRACE( "texture %d, target %d, level %d, xoffset %d, yoffset %d, zoffset %d, width %d, height %d, depth %d, format %d, type %d, pixels %p\n", texture, target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels ); + if (!alloc_context_objects( OBJ_TYPE_TEXTURE, 1, &texture, TRUE )) return; + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glTextureSubImage3DEXT, &args ))) WARN( "glTextureSubImage3DEXT returned %#lx\n", status ); } static void WINAPI glTextureView( GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers ) { - struct glTextureView_params args = { .teb = NtCurrentTeb(), .texture = texture, .target = target, .origtexture = origtexture, .internalformat = internalformat, .minlevel = minlevel, .numlevels = numlevels, .minlayer = minlayer, .numlayers = numlayers }; + struct glTextureView_params args = { .teb = NtCurrentTeb(), .target = target, .internalformat = internalformat, .minlevel = minlevel, .numlevels = numlevels, .minlayer = minlayer, .numlayers = numlayers }; NTSTATUS status; TRACE( "texture %d, target %d, origtexture %d, internalformat %d, minlevel %d, numlevels %d, minlayer %d, numlayers %d\n", texture, target, origtexture, internalformat, minlevel, numlevels, minlayer, numlayers ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); + args.origtexture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &origtexture ); if ((status = UNIX_CALL( glTextureView, &args ))) WARN( "glTextureView returned %#lx\n", status ); } @@ -21594,9 +21826,10 @@ static void WINAPI glUnmapObjectBufferATI( GLuint buffer ) static void WINAPI glUnmapTexture2DINTEL( GLuint texture, GLint level ) { - struct glUnmapTexture2DINTEL_params args = { .teb = NtCurrentTeb(), .texture = texture, .level = level }; + struct glUnmapTexture2DINTEL_params args = { .teb = NtCurrentTeb(), .level = level }; NTSTATUS status; TRACE( "texture %d, level %d\n", texture, level ); + args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); if ((status = UNIX_CALL( glUnmapTexture2DINTEL, &args ))) WARN( "glUnmapTexture2DINTEL returned %#lx\n", status ); } @@ -21692,28 +21925,40 @@ static void WINAPI glVDPAUMapSurfacesNV( GLsizei numSurfaces, const GLvdpauSurfa static GLvdpauSurfaceNV WINAPI glVDPAURegisterOutputSurfaceNV( const void *vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames ) { - struct glVDPAURegisterOutputSurfaceNV_params args = { .teb = NtCurrentTeb(), .vdpSurface = vdpSurface, .target = target, .numTextureNames = numTextureNames, .textureNames = textureNames }; + GLuint textureNames_buf[64], *textureNames_tmp; + struct glVDPAURegisterOutputSurfaceNV_params args = { .teb = NtCurrentTeb(), .vdpSurface = vdpSurface, .target = target, .numTextureNames = numTextureNames }; NTSTATUS status; TRACE( "vdpSurface %p, target %d, numTextureNames %d, textureNames %p\n", vdpSurface, target, numTextureNames, textureNames ); + textureNames_tmp = numTextureNames > 0 ? memdup_objects( numTextureNames, textureNames, textureNames_buf, ARRAY_SIZE(textureNames_buf) ) : NULL; + args.textureNames = numTextureNames > 0 ? map_context_objects( OBJ_TYPE_TEXTURE, numTextureNames, textureNames_tmp ) : NULL; if ((status = UNIX_CALL( glVDPAURegisterOutputSurfaceNV, &args ))) WARN( "glVDPAURegisterOutputSurfaceNV returned %#lx\n", status ); + if (textureNames_tmp != textureNames_buf) free( textureNames_tmp ); return args.ret; } static GLvdpauSurfaceNV WINAPI glVDPAURegisterVideoSurfaceNV( const void *vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames ) { - struct glVDPAURegisterVideoSurfaceNV_params args = { .teb = NtCurrentTeb(), .vdpSurface = vdpSurface, .target = target, .numTextureNames = numTextureNames, .textureNames = textureNames }; + GLuint textureNames_buf[64], *textureNames_tmp; + struct glVDPAURegisterVideoSurfaceNV_params args = { .teb = NtCurrentTeb(), .vdpSurface = vdpSurface, .target = target, .numTextureNames = numTextureNames }; NTSTATUS status; TRACE( "vdpSurface %p, target %d, numTextureNames %d, textureNames %p\n", vdpSurface, target, numTextureNames, textureNames ); + textureNames_tmp = numTextureNames > 0 ? memdup_objects( numTextureNames, textureNames, textureNames_buf, ARRAY_SIZE(textureNames_buf) ) : NULL; + args.textureNames = numTextureNames > 0 ? map_context_objects( OBJ_TYPE_TEXTURE, numTextureNames, textureNames_tmp ) : NULL; if ((status = UNIX_CALL( glVDPAURegisterVideoSurfaceNV, &args ))) WARN( "glVDPAURegisterVideoSurfaceNV returned %#lx\n", status ); + if (textureNames_tmp != textureNames_buf) free( textureNames_tmp ); return args.ret; } static GLvdpauSurfaceNV WINAPI glVDPAURegisterVideoSurfaceWithPictureStructureNV( const void *vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames, GLboolean isFrameStructure ) { - struct glVDPAURegisterVideoSurfaceWithPictureStructureNV_params args = { .teb = NtCurrentTeb(), .vdpSurface = vdpSurface, .target = target, .numTextureNames = numTextureNames, .textureNames = textureNames, .isFrameStructure = isFrameStructure }; + GLuint textureNames_buf[64], *textureNames_tmp; + struct glVDPAURegisterVideoSurfaceWithPictureStructureNV_params args = { .teb = NtCurrentTeb(), .vdpSurface = vdpSurface, .target = target, .numTextureNames = numTextureNames, .isFrameStructure = isFrameStructure }; NTSTATUS status; TRACE( "vdpSurface %p, target %d, numTextureNames %d, textureNames %p, isFrameStructure %d\n", vdpSurface, target, numTextureNames, textureNames, isFrameStructure ); + textureNames_tmp = numTextureNames > 0 ? memdup_objects( numTextureNames, textureNames, textureNames_buf, ARRAY_SIZE(textureNames_buf) ) : NULL; + args.textureNames = numTextureNames > 0 ? map_context_objects( OBJ_TYPE_TEXTURE, numTextureNames, textureNames_tmp ) : NULL; if ((status = UNIX_CALL( glVDPAURegisterVideoSurfaceWithPictureStructureNV, &args ))) WARN( "glVDPAURegisterVideoSurfaceWithPictureStructureNV returned %#lx\n", status ); + if (textureNames_tmp != textureNames_buf) free( textureNames_tmp ); return args.ret; } @@ -24531,13 +24776,17 @@ static void WINAPI glViewportSwizzleNV( GLuint index, GLenum swizzlex, GLenum sw static void WINAPI glWaitSemaphoreEXT( GLuint semaphore, GLuint numBufferBarriers, const GLuint *buffers, GLuint numTextureBarriers, const GLuint *textures, const GLenum *srcLayouts ) { GLuint buffers_buf[64], *buffers_tmp; - struct glWaitSemaphoreEXT_params args = { .teb = NtCurrentTeb(), .semaphore = semaphore, .numBufferBarriers = numBufferBarriers, .numTextureBarriers = numTextureBarriers, .textures = textures, .srcLayouts = srcLayouts }; + GLuint textures_buf[64], *textures_tmp; + struct glWaitSemaphoreEXT_params args = { .teb = NtCurrentTeb(), .semaphore = semaphore, .numBufferBarriers = numBufferBarriers, .numTextureBarriers = numTextureBarriers, .srcLayouts = srcLayouts }; NTSTATUS status; TRACE( "semaphore %d, numBufferBarriers %d, buffers %p, numTextureBarriers %d, textures %p, srcLayouts %p\n", semaphore, numBufferBarriers, buffers, numTextureBarriers, textures, srcLayouts ); buffers_tmp = numBufferBarriers > 0 ? memdup_objects( numBufferBarriers, buffers, buffers_buf, ARRAY_SIZE(buffers_buf) ) : NULL; args.buffers = numBufferBarriers > 0 ? map_context_objects( OBJ_TYPE_BUFFER, numBufferBarriers, buffers_tmp ) : NULL; + textures_tmp = numTextureBarriers > 0 ? memdup_objects( numTextureBarriers, textures, textures_buf, ARRAY_SIZE(textures_buf) ) : NULL; + args.textures = numTextureBarriers > 0 ? map_context_objects( OBJ_TYPE_TEXTURE, numTextureBarriers, textures_tmp ) : NULL; if ((status = UNIX_CALL( glWaitSemaphoreEXT, &args ))) WARN( "glWaitSemaphoreEXT returned %#lx\n", status ); if (buffers_tmp != buffers_buf) free( buffers_tmp ); + if (textures_tmp != textures_buf) free( textures_tmp ); } static void WINAPI glWaitSemaphoreui64NVX( GLuint waitGpu, GLsizei fenceObjectCount, const GLuint *semaphoreArray, const GLuint64 *fenceValueArray ) diff --git a/dlls/opengl32/wgl.c b/dlls/opengl32/wgl.c index f4026318fea..3de3e025188 100644 --- a/dlls/opengl32/wgl.c +++ b/dlls/opengl32/wgl.c @@ -108,6 +108,7 @@ static const char *debugstr_object_type( enum object_type type ) case OBJ_TYPE_BUFFER: return "buffer"; case OBJ_TYPE_FRAMEBUFFER: return "framebuffer"; case OBJ_TYPE_RENDERBUFFER: return "renderbuffer"; + case OBJ_TYPE_TEXTURE: return "texture"; case OBJ_TYPE_COUNT: break; } return wine_dbg_sprintf( "object (type %u)", type ); @@ -390,6 +391,7 @@ static GLuint create_object( enum object_type type ) case OBJ_TYPE_BUFFER: { MAKE_OBJECT_CALL( glGenBuffers, .n = 1, .buffers = &object ); return object; } case OBJ_TYPE_FRAMEBUFFER: { MAKE_OBJECT_CALL( glGenFramebuffers, .n = 1, .framebuffers = &object ); return object; } case OBJ_TYPE_RENDERBUFFER: { MAKE_OBJECT_CALL( glGenRenderbuffers, .n = 1, .renderbuffers = &object ); return object; } + case OBJ_TYPE_TEXTURE: { MAKE_OBJECT_CALL( glGenTextures, .n = 1, .textures = &object ); return object; } case OBJ_TYPE_COUNT: break; } @@ -659,6 +661,27 @@ static GLuint get_pname_object_type( GLenum pname ) case GL_RENDERBUFFER_BINDING: case GL_TEXTURE_RENDERBUFFER_DATA_STORE_BINDING_NV: return OBJ_TYPE_RENDERBUFFER; + case GL_TEXTURE_BINDING_1D: + case GL_TEXTURE_BINDING_1D_ARRAY: + case GL_TEXTURE_BINDING_2D: + case GL_TEXTURE_BINDING_2D_ARRAY: + case GL_TEXTURE_BINDING_2D_MULTISAMPLE: + case GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY: + case GL_TEXTURE_BINDING_3D: + case GL_TEXTURE_BINDING_BUFFER: + case GL_TEXTURE_BINDING_CUBE_MAP: + case GL_TEXTURE_BINDING_CUBE_MAP_ARRAY: + case GL_TEXTURE_BINDING_EXTERNAL_OES: + case GL_TEXTURE_BINDING_RECTANGLE: + case GL_TEXTURE_BUFFER_BINDING: + case GL_TEXTURE_BINDING_RENDERBUFFER_NV: + case GL_TEXTURE_1D_STACK_BINDING_MESAX: + case GL_TEXTURE_2D_STACK_BINDING_MESAX: + case GL_TEXTURE_4D_BINDING_SGIS: + case GL_DETAIL_TEXTURE_2D_BINDING_SGIS: + case GL_SHADING_RATE_IMAGE_BINDING_NV: + case GL_IMAGE_BINDING_NAME: + return OBJ_TYPE_TEXTURE; } return OBJ_TYPE_COUNT; @@ -689,6 +712,7 @@ static void map_framebuffer_attachment_param( GLenum target, GLenum attachment, if (pname != GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME) return; glGetFramebufferAttachmentParameteriv( target, attachment, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, &type ); if (type == GL_RENDERBUFFER && map_client_objects( OBJ_TYPE_RENDERBUFFER, *params, (GLuint *)&value )) *params = value; + if (type == GL_TEXTURE && map_client_objects( OBJ_TYPE_TEXTURE, *params, (GLuint *)&value )) *params = value; } void WINAPI glGetFramebufferAttachmentParameteriv( GLenum target, GLenum attachment, GLenum pname, GLint *params ) @@ -720,6 +744,7 @@ static void map_named_framebuffer_attachment_param( GLuint framebuffer, GLenum a if (pname != GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME) return; glGetNamedFramebufferAttachmentParameteriv( framebuffer, attachment, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, &type ); if (type == GL_RENDERBUFFER && map_client_objects( OBJ_TYPE_RENDERBUFFER, *params, (GLuint *)&value )) *params = value; + if (type == GL_TEXTURE && map_client_objects( OBJ_TYPE_TEXTURE, *params, (GLuint *)&value )) *params = value; } void WINAPI glGetNamedFramebufferAttachmentParameteriv( GLuint framebuffer, GLenum attachment, GLenum pname, GLint *params ) -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/11125
From: Rémi Bernon <rbernon@codeweavers.com> --- dlls/opengl32/make_opengl | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/dlls/opengl32/make_opengl b/dlls/opengl32/make_opengl index c9ad56a4977..e86104be568 100755 --- a/dlls/opengl32/make_opengl +++ b/dlls/opengl32/make_opengl @@ -699,11 +699,37 @@ sub get_object_type($$$$) return "OBJ_TYPE_TEXTURE" if $func =~ /^glVDPAURegister/ and $pname eq "textureNames"; return "OBJ_TYPE_TEXTURE" if $func =~ /^gl(LGPU|Multicast|Async|)CopyImageSubData/ and $pname =~ /^(src|dst)Name$/; + return 0 if $class eq "Color"; + return 0 if $class eq "ColorIndexMask"; + return 0 if $class eq "perf query handle"; + return 0 if $class eq "perf query id"; + return 0 if $class eq "program pipeline"; + return 0 if $class eq "query"; + return 0 if $class eq "StencilMask"; + return 0 if $class eq "StencilValue"; return 0 if $class eq "SelectName"; + return 0 if $class eq "sync"; + return 0 if $class eq "transform feedback"; + return 0 if $class eq "vertex array"; + return 0 if $class =~ /^Vector/; return 0 if $func eq "glGetActiveAtomicCounterBufferiv" and $pname eq "bufferIndex"; return 0 if $func =~ /^glBlend(Equation|Func)/ and $pname eq "buf"; return 0 if $func =~ /^gl(Signal|Wait)Semaphore/ and $pname eq "numBufferBarriers"; + return 0 if $func =~ /^gl(Signal|Wait)Semaphore/ and $pname eq "numTextureBarriers"; + return 0 if $func eq "glCallCommandListNV" and $pname =~ /^list/; + return 0 if $func eq "glCommandListSegmentsNV" and $pname =~ /^list/; + return 0 if $func eq "glCompileCommandListNV" and $pname =~ /^list/; + return 0 if $func eq "glCreateCommandListsNV" and $pname =~ /^list/; + return 0 if $func eq "glDeleteCommandListsNV" and $pname =~ /^list/; + return 0 if $func eq "glIsCommandListNV" and $pname =~ /^list/; + return 0 if $func eq "glListDrawCommandsStatesClientNV" and $pname =~ /^list/; return 0 if $ptype !~ /GLuint|GLhandleARB/; + return 0 if $ptype =~ /GLuint \*/ and $pname =~ /^fences$/; + return 0 if $pname eq "fence"; + return 0 if $pname eq "vkSemaphore"; + return 0 if $pname eq "vkFence"; + return 0 if $pname eq "fenceValueArray"; + return 0 if $pname eq "pathParameterTemplate"; print "Missing possible buffer: $func $ptype $pname $class\n" if lc( $pname ) =~ /buffer/; print "Missing possible framebuffer: $func $ptype $pname $class\n" if lc( $pname ) =~ /fbo/; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/11125
From: Rémi Bernon <rbernon@codeweavers.com> --- dlls/opengl32/make_opengl | 3 ++ dlls/opengl32/private.h | 1 + dlls/opengl32/tests/opengl.c | 6 ++-- dlls/opengl32/thunks.c | 64 ++++++++++++++++++++++++++---------- dlls/opengl32/wgl.c | 5 +++ 5 files changed, 58 insertions(+), 21 deletions(-) diff --git a/dlls/opengl32/make_opengl b/dlls/opengl32/make_opengl index e86104be568..d47cf01c6a2 100755 --- a/dlls/opengl32/make_opengl +++ b/dlls/opengl32/make_opengl @@ -695,6 +695,7 @@ sub get_object_type($$$$) return "OBJ_TYPE_FRAMEBUFFER" if $class eq "framebuffer"; return "OBJ_TYPE_FRAMEBUFFER" if $pname =~ "fbo"; return "OBJ_TYPE_RENDERBUFFER" if $class eq "renderbuffer"; + return "OBJ_TYPE_SAMPLER" if $class eq "sampler"; return "OBJ_TYPE_TEXTURE" if $class eq "texture"; return "OBJ_TYPE_TEXTURE" if $func =~ /^glVDPAURegister/ and $pname eq "textureNames"; return "OBJ_TYPE_TEXTURE" if $func =~ /^gl(LGPU|Multicast|Async|)CopyImageSubData/ and $pname =~ /^(src|dst)Name$/; @@ -733,6 +734,7 @@ sub get_object_type($$$$) print "Missing possible buffer: $func $ptype $pname $class\n" if lc( $pname ) =~ /buffer/; print "Missing possible framebuffer: $func $ptype $pname $class\n" if lc( $pname ) =~ /fbo/; + print "Missing possible sampler: $func $ptype $pname $class\n" if lc( $pname ) =~ /sampler/; print "Missing possible texture: $func $ptype $pname $class\n" if lc( $pname ) =~ /texture/; return 0; } @@ -746,6 +748,7 @@ sub allocate_object_names($) return $ret if $name =~ /^glBindBuffer/; return $ret if $name =~ /^glBindFramebuffer/; return $ret if $name =~ /^glBindRenderbuffer/; + return $ret if $name =~ /^glBindSampler/; return $ret if $name =~ /^glBindTexture/; return 0; diff --git a/dlls/opengl32/private.h b/dlls/opengl32/private.h index f6bfb18fb92..6b6e8aa2714 100644 --- a/dlls/opengl32/private.h +++ b/dlls/opengl32/private.h @@ -51,6 +51,7 @@ enum object_type OBJ_TYPE_BUFFER, OBJ_TYPE_FRAMEBUFFER, OBJ_TYPE_RENDERBUFFER, + OBJ_TYPE_SAMPLER, OBJ_TYPE_TEXTURE, OBJ_TYPE_COUNT, }; diff --git a/dlls/opengl32/tests/opengl.c b/dlls/opengl32/tests/opengl.c index 7350a744990..c95e75255b9 100644 --- a/dlls/opengl32/tests/opengl.c +++ b/dlls/opengl32/tests/opengl.c @@ -2019,7 +2019,7 @@ static void test_sharelists(HDC winhdc) ok_ret( GL_NO_ERROR, glGetError() ); /* cannot overwrite non-empty lists with some other */ - todo_wine_if( i >= 8 ) ok_ret( FALSE, wglShareLists( ctx1, ctx3 ) ); + todo_wine_if( i >= 9 ) ok_ret( FALSE, wglShareLists( ctx1, ctx3 ) ); ok_ret( GL_NO_ERROR, glGetError() ); ok_ret( FALSE, wglShareLists( ctx2, ctx1 ) ); ok_ret( GL_NO_ERROR, glGetError() ); @@ -2067,7 +2067,7 @@ static void test_sharelists(HDC winhdc) ok_ret( GL_NO_ERROR, glGetError() ); ok_ret( TRUE, wglMakeCurrent( winhdc, ctx2 ) ); ok_ret( GL_NO_ERROR, glGetError() ); - todo_wine_if( i >= 8 ) ok_ret( FALSE, test->exists( obj1 ) ); + todo_wine_if( i >= 9 ) ok_ret( FALSE, test->exists( obj1 ) ); ok_ret( GL_NO_ERROR, glGetError() ); ok_ret( FALSE, test->exists( obj2 ) ); ok_ret( GL_NO_ERROR, glGetError() ); @@ -2078,7 +2078,7 @@ static void test_sharelists(HDC winhdc) ok_ret( TRUE, wglDeleteContext( ctx3 ) ); /* objects are still valid after shared context destruction */ - todo_wine_if( i >= 8 ) ok_ret( FALSE, test->exists( obj1 ) ); + todo_wine_if( i >= 9 ) ok_ret( FALSE, test->exists( obj1 ) ); ok_ret( GL_NO_ERROR, glGetError() ); ok_ret( FALSE, test->exists( obj2 ) ); ok_ret( GL_NO_ERROR, glGetError() ); diff --git a/dlls/opengl32/thunks.c b/dlls/opengl32/thunks.c index 0cd50ca1a4b..da932c36526 100644 --- a/dlls/opengl32/thunks.c +++ b/dlls/opengl32/thunks.c @@ -3394,18 +3394,25 @@ static void WINAPI glBindRenderbufferEXT( GLenum target, GLuint renderbuffer ) static void WINAPI glBindSampler( GLuint unit, GLuint sampler ) { - struct glBindSampler_params args = { .teb = NtCurrentTeb(), .unit = unit, .sampler = sampler }; + struct glBindSampler_params args = { .teb = NtCurrentTeb(), .unit = unit }; NTSTATUS status; TRACE( "unit %d, sampler %d\n", unit, sampler ); + if (!alloc_context_objects( OBJ_TYPE_SAMPLER, 1, &sampler, FALSE )) return; + args.sampler = *map_context_objects( OBJ_TYPE_SAMPLER, 1, &sampler ); if ((status = UNIX_CALL( glBindSampler, &args ))) WARN( "glBindSampler returned %#lx\n", status ); } static void WINAPI glBindSamplers( GLuint first, GLsizei count, const GLuint *samplers ) { - struct glBindSamplers_params args = { .teb = NtCurrentTeb(), .first = first, .count = count, .samplers = samplers }; + GLuint samplers_buf[64], *samplers_tmp; + struct glBindSamplers_params args = { .teb = NtCurrentTeb(), .first = first, .count = count }; NTSTATUS status; TRACE( "first %d, count %d, samplers %p\n", first, count, samplers ); + if (!alloc_context_objects( OBJ_TYPE_SAMPLER, count, samplers, FALSE )) return; + samplers_tmp = count > 0 ? memdup_objects( count, samplers, samplers_buf, ARRAY_SIZE(samplers_buf) ) : NULL; + args.samplers = count > 0 ? map_context_objects( OBJ_TYPE_SAMPLER, count, samplers_tmp ) : NULL; if ((status = UNIX_CALL( glBindSamplers, &args ))) WARN( "glBindSamplers returned %#lx\n", status ); + if (samplers_tmp != samplers_buf) free( samplers_tmp ); } static void WINAPI glBindShadingRateImageNV( GLuint texture ) @@ -5560,6 +5567,7 @@ static void WINAPI glCreateSamplers( GLsizei n, GLuint *samplers ) NTSTATUS status; TRACE( "n %d, samplers %p\n", n, samplers ); if ((status = UNIX_CALL( glCreateSamplers, &args ))) WARN( "glCreateSamplers returned %#lx\n", status ); + if (n > 0) put_context_objects( OBJ_TYPE_SAMPLER, n, samplers ); } static void WINAPI glCreateSemaphoresNV( GLsizei n, GLuint *semaphores ) @@ -6010,10 +6018,14 @@ static void WINAPI glDeleteRenderbuffersEXT( GLsizei n, const GLuint *renderbuff static void WINAPI glDeleteSamplers( GLsizei count, const GLuint *samplers ) { - struct glDeleteSamplers_params args = { .teb = NtCurrentTeb(), .count = count, .samplers = samplers }; + GLuint samplers_buf[64], *samplers_tmp; + struct glDeleteSamplers_params args = { .teb = NtCurrentTeb(), .count = count }; NTSTATUS status; TRACE( "count %d, samplers %p\n", count, samplers ); + samplers_tmp = count > 0 ? memdup_objects( count, samplers, samplers_buf, ARRAY_SIZE(samplers_buf) ) : NULL; + args.samplers = count > 0 ? del_context_objects( OBJ_TYPE_SAMPLER, count, samplers_tmp ) : NULL; if ((status = UNIX_CALL( glDeleteSamplers, &args ))) WARN( "glDeleteSamplers returned %#lx\n", status ); + if (samplers_tmp != samplers_buf) free( samplers_tmp ); } static void WINAPI glDeleteSemaphoresEXT( GLsizei n, const GLuint *semaphores ) @@ -6600,10 +6612,11 @@ static void WINAPI glDrawRangeElementsEXT( GLenum mode, GLuint start, GLuint end static void WINAPI glDrawTextureNV( GLuint texture, GLuint sampler, GLfloat x0, GLfloat y0, GLfloat x1, GLfloat y1, GLfloat z, GLfloat s0, GLfloat t0, GLfloat s1, GLfloat t1 ) { - struct glDrawTextureNV_params args = { .teb = NtCurrentTeb(), .sampler = sampler, .x0 = x0, .y0 = y0, .x1 = x1, .y1 = y1, .z = z, .s0 = s0, .t0 = t0, .s1 = s1, .t1 = t1 }; + struct glDrawTextureNV_params args = { .teb = NtCurrentTeb(), .x0 = x0, .y0 = y0, .x1 = x1, .y1 = y1, .z = z, .s0 = s0, .t0 = t0, .s1 = s1, .t1 = t1 }; NTSTATUS status; TRACE( "texture %d, sampler %d, x0 %f, y0 %f, x1 %f, y1 %f, z %f, s0 %f, t0 %f, s1 %f, t1 %f\n", texture, sampler, x0, y0, x1, y1, z, s0, t0, s1, t1 ); args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); + args.sampler = *map_context_objects( OBJ_TYPE_SAMPLER, 1, &sampler ); if ((status = UNIX_CALL( glDrawTextureNV, &args ))) WARN( "glDrawTextureNV returned %#lx\n", status ); } @@ -6649,9 +6662,10 @@ static void WINAPI glDrawTransformFeedbackStreamInstanced( GLenum mode, GLuint i static void WINAPI glDrawVkImageNV( GLuint64 vkImage, GLuint sampler, GLfloat x0, GLfloat y0, GLfloat x1, GLfloat y1, GLfloat z, GLfloat s0, GLfloat t0, GLfloat s1, GLfloat t1 ) { - struct glDrawVkImageNV_params args = { .teb = NtCurrentTeb(), .vkImage = vkImage, .sampler = sampler, .x0 = x0, .y0 = y0, .x1 = x1, .y1 = y1, .z = z, .s0 = s0, .t0 = t0, .s1 = s1, .t1 = t1 }; + struct glDrawVkImageNV_params args = { .teb = NtCurrentTeb(), .vkImage = vkImage, .x0 = x0, .y0 = y0, .x1 = x1, .y1 = y1, .z = z, .s0 = s0, .t0 = t0, .s1 = s1, .t1 = t1 }; NTSTATUS status; TRACE( "vkImage %s, sampler %d, x0 %f, y0 %f, x1 %f, y1 %f, z %f, s0 %f, t0 %f, s1 %f, t1 %f\n", wine_dbgstr_longlong(vkImage), sampler, x0, y0, x1, y1, z, s0, t0, s1, t1 ); + args.sampler = *map_context_objects( OBJ_TYPE_SAMPLER, 1, &sampler ); if ((status = UNIX_CALL( glDrawVkImageNV, &args ))) WARN( "glDrawVkImageNV returned %#lx\n", status ); } @@ -7852,6 +7866,7 @@ static void WINAPI glGenSamplers( GLsizei count, GLuint *samplers ) NTSTATUS status; TRACE( "count %d, samplers %p\n", count, samplers ); if ((status = UNIX_CALL( glGenSamplers, &args ))) WARN( "glGenSamplers returned %#lx\n", status ); + if (count > 0) put_context_objects( OBJ_TYPE_SAMPLER, count, samplers ); } static void WINAPI glGenSemaphoresEXT( GLsizei n, GLuint *semaphores ) @@ -10191,33 +10206,37 @@ static void WINAPI glGetRenderbufferParameterivEXT( GLenum target, GLenum pname, static void WINAPI glGetSamplerParameterIiv( GLuint sampler, GLenum pname, GLint *params ) { - struct glGetSamplerParameterIiv_params args = { .teb = NtCurrentTeb(), .sampler = sampler, .pname = pname, .params = params }; + struct glGetSamplerParameterIiv_params args = { .teb = NtCurrentTeb(), .pname = pname, .params = params }; NTSTATUS status; TRACE( "sampler %d, pname %d, params %p\n", sampler, pname, params ); + args.sampler = *map_context_objects( OBJ_TYPE_SAMPLER, 1, &sampler ); if ((status = UNIX_CALL( glGetSamplerParameterIiv, &args ))) WARN( "glGetSamplerParameterIiv returned %#lx\n", status ); } static void WINAPI glGetSamplerParameterIuiv( GLuint sampler, GLenum pname, GLuint *params ) { - struct glGetSamplerParameterIuiv_params args = { .teb = NtCurrentTeb(), .sampler = sampler, .pname = pname, .params = params }; + struct glGetSamplerParameterIuiv_params args = { .teb = NtCurrentTeb(), .pname = pname, .params = params }; NTSTATUS status; TRACE( "sampler %d, pname %d, params %p\n", sampler, pname, params ); + args.sampler = *map_context_objects( OBJ_TYPE_SAMPLER, 1, &sampler ); if ((status = UNIX_CALL( glGetSamplerParameterIuiv, &args ))) WARN( "glGetSamplerParameterIuiv returned %#lx\n", status ); } static void WINAPI glGetSamplerParameterfv( GLuint sampler, GLenum pname, GLfloat *params ) { - struct glGetSamplerParameterfv_params args = { .teb = NtCurrentTeb(), .sampler = sampler, .pname = pname, .params = params }; + struct glGetSamplerParameterfv_params args = { .teb = NtCurrentTeb(), .pname = pname, .params = params }; NTSTATUS status; TRACE( "sampler %d, pname %d, params %p\n", sampler, pname, params ); + args.sampler = *map_context_objects( OBJ_TYPE_SAMPLER, 1, &sampler ); if ((status = UNIX_CALL( glGetSamplerParameterfv, &args ))) WARN( "glGetSamplerParameterfv returned %#lx\n", status ); } static void WINAPI glGetSamplerParameteriv( GLuint sampler, GLenum pname, GLint *params ) { - struct glGetSamplerParameteriv_params args = { .teb = NtCurrentTeb(), .sampler = sampler, .pname = pname, .params = params }; + struct glGetSamplerParameteriv_params args = { .teb = NtCurrentTeb(), .pname = pname, .params = params }; NTSTATUS status; TRACE( "sampler %d, pname %d, params %p\n", sampler, pname, params ); + args.sampler = *map_context_objects( OBJ_TYPE_SAMPLER, 1, &sampler ); if ((status = UNIX_CALL( glGetSamplerParameteriv, &args ))) WARN( "glGetSamplerParameteriv returned %#lx\n", status ); } @@ -10630,20 +10649,22 @@ static void WINAPI glGetTextureParameterivEXT( GLuint texture, GLenum target, GL static GLuint64 WINAPI glGetTextureSamplerHandleARB( GLuint texture, GLuint sampler ) { - struct glGetTextureSamplerHandleARB_params args = { .teb = NtCurrentTeb(), .sampler = sampler }; + struct glGetTextureSamplerHandleARB_params args = { .teb = NtCurrentTeb() }; NTSTATUS status; TRACE( "texture %d, sampler %d\n", texture, sampler ); args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); + args.sampler = *map_context_objects( OBJ_TYPE_SAMPLER, 1, &sampler ); if ((status = UNIX_CALL( glGetTextureSamplerHandleARB, &args ))) WARN( "glGetTextureSamplerHandleARB returned %#lx\n", status ); return args.ret; } static GLuint64 WINAPI glGetTextureSamplerHandleNV( GLuint texture, GLuint sampler ) { - struct glGetTextureSamplerHandleNV_params args = { .teb = NtCurrentTeb(), .sampler = sampler }; + struct glGetTextureSamplerHandleNV_params args = { .teb = NtCurrentTeb() }; NTSTATUS status; TRACE( "texture %d, sampler %d\n", texture, sampler ); args.texture = *map_context_objects( OBJ_TYPE_TEXTURE, 1, &texture ); + args.sampler = *map_context_objects( OBJ_TYPE_SAMPLER, 1, &sampler ); if ((status = UNIX_CALL( glGetTextureSamplerHandleNV, &args ))) WARN( "glGetTextureSamplerHandleNV returned %#lx\n", status ); return args.ret; } @@ -12220,9 +12241,10 @@ static GLboolean WINAPI glIsRenderbufferEXT( GLuint renderbuffer ) static GLboolean WINAPI glIsSampler( GLuint sampler ) { - struct glIsSampler_params args = { .teb = NtCurrentTeb(), .sampler = sampler }; + struct glIsSampler_params args = { .teb = NtCurrentTeb() }; NTSTATUS status; TRACE( "sampler %d\n", sampler ); + args.sampler = *map_context_objects( OBJ_TYPE_SAMPLER, 1, &sampler ); if ((status = UNIX_CALL( glIsSampler, &args ))) WARN( "glIsSampler returned %#lx\n", status ); return args.ret; } @@ -18334,49 +18356,55 @@ static void WINAPI glSamplePatternSGIS( GLenum pattern ) static void WINAPI glSamplerParameterIiv( GLuint sampler, GLenum pname, const GLint *param ) { - struct glSamplerParameterIiv_params args = { .teb = NtCurrentTeb(), .sampler = sampler, .pname = pname, .param = param }; + struct glSamplerParameterIiv_params args = { .teb = NtCurrentTeb(), .pname = pname, .param = param }; NTSTATUS status; TRACE( "sampler %d, pname %d, param %p\n", sampler, pname, param ); + args.sampler = *map_context_objects( OBJ_TYPE_SAMPLER, 1, &sampler ); if ((status = UNIX_CALL( glSamplerParameterIiv, &args ))) WARN( "glSamplerParameterIiv returned %#lx\n", status ); } static void WINAPI glSamplerParameterIuiv( GLuint sampler, GLenum pname, const GLuint *param ) { - struct glSamplerParameterIuiv_params args = { .teb = NtCurrentTeb(), .sampler = sampler, .pname = pname, .param = param }; + struct glSamplerParameterIuiv_params args = { .teb = NtCurrentTeb(), .pname = pname, .param = param }; NTSTATUS status; TRACE( "sampler %d, pname %d, param %p\n", sampler, pname, param ); + args.sampler = *map_context_objects( OBJ_TYPE_SAMPLER, 1, &sampler ); if ((status = UNIX_CALL( glSamplerParameterIuiv, &args ))) WARN( "glSamplerParameterIuiv returned %#lx\n", status ); } static void WINAPI glSamplerParameterf( GLuint sampler, GLenum pname, GLfloat param ) { - struct glSamplerParameterf_params args = { .teb = NtCurrentTeb(), .sampler = sampler, .pname = pname, .param = param }; + struct glSamplerParameterf_params args = { .teb = NtCurrentTeb(), .pname = pname, .param = param }; NTSTATUS status; TRACE( "sampler %d, pname %d, param %f\n", sampler, pname, param ); + args.sampler = *map_context_objects( OBJ_TYPE_SAMPLER, 1, &sampler ); if ((status = UNIX_CALL( glSamplerParameterf, &args ))) WARN( "glSamplerParameterf returned %#lx\n", status ); } static void WINAPI glSamplerParameterfv( GLuint sampler, GLenum pname, const GLfloat *param ) { - struct glSamplerParameterfv_params args = { .teb = NtCurrentTeb(), .sampler = sampler, .pname = pname, .param = param }; + struct glSamplerParameterfv_params args = { .teb = NtCurrentTeb(), .pname = pname, .param = param }; NTSTATUS status; TRACE( "sampler %d, pname %d, param %p\n", sampler, pname, param ); + args.sampler = *map_context_objects( OBJ_TYPE_SAMPLER, 1, &sampler ); if ((status = UNIX_CALL( glSamplerParameterfv, &args ))) WARN( "glSamplerParameterfv returned %#lx\n", status ); } static void WINAPI glSamplerParameteri( GLuint sampler, GLenum pname, GLint param ) { - struct glSamplerParameteri_params args = { .teb = NtCurrentTeb(), .sampler = sampler, .pname = pname, .param = param }; + struct glSamplerParameteri_params args = { .teb = NtCurrentTeb(), .pname = pname, .param = param }; NTSTATUS status; TRACE( "sampler %d, pname %d, param %d\n", sampler, pname, param ); + args.sampler = *map_context_objects( OBJ_TYPE_SAMPLER, 1, &sampler ); if ((status = UNIX_CALL( glSamplerParameteri, &args ))) WARN( "glSamplerParameteri returned %#lx\n", status ); } static void WINAPI glSamplerParameteriv( GLuint sampler, GLenum pname, const GLint *param ) { - struct glSamplerParameteriv_params args = { .teb = NtCurrentTeb(), .sampler = sampler, .pname = pname, .param = param }; + struct glSamplerParameteriv_params args = { .teb = NtCurrentTeb(), .pname = pname, .param = param }; NTSTATUS status; TRACE( "sampler %d, pname %d, param %p\n", sampler, pname, param ); + args.sampler = *map_context_objects( OBJ_TYPE_SAMPLER, 1, &sampler ); if ((status = UNIX_CALL( glSamplerParameteriv, &args ))) WARN( "glSamplerParameteriv returned %#lx\n", status ); } diff --git a/dlls/opengl32/wgl.c b/dlls/opengl32/wgl.c index 3de3e025188..89bc1d6130f 100644 --- a/dlls/opengl32/wgl.c +++ b/dlls/opengl32/wgl.c @@ -108,6 +108,7 @@ static const char *debugstr_object_type( enum object_type type ) case OBJ_TYPE_BUFFER: return "buffer"; case OBJ_TYPE_FRAMEBUFFER: return "framebuffer"; case OBJ_TYPE_RENDERBUFFER: return "renderbuffer"; + case OBJ_TYPE_SAMPLER: return "sampler"; case OBJ_TYPE_TEXTURE: return "texture"; case OBJ_TYPE_COUNT: break; } @@ -391,6 +392,7 @@ static GLuint create_object( enum object_type type ) case OBJ_TYPE_BUFFER: { MAKE_OBJECT_CALL( glGenBuffers, .n = 1, .buffers = &object ); return object; } case OBJ_TYPE_FRAMEBUFFER: { MAKE_OBJECT_CALL( glGenFramebuffers, .n = 1, .framebuffers = &object ); return object; } case OBJ_TYPE_RENDERBUFFER: { MAKE_OBJECT_CALL( glGenRenderbuffers, .n = 1, .renderbuffers = &object ); return object; } + case OBJ_TYPE_SAMPLER: { MAKE_OBJECT_CALL( glGenSamplers, .count = 1, .samplers = &object ); return object; } case OBJ_TYPE_TEXTURE: { MAKE_OBJECT_CALL( glGenTextures, .n = 1, .textures = &object ); return object; } case OBJ_TYPE_COUNT: break; } @@ -576,6 +578,7 @@ BOOL alloc_context_objects( enum object_type type, UINT n, const GLuint *handles if (ctx->base.profile_mask & WGL_CONTEXT_CORE_PROFILE_BIT_ARB) alloc_client = FALSE; if (type == OBJ_TYPE_FRAMEBUFFER) alloc_client = extension; if (type == OBJ_TYPE_RENDERBUFFER) alloc_client = extension; + if (type == OBJ_TYPE_SAMPLER) alloc_client = FALSE; AcquireSRWLockShared( &table->lock ); for (UINT i = 0; i < n && !needs_client; i++) @@ -682,6 +685,8 @@ static GLuint get_pname_object_type( GLenum pname ) case GL_SHADING_RATE_IMAGE_BINDING_NV: case GL_IMAGE_BINDING_NAME: return OBJ_TYPE_TEXTURE; + case GL_SAMPLER_BINDING: + return OBJ_TYPE_SAMPLER; } return OBJ_TYPE_COUNT; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/11125
participants (1)
-
Rémi Bernon -
Rémi Bernon (@rbernon)