sparklemotion icon indicating copy to clipboard operation
sparklemotion copied to clipboard

GLSL error: Use of undeclared identifier 'null'

Open xian opened this issue 3 years ago • 0 comments

2021-05-27 22:27:41.178 [Pinky Main] DEBUG PortDiagram - Resolved Track[main/color] to baaahs.show.live.LinkedShaderInstance@4d85a435.
2021-05-27 22:27:41.178 [Pinky Main] INFO  ModelRenderEngine - Compiling Brightness on PixelArrayDevice
2021-05-27 22:27:41.187 [Pinky Main] ERROR PatchResolver - Error preparing program
baaahs.gl.glsl.CompilationException: GLSL compilation error: ERROR: 0:8: Use of undeclared identifier 'null'

        at baaahs.gl.glsl.CompiledShader$validate$1.invoke(CompiledShader.kt:36)
        at baaahs.gl.glsl.CompiledShader$validate$1.invoke(CompiledShader.kt:9)
        at baaahs.gl.LwjglGlManager$LwjglGlContext.runInContext(LwjglGlManager.kt:36)
        at baaahs.gl.glsl.CompiledShader.validate(CompiledShader.kt:33)
        at baaahs.gl.GlContext$compile$1.invoke(GlContext.kt:65)
        at baaahs.gl.GlContext$compile$1.invoke(GlContext.kt:11)
        at baaahs.gl.LwjglGlManager$LwjglGlContext.runInContext(LwjglGlManager.kt:36)
        at baaahs.gl.GlContext.compile(GlContext.kt:53)
        at baaahs.gl.glsl.GlslProgramImpl.<init>(GlslProgram.kt:48)
        at baaahs.gl.render.RenderEngine.compile(RenderEngine.kt:26)
        at baaahs.gl.render.ModelRenderEngine.compile(ModelRenderEngine.kt:77)
        at baaahs.gl.render.RenderManager.compile(RenderManager.kt:37)
        at baaahs.gl.patch.PatchResolver.buildProgram(PatchResolver.kt:31)
        at baaahs.gl.patch.BasePatchResolver.createRenderPlan(PatchResolver.kt:89)
        at baaahs.show.live.ActivePatchSet.createRenderPlan(OpenShow.kt:136)
        at baaahs.fixtures.FixtureManager$maybeUpdateRenderPlans$elapsedMs$1.invoke(FixtureManager.kt:100)
        at baaahs.fixtures.FixtureManager$maybeUpdateRenderPlans$elapsedMs$1.invoke(FixtureManager.kt:11)
        at baaahs.UtilKt.timeSync(util.kt:72)
        at baaahs.UtilKt.timeSync(util.kt:69)
        at baaahs.fixtures.FixtureManager.maybeUpdateRenderPlans(FixtureManager.kt:99)
        at baaahs.ShowRunner.housekeeping(ShowRunner.kt:53)
        at baaahs.StageManager.onGadgetChange(StageManager.kt:117)
        at baaahs.StageManager$1.invoke(StageManager.kt:79)
        at baaahs.StageManager$1.invoke(StageManager.kt:59)
        at baaahs.ui.RemovableObserver.notifyChanged(Observable.kt:43)
        at baaahs.ui.Observable.notifyChanged(Observable.kt:24)
        at baaahs.GadgetManager$registerGadget$channel$1$1.invokeSuspend(StageManager.kt:44)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
        at java.base/java.lang.Thread.run(Thread.java:832)
2021-05-27 22:27:41.187 [Pinky Main] INFO  ShowRunner - #version 330 core
#ifdef GL_ES
precision mediump float;
#endif

// SparkleMotion-generated GLSL

layout(location = 0) out vec4 sm_result;

struct ModelInfo {
    vec3 center;
    vec3 extents;
};

// Data source: Brightness Slider
uniform float in_brightnessSlider;

// Data source: Conflagration Slider
uniform float in_conflagrationSlider;

// Data source: Fade Slider
uniform float in_fadeSlider;

// Data source: Model Info
uniform ModelInfo in_modelInfo;

// Data source: Pixel Location
uniform sampler2D ds_pixelLocation_texture;
vec3 ds_pixelLocation_getPixelCoords(vec2 rasterCoord) {
    return texelFetch(ds_pixelLocation_texture, ivec2(rasterCoord.xy), 0).xyz;
}
vec3 in_pixelLocation;

// Data source: Resolution
uniform vec2 in_resolution;

// Data source: Saturation Slider
uniform float in_saturationSlider;

// Data source: Size Slider
uniform float in_sizeSlider;

// Data source: Time
uniform float in_time;

// Shader: Flat Projection; namespace: p0
// Flat Projection

vec2 p0_flatProjectioni_result = vec2(0.);

#line 11
const float p0_flatProjection_PI = 3.141592654;

#line 15
vec2 p0_flatProjection_main(vec3 pixelLocation) {
    vec3 pixelOffset = (pixelLocation - in_modelInfo.center) / in_modelInfo.extents + .5;
    return vec2(1.-pixelOffset.x, pixelOffset.y);
    // vec3 normalDelta = normalize(pixelOffset);
    // float theta = atan(abs(normalDelta.z), normalDelta.x); // theta in range [-π,π]
    // if (theta < 0.0) theta += (2.0f * PI);                 // theta in range [0,2π)
    // float u = theta / (2.0f * PI);                         // u in range [0,1)
    // float v = (pixelOffset.y + modelInfo.extents.y / 2.0f) / modelInfo.extents.y;
    // return vec2(u, v);
}

// Shader: Fire Ball; namespace: p1
// Fire Ball

vec4 p1_fireBall_gl_FragColor = vec4(0., 0., 0., 1.);
vec2 p1_global_gl_FragCoord = vec2(0.);

#line 18
const float p1_fireBall_PI = 3.141592;

#line 22
vec2 p1_fireBall_hash( vec2 p ) 
{
    p = vec2( dot(p,vec2(127.1,311.7)), dot(p,vec2(269.5,183.3)) );
    return -1.0 + 2.0*fract(sin(p)*43758.5453123);
}

#line 28
float p1_fireBall_noise( in vec2 p )
{
    const float K1 = 0.366025404; // (sqrt(3)-1)/2;
    const float K2 = 0.211324865; // (3-sqrt(3))/6;

    vec2  i = floor( p + (p.x+p.y)*K1 );
    vec2  a = p - i + (i.x+i.y)*K2;
    float m = step(a.y,a.x);
    vec2  o = vec2(m,1.0-m);
    vec2  b = a - o + K2;
    vec2  c = a - 1.0 + 2.0*K2;
    vec3  h = max( 0.5-vec3(dot(a,a), dot(b,b), dot(c,c) ), 0.0 );
    vec3  n = h*h*h*h*vec3( dot(a,p1_fireBall_hash(i+0.0)), dot(b,p1_fireBall_hash(i+o)), dot(c,p1_fireBall_hash(i+1.0)));
    return dot( n, vec3(70.0) );
}

#line 44
float p1_fireBall_circleShape(vec2 coord, vec2 pos){
    float dist = distance(coord, pos);
    return clamp(   log(dist*(15.+in_conflagrationSlider+4.*p1_fireBall_noise(vec2(in_time*.8))))  ,0.,1.);
}

#line 49
vec2 p1_fireBall_sineWave(vec2 p){
    float Ax = .05;
    float wx = 1.50 * p1_fireBall_PI;
    float x = sin(wx * p.x) * Ax * sin(p1_fireBall_noise(vec2(in_time)));

    float Ay = .05;
    float wy = p1_fireBall_PI * 10.;
    float y = sin(wy*p.y) * Ay * p1_fireBall_noise(vec2(in_time));

    return vec2(p.x + x, p.y + y);
}

#line 61
void p1_fireBall_main( void ) {

    vec2 pos = p1_global_gl_FragCoord.xy / in_resolution.xy;
    pos.x += .2;
    vec2 uv = pos;

    uv += vec2(-.5, -.5);
    uv *= vec2(2.3, 1.3);

    float luz = clamp(1.05 - (pow(uv.x, 2.) + pow(uv.y * 1.6, 6.))*2., 0., 1.);
    //vec3 color = vec3(0.3059, 0.1922, 0.0431);
    vec3 color = vec3(0.7333, 0.2902, 0.0314);
    //vec3 color = vec3(0.3882, 0.1686, 0.251);
    float grad = p1_fireBall_circleShape(p1_fireBall_sineWave(pos), vec2(.5, .32));

    float ruido = 0.;

    pos *= 5.0;
    float xoff = 1.05;
    float yoff = 2.1;
    mat2 m = mat2( 1.6,  1.2, -1.2,  1.6 );
    ruido = 0.7500*p1_fireBall_noise(vec2(abs(pos.x-in_time*xoff), abs(pos.y-in_time*yoff))); pos = m*pos;
    ruido += 0.2500*p1_fireBall_noise(vec2(abs(pos.x-in_time*xoff), abs(pos.y-in_time*yoff))); pos = m*pos;
    ruido += 0.5000*p1_fireBall_noise(vec2(abs(pos.x-in_time*xoff), abs(pos.y-in_time*yoff))); pos = m*pos;
    ruido += 0.1250*p1_fireBall_noise(vec2(abs(pos.x-in_time*xoff), abs(pos.y-in_time*yoff))); pos = m*pos;


    ruido = 0.5 + 0.5*ruido;
    ruido = clamp(ruido, 0., 1.);

    /////////////////////////////////////////////////////////////
    pos = uv;
    pos *= 3.0;
    float ruido2 = 0.;
    xoff = 1.5;
    yoff = 1.5;
    m = mat2( -2.1,  .5, -.5,  2.1 );
    ruido2 = 0.2500*p1_fireBall_noise(vec2(abs(pos.x-in_time*xoff), abs(pos.y-in_time*yoff))); pos = m*pos;
    ruido2 += 0.5000*p1_fireBall_noise(vec2(abs(pos.x-in_time*xoff), abs(pos.y-in_time*yoff))); pos = m*pos;
    ruido2 += 0.1250*p1_fireBall_noise(vec2(abs(pos.x-in_time*xoff), abs(pos.y-in_time*yoff))); pos = m*pos;
    ruido2 += 0.0625*p1_fireBall_noise(vec2(abs(pos.x-in_time*xoff), abs(pos.y-in_time*yoff))); pos = m*pos;

    ruido2 = 0.5 + 0.5*ruido2;
    ruido2 = clamp(ruido2, 0., 1.);

    float f = 0.;
    f += 1.0 - ( (1.0-luz) / (ruido2 + 0.001) );
    f /= grad;
    f /= ruido;

    p1_fireBall_gl_FragColor = vec4(f*color*luz*(.5-.5*p1_fireBall_noise(vec2(in_time*.8))), 1.);
    //gl_FragColor = vec4(color/grad, 1.);

}

// Shader: Scale; namespace: p2
// Scale

vec2 p2_scalei_result = vec2(0.);

#line 5
vec2 p2_scale_main(vec2 uvIn) {
  return (uvIn - .5) / in_sizeSlider + .5;
}

// Shader: Slide Left; namespace: p3
// Slide Left

vec4 p3_slideLefti_result = vec4(0., 0., 0., 1.);

#line 3
vec4 p3_slideLeft_channelA(vec2 uv) {
    // Invoke Fire Ball
    p1_global_gl_FragCoord = uv;
    p1_fireBall_main();

    return p1_fireBall_gl_FragColor;
}

#line 7
vec4 p3_slideLeft_channelB(vec2 uv) {
    return null;
}

#line 12
vec4 p3_slideLeft_main() {
    if (1. - p2_scalei_result.x > in_fadeSlider) {
        return p3_slideLeft_channelA(p2_scalei_result + vec2(in_fadeSlider, 0));
    } else {
        return p3_slideLeft_channelB(p2_scalei_result + vec2(in_fadeSlider - 1., 0));
    }
}

// Shader: Saturation; namespace: p4
// Saturation

vec4 p4_saturationi_result = vec4(0., 0., 0., 1.);

#line 4
vec3 p4_saturation_rgb2hsv(vec3 c)
{
    vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
    vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));
    vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));

    float d = q.x - min(q.w, q.y);
    float e = 1.0e-10;
    return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);
}

#line 17
vec3 p4_saturation_hsv2rgb(vec3 c)
{
    vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
    vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
    return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
}

#line 26
vec4 p4_saturation_main(vec4 inColor) {
    if (in_saturationSlider == 1.) return inColor;

    vec4 clampedColor = clamp(inColor, 0., 1.);
    vec3 hsv = p4_saturation_rgb2hsv(clampedColor.rgb);
    hsv.y *= in_saturationSlider;
    return vec4(p4_saturation_hsv2rgb(hsv), clampedColor.a);
}

// Shader: Brightness; namespace: p5
// Brightness

vec4 p5_brightnessi_result = vec4(0., 0., 0., 1.);

#line 5
vec4 p5_brightness_main(vec4 inColor) {
    vec4 clampedColor = clamp(inColor, 0., 1.);
    return vec4(clampedColor.rgb * in_brightnessSlider, clampedColor.a);
}


#line 10001
void main() {
    // Invoke Pixel Location
    in_pixelLocation = ds_pixelLocation_getPixelCoords(gl_FragCoord.xy);

    // Invoke Flat Projection
    p0_flatProjectioni_result = p0_flatProjection_main(in_pixelLocation);

    // Invoke Scale
    p2_scalei_result = p2_scale_main(p0_flatProjectioni_result);

    // Invoke Slide Left
    p3_slideLefti_result = p3_slideLeft_main();

    // Invoke Saturation
    p4_saturationi_result = p4_saturation_main(p3_slideLefti_result);

    // Invoke Brightness
    p5_brightnessi_result = p5_brightness_main(p4_saturationi_result);

    sm_result = p5_brightnessi_result;
}

2021-05-27 22:27:41.189 [Pinky Main] DEBUG ShowOpener - Opening show error 2021-05-27 22:27:41.190 [Pinky Main] DEBUG PortDiagram - Resolved Track[main/color] to baaahs.show.live.LinkedShaderInstance@48ca906a.

xian avatar Jun 01 '21 20:06 xian