From 89a717f2ebcd78fafa260d3555ede5f2cad5b71f Mon Sep 17 00:00:00 2001 From: Swung0x48 Date: Wed, 19 Feb 2025 11:48:15 +0800 Subject: [PATCH] fix(vertexattrib): add glVertexAttribI*ui, fixing physics mod --- src/main/cpp/CMakeLists.txt | 1 + src/main/cpp/gl/gl_stub.c | 6 +++--- src/main/cpp/gl/vertexattrib.c | 25 +++++++++++++++++++++++++ src/main/cpp/gl/vertexattrib.h | 27 +++++++++++++++++++++++++++ 4 files changed, 56 insertions(+), 3 deletions(-) create mode 100644 src/main/cpp/gl/vertexattrib.c create mode 100644 src/main/cpp/gl/vertexattrib.h diff --git a/src/main/cpp/CMakeLists.txt b/src/main/cpp/CMakeLists.txt index a7dfeab..6d06999 100644 --- a/src/main/cpp/CMakeLists.txt +++ b/src/main/cpp/CMakeLists.txt @@ -39,6 +39,7 @@ add_library(${CMAKE_PROJECT_NAME} SHARED gl/glsl/glsl_for_es.cpp gl/glsl/cache.cpp gl/glsl/preConvertedGlsl.cpp + gl/vertexattrib.c glx/lookup.c egl/egl.c egl/loader.c diff --git a/src/main/cpp/gl/gl_stub.c b/src/main/cpp/gl/gl_stub.c index 0cf3d05..04681eb 100644 --- a/src/main/cpp/gl/gl_stub.c +++ b/src/main/cpp/gl/gl_stub.c @@ -355,9 +355,9 @@ STUB_FUNCTION_HEAD(void, glEndConditionalRender,void ) STUB_FUNCTION_END_NO_RETU STUB_FUNCTION_HEAD(void, glVertexAttribI1i, GLuint index, GLint x) STUB_FUNCTION_END_NO_RETURN(void, glVertexAttribI1i,index,x) STUB_FUNCTION_HEAD(void, glVertexAttribI2i, GLuint index, GLint x, GLint y) STUB_FUNCTION_END_NO_RETURN(void, glVertexAttribI2i,index,x,y) STUB_FUNCTION_HEAD(void, glVertexAttribI3i, GLuint index, GLint x, GLint y, GLint z) STUB_FUNCTION_END_NO_RETURN(void, glVertexAttribI3i,index,x,y,z) -STUB_FUNCTION_HEAD(void, glVertexAttribI1ui, GLuint index, GLuint x) STUB_FUNCTION_END_NO_RETURN(void, glVertexAttribI1ui,index,x) -STUB_FUNCTION_HEAD(void, glVertexAttribI2ui, GLuint index, GLuint x, GLuint y) STUB_FUNCTION_END_NO_RETURN(void, glVertexAttribI2ui,index,x,y) -STUB_FUNCTION_HEAD(void, glVertexAttribI3ui, GLuint index, GLuint x, GLuint y, GLuint z) STUB_FUNCTION_END_NO_RETURN(void, glVertexAttribI3ui,index,x,y,z) +//STUB_FUNCTION_HEAD(void, glVertexAttribI1ui, GLuint index, GLuint x) STUB_FUNCTION_END_NO_RETURN(void, glVertexAttribI1ui,index,x) +//STUB_FUNCTION_HEAD(void, glVertexAttribI2ui, GLuint index, GLuint x, GLuint y) STUB_FUNCTION_END_NO_RETURN(void, glVertexAttribI2ui,index,x,y) +//STUB_FUNCTION_HEAD(void, glVertexAttribI3ui, GLuint index, GLuint x, GLuint y, GLuint z) STUB_FUNCTION_END_NO_RETURN(void, glVertexAttribI3ui,index,x,y,z) STUB_FUNCTION_HEAD(void, glVertexAttribI1iv, GLuint index, const GLint *v) STUB_FUNCTION_END_NO_RETURN(void, glVertexAttribI1iv,index,v) STUB_FUNCTION_HEAD(void, glVertexAttribI2iv, GLuint index, const GLint *v) STUB_FUNCTION_END_NO_RETURN(void, glVertexAttribI2iv,index,v) STUB_FUNCTION_HEAD(void, glVertexAttribI3iv, GLuint index, const GLint *v) STUB_FUNCTION_END_NO_RETURN(void, glVertexAttribI3iv,index,v) diff --git a/src/main/cpp/gl/vertexattrib.c b/src/main/cpp/gl/vertexattrib.c new file mode 100644 index 0000000..1f3628f --- /dev/null +++ b/src/main/cpp/gl/vertexattrib.c @@ -0,0 +1,25 @@ +// +// Created by Swung 0x48 on 2025/2/19. +// + +#include "vertexattrib.h" + +#define DEBUG 0 + +void glVertexAttribI1ui(GLuint index, GLuint x) { + LOG() + LOAD_GLES_FUNC(glVertexAttribI4ui) + gles_glVertexAttribI4ui(index, x, 0, 0, 0); +} + +void glVertexAttribI2ui(GLuint index, GLuint x, GLuint y) { + LOG() + LOAD_GLES_FUNC(glVertexAttribI4ui) + gles_glVertexAttribI4ui(index, x, y, 0, 0); +} + +void glVertexAttribI3ui(GLuint index, GLuint x, GLuint y, GLuint z) { + LOG() + LOAD_GLES_FUNC(glVertexAttribI4ui) + gles_glVertexAttribI4ui(index, x, y, z, 0); +} \ No newline at end of file diff --git a/src/main/cpp/gl/vertexattrib.h b/src/main/cpp/gl/vertexattrib.h new file mode 100644 index 0000000..1f72966 --- /dev/null +++ b/src/main/cpp/gl/vertexattrib.h @@ -0,0 +1,27 @@ +// +// Created by Swung 0x48 on 2025/2/19. +// + +#ifndef MOBILEGLUES_VERTEXATTRIB_H +#define MOBILEGLUES_VERTEXATTRIB_H + +#include "../includes.h" +#include "gl.h" +#include "glcorearb.h" +#include "log.h" +#include "../gles/loader.h" +#include "mg.h" + +#ifdef __cplusplus +extern "C" { +#endif + +GLAPI GLAPIENTRY void glVertexAttribI1ui(GLuint index, GLuint x); +GLAPI GLAPIENTRY void glVertexAttribI2ui(GLuint index, GLuint x, GLuint y); +GLAPI GLAPIENTRY void glVertexAttribI3ui(GLuint index, GLuint x, GLuint y, GLuint z); + +#ifdef __cplusplus +} +#endif + +#endif //MOBILEGLUES_VERTEXATTRIB_H