Correct support conditions for float16s
authorGraeme Leese <gleese@broadcom.com>
Mon, 10 Dec 2018 14:31:51 +0000 (14:31 +0000)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Fri, 11 Jan 2019 14:28:13 +0000 (09:28 -0500)
My previous fix missed out the graphics versions of these tests, so add
the correct conditions under which these tests can be supported as well.

Components: Vulkan
VK-GL-CTS issue: 1499
Affects:
dEQP-VK.spirv_assembly.instruction.compute.float16.opconstantcomposite.*
dEQP-VK.spirv_assembly.instruction.graphics.opspecconstantop.fconvert16_*
dEQP-VK.spirv_assembly.instruction.graphics.float16.opconstant.*

Change-Id: I7ac48027b4160bd82484e7d8d780d8a1870babbf
(cherry picked from commit f2ed80c3d2f8b4f2e782f71cc3755fe06ab52b33)

external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsmInstructionTests.cpp

index f9ef994..5e58fe5 100644 (file)
@@ -5980,7 +5980,12 @@ tcu::TestCaseGroup* createFloat16OpConstantCompositeGroup (tcu::TestContext& tes
                spec.inputs.push_back(BufferSp(new Float32Buffer(positiveFloats)));
                spec.outputs.push_back(BufferSp(new Float32Buffer(negativeFloats)));
                spec.numWorkGroups = IVec3(numElements, 1, 1);
+
                spec.extensions.push_back("VK_KHR_16bit_storage");
+               spec.extensions.push_back("VK_KHR_shader_float16_int8");
+
+               spec.requestedVulkanFeatures.ext16BitStorage = EXT16BITSTORAGEFEATURES_UNIFORM_BUFFER_BLOCK;
+               spec.requestedVulkanFeatures.extFloat16Int8 = EXTFLOAT16INT8FEATURES_FLOAT16;
 
                group->addChild(new SpvAsmComputeShaderCase(testCtx, cases[caseNdx].name, cases[caseNdx].name, spec));
        }
@@ -7097,7 +7102,7 @@ tcu::TestCaseGroup* createSpecConstantTests (tcu::TestContext& testCtx)
                PushConstants                           noPushConstants;
                GraphicsResources                       noResources;
                GraphicsInterfaces                      noInterfaces;
-               std::vector<std::string>        noExtensions;
+               vector<string>                          extensions;
                VulkanFeatures                          requiredFeatures;
 
                // Special SPIR-V code for SConvert-case
@@ -7121,6 +7126,8 @@ tcu::TestCaseGroup* createSpecConstantTests (tcu::TestContext& testCtx)
                // Special SPIR-V code for FConvert-case for 16-bit floats
                if (strcmp(cases[caseNdx].caseName, "fconvert16") == 0)
                {
+                       extensions.push_back("VK_KHR_shader_float16_int8");
+                       requiredFeatures.extFloat16Int8 = EXTFLOAT16INT8FEATURES_FLOAT16;
                        fragments["capability"]                                 = "OpCapability Float16\n";                                     // Adds 16-bit float capability
                        specializations["OPTYPE_DEFINITIONS"]   = "%f16 = OpTypeFloat 16\n";                            // Adds 16-bit float type
                        specializations["TYPE_CONVERT"]                 = "%sc_op32 = OpConvertFToS %i32 %sc_op\n";     // Converts 16-bit float to 32-bit integer
@@ -7141,7 +7148,7 @@ tcu::TestCaseGroup* createSpecConstantTests (tcu::TestContext& testCtx)
 
                createTestsForAllStages(
                        cases[caseNdx].caseName, inputColors, cases[caseNdx].expectedColors, fragments, specConstants,
-                       noPushConstants, noResources, noInterfaces, noExtensions, requiredFeatures, group.get());
+                       noPushConstants, noResources, noInterfaces, extensions, requiredFeatures, group.get());
        }
 
        const char      decorations2[]                  =
@@ -9823,6 +9830,7 @@ tcu::TestCaseGroup* createOpConstantFloat16Tests(tcu::TestContext& testCtx)
 
        extensions.push_back("VK_KHR_16bit_storage");
        extensions.push_back("VK_KHR_shader_float16_int8");
+       features.extFloat16Int8 = EXTFLOAT16INT8FEATURES_FLOAT16;
 
        for (size_t testNdx = 0; testNdx < sizeof(tests) / sizeof(NameConstantsCode); ++testNdx)
        {