question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Driver performance warnings after recent shader unbinding change

See original GitHub issue

The commit 01ea5b1 (#5944) has caused performance warnings to appear, and sometimes spam, when drawing. A minimal reproducible example is shown below which can be fixed by reverting to any previous commit, or unbinding the shader yourself.

These warnings show when using an Nvidia card. I have not yet tested any AMD cards. I am unsure which specific GL state is causing the shader to be recompiled, but it could be various combined.

This also occurs when using SpriteBatch, SpriteCache, and other drawing classes.

[LWJGL] OpenGL debug message
	ID: 0x20092
	Source: API
	Type: PERFORMANCE
	Severity: MEDIUM
	Message: Program/shader state performance warning: Vertex shader in program 3 is being recompiled based on GL state.
Lwjgl3ApplicationConfiguration options = new Lwjgl3ApplicationConfiguration();

options.enableGLDebugOutput(true, System.err);

new Lwjgl3Application(new ApplicationAdapter() {

    private ShapeRenderer shapeRenderer;

    @Override
    public void create() {
        shapeRenderer = new ShapeRenderer();
    }

    @Override
    public void render() {
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

        shapeRenderer.begin(ShapeRenderer.ShapeType.Line);
        shapeRenderer.line(0.0f, 0.0f, 1.0f, 1.0f);
        shapeRenderer.end();
    }

    @Override
    public void dispose() {
        shapeRenderer.dispose();
    }
}, options);

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:12 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
AndEditor7commented, Jul 22, 2020

I decided to visit this issue because I got this same message when I recently updated my project to 1.9.11 and LWJGL 3.2.3. Even tho I got a new Geforce GTX 1660 SUPER graphic card with a lastest driver update (451.67 - July 9th, 2020), and the message appears in my console log with enabled GL debug output. But good news, I found what causes it, and fix it. (may not work on every GPU and drivers). How I found it? I traced the log by adding a breakpoint in System.err.println() to found what triggers it. From what I found, it caused from Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);. I added Gdx.gl.glUseProgram(0); before the Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);. And what you know, the debug message is gone! 🦀🦀🦀

1reaction
WickedShellcommented, Mar 11, 2020

@mgsx-dev I just reproduced this here: ArchLinux using 5.5.7-arch1-1 kernel Java: 1.8.0_242 GTX 1070 NVIDIA 440.64 drivers

I get it without using the shaperenderer, I just took my existing application and told it to use the 1.9.11-SNAPSHOT. I’d actually suggest you might be getting away with it due to the older driver version you are on. (You also have to actually enable the GLDebug output on LWJGL3 which I hadn’t realized was a thing before now, but this is the only message I’ve seen come out it so far.)

Read more comments on GitHub >

github_iconTop Results From Across the Web

What causes GLSL recompilation of vertex shader based on ...
The driver gives me this warning: Program/shader state performance warning: Vertex shader in program 16 is being recompiled based on GL state.
Read more >
Improve Shader Performance and In-Game Frame Rates with ...
Learn about Shader Execution Reordering (SER), a performance optimization that unlocks the potential for better ray and memory coherency in ...
Read more >
Shader Development | Unreal Engine Documentation
This will enable retry-on-error and shader development related logs and warnings. Use Ctrl+Shift+., which executes the recompileshaders changed command.
Read more >
Shaders and Rendering — pyglet v2.0.1
Uniforms are variables that can be modified after a ShaderProgram has been compiled to change functionality during run time. Warning. When setting uniforms ......
Read more >
Unity 2022.2.0
HDRP: Added a new Eye Shader type called Eye Cinematic with Caustic. ... header and implemented new design changes on the details header....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found