Commit 2d0cc786 by John Kessenich

SPV: Turn on atomic-storage functionality for SPIR-V.

This is used by OpenGL, but not Vulkan. Includes: - atomicCounter, atomicIncrement, atomicCounterDecrement - atomic_uint layout-offset checking - AtomicStorage capability
parent 5e69ec68
......@@ -1832,7 +1832,7 @@ spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& ty
spvType = builder.makeUintType(64);
break;
case glslang::EbtAtomicUint:
logger->tbdFunctionality("Is atomic_uint an opaque handle in the uniform storage class, or an addresses in the atomic storage class?");
builder.addCapability(spv::CapabilityAtomicStorage);
spvType = builder.makeUintType(32);
break;
case glslang::EbtSampler:
......
#version 310 es
#version 450
......@@ -22,6 +22,7 @@ void main()
func(counter);
uint val = atomicCounter(countArr[2]);
atomicCounterDecrement(counter);
atomicCounterIncrement(counter);
}
shared int atomi;
......
......@@ -1259,7 +1259,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
}
if (spvVersion.vulkan == 0) {
// gl_spirv TODO
//
// Atomic counter functions.
//
......
......@@ -186,7 +186,6 @@ INSTANTIATE_TEST_CASE_P(
"whileLoop.frag",
"nonVulkan.frag",
"negativeArraySize.comp",
"spv.atomic.comp",
"precise.tesc",
"precise_struct_block.vert",
"maxClipDistances.vert",
......
......@@ -41,19 +41,29 @@
namespace glslangtest {
namespace {
using CompileToSpirvTest = GlslangTest<::testing::TestWithParam<std::string>>;
using CompileVulkanToSpirvTest = GlslangTest<::testing::TestWithParam<std::string>>;
using CompileOpenGLToSpirvTest = GlslangTest<::testing::TestWithParam<std::string>>;
using VulkanSemantics = GlslangTest<::testing::TestWithParam<std::string>>;
using VulkanAstSemantics = GlslangTest<::testing::TestWithParam<std::string>>;
// Compiling GLSL to SPIR-V under Vulkan semantics. Expected to successfully
// generate SPIR-V.
TEST_P(CompileToSpirvTest, FromFile)
TEST_P(CompileVulkanToSpirvTest, FromFile)
{
loadFileCompileAndCheck(GLSLANG_TEST_DIRECTORY, GetParam(),
Source::GLSL, Semantics::Vulkan,
Target::Spv);
}
// Compiling GLSL to SPIR-V under OpenGL semantics. Expected to successfully
// generate SPIR-V.
TEST_P(CompileOpenGLToSpirvTest, FromFile)
{
loadFileCompileAndCheck(GLSLANG_TEST_DIRECTORY, GetParam(),
Source::GLSL, Semantics::OpenGL,
Target::Spv);
}
// GLSL-level Vulkan semantics test. Expected to error out before generating
// SPIR-V.
TEST_P(VulkanSemantics, FromFile)
......@@ -73,7 +83,7 @@ TEST_P(VulkanAstSemantics, FromFile)
// clang-format off
INSTANTIATE_TEST_CASE_P(
Glsl, CompileToSpirvTest,
Glsl, CompileVulkanToSpirvTest,
::testing::ValuesIn(std::vector<std::string>({
// Test looping constructs.
// No tests yet for making sure break and continue from a nested loop
......@@ -192,6 +202,18 @@ INSTANTIATE_TEST_CASE_P(
FileNameAsCustomTestSuffix
);
// clang-format off
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",
})),
FileNameAsCustomTestSuffix
);
INSTANTIATE_TEST_CASE_P(
Glsl, VulkanSemantics,
::testing::ValuesIn(std::vector<std::string>({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment