From: Rémi Bernon <rbernon@codeweavers.com> --- dlls/opengl32/make_opengl | 13 +- dlls/opengl32/private.h | 1 + dlls/opengl32/tests/opengl.c | 4 +- dlls/opengl32/thunks.c | 339 ++++++++++++++++++++++++----------- dlls/opengl32/wgl.c | 112 +++++++++++- 5 files changed, 356 insertions(+), 113 deletions(-) diff --git a/dlls/opengl32/make_opengl b/dlls/opengl32/make_opengl index acd30ef6a39..86d8a2604be 100755 --- a/dlls/opengl32/make_opengl +++ b/dlls/opengl32/make_opengl @@ -769,8 +769,19 @@ sub generate_win_thunk($$) if ($len eq "1") { $checks .= " if (!alloc_context_objects( $map_type, 1, &$pname, $alloc )) return$return;\n" if $alloc; + $map_args .= " args.$pname = *map_context_objects( $map_type, 1, &$pname );\n"; + } + else + { + my ($buf, $tmp) = ($pname . "_buf", $pname . "_tmp"); + $ret .= " GLuint $buf\[64\], *$tmp;\n"; + $len =~ s/^COMPSIZE\((.*)\)$/$1/; + + $checks .= " if (!alloc_context_objects( $map_type, $len, $pname, $alloc )) return$return;\n" if $alloc; + $map_args .= " $tmp = $len > 0 ? memdup_objects( $len, $pname, $buf, ARRAY_SIZE($buf) ) : NULL;\n"; + $map_args .= " args.$pname = $len > 0 ? map_context_objects( $map_type, $len, $tmp ) : NULL;\n"; + $post_call .= " if ($tmp != $buf) free( $tmp );\n"; } - $params .= ", .$pname = $pname"; } } else diff --git a/dlls/opengl32/private.h b/dlls/opengl32/private.h index 50dc33c9a86..334ce6b7868 100644 --- a/dlls/opengl32/private.h +++ b/dlls/opengl32/private.h @@ -63,5 +63,6 @@ static inline GLuint *memdup_objects( UINT n, const GLuint *handles, GLuint *buf extern void put_context_objects( enum object_type type, UINT n, GLuint *handles ); extern BOOL alloc_context_objects( enum object_type type, UINT n, const GLuint *handles, BOOL extension ); extern GLuint *del_context_objects( enum object_type type, UINT n, GLuint *handles ); +extern GLuint *map_context_objects( enum object_type type, UINT n, GLuint *handles ); #endif /* __WINE_OPENGL32_PRIVATE_H */ diff --git a/dlls/opengl32/tests/opengl.c b/dlls/opengl32/tests/opengl.c index 21099838434..352c21fa2c7 100644 --- a/dlls/opengl32/tests/opengl.c +++ b/dlls/opengl32/tests/opengl.c @@ -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 ok_ret( FALSE, test->exists( obj1 ) ); + todo_wine_if( i >= 2 ) 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 ok_ret( FALSE, test->exists( obj1 ) ); + todo_wine_if( i >= 2 ) 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 8eff4b922b0..cc40a29554a 100644 --- a/dlls/opengl32/thunks.c +++ b/dlls/opengl32/thunks.c @@ -2894,17 +2894,20 @@ static void WINAPI glArrayElementEXT( GLint i ) static void WINAPI glArrayObjectATI( GLenum array, GLint size, GLenum type, GLsizei stride, GLuint buffer, GLuint offset ) { - struct glArrayObjectATI_params args = { .teb = NtCurrentTeb(), .array = array, .size = size, .type = type, .stride = stride, .buffer = buffer, .offset = offset }; + struct glArrayObjectATI_params args = { .teb = NtCurrentTeb(), .array = array, .size = size, .type = type, .stride = stride, .offset = offset }; NTSTATUS status; TRACE( "array %d, size %d, type %d, stride %d, buffer %d, offset %d\n", array, size, type, stride, buffer, offset ); + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glArrayObjectATI, &args ))) WARN( "glArrayObjectATI returned %#lx\n", status ); } static GLuint WINAPI glAsyncCopyBufferSubDataNVX( GLsizei waitSemaphoreCount, const GLuint *waitSemaphoreArray, const GLuint64 *fenceValueArray, GLuint readGpu, GLbitfield writeGpuMask, GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size, GLsizei signalSemaphoreCount, const GLuint *signalSemaphoreArray, const GLuint64 *signalValueArray ) { - struct glAsyncCopyBufferSubDataNVX_params args = { .teb = NtCurrentTeb(), .waitSemaphoreCount = waitSemaphoreCount, .waitSemaphoreArray = waitSemaphoreArray, .fenceValueArray = fenceValueArray, .readGpu = readGpu, .writeGpuMask = writeGpuMask, .readBuffer = readBuffer, .writeBuffer = writeBuffer, .readOffset = readOffset, .writeOffset = writeOffset, .size = size, .signalSemaphoreCount = signalSemaphoreCount, .signalSemaphoreArray = signalSemaphoreArray, .signalValueArray = signalValueArray }; + struct glAsyncCopyBufferSubDataNVX_params args = { .teb = NtCurrentTeb(), .waitSemaphoreCount = waitSemaphoreCount, .waitSemaphoreArray = waitSemaphoreArray, .fenceValueArray = fenceValueArray, .readGpu = readGpu, .writeGpuMask = writeGpuMask, .readOffset = readOffset, .writeOffset = writeOffset, .size = size, .signalSemaphoreCount = signalSemaphoreCount, .signalSemaphoreArray = signalSemaphoreArray, .signalValueArray = signalValueArray }; NTSTATUS status; TRACE( "waitSemaphoreCount %d, waitSemaphoreArray %p, fenceValueArray %p, readGpu %d, writeGpuMask %d, readBuffer %d, writeBuffer %d, readOffset %Id, writeOffset %Id, size %Id, signalSemaphoreCount %d, signalSemaphoreArray %p, signalValueArray %p\n", waitSemaphoreCount, waitSemaphoreArray, fenceValueArray, readGpu, writeGpuMask, readBuffer, writeBuffer, readOffset, writeOffset, size, signalSemaphoreCount, signalSemaphoreArray, signalValueArray ); + args.readBuffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &readBuffer ); + args.writeBuffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &writeBuffer ); if ((status = UNIX_CALL( glAsyncCopyBufferSubDataNVX, &args ))) WARN( "glAsyncCopyBufferSubDataNVX returned %#lx\n", status ); return args.ret; } @@ -3080,108 +3083,128 @@ static void WINAPI glBindAttribLocationARB( GLhandleARB programObj, GLuint index static void WINAPI glBindBuffer( GLenum target, GLuint buffer ) { - struct glBindBuffer_params args = { .teb = NtCurrentTeb(), .target = target, .buffer = buffer }; + struct glBindBuffer_params args = { .teb = NtCurrentTeb(), .target = target }; NTSTATUS status; TRACE( "target %d, buffer %d\n", target, buffer ); if (!alloc_context_objects( OBJ_TYPE_BUFFER, 1, &buffer, FALSE )) return; + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glBindBuffer, &args ))) WARN( "glBindBuffer returned %#lx\n", status ); } static void WINAPI glBindBufferARB( GLenum target, GLuint buffer ) { - struct glBindBufferARB_params args = { .teb = NtCurrentTeb(), .target = target, .buffer = buffer }; + struct glBindBufferARB_params args = { .teb = NtCurrentTeb(), .target = target }; NTSTATUS status; TRACE( "target %d, buffer %d\n", target, buffer ); if (!alloc_context_objects( OBJ_TYPE_BUFFER, 1, &buffer, TRUE )) return; + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glBindBufferARB, &args ))) WARN( "glBindBufferARB returned %#lx\n", status ); } static void WINAPI glBindBufferBase( GLenum target, GLuint index, GLuint buffer ) { - struct glBindBufferBase_params args = { .teb = NtCurrentTeb(), .target = target, .index = index, .buffer = buffer }; + struct glBindBufferBase_params args = { .teb = NtCurrentTeb(), .target = target, .index = index }; NTSTATUS status; TRACE( "target %d, index %d, buffer %d\n", target, index, buffer ); if (!alloc_context_objects( OBJ_TYPE_BUFFER, 1, &buffer, FALSE )) return; + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glBindBufferBase, &args ))) WARN( "glBindBufferBase returned %#lx\n", status ); } static void WINAPI glBindBufferBaseEXT( GLenum target, GLuint index, GLuint buffer ) { - struct glBindBufferBaseEXT_params args = { .teb = NtCurrentTeb(), .target = target, .index = index, .buffer = buffer }; + struct glBindBufferBaseEXT_params args = { .teb = NtCurrentTeb(), .target = target, .index = index }; NTSTATUS status; TRACE( "target %d, index %d, buffer %d\n", target, index, buffer ); if (!alloc_context_objects( OBJ_TYPE_BUFFER, 1, &buffer, TRUE )) return; + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glBindBufferBaseEXT, &args ))) WARN( "glBindBufferBaseEXT returned %#lx\n", status ); } static void WINAPI glBindBufferBaseNV( GLenum target, GLuint index, GLuint buffer ) { - struct glBindBufferBaseNV_params args = { .teb = NtCurrentTeb(), .target = target, .index = index, .buffer = buffer }; + struct glBindBufferBaseNV_params args = { .teb = NtCurrentTeb(), .target = target, .index = index }; NTSTATUS status; TRACE( "target %d, index %d, buffer %d\n", target, index, buffer ); if (!alloc_context_objects( OBJ_TYPE_BUFFER, 1, &buffer, TRUE )) return; + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glBindBufferBaseNV, &args ))) WARN( "glBindBufferBaseNV returned %#lx\n", status ); } static void WINAPI glBindBufferOffsetEXT( GLenum target, GLuint index, GLuint buffer, GLintptr offset ) { - struct glBindBufferOffsetEXT_params args = { .teb = NtCurrentTeb(), .target = target, .index = index, .buffer = buffer, .offset = offset }; + struct glBindBufferOffsetEXT_params args = { .teb = NtCurrentTeb(), .target = target, .index = index, .offset = offset }; NTSTATUS status; TRACE( "target %d, index %d, buffer %d, offset %Id\n", target, index, buffer, offset ); if (!alloc_context_objects( OBJ_TYPE_BUFFER, 1, &buffer, TRUE )) return; + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glBindBufferOffsetEXT, &args ))) WARN( "glBindBufferOffsetEXT returned %#lx\n", status ); } static void WINAPI glBindBufferOffsetNV( GLenum target, GLuint index, GLuint buffer, GLintptr offset ) { - struct glBindBufferOffsetNV_params args = { .teb = NtCurrentTeb(), .target = target, .index = index, .buffer = buffer, .offset = offset }; + struct glBindBufferOffsetNV_params args = { .teb = NtCurrentTeb(), .target = target, .index = index, .offset = offset }; NTSTATUS status; TRACE( "target %d, index %d, buffer %d, offset %Id\n", target, index, buffer, offset ); if (!alloc_context_objects( OBJ_TYPE_BUFFER, 1, &buffer, TRUE )) return; + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glBindBufferOffsetNV, &args ))) WARN( "glBindBufferOffsetNV returned %#lx\n", status ); } static void WINAPI glBindBufferRange( GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size ) { - struct glBindBufferRange_params args = { .teb = NtCurrentTeb(), .target = target, .index = index, .buffer = buffer, .offset = offset, .size = size }; + struct glBindBufferRange_params args = { .teb = NtCurrentTeb(), .target = target, .index = index, .offset = offset, .size = size }; NTSTATUS status; TRACE( "target %d, index %d, buffer %d, offset %Id, size %Id\n", target, index, buffer, offset, size ); if (!alloc_context_objects( OBJ_TYPE_BUFFER, 1, &buffer, FALSE )) return; + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glBindBufferRange, &args ))) WARN( "glBindBufferRange returned %#lx\n", status ); } static void WINAPI glBindBufferRangeEXT( GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size ) { - struct glBindBufferRangeEXT_params args = { .teb = NtCurrentTeb(), .target = target, .index = index, .buffer = buffer, .offset = offset, .size = size }; + struct glBindBufferRangeEXT_params args = { .teb = NtCurrentTeb(), .target = target, .index = index, .offset = offset, .size = size }; NTSTATUS status; TRACE( "target %d, index %d, buffer %d, offset %Id, size %Id\n", target, index, buffer, offset, size ); if (!alloc_context_objects( OBJ_TYPE_BUFFER, 1, &buffer, TRUE )) return; + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glBindBufferRangeEXT, &args ))) WARN( "glBindBufferRangeEXT returned %#lx\n", status ); } static void WINAPI glBindBufferRangeNV( GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size ) { - struct glBindBufferRangeNV_params args = { .teb = NtCurrentTeb(), .target = target, .index = index, .buffer = buffer, .offset = offset, .size = size }; + struct glBindBufferRangeNV_params args = { .teb = NtCurrentTeb(), .target = target, .index = index, .offset = offset, .size = size }; NTSTATUS status; TRACE( "target %d, index %d, buffer %d, offset %Id, size %Id\n", target, index, buffer, offset, size ); if (!alloc_context_objects( OBJ_TYPE_BUFFER, 1, &buffer, TRUE )) return; + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glBindBufferRangeNV, &args ))) WARN( "glBindBufferRangeNV returned %#lx\n", status ); } static void WINAPI glBindBuffersBase( GLenum target, GLuint first, GLsizei count, const GLuint *buffers ) { - struct glBindBuffersBase_params args = { .teb = NtCurrentTeb(), .target = target, .first = first, .count = count, .buffers = buffers }; + GLuint buffers_buf[64], *buffers_tmp; + struct glBindBuffersBase_params args = { .teb = NtCurrentTeb(), .target = target, .first = first, .count = count }; NTSTATUS status; TRACE( "target %d, first %d, count %d, buffers %p\n", target, first, count, buffers ); + if (!alloc_context_objects( OBJ_TYPE_BUFFER, count, buffers, FALSE )) return; + buffers_tmp = count > 0 ? memdup_objects( count, buffers, buffers_buf, ARRAY_SIZE(buffers_buf) ) : NULL; + args.buffers = count > 0 ? map_context_objects( OBJ_TYPE_BUFFER, count, buffers_tmp ) : NULL; if ((status = UNIX_CALL( glBindBuffersBase, &args ))) WARN( "glBindBuffersBase returned %#lx\n", status ); + if (buffers_tmp != buffers_buf) free( buffers_tmp ); } static void WINAPI glBindBuffersRange( GLenum target, GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizeiptr *sizes ) { - struct glBindBuffersRange_params args = { .teb = NtCurrentTeb(), .target = target, .first = first, .count = count, .buffers = buffers, .offsets = offsets, .sizes = sizes }; + GLuint buffers_buf[64], *buffers_tmp; + struct glBindBuffersRange_params args = { .teb = NtCurrentTeb(), .target = target, .first = first, .count = count, .offsets = offsets, .sizes = sizes }; NTSTATUS status; TRACE( "target %d, first %d, count %d, buffers %p, offsets %p, sizes %p\n", target, first, count, buffers, offsets, sizes ); + if (!alloc_context_objects( OBJ_TYPE_BUFFER, count, buffers, FALSE )) return; + buffers_tmp = count > 0 ? memdup_objects( count, buffers, buffers_buf, ARRAY_SIZE(buffers_buf) ) : NULL; + args.buffers = count > 0 ? map_context_objects( OBJ_TYPE_BUFFER, count, buffers_tmp ) : NULL; if ((status = UNIX_CALL( glBindBuffersRange, &args ))) WARN( "glBindBuffersRange returned %#lx\n", status ); + if (buffers_tmp != buffers_buf) free( buffers_tmp ); } static void WINAPI glBindFragDataLocation( GLuint program, GLuint color, const GLchar *name ) @@ -3431,18 +3454,23 @@ static void WINAPI glBindVertexArrayAPPLE( GLuint array ) static void WINAPI glBindVertexBuffer( GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride ) { - struct glBindVertexBuffer_params args = { .teb = NtCurrentTeb(), .bindingindex = bindingindex, .buffer = buffer, .offset = offset, .stride = stride }; + struct glBindVertexBuffer_params args = { .teb = NtCurrentTeb(), .bindingindex = bindingindex, .offset = offset, .stride = stride }; NTSTATUS status; TRACE( "bindingindex %d, buffer %d, offset %Id, stride %d\n", bindingindex, buffer, offset, stride ); + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glBindVertexBuffer, &args ))) WARN( "glBindVertexBuffer returned %#lx\n", status ); } static void WINAPI glBindVertexBuffers( GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizei *strides ) { - struct glBindVertexBuffers_params args = { .teb = NtCurrentTeb(), .first = first, .count = count, .buffers = buffers, .offsets = offsets, .strides = strides }; + GLuint buffers_buf[64], *buffers_tmp; + struct glBindVertexBuffers_params args = { .teb = NtCurrentTeb(), .first = first, .count = count, .offsets = offsets, .strides = strides }; NTSTATUS status; TRACE( "first %d, count %d, buffers %p, offsets %p, strides %p\n", first, count, buffers, offsets, strides ); + buffers_tmp = count > 0 ? memdup_objects( count, buffers, buffers_buf, ARRAY_SIZE(buffers_buf) ) : NULL; + args.buffers = count > 0 ? map_context_objects( OBJ_TYPE_BUFFER, count, buffers_tmp ) : NULL; if ((status = UNIX_CALL( glBindVertexBuffers, &args ))) WARN( "glBindVertexBuffers returned %#lx\n", status ); + if (buffers_tmp != buffers_buf) free( buffers_tmp ); } static void WINAPI glBindVertexShaderEXT( GLuint id ) @@ -4108,35 +4136,39 @@ static void WINAPI glClearDepthxOES( GLfixed depth ) static void WINAPI glClearNamedBufferData( GLuint buffer, GLenum internalformat, GLenum format, GLenum type, const void *data ) { - struct glClearNamedBufferData_params args = { .teb = NtCurrentTeb(), .buffer = buffer, .internalformat = internalformat, .format = format, .type = type, .data = data }; + struct glClearNamedBufferData_params args = { .teb = NtCurrentTeb(), .internalformat = internalformat, .format = format, .type = type, .data = data }; NTSTATUS status; TRACE( "buffer %d, internalformat %d, format %d, type %d, data %p\n", buffer, internalformat, format, type, data ); + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glClearNamedBufferData, &args ))) WARN( "glClearNamedBufferData returned %#lx\n", status ); } static void WINAPI glClearNamedBufferDataEXT( GLuint buffer, GLenum internalformat, GLenum format, GLenum type, const void *data ) { - struct glClearNamedBufferDataEXT_params args = { .teb = NtCurrentTeb(), .buffer = buffer, .internalformat = internalformat, .format = format, .type = type, .data = data }; + struct glClearNamedBufferDataEXT_params args = { .teb = NtCurrentTeb(), .internalformat = internalformat, .format = format, .type = type, .data = data }; NTSTATUS status; TRACE( "buffer %d, internalformat %d, format %d, type %d, data %p\n", buffer, internalformat, format, type, data ); if (!alloc_context_objects( OBJ_TYPE_BUFFER, 1, &buffer, TRUE )) return; + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glClearNamedBufferDataEXT, &args ))) WARN( "glClearNamedBufferDataEXT returned %#lx\n", status ); } static void WINAPI glClearNamedBufferSubData( GLuint buffer, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data ) { - struct glClearNamedBufferSubData_params args = { .teb = NtCurrentTeb(), .buffer = buffer, .internalformat = internalformat, .offset = offset, .size = size, .format = format, .type = type, .data = data }; + struct glClearNamedBufferSubData_params args = { .teb = NtCurrentTeb(), .internalformat = internalformat, .offset = offset, .size = size, .format = format, .type = type, .data = data }; NTSTATUS status; TRACE( "buffer %d, internalformat %d, offset %Id, size %Id, format %d, type %d, data %p\n", buffer, internalformat, offset, size, format, type, data ); + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glClearNamedBufferSubData, &args ))) WARN( "glClearNamedBufferSubData returned %#lx\n", status ); } static void WINAPI glClearNamedBufferSubDataEXT( GLuint buffer, GLenum internalformat, GLsizeiptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data ) { - struct glClearNamedBufferSubDataEXT_params args = { .teb = NtCurrentTeb(), .buffer = buffer, .internalformat = internalformat, .offset = offset, .size = size, .format = format, .type = type, .data = data }; + struct glClearNamedBufferSubDataEXT_params args = { .teb = NtCurrentTeb(), .internalformat = internalformat, .offset = offset, .size = size, .format = format, .type = type, .data = data }; NTSTATUS status; TRACE( "buffer %d, internalformat %d, offset %Id, size %Id, format %d, type %d, data %p\n", buffer, internalformat, offset, size, format, type, data ); if (!alloc_context_objects( OBJ_TYPE_BUFFER, 1, &buffer, TRUE )) return; + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glClearNamedBufferSubDataEXT, &args ))) WARN( "glClearNamedBufferSubDataEXT returned %#lx\n", status ); } @@ -5160,9 +5192,11 @@ static void WINAPI glCopyMultiTexSubImage3DEXT( GLenum texunit, GLenum target, G static void WINAPI glCopyNamedBufferSubData( GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size ) { - struct glCopyNamedBufferSubData_params args = { .teb = NtCurrentTeb(), .readBuffer = readBuffer, .writeBuffer = writeBuffer, .readOffset = readOffset, .writeOffset = writeOffset, .size = size }; + struct glCopyNamedBufferSubData_params args = { .teb = NtCurrentTeb(), .readOffset = readOffset, .writeOffset = writeOffset, .size = size }; NTSTATUS status; TRACE( "readBuffer %d, writeBuffer %d, readOffset %Id, writeOffset %Id, size %Id\n", readBuffer, writeBuffer, readOffset, writeOffset, size ); + args.readBuffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &readBuffer ); + args.writeBuffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &writeBuffer ); if ((status = UNIX_CALL( glCopyNamedBufferSubData, &args ))) WARN( "glCopyNamedBufferSubData returned %#lx\n", status ); } @@ -6257,9 +6291,10 @@ static void WINAPI glDrawCommandsAddressNV( GLenum primitiveMode, const GLuint64 static void WINAPI glDrawCommandsNV( GLenum primitiveMode, GLuint buffer, const GLintptr *indirects, const GLsizei *sizes, GLuint count ) { - struct glDrawCommandsNV_params args = { .teb = NtCurrentTeb(), .primitiveMode = primitiveMode, .buffer = buffer, .indirects = indirects, .sizes = sizes, .count = count }; + struct glDrawCommandsNV_params args = { .teb = NtCurrentTeb(), .primitiveMode = primitiveMode, .indirects = indirects, .sizes = sizes, .count = count }; NTSTATUS status; TRACE( "primitiveMode %d, buffer %d, indirects %p, sizes %p, count %d\n", primitiveMode, buffer, indirects, sizes, count ); + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glDrawCommandsNV, &args ))) WARN( "glDrawCommandsNV returned %#lx\n", status ); } @@ -6273,9 +6308,10 @@ static void WINAPI glDrawCommandsStatesAddressNV( const GLuint64 *indirects, con 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(), .buffer = buffer, .indirects = indirects, .sizes = sizes, .states = states, .fbos = fbos, .count = count }; + struct glDrawCommandsStatesNV_params args = { .teb = NtCurrentTeb(), .indirects = indirects, .sizes = sizes, .states = states, .fbos = fbos, .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 ); if ((status = UNIX_CALL( glDrawCommandsStatesNV, &args ))) WARN( "glDrawCommandsStatesNV returned %#lx\n", status ); } @@ -6898,18 +6934,20 @@ static void WINAPI glFlushMappedBufferRangeAPPLE( GLenum target, GLintptr offset static void WINAPI glFlushMappedNamedBufferRange( GLuint buffer, GLintptr offset, GLsizeiptr length ) { - struct glFlushMappedNamedBufferRange_params args = { .teb = NtCurrentTeb(), .buffer = buffer, .offset = offset, .length = length }; + struct glFlushMappedNamedBufferRange_params args = { .teb = NtCurrentTeb(), .offset = offset, .length = length }; NTSTATUS status; TRACE( "buffer %d, offset %Id, length %Id\n", buffer, offset, length ); + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glFlushMappedNamedBufferRange, &args ))) WARN( "glFlushMappedNamedBufferRange returned %#lx\n", status ); } static void WINAPI glFlushMappedNamedBufferRangeEXT( GLuint buffer, GLintptr offset, GLsizeiptr length ) { - struct glFlushMappedNamedBufferRangeEXT_params args = { .teb = NtCurrentTeb(), .buffer = buffer, .offset = offset, .length = length }; + struct glFlushMappedNamedBufferRangeEXT_params args = { .teb = NtCurrentTeb(), .offset = offset, .length = length }; NTSTATUS status; TRACE( "buffer %d, offset %Id, length %Id\n", buffer, offset, length ); if (!alloc_context_objects( OBJ_TYPE_BUFFER, 1, &buffer, TRUE )) return; + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glFlushMappedNamedBufferRangeEXT, &args ))) WARN( "glFlushMappedNamedBufferRangeEXT returned %#lx\n", status ); } @@ -7451,9 +7489,10 @@ static void WINAPI glFramebufferTextureMultiviewOVR( GLenum target, GLenum attac static void WINAPI glFreeObjectBufferATI( GLuint buffer ) { - struct glFreeObjectBufferATI_params args = { .teb = NtCurrentTeb(), .buffer = buffer }; + struct glFreeObjectBufferATI_params args = { .teb = NtCurrentTeb() }; NTSTATUS status; TRACE( "buffer %d\n", buffer ); + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glFreeObjectBufferATI, &args ))) WARN( "glFreeObjectBufferATI returned %#lx\n", status ); } @@ -9089,68 +9128,76 @@ static void WINAPI glGetMultisamplefvNV( GLenum pname, GLuint index, GLfloat *va static void WINAPI glGetNamedBufferParameteri64v( GLuint buffer, GLenum pname, GLint64 *params ) { - struct glGetNamedBufferParameteri64v_params args = { .teb = NtCurrentTeb(), .buffer = buffer, .pname = pname, .params = params }; + struct glGetNamedBufferParameteri64v_params args = { .teb = NtCurrentTeb(), .pname = pname, .params = params }; NTSTATUS status; TRACE( "buffer %d, pname %d, params %p\n", buffer, pname, params ); + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glGetNamedBufferParameteri64v, &args ))) WARN( "glGetNamedBufferParameteri64v returned %#lx\n", status ); } static void WINAPI glGetNamedBufferParameteriv( GLuint buffer, GLenum pname, GLint *params ) { - struct glGetNamedBufferParameteriv_params args = { .teb = NtCurrentTeb(), .buffer = buffer, .pname = pname, .params = params }; + struct glGetNamedBufferParameteriv_params args = { .teb = NtCurrentTeb(), .pname = pname, .params = params }; NTSTATUS status; TRACE( "buffer %d, pname %d, params %p\n", buffer, pname, params ); + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glGetNamedBufferParameteriv, &args ))) WARN( "glGetNamedBufferParameteriv returned %#lx\n", status ); } static void WINAPI glGetNamedBufferParameterivEXT( GLuint buffer, GLenum pname, GLint *params ) { - struct glGetNamedBufferParameterivEXT_params args = { .teb = NtCurrentTeb(), .buffer = buffer, .pname = pname, .params = params }; + struct glGetNamedBufferParameterivEXT_params args = { .teb = NtCurrentTeb(), .pname = pname, .params = params }; NTSTATUS status; TRACE( "buffer %d, pname %d, params %p\n", buffer, pname, params ); if (!alloc_context_objects( OBJ_TYPE_BUFFER, 1, &buffer, TRUE )) return; + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glGetNamedBufferParameterivEXT, &args ))) WARN( "glGetNamedBufferParameterivEXT returned %#lx\n", status ); } static void WINAPI glGetNamedBufferParameterui64vNV( GLuint buffer, GLenum pname, GLuint64EXT *params ) { - struct glGetNamedBufferParameterui64vNV_params args = { .teb = NtCurrentTeb(), .buffer = buffer, .pname = pname, .params = params }; + struct glGetNamedBufferParameterui64vNV_params args = { .teb = NtCurrentTeb(), .pname = pname, .params = params }; NTSTATUS status; TRACE( "buffer %d, pname %d, params %p\n", buffer, pname, params ); + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glGetNamedBufferParameterui64vNV, &args ))) WARN( "glGetNamedBufferParameterui64vNV returned %#lx\n", status ); } static void WINAPI glGetNamedBufferPointerv( GLuint buffer, GLenum pname, void **params ) { - struct glGetNamedBufferPointerv_params args = { .teb = NtCurrentTeb(), .buffer = buffer, .pname = pname, .params = params }; + struct glGetNamedBufferPointerv_params args = { .teb = NtCurrentTeb(), .pname = pname, .params = params }; NTSTATUS status; TRACE( "buffer %d, pname %d, params %p\n", buffer, pname, params ); + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glGetNamedBufferPointerv, &args ))) WARN( "glGetNamedBufferPointerv returned %#lx\n", status ); } static void WINAPI glGetNamedBufferPointervEXT( GLuint buffer, GLenum pname, void **params ) { - struct glGetNamedBufferPointervEXT_params args = { .teb = NtCurrentTeb(), .buffer = buffer, .pname = pname, .params = params }; + struct glGetNamedBufferPointervEXT_params args = { .teb = NtCurrentTeb(), .pname = pname, .params = params }; NTSTATUS status; TRACE( "buffer %d, pname %d, params %p\n", buffer, pname, params ); if (!alloc_context_objects( OBJ_TYPE_BUFFER, 1, &buffer, TRUE )) return; + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glGetNamedBufferPointervEXT, &args ))) WARN( "glGetNamedBufferPointervEXT returned %#lx\n", status ); } static void WINAPI glGetNamedBufferSubData( GLuint buffer, GLintptr offset, GLsizeiptr size, void *data ) { - struct glGetNamedBufferSubData_params args = { .teb = NtCurrentTeb(), .buffer = buffer, .offset = offset, .size = size, .data = data }; + struct glGetNamedBufferSubData_params args = { .teb = NtCurrentTeb(), .offset = offset, .size = size, .data = data }; NTSTATUS status; TRACE( "buffer %d, offset %Id, size %Id, data %p\n", buffer, offset, size, data ); + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glGetNamedBufferSubData, &args ))) WARN( "glGetNamedBufferSubData returned %#lx\n", status ); } static void WINAPI glGetNamedBufferSubDataEXT( GLuint buffer, GLintptr offset, GLsizeiptr size, void *data ) { - struct glGetNamedBufferSubDataEXT_params args = { .teb = NtCurrentTeb(), .buffer = buffer, .offset = offset, .size = size, .data = data }; + struct glGetNamedBufferSubDataEXT_params args = { .teb = NtCurrentTeb(), .offset = offset, .size = size, .data = data }; NTSTATUS status; TRACE( "buffer %d, offset %Id, size %Id, data %p\n", buffer, offset, size, data ); if (!alloc_context_objects( OBJ_TYPE_BUFFER, 1, &buffer, TRUE )) return; + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glGetNamedBufferSubDataEXT, &args ))) WARN( "glGetNamedBufferSubDataEXT returned %#lx\n", status ); } @@ -9288,17 +9335,19 @@ static void WINAPI glGetNextPerfQueryIdINTEL( GLuint queryId, GLuint *nextQueryI static void WINAPI glGetObjectBufferfvATI( GLuint buffer, GLenum pname, GLfloat *params ) { - struct glGetObjectBufferfvATI_params args = { .teb = NtCurrentTeb(), .buffer = buffer, .pname = pname, .params = params }; + struct glGetObjectBufferfvATI_params args = { .teb = NtCurrentTeb(), .pname = pname, .params = params }; NTSTATUS status; TRACE( "buffer %d, pname %d, params %p\n", buffer, pname, params ); + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glGetObjectBufferfvATI, &args ))) WARN( "glGetObjectBufferfvATI returned %#lx\n", status ); } static void WINAPI glGetObjectBufferivATI( GLuint buffer, GLenum pname, GLint *params ) { - struct glGetObjectBufferivATI_params args = { .teb = NtCurrentTeb(), .buffer = buffer, .pname = pname, .params = params }; + struct glGetObjectBufferivATI_params args = { .teb = NtCurrentTeb(), .pname = pname, .params = params }; NTSTATUS status; TRACE( "buffer %d, pname %d, params %p\n", buffer, pname, params ); + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glGetObjectBufferivATI, &args ))) WARN( "glGetObjectBufferivATI returned %#lx\n", status ); } @@ -9870,33 +9919,37 @@ static void WINAPI glGetProgramivNV( GLuint id, GLenum pname, GLint *params ) static void WINAPI glGetQueryBufferObjecti64v( GLuint id, GLuint buffer, GLenum pname, GLintptr offset ) { - struct glGetQueryBufferObjecti64v_params args = { .teb = NtCurrentTeb(), .id = id, .buffer = buffer, .pname = pname, .offset = offset }; + struct glGetQueryBufferObjecti64v_params args = { .teb = NtCurrentTeb(), .id = id, .pname = pname, .offset = offset }; NTSTATUS status; TRACE( "id %d, buffer %d, pname %d, offset %Id\n", id, buffer, pname, offset ); + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glGetQueryBufferObjecti64v, &args ))) WARN( "glGetQueryBufferObjecti64v returned %#lx\n", status ); } static void WINAPI glGetQueryBufferObjectiv( GLuint id, GLuint buffer, GLenum pname, GLintptr offset ) { - struct glGetQueryBufferObjectiv_params args = { .teb = NtCurrentTeb(), .id = id, .buffer = buffer, .pname = pname, .offset = offset }; + struct glGetQueryBufferObjectiv_params args = { .teb = NtCurrentTeb(), .id = id, .pname = pname, .offset = offset }; NTSTATUS status; TRACE( "id %d, buffer %d, pname %d, offset %Id\n", id, buffer, pname, offset ); + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glGetQueryBufferObjectiv, &args ))) WARN( "glGetQueryBufferObjectiv returned %#lx\n", status ); } static void WINAPI glGetQueryBufferObjectui64v( GLuint id, GLuint buffer, GLenum pname, GLintptr offset ) { - struct glGetQueryBufferObjectui64v_params args = { .teb = NtCurrentTeb(), .id = id, .buffer = buffer, .pname = pname, .offset = offset }; + struct glGetQueryBufferObjectui64v_params args = { .teb = NtCurrentTeb(), .id = id, .pname = pname, .offset = offset }; NTSTATUS status; TRACE( "id %d, buffer %d, pname %d, offset %Id\n", id, buffer, pname, offset ); + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glGetQueryBufferObjectui64v, &args ))) WARN( "glGetQueryBufferObjectui64v returned %#lx\n", status ); } static void WINAPI glGetQueryBufferObjectuiv( GLuint id, GLuint buffer, GLenum pname, GLintptr offset ) { - struct glGetQueryBufferObjectuiv_params args = { .teb = NtCurrentTeb(), .id = id, .buffer = buffer, .pname = pname, .offset = offset }; + struct glGetQueryBufferObjectuiv_params args = { .teb = NtCurrentTeb(), .id = id, .pname = pname, .offset = offset }; NTSTATUS status; TRACE( "id %d, buffer %d, pname %d, offset %Id\n", id, buffer, pname, offset ); + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glGetQueryBufferObjectuiv, &args ))) WARN( "glGetQueryBufferObjectuiv returned %#lx\n", status ); } @@ -11661,17 +11714,19 @@ static void WINAPI glInterpolatePathsNV( GLuint resultPath, GLuint pathA, GLuint static void WINAPI glInvalidateBufferData( GLuint buffer ) { - struct glInvalidateBufferData_params args = { .teb = NtCurrentTeb(), .buffer = buffer }; + struct glInvalidateBufferData_params args = { .teb = NtCurrentTeb() }; NTSTATUS status; TRACE( "buffer %d\n", buffer ); + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glInvalidateBufferData, &args ))) WARN( "glInvalidateBufferData returned %#lx\n", status ); } static void WINAPI glInvalidateBufferSubData( GLuint buffer, GLintptr offset, GLsizeiptr length ) { - struct glInvalidateBufferSubData_params args = { .teb = NtCurrentTeb(), .buffer = buffer, .offset = offset, .length = length }; + struct glInvalidateBufferSubData_params args = { .teb = NtCurrentTeb(), .offset = offset, .length = length }; NTSTATUS status; TRACE( "buffer %d, offset %Id, length %Id\n", buffer, offset, length ); + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glInvalidateBufferSubData, &args ))) WARN( "glInvalidateBufferSubData returned %#lx\n", status ); } @@ -11734,18 +11789,20 @@ static GLboolean WINAPI glIsAsyncMarkerSGIX( GLuint marker ) static GLboolean WINAPI glIsBuffer( GLuint buffer ) { - struct glIsBuffer_params args = { .teb = NtCurrentTeb(), .buffer = buffer }; + struct glIsBuffer_params args = { .teb = NtCurrentTeb() }; NTSTATUS status; TRACE( "buffer %d\n", buffer ); + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glIsBuffer, &args ))) WARN( "glIsBuffer returned %#lx\n", status ); return args.ret; } static GLboolean WINAPI glIsBufferARB( GLuint buffer ) { - struct glIsBufferARB_params args = { .teb = NtCurrentTeb(), .buffer = buffer }; + struct glIsBufferARB_params args = { .teb = NtCurrentTeb() }; NTSTATUS status; TRACE( "buffer %d\n", buffer ); + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glIsBufferARB, &args ))) WARN( "glIsBufferARB returned %#lx\n", status ); return args.ret; } @@ -11860,9 +11917,10 @@ static GLboolean WINAPI glIsNameAMD( GLenum identifier, GLuint name ) static GLboolean WINAPI glIsNamedBufferResidentNV( GLuint buffer ) { - struct glIsNamedBufferResidentNV_params args = { .teb = NtCurrentTeb(), .buffer = buffer }; + struct glIsNamedBufferResidentNV_params args = { .teb = NtCurrentTeb() }; NTSTATUS status; TRACE( "buffer %d\n", buffer ); + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glIsNamedBufferResidentNV, &args ))) WARN( "glIsNamedBufferResidentNV returned %#lx\n", status ); return args.ret; } @@ -11878,9 +11936,10 @@ static GLboolean WINAPI glIsNamedStringARB( GLint namelen, const GLchar *name ) static GLboolean WINAPI glIsObjectBufferATI( GLuint buffer ) { - struct glIsObjectBufferATI_params args = { .teb = NtCurrentTeb(), .buffer = buffer }; + struct glIsObjectBufferATI_params args = { .teb = NtCurrentTeb() }; NTSTATUS status; TRACE( "buffer %d\n", buffer ); + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glIsObjectBufferATI, &args ))) WARN( "glIsObjectBufferATI returned %#lx\n", status ); return args.ret; } @@ -12138,9 +12197,10 @@ static void WINAPI glLGPUInterlockNVX(void) static void WINAPI glLGPUNamedBufferSubDataNVX( GLbitfield gpuMask, GLuint buffer, GLintptr offset, GLsizeiptr size, const void *data ) { - struct glLGPUNamedBufferSubDataNVX_params args = { .teb = NtCurrentTeb(), .gpuMask = gpuMask, .buffer = buffer, .offset = offset, .size = size, .data = data }; + struct glLGPUNamedBufferSubDataNVX_params args = { .teb = NtCurrentTeb(), .gpuMask = gpuMask, .offset = offset, .size = size, .data = data }; NTSTATUS status; TRACE( "gpuMask %d, buffer %d, offset %Id, size %Id, data %p\n", gpuMask, buffer, offset, size, data ); + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glLGPUNamedBufferSubDataNVX, &args ))) WARN( "glLGPUNamedBufferSubDataNVX returned %#lx\n", status ); } @@ -12442,17 +12502,19 @@ static void WINAPI glMakeImageHandleResidentNV( GLuint64 handle, GLenum access ) static void WINAPI glMakeNamedBufferNonResidentNV( GLuint buffer ) { - struct glMakeNamedBufferNonResidentNV_params args = { .teb = NtCurrentTeb(), .buffer = buffer }; + struct glMakeNamedBufferNonResidentNV_params args = { .teb = NtCurrentTeb() }; NTSTATUS status; TRACE( "buffer %d\n", buffer ); + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glMakeNamedBufferNonResidentNV, &args ))) WARN( "glMakeNamedBufferNonResidentNV returned %#lx\n", status ); } static void WINAPI glMakeNamedBufferResidentNV( GLuint buffer, GLenum access ) { - struct glMakeNamedBufferResidentNV_params args = { .teb = NtCurrentTeb(), .buffer = buffer, .access = access }; + struct glMakeNamedBufferResidentNV_params args = { .teb = NtCurrentTeb(), .access = access }; NTSTATUS status; TRACE( "buffer %d, access %d\n", buffer, access ); + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glMakeNamedBufferResidentNV, &args ))) WARN( "glMakeNamedBufferResidentNV returned %#lx\n", status ); } @@ -12557,47 +12619,52 @@ static void WINAPI glMapGrid2xOES( GLint n, GLfixed u1, GLfixed u2, GLfixed v1, static void * WINAPI glMapNamedBuffer( GLuint buffer, GLenum access ) { - struct glMapNamedBuffer_params args = { .teb = NtCurrentTeb(), .buffer = buffer, .access = access }; + struct glMapNamedBuffer_params args = { .teb = NtCurrentTeb(), .access = access }; NTSTATUS status; TRACE( "buffer %d, access %d\n", buffer, access ); + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glMapNamedBuffer, &args ))) WARN( "glMapNamedBuffer returned %#lx\n", status ); return args.ret; } static void * WINAPI glMapNamedBufferEXT( GLuint buffer, GLenum access ) { - struct glMapNamedBufferEXT_params args = { .teb = NtCurrentTeb(), .buffer = buffer, .access = access }; + struct glMapNamedBufferEXT_params args = { .teb = NtCurrentTeb(), .access = access }; NTSTATUS status; TRACE( "buffer %d, access %d\n", buffer, access ); if (!alloc_context_objects( OBJ_TYPE_BUFFER, 1, &buffer, TRUE )) return args.ret; + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glMapNamedBufferEXT, &args ))) WARN( "glMapNamedBufferEXT returned %#lx\n", status ); return args.ret; } static void * WINAPI glMapNamedBufferRange( GLuint buffer, GLintptr offset, GLsizeiptr length, GLbitfield access ) { - struct glMapNamedBufferRange_params args = { .teb = NtCurrentTeb(), .buffer = buffer, .offset = offset, .length = length, .access = access }; + struct glMapNamedBufferRange_params args = { .teb = NtCurrentTeb(), .offset = offset, .length = length, .access = access }; NTSTATUS status; TRACE( "buffer %d, offset %Id, length %Id, access %d\n", buffer, offset, length, access ); + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glMapNamedBufferRange, &args ))) WARN( "glMapNamedBufferRange returned %#lx\n", status ); return args.ret; } static void * WINAPI glMapNamedBufferRangeEXT( GLuint buffer, GLintptr offset, GLsizeiptr length, GLbitfield access ) { - struct glMapNamedBufferRangeEXT_params args = { .teb = NtCurrentTeb(), .buffer = buffer, .offset = offset, .length = length, .access = access }; + struct glMapNamedBufferRangeEXT_params args = { .teb = NtCurrentTeb(), .offset = offset, .length = length, .access = access }; NTSTATUS status; TRACE( "buffer %d, offset %Id, length %Id, access %d\n", buffer, offset, length, access ); if (!alloc_context_objects( OBJ_TYPE_BUFFER, 1, &buffer, TRUE )) return args.ret; + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glMapNamedBufferRangeEXT, &args ))) WARN( "glMapNamedBufferRangeEXT returned %#lx\n", status ); return args.ret; } static void * WINAPI glMapObjectBufferATI( GLuint buffer ) { - struct glMapObjectBufferATI_params args = { .teb = NtCurrentTeb(), .buffer = buffer }; + struct glMapObjectBufferATI_params args = { .teb = NtCurrentTeb() }; NTSTATUS status; TRACE( "buffer %d\n", buffer ); + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glMapObjectBufferATI, &args ))) WARN( "glMapObjectBufferATI returned %#lx\n", status ); return args.ret; } @@ -13261,10 +13328,11 @@ static void WINAPI glMultiModeDrawElementsIBM( const GLenum *mode, const GLsizei static void WINAPI glMultiTexBufferEXT( GLenum texunit, GLenum target, GLenum internalformat, GLuint buffer ) { - struct glMultiTexBufferEXT_params args = { .teb = NtCurrentTeb(), .texunit = texunit, .target = target, .internalformat = internalformat, .buffer = buffer }; + struct glMultiTexBufferEXT_params args = { .teb = NtCurrentTeb(), .texunit = texunit, .target = target, .internalformat = internalformat }; NTSTATUS status; TRACE( "texunit %d, target %d, internalformat %d, buffer %d\n", texunit, target, internalformat, buffer ); if (!alloc_context_objects( OBJ_TYPE_BUFFER, 1, &buffer, TRUE )) return; + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glMultiTexBufferEXT, &args ))) WARN( "glMultiTexBufferEXT returned %#lx\n", status ); } @@ -14518,17 +14586,20 @@ static void WINAPI glMulticastBlitFramebufferNV( GLuint srcGpu, GLuint dstGpu, G static void WINAPI glMulticastBufferSubDataNV( GLbitfield gpuMask, GLuint buffer, GLintptr offset, GLsizeiptr size, const void *data ) { - struct glMulticastBufferSubDataNV_params args = { .teb = NtCurrentTeb(), .gpuMask = gpuMask, .buffer = buffer, .offset = offset, .size = size, .data = data }; + struct glMulticastBufferSubDataNV_params args = { .teb = NtCurrentTeb(), .gpuMask = gpuMask, .offset = offset, .size = size, .data = data }; NTSTATUS status; TRACE( "gpuMask %d, buffer %d, offset %Id, size %Id, data %p\n", gpuMask, buffer, offset, size, data ); + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glMulticastBufferSubDataNV, &args ))) WARN( "glMulticastBufferSubDataNV returned %#lx\n", status ); } static void WINAPI glMulticastCopyBufferSubDataNV( GLuint readGpu, GLbitfield writeGpuMask, GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size ) { - struct glMulticastCopyBufferSubDataNV_params args = { .teb = NtCurrentTeb(), .readGpu = readGpu, .writeGpuMask = writeGpuMask, .readBuffer = readBuffer, .writeBuffer = writeBuffer, .readOffset = readOffset, .writeOffset = writeOffset, .size = size }; + struct glMulticastCopyBufferSubDataNV_params args = { .teb = NtCurrentTeb(), .readGpu = readGpu, .writeGpuMask = writeGpuMask, .readOffset = readOffset, .writeOffset = writeOffset, .size = size }; NTSTATUS status; TRACE( "readGpu %d, writeGpuMask %d, readBuffer %d, writeBuffer %d, readOffset %Id, writeOffset %Id, size %Id\n", readGpu, writeGpuMask, readBuffer, writeBuffer, readOffset, writeOffset, size ); + args.readBuffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &readBuffer ); + args.writeBuffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &writeBuffer ); if ((status = UNIX_CALL( glMulticastCopyBufferSubDataNV, &args ))) WARN( "glMulticastCopyBufferSubDataNV returned %#lx\n", status ); } @@ -14614,110 +14685,124 @@ static void WINAPI glMulticastWaitSyncNV( GLuint signalGpu, GLbitfield waitGpuMa static void WINAPI glNamedBufferAttachMemoryNV( GLuint buffer, GLuint memory, GLuint64 offset ) { - struct glNamedBufferAttachMemoryNV_params args = { .teb = NtCurrentTeb(), .buffer = buffer, .memory = memory, .offset = offset }; + struct glNamedBufferAttachMemoryNV_params args = { .teb = NtCurrentTeb(), .memory = memory, .offset = offset }; NTSTATUS status; TRACE( "buffer %d, memory %d, offset %s\n", buffer, memory, wine_dbgstr_longlong(offset) ); + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glNamedBufferAttachMemoryNV, &args ))) WARN( "glNamedBufferAttachMemoryNV returned %#lx\n", status ); } static void WINAPI glNamedBufferData( GLuint buffer, GLsizeiptr size, const void *data, GLenum usage ) { - struct glNamedBufferData_params args = { .teb = NtCurrentTeb(), .buffer = buffer, .size = size, .data = data, .usage = usage }; + struct glNamedBufferData_params args = { .teb = NtCurrentTeb(), .size = size, .data = data, .usage = usage }; NTSTATUS status; TRACE( "buffer %d, size %Id, data %p, usage %d\n", buffer, size, data, usage ); + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glNamedBufferData, &args ))) WARN( "glNamedBufferData returned %#lx\n", status ); } static void WINAPI glNamedBufferDataEXT( GLuint buffer, GLsizeiptr size, const void *data, GLenum usage ) { - struct glNamedBufferDataEXT_params args = { .teb = NtCurrentTeb(), .buffer = buffer, .size = size, .data = data, .usage = usage }; + struct glNamedBufferDataEXT_params args = { .teb = NtCurrentTeb(), .size = size, .data = data, .usage = usage }; NTSTATUS status; TRACE( "buffer %d, size %Id, data %p, usage %d\n", buffer, size, data, usage ); if (!alloc_context_objects( OBJ_TYPE_BUFFER, 1, &buffer, TRUE )) return; + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glNamedBufferDataEXT, &args ))) WARN( "glNamedBufferDataEXT returned %#lx\n", status ); } static void WINAPI glNamedBufferPageCommitmentARB( GLuint buffer, GLintptr offset, GLsizeiptr size, GLboolean commit ) { - struct glNamedBufferPageCommitmentARB_params args = { .teb = NtCurrentTeb(), .buffer = buffer, .offset = offset, .size = size, .commit = commit }; + struct glNamedBufferPageCommitmentARB_params args = { .teb = NtCurrentTeb(), .offset = offset, .size = size, .commit = commit }; NTSTATUS status; TRACE( "buffer %d, offset %Id, size %Id, commit %d\n", buffer, offset, size, commit ); + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glNamedBufferPageCommitmentARB, &args ))) WARN( "glNamedBufferPageCommitmentARB returned %#lx\n", status ); } static void WINAPI glNamedBufferPageCommitmentEXT( GLuint buffer, GLintptr offset, GLsizeiptr size, GLboolean commit ) { - struct glNamedBufferPageCommitmentEXT_params args = { .teb = NtCurrentTeb(), .buffer = buffer, .offset = offset, .size = size, .commit = commit }; + struct glNamedBufferPageCommitmentEXT_params args = { .teb = NtCurrentTeb(), .offset = offset, .size = size, .commit = commit }; NTSTATUS status; TRACE( "buffer %d, offset %Id, size %Id, commit %d\n", buffer, offset, size, commit ); + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glNamedBufferPageCommitmentEXT, &args ))) WARN( "glNamedBufferPageCommitmentEXT returned %#lx\n", status ); } static void WINAPI glNamedBufferPageCommitmentMemNV( GLuint buffer, GLintptr offset, GLsizeiptr size, GLuint memory, GLuint64 memOffset, GLboolean commit ) { - struct glNamedBufferPageCommitmentMemNV_params args = { .teb = NtCurrentTeb(), .buffer = buffer, .offset = offset, .size = size, .memory = memory, .memOffset = memOffset, .commit = commit }; + struct glNamedBufferPageCommitmentMemNV_params args = { .teb = NtCurrentTeb(), .offset = offset, .size = size, .memory = memory, .memOffset = memOffset, .commit = commit }; NTSTATUS status; TRACE( "buffer %d, offset %Id, size %Id, memory %d, memOffset %s, commit %d\n", buffer, offset, size, memory, wine_dbgstr_longlong(memOffset), commit ); + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glNamedBufferPageCommitmentMemNV, &args ))) WARN( "glNamedBufferPageCommitmentMemNV returned %#lx\n", status ); } static void WINAPI glNamedBufferStorage( GLuint buffer, GLsizeiptr size, const void *data, GLbitfield flags ) { - struct glNamedBufferStorage_params args = { .teb = NtCurrentTeb(), .buffer = buffer, .size = size, .data = data, .flags = flags }; + struct glNamedBufferStorage_params args = { .teb = NtCurrentTeb(), .size = size, .data = data, .flags = flags }; NTSTATUS status; TRACE( "buffer %d, size %Id, data %p, flags %d\n", buffer, size, data, flags ); + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glNamedBufferStorage, &args ))) WARN( "glNamedBufferStorage returned %#lx\n", status ); } static void WINAPI glNamedBufferStorageEXT( GLuint buffer, GLsizeiptr size, const void *data, GLbitfield flags ) { - struct glNamedBufferStorageEXT_params args = { .teb = NtCurrentTeb(), .buffer = buffer, .size = size, .data = data, .flags = flags }; + struct glNamedBufferStorageEXT_params args = { .teb = NtCurrentTeb(), .size = size, .data = data, .flags = flags }; NTSTATUS status; TRACE( "buffer %d, size %Id, data %p, flags %d\n", buffer, size, data, flags ); if (!alloc_context_objects( OBJ_TYPE_BUFFER, 1, &buffer, TRUE )) return; + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glNamedBufferStorageEXT, &args ))) WARN( "glNamedBufferStorageEXT returned %#lx\n", status ); } static void WINAPI glNamedBufferStorageExternalEXT( GLuint buffer, GLintptr offset, GLsizeiptr size, GLeglClientBufferEXT clientBuffer, GLbitfield flags ) { - struct glNamedBufferStorageExternalEXT_params args = { .teb = NtCurrentTeb(), .buffer = buffer, .offset = offset, .size = size, .clientBuffer = clientBuffer, .flags = flags }; + struct glNamedBufferStorageExternalEXT_params args = { .teb = NtCurrentTeb(), .offset = offset, .size = size, .clientBuffer = clientBuffer, .flags = flags }; NTSTATUS status; TRACE( "buffer %d, offset %Id, size %Id, clientBuffer %p, flags %d\n", buffer, offset, size, clientBuffer, flags ); + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glNamedBufferStorageExternalEXT, &args ))) WARN( "glNamedBufferStorageExternalEXT returned %#lx\n", status ); } static void WINAPI glNamedBufferStorageMemEXT( GLuint buffer, GLsizeiptr size, GLuint memory, GLuint64 offset ) { - struct glNamedBufferStorageMemEXT_params args = { .teb = NtCurrentTeb(), .buffer = buffer, .size = size, .memory = memory, .offset = offset }; + struct glNamedBufferStorageMemEXT_params args = { .teb = NtCurrentTeb(), .size = size, .memory = memory, .offset = offset }; NTSTATUS status; TRACE( "buffer %d, size %Id, memory %d, offset %s\n", buffer, size, memory, wine_dbgstr_longlong(offset) ); + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glNamedBufferStorageMemEXT, &args ))) WARN( "glNamedBufferStorageMemEXT returned %#lx\n", status ); } static void WINAPI glNamedBufferSubData( GLuint buffer, GLintptr offset, GLsizeiptr size, const void *data ) { - struct glNamedBufferSubData_params args = { .teb = NtCurrentTeb(), .buffer = buffer, .offset = offset, .size = size, .data = data }; + struct glNamedBufferSubData_params args = { .teb = NtCurrentTeb(), .offset = offset, .size = size, .data = data }; NTSTATUS status; TRACE( "buffer %d, offset %Id, size %Id, data %p\n", buffer, offset, size, data ); + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glNamedBufferSubData, &args ))) WARN( "glNamedBufferSubData returned %#lx\n", status ); } static void WINAPI glNamedBufferSubDataEXT( GLuint buffer, GLintptr offset, GLsizeiptr size, const void *data ) { - struct glNamedBufferSubDataEXT_params args = { .teb = NtCurrentTeb(), .buffer = buffer, .offset = offset, .size = size, .data = data }; + struct glNamedBufferSubDataEXT_params args = { .teb = NtCurrentTeb(), .offset = offset, .size = size, .data = data }; NTSTATUS status; TRACE( "buffer %d, offset %Id, size %Id, data %p\n", buffer, offset, size, data ); if (!alloc_context_objects( OBJ_TYPE_BUFFER, 1, &buffer, TRUE )) return; + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glNamedBufferSubDataEXT, &args ))) WARN( "glNamedBufferSubDataEXT returned %#lx\n", status ); } static void WINAPI glNamedCopyBufferSubDataEXT( GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size ) { - struct glNamedCopyBufferSubDataEXT_params args = { .teb = NtCurrentTeb(), .readBuffer = readBuffer, .writeBuffer = writeBuffer, .readOffset = readOffset, .writeOffset = writeOffset, .size = size }; + struct glNamedCopyBufferSubDataEXT_params args = { .teb = NtCurrentTeb(), .readOffset = readOffset, .writeOffset = writeOffset, .size = size }; NTSTATUS status; TRACE( "readBuffer %d, writeBuffer %d, readOffset %Id, writeOffset %Id, size %Id\n", readBuffer, writeBuffer, readOffset, writeOffset, size ); if (!alloc_context_objects( OBJ_TYPE_BUFFER, 1, &readBuffer, TRUE )) return; if (!alloc_context_objects( OBJ_TYPE_BUFFER, 1, &writeBuffer, TRUE )) return; + args.readBuffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &readBuffer ); + args.writeBuffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &writeBuffer ); if ((status = UNIX_CALL( glNamedCopyBufferSubDataEXT, &args ))) WARN( "glNamedCopyBufferSubDataEXT returned %#lx\n", status ); } @@ -18648,10 +18733,14 @@ 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 ) { - struct glSignalSemaphoreEXT_params args = { .teb = NtCurrentTeb(), .semaphore = semaphore, .numBufferBarriers = numBufferBarriers, .buffers = buffers, .numTextureBarriers = numTextureBarriers, .textures = textures, .dstLayouts = dstLayouts }; + GLuint buffers_buf[64], *buffers_tmp; + struct glSignalSemaphoreEXT_params args = { .teb = NtCurrentTeb(), .semaphore = semaphore, .numBufferBarriers = numBufferBarriers, .numTextureBarriers = numTextureBarriers, .textures = textures, .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; if ((status = UNIX_CALL( glSignalSemaphoreEXT, &args ))) WARN( "glSignalSemaphoreEXT returned %#lx\n", status ); + if (buffers_tmp != buffers_buf) free( buffers_tmp ); } static void WINAPI glSignalSemaphoreui64NVX( GLuint signalGpu, GLsizei fenceObjectCount, const GLuint *semaphoreArray, const GLuint64 *fenceValueArray ) @@ -19059,33 +19148,37 @@ static void WINAPI glTexAttachMemoryNV( GLenum target, GLuint memory, GLuint64 o static void WINAPI glTexBuffer( GLenum target, GLenum internalformat, GLuint buffer ) { - struct glTexBuffer_params args = { .teb = NtCurrentTeb(), .target = target, .internalformat = internalformat, .buffer = buffer }; + struct glTexBuffer_params args = { .teb = NtCurrentTeb(), .target = target, .internalformat = internalformat }; NTSTATUS status; TRACE( "target %d, internalformat %d, buffer %d\n", target, internalformat, buffer ); + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glTexBuffer, &args ))) WARN( "glTexBuffer returned %#lx\n", status ); } static void WINAPI glTexBufferARB( GLenum target, GLenum internalformat, GLuint buffer ) { - struct glTexBufferARB_params args = { .teb = NtCurrentTeb(), .target = target, .internalformat = internalformat, .buffer = buffer }; + struct glTexBufferARB_params args = { .teb = NtCurrentTeb(), .target = target, .internalformat = internalformat }; NTSTATUS status; TRACE( "target %d, internalformat %d, buffer %d\n", target, internalformat, buffer ); + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glTexBufferARB, &args ))) WARN( "glTexBufferARB returned %#lx\n", status ); } static void WINAPI glTexBufferEXT( GLenum target, GLenum internalformat, GLuint buffer ) { - struct glTexBufferEXT_params args = { .teb = NtCurrentTeb(), .target = target, .internalformat = internalformat, .buffer = buffer }; + struct glTexBufferEXT_params args = { .teb = NtCurrentTeb(), .target = target, .internalformat = internalformat }; NTSTATUS status; TRACE( "target %d, internalformat %d, buffer %d\n", target, internalformat, buffer ); + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glTexBufferEXT, &args ))) WARN( "glTexBufferEXT returned %#lx\n", status ); } static void WINAPI glTexBufferRange( GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size ) { - struct glTexBufferRange_params args = { .teb = NtCurrentTeb(), .target = target, .internalformat = internalformat, .buffer = buffer, .offset = offset, .size = size }; + struct glTexBufferRange_params args = { .teb = NtCurrentTeb(), .target = target, .internalformat = internalformat, .offset = offset, .size = size }; NTSTATUS status; TRACE( "target %d, internalformat %d, buffer %d, offset %Id, size %Id\n", target, internalformat, buffer, offset, size ); + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glTexBufferRange, &args ))) WARN( "glTexBufferRange returned %#lx\n", status ); } @@ -19883,35 +19976,39 @@ 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, .buffer = buffer }; + struct glTextureBuffer_params args = { .teb = NtCurrentTeb(), .texture = texture, .internalformat = internalformat }; NTSTATUS status; TRACE( "texture %d, internalformat %d, buffer %d\n", texture, internalformat, buffer ); + 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, .buffer = buffer }; + struct glTextureBufferEXT_params args = { .teb = NtCurrentTeb(), .texture = texture, .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_BUFFER, 1, &buffer, TRUE )) return; + 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, .buffer = buffer, .offset = offset, .size = size }; + struct glTextureBufferRange_params args = { .teb = NtCurrentTeb(), .texture = texture, .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.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, .buffer = buffer, .offset = offset, .size = size }; + struct glTextureBufferRangeEXT_params args = { .teb = NtCurrentTeb(), .texture = texture, .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_BUFFER, 1, &buffer, TRUE )) return; + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glTextureBufferRangeEXT, &args ))) WARN( "glTextureBufferRangeEXT returned %#lx\n", status ); } @@ -20333,17 +20430,19 @@ static void WINAPI glTransformFeedbackAttribsNV( GLsizei count, const GLint *att static void WINAPI glTransformFeedbackBufferBase( GLuint xfb, GLuint index, GLuint buffer ) { - struct glTransformFeedbackBufferBase_params args = { .teb = NtCurrentTeb(), .xfb = xfb, .index = index, .buffer = buffer }; + struct glTransformFeedbackBufferBase_params args = { .teb = NtCurrentTeb(), .xfb = xfb, .index = index }; NTSTATUS status; TRACE( "xfb %d, index %d, buffer %d\n", xfb, index, buffer ); + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glTransformFeedbackBufferBase, &args ))) WARN( "glTransformFeedbackBufferBase returned %#lx\n", status ); } static void WINAPI glTransformFeedbackBufferRange( GLuint xfb, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size ) { - struct glTransformFeedbackBufferRange_params args = { .teb = NtCurrentTeb(), .xfb = xfb, .index = index, .buffer = buffer, .offset = offset, .size = size }; + struct glTransformFeedbackBufferRange_params args = { .teb = NtCurrentTeb(), .xfb = xfb, .index = index, .offset = offset, .size = size }; NTSTATUS status; TRACE( "xfb %d, index %d, buffer %d, offset %Id, size %Id\n", xfb, index, buffer, offset, size ); + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glTransformFeedbackBufferRange, &args ))) WARN( "glTransformFeedbackBufferRange returned %#lx\n", status ); } @@ -21117,9 +21216,10 @@ static void WINAPI glUniformBlockBinding( GLuint program, GLuint uniformBlockInd static void WINAPI glUniformBufferEXT( GLuint program, GLint location, GLuint buffer ) { - struct glUniformBufferEXT_params args = { .teb = NtCurrentTeb(), .program = program, .location = location, .buffer = buffer }; + struct glUniformBufferEXT_params args = { .teb = NtCurrentTeb(), .program = program, .location = location }; NTSTATUS status; TRACE( "program %d, location %d, buffer %d\n", program, location, buffer ); + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glUniformBufferEXT, &args ))) WARN( "glUniformBufferEXT returned %#lx\n", status ); } @@ -21375,28 +21475,31 @@ static GLboolean WINAPI glUnmapBufferARB( GLenum target ) static GLboolean WINAPI glUnmapNamedBuffer( GLuint buffer ) { - struct glUnmapNamedBuffer_params args = { .teb = NtCurrentTeb(), .buffer = buffer }; + struct glUnmapNamedBuffer_params args = { .teb = NtCurrentTeb() }; NTSTATUS status; TRACE( "buffer %d\n", buffer ); + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glUnmapNamedBuffer, &args ))) WARN( "glUnmapNamedBuffer returned %#lx\n", status ); return args.ret; } static GLboolean WINAPI glUnmapNamedBufferEXT( GLuint buffer ) { - struct glUnmapNamedBufferEXT_params args = { .teb = NtCurrentTeb(), .buffer = buffer }; + struct glUnmapNamedBufferEXT_params args = { .teb = NtCurrentTeb() }; NTSTATUS status; TRACE( "buffer %d\n", buffer ); if (!alloc_context_objects( OBJ_TYPE_BUFFER, 1, &buffer, TRUE )) return args.ret; + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glUnmapNamedBufferEXT, &args ))) WARN( "glUnmapNamedBufferEXT returned %#lx\n", status ); return args.ret; } static void WINAPI glUnmapObjectBufferATI( GLuint buffer ) { - struct glUnmapObjectBufferATI_params args = { .teb = NtCurrentTeb(), .buffer = buffer }; + struct glUnmapObjectBufferATI_params args = { .teb = NtCurrentTeb() }; NTSTATUS status; TRACE( "buffer %d\n", buffer ); + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glUnmapObjectBufferATI, &args ))) WARN( "glUnmapObjectBufferATI returned %#lx\n", status ); } @@ -21410,9 +21513,10 @@ static void WINAPI glUnmapTexture2DINTEL( GLuint texture, GLint level ) static void WINAPI glUpdateObjectBufferATI( GLuint buffer, GLuint offset, GLsizei size, const void *pointer, GLenum preserve ) { - struct glUpdateObjectBufferATI_params args = { .teb = NtCurrentTeb(), .buffer = buffer, .offset = offset, .size = size, .pointer = pointer, .preserve = preserve }; + struct glUpdateObjectBufferATI_params args = { .teb = NtCurrentTeb(), .offset = offset, .size = size, .pointer = pointer, .preserve = preserve }; NTSTATUS status; TRACE( "buffer %d, offset %d, size %d, pointer %p, preserve %d\n", buffer, offset, size, pointer, preserve ); + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glUpdateObjectBufferATI, &args ))) WARN( "glUpdateObjectBufferATI returned %#lx\n", status ); } @@ -21574,9 +21678,10 @@ static void WINAPI glValidateProgramPipeline( GLuint pipeline ) static void WINAPI glVariantArrayObjectATI( GLuint id, GLenum type, GLsizei stride, GLuint buffer, GLuint offset ) { - struct glVariantArrayObjectATI_params args = { .teb = NtCurrentTeb(), .id = id, .type = type, .stride = stride, .buffer = buffer, .offset = offset }; + struct glVariantArrayObjectATI_params args = { .teb = NtCurrentTeb(), .id = id, .type = type, .stride = stride, .offset = offset }; NTSTATUS status; TRACE( "id %d, type %d, stride %d, buffer %d, offset %d\n", id, type, stride, buffer, offset ); + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glVariantArrayObjectATI, &args ))) WARN( "glVariantArrayObjectATI returned %#lx\n", status ); } @@ -21830,10 +21935,11 @@ static void WINAPI glVertexArrayAttribLFormat( GLuint vaobj, GLuint attribindex, static void WINAPI glVertexArrayBindVertexBufferEXT( GLuint vaobj, GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride ) { - struct glVertexArrayBindVertexBufferEXT_params args = { .teb = NtCurrentTeb(), .vaobj = vaobj, .bindingindex = bindingindex, .buffer = buffer, .offset = offset, .stride = stride }; + struct glVertexArrayBindVertexBufferEXT_params args = { .teb = NtCurrentTeb(), .vaobj = vaobj, .bindingindex = bindingindex, .offset = offset, .stride = stride }; NTSTATUS status; TRACE( "vaobj %d, bindingindex %d, buffer %d, offset %Id, stride %d\n", vaobj, bindingindex, buffer, offset, stride ); if (!alloc_context_objects( OBJ_TYPE_BUFFER, 1, &buffer, TRUE )) return; + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glVertexArrayBindVertexBufferEXT, &args ))) WARN( "glVertexArrayBindVertexBufferEXT returned %#lx\n", status ); } @@ -21847,63 +21953,70 @@ static void WINAPI glVertexArrayBindingDivisor( GLuint vaobj, GLuint bindinginde static void WINAPI glVertexArrayColorOffsetEXT( GLuint vaobj, GLuint buffer, GLint size, GLenum type, GLsizei stride, GLintptr offset ) { - struct glVertexArrayColorOffsetEXT_params args = { .teb = NtCurrentTeb(), .vaobj = vaobj, .buffer = buffer, .size = size, .type = type, .stride = stride, .offset = offset }; + struct glVertexArrayColorOffsetEXT_params args = { .teb = NtCurrentTeb(), .vaobj = vaobj, .size = size, .type = type, .stride = stride, .offset = offset }; NTSTATUS status; TRACE( "vaobj %d, buffer %d, size %d, type %d, stride %d, offset %Id\n", vaobj, buffer, size, type, stride, offset ); if (!alloc_context_objects( OBJ_TYPE_BUFFER, 1, &buffer, TRUE )) return; + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glVertexArrayColorOffsetEXT, &args ))) WARN( "glVertexArrayColorOffsetEXT returned %#lx\n", status ); } static void WINAPI glVertexArrayEdgeFlagOffsetEXT( GLuint vaobj, GLuint buffer, GLsizei stride, GLintptr offset ) { - struct glVertexArrayEdgeFlagOffsetEXT_params args = { .teb = NtCurrentTeb(), .vaobj = vaobj, .buffer = buffer, .stride = stride, .offset = offset }; + struct glVertexArrayEdgeFlagOffsetEXT_params args = { .teb = NtCurrentTeb(), .vaobj = vaobj, .stride = stride, .offset = offset }; NTSTATUS status; TRACE( "vaobj %d, buffer %d, stride %d, offset %Id\n", vaobj, buffer, stride, offset ); if (!alloc_context_objects( OBJ_TYPE_BUFFER, 1, &buffer, TRUE )) return; + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glVertexArrayEdgeFlagOffsetEXT, &args ))) WARN( "glVertexArrayEdgeFlagOffsetEXT returned %#lx\n", status ); } static void WINAPI glVertexArrayElementBuffer( GLuint vaobj, GLuint buffer ) { - struct glVertexArrayElementBuffer_params args = { .teb = NtCurrentTeb(), .vaobj = vaobj, .buffer = buffer }; + struct glVertexArrayElementBuffer_params args = { .teb = NtCurrentTeb(), .vaobj = vaobj }; NTSTATUS status; TRACE( "vaobj %d, buffer %d\n", vaobj, buffer ); + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glVertexArrayElementBuffer, &args ))) WARN( "glVertexArrayElementBuffer returned %#lx\n", status ); } static void WINAPI glVertexArrayFogCoordOffsetEXT( GLuint vaobj, GLuint buffer, GLenum type, GLsizei stride, GLintptr offset ) { - struct glVertexArrayFogCoordOffsetEXT_params args = { .teb = NtCurrentTeb(), .vaobj = vaobj, .buffer = buffer, .type = type, .stride = stride, .offset = offset }; + struct glVertexArrayFogCoordOffsetEXT_params args = { .teb = NtCurrentTeb(), .vaobj = vaobj, .type = type, .stride = stride, .offset = offset }; NTSTATUS status; TRACE( "vaobj %d, buffer %d, type %d, stride %d, offset %Id\n", vaobj, buffer, type, stride, offset ); if (!alloc_context_objects( OBJ_TYPE_BUFFER, 1, &buffer, TRUE )) return; + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glVertexArrayFogCoordOffsetEXT, &args ))) WARN( "glVertexArrayFogCoordOffsetEXT returned %#lx\n", status ); } static void WINAPI glVertexArrayIndexOffsetEXT( GLuint vaobj, GLuint buffer, GLenum type, GLsizei stride, GLintptr offset ) { - struct glVertexArrayIndexOffsetEXT_params args = { .teb = NtCurrentTeb(), .vaobj = vaobj, .buffer = buffer, .type = type, .stride = stride, .offset = offset }; + struct glVertexArrayIndexOffsetEXT_params args = { .teb = NtCurrentTeb(), .vaobj = vaobj, .type = type, .stride = stride, .offset = offset }; NTSTATUS status; TRACE( "vaobj %d, buffer %d, type %d, stride %d, offset %Id\n", vaobj, buffer, type, stride, offset ); if (!alloc_context_objects( OBJ_TYPE_BUFFER, 1, &buffer, TRUE )) return; + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glVertexArrayIndexOffsetEXT, &args ))) WARN( "glVertexArrayIndexOffsetEXT returned %#lx\n", status ); } static void WINAPI glVertexArrayMultiTexCoordOffsetEXT( GLuint vaobj, GLuint buffer, GLenum texunit, GLint size, GLenum type, GLsizei stride, GLintptr offset ) { - struct glVertexArrayMultiTexCoordOffsetEXT_params args = { .teb = NtCurrentTeb(), .vaobj = vaobj, .buffer = buffer, .texunit = texunit, .size = size, .type = type, .stride = stride, .offset = offset }; + struct glVertexArrayMultiTexCoordOffsetEXT_params args = { .teb = NtCurrentTeb(), .vaobj = vaobj, .texunit = texunit, .size = size, .type = type, .stride = stride, .offset = offset }; NTSTATUS status; TRACE( "vaobj %d, buffer %d, texunit %d, size %d, type %d, stride %d, offset %Id\n", vaobj, buffer, texunit, size, type, stride, offset ); if (!alloc_context_objects( OBJ_TYPE_BUFFER, 1, &buffer, TRUE )) return; + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glVertexArrayMultiTexCoordOffsetEXT, &args ))) WARN( "glVertexArrayMultiTexCoordOffsetEXT returned %#lx\n", status ); } static void WINAPI glVertexArrayNormalOffsetEXT( GLuint vaobj, GLuint buffer, GLenum type, GLsizei stride, GLintptr offset ) { - struct glVertexArrayNormalOffsetEXT_params args = { .teb = NtCurrentTeb(), .vaobj = vaobj, .buffer = buffer, .type = type, .stride = stride, .offset = offset }; + struct glVertexArrayNormalOffsetEXT_params args = { .teb = NtCurrentTeb(), .vaobj = vaobj, .type = type, .stride = stride, .offset = offset }; NTSTATUS status; TRACE( "vaobj %d, buffer %d, type %d, stride %d, offset %Id\n", vaobj, buffer, type, stride, offset ); if (!alloc_context_objects( OBJ_TYPE_BUFFER, 1, &buffer, TRUE )) return; + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glVertexArrayNormalOffsetEXT, &args ))) WARN( "glVertexArrayNormalOffsetEXT returned %#lx\n", status ); } @@ -21933,19 +22046,21 @@ static void WINAPI glVertexArrayRangeNV( GLsizei length, const void *pointer ) static void WINAPI glVertexArraySecondaryColorOffsetEXT( GLuint vaobj, GLuint buffer, GLint size, GLenum type, GLsizei stride, GLintptr offset ) { - struct glVertexArraySecondaryColorOffsetEXT_params args = { .teb = NtCurrentTeb(), .vaobj = vaobj, .buffer = buffer, .size = size, .type = type, .stride = stride, .offset = offset }; + struct glVertexArraySecondaryColorOffsetEXT_params args = { .teb = NtCurrentTeb(), .vaobj = vaobj, .size = size, .type = type, .stride = stride, .offset = offset }; NTSTATUS status; TRACE( "vaobj %d, buffer %d, size %d, type %d, stride %d, offset %Id\n", vaobj, buffer, size, type, stride, offset ); if (!alloc_context_objects( OBJ_TYPE_BUFFER, 1, &buffer, TRUE )) return; + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glVertexArraySecondaryColorOffsetEXT, &args ))) WARN( "glVertexArraySecondaryColorOffsetEXT returned %#lx\n", status ); } static void WINAPI glVertexArrayTexCoordOffsetEXT( GLuint vaobj, GLuint buffer, GLint size, GLenum type, GLsizei stride, GLintptr offset ) { - struct glVertexArrayTexCoordOffsetEXT_params args = { .teb = NtCurrentTeb(), .vaobj = vaobj, .buffer = buffer, .size = size, .type = type, .stride = stride, .offset = offset }; + struct glVertexArrayTexCoordOffsetEXT_params args = { .teb = NtCurrentTeb(), .vaobj = vaobj, .size = size, .type = type, .stride = stride, .offset = offset }; NTSTATUS status; TRACE( "vaobj %d, buffer %d, size %d, type %d, stride %d, offset %Id\n", vaobj, buffer, size, type, stride, offset ); if (!alloc_context_objects( OBJ_TYPE_BUFFER, 1, &buffer, TRUE )) return; + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glVertexArrayTexCoordOffsetEXT, &args ))) WARN( "glVertexArrayTexCoordOffsetEXT returned %#lx\n", status ); } @@ -21983,10 +22098,11 @@ static void WINAPI glVertexArrayVertexAttribIFormatEXT( GLuint vaobj, GLuint att static void WINAPI glVertexArrayVertexAttribIOffsetEXT( GLuint vaobj, GLuint buffer, GLuint index, GLint size, GLenum type, GLsizei stride, GLintptr offset ) { - struct glVertexArrayVertexAttribIOffsetEXT_params args = { .teb = NtCurrentTeb(), .vaobj = vaobj, .buffer = buffer, .index = index, .size = size, .type = type, .stride = stride, .offset = offset }; + struct glVertexArrayVertexAttribIOffsetEXT_params args = { .teb = NtCurrentTeb(), .vaobj = vaobj, .index = index, .size = size, .type = type, .stride = stride, .offset = offset }; NTSTATUS status; TRACE( "vaobj %d, buffer %d, index %d, size %d, type %d, stride %d, offset %Id\n", vaobj, buffer, index, size, type, stride, offset ); if (!alloc_context_objects( OBJ_TYPE_BUFFER, 1, &buffer, TRUE )) return; + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glVertexArrayVertexAttribIOffsetEXT, &args ))) WARN( "glVertexArrayVertexAttribIOffsetEXT returned %#lx\n", status ); } @@ -22000,19 +22116,21 @@ static void WINAPI glVertexArrayVertexAttribLFormatEXT( GLuint vaobj, GLuint att static void WINAPI glVertexArrayVertexAttribLOffsetEXT( GLuint vaobj, GLuint buffer, GLuint index, GLint size, GLenum type, GLsizei stride, GLintptr offset ) { - struct glVertexArrayVertexAttribLOffsetEXT_params args = { .teb = NtCurrentTeb(), .vaobj = vaobj, .buffer = buffer, .index = index, .size = size, .type = type, .stride = stride, .offset = offset }; + struct glVertexArrayVertexAttribLOffsetEXT_params args = { .teb = NtCurrentTeb(), .vaobj = vaobj, .index = index, .size = size, .type = type, .stride = stride, .offset = offset }; NTSTATUS status; TRACE( "vaobj %d, buffer %d, index %d, size %d, type %d, stride %d, offset %Id\n", vaobj, buffer, index, size, type, stride, offset ); if (!alloc_context_objects( OBJ_TYPE_BUFFER, 1, &buffer, TRUE )) return; + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glVertexArrayVertexAttribLOffsetEXT, &args ))) WARN( "glVertexArrayVertexAttribLOffsetEXT returned %#lx\n", status ); } static void WINAPI glVertexArrayVertexAttribOffsetEXT( GLuint vaobj, GLuint buffer, GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLintptr offset ) { - struct glVertexArrayVertexAttribOffsetEXT_params args = { .teb = NtCurrentTeb(), .vaobj = vaobj, .buffer = buffer, .index = index, .size = size, .type = type, .normalized = normalized, .stride = stride, .offset = offset }; + struct glVertexArrayVertexAttribOffsetEXT_params args = { .teb = NtCurrentTeb(), .vaobj = vaobj, .index = index, .size = size, .type = type, .normalized = normalized, .stride = stride, .offset = offset }; NTSTATUS status; TRACE( "vaobj %d, buffer %d, index %d, size %d, type %d, normalized %d, stride %d, offset %Id\n", vaobj, buffer, index, size, type, normalized, stride, offset ); if (!alloc_context_objects( OBJ_TYPE_BUFFER, 1, &buffer, TRUE )) return; + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glVertexArrayVertexAttribOffsetEXT, &args ))) WARN( "glVertexArrayVertexAttribOffsetEXT returned %#lx\n", status ); } @@ -22026,26 +22144,32 @@ static void WINAPI glVertexArrayVertexBindingDivisorEXT( GLuint vaobj, GLuint bi static void WINAPI glVertexArrayVertexBuffer( GLuint vaobj, GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride ) { - struct glVertexArrayVertexBuffer_params args = { .teb = NtCurrentTeb(), .vaobj = vaobj, .bindingindex = bindingindex, .buffer = buffer, .offset = offset, .stride = stride }; + struct glVertexArrayVertexBuffer_params args = { .teb = NtCurrentTeb(), .vaobj = vaobj, .bindingindex = bindingindex, .offset = offset, .stride = stride }; NTSTATUS status; TRACE( "vaobj %d, bindingindex %d, buffer %d, offset %Id, stride %d\n", vaobj, bindingindex, buffer, offset, stride ); + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glVertexArrayVertexBuffer, &args ))) WARN( "glVertexArrayVertexBuffer returned %#lx\n", status ); } static void WINAPI glVertexArrayVertexBuffers( GLuint vaobj, GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizei *strides ) { - struct glVertexArrayVertexBuffers_params args = { .teb = NtCurrentTeb(), .vaobj = vaobj, .first = first, .count = count, .buffers = buffers, .offsets = offsets, .strides = strides }; + GLuint buffers_buf[64], *buffers_tmp; + struct glVertexArrayVertexBuffers_params args = { .teb = NtCurrentTeb(), .vaobj = vaobj, .first = first, .count = count, .offsets = offsets, .strides = strides }; NTSTATUS status; TRACE( "vaobj %d, first %d, count %d, buffers %p, offsets %p, strides %p\n", vaobj, first, count, buffers, offsets, strides ); + buffers_tmp = count > 0 ? memdup_objects( count, buffers, buffers_buf, ARRAY_SIZE(buffers_buf) ) : NULL; + args.buffers = count > 0 ? map_context_objects( OBJ_TYPE_BUFFER, count, buffers_tmp ) : NULL; if ((status = UNIX_CALL( glVertexArrayVertexBuffers, &args ))) WARN( "glVertexArrayVertexBuffers returned %#lx\n", status ); + if (buffers_tmp != buffers_buf) free( buffers_tmp ); } static void WINAPI glVertexArrayVertexOffsetEXT( GLuint vaobj, GLuint buffer, GLint size, GLenum type, GLsizei stride, GLintptr offset ) { - struct glVertexArrayVertexOffsetEXT_params args = { .teb = NtCurrentTeb(), .vaobj = vaobj, .buffer = buffer, .size = size, .type = type, .stride = stride, .offset = offset }; + struct glVertexArrayVertexOffsetEXT_params args = { .teb = NtCurrentTeb(), .vaobj = vaobj, .size = size, .type = type, .stride = stride, .offset = offset }; NTSTATUS status; TRACE( "vaobj %d, buffer %d, size %d, type %d, stride %d, offset %Id\n", vaobj, buffer, size, type, stride, offset ); if (!alloc_context_objects( OBJ_TYPE_BUFFER, 1, &buffer, TRUE )) return; + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glVertexArrayVertexOffsetEXT, &args ))) WARN( "glVertexArrayVertexOffsetEXT returned %#lx\n", status ); } @@ -22899,9 +23023,10 @@ static void WINAPI glVertexAttrib4usvARB( GLuint index, const GLushort *v ) static void WINAPI glVertexAttribArrayObjectATI( GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLuint buffer, GLuint offset ) { - struct glVertexAttribArrayObjectATI_params args = { .teb = NtCurrentTeb(), .index = index, .size = size, .type = type, .normalized = normalized, .stride = stride, .buffer = buffer, .offset = offset }; + struct glVertexAttribArrayObjectATI_params args = { .teb = NtCurrentTeb(), .index = index, .size = size, .type = type, .normalized = normalized, .stride = stride, .offset = offset }; NTSTATUS status; TRACE( "index %d, size %d, type %d, normalized %d, stride %d, buffer %d, offset %d\n", index, size, type, normalized, stride, buffer, offset ); + args.buffer = *map_context_objects( OBJ_TYPE_BUFFER, 1, &buffer ); if ((status = UNIX_CALL( glVertexAttribArrayObjectATI, &args ))) WARN( "glVertexAttribArrayObjectATI returned %#lx\n", status ); } @@ -24316,10 +24441,14 @@ 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 ) { - struct glWaitSemaphoreEXT_params args = { .teb = NtCurrentTeb(), .semaphore = semaphore, .numBufferBarriers = numBufferBarriers, .buffers = buffers, .numTextureBarriers = numTextureBarriers, .textures = textures, .srcLayouts = srcLayouts }; + GLuint buffers_buf[64], *buffers_tmp; + struct glWaitSemaphoreEXT_params args = { .teb = NtCurrentTeb(), .semaphore = semaphore, .numBufferBarriers = numBufferBarriers, .numTextureBarriers = numTextureBarriers, .textures = textures, .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; if ((status = UNIX_CALL( glWaitSemaphoreEXT, &args ))) WARN( "glWaitSemaphoreEXT returned %#lx\n", status ); + if (buffers_tmp != buffers_buf) free( buffers_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 645a2497833..97216492ac1 100644 --- a/dlls/opengl32/wgl.c +++ b/dlls/opengl32/wgl.c @@ -278,6 +278,7 @@ struct object_table enum object_type type; /* object type of the id table */ SRWLOCK lock; /* lock for accessing the table */ GLuint **host_ids[L1_COUNT]; /* client -> host id mapping sparse array */ + GLuint **client_ids[L1_COUNT]; /* host -> client id mapping sparse array */ GLuint min_free; /* id to start looking for a free slot */ BOOL implicit; /* table allows implicit allocation */ }; @@ -337,7 +338,13 @@ static GLuint set_object( struct object_table *table, GLuint client_id, GLuint h if (!(ids = alloc_object_ids( table->host_ids, client_id ))) goto failed; ids[client_id % L3_COUNT] = host_id; - TRACE( "Inserted %s client %#x, host %#x\n", debugstr_object_type( table->type ), client_id, host_id ); + if (table->implicit) + { + if (!(ids = alloc_object_ids( table->client_ids, host_id ))) goto failed; + ids[host_id % L3_COUNT] = client_id; + } + + TRACE( "Inserted %s client %#x, host %#x\n", debugstr_object_type(table->type), client_id, host_id ); return client_id; failed: @@ -349,13 +356,14 @@ static GLuint del_object( struct object_table *table, GLuint client_id ) { GLuint *object, host_id = 0; - if (!client_id || !(object = find_object_id( table->host_ids, client_id ))) return client_id; + if (!client_id || !(object = find_object_id( table->host_ids, client_id ))) return -1; table->min_free = min( table->min_free, client_id - 1 ); host_id = *object; *object = 0; + if (host_id && (object = find_object_id( table->client_ids, host_id ))) *object = 0; TRACE( "Deleting %s client %#x, host %#x\n", debugstr_object_type( table->type ), client_id, host_id ); - return host_id ? host_id : client_id; + return host_id ? host_id : -1; } static GLuint get_object( struct object_table *table, GLuint client_id, BOOL check ) @@ -367,9 +375,29 @@ static GLuint get_object( struct object_table *table, GLuint client_id, BOOL che return check || host_id ? host_id : -1; } +#define MAKE_OBJECT_CALL( func, ... ) \ + struct func##_params args = { .teb = NtCurrentTeb(), __VA_ARGS__ }; \ + UNIX_CALL( func, &args ) + +static GLuint create_object( enum object_type type ) +{ + GLuint object; + + switch (type) + { + case OBJ_TYPE_BUFFER: { MAKE_OBJECT_CALL( glGenBuffers, .n = 1, .buffers = &object ); return object; } + case OBJ_TYPE_COUNT: break; + } + + return 0; +} + +#undef MAKE_OBJECT_CALL + static void free_object_table( struct object_table *table ) { free_object_ids( table, table->host_ids ); + free_object_ids( table, table->client_ids ); } static void init_object_table( struct object_table *table, enum object_type type ) @@ -523,7 +551,7 @@ static void alloc_client_objects( struct context *ctx, enum object_type type, UI { if (!handles[i] || get_object( table, handles[i], TRUE )) continue; WARN( "Creating implicit %s client %#x\n", debugstr_object_type( type ), handles[i] ); - set_object( table, handles[i], handles[i] ); + set_object( table, handles[i], create_object( table->type ) ); table->implicit = TRUE; /* from now on we cannot rely on host-allocated ids */ } ReleaseSRWLockExclusive( &table->lock ); @@ -568,6 +596,80 @@ GLuint *del_context_objects( enum object_type type, UINT n, GLuint *handles ) return handles; } +GLuint *map_context_objects( enum object_type type, UINT n, GLuint *handles ) +{ + struct object_table *table; + struct context *ctx; + + if (!(ctx = context_from_handle( NtCurrentTeb()->glCurrentRC ))) return handles; + if (!(table = get_object_table( ctx, type, FALSE ))) return handles; + + AcquireSRWLockShared( &table->lock ); + while (n--) handles[n] = handles[n] ? get_object( table, handles[n], FALSE ) : 0; + ReleaseSRWLockShared( &table->lock ); + + return handles; +} + +static GLuint get_pname_object_type( GLenum pname ) +{ + switch (pname) + { + case GL_ARRAY_BUFFER_BINDING: + case GL_ATOMIC_COUNTER_BUFFER_BINDING: + case GL_COLOR_ARRAY_BUFFER_BINDING: + case GL_COPY_READ_BUFFER_BINDING: + case GL_COPY_WRITE_BUFFER_BINDING: + case GL_DISPATCH_INDIRECT_BUFFER_BINDING: + case GL_DRAW_INDIRECT_BUFFER_BINDING: + case GL_EDGE_FLAG_ARRAY_BUFFER_BINDING: + case GL_ELEMENT_ARRAY_BUFFER_BINDING: + case GL_FOG_COORD_ARRAY_BUFFER_BINDING: + case GL_INDEX_ARRAY_BUFFER_BINDING: + case GL_NORMAL_ARRAY_BUFFER_BINDING: + case GL_PARAMETER_BUFFER_BINDING: + case GL_PIXEL_PACK_BUFFER_BINDING: + case GL_PIXEL_UNPACK_BUFFER_BINDING: + case GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES: + case GL_QUERY_BUFFER_BINDING: + case GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING: + case GL_SHADER_STORAGE_BUFFER_BINDING: + case GL_TEXTURE_BUFFER_DATA_STORE_BINDING: + case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING: + case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING: + case GL_UNIFORM_BLOCK_BINDING: + case GL_UNIFORM_BUFFER_BINDING: + case GL_UNIFORM_BUFFER_BINDING_EXT: + case GL_VERTEX_ARRAY_BUFFER_BINDING: + case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: + case GL_VERTEX_BINDING_BUFFER: + case GL_VIDEO_BUFFER_BINDING_NV: + case GL_WEIGHT_ARRAY_BUFFER_BINDING: + case GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES: + return OBJ_TYPE_BUFFER; + } + + return OBJ_TYPE_COUNT; +} + +static BOOL map_client_objects( enum object_type type, GLuint host_id, GLuint *ret ) +{ + GLuint *object, client_id = host_id; + struct object_table *table; + struct context *ctx; + + if (!host_id || type == OBJ_TYPE_COUNT) return FALSE; + if (!(ctx = context_from_handle( NtCurrentTeb()->glCurrentRC ))) return FALSE; + if (!(table = get_object_table( ctx, type, FALSE ))) return FALSE; + + AcquireSRWLockShared( &table->lock ); + if ((object = find_object_id( table->client_ids, host_id ))) client_id = *object; + ReleaseSRWLockShared( &table->lock ); + + *ret = client_id; + return TRUE; +} + HGLRC WINAPI wglCreateContext( HDC hdc ) { static const int attribs[] = { WGL_CONTEXT_PROFILE_MASK_ARB, WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB, 0, 0 }; @@ -2328,7 +2430,7 @@ BOOL get_integer( GLenum name, GLuint index, GLint value, GLint *data ) return TRUE; } - return FALSE; + return map_client_objects( get_pname_object_type( name ), value, (GLuint *)data ); } const GLubyte * WINAPI glGetStringi( GLenum name, GLuint index ) -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/11091