mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-12 06:08:30 +09:00
[Fix] (MG_Test/Program): fix CompileSimpleFragmentShader
This commit is contained in:
@@ -46,3 +46,34 @@ TEST_F(ProgramTest, CompileSimpleVertexShader) {
|
|||||||
FAIL() << "errc: " << res.error().errc << "\nlog: " << res.error().log;
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user