varjo icon indicating copy to clipboard operation
varjo copied to clipboard

struct declaration missing when struct used as ubo arg has struct slot but not used in body

Open cbaggers opened this issue 7 years ago • 0 comments

No type ref so it's stripped, however it causes an error.

Error compiling fragment-shader: 
0(17) : error C0000: syntax error, unexpected '[', expecting "::" at token "["


// fragment-stage
#version 450

in _FROM_GEOMETRY_STAGE_
{
     in vec2 _GEOMETRY_STAGE_OUT_0;
} v_in;

layout(location = 0)  out vec4 _FRAGMENT_STAGE_OUT_0;

uniform sampler2D MSDF;
uniform float PX_RANGE;
uniform vec4 BG_COLOR;
uniform vec4 FG_COLOR;
layout(std140) uniform _UBO_ATLAS
{
    BITMAP_GLYPH[500] GLYPHS;
} ATLAS;

float MEDIAN(float R, float G, float B);

float MEDIAN(float R, float G, float B)
{
    return max(min(R,G),min(max(R,G),B));
}

void main()
{
    vec2 POS = vec2(v_in._GEOMETRY_STAGE_OUT_0.x,(float(1) - v_in._GEOMETRY_STAGE_OUT_0.y));
    vec3 SAM = texture(MSDF,POS).xyz;
    ivec2 SIZE4 = textureSize(MSDF,0);
    vec2 MSDF_UNIT = (PX_RANGE / vec2(float(SIZE4.x),float(SIZE4.y)));
    float SIG_DIST = (MEDIAN(SAM.x,SAM.y,SAM.z) - 0.5f);
    SIG_DIST *= dot(MSDF_UNIT,(0.5f / fwidth(POS)));
    float OPACITY = clamp((SIG_DIST + 0.5f),0.0f,1.0f);
    vec4 g_GEXPR0_4913 = mix(BG_COLOR,FG_COLOR,OPACITY);
    _FRAGMENT_STAGE_OUT_0 = g_GEXPR0_4913;
    return;
}
   [Condition of type SIMPLE-ERROR]

cbaggers avatar Apr 21 '18 23:04 cbaggers