rm attachmentCount shader flag;

It doesn't work as intended (due to glslang issues?).  The current way
to write a shader that uses multiple attachments is to declare multiple
output variables, which is a little better because you can name them
however you want and customize the type.

It would be nice to be able to support a "void" entrypoint for multiple
attachments so you don't need to awkwardly return the first target's
color, but I can't find a way around this right now.
This commit is contained in:
bjorn 2023-02-05 16:04:17 -08:00
parent b76d9bbfe5
commit 7027defe3c
1 changed files with 6 additions and 7 deletions

View File

@ -1,6 +1,5 @@
// Flags
layout(constant_id = 1000) const float flag_pointSize = 1.f;
layout(constant_id = 1001) const uint flag_attachmentCount = 1;
layout(constant_id = 1002) const bool flag_passColor = true;
layout(constant_id = 1003) const bool flag_materialColor = true;
layout(constant_id = 1004) const bool flag_vertexColors = true;
@ -72,7 +71,7 @@ layout(location = 14) in vec3 VertexTangent;
// Framebuffer
#ifdef GL_FRAGMENT_SHADER
layout(location = 0) out vec4 PixelColor[flag_attachmentCount];
layout(location = 0) out vec4 PixelColor;
#endif
// Varyings
@ -390,21 +389,21 @@ void main() {
#ifdef GL_FRAGMENT_SHADER
vec4 lovrmain();
void main() {
PixelColor[0] = lovrmain();
PixelColor = lovrmain();
if (flag_glow) {
if (flag_glowTexture) {
PixelColor[0].rgb += getPixel(GlowTexture, UV).rgb * Material.glow.rgb * Material.glow.a;
PixelColor.rgb += getPixel(GlowTexture, UV).rgb * Material.glow.rgb * Material.glow.a;
} else {
PixelColor[0].rgb += Material.glow.rgb * Material.glow.a;
PixelColor.rgb += Material.glow.rgb * Material.glow.a;
}
}
if (flag_tonemap) {
PixelColor[0].rgb = tonemap(PixelColor[0].rgb);
PixelColor.rgb = tonemap(PixelColor.rgb);
}
if (flag_alphaCutoff && PixelColor[0].a <= Material.alphaCutoff) {
if (flag_alphaCutoff && PixelColor.a <= Material.alphaCutoff) {
discard;
}
}