From: Gabor Abraham Date: Thu, 28 Apr 2016 14:12:11 +0000 (+0200) Subject: Refactor the code, extract the assembly type declaration. X-Git-Tag: upstream/0.1.0~840^2~3^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a53fab65b7142da1f240e34680d5d8c5f945b839;p=platform%2Fupstream%2FVK-GL-CTS.git Refactor the code, extract the assembly type declaration. --- diff --git a/external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsmInstructionTests.cpp b/external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsmInstructionTests.cpp index a6dc11a4d..5712d69b9 100644 --- a/external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsmInstructionTests.cpp +++ b/external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsmInstructionTests.cpp @@ -8252,21 +8252,22 @@ void createCompositeCases (vector >& testCases, de::Random& } } -const string specializeCompositeShaderTemplate (const NumberType type, const map& params) +const string getAssemblyTypeDeclaration (const NumberType type) { - map parameters(params); - - string typeAssembly; - switch (type) { - case TYPE_INT: typeAssembly = "OpTypeInt 32 1"; break; - case TYPE_UINT: typeAssembly = "OpTypeInt 32 0"; break; - case TYPE_FLOAT: typeAssembly = "OpTypeFloat 32"; break; - default: DE_ASSERT(false); + case TYPE_INT: return "OpTypeInt 32 1"; + case TYPE_UINT: return "OpTypeInt 32 0"; + case TYPE_FLOAT: return "OpTypeFloat 32"; + default: DE_ASSERT(false); return ""; } +} + +const string specializeCompositeInsertShaderTemplate (const NumberType type, const map& params) +{ + map parameters(params); - parameters["typeDeclaration"] = typeAssembly; + parameters["typeDeclaration"] = getAssemblyTypeDeclaration(type); return StringTemplate ( "OpCapability Shader\n" @@ -8363,7 +8364,7 @@ tcu::TestCaseGroup* createOpCompositeInsertGroup (tcu::TestContext& testCtx) { ComputeShaderSpec spec; - spec.assembly = specializeCompositeShaderTemplate(numberType, *test); + spec.assembly = specializeCompositeInsertShaderTemplate(numberType, *test); switch (numberType) {