Skip to content

Commit 3f5c986

Browse files
zzueggclaude
andcommitted
refactor(renderer): reuse existing IntBuffer fields in queryShaderStorageBlockBinding
Use the renderer's intBuf1 and intBuf16 instance fields instead of allocating new IntBuffers on each call. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent efbb280 commit 3f5c986

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

jme3-core/src/main/java/com/jme3/renderer/opengl/GLRenderer.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1590,11 +1590,11 @@ private void resolveBufferBlockBindings(final Shader shader) {
15901590
* @return the binding point assigned to the block.
15911591
*/
15921592
private int queryShaderStorageBlockBinding(int program, int blockIndex) {
1593-
IntBuffer props = BufferUtils.createIntBuffer(1);
1594-
props.put(GL4.GL_BUFFER_BINDING).flip();
1595-
IntBuffer params = BufferUtils.createIntBuffer(1);
1596-
gl4.glGetProgramResourceiv(program, GL4.GL_SHADER_STORAGE_BLOCK, blockIndex, props, null, params);
1597-
return params.get(0);
1593+
intBuf16.clear();
1594+
intBuf16.put(GL4.GL_BUFFER_BINDING).flip();
1595+
intBuf1.clear();
1596+
gl4.glGetProgramResourceiv(program, GL4.GL_SHADER_STORAGE_BLOCK, blockIndex, intBuf16, null, intBuf1);
1597+
return intBuf1.get(0);
15981598
}
15991599

16001600
protected void updateShaderUniforms(Shader shader) {

0 commit comments

Comments
 (0)