[Fix] (MG_Test/Program): fix CompileSimpleFragmentShader

This commit is contained in:
2025-07-20 21:07:31 +08:00
parent ad041d6dab
commit bff7711e2c
+31
View File
@@ -46,3 +46,34 @@ TEST_F(ProgramTest, CompileSimpleVertexShader) {
FAIL() << "errc: " << res.error().errc << "\nlog: " << res.error().log;
}
}
const char* fs = R"(#version 150
uniform sampler2D DiffuseSampler;
uniform vec4 ColorModulator;
in vec2 texCoord;
in vec4 vertexColor;
out vec4 fragColor;
void main() {
vec4 color = texture(DiffuseSampler, texCoord) * vertexColor;
// blit final output of compositor into displayed back buffer
fragColor = color * ColorModulator;
})";
TEST_F(ProgramTest, CompileSimpleFragmentShader) {
using namespace MG_Util::ShaderTranspiler;
ShaderAttrib attrib {
.shaderType = GL_FRAGMENT_SHADER,
.sourceStr = fs
};
auto res = ShaderCompiler::CompileShader(attrib);
if (!res) {
ASSERT_NE(res.error().errc, 0);
FAIL() << "errc: " << res.error().errc << "\nlog: " << res.error().log;
}
}