From 6e5ef4c51158771e71f72c70980b4dbd78f011f2 Mon Sep 17 00:00:00 2001 From: Pyry Haulos Date: Thu, 12 May 2016 14:00:59 -0700 Subject: [PATCH] Fix warnings in tessellation and spec constant tests --- .../vulkan/pipeline/vktPipelineSpecConstantTests.cpp | 14 ++++++++------ .../vulkan/tessellation/vktTessellationCommonEdgeTests.cpp | 8 ++++---- .../tessellation/vktTessellationCoordinatesTests.cpp | 10 +++++++--- .../vulkan/tessellation/vktTessellationInvarianceTests.cpp | 6 +++--- .../vulkan/tessellation/vktTessellationMiscDrawTests.cpp | 2 +- .../tessellation/vktTessellationShaderInputOutputTests.cpp | 6 +++--- .../vulkan/tessellation/vktTessellationUserDefinedIO.cpp | 8 ++++---- .../vulkan/tessellation/vktTessellationWindingTests.cpp | 2 +- 8 files changed, 31 insertions(+), 25 deletions(-) diff --git a/external/vulkancts/modules/vulkan/pipeline/vktPipelineSpecConstantTests.cpp b/external/vulkancts/modules/vulkan/pipeline/vktPipelineSpecConstantTests.cpp index d36f9b7..12ca3b8 100644 --- a/external/vulkancts/modules/vulkan/pipeline/vktPipelineSpecConstantTests.cpp +++ b/external/vulkancts/modules/vulkan/pipeline/vktPipelineSpecConstantTests.cpp @@ -73,9 +73,9 @@ private: inline GenericValue makeValueBool32 (const bool a) { return GenericValue(&a, sizeof(a)); } inline GenericValue makeValueInt32 (const deInt32 a) { return GenericValue(&a, sizeof(a)); } -inline GenericValue makeValueInt64 (const deInt64 a) { return GenericValue(&a, sizeof(a)); } +// \note deInt64 not tested inline GenericValue makeValueUint32 (const deUint32 a) { return GenericValue(&a, sizeof(a)); } -inline GenericValue makeValueUint64 (const deUint64 a) { return GenericValue(&a, sizeof(a)); } +// \note deUint64 not tested inline GenericValue makeValueFloat32 (const float a) { return GenericValue(&a, sizeof(a)); } inline GenericValue makeValueFloat64 (const double a) { return GenericValue(&a, sizeof(a)); } @@ -204,7 +204,7 @@ Specialization::Specialization (const std::vector& specConstants) { m_data.push_back(it->specValue); m_entries.push_back(makeSpecializationMapEntry(it->specID, offset, it->size)); - offset += sizeof(GenericValue); + offset += (deUint32)sizeof(GenericValue); } if (m_entries.size() > 0) @@ -689,10 +689,12 @@ FeatureFlags getShaderStageRequirements (const VkShaderStageFlags stageFlags) // All tests use SSBO writes to read back results. if ((stageFlags & VK_SHADER_STAGE_ALL_GRAPHICS) != 0) + { if ((stageFlags & VK_SHADER_STAGE_FRAGMENT_BIT) != 0) features |= FEATURE_FRAGMENT_STORES_AND_ATOMICS; else features |= FEATURE_VERTEX_PIPELINE_STORES_AND_ATOMICS; + } return features; } @@ -1462,7 +1464,7 @@ CaseDefinition makeMatrixVectorCompositeCaseDefinition (const glu::DataType type globalCode.str(), generateShaderChecksumComputationCode(scalarType, varName, accumType, size1, size2, numCombinations), computeExpectedValues(specValue, scalarType, numCombinations), - (scalarType == glu::TYPE_DOUBLE ? FEATURE_SHADER_FLOAT_64 : (FeatureFlags)0), + (scalarType == glu::TYPE_DOUBLE ? (FeatureFlags)FEATURE_SHADER_FLOAT_64 : (FeatureFlags)0), }; return def; } @@ -1505,7 +1507,7 @@ CaseDefinition makeArrayCompositeCaseDefinition (const glu::DataType elemType, c globalCode.str(), generateShaderChecksumComputationCode(elemType, varName, accumType, size1, size2, numCombinations), computeExpectedValues(specValue, scalarType, numCombinations), - (scalarType == glu::TYPE_DOUBLE ? FEATURE_SHADER_FLOAT_64 : (FeatureFlags)0), + (scalarType == glu::TYPE_DOUBLE ? (FeatureFlags)FEATURE_SHADER_FLOAT_64 : (FeatureFlags)0), }; return def; } @@ -1560,7 +1562,7 @@ CaseDefinition makeStructCompositeCaseDefinition (const glu::DataType memberType globalCode.str(), mainCode.str(), makeVector(OffsetValue(getDataTypeScalarSizeBytes(memberType), 0, makeValue(scalarType, checksum))), - (scalarType == glu::TYPE_DOUBLE ? FEATURE_SHADER_FLOAT_64 : (FeatureFlags)0), + (scalarType == glu::TYPE_DOUBLE ? (FeatureFlags)FEATURE_SHADER_FLOAT_64 : (FeatureFlags)0), }; return def; } diff --git a/external/vulkancts/modules/vulkan/tessellation/vktTessellationCommonEdgeTests.cpp b/external/vulkancts/modules/vulkan/tessellation/vktTessellationCommonEdgeTests.cpp index db0b2d4..a2bfc8f 100644 --- a/external/vulkancts/modules/vulkan/tessellation/vktTessellationCommonEdgeTests.cpp +++ b/external/vulkancts/modules/vulkan/tessellation/vktTessellationCommonEdgeTests.cpp @@ -71,10 +71,10 @@ struct CaseDefinition //! Returns true if an image successfully passess the verification. bool verifyResult (tcu::TestLog& log, const tcu::ConstPixelBufferAccess image) { - const int startX = static_cast(0.15f * image.getWidth()); - const int endX = static_cast(0.85f * image.getWidth()); - const int startY = static_cast(0.15f * image.getHeight()); - const int endY = static_cast(0.85f * image.getHeight()); + const int startX = static_cast(0.15f * (float)image.getWidth()); + const int endX = static_cast(0.85f * (float)image.getWidth()); + const int startY = static_cast(0.15f * (float)image.getHeight()); + const int endY = static_cast(0.85f * (float)image.getHeight()); for (int y = startY; y < endY; ++y) for (int x = startX; x < endX; ++x) diff --git a/external/vulkancts/modules/vulkan/tessellation/vktTessellationCoordinatesTests.cpp b/external/vulkancts/modules/vulkan/tessellation/vktTessellationCoordinatesTests.cpp index 67ce58e..944b9a8 100644 --- a/external/vulkancts/modules/vulkan/tessellation/vktTessellationCoordinatesTests.cpp +++ b/external/vulkancts/modules/vulkan/tessellation/vktTessellationCoordinatesTests.cpp @@ -235,7 +235,11 @@ void drawTessCoordPoint (tcu::Surface& dst, const TessPrimitiveType primitiveTyp : tcu::Vec2(-1.0f); - drawPoint(dst, static_cast(dstPos.x() * dst.getWidth()), static_cast(dstPos.y() * dst.getHeight()), color, size); + drawPoint(dst, + static_cast(dstPos.x() * (float)dst.getWidth()), + static_cast(dstPos.y() * (float)dst.getHeight()), + color, + size); } void drawTessCoordVisualization (tcu::Surface& dst, const TessPrimitiveType primitiveType, const std::vector& coords) @@ -485,7 +489,7 @@ tcu::TestStatus TessCoordTestInstance::iterate (void) for (deUint32 i = 0; i < tessLevelCases.size(); ++i) allReferenceTessCoords[i] = generateReferenceTessCoords(m_primitiveType, m_spacingMode, &tessLevelCases[i].inner[0], &tessLevelCases[i].outer[0]); - const int maxNumVertices = static_cast(std::max_element(allReferenceTessCoords.begin(), allReferenceTessCoords.end(), SizeLessThan >())->size()); + const size_t maxNumVertices = static_cast(std::max_element(allReferenceTessCoords.begin(), allReferenceTessCoords.end(), SizeLessThan >())->size()); // Input buffer: tessellation levels. Data is filled in later. @@ -494,7 +498,7 @@ tcu::TestStatus TessCoordTestInstance::iterate (void) // Output buffer: number of invocations + padding + tessellation coordinates. Initialized later. - const int resultBufferTessCoordsOffset = 4 * sizeof(deInt32); + const int resultBufferTessCoordsOffset = 4 * (int)sizeof(deInt32); const int extraneousVertices = 16; // allow some room for extraneous vertices from duplicate shader invocations (number is arbitrary) const VkDeviceSize resultBufferSizeBytes = resultBufferTessCoordsOffset + (maxNumVertices + extraneousVertices)*sizeof(tcu::Vec4); const Buffer resultBuffer (vk, device, allocator, makeBufferCreateInfo(resultBufferSizeBytes, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT), MemoryRequirement::HostVisible); diff --git a/external/vulkancts/modules/vulkan/tessellation/vktTessellationInvarianceTests.cpp b/external/vulkancts/modules/vulkan/tessellation/vktTessellationInvarianceTests.cpp index 3c84792..3bf0506 100644 --- a/external/vulkancts/modules/vulkan/tessellation/vktTessellationInvarianceTests.cpp +++ b/external/vulkancts/modules/vulkan/tessellation/vktTessellationInvarianceTests.cpp @@ -592,7 +592,7 @@ BaseTestInstance::BaseTestInstance (Context& context, const CaseDefinition caseD , m_vertexDataSizeBytes (NUM_TESS_LEVELS * m_numPatchesToDraw * m_vertexStride) , m_vertexBuffer (m_context.getDeviceInterface(), m_context.getDevice(), m_context.getDefaultAllocator(), makeBufferCreateInfo(m_vertexDataSizeBytes, VK_BUFFER_USAGE_VERTEX_BUFFER_BIT), MemoryRequirement::HostVisible) - , m_resultBufferPrimitiveDataOffset (sizeof(deInt32) * 4) + , m_resultBufferPrimitiveDataOffset ((int)sizeof(deInt32) * 4) , m_resultBufferSizeBytes (m_resultBufferPrimitiveDataOffset + m_maxNumPrimitivesInDrawCall * sizeof(PerPrimitive)) , m_resultBuffer (m_context.getDeviceInterface(), m_context.getDevice(), m_context.getDefaultAllocator(), makeBufferCreateInfo(m_resultBufferSizeBytes, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT), MemoryRequirement::HostVisible) @@ -1360,7 +1360,7 @@ tcu::TestStatus InvarianceTestInstance::iterate (void) // Output buffer: number of primitives and an array of PerPrimitive structures const int resultBufferMaxVertices = numPatchesPerDrawCall * maxNumPrimitivesPerPatch * numVerticesPerPrimitive(m_caseDef.primitiveType, m_caseDef.usePointMode); - const int resultBufferTessCoordsOffset = sizeof(deInt32) * 4; + const int resultBufferTessCoordsOffset = (int)sizeof(deInt32) * 4; const VkDeviceSize resultBufferSizeBytes = resultBufferTessCoordsOffset + resultBufferMaxVertices * sizeof(PerPrimitive); const Buffer resultBuffer (vk, device, allocator, makeBufferCreateInfo(resultBufferSizeBytes, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT), MemoryRequirement::HostVisible); @@ -2009,7 +2009,7 @@ tcu::TestStatus test (Context& context, const CaseDefinition caseDef) // Output buffer: number of invocations and array of tess coords - const int resultBufferTessCoordsOffset = sizeof(deInt32) * 4; + const int resultBufferTessCoordsOffset = (int)sizeof(deInt32) * 4; const VkDeviceSize resultBufferSizeBytes = resultBufferTessCoordsOffset + maxNumVerticesInDrawCall * sizeof(tcu::Vec4); const Buffer resultBuffer (vk, device, allocator, makeBufferCreateInfo(resultBufferSizeBytes, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT), MemoryRequirement::HostVisible); diff --git a/external/vulkancts/modules/vulkan/tessellation/vktTessellationMiscDrawTests.cpp b/external/vulkancts/modules/vulkan/tessellation/vktTessellationMiscDrawTests.cpp index a713122..5aa95d4 100644 --- a/external/vulkancts/modules/vulkan/tessellation/vktTessellationMiscDrawTests.cpp +++ b/external/vulkancts/modules/vulkan/tessellation/vktTessellationMiscDrawTests.cpp @@ -238,7 +238,7 @@ tcu::TestStatus runTest (Context& context, const CaseDefinition caseDef) { // State is slightly different on the first iteration. const VkImageLayout currentLayout = (tessLevelCaseNdx == 0 ? VK_IMAGE_LAYOUT_UNDEFINED : VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL); - const VkAccessFlags srcFlags = (tessLevelCaseNdx == 0 ? (VkAccessFlags)0 : VK_ACCESS_TRANSFER_READ_BIT); + const VkAccessFlags srcFlags = (tessLevelCaseNdx == 0 ? (VkAccessFlags)0 : (VkAccessFlags)VK_ACCESS_TRANSFER_READ_BIT); const VkImageMemoryBarrier colorAttachmentLayoutBarrier = makeImageMemoryBarrier( srcFlags, VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT, diff --git a/external/vulkancts/modules/vulkan/tessellation/vktTessellationShaderInputOutputTests.cpp b/external/vulkancts/modules/vulkan/tessellation/vktTessellationShaderInputOutputTests.cpp index 50c1cb1..2ada455 100644 --- a/external/vulkancts/modules/vulkan/tessellation/vktTessellationShaderInputOutputTests.cpp +++ b/external/vulkancts/modules/vulkan/tessellation/vktTessellationShaderInputOutputTests.cpp @@ -305,7 +305,7 @@ tcu::TestStatus test (Context& context, const CaseDefinition caseDef) vertexData.reserve(caseDef.inPatchSize); for (int i = 0; i < caseDef.inPatchSize; ++i) { - const float f = static_cast(i) / (caseDef.inPatchSize - 1); + const float f = static_cast(i) / static_cast(caseDef.inPatchSize - 1); vertexData.push_back(f*f); } const VkDeviceSize vertexBufferSize = sizeof(float) * vertexData.size(); @@ -411,7 +411,7 @@ void initPrograms (vk::SourceCollections& programCollection, const CaseDefinitio // Tessellation evaluation shader { - const float xScale = 1.0f / getNumPrimitives(caseDef.caseType); + const float xScale = 1.0f / static_cast(getNumPrimitives(caseDef.caseType)); std::ostringstream src; src << glu::getGLSLVersionDeclaration(glu::GLSL_VERSION_310_ES) << "\n" @@ -488,7 +488,7 @@ tcu::TestStatus test (Context& context, const CaseDefinition caseDef) const VkDeviceSize vertexBufferSize = sizeof(float) * vertexData.size(); for (int i = 0; i < numPrimitives; ++i) - vertexData[INPUT_PATCH_SIZE * i] = static_cast(i) / numPrimitives; + vertexData[INPUT_PATCH_SIZE * i] = static_cast(i) / static_cast(numPrimitives); tcu::TextureLevel referenceImage; if (caseDef.usesReferenceImageFromFile) diff --git a/external/vulkancts/modules/vulkan/tessellation/vktTessellationUserDefinedIO.cpp b/external/vulkancts/modules/vulkan/tessellation/vktTessellationUserDefinedIO.cpp index adfcf44..5a053ea 100644 --- a/external/vulkancts/modules/vulkan/tessellation/vktTessellationUserDefinedIO.cpp +++ b/external/vulkancts/modules/vulkan/tessellation/vktTessellationUserDefinedIO.cpp @@ -161,7 +161,7 @@ std::string glslAssignBasicTypeObject (const std::string& name, const glu::DataT if (type != glu::TYPE_FLOAT) result << std::string() << glu::getDataTypeName(type) << "("; for (int i = 0; i < scalarSize; ++i) - result << (i > 0 ? ", v+" + de::floatToString(0.8f*i, 1) : "v"); + result << (i > 0 ? ", v+" + de::floatToString(0.8f*(float)i, 1) : "v"); if (type != glu::TYPE_FLOAT) result << ")"; result << ";\n" @@ -181,7 +181,7 @@ std::string glslCheckBasicTypeObject (const std::string& name, const glu::DataTy if (type != glu::TYPE_FLOAT) result << std::string() << glu::getDataTypeName(type) << "("; for (int i = 0; i < scalarSize; ++i) - result << (i > 0 ? ", v+" + de::floatToString(0.8f*i, 1) : "v"); + result << (i > 0 ? ", v+" + de::floatToString(0.8f*(float)i, 1) : "v"); if (type != glu::TYPE_FLOAT) result << ")"; result << ");\n" @@ -562,7 +562,7 @@ UserDefinedIOTest::UserDefinedIOTest (tcu::TestContext& testCtx, const std::stri tcsNextOutputLocation += output.numBasicSubobjectsInElementType(); if (!isPerPatchIO) - tcsStatements << "\t\tv += float(gl_InvocationID)*" << de::floatToString(0.4f * output.numBasicSubobjectsInElementType(), 1) << ";\n"; + tcsStatements << "\t\tv += float(gl_InvocationID)*" << de::floatToString(0.4f * (float)output.numBasicSubobjectsInElementType(), 1) << ";\n"; tcsStatements << "\n\t\t// Assign values to output " << output.name() << "\n"; if (isArray) @@ -571,7 +571,7 @@ UserDefinedIOTest::UserDefinedIOTest (tcu::TestContext& testCtx, const std::stri tcsStatements << output.glslTraverseBasicType(2, glslAssignBasicTypeObject); if (!isPerPatchIO) - tcsStatements << "\t\tv += float(" << de::toString(NUM_OUTPUT_VERTICES) << "-gl_InvocationID-1)*" << de::floatToString(0.4f * output.numBasicSubobjectsInElementType(), 1) << ";\n"; + tcsStatements << "\t\tv += float(" << de::toString(NUM_OUTPUT_VERTICES) << "-gl_InvocationID-1)*" << de::floatToString(0.4f * (float)output.numBasicSubobjectsInElementType(), 1) << ";\n"; } tcsStatements << "\t}\n"; diff --git a/external/vulkancts/modules/vulkan/tessellation/vktTessellationWindingTests.cpp b/external/vulkancts/modules/vulkan/tessellation/vktTessellationWindingTests.cpp index 883c0c3..d61bc07 100644 --- a/external/vulkancts/modules/vulkan/tessellation/vktTessellationWindingTests.cpp +++ b/external/vulkancts/modules/vulkan/tessellation/vktTessellationWindingTests.cpp @@ -337,7 +337,7 @@ tcu::TestStatus WindingTestInstance::iterate (void) { // State is slightly different on the first iteration. const VkImageLayout currentLayout = (caseNdx == 0 ? VK_IMAGE_LAYOUT_UNDEFINED : VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL); - const VkAccessFlags srcFlags = (caseNdx == 0 ? (VkAccessFlags)0 : VK_ACCESS_TRANSFER_READ_BIT); + const VkAccessFlags srcFlags = (caseNdx == 0 ? (VkAccessFlags)0 : (VkAccessFlags)VK_ACCESS_TRANSFER_READ_BIT); const VkImageMemoryBarrier colorAttachmentLayoutBarrier = makeImageMemoryBarrier( srcFlags, VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT, -- 2.7.4