From: Rémi Bernon <rbernon@codeweavers.com> --- dlls/opengl32/tests/opengl.c | 143 +++-------------------------------- 1 file changed, 10 insertions(+), 133 deletions(-) diff --git a/dlls/opengl32/tests/opengl.c b/dlls/opengl32/tests/opengl.c index 54655724d6e..a8df849195c 100644 --- a/dlls/opengl32/tests/opengl.c +++ b/dlls/opengl32/tests/opengl.c @@ -66,72 +66,14 @@ static void check_gl_error_( unsigned int line, GLenum exp ) ok_(__FILE__,line)( err == exp, "glGetError returned %x, expected %x\n", err, exp ); } +#define USE_GL_FUNC( func ) static PFN_ ## func p ## func; +ALL_GL_EXT_FUNCS +ALL_WGL_EXT_FUNCS +#undef USE_GL_FUNC + static NTSTATUS (WINAPI *pD3DKMTCreateDCFromMemory)( D3DKMT_CREATEDCFROMMEMORY *desc ); static NTSTATUS (WINAPI *pD3DKMTDestroyDCFromMemory)( const D3DKMT_DESTROYDCFROMMEMORY *desc ); -/* WGL_ARB_create_context */ -static HGLRC (WINAPI *pwglCreateContextAttribsARB)(HDC hDC, HGLRC hShareContext, const int *attribList); - -/* WGL_ARB_extensions_string */ -static const char* (WINAPI *pwglGetExtensionsStringARB)(HDC); -static const char* (WINAPI *pwglGetExtensionsStringEXT)(void); - -/* WGL_ARB_make_current_read */ -static BOOL (WINAPI *pwglMakeContextCurrentARB)(HDC hdraw, HDC hread, HGLRC hglrc); -static HDC (WINAPI *pwglGetCurrentReadDCARB)(void); - -/* WGL_ARB_pixel_format */ -static BOOL (WINAPI *pwglChoosePixelFormatARB)(HDC, const int *, const FLOAT *, UINT, int *, UINT *); -static BOOL (WINAPI *pwglGetPixelFormatAttribivARB)(HDC, int, int, UINT, const int *, int *); - -/* WGL_ARB_pbuffer */ -static HPBUFFERARB (WINAPI *pwglCreatePbufferARB)(HDC, int, int, int, const int *); -static BOOL (WINAPI *pwglDestroyPbufferARB)(HPBUFFERARB); -static HDC (WINAPI *pwglGetPbufferDCARB)(HPBUFFERARB); -static int (WINAPI *pwglReleasePbufferDCARB)(HPBUFFERARB, HDC); -static BOOL (WINAPI *pwglQueryPbufferARB)(HPBUFFERARB,int,int*); - -/* WGL_ARB_render_texture */ -static BOOL (WINAPI *pwglBindTexImageARB)(HPBUFFERARB,int); -static BOOL (WINAPI *pwglReleaseTexImageARB)(HPBUFFERARB,int); -static BOOL (WINAPI *pwglSetPbufferAttribARB)(HPBUFFERARB,const int*); - -/* WGL_EXT_swap_control */ -static BOOL (WINAPI *pwglSwapIntervalEXT)(int interval); -static int (WINAPI *pwglGetSwapIntervalEXT)(void); - -/* GL_ARB_debug_output */ -static void (WINAPI *pglDebugMessageCallbackARB)(void *, void *); -static void (WINAPI *pglDebugMessageControlARB)(GLenum, GLenum, GLenum, GLsizei, const GLuint *, GLboolean); -static void (WINAPI *pglDebugMessageInsertARB)(GLenum, GLenum, GLuint, GLenum, GLsizei, const char *); - -/* GL_ARB_framebuffer_object */ -static void (WINAPI *pglBindFramebuffer)(GLenum target, GLuint framebuffer); -static GLenum (WINAPI *pglCheckFramebufferStatus)(GLenum target); - -static PFN_glBindBuffer pglBindBuffer; -static PFN_glBufferData pglBufferData; -static PFN_glBufferStorage pglBufferStorage; -static PFN_glCopyBufferSubData pglCopyBufferSubData; -static PFN_glCopyNamedBufferSubData pglCopyNamedBufferSubData; -static PFN_glCreateBuffers pglCreateBuffers; -static PFN_glDeleteBuffers pglDeleteBuffers; -static PFN_glDeleteSync pglDeleteSync; -static PFN_glFenceSync pglFenceSync; -static PFN_glFlushMappedBufferRange pglFlushMappedBufferRange; -static PFN_glFlushMappedNamedBufferRange pglFlushMappedNamedBufferRange; -static PFN_glGenBuffers pglGenBuffers; -static PFN_glGetStringi pglGetStringi; -static PFN_glIsSync pglIsSync; -static PFN_glMapBuffer pglMapBuffer; -static PFN_glMapBufferRange pglMapBufferRange; -static PFN_glMapNamedBuffer pglMapNamedBuffer; -static PFN_glMapNamedBufferRange pglMapNamedBufferRange; -static PFN_glNamedBufferData pglNamedBufferData; -static PFN_glNamedBufferStorage pglNamedBufferStorage; -static PFN_glUnmapBuffer pglUnmapBuffer; -static PFN_glUnmapNamedBuffer pglUnmapNamedBuffer; - static const char* wgl_extensions = NULL; static void flush_events(void) @@ -153,75 +95,10 @@ static void flush_events(void) static void init_functions(void) { -#define GET_PROC(func) \ - p ## func = (void*)wglGetProcAddress(#func); \ - if(!p ## func) \ - trace("wglGetProcAddress(%s) failed\n", #func); - - /* WGL_ARB_create_context */ - GET_PROC(wglCreateContextAttribsARB); - - /* WGL_ARB_extensions_string */ - GET_PROC(wglGetExtensionsStringARB) - GET_PROC(wglGetExtensionsStringEXT) - - /* WGL_ARB_make_current_read */ - GET_PROC(wglMakeContextCurrentARB); - GET_PROC(wglGetCurrentReadDCARB); - - /* WGL_ARB_pixel_format */ - GET_PROC(wglChoosePixelFormatARB) - GET_PROC(wglGetPixelFormatAttribivARB) - - /* WGL_ARB_pbuffer */ - GET_PROC(wglCreatePbufferARB) - GET_PROC(wglDestroyPbufferARB) - GET_PROC(wglGetPbufferDCARB) - GET_PROC(wglReleasePbufferDCARB) - GET_PROC(wglQueryPbufferARB) - - /* WGL_ARB_render_texture */ - GET_PROC(wglBindTexImageARB) - GET_PROC(wglReleaseTexImageARB) - GET_PROC(wglSetPbufferAttribARB) - - /* WGL_EXT_swap_control */ - GET_PROC(wglSwapIntervalEXT) - GET_PROC(wglGetSwapIntervalEXT) - - /* GL_ARB_debug_output */ - GET_PROC(glDebugMessageCallbackARB) - GET_PROC(glDebugMessageControlARB) - GET_PROC(glDebugMessageInsertARB) - - /* GL_ARB_framebuffer_object */ - GET_PROC(glBindFramebuffer) - GET_PROC(glCheckFramebufferStatus) - - GET_PROC(glBindBuffer) - GET_PROC(glBufferData) - GET_PROC(glBufferStorage) - GET_PROC(glCopyBufferSubData) - GET_PROC(glCopyNamedBufferSubData) - GET_PROC(glCreateBuffers) - GET_PROC(glDeleteBuffers) - GET_PROC(glDeleteSync) - GET_PROC(glFenceSync) - GET_PROC(glFlushMappedBufferRange) - GET_PROC(glFlushMappedNamedBufferRange) - GET_PROC(glGenBuffers) - GET_PROC(glGetStringi) - GET_PROC(glIsSync) - GET_PROC(glMapBuffer) - GET_PROC(glMapBufferRange) - GET_PROC(glMapNamedBuffer) - GET_PROC(glMapNamedBufferRange) - GET_PROC(glNamedBufferData) - GET_PROC(glNamedBufferStorage) - GET_PROC(glUnmapBuffer) - GET_PROC(glUnmapNamedBuffer) - -#undef GET_PROC +#define USE_GL_FUNC(func) p ## func = (void *)wglGetProcAddress( #func ); + ALL_GL_EXT_FUNCS + ALL_WGL_EXT_FUNCS +#undef USE_GL_FUNC } static BOOL gl_extension_supported(const char *extensions, const char *extension_string) @@ -1039,7 +916,7 @@ static void WINAPI gl_debug_message_callback(GLenum source, GLenum type, GLuint static void test_debug_message_callback(void) { static const char testmsg[] = "Hello World"; - DWORD count; + DWORD count = 0; if (!pglDebugMessageCallbackARB) { -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10739