From 6bb7d3bbc058e28d7131f738a7874996498ba090 Mon Sep 17 00:00:00 2001 From: Jose Fonseca Date: Wed, 12 May 2021 13:29:45 +0100 Subject: [PATCH] wgl: Remove opengl32.mingw.def. MinGW DEF parsing is even more broken than before, and 32-bits import libs are broken regardless one uses opengl32.mingw.def or opengl32.def. This change removes opengl32.mingw.def and addresses the issue differently: - link opengl32.dll with --enable-stdcall-fixup - use the systems opengl32 import lib (libopengl32.a/opengl32.lib) instead of our own This change also gets test_wgl built with MinGW (even if it's never tested), which I used to verify this; and to not link against internal libraries. Reviewed-by: Jesse Natalie v2: Revert back to shared_library. Part-of: --- src/gallium/frontends/wgl/opengl32.mingw.def | 388 ------------------- src/gallium/targets/libgl-gdi/meson.build | 49 ++- 2 files changed, 29 insertions(+), 408 deletions(-) delete mode 100644 src/gallium/frontends/wgl/opengl32.mingw.def diff --git a/src/gallium/frontends/wgl/opengl32.mingw.def b/src/gallium/frontends/wgl/opengl32.mingw.def deleted file mode 100644 index 0bceee06979..00000000000 --- a/src/gallium/frontends/wgl/opengl32.mingw.def +++ /dev/null @@ -1,388 +0,0 @@ -EXPORTS -; GlmfBeginGlsBlock = GlmfBeginGlsBlock@4 -; GlmfCloseMetaFile = GlmfCloseMetaFile@4 -; GlmfEndGlsBlock = GlmfEndGlsBlock@4 -; GlmfEndPlayback = GlmfEndPlayback@4 -; GlmfInitPlayback = GlmfInitPlayback@12 -; GlmfPlayGlsRecord = GlmfPlayGlsRecord@16 - glAccum = glAccum@8 - glAlphaFunc = glAlphaFunc@8 - glAreTexturesResident = glAreTexturesResident@12 - glArrayElement = glArrayElement@4 - glBegin = glBegin@4 - glBindTexture = glBindTexture@8 - glBitmap = glBitmap@28 - glBlendFunc = glBlendFunc@8 - glCallList = glCallList@4 - glCallLists = glCallLists@12 - glClear = glClear@4 - glClearAccum = glClearAccum@16 - glClearColor = glClearColor@16 - glClearDepth = glClearDepth@8 - glClearIndex = glClearIndex@4 - glClearStencil = glClearStencil@4 - glClipPlane = glClipPlane@8 - glColor3b = glColor3b@12 - glColor3bv = glColor3bv@4 - glColor3d = glColor3d@24 - glColor3dv = glColor3dv@4 - glColor3f = glColor3f@12 - glColor3fv = glColor3fv@4 - glColor3i = glColor3i@12 - glColor3iv = glColor3iv@4 - glColor3s = glColor3s@12 - glColor3sv = glColor3sv@4 - glColor3ub = glColor3ub@12 - glColor3ubv = glColor3ubv@4 - glColor3ui = glColor3ui@12 - glColor3uiv = glColor3uiv@4 - glColor3us = glColor3us@12 - glColor3usv = glColor3usv@4 - glColor4b = glColor4b@16 - glColor4bv = glColor4bv@4 - glColor4d = glColor4d@32 - glColor4dv = glColor4dv@4 - glColor4f = glColor4f@16 - glColor4fv = glColor4fv@4 - glColor4i = glColor4i@16 - glColor4iv = glColor4iv@4 - glColor4s = glColor4s@16 - glColor4sv = glColor4sv@4 - glColor4ub = glColor4ub@16 - glColor4ubv = glColor4ubv@4 - glColor4ui = glColor4ui@16 - glColor4uiv = glColor4uiv@4 - glColor4us = glColor4us@16 - glColor4usv = glColor4usv@4 - glColorMask = glColorMask@16 - glColorMaterial = glColorMaterial@8 - glColorPointer = glColorPointer@16 - glCopyPixels = glCopyPixels@20 - glCopyTexImage1D = glCopyTexImage1D@28 - glCopyTexImage2D = glCopyTexImage2D@32 - glCopyTexSubImage1D = glCopyTexSubImage1D@24 - glCopyTexSubImage2D = glCopyTexSubImage2D@32 - glCullFace = glCullFace@4 -; glDebugEntry = glDebugEntry@8 - glDeleteLists = glDeleteLists@8 - glDeleteTextures = glDeleteTextures@8 - glDepthFunc = glDepthFunc@4 - glDepthMask = glDepthMask@4 - glDepthRange = glDepthRange@16 - glDisable = glDisable@4 - glDisableClientState = glDisableClientState@4 - glDrawArrays = glDrawArrays@12 - glDrawBuffer = glDrawBuffer@4 - glDrawElements = glDrawElements@16 - glDrawPixels = glDrawPixels@20 - glEdgeFlag = glEdgeFlag@4 - glEdgeFlagPointer = glEdgeFlagPointer@8 - glEdgeFlagv = glEdgeFlagv@4 - glEnable = glEnable@4 - glEnableClientState = glEnableClientState@4 - glEnd = glEnd@0 - glEndList = glEndList@0 - glEvalCoord1d = glEvalCoord1d@8 - glEvalCoord1dv = glEvalCoord1dv@4 - glEvalCoord1f = glEvalCoord1f@4 - glEvalCoord1fv = glEvalCoord1fv@4 - glEvalCoord2d = glEvalCoord2d@16 - glEvalCoord2dv = glEvalCoord2dv@4 - glEvalCoord2f = glEvalCoord2f@8 - glEvalCoord2fv = glEvalCoord2fv@4 - glEvalMesh1 = glEvalMesh1@12 - glEvalMesh2 = glEvalMesh2@20 - glEvalPoint1 = glEvalPoint1@4 - glEvalPoint2 = glEvalPoint2@8 - glFeedbackBuffer = glFeedbackBuffer@12 - glFinish = glFinish@0 - glFlush = glFlush@0 - glFogf = glFogf@8 - glFogfv = glFogfv@8 - glFogi = glFogi@8 - glFogiv = glFogiv@8 - glFrontFace = glFrontFace@4 - glFrustum = glFrustum@48 - glGenLists = glGenLists@4 - glGenTextures = glGenTextures@8 - glGetBooleanv = glGetBooleanv@8 - glGetClipPlane = glGetClipPlane@8 - glGetDoublev = glGetDoublev@8 - glGetError = glGetError@0 - glGetFloatv = glGetFloatv@8 - glGetIntegerv = glGetIntegerv@8 - glGetLightfv = glGetLightfv@12 - glGetLightiv = glGetLightiv@12 - glGetMapdv = glGetMapdv@12 - glGetMapfv = glGetMapfv@12 - glGetMapiv = glGetMapiv@12 - glGetMaterialfv = glGetMaterialfv@12 - glGetMaterialiv = glGetMaterialiv@12 - glGetPixelMapfv = glGetPixelMapfv@8 - glGetPixelMapuiv = glGetPixelMapuiv@8 - glGetPixelMapusv = glGetPixelMapusv@8 - glGetPointerv = glGetPointerv@8 - glGetPolygonStipple = glGetPolygonStipple@4 - glGetString = glGetString@4 - glGetTexEnvfv = glGetTexEnvfv@12 - glGetTexEnviv = glGetTexEnviv@12 - glGetTexGendv = glGetTexGendv@12 - glGetTexGenfv = glGetTexGenfv@12 - glGetTexGeniv = glGetTexGeniv@12 - glGetTexImage = glGetTexImage@20 - glGetTexLevelParameterfv = glGetTexLevelParameterfv@16 - glGetTexLevelParameteriv = glGetTexLevelParameteriv@16 - glGetTexParameterfv = glGetTexParameterfv@12 - glGetTexParameteriv = glGetTexParameteriv@12 - glHint = glHint@8 - glIndexMask = glIndexMask@4 - glIndexPointer = glIndexPointer@12 - glIndexd = glIndexd@8 - glIndexdv = glIndexdv@4 - glIndexf = glIndexf@4 - glIndexfv = glIndexfv@4 - glIndexi = glIndexi@4 - glIndexiv = glIndexiv@4 - glIndexs = glIndexs@4 - glIndexsv = glIndexsv@4 - glIndexub = glIndexub@4 - glIndexubv = glIndexubv@4 - glInitNames = glInitNames@0 - glInterleavedArrays = glInterleavedArrays@12 - glIsEnabled = glIsEnabled@4 - glIsList = glIsList@4 - glIsTexture = glIsTexture@4 - glLightModelf = glLightModelf@8 - glLightModelfv = glLightModelfv@8 - glLightModeli = glLightModeli@8 - glLightModeliv = glLightModeliv@8 - glLightf = glLightf@12 - glLightfv = glLightfv@12 - glLighti = glLighti@12 - glLightiv = glLightiv@12 - glLineStipple = glLineStipple@8 - glLineWidth = glLineWidth@4 - glListBase = glListBase@4 - glLoadIdentity = glLoadIdentity@0 - glLoadMatrixd = glLoadMatrixd@4 - glLoadMatrixf = glLoadMatrixf@4 - glLoadName = glLoadName@4 - glLogicOp = glLogicOp@4 - glMap1d = glMap1d@32 - glMap1f = glMap1f@24 - glMap2d = glMap2d@56 - glMap2f = glMap2f@40 - glMapGrid1d = glMapGrid1d@20 - glMapGrid1f = glMapGrid1f@12 - glMapGrid2d = glMapGrid2d@40 - glMapGrid2f = glMapGrid2f@24 - glMaterialf = glMaterialf@12 - glMaterialfv = glMaterialfv@12 - glMateriali = glMateriali@12 - glMaterialiv = glMaterialiv@12 - glMatrixMode = glMatrixMode@4 - glMultMatrixd = glMultMatrixd@4 - glMultMatrixf = glMultMatrixf@4 - glNewList = glNewList@8 - glNormal3b = glNormal3b@12 - glNormal3bv = glNormal3bv@4 - glNormal3d = glNormal3d@24 - glNormal3dv = glNormal3dv@4 - glNormal3f = glNormal3f@12 - glNormal3fv = glNormal3fv@4 - glNormal3i = glNormal3i@12 - glNormal3iv = glNormal3iv@4 - glNormal3s = glNormal3s@12 - glNormal3sv = glNormal3sv@4 - glNormalPointer = glNormalPointer@12 - glOrtho = glOrtho@48 - glPassThrough = glPassThrough@4 - glPixelMapfv = glPixelMapfv@12 - glPixelMapuiv = glPixelMapuiv@12 - glPixelMapusv = glPixelMapusv@12 - glPixelStoref = glPixelStoref@8 - glPixelStorei = glPixelStorei@8 - glPixelTransferf = glPixelTransferf@8 - glPixelTransferi = glPixelTransferi@8 - glPixelZoom = glPixelZoom@8 - glPointSize = glPointSize@4 - glPolygonMode = glPolygonMode@8 - glPolygonOffset = glPolygonOffset@8 - glPolygonStipple = glPolygonStipple@4 - glPopAttrib = glPopAttrib@0 - glPopClientAttrib = glPopClientAttrib@0 - glPopMatrix = glPopMatrix@0 - glPopName = glPopName@0 - glPrioritizeTextures = glPrioritizeTextures@12 - glPushAttrib = glPushAttrib@4 - glPushClientAttrib = glPushClientAttrib@4 - glPushMatrix = glPushMatrix@0 - glPushName = glPushName@4 - glRasterPos2d = glRasterPos2d@16 - glRasterPos2dv = glRasterPos2dv@4 - glRasterPos2f = glRasterPos2f@8 - glRasterPos2fv = glRasterPos2fv@4 - glRasterPos2i = glRasterPos2i@8 - glRasterPos2iv = glRasterPos2iv@4 - glRasterPos2s = glRasterPos2s@8 - glRasterPos2sv = glRasterPos2sv@4 - glRasterPos3d = glRasterPos3d@24 - glRasterPos3dv = glRasterPos3dv@4 - glRasterPos3f = glRasterPos3f@12 - glRasterPos3fv = glRasterPos3fv@4 - glRasterPos3i = glRasterPos3i@12 - glRasterPos3iv = glRasterPos3iv@4 - glRasterPos3s = glRasterPos3s@12 - glRasterPos3sv = glRasterPos3sv@4 - glRasterPos4d = glRasterPos4d@32 - glRasterPos4dv = glRasterPos4dv@4 - glRasterPos4f = glRasterPos4f@16 - glRasterPos4fv = glRasterPos4fv@4 - glRasterPos4i = glRasterPos4i@16 - glRasterPos4iv = glRasterPos4iv@4 - glRasterPos4s = glRasterPos4s@16 - glRasterPos4sv = glRasterPos4sv@4 - glReadBuffer = glReadBuffer@4 - glReadPixels = glReadPixels@28 - glRectd = glRectd@32 - glRectdv = glRectdv@8 - glRectf = glRectf@16 - glRectfv = glRectfv@8 - glRecti = glRecti@16 - glRectiv = glRectiv@8 - glRects = glRects@16 - glRectsv = glRectsv@8 - glRenderMode = glRenderMode@4 - glRotated = glRotated@32 - glRotatef = glRotatef@16 - glScaled = glScaled@24 - glScalef = glScalef@12 - glScissor = glScissor@16 - glSelectBuffer = glSelectBuffer@8 - glShadeModel = glShadeModel@4 - glStencilFunc = glStencilFunc@12 - glStencilMask = glStencilMask@4 - glStencilOp = glStencilOp@12 - glTexCoord1d = glTexCoord1d@8 - glTexCoord1dv = glTexCoord1dv@4 - glTexCoord1f = glTexCoord1f@4 - glTexCoord1fv = glTexCoord1fv@4 - glTexCoord1i = glTexCoord1i@4 - glTexCoord1iv = glTexCoord1iv@4 - glTexCoord1s = glTexCoord1s@4 - glTexCoord1sv = glTexCoord1sv@4 - glTexCoord2d = glTexCoord2d@16 - glTexCoord2dv = glTexCoord2dv@4 - glTexCoord2f = glTexCoord2f@8 - glTexCoord2fv = glTexCoord2fv@4 - glTexCoord2i = glTexCoord2i@8 - glTexCoord2iv = glTexCoord2iv@4 - glTexCoord2s = glTexCoord2s@8 - glTexCoord2sv = glTexCoord2sv@4 - glTexCoord3d = glTexCoord3d@24 - glTexCoord3dv = glTexCoord3dv@4 - glTexCoord3f = glTexCoord3f@12 - glTexCoord3fv = glTexCoord3fv@4 - glTexCoord3i = glTexCoord3i@12 - glTexCoord3iv = glTexCoord3iv@4 - glTexCoord3s = glTexCoord3s@12 - glTexCoord3sv = glTexCoord3sv@4 - glTexCoord4d = glTexCoord4d@32 - glTexCoord4dv = glTexCoord4dv@4 - glTexCoord4f = glTexCoord4f@16 - glTexCoord4fv = glTexCoord4fv@4 - glTexCoord4i = glTexCoord4i@16 - glTexCoord4iv = glTexCoord4iv@4 - glTexCoord4s = glTexCoord4s@16 - glTexCoord4sv = glTexCoord4sv@4 - glTexCoordPointer = glTexCoordPointer@16 - glTexEnvf = glTexEnvf@12 - glTexEnvfv = glTexEnvfv@12 - glTexEnvi = glTexEnvi@12 - glTexEnviv = glTexEnviv@12 - glTexGend = glTexGend@16 - glTexGendv = glTexGendv@12 - glTexGenf = glTexGenf@12 - glTexGenfv = glTexGenfv@12 - glTexGeni = glTexGeni@12 - glTexGeniv = glTexGeniv@12 - glTexImage1D = glTexImage1D@32 - glTexImage2D = glTexImage2D@36 - glTexParameterf = glTexParameterf@12 - glTexParameterfv = glTexParameterfv@12 - glTexParameteri = glTexParameteri@12 - glTexParameteriv = glTexParameteriv@12 - glTexSubImage1D = glTexSubImage1D@28 - glTexSubImage2D = glTexSubImage2D@36 - glTranslated = glTranslated@24 - glTranslatef = glTranslatef@12 - glVertex2d = glVertex2d@16 - glVertex2dv = glVertex2dv@4 - glVertex2f = glVertex2f@8 - glVertex2fv = glVertex2fv@4 - glVertex2i = glVertex2i@8 - glVertex2iv = glVertex2iv@4 - glVertex2s = glVertex2s@8 - glVertex2sv = glVertex2sv@4 - glVertex3d = glVertex3d@24 - glVertex3dv = glVertex3dv@4 - glVertex3f = glVertex3f@12 - glVertex3fv = glVertex3fv@4 - glVertex3i = glVertex3i@12 - glVertex3iv = glVertex3iv@4 - glVertex3s = glVertex3s@12 - glVertex3sv = glVertex3sv@4 - glVertex4d = glVertex4d@32 - glVertex4dv = glVertex4dv@4 - glVertex4f = glVertex4f@16 - glVertex4fv = glVertex4fv@4 - glVertex4i = glVertex4i@16 - glVertex4iv = glVertex4iv@4 - glVertex4s = glVertex4s@16 - glVertex4sv = glVertex4sv@4 - glVertexPointer = glVertexPointer@16 - glViewport = glViewport@16 - wglChoosePixelFormat = wglChoosePixelFormat@8 - wglCopyContext = wglCopyContext@12 - wglCreateContext = wglCreateContext@4 - wglCreateLayerContext = wglCreateLayerContext@8 - wglDeleteContext = wglDeleteContext@4 - wglDescribeLayerPlane = wglDescribeLayerPlane@20 - wglDescribePixelFormat = wglDescribePixelFormat@16 - wglGetCurrentContext = wglGetCurrentContext@0 - wglGetCurrentDC = wglGetCurrentDC@0 -; wglGetDefaultProcAddress = wglGetDefaultProcAddress@4 - wglGetLayerPaletteEntries = wglGetLayerPaletteEntries@20 - wglGetPixelFormat = wglGetPixelFormat@4 - wglGetProcAddress = wglGetProcAddress@4 - wglMakeCurrent = wglMakeCurrent@8 - wglRealizeLayerPalette = wglRealizeLayerPalette@12 - wglSetLayerPaletteEntries = wglSetLayerPaletteEntries@20 - wglSetPixelFormat = wglSetPixelFormat@12 - wglShareLists = wglShareLists@8 - wglSwapBuffers = wglSwapBuffers@4 - wglSwapLayerBuffers = wglSwapLayerBuffers@8 - wglSwapMultipleBuffers = wglSwapMultipleBuffers@8 - wglUseFontBitmapsA = wglUseFontBitmapsA@16 - wglUseFontBitmapsW = wglUseFontBitmapsW@16 - wglUseFontOutlinesA = wglUseFontOutlinesA@32 - wglUseFontOutlinesW = wglUseFontOutlinesW@32 - DrvCopyContext = DrvCopyContext@12 - DrvCreateContext = DrvCreateContext@4 - DrvCreateLayerContext = DrvCreateLayerContext@8 - DrvDeleteContext = DrvDeleteContext@4 - DrvDescribeLayerPlane = DrvDescribeLayerPlane@20 - DrvDescribePixelFormat = DrvDescribePixelFormat@16 - DrvGetLayerPaletteEntries = DrvGetLayerPaletteEntries@20 - DrvGetProcAddress = DrvGetProcAddress@4 - DrvPresentBuffers = DrvPresentBuffers@8 - DrvRealizeLayerPalette = DrvRealizeLayerPalette@12 - DrvReleaseContext = DrvReleaseContext@4 - DrvSetCallbackProcs = DrvSetCallbackProcs@8 - DrvSetContext = DrvSetContext@12 - DrvSetLayerPaletteEntries = DrvSetLayerPaletteEntries@20 - DrvSetPixelFormat = DrvSetPixelFormat@8 - DrvShareLists = DrvShareLists@8 - DrvSwapBuffers = DrvSwapBuffers@4 - DrvSwapLayerBuffers = DrvSwapLayerBuffers@8 - DrvValidateVersion = DrvValidateVersion@4 diff --git a/src/gallium/targets/libgl-gdi/meson.build b/src/gallium/targets/libgl-gdi/meson.build index cf5dbcd3d06..f053abc6bee 100644 --- a/src/gallium/targets/libgl-gdi/meson.build +++ b/src/gallium/targets/libgl-gdi/meson.build @@ -18,14 +18,14 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -# DEF parser in certain versions of MinGW is busted, as does not behave as -# MSVC. mingw-w64 works fine. + +opengl32_link_args = [] if cc.get_id() == 'gcc' and host_machine.cpu_family() != 'x86_64' - ogldef = files('../../frontends/wgl/opengl32.mingw.def')[0] -else - ogldef = files('../../frontends/wgl/opengl32.def')[0] + opengl32_link_args += ['-Wl,--enable-stdcall-fixup'] endif +ogldef = files('../../frontends/wgl/opengl32.def')[0] + libopengl32 = shared_library( 'opengl32', ['libgl_gdi.c'], @@ -41,28 +41,37 @@ libopengl32 = shared_library( dep_ws2_32, idep_nir, idep_mesautil, driver_swrast, driver_swr, driver_d3d12, driver_zink, winsys_d3d12_wgl ], + link_args : opengl32_link_args, name_prefix : '', # otherwise mingw will create libopengl32.dll install : true, ) -# The CI pipeline for MinGW doesn't support creating a window, so don't run these tests there -if with_tests and cc.get_id() != 'gcc' - extra_test_deps = [] +if with_tests + extra_test_defs = [] + + # The generated MinGW 32-bits import libraries are always broken due to missing @nn suffix on + # symbols, no matter what we do. So instead we use the builtin libopengl32.a + extra_test_deps = [cpp.find_library('opengl32')] + if with_gallium_d3d12 + extra_test_defs += ['-DGALLIUM_D3D12'] extra_test_deps += [cpp.find_library('d3d12')] endif - test( - 'wgl', - executable( - 'test_wgl', - files('tests/wgl_tests.cpp'), - cpp_args : [cpp_msvc_compat_args], - dependencies : [idep_gtest, dep_dxheaders, extra_test_deps, - driver_swrast, driver_swr, driver_d3d12, driver_zink - ], - link_with : [libopengl32], - ), - suite : ['wgl'], + test_wgl = executable( + 'test_wgl', + files('tests/wgl_tests.cpp'), + cpp_args : [cpp_msvc_compat_args, extra_test_defs], + dependencies : [idep_gtest, dep_dxheaders, extra_test_deps], ) + + # The CI pipeline for MinGW doesn't support creating a window, so don't run these tests there + if with_tests and cc.get_id() != 'gcc' + test( + 'wgl', + test_wgl, + suite : ['wgl'], + depends : [libopengl32], + ) + endif endif