Skip to content

Commit

Permalink
Add GL_BindBufferBase() wrapper.
Browse files Browse the repository at this point in the history
  • Loading branch information
skullernet committed Oct 30, 2024
1 parent efc53a1 commit 05aa7ec
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
7 changes: 7 additions & 0 deletions src/refresh/gl.h
Original file line number Diff line number Diff line change
Expand Up @@ -798,6 +798,13 @@ static inline void GL_BindBuffer(GLenum target, GLuint buffer)
}
}

static inline void GL_BindBufferBase(GLenum target, GLuint index, GLuint buffer)
{
glBufferBinding_t i = GL_BindingForTarget(target);
qglBindBufferBase(target, index, buffer);
gls.currentbuffer[i] = buffer;
}

static inline void GL_ClearDepth(GLfloat d)
{
if (qglClearDepthf)
Expand Down
6 changes: 2 additions & 4 deletions src/refresh/shader.c
Original file line number Diff line number Diff line change
Expand Up @@ -1041,15 +1041,13 @@ static void shader_init(void)
gl_static.programs = HashMap_TagCreate(glStateBits_t, GLuint, HashInt32, NULL, TAG_RENDERER);

qglGenBuffers(1, &gl_static.uniform_buffer);
GL_BindBuffer(GL_UNIFORM_BUFFER, gl_static.uniform_buffer);
qglBindBufferBase(GL_UNIFORM_BUFFER, UBO_UNIFORMS, gl_static.uniform_buffer);
GL_BindBufferBase(GL_UNIFORM_BUFFER, UBO_UNIFORMS, gl_static.uniform_buffer);
qglBufferData(GL_UNIFORM_BUFFER, sizeof(gls.u_block), NULL, GL_DYNAMIC_DRAW);

#if USE_MD5
if (gl_config.caps & QGL_CAP_SKELETON_MASK) {
qglGenBuffers(1, &gl_static.skeleton_buffer);
GL_BindBuffer(GL_UNIFORM_BUFFER, gl_static.skeleton_buffer);
qglBindBufferBase(GL_UNIFORM_BUFFER, UBO_SKELETON, gl_static.skeleton_buffer);
GL_BindBufferBase(GL_UNIFORM_BUFFER, UBO_SKELETON, gl_static.skeleton_buffer);

if ((gl_config.caps & QGL_CAP_SKELETON_MASK) == QGL_CAP_BUFFER_TEXTURE)
qglGenTextures(2, gl_static.skeleton_tex);
Expand Down

0 comments on commit 05aa7ec

Please sign in to comment.