0
votes

I am writing a program that takes heavy use of compute-shaders in OpenGL (in Java using JOGL) which runs fine on my desktop computer but won't link the shaders on my laptop.

I currently have a desktop system, running Ubuntu 18.04LTS with a GTX 1060, where it runs without issue, however when running on my laptop, running Ubuntu 18.04LTS, GTX 1650, the shader does not link properly and prints "error: linking with uncompiled/unspecialized shader" in the shader program log.

I have considered it could be driver issues and tried switching to the proprietary nVidia drivers' with no luck. Both platforms are running the same Open-jdk 8.

Note: graphical shaders work as intended, it is only occurring when trying to link a compute-shader, even when using the same method for reading source in, so I'm sure there's no problem there.

The problem occurs when linking the shader to a program:

        int computeShader = gl.glCreateShader(GL4.GL_COMPUTE_SHADER); //Create compute shader
        gl.glShaderSource(computeShader, computeShaderSrc.length, computeShaderSrc, null);
        gl.glCompileShader(computeShader);

        int shaderProg = gl.glCreateProgram(); //Create shader program and attach compute shader

        printProgramLog(shaderProg);
        System.out.println("Created shader\n");

        System.out.println("Attaching shader");
        gl.glAttachShader(shaderProg, computeShader);
        printProgramLog(shaderProg);
        System.out.println("Attached shader\n");

        System.out.println("Linking shader");
        gl.glLinkProgram(shaderProg);
        printProgramLog(shaderProg);
        System.out.println("Linked Shader\n");

        gl.glDeleteShader(computeShader);

This outputs:

Created shader

Attaching shader
Attached shader

Linking shader
Program Info Log: 
error: linking with uncompiled/unspecialized shader
Linked Shader
1
Error is most likely occuring when you compile, not when you link. The program log won't show compilation errors. For that you need the Shader Info log. Also, it's best to explicitly check whether compilation/linking worked with glGetShaderiv(shader, GL_COMPILE_STATUS, &flag) glGetProgramiv(program, GL_LINK_STATUS, &flag) - Hugh Fisher
@HughFisher This was correct, checking the shader info log pointed to some variable init issues which have now resolved the problem. Do you know why it might have had an issue on one device but still compiled fine on another computer? - Bash09
@Bash09 Give us a SSCCE if you want some help. - gouessej

1 Answers

0
votes

Refer to comments, issue in shader compilation which was inconsistent between devices.