Error linking with uncompiled unspecialized shader

need create shaders by myself? void StateSet::setGlobalDefaults() ShaderPipeline enabled, numTextUnits = 4 void StateSet::setGlobalDefaults() ShaderPipeline enabled, numTextUnits = 4 VERTEX glCompi...

need create shaders by myself?

void StateSet::setGlobalDefaults() ShaderPipeline enabled, numTextUnits = 4
void StateSet::setGlobalDefaults() ShaderPipeline enabled, numTextUnits = 4
VERTEX glCompileShader «» FAILED
VERTEX Shader «» infolog:
0:1(9): preprocessor error: Macro names starting with «GL_» are reserved.

0:2(9): preprocessor error: Macro names starting with «GL_» are reserved.

0:3(9): preprocessor error: Macro names starting with «GL_» are reserved.

FRAGMENT glCompileShader «» FAILED
FRAGMENT Shader «» infolog:
0:1(9): preprocessor error: Macro names starting with «GL_» are reserved.

0:2(9): preprocessor error: Macro names starting with «GL_» are reserved.

0:3(9): preprocessor error: Macro names starting with «GL_» are reserved.

glLinkProgram 0x7f6fcc04c600″» FAILED
Program «» infolog:
error: linking with uncompiled/unspecialized shadererror: linking with uncompiled/unspecialized shader

I use a demo to produce a test.osg file, then use osgviewer to open it.

ubuntu 18.4
osg(master)

here is the code.

`#include <osg/ref_ptr>
#include <osgDB/Registry>
#include <osgDB/WriteFile>
#include <osg/Notify>
#include <osg/Geode>
#include <osg/Geometry>

#include

int main()
{
osg::ref_ptrosg::Geometry geometry_ptr{new osg::Geometry};
osg::ref_ptrosg::Vec3Array vertex_data_ptr{new osg::Vec3Array};

vertex_data_ptr->push_back(osg::Vec3(-1.f, 0.f, -1.f));
vertex_data_ptr->push_back(osg::Vec3(1.f, 0.f, -1.f));
vertex_data_ptr->push_back(osg::Vec3(1.f, 0.f, 1.f));
vertex_data_ptr->push_back(osg::Vec3(-1.f, 0.f, 1.f));

osg::ref_ptr<osg::Vec4Array> color_array{new osg::Vec4Array};
geometry_ptr->setColorArray(color_array.get());
geometry_ptr->setColorBinding(osg::Geometry::BIND_PER_VERTEX);
color_array->push_back(osg::Vec4(1.f, 0.f, 0.f, 1.f));
color_array->push_back(osg::Vec4(0.f, 1.f, 0.f, 1.f));
color_array->push_back(osg::Vec4(0.f, 0.f, 1.f, 1.f));
color_array->push_back(osg::Vec4(1.f, 1.f, 1.f, 1.f));

osg::ref_ptr<osg::Vec3Array> normal_array{new osg::Vec3Array};
geometry_ptr->setNormalArray(normal_array.get());
normal_array->push_back(osg::Vec3{0, 1, 0});

geometry_ptr->addPrimitiveSet(new osg::DrawArrays{osg::PrimitiveSet::QUADS, 0, 4});

osg::ref_ptr<osg::Geode> geode_ptr{new osg::Geode};
geode_ptr->addDrawable(geometry_ptr.get());

if (!geode_ptr.valid())
{
    osg::notify(osg::FATAL) << "failed to create a node!" << std::endl;
}

bool result{osgDB::writeNodeFile(*(geode_ptr.get()), "./test.osg")};

if (!result)
{
    osg::notify(osg::FATAL) << "failed to create a osg file!" << std::endl;
}

return 0;

}`

In order to build up a headless simulation cluster, we’re working on containerization of our existing tools. Right now, the accessible server does not have any NVIDIA GPUs.

One problem, that we encounter is, that a specific application uses OpenGL for rendering. With an physical GPU, the simulation tool is running without any problem. To ship around the GPU dependencies, we’re using Mesa 3D OpenGL Software Rendering (Gallium), LLVMpipe, and OpenSWR Drivers. For reference, we had a look at https://github.com/jamesbrink/docker-opengl.

The current Dockerfile, which builds mesa 19.0.2 (using gcc-8) from source, looks like this:

# OPENGL SUPPORT ------------------------------------------------------------------------------
# start with plain ubuntu as base image for testing
FROM ubuntu AS builder

# install some needed packages and set gcc-8 as default compiler
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y 
    llvm-7 
    llvm-dev 
    autoconf 
    automake 
    bison 
    flex 
    gettext 
    libtool 
    python-dev
    git 
    pkgconf 
    python-mako 
    zlib1g-dev 
    x11proto-gl-dev 
    libxext-dev 
    xcb 
    libx11-xcb-dev 
    libxcb-dri2-0-dev 
    libxcb-xfixes0-dev 
    libdrm-dev 
    g++ 
    make 
    xvfb 
    x11vnc 
    g++-8 && 
    update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 800 --slave /usr/bin/g++ g++ /usr/bin/g++-8

# get mesa (using 19.0.2 as later versions dont use the configure script)
WORKDIR /mesa
RUN git clone https://gitlab.freedesktop.org/mesa/mesa.git
WORKDIR /mesa/mesa
RUN git checkout mesa-19.0.2
#RUN git checkout mesa-18.2.2

# build and install mesa
RUN libtoolize && 
    autoreconf --install && 
    ./configure 
        --enable-glx=gallium-xlib 
        --with-gallium-drivers=swrast,swr 
        --disable-dri 
        --disable-gbm 
        --disable-egl 
        --enable-gallium-osmesa 
        --enable-autotools 
        --enable-llvm 
        --with-llvm-prefix=/usr/lib/llvm-7/ 
        --prefix=/usr/local && 
    make -j 4 && 
    make install && 
    rm -rf /mesa



# SIM -----------------------------------------------------------------------------------------
FROM ubuntu
COPY --from=builder /usr/local /usr/local

# copy all simulation binaries to the image
COPY .....

# update ubuntu and install all sim dependencies
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y 
        xterm 
        freeglut3 
        openssh-server 
        synaptic 
        nfs-common 
        mesa-utils 
        xfonts-75dpi 
        libusb-0.1-4 
        python 
        libglu1-mesa 
        libqtgui4 
        gedit 
        xvfb 
        x11vnc 
        llvm-7-dev 
        expat 
        nano && 
    dpkg -i /vtdDeb/libpng12-0_1.2.54-1ubuntu1.1_amd64.deb

# set the environment variables (display -> 99 and LIBGL_ALWAYS_SOFTWARE)
ENV DISPLAY=":99" 
    GALLIUM_DRIVER="llvmpipe" 
    LIBGL_ALWAYS_SOFTWARE="1" 
    LP_DEBUG="" 
    LP_NO_RAST="false" 
    LP_NUM_THREADS="" 
    LP_PERF="" 
    MESA_VERSION="19.0.2" 
    XVFB_WHD="1920x1080x24"

If we now start the container and initialize the xvfb session, all glx examples like glxgears are working. Also the output of glxinfo | grep '^direct rendering:' is yes, so OpenGL is working.

However, if we start our simulation binary (which is provided from some company and cannot be changed now), following error messages are provided:

uniform block ub_lights has no binding.
uniform block ub_lights has no binding.
FRAGMENT glCompileShader "../data/Shaders/roadRendererFrag.glsl" FAILED
FRAGMENT Shader "../data/Shaders/roadRendererFrag.glsl" infolog:
0:277(48): error: unsized array index must be constant
0:344(48): error: unsized array index must be constant

glLinkProgram "RoadRenderingBase_Program" FAILED
Program "RoadRenderingBase_Program" infolog:
error: linking with uncompiled/unspecialized shader

Any idea how to fix that? For us, the error message is kind of vacuous.
Did someone encountered a similar problem?

EDIT

SOLVED Extra useless bytes at the start and the end appended by qt-creator messed it all up.

I am following the tuts from learnopengl.com and have written a shader class.

The fragment shader is:

out vec4 FragColor;
  
in vec3 ourColor;
in vec2 TexCoord;

uniform sampler2D texture1;
uniform sampler2D texture2;

void main()
{
    FragColor = mix(texture(texture1, TexCoord), texture(texture2, TexCoord), 0.2);
}

TexCoord isn’t used but is there in the vertex data.

I load the shader from a file to a char array and then use glShaderSource as:

glShaderSource(_handle, 1, &tmp, NULL);

where tmp is the char array and _handle is the id.

The compilation gives an error:

[ERROR]       resources/shaders/frag1.frag : compilation failed

0:1(1): error: syntax error, unexpected $end

What is this error and how to fix it?

EDIT

The file is loaded first into a string called _src:

in.open(_filename);
std::string contents((std::istreambuf_iterator<char>(in)), std::istreambuf_iterator<char>());         
_src = contents;

then copied to a char array called tmp:

const char* tmp = _src.c_str(); 

To verify that the char array is not empty i made it print out its contents as such (i use qt creator so use qDebug() instead of std::cout)

qDebug() << tmp;

and the output is:

out vec4 FragColor;
  
in vec3 ourColor;
in vec2 TexCoord;

uniform sampler2D texture1;
uniform sampler2D texture2;

void main()
{
    FragColor = mix(texture(texture1, TexCoord), texture(texture2, TexCoord), 0.2);
}

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 shadern");

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

        System.out.println("Linking shader");
        gl.glLinkProgram(shaderProg);
        printProgramLog(shaderProg);
        System.out.println("Linked Shadern");

        gl.glDeleteShader(computeShader);

This outputs:

Created shader

Attaching shader
Attached shader

Linking shader
Program Info Log: 
error: linking with uncompiled/unspecialized shader
Linked Shader

Recommend Projects

  • React photo

    React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo

    Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo

    Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo

    TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo

    Django

    The Web framework for perfectionists with deadlines.

  • Laravel photo

    Laravel

    A PHP framework for web artisans

  • D3 photo

    D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Visualization

    Some thing interesting about visualization, use data art

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo

    Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo

    Microsoft

    Open source projects and samples from Microsoft.

  • Google photo

    Google

    Google ❤️ Open Source for everyone.

  • Alibaba photo

    Alibaba

    Alibaba Open Source for everyone

  • D3 photo

    D3

    Data-Driven Documents codes.

  • Tencent photo

    Tencent

    China tencent open source team.

Moderator: Raze Developers

Forum rules
Please don’t bump threads here if you have a problem — it will often be forgotten about if you do. Instead, make a new thread here.

hjkos

Posts: 14
Joined: Thu Feb 25, 2016 9:01 pm

[16cee1148][all] Unable to load shader Paletted

Fails to start, this window appears:

Code: Select all

Unable to load shader Paletted:
Init Shader 'Paletted':
Vertex shader:
0:4(26): preprocessor error: syntax error, unexpected HASH_TOKEN, expecting NEWLINE

Fragment shader:
0:6(26): preprocessor error: syntax error, unexpected HASH_TOKEN, expecting NEWLINE

Linking:
error: linking with uncompiled/unspecialized shadererror: linking with uncompiled/unspecialized shader

User avatar

mjr4077au

Posts: 814
Joined: Sun Jun 16, 2019 9:17 pm
Graphics Processor: nVidia with Vulkan support
Location: Gosford NSW, Australia
Contact:

Re: [16cee1148][all] Unable to load shader Paletted

Post

by mjr4077au » Thu Sep 24, 2020 9:02 am

I’m not sure what this could be… Could you try downloading again and running from a clean directory? This is indicative that the pk3 file didn’t update properly.

hjkos

Posts: 14
Joined: Thu Feb 25, 2016 9:01 pm

Re: [16cee1148][all] Unable to load shader Paletted

Post

by hjkos » Thu Sep 24, 2020 1:51 pm

Just completely removed my build directory and rebuilt everything again, same outcome.

OS: Debian Linux testing/sid/experimental
CPU: AMD Ryzen 9 3950X (32) @ 3.500GHz
GPU: AMD ATI Radeon RX 5700 XT

gzdoom master builds and runs normally.

hjkos

Posts: 14
Joined: Thu Feb 25, 2016 9:01 pm

User avatar

mjr4077au

Posts: 814
Joined: Sun Jun 16, 2019 9:17 pm
Graphics Processor: nVidia with Vulkan support
Location: Gosford NSW, Australia
Contact:

Re: [16cee1148][all] Unable to load shader Paletted

Post

by mjr4077au » Thu Sep 24, 2020 2:20 pm

I’ll do some testing under Linux this morning. It sounds like a carriage return issue since Windows users CRLF for line endings and Linux just LF.

User avatar

mjr4077au

Posts: 814
Joined: Sun Jun 16, 2019 9:17 pm
Graphics Processor: nVidia with Vulkan support
Location: Gosford NSW, Australia
Contact:

Re: [16cee1148][all] Unable to load shader Paletted

Post

by mjr4077au » Thu Sep 24, 2020 4:13 pm

I was unable to reproduce this under an Arch Linux install. @hjkos just wondering whether you’re still having the issue or you’ve identified something locally?

User avatar

Graf Zahl

Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 48543
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: [16cee1148][all] Unable to load shader Paletted

Post

by Graf Zahl » Sat Sep 26, 2020 12:50 am

I think I found the cause for this. There was a line feed missing after a specific #define. But this will only cause issues if the GL driver requires some #defines of its own to be added, otherwise the follow-up was an empty line which made it work normally.


0

3

Привет. Пытаюсь одолеть, в качестве руководства использую https://habr.com/post/310790/. Автор использует opengl не меньше 3.3, в его примерах так:

   //Задается минимальная требуемая версия OpenGL. 
   //Мажорная 
   glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
   //Минорная
   glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);

Когда начал читать, то сразу возникли сомнения — у меня уже очень старая видеокарта (GeForce G 105M, в игры не играю, как-то и не заморачивался. А тут возникла нужда строить навороченные графики, с прокруткой, с графическими построениями …).

pavlick@pc ~ $ glxinfo | grep version
server glx version string: 1.4
client glx version string: 1.4
GLX version: 1.4
Max core profile version: 3.3
Max compat profile version: 3.1
Max GLES1 profile version: 1.1
Max GLES[23] profile version: 3.0
OpenGL core profile version string: 3.3 (Core Profile) Mesa 18.1.1
OpenGL core profile shading language version string: 3.30
OpenGL version string: 3.1 Mesa 18.1.1
OpenGL shading language version string: 1.40
OpenGL ES profile version string: OpenGL ES 3.0 Mesa 18.1.1
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.00

Судя по этому выхлопу, какая у меня версия )), то ли 3.1, то ли 3.3 ? Я для пробы собрал пример, где автор выводит треугольник, всё получилось. Знаю, что вопрос нубовский, я с гуём вообще дел почти не имел, надо определиться — грызть ли дальше тему/забить/менять карту.

Понравилась статья? Поделить с друзьями:
  • Error linker link exe not found
  • Error ld returned 1 exit status как исправить linux
  • Error ld returned 1 exit status как исправить codeblocks
  • Error ld returned 1 exit status code blocks
  • Error launching unity player