return createProgramBinaryFromSpirV(binary);
}
-void disassembleProgram (const ProgramBinary& program, std::ostream* dst, SpirvVersion spirvVersion)
+void disassembleProgram (const ProgramBinary& program, std::ostream* dst)
{
if (program.getFormat() == PROGRAM_FORMAT_SPIRV)
{
TCU_CHECK_INTERNAL(isSaneSpirVBinary(program));
if (isNativeSpirVBinaryEndianness())
- disassembleSpirV(program.getSize()/sizeof(deUint32), (const deUint32*)program.getBinary(), dst, spirvVersion);
+ disassembleSpirV(program.getSize()/sizeof(deUint32), (const deUint32*)program.getBinary(), dst,
+ extractSpirvVersion(program));
else
TCU_THROW(InternalError, "SPIR-V endianness translation not supported");
}
TCU_THROW(NotSupportedError, "Unsupported program format");
}
-bool validateProgram (const ProgramBinary& program, std::ostream* dst, SpirvVersion spirvVersion)
+bool validateProgram (const ProgramBinary& program, std::ostream* dst)
{
if (program.getFormat() == PROGRAM_FORMAT_SPIRV)
{
}
if (isNativeSpirVBinaryEndianness())
- return validateSpirV(program.getSize()/sizeof(deUint32), (const deUint32*)program.getBinary(), dst, spirvVersion);
+ return validateSpirV(program.getSize()/sizeof(deUint32), (const deUint32*)program.getBinary(), dst,
+ extractSpirvVersion(program));
else
TCU_THROW(InternalError, "SPIR-V endianness translation not supported");
}
return de::getSizedArrayElement<glu::SHADERTYPE_LAST>(s_shaderStages, shaderType);
}
-vk::SpirvVersion getSpirvVersionForAsm (const deUint32 vulkanVersion)
+// Baseline version, to be used for shaders which don't specify a version
+vk::SpirvVersion getBaselineSpirvVersion (const deUint32 /* vulkanVersion */)
+{
+ return vk::SPIRV_VERSION_1_0;
+}
+
+// Max supported versions for each vulkan version
+vk::SpirvVersion getMaxSpirvVersionForAsm (const deUint32 vulkanVersion)
{
vk::SpirvVersion result = vk::SPIRV_VERSION_LAST;
return result;
}
-vk::SpirvVersion getSpirvVersionForGlsl (const deUint32 vulkanVersion)
+vk::SpirvVersion getMaxSpirvVersionForGlsl (const deUint32 vulkanVersion)
{
vk::SpirvVersion result = vk::SPIRV_VERSION_LAST;
ProgramBinary* buildProgram (const GlslSource& program, glu::ShaderProgramInfo* buildInfo);
ProgramBinary* buildProgram (const HlslSource& program, glu::ShaderProgramInfo* buildInfo);
ProgramBinary* assembleProgram (const vk::SpirVAsmSource& program, SpirVProgramInfo* buildInfo);
-void disassembleProgram (const ProgramBinary& program, std::ostream* dst, SpirvVersion spirvVersion);
-bool validateProgram (const ProgramBinary& program, std::ostream* dst, SpirvVersion spirvVersion);
+void disassembleProgram (const ProgramBinary& program, std::ostream* dst);
+bool validateProgram (const ProgramBinary& program, std::ostream* dst);
Move<VkShaderModule> createShaderModule (const DeviceInterface& deviceInterface, VkDevice device, const ProgramBinary& binary, VkShaderModuleCreateFlags flags);
glu::ShaderType getGluShaderType (VkShaderStageFlagBits shaderStage);
VkShaderStageFlagBits getVkShaderStage (glu::ShaderType shaderType);
-vk::SpirvVersion getSpirvVersionForAsm (const deUint32 vulkanVersion);
-vk::SpirvVersion getSpirvVersionForGlsl (const deUint32 vulkanVersion);
-SpirvVersion extractSpirvVersion (const ProgramBinary& binary);
-std::string getSpirvVersionName (const SpirvVersion spirvVersion);
-SpirvVersion& operator++ (SpirvVersion& spirvVersion);
+vk::SpirvVersion getMaxSpirvVersionForAsm (const deUint32 vulkanVersion);
+vk::SpirvVersion getMaxSpirvVersionForGlsl (const deUint32 vulkanVersion);
+vk::SpirvVersion getBaselineSpirvVersion (const deUint32 vulkanVersion);
+SpirvVersion extractSpirvVersion (const ProgramBinary& binary);
+std::string getSpirvVersionName (const SpirvVersion spirvVersion);
+SpirvVersion& operator++ (SpirvVersion& spirvVersion);
} // vk
void validateVulkanVersion (const deUint32 usedVulkanVersion, const SpirvVersion testedSpirvVersion)
{
- const SpirvVersion usedSpirvVersionForAsm = getSpirvVersionForAsm(usedVulkanVersion);
+ const SpirvVersion usedSpirvVersionForAsm = getMaxSpirvVersionForAsm(usedVulkanVersion);
if (testedSpirvVersion > usedSpirvVersionForAsm)
TCU_THROW(NotSupportedError, "Specified SPIR-V version is not supported by the device/instance");
DE_ASSERT(m_program->binary->getFormat() == vk::PROGRAM_FORMAT_SPIRV);
std::ostringstream validationLog;
- const vk::ProgramBinary& programBinary = *(m_program->binary);
- const vk::SpirvVersion spirvVersion = vk::extractSpirvVersion(programBinary);
- if (vk::validateProgram(*m_program->binary, &validationLog, spirvVersion))
+ if (vk::validateProgram(*m_program->binary, &validationLog))
m_program->validationStatus = Program::STATUS_PASSED;
else
m_program->validationStatus = Program::STATUS_FAILED;
const std::string& dstPath,
const bool validateBinaries,
const deUint32 usedVulkanVersion,
- const vk::SpirvVersion spirvVersionForGlsl,
- const vk::SpirvVersion spirvVersionForAsm)
+ const vk::SpirvVersion baselineSpirvVersion,
+ const vk::SpirvVersion maxSpirvVersion)
{
const deUint32 numThreads = deGetNumAvailableLogicalCores();
{
const TestCase* const testCase = dynamic_cast<TestCase*>(iterator.getNode());
const string casePath = iterator.getNodePath();
- vk::ShaderBuildOptions defaultGlslBuildOptions (spirvVersionForGlsl, 0u);
- vk::ShaderBuildOptions defaultHlslBuildOptions (spirvVersionForGlsl, 0u);
- vk::SpirVAsmBuildOptions defaultSpirvAsmBuildOptions (spirvVersionForAsm);
+ vk::ShaderBuildOptions defaultGlslBuildOptions (baselineSpirvVersion, 0u);
+ vk::ShaderBuildOptions defaultHlslBuildOptions (baselineSpirvVersion, 0u);
+ vk::SpirVAsmBuildOptions defaultSpirvAsmBuildOptions (baselineSpirvVersion);
vk::SourceCollections sourcePrograms (usedVulkanVersion, defaultGlslBuildOptions, defaultHlslBuildOptions, defaultSpirvAsmBuildOptions);
try
++progIter)
{
// Source program requires higher SPIR-V version than available: skip it to avoid fail
- if (progIter.getProgram().buildOptions.targetVersion > spirvVersionForGlsl)
+ if (progIter.getProgram().buildOptions.targetVersion > maxSpirvVersion)
continue;
programs.pushBack(Program(vk::ProgramIdentifier(casePath, progIter.getName()), progIter.getProgram().buildOptions.targetVersion));
++progIter)
{
// Source program requires higher SPIR-V version than available: skip it to avoid fail
- if (progIter.getProgram().buildOptions.targetVersion > spirvVersionForGlsl)
+ if (progIter.getProgram().buildOptions.targetVersion > maxSpirvVersion)
continue;
programs.pushBack(Program(vk::ProgramIdentifier(casePath, progIter.getName()), progIter.getProgram().buildOptions.targetVersion));
++progIter)
{
// Source program requires higher SPIR-V version than available: skip it to avoid fail
- if (progIter.getProgram().buildOptions.targetVersion > spirvVersionForAsm)
+ if (progIter.getProgram().buildOptions.targetVersion > maxSpirvVersion)
continue;
programs.pushBack(Program(vk::ProgramIdentifier(casePath, progIter.getName()), progIter.getProgram().buildOptions.targetVersion));
try
{
- tcu::DirArchive archive (".");
- tcu::TestLog log (deqpCmdLine.getLogFileName(), deqpCmdLine.getLogFlags());
+ tcu::DirArchive archive (".");
+ tcu::TestLog log (deqpCmdLine.getLogFileName(), deqpCmdLine.getLogFlags());
tcu::Platform platform;
- tcu::TestContext testCtx (platform, archive, log, deqpCmdLine, DE_NULL);
- vk::SpirvVersion spirvVersionForGlsl = vk::getSpirvVersionForGlsl(cmdLine.getOption<opt::VulkanVersion>());
- vk::SpirvVersion spirvVersionForAsm = vk::getSpirvVersionForAsm(cmdLine.getOption<opt::VulkanVersion>());
+ tcu::TestContext testCtx (platform, archive, log, deqpCmdLine, DE_NULL);
+ vk::SpirvVersion baselineSpirvVersion = vk::getBaselineSpirvVersion(cmdLine.getOption<opt::VulkanVersion>());
+ vk::SpirvVersion maxSpirvVersion = vk::getMaxSpirvVersionForGlsl(cmdLine.getOption<opt::VulkanVersion>());
- tcu::print("SPIR-V versions: for GLSL sources: %s, for SPIR-V asm sources: %s\n",
- getSpirvVersionName(spirvVersionForGlsl).c_str(),
- getSpirvVersionName(spirvVersionForAsm).c_str());
+ tcu::print("SPIR-V versions: baseline: %s, max supported: %s\n",
+ getSpirvVersionName(baselineSpirvVersion).c_str(),
+ getSpirvVersionName(maxSpirvVersion).c_str());
const vkt::BuildStats stats = vkt::buildPrograms(testCtx,
cmdLine.getOption<opt::DstPath>(),
cmdLine.getOption<opt::Validate>(),
cmdLine.getOption<opt::VulkanVersion>(),
- spirvVersionForGlsl,
- spirvVersionForAsm);
+ baselineSpirvVersion,
+ maxSpirvVersion);
tcu::print("DONE: %d passed, %d failed, %d not supported\n", stats.numSucceeded, stats.numFailed, stats.notSupported);
const TestCase* vktCase = dynamic_cast<TestCase*>(testCase);
tcu::TestLog& log = m_context.getTestContext().getLog();
const deUint32 usedVulkanVersion = m_context.getUsedApiVersion();
- const vk::SpirvVersion spirvVersionForGlsl = vk::getSpirvVersionForGlsl(usedVulkanVersion);
- const vk::SpirvVersion spirvVersionForAsm = vk::getSpirvVersionForAsm(usedVulkanVersion);
- vk::ShaderBuildOptions defaultGlslBuildOptions (spirvVersionForGlsl, 0u);
- vk::ShaderBuildOptions defaultHlslBuildOptions (spirvVersionForGlsl, 0u);
- vk::SpirVAsmBuildOptions defaultSpirvAsmBuildOptions (spirvVersionForAsm);
+ const vk::SpirvVersion baselineSpirvVersion = vk::getBaselineSpirvVersion(usedVulkanVersion);
+ vk::ShaderBuildOptions defaultGlslBuildOptions (baselineSpirvVersion, 0u);
+ vk::ShaderBuildOptions defaultHlslBuildOptions (baselineSpirvVersion, 0u);
+ vk::SpirVAsmBuildOptions defaultSpirvAsmBuildOptions (baselineSpirvVersion);
vk::SourceCollections sourceProgs (usedVulkanVersion, defaultGlslBuildOptions, defaultHlslBuildOptions, defaultSpirvAsmBuildOptions);
DE_UNREF(casePath); // \todo [2015-03-13 pyry] Use this to identify ProgramCollection storage path
for (vk::GlslSourceCollection::Iterator progIter = sourceProgs.glslSources.begin(); progIter != sourceProgs.glslSources.end(); ++progIter)
{
- if (progIter.getProgram().buildOptions.targetVersion > vk::getSpirvVersionForGlsl(m_context.getUsedApiVersion()))
+ if (progIter.getProgram().buildOptions.targetVersion > vk::getMaxSpirvVersionForGlsl(m_context.getUsedApiVersion()))
TCU_THROW(NotSupportedError, "Shader requires SPIR-V higher than available");
const vk::ProgramBinary* const binProg = buildProgram<glu::ShaderProgramInfo, vk::GlslSourceCollection::Iterator>(casePath, progIter, m_prebuiltBinRegistry, log, &m_progCollection);
{
std::ostringstream disasm;
- vk::disassembleProgram(*binProg, &disasm, spirvVersionForGlsl);
+ vk::disassembleProgram(*binProg, &disasm);
log << vk::SpirVAsmSource(disasm.str());
}
for (vk::HlslSourceCollection::Iterator progIter = sourceProgs.hlslSources.begin(); progIter != sourceProgs.hlslSources.end(); ++progIter)
{
- if (progIter.getProgram().buildOptions.targetVersion > vk::getSpirvVersionForGlsl(m_context.getUsedApiVersion()))
+ if (progIter.getProgram().buildOptions.targetVersion > vk::getMaxSpirvVersionForGlsl(m_context.getUsedApiVersion()))
TCU_THROW(NotSupportedError, "Shader requires SPIR-V higher than available");
const vk::ProgramBinary* const binProg = buildProgram<glu::ShaderProgramInfo, vk::HlslSourceCollection::Iterator>(casePath, progIter, m_prebuiltBinRegistry, log, &m_progCollection);
{
std::ostringstream disasm;
- vk::disassembleProgram(*binProg, &disasm, spirvVersionForGlsl);
+ vk::disassembleProgram(*binProg, &disasm);
log << vk::SpirVAsmSource(disasm.str());
}
for (vk::SpirVAsmCollection::Iterator asmIterator = sourceProgs.spirvAsmSources.begin(); asmIterator != sourceProgs.spirvAsmSources.end(); ++asmIterator)
{
- if (asmIterator.getProgram().buildOptions.targetVersion > vk::getSpirvVersionForAsm(m_context.getUsedApiVersion()))
+ if (asmIterator.getProgram().buildOptions.targetVersion > vk::getMaxSpirvVersionForAsm(m_context.getUsedApiVersion()))
TCU_THROW(NotSupportedError, "Shader requires SPIR-V higher than available");
buildProgram<vk::SpirVProgramInfo, vk::SpirVAsmCollection::Iterator>(casePath, asmIterator, m_prebuiltBinRegistry, log, &m_progCollection);