Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

glDrawElementsBaseVertex has generated an error (GL_INVALID_OPERATION) #16

Open
catalyst2001 opened this issue Dec 1, 2022 · 6 comments

Comments

@catalyst2001
Copy link

Hello!
I'm compiling your project on Windows, and on all recent projects I'm getting debug messages that glDrawElementsBaseVertex is generating a GL_INVALID_OPERATION error.
How can I solve this problem?

Here are some details about my hardware:
Radeon RX 580 Series
PCI\VEN_1002&DEV_67DF&SUBSYS_2378148C&REV_E7
PCI\VEN_1002&DEV_67DF&SUBSYS_2378148C
PCI\VEN_1002&DEV_67DF&CC_030000
PCI\VEN_1002&DEV_67DF&CC_0300

Driver date: 12/16/2021

The error message itself:
Debug message: id 1000, glDrawElementsBaseVertex has generated an error (GL_INVALID_OPERATION)
Message source: API
Error type: Error
Severity: High

@emeiri
Copy link
Owner

emeiri commented Dec 2, 2022

I assume that this is coming from Common/ogldev_basic_mesh.cpp but I looked at the parameters of this function and they look ok. Perhaps something else in the state is wrong.
Can you please place a breakpoint in glDebugOutput (Common/ogldev_util.cpp) and look at the stack?

@catalyst2001
Copy link
Author

catalyst2001 commented Dec 2, 2022

Which stack exactly?
GL Attributes stack?

@catalyst2001
Copy link
Author

error after compiling shaders: "Validation failed! - Different sampler types for same sample texture unit in fragment shader"

@emeiri
Copy link
Owner

emeiri commented Dec 2, 2022

I've seen this error code before. Let me see if I can find the mail report about it.

@emeiri
Copy link
Owner

emeiri commented Dec 2, 2022

Here's something that a user sent me:

Trying tutorial43 in ogldev.org…:

Tutorial 43: Multipass Shadow Mapping With Point Lights
it builds and runs fine except for an error message I get when I close the window…

active samplers with a different type refer to the same texture image unit
As can be seen in the image I printed out the texture units used the sampler2d and samplerCube and they are indeed different. …
My question if everything is fine why the error message about invalid shader when closing the window? is this a bug in the driver?

This indicates that at some point, when the program was “validated” against the current GL state (**), then the shader program:

Makes use of 2+ sampler uniforms,
At least 2 of these survive compile+link and are used in the resulting shader program binary, and
The texture image assigned to 2 or more of these are assigned the same texture image unit number.
(**) Shader program validation occurs when glValidateProgram() is called or a draw call is made with that shader program bound to the context.

So check the code for this. Assuming it’s not a driver bug, it’s likely being invoked someplace you’ve not looked at.

The easy way to avoid this is to just specify the texture unit bindings in your shader code, rather than specify them externally via glUniform1i(). For instance:

layout( binding = 0 ) uniform sampler2D tex1;
layout( binding = 1 ) uniform samplerCube tex2;
Then there’s no way this conflict can arise between these two sampler uniforms in this shader stage.

@catalyst2001
Copy link
Author

Hello. I asked a question on one of the Russian forums I know, and the person answered me. He said there was a mistake in the lesson.
You can translate his message through a translator. Perhaps this will be useful.

https://www.cyberforum.ru/opengl/thread3053817.html#post16612046

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants