From 818373725fc3b3f0a856e2c258c35a1ed2b3a2fc Mon Sep 17 00:00:00 2001 From: assiduous Date: Wed, 18 Nov 2020 20:06:47 -0800 Subject: Broken Shader Test: added shader macros --- Tests/DiligentCoreAPITest/src/BrokenShaderTest.cpp | 29 ++++++++++++---------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/Tests/DiligentCoreAPITest/src/BrokenShaderTest.cpp b/Tests/DiligentCoreAPITest/src/BrokenShaderTest.cpp index d69eb9c2..6e112b5b 100644 --- a/Tests/DiligentCoreAPITest/src/BrokenShaderTest.cpp +++ b/Tests/DiligentCoreAPITest/src/BrokenShaderTest.cpp @@ -60,7 +60,7 @@ struct VSOut float4 pos [[position]]; }; -vertex VSOut vs_main() +vertex VSOut VSMain() { VSOut out = {}; out.pos = float3(0.0, 0.0, 0.0); @@ -75,23 +75,26 @@ void TestBrokenShader(const char* Source, const char* Name, SHADER_SOURCE_LANGUA TestingEnvironment::ScopedReset EnvironmentAutoReset; - ShaderCreateInfo Attrs; - Attrs.Source = Source; - Attrs.EntryPoint = "VSMain"; - Attrs.Desc.ShaderType = SHADER_TYPE_VERTEX; - Attrs.Desc.Name = Name; - Attrs.SourceLanguage = SourceLanguage; - Attrs.ShaderCompiler = pEnv->GetDefaultCompiler(Attrs.SourceLanguage); - Attrs.UseCombinedTextureSamplers = true; + ShaderCreateInfo ShaderCI; + ShaderCI.Source = Source; + ShaderCI.EntryPoint = "VSMain"; + ShaderCI.Desc.ShaderType = SHADER_TYPE_VERTEX; + ShaderCI.Desc.Name = Name; + ShaderCI.SourceLanguage = SourceLanguage; + ShaderCI.ShaderCompiler = pEnv->GetDefaultCompiler(ShaderCI.SourceLanguage); + ShaderCI.UseCombinedTextureSamplers = true; - IDataBlob* pErrors = nullptr; - Attrs.ppCompilerOutput = &pErrors; + ShaderMacro Macros[] = {{"TEST", "MACRO"}, {}}; + ShaderCI.Macros = Macros; + + IDataBlob* pErrors = nullptr; + ShaderCI.ppCompilerOutput = &pErrors; pEnv->SetErrorAllowance(ErrorAllowance, "\n\nNo worries, testing broken shader...\n\n"); RefCntAutoPtr pBrokenShader; - pDevice->CreateShader(Attrs, &pBrokenShader); + pDevice->CreateShader(ShaderCI, &pBrokenShader); EXPECT_FALSE(pBrokenShader); - EXPECT_TRUE(pErrors); + ASSERT_NE(pErrors, nullptr); const char* Msg = reinterpret_cast(pErrors->GetDataPtr()); LOG_INFO_MESSAGE("Compiler output:\n", Msg); pErrors->Release(); -- cgit v1.2.3