瀏覽代碼

REVIEWED: Avoid UBSAN warnings #1891

pull/1923/head
raysan5 3 年之前
父節點
當前提交
a8e9e1387f
共有 1 個檔案被更改,包括 4 行新增2 行删除
  1. +4
    -2
      src/rlgl.h

+ 4
- 2
src/rlgl.h 查看文件

@ -3227,7 +3227,8 @@ void rlDrawVertexArray(int offset, int count)
void rlDrawVertexArrayElements(int offset, int count, void *buffer)
{
glDrawElements(GL_TRIANGLES, count, GL_UNSIGNED_SHORT, (unsigned short *)buffer + offset);
if (buffer == 0) glDrawElements(GL_TRIANGLES, count, GL_UNSIGNED_SHORT, offset);
else glDrawElements(GL_TRIANGLES, count, GL_UNSIGNED_SHORT, (unsigned short *)buffer + offset);
}
void rlDrawVertexArrayInstanced(int offset, int count, int instances)
@ -3240,7 +3241,8 @@ void rlDrawVertexArrayInstanced(int offset, int count, int instances)
void rlDrawVertexArrayElementsInstanced(int offset, int count, void *buffer, int instances)
{
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
glDrawElementsInstanced(GL_TRIANGLES, count, GL_UNSIGNED_SHORT, (unsigned short *)buffer + offset, instances);
if (buffer == 0) glDrawElementsInstanced(GL_TRIANGLES, count, GL_UNSIGNED_SHORT, offset, instances);
else glDrawElementsInstanced(GL_TRIANGLES, count, GL_UNSIGNED_SHORT, (unsigned short *)buffer + offset, instances);
#endif
}

Loading…
取消
儲存