summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorassiduous <assiduous@diligentgraphics.com>2020-11-08 20:19:20 +0000
committerassiduous <assiduous@diligentgraphics.com>2020-11-08 20:19:20 +0000
commit37a3d0771d015bfc64bd9bd6ef87e294cf5a3a59 (patch)
tree4d357b72cc1cfe6daccef2340a9cee4cc499685c
parentBroken shader test: added broken GLSL (diff)
downloadDiligentCore-37a3d0771d015bfc64bd9bd6ef87e294cf5a3a59.tar.gz
DiligentCore-37a3d0771d015bfc64bd9bd6ef87e294cf5a3a59.zip
Broken shader test: added broken MSL; added SHADER_SOURCE_LANGUAGE_MSL
-rw-r--r--Graphics/GraphicsEngine/interface/Shader.h3
-rw-r--r--Tests/DiligentCoreAPITest/src/BrokenShaderTest.cpp30
2 files changed, 33 insertions, 0 deletions
diff --git a/Graphics/GraphicsEngine/interface/Shader.h b/Graphics/GraphicsEngine/interface/Shader.h
index dce77a82..bb4acc84 100644
--- a/Graphics/GraphicsEngine/interface/Shader.h
+++ b/Graphics/GraphicsEngine/interface/Shader.h
@@ -71,6 +71,9 @@ DILIGENT_TYPED_ENUM(SHADER_SOURCE_LANGUAGE, Uint32)
/// The source language is GLSL
SHADER_SOURCE_LANGUAGE_GLSL,
+ /// The source language is Metal shading language (MSL)
+ SHADER_SOURCE_LANGUAGE_MSL,
+
/// The source language is GLSL that should be compiled verbatim
/// By default the engine prepends GLSL shader source code with platform-specific
diff --git a/Tests/DiligentCoreAPITest/src/BrokenShaderTest.cpp b/Tests/DiligentCoreAPITest/src/BrokenShaderTest.cpp
index 2320f1c3..d69eb9c2 100644
--- a/Tests/DiligentCoreAPITest/src/BrokenShaderTest.cpp
+++ b/Tests/DiligentCoreAPITest/src/BrokenShaderTest.cpp
@@ -49,6 +49,25 @@ void VSMain()
}
)";
+static const char g_BrokenMSL[] = R"(
+#include <metal_stdlib>
+#include <simd/simd.h>
+
+using namespace metal;
+
+struct VSOut
+{
+ float4 pos [[position]];
+};
+
+vertex VSOut vs_main()
+{
+ VSOut out = {};
+ out.pos = float3(0.0, 0.0, 0.0);
+ return out;
+}
+)";
+
void TestBrokenShader(const char* Source, const char* Name, SHADER_SOURCE_LANGUAGE SourceLanguage, int ErrorAllowance)
{
auto* pEnv = TestingEnvironment::GetInstance();
@@ -98,4 +117,15 @@ TEST(Shader, BrokenGLSL)
deviceCaps.IsGLDevice() ? 2 : 3);
}
+TEST(Shader, BrokenMSL)
+{
+ const auto& deviceCaps = TestingEnvironment::GetInstance()->GetDevice()->GetDeviceCaps();
+ if (!deviceCaps.IsMetalDevice())
+ {
+ GTEST_SKIP() << "MSL is only supported in Metal";
+ }
+
+ TestBrokenShader(g_BrokenMSL, "Broken MSL test", SHADER_SOURCE_LANGUAGE_MSL, 2);
+}
+
} // namespace