From cb1ca3c1be655cf253c98eef27f5ee396e69f806 Mon Sep 17 00:00:00 2001 From: Ricardo Garcia Date: Thu, 13 Oct 2022 17:28:27 +0200 Subject: [PATCH] Fix build on main branch This commit fixes several build errors and warnings on the main branch, as reported by clang/GCC on a Ubuntu 20.04 system. The warnings were also being converted to errors in check_build_sanity, preventing the checks from completing successfully. * VulkanSC did not compile with DEQP_SUPPORT_DRM. * Some GL callbacks used the wrong prototype. * Some functions had write-only variables that were not being used. * One class was not using the "override" suffix for virtual methods consistently. VK-GL-CTS issue: 4032 Components: OpenGL, Vulkan, Framework Change-Id: I9c3e1af13713f1f6ed10cde1c475f7a1c7e6581a --- .../openglcts/modules/common/glcKHRDebugTests.cpp | 4 ++-- .../openglcts/modules/common/glcKHRDebugTests.hpp | 4 ++-- .../openglcts/modules/gl/gl3cCullDistanceTests.cpp | 5 ----- .../vulkan/api/vktApiDeviceDrmPropertiesTests.cpp | 4 ++-- .../vulkan/api/vktApiDeviceInitializationTests.cpp | 2 -- .../vulkan/image/vktImageSubresourceLayoutTests.cpp | 2 -- .../vulkan/wsi/vktWsiAcquireDrmDisplayTests.cpp | 20 ++++++++++---------- framework/common/tcuLibDrm.cpp | 4 ++-- framework/common/tcuLibDrm.hpp | 6 +++--- framework/opengl/gluShaderLibrary.cpp | 3 --- framework/opengl/wrapper/glwTypes.inl | 2 +- framework/platform/lnx/tcuLnxVulkanPlatform.cpp | 16 +++++++++------- modules/gles2/functional/es2fPolygonOffsetTests.cpp | 2 -- modules/gles3/functional/es3fPolygonOffsetTests.cpp | 2 -- modules/gles31/functional/es31fDebugTests.cpp | 6 +++--- 15 files changed, 34 insertions(+), 48 deletions(-) diff --git a/external/openglcts/modules/common/glcKHRDebugTests.cpp b/external/openglcts/modules/common/glcKHRDebugTests.cpp index efad8c4..8da51b2 100644 --- a/external/openglcts/modules/common/glcKHRDebugTests.cpp +++ b/external/openglcts/modules/common/glcKHRDebugTests.cpp @@ -1797,7 +1797,7 @@ tcu::TestNode::IterateResult ReceivingMessagesTest::iterate() **/ void ReceivingMessagesTest::debug_proc(glw::GLenum /* source */, glw::GLenum /* type */, glw::GLuint /* id */, glw::GLenum /* severity */, glw::GLsizei /* length */, - const glw::GLchar* /* message */, const void* info) + const glw::GLchar* /* message */, void* info) { GLuint* counter = (GLuint*)info; @@ -2403,7 +2403,7 @@ SynchronousCallsTest::~SynchronousCallsTest(void) **/ void SynchronousCallsTest::debug_proc(glw::GLenum /* source */, glw::GLenum /* type */, glw::GLuint /* id */, glw::GLenum /* severity */, glw::GLsizei /* length */, - const glw::GLchar* /* message */, const void* info) + const glw::GLchar* /* message */, void* info) { int* callback_executed = (int*)info; diff --git a/external/openglcts/modules/common/glcKHRDebugTests.hpp b/external/openglcts/modules/common/glcKHRDebugTests.hpp index cce0c5a..b4d0b65 100644 --- a/external/openglcts/modules/common/glcKHRDebugTests.hpp +++ b/external/openglcts/modules/common/glcKHRDebugTests.hpp @@ -318,7 +318,7 @@ public: private: /* Private routines */ static void GLW_APIENTRY debug_proc(glw::GLenum source, glw::GLenum type, glw::GLuint id, glw::GLenum severity, - glw::GLsizei length, const glw::GLchar* message, const void* info); + glw::GLsizei length, const glw::GLchar* message, void* info); void inspectCallbackCounter(glw::GLuint& callback_counter, glw::GLuint expected_number_of_messages) const; @@ -446,7 +446,7 @@ public: private: /* Private routines */ static void GLW_APIENTRY debug_proc(glw::GLenum source, glw::GLenum type, glw::GLuint id, glw::GLenum severity, - glw::GLsizei length, const glw::GLchar* message, const void* info); + glw::GLsizei length, const glw::GLchar* message, void* info); de::ThreadLocal m_tls; deUint32 m_uid; diff --git a/external/openglcts/modules/gl/gl3cCullDistanceTests.cpp b/external/openglcts/modules/gl/gl3cCullDistanceTests.cpp index 79225a7..95f7c12 100644 --- a/external/openglcts/modules/gl/gl3cCullDistanceTests.cpp +++ b/external/openglcts/modules/gl/gl3cCullDistanceTests.cpp @@ -2221,7 +2221,6 @@ void CullDistance::FunctionalTest::executeRenderTest(glw::GLuint clipdistances_ glw::GLenum mode = GL_NONE; glw::GLuint n_clipped_vertices_real = 0; glw::GLuint n_culled_primitives_real = 0; - glw::GLuint n_not_clipped_vertices_real = 0; const glw::GLuint primitive_vertices_count = ((primitive_mode == PRIMITIVE_MODE_LINES) ? 2 : (primitive_mode == PRIMITIVE_MODE_POINTS) ? 1 : 3); const glw::GLuint stride_in_floats = @@ -2456,10 +2455,6 @@ void CullDistance::FunctionalTest::executeRenderTest(glw::GLuint clipdistances_ TCU_FAIL("Vertex is unexpectedly clipped or invisible"); } - else - { - n_not_clipped_vertices_real++; - } } } diff --git a/external/vulkancts/modules/vulkan/api/vktApiDeviceDrmPropertiesTests.cpp b/external/vulkancts/modules/vulkan/api/vktApiDeviceDrmPropertiesTests.cpp index fa764c2..3222a51 100644 --- a/external/vulkancts/modules/vulkan/api/vktApiDeviceDrmPropertiesTests.cpp +++ b/external/vulkancts/modules/vulkan/api/vktApiDeviceDrmPropertiesTests.cpp @@ -55,7 +55,7 @@ void testFilesExist (const VkPhysicalDeviceDrmPropertiesEXT& deviceDrmProperties bool primaryFound = !deviceDrmProperties.hasPrimary; bool renderFound = !deviceDrmProperties.hasRender; -#if DEQP_SUPPORT_DRM +#if DEQP_SUPPORT_DRM && !defined (CTS_USES_VULKANSC) static const tcu::LibDrm libDrm; int numDrmDevices; @@ -71,7 +71,7 @@ void testFilesExist (const VkPhysicalDeviceDrmPropertiesEXT& deviceDrmProperties renderFound = true; libDrm.freeDevices(drmDevices, numDrmDevices); -#endif // DEQP_SUPPORT_DRM +#endif // DEQP_SUPPORT_DRM && !defined (CTS_USES_VULKANSC) if (!primaryFound && !renderFound) { TCU_THROW(NotSupportedError, "Nether DRM primary nor render device files were found"); diff --git a/external/vulkancts/modules/vulkan/api/vktApiDeviceInitializationTests.cpp b/external/vulkancts/modules/vulkan/api/vktApiDeviceInitializationTests.cpp index f97e23a..a7e290a 100644 --- a/external/vulkancts/modules/vulkan/api/vktApiDeviceInitializationTests.cpp +++ b/external/vulkancts/modules/vulkan/api/vktApiDeviceInitializationTests.cpp @@ -1544,7 +1544,6 @@ tcu::TestStatus createDeviceWithUnsupportedFeaturesTest (Context& context) const VkPhysicalDeviceFeatures2 deviceFeatures2 = deviceFeaturesAll.getCoreFeatures2(); const VkPhysicalDeviceFeatures deviceFeatures = deviceFeatures2.features; const vector queueFamilyProperties = getPhysicalDeviceQueueFamilyProperties(instanceDriver, physicalDevice); - int numErrors = 0; // Test features listed in VkPhysicalDeviceFeatures structure { @@ -1656,7 +1655,6 @@ tcu::TestStatus createDeviceWithUnsupportedFeaturesTest (Context& context) if (res != VK_ERROR_FEATURE_NOT_PRESENT) { - numErrors++; resultCollector.fail("Not returning VK_ERROR_FEATURE_NOT_PRESENT when creating device with feature " + de::toString(feature.name) + ", which was reported as unsupported."); } diff --git a/external/vulkancts/modules/vulkan/image/vktImageSubresourceLayoutTests.cpp b/external/vulkancts/modules/vulkan/image/vktImageSubresourceLayoutTests.cpp index 9b408cf..a54e01c 100644 --- a/external/vulkancts/modules/vulkan/image/vktImageSubresourceLayoutTests.cpp +++ b/external/vulkancts/modules/vulkan/image/vktImageSubresourceLayoutTests.cpp @@ -89,7 +89,6 @@ BufferLevels::BufferLevels (VkImageType type, VkFormat format, VkExtent3D levelZ VkDeviceSize currentOffset = 0ull; VkExtent3D nextExtent = levelZero; - deUint32 levelCount = 0; if (!aspects || (aspects & VK_IMAGE_ASPECT_COLOR_BIT)) { @@ -130,7 +129,6 @@ BufferLevels::BufferLevels (VkImageType type, VkFormat format, VkExtent3D levelZ nextExtent.depth = std::max(1u, (nextExtent.depth / 2u)); currentOffset += level.size; - ++levelCount; } } diff --git a/external/vulkancts/modules/vulkan/wsi/vktWsiAcquireDrmDisplayTests.cpp b/external/vulkancts/modules/vulkan/wsi/vktWsiAcquireDrmDisplayTests.cpp index cd2b953..2732e6f 100644 --- a/external/vulkancts/modules/vulkan/wsi/vktWsiAcquireDrmDisplayTests.cpp +++ b/external/vulkancts/modules/vulkan/wsi/vktWsiAcquireDrmDisplayTests.cpp @@ -31,9 +31,9 @@ #include "tcuDefs.hpp" #include "tcuLibDrm.hpp" -#if DEQP_SUPPORT_DRM +#if DEQP_SUPPORT_DRM && !defined (CTS_USES_VULKANSC) #include -#endif // DEQP_SUPPORT_DRM +#endif // DEQP_SUPPORT_DRM && !defined (CTS_USES_VULKANSC) #include #include @@ -45,9 +45,9 @@ namespace wsi using namespace vk; using std::string; using std::vector; -#if DEQP_SUPPORT_DRM +#if DEQP_SUPPORT_DRM && !defined (CTS_USES_VULKANSC) using tcu::LibDrm; -#endif // DEQP_SUPPORT_DRM +#endif // DEQP_SUPPORT_DRM && !defined (CTS_USES_VULKANSC) #define INVALID_PTR 0xFFFFFFFF @@ -79,7 +79,7 @@ public: private: CustomInstance createInstanceWithAcquireDrmDisplay (void); -#if DEQP_SUPPORT_DRM +#if DEQP_SUPPORT_DRM && !defined (CTS_USES_VULKANSC) LibDrm::FdPtr getDrmFdPtr (void); deUint32 getConnectedConnectorId (int fd, deUint32 connectorId = 0); deUint32 getValidCrtcId (int fd, deUint32 connectorId); @@ -98,7 +98,7 @@ private: tcu::TestStatus testReleaseDisplayEXT (void); const LibDrm m_libDrm; -#endif // DEQP_SUPPORT_DRM +#endif // DEQP_SUPPORT_DRM && !defined (CTS_USES_VULKANSC) const CustomInstance m_instance; const InstanceInterface& m_vki; @@ -132,7 +132,7 @@ AcquireDrmDisplayTestInstance::AcquireDrmDisplayTestInstance (Context& context, *//*--------------------------------------------------------------------*/ tcu::TestStatus AcquireDrmDisplayTestInstance::iterate (void) { -#if DEQP_SUPPORT_DRM +#if DEQP_SUPPORT_DRM && !defined (CTS_USES_VULKANSC) switch (m_testId) { case DRM_TEST_INDEX_GET_DRM_DISPLAY: return testGetDrmDisplayEXT(); @@ -154,7 +154,7 @@ tcu::TestStatus AcquireDrmDisplayTestInstance::iterate (void) TCU_FAIL("Invalid test identifier"); #else TCU_THROW(NotSupportedError, "Drm not supported."); -#endif // DEQP_SUPPORT_DRM +#endif // DEQP_SUPPORT_DRM && !defined (CTS_USES_VULKANSC) } // /*--------------------------------------------------------------------*//*! @@ -177,7 +177,7 @@ CustomInstance AcquireDrmDisplayTestInstance::createInstanceWithAcquireDrmDispla return createCustomInstanceWithExtensions(m_context, requiredExtensions); } -#if DEQP_SUPPORT_DRM +#if DEQP_SUPPORT_DRM && !defined (CTS_USES_VULKANSC) // /*--------------------------------------------------------------------*//*! // * \brief Open a fd for the Drm corresponding to the Vulkan instance // * @@ -663,7 +663,7 @@ tcu::TestStatus AcquireDrmDisplayTestInstance::testReleaseDisplayEXT (void) return tcu::TestStatus::pass("pass"); } -#endif // DEQP_SUPPORT_DRM +#endif // DEQP_SUPPORT_DRM && !defined (CTS_USES_VULKANSC) /*--------------------------------------------------------------------*//*! * \brief Acquire Drm display tests case class diff --git a/framework/common/tcuLibDrm.cpp b/framework/common/tcuLibDrm.cpp index 7d53528..d5d835e 100644 --- a/framework/common/tcuLibDrm.cpp +++ b/framework/common/tcuLibDrm.cpp @@ -22,7 +22,7 @@ * \brief Drm utilities. *//*--------------------------------------------------------------------*/ -#if DEQP_SUPPORT_DRM +#if DEQP_SUPPORT_DRM && !defined (CTS_USES_VULKANSC) #include "tcuLibDrm.hpp" @@ -204,4 +204,4 @@ const char* LibDrm::libDrmFiles[] = } // tcu -#endif // DEQP_SUPPORT_DRM +#endif // DEQP_SUPPORT_DRM && !defined (CTS_USES_VULKANSC) diff --git a/framework/common/tcuLibDrm.hpp b/framework/common/tcuLibDrm.hpp index cae3135..2868392 100644 --- a/framework/common/tcuLibDrm.hpp +++ b/framework/common/tcuLibDrm.hpp @@ -24,7 +24,7 @@ * \brief Drm utilities. *//*--------------------------------------------------------------------*/ -#if DEQP_SUPPORT_DRM +#if DEQP_SUPPORT_DRM && !defined (CTS_USES_VULKANSC) #include "deDynamicLibrary.hpp" @@ -91,6 +91,6 @@ private: } // tcu -#endif // DEQP_SUPPORT_DRM +#endif // DEQP_SUPPORT_DRM && !defined (CTS_USES_VULKANSC) -#endif // _TCULIBDRM_HPP \ No newline at end of file +#endif // _TCULIBDRM_HPP diff --git a/framework/opengl/gluShaderLibrary.cpp b/framework/opengl/gluShaderLibrary.cpp index 347ce4c..e8ea64b 100644 --- a/framework/opengl/gluShaderLibrary.cpp +++ b/framework/opengl/gluShaderLibrary.cpp @@ -1036,14 +1036,11 @@ void ShaderParser::parseValue (ValueBlock& valueBlock) // Parse actual value. if (m_curToken == TOKEN_LEFT_BRACKET) // value list { - int arrayLength = 0; // \todo [2015-08-03 pyry] Currently unused - advanceToken(TOKEN_LEFT_BRACKET); for (;;) { parseValueElement(basicType, dstBlock->back()); - arrayLength++; if (m_curToken == TOKEN_RIGHT_BRACKET) break; diff --git a/framework/opengl/wrapper/glwTypes.inl b/framework/opengl/wrapper/glwTypes.inl index eb40825..76d3d1a 100644 --- a/framework/opengl/wrapper/glwTypes.inl +++ b/framework/opengl/wrapper/glwTypes.inl @@ -83,7 +83,7 @@ typedef struct __GLsync* GLsync; typedef void* GLeglImageOES; /* Callback for GL_ARB_debug_output. */ -typedef void (GLW_APIENTRY* GLDEBUGPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *message, const GLvoid *userParam); +typedef void (GLW_APIENTRY* GLDEBUGPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *message, GLvoid *userParam); /* OES_EGL_image */ typedef void* GLeglImageOES; diff --git a/framework/platform/lnx/tcuLnxVulkanPlatform.cpp b/framework/platform/lnx/tcuLnxVulkanPlatform.cpp index 6b08369..4d57526 100644 --- a/framework/platform/lnx/tcuLnxVulkanPlatform.cpp +++ b/framework/platform/lnx/tcuLnxVulkanPlatform.cpp @@ -38,7 +38,9 @@ using de::MovePtr; using de::UniquePtr; +#if DEQP_SUPPORT_DRM && !defined (CTS_USES_VULKANSC) using tcu::LibDrm; +#endif // DEQP_SUPPORT_DRM && !defined (CTS_USES_VULKANSC) #if defined (DEQP_SUPPORT_X11) # include "tcuLnxX11.hpp" @@ -227,7 +229,7 @@ public: #endif // DEQP_SUPPORT_HEADLESS -#if DEQP_SUPPORT_DRM +#if DEQP_SUPPORT_DRM && !defined (CTS_USES_VULKANSC) struct VulkanWindowDirectDrm : public vk::wsi::Window { @@ -244,7 +246,7 @@ public: { } - vk::wsi::Window* createWindow (const Maybe&) const + vk::wsi::Window* createWindow (const Maybe&) const override { return new VulkanWindowDirectDrm(); } @@ -321,7 +323,7 @@ public: bool m_initialized = false; }; -#endif // DEQP_SUPPORT_DRM +#endif // DEQP_SUPPORT_DRM && !defined (CTS_USES_VULKANSC) class VulkanLibrary : public vk::Library { @@ -377,10 +379,10 @@ vk::wsi::Display* VulkanPlatform::createWsiDisplay (vk::wsi::Type wsiType) const case vk::wsi::TYPE_HEADLESS: return new VulkanDisplayHeadless(); #endif // DEQP_SUPPORT_HEADLESS -#if DEQP_SUPPORT_DRM +#if DEQP_SUPPORT_DRM && !defined (CTS_USES_VULKANSC) case vk::wsi::TYPE_DIRECT_DRM: return new VulkanDisplayDirectDrm(); -#endif // DEQP_SUPPORT_DRM +#endif // DEQP_SUPPORT_DRM && !defined (CTS_USES_VULKANSC) default: TCU_THROW(NotSupportedError, "WSI type not supported"); @@ -407,10 +409,10 @@ bool VulkanPlatform::hasDisplay (vk::wsi::Type wsiType) const case vk::wsi::TYPE_HEADLESS: return true; #endif // DEQP_SUPPORT_HEADLESS -#if DEQP_SUPPORT_DRM +#if DEQP_SUPPORT_DRM && !defined (CTS_USES_VULKANSC) case vk::wsi::TYPE_DIRECT_DRM: return true; -#endif // DEQP_SUPPORT_DRM +#endif // DEQP_SUPPORT_DRM && !defined (CTS_USES_VULKANSC) default: return false; diff --git a/modules/gles2/functional/es2fPolygonOffsetTests.cpp b/modules/gles2/functional/es2fPolygonOffsetTests.cpp index 0c69b62..d8f4439 100644 --- a/modules/gles2/functional/es2fPolygonOffsetTests.cpp +++ b/modules/gles2/functional/es2fPolygonOffsetTests.cpp @@ -99,7 +99,6 @@ int compareImages (tcu::TestLog& log, glu::RenderContext& renderCtx, const tcu:: const tcu::IVec4 threshold = tcu::IVec4(colorThreshold, colorThreshold, colorThreshold, formatThreshold.getAlpha() > 0 ? colorThreshold : 0) + tcu::IVec4(formatThreshold.getRed(), formatThreshold.getGreen(), formatThreshold.getBlue(), formatThreshold.getAlpha()); - int deviatingPixels = 0; int faultyPixels = 0; int compareFailed = -1; @@ -139,7 +138,6 @@ int compareImages (tcu::TestLog& log, glu::RenderContext& renderCtx, const tcu:: diffMask.setPixel(MASK_COLOR_DEV, x, y); if (compareFailed == -1) compareFailed = 0; - deviatingPixels++; continue; } } diff --git a/modules/gles3/functional/es3fPolygonOffsetTests.cpp b/modules/gles3/functional/es3fPolygonOffsetTests.cpp index b8d13ba..e19f56f 100644 --- a/modules/gles3/functional/es3fPolygonOffsetTests.cpp +++ b/modules/gles3/functional/es3fPolygonOffsetTests.cpp @@ -102,7 +102,6 @@ int compareImages (tcu::TestLog& log, glu::RenderContext& renderCtx, const tcu:: const tcu::IVec4 threshold = tcu::IVec4(colorThreshold, colorThreshold, colorThreshold, formatThreshold.getAlpha() > 0 ? colorThreshold : 0) + tcu::IVec4(formatThreshold.getRed(), formatThreshold.getGreen(), formatThreshold.getBlue(), formatThreshold.getAlpha()); - int deviatingPixels = 0; int faultyPixels = 0; int compareFailed = -1; @@ -142,7 +141,6 @@ int compareImages (tcu::TestLog& log, glu::RenderContext& renderCtx, const tcu:: diffMask.setPixel(MASK_COLOR_DEV, x, y); if (compareFailed == -1) compareFailed = 0; - deviatingPixels++; continue; } } diff --git a/modules/gles31/functional/es31fDebugTests.cpp b/modules/gles31/functional/es31fDebugTests.cpp index f0dbc9f..9f8e03b 100644 --- a/modules/gles31/functional/es31fDebugTests.cpp +++ b/modules/gles31/functional/es31fDebugTests.cpp @@ -310,7 +310,7 @@ struct MessageData MessageData (const MessageID& id_, GLenum severity_, const string& message_) : id(id_) , severity(severity_) , message(message_) {} }; -extern "C" typedef void GLW_APIENTRY DebugCallbackFunc(GLenum, GLenum, GLuint, GLenum, GLsizei, const char*, const void*); +extern "C" typedef void GLW_APIENTRY DebugCallbackFunc(GLenum, GLenum, GLuint, GLenum, GLsizei, const char*, void*); // Base class class BaseCase : public NegativeTestShared::ErrorCase @@ -356,7 +356,7 @@ protected: tcu::ResultCollector m_results; }; -void BaseCase::callbackHandle (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const char* message, const void* userParam) +void BaseCase::callbackHandle (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const char* message, void* userParam) { static_cast(const_cast(userParam))->callback(source, type, id, severity, string(message, &message[length])); } @@ -2804,7 +2804,7 @@ GroupStackDepthQueryCase::IterateResult GroupStackDepthQueryCase::iterate (void) return STOP; } -extern "C" void GLW_APIENTRY emptyCallback(GLenum, GLenum, GLuint, GLenum, GLsizei, const char*, const void*) +extern "C" void GLW_APIENTRY emptyCallback(GLenum, GLenum, GLuint, GLenum, GLsizei, const char*, void*) { // empty } -- 2.7.4