glGetActiveUniformBlockiv not functioning for vector output
See original GitHub issueRelated PR https://github.com/libgdx/libgdx/pull/6208
Issue details
When querying vector information from UniformBlocks (i.e. GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES) only the first item is ever written.
Reproduction steps/code
I don’t have time to create a reproduction rn, but my stacktrace looks something like this
My code:
val indices = allocateIntBuffer(count) // direct byte buffer as an int buffer
indices.rewind()
gl.glGetActiveUniformBlockiv( // gl is typealiased to Gdx.gl30
programId,
i, // index of the ubo
GL30.GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES,
indices
)
Libgdx: Lwjgl3GL30.java:484
@Override
public void glGetActiveUniformBlockiv (int program, int uniformBlockIndex, int pname, IntBuffer params) {
params.put(GL31.glGetActiveUniformBlocki(program, uniformBlockIndex, pname));
}
Lwjgl: GL31C.java:584
@NativeType("void")
public static int glGetActiveUniformBlocki(@NativeType("GLuint") int program, @NativeType("GLuint") int uniformBlockIndex, @NativeType("GLenum") int pname) {
MemoryStack stack = stackGet(); int stackPointer = stack.getPointer();
try {
IntBuffer params = stack.callocInt(1);
nglGetActiveUniformBlockiv(program, uniformBlockIndex, pname, memAddress(params));
return params.get(0);
} finally {
stack.setPointer(stackPointer);
}
}
I may provide a proper reproduction later on.
Version of LibGDX and/or relevant dependencies
1.9.11
Stacktrace
glGetActiveUniformBlocki:553, GL31 (org.lwjgl.opengl)
glGetActiveUniformBlockiv:485, Lwjgl3GL30 (com.badlogic.gdx.backends.lwjgl3)
introspect:140, ShaderProgram (com.nanite.graphics)
. . .
initializeListener:433, Lwjgl3Window (com.badlogic.gdx.backends.lwjgl3)
update:381, Lwjgl3Window (com.badlogic.gdx.backends.lwjgl3)
loop:138, Lwjgl3Application (com.badlogic.gdx.backends.lwjgl3)
<init>:114, Lwjgl3Application (com.badlogic.gdx.backends.lwjgl3)
main:18, DesktopLauncher (com.cellular.game.desktop)
Please select the affected platforms
- Android
- iOS
- HTML/GWT
- Windows
- Linux
- MacOS (although I imagine other platforms will be affected as well)
I imagine it’s a simple matter of calling the wrong jwjgl function.
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
Catalyst 10.12 and std140 uniform blocks - Khronos Forums
Basically using the glGetActiveUniformBlockiv interface. Here's the code if you're ... It does not say this vector should occupy 16 bytes.
Read more >GLSL, multiple uniform blocks - opengl - Stack Overflow
... the uniforms resulting after this optimization are called "active" uniforms and the reason why a uniform declared but not otherwise used ...
Read more >C++ (Cpp) glGetActiveUniformBlockiv Examples - HotExamples
C++ (Cpp) glGetActiveUniformBlockiv - 30 examples found. ... used for debugging to print the offsets of uniform buffer members void ...
Read more >Lesson 3 – GLSL - PV227 – GPU Rendering - IS MUNI
all output parameter values are copied from the function after execution, in parameters can be also const (not writeable inside function).
Read more >glLinkProgram - OpenGL ES 3 - docs.gl
Also, any active user-defined attribute variables that have not been bound to a ... in the varyings array is not declared as an...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Sure I could have something ready by tomorrow-ish
fixed by #6208