SPV: Further refine OpenGL vs. Vulkan differences for SPIR-V.

Includes adding test cases to verify the differences.
This commit is contained in:
John Kessenich
2016-07-07 17:46:42 -06:00
parent 2d0cc786f3
commit 91e4aa5900
23 changed files with 305 additions and 27 deletions

View File

@@ -44,6 +44,7 @@ namespace {
using CompileVulkanToSpirvTest = GlslangTest<::testing::TestWithParam<std::string>>;
using CompileOpenGLToSpirvTest = GlslangTest<::testing::TestWithParam<std::string>>;
using VulkanSemantics = GlslangTest<::testing::TestWithParam<std::string>>;
using OpenGLSemantics = GlslangTest<::testing::TestWithParam<std::string>>;
using VulkanAstSemantics = GlslangTest<::testing::TestWithParam<std::string>>;
// Compiling GLSL to SPIR-V under Vulkan semantics. Expected to successfully
@@ -73,6 +74,15 @@ TEST_P(VulkanSemantics, FromFile)
Target::Spv);
}
// GLSL-level Vulkan semantics test. Expected to error out before generating
// SPIR-V.
TEST_P(OpenGLSemantics, FromFile)
{
loadFileCompileAndCheck(GLSLANG_TEST_DIRECTORY, GetParam(),
Source::GLSL, Semantics::OpenGL,
Target::Spv);
}
// GLSL-level Vulkan semantics test that need to see the AST for validation.
TEST_P(VulkanAstSemantics, FromFile)
{
@@ -206,10 +216,9 @@ INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_CASE_P(
Glsl, CompileOpenGLToSpirvTest,
::testing::ValuesIn(std::vector<std::string>({
// Test looping constructs.
// No tests yet for making sure break and continue from a nested loop
// goes to the innermost target.
"spv.atomic.comp",
"spv.glFragColor.frag",
"spv.specConst.vert",
})),
FileNameAsCustomTestSuffix
);
@@ -224,6 +233,18 @@ INSTANTIATE_TEST_CASE_P(
FileNameAsCustomTestSuffix
);
INSTANTIATE_TEST_CASE_P(
Glsl, OpenGLSemantics,
::testing::ValuesIn(std::vector<std::string>({
"glspv.esversion.vert",
"glspv.version.frag",
"glspv.version.vert",
"glspv.frag",
"glspv.vert",
})),
FileNameAsCustomTestSuffix
);
INSTANTIATE_TEST_CASE_P(
Glsl, VulkanAstSemantics,
::testing::ValuesIn(std::vector<std::string>({