From bb799876247672a66a743202094c1822af7427e2 Mon Sep 17 00:00:00 2001 From: Ricardo Garcia Date: Mon, 4 Apr 2022 10:14:57 +0200 Subject: [PATCH] Fix warnings with clang and GCC Affected tests: No test result should be affected by these changes. Components: OpenGL, Vulkan VK-GL-CTS issue: 3602 Change-Id: If2eb0736d296add732aaff53c80a705cc306d7a3 --- .../modules/gl/gl4cGPUShaderFP64Tests.cpp | 25 ++++++++++++++++----- .../esextcTessellationShaderVertexSpacing.hpp | 2 +- ...ktComputeWorkgroupMemoryExplicitLayoutTests.cpp | 26 +++++++++++++++++++++- ...ktComputeZeroInitializeWorkgroupMemoryTests.cpp | 10 ++++++++- .../vktSparseResourcesImageAlignedMipSize.cpp | 2 +- .../vktSparseResourcesImageBlockShapes.cpp | 2 +- .../vktSparseResourcesImageMemoryAliasing.cpp | 2 +- .../vktSparseResourcesImageSparseBinding.cpp | 2 +- .../vktSparseResourcesImageSparseResidency.cpp | 2 +- .../vktSparseResourcesMipmapSparseResidency.cpp | 2 +- .../vktSparseResourcesShaderIntrinsics.cpp | 2 +- .../vktSparseResourcesTestsUtil.hpp | 6 +++++ .../spirv_assembly/vktSpvAsmEmptyStructTests.cpp | 25 +++++++++++++++++++-- 13 files changed, 90 insertions(+), 18 deletions(-) diff --git a/external/openglcts/modules/gl/gl4cGPUShaderFP64Tests.cpp b/external/openglcts/modules/gl/gl4cGPUShaderFP64Tests.cpp index bebac24..aef62df 100644 --- a/external/openglcts/modules/gl/gl4cGPUShaderFP64Tests.cpp +++ b/external/openglcts/modules/gl/gl4cGPUShaderFP64Tests.cpp @@ -12379,32 +12379,45 @@ template static tcu::Matrix eliminate(const tcu::Matrix& matrix, glw::GLuint column, glw::GLuint row) { + // GCC sometimes diagnoses an incorrect out of bounds write here. The code has been verified to be correct. +#if (DE_COMPILER == DE_COMPILER_GCC) +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Warray-bounds" +#endif + + const glw::GLint eCol = static_cast(column); + const glw::GLint eRow = static_cast(row); + tcu::Matrix result; - for (glw::GLuint c = 0; c < Size; ++c) + for (glw::GLint c = 0; c < Size; ++c) { /* Skip eliminated column */ - if (column == c) + if (eCol == c) { continue; } - for (glw::GLuint r = 0; r < Size; ++r) + for (glw::GLint r = 0; r < Size; ++r) { /* Skip eliminated row */ - if (row == r) + if (eRow == r) { continue; } - const glw::GLint r_offset = (r > row) ? -1 : 0; - const glw::GLint c_offset = (c > column) ? -1 : 0; + const glw::GLint r_offset = (r > eRow) ? -1 : 0; + const glw::GLint c_offset = (c > eCol) ? -1 : 0; result(r + r_offset, c + c_offset) = matrix(r, c); } } return result; + +#if (DE_COMPILER == DE_COMPILER_GCC) +# pragma GCC diagnostic pop +#endif } template diff --git a/external/openglcts/modules/glesext/tessellation_shader/esextcTessellationShaderVertexSpacing.hpp b/external/openglcts/modules/glesext/tessellation_shader/esextcTessellationShaderVertexSpacing.hpp index 22eece2..1ea6fc8 100644 --- a/external/openglcts/modules/glesext/tessellation_shader/esextcTessellationShaderVertexSpacing.hpp +++ b/external/openglcts/modules/glesext/tessellation_shader/esextcTessellationShaderVertexSpacing.hpp @@ -279,7 +279,7 @@ private: /** Comparator that is used to compare two tessellation coordinates using FP value * equal operator. */ - struct _comparator_exact_tess_coordinate_match : public std::unary_function + struct _comparator_exact_tess_coordinate_match { /* Constructor. * diff --git a/external/vulkancts/modules/vulkan/compute/vktComputeWorkgroupMemoryExplicitLayoutTests.cpp b/external/vulkancts/modules/vulkan/compute/vktComputeWorkgroupMemoryExplicitLayoutTests.cpp index 0d117e8..c38c025 100644 --- a/external/vulkancts/modules/vulkan/compute/vktComputeWorkgroupMemoryExplicitLayoutTests.cpp +++ b/external/vulkancts/modules/vulkan/compute/vktComputeWorkgroupMemoryExplicitLayoutTests.cpp @@ -314,6 +314,30 @@ public: Synchronization sync; Requirements requirements; + CaseDef (const std::string& extraTypes_, + const std::string& writeDesc_, + const std::string& writeType_, + const std::string& writeValue_, + const std::string& readDesc_, + const std::string& readType_, + const std::string& readValue_, + LayoutFlags layout_, + Function func_, + Synchronization sync_, + Requirements requirements_) + : extraTypes (extraTypes_) + , writeDesc (writeDesc_) + , writeType (writeType_) + , writeValue (writeValue_) + , readDesc (readDesc_) + , readType (readType_) + , readValue (readValue_) + , layout (layout_) + , func (func_) + , sync (sync_) + , requirements (requirements_) + {} + std::string testName() const { std::string name = writeDesc + "_to_" + readDesc; @@ -565,7 +589,7 @@ void AddAliasTests(tcu::TestCaseGroup* group) #define CASE(L, R, D1, T1, V1, D2, T2, V2) CASE_EXTRA(L, R, "", D1, T1, V1, D2, T2, V2) - std::vector cases = + const std::vector cases { CASE_SAME_TYPE(0, "bool_true", "bool v", "true"), CASE_SAME_TYPE(0, "bool_false", "bool v", "false"), diff --git a/external/vulkancts/modules/vulkan/compute/vktComputeZeroInitializeWorkgroupMemoryTests.cpp b/external/vulkancts/modules/vulkan/compute/vktComputeZeroInitializeWorkgroupMemoryTests.cpp index 5cc0e51..4884bde 100644 --- a/external/vulkancts/modules/vulkan/compute/vktComputeZeroInitializeWorkgroupMemoryTests.cpp +++ b/external/vulkancts/modules/vulkan/compute/vktComputeZeroInitializeWorkgroupMemoryTests.cpp @@ -568,6 +568,14 @@ struct CompositeCaseDef std::string assignment; deUint32 elements; std::vector specValues; + + CompositeCaseDef (uint32_t index_, const std::string& typeDefinition_, const std::string& assignment_, uint32_t elements_, const std::vector& specValues_) + : index (index_) + , typeDefinition (typeDefinition_) + , assignment (assignment_) + , elements (elements_) + , specValues (specValues_) + {} }; class CompositeTestInstance : public vkt::TestInstance @@ -669,7 +677,7 @@ tcu::TestStatus CompositeTestInstance::iterate(void) void AddCompositeTests(tcu::TestCaseGroup* group) { - std::vector cases = + const std::vector cases { {0, "shared uint wg_mem[specId0] = {};\n", diff --git a/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesImageAlignedMipSize.cpp b/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesImageAlignedMipSize.cpp index b3ff118..8d45d0f 100644 --- a/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesImageAlignedMipSize.cpp +++ b/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesImageAlignedMipSize.cpp @@ -263,7 +263,7 @@ tcu::TestCaseGroup* createImageAlignedMipSizeTests (tcu::TestContext& testCtx) { de::MovePtr testGroup(new tcu::TestCaseGroup(testCtx, "aligned_mip_size", "Aligned mip size")); - const std::vector imageParameters = + const std::vector imageParameters { { IMAGE_TYPE_2D, { tcu::UVec3(512u, 256u, 1u) }, getTestFormats(IMAGE_TYPE_2D) }, { IMAGE_TYPE_2D_ARRAY, { tcu::UVec3(512u, 256u, 6u) }, getTestFormats(IMAGE_TYPE_2D_ARRAY) }, diff --git a/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesImageBlockShapes.cpp b/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesImageBlockShapes.cpp index a8a5eb8..400467b 100644 --- a/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesImageBlockShapes.cpp +++ b/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesImageBlockShapes.cpp @@ -449,7 +449,7 @@ tcu::TestCaseGroup* createImageBlockShapesTests (tcu::TestContext& testCtx) { de::MovePtr testGroup(new tcu::TestCaseGroup(testCtx, "image_block_shapes", "Standard block shape")); - const std::vector imageParameters = + const std::vector imageParameters { { IMAGE_TYPE_2D, { tcu::UVec3(512u, 256u, 1u) }, getTestFormats(IMAGE_TYPE_2D) }, { IMAGE_TYPE_2D_ARRAY, { tcu::UVec3(512u, 256u, 6u) }, getTestFormats(IMAGE_TYPE_2D_ARRAY) }, diff --git a/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesImageMemoryAliasing.cpp b/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesImageMemoryAliasing.cpp index a8ad9cb..f465a93 100755 --- a/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesImageMemoryAliasing.cpp +++ b/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesImageMemoryAliasing.cpp @@ -899,7 +899,7 @@ TestInstance* ImageSparseMemoryAliasingCase::createInstance (Context& context) c tcu::TestCaseGroup* createImageSparseMemoryAliasingTestsCommon(tcu::TestContext& testCtx, de::MovePtr testGroup, const bool useDeviceGroup = false) { - const std::vector imageParameters = + const std::vector imageParameters { { IMAGE_TYPE_2D, { tcu::UVec3(512u, 256u, 1u), tcu::UVec3(128u, 128u, 1u), tcu::UVec3(503u, 137u, 1u), tcu::UVec3(11u, 37u, 1u) }, getTestFormats(IMAGE_TYPE_2D) }, { IMAGE_TYPE_2D_ARRAY, { tcu::UVec3(512u, 256u, 6u), tcu::UVec3(128u, 128u, 8u), tcu::UVec3(503u, 137u, 3u), tcu::UVec3(11u, 37u, 3u) }, getTestFormats(IMAGE_TYPE_2D_ARRAY) }, diff --git a/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesImageSparseBinding.cpp b/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesImageSparseBinding.cpp index c80367f..8f0b596 100755 --- a/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesImageSparseBinding.cpp +++ b/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesImageSparseBinding.cpp @@ -479,7 +479,7 @@ TestInstance* ImageSparseBindingCase::createInstance (Context& context) const tcu::TestCaseGroup* createImageSparseBindingTestsCommon(tcu::TestContext& testCtx, de::MovePtr testGroup, const bool useDeviceGroup = false) { - const std::vector imageParameters = + const std::vector imageParameters { { IMAGE_TYPE_1D, { tcu::UVec3(512u, 1u, 1u ), tcu::UVec3(1024u, 1u, 1u), tcu::UVec3(11u, 1u, 1u) }, getTestFormats(IMAGE_TYPE_1D) }, { IMAGE_TYPE_1D_ARRAY, { tcu::UVec3(512u, 1u, 64u), tcu::UVec3(1024u, 1u, 8u), tcu::UVec3(11u, 1u, 3u) }, getTestFormats(IMAGE_TYPE_1D_ARRAY) }, diff --git a/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesImageSparseResidency.cpp b/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesImageSparseResidency.cpp index c292e58..b28891f 100755 --- a/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesImageSparseResidency.cpp +++ b/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesImageSparseResidency.cpp @@ -1020,7 +1020,7 @@ TestInstance* ImageSparseResidencyCase::createInstance (Context& context) const tcu::TestCaseGroup* createImageSparseResidencyTestsCommon (tcu::TestContext& testCtx, de::MovePtr testGroup, const bool useDeviceGroup = false) { - const std::vector imageParameters = + const std::vector imageParameters { { IMAGE_TYPE_2D, { tcu::UVec3(512u, 256u, 1u), tcu::UVec3(1024u, 128u, 1u), tcu::UVec3(11u, 137u, 1u) }, getTestFormats(IMAGE_TYPE_2D) }, { IMAGE_TYPE_2D_ARRAY, { tcu::UVec3(512u, 256u, 6u), tcu::UVec3(1024u, 128u, 8u), tcu::UVec3(11u, 137u, 3u) }, getTestFormats(IMAGE_TYPE_2D_ARRAY) }, diff --git a/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesMipmapSparseResidency.cpp b/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesMipmapSparseResidency.cpp index 5c02cc9..b3f3665 100755 --- a/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesMipmapSparseResidency.cpp +++ b/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesMipmapSparseResidency.cpp @@ -600,7 +600,7 @@ TestInstance* MipmapSparseResidencyCase::createInstance (Context& context) const tcu::TestCaseGroup* createMipmapSparseResidencyTestsCommon (tcu::TestContext& testCtx, de::MovePtr testGroup, const bool useDeviceGroup = false) { - const std::vector imageParameters = + const std::vector imageParameters { { IMAGE_TYPE_2D, { tcu::UVec3(512u, 256u, 1u), tcu::UVec3(1024u, 128u, 1u), tcu::UVec3(11u, 137u, 1u) }, getTestFormats(IMAGE_TYPE_2D) }, { IMAGE_TYPE_2D_ARRAY, { tcu::UVec3(512u, 256u, 6u), tcu::UVec3(1024u, 128u, 8u), tcu::UVec3(11u, 137u, 3u) }, getTestFormats(IMAGE_TYPE_2D_ARRAY) }, diff --git a/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesShaderIntrinsics.cpp b/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesShaderIntrinsics.cpp index 079464e..79f3e94 100644 --- a/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesShaderIntrinsics.cpp +++ b/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesShaderIntrinsics.cpp @@ -35,7 +35,7 @@ tcu::TestCaseGroup* createSparseResourcesShaderIntrinsicsTests (tcu::TestContext { de::MovePtr testGroup(new tcu::TestCaseGroup(testCtx, "shader_intrinsics", "Sparse Resources Shader Intrinsics")); - const std::vector imageParameters = + const std::vector imageParameters { { IMAGE_TYPE_2D, { tcu::UVec3(512u, 256u, 1u), tcu::UVec3(128u, 128u, 1u), tcu::UVec3(503u, 137u, 1u), tcu::UVec3(11u, 37u, 1u) }, getTestFormats(IMAGE_TYPE_2D) }, { IMAGE_TYPE_2D_ARRAY, { tcu::UVec3(512u, 256u, 6u), tcu::UVec3(128u, 128u, 8u), tcu::UVec3(503u, 137u, 3u), tcu::UVec3(11u, 37u, 3u) }, getTestFormats(IMAGE_TYPE_2D_ARRAY) }, diff --git a/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesTestsUtil.hpp b/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesTestsUtil.hpp index 9853162..ccb6ef1 100644 --- a/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesTestsUtil.hpp +++ b/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesTestsUtil.hpp @@ -80,6 +80,12 @@ struct TestImageParameters ImageType imageType; std::vector imageSizes; std::vector formats; + + TestImageParameters (ImageType imageType_, const std::vector& imageSizes_, const std::vector& formats_) + : imageType (imageType_) + , imageSizes (imageSizes_) + , formats (formats_) + {} }; bool formatIsR64 (const vk::VkFormat& format); diff --git a/external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsmEmptyStructTests.cpp b/external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsmEmptyStructTests.cpp index 4fc60c5..fd8f111 100644 --- a/external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsmEmptyStructTests.cpp +++ b/external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsmEmptyStructTests.cpp @@ -126,8 +126,24 @@ void addCopyingComputeGroup(tcu::TestCaseGroup* group) std::vector expectedOutput; std::string spirvVariables; std::string spirvCopyObject; + + BufferType (const std::string& name_, + VkDescriptorType descriptorType_, + const std::vector& offsets_, + const std::vector& input_, + const std::vector& expectedOutput_, + const std::string& spirvVariables_, + const std::string& spirvCopyObject_) + : name (name_) + , descriptorType (descriptorType_) + , offsets (offsets_) + , input (input_) + , expectedOutput (expectedOutput_) + , spirvVariables (spirvVariables_) + , spirvCopyObject (spirvCopyObject_) + {} }; - std::vector bufferTypes + const std::vector bufferTypes { { "ubo", @@ -163,8 +179,13 @@ void addCopyingComputeGroup(tcu::TestCaseGroup* group) { std::string name; std::string spirvCopyCode; + + CopyingMethod (const std::string& name_, const std::string& spirvCopyCode_) + : name (name_) + , spirvCopyCode (spirvCopyCode_) + {} }; - std::vector copyingMethods + const std::vector copyingMethods { { "copy_object", -- 2.7.4