diff --git a/internal/graphicsdriver/opengl/context_desktop.go b/internal/graphicsdriver/opengl/context_desktop.go index 77347bfbf..fce1c2c1b 100644 --- a/internal/graphicsdriver/opengl/context_desktop.go +++ b/internal/graphicsdriver/opengl/context_desktop.go @@ -401,7 +401,7 @@ func (c *context) uniformFloats(p program, location string, v []float32) { func (c *context) vertexAttribPointer(p program, index int, size int, dataType dataType, stride int, offset int) { _ = c.t.Call(func() error { - gl.VertexAttribPointer(uint32(index), int32(size), uint32(dataType), false, int32(stride), gl.PtrOffset(offset)) + gl.VertexAttribPointer(uint32(index), int32(size), uint32(dataType), false, int32(stride), uintptr(offset)) return nil }) } @@ -477,7 +477,7 @@ func (c *context) deleteBuffer(b buffer) { func (c *context) drawElements(len int, offsetInBytes int) { _ = c.t.Call(func() error { - gl.DrawElements(gl.TRIANGLES, int32(len), gl.UNSIGNED_SHORT, gl.PtrOffset(offsetInBytes)) + gl.DrawElements(gl.TRIANGLES, int32(len), gl.UNSIGNED_SHORT, uintptr(offsetInBytes)) return nil }) } diff --git a/internal/graphicsdriver/opengl/gl/conversions_notwindows.go b/internal/graphicsdriver/opengl/gl/conversions_notwindows.go index 51ec9e2be..56703d56b 100644 --- a/internal/graphicsdriver/opengl/gl/conversions_notwindows.go +++ b/internal/graphicsdriver/opengl/gl/conversions_notwindows.go @@ -51,13 +51,6 @@ func Ptr(data interface{}) unsafe.Pointer { return addr } -// PtrOffset takes a pointer offset and returns a GL-compatible pointer. -// Useful for functions such as glVertexAttribPointer that take pointer -// parameters indicating an offset rather than an absolute memory address. -func PtrOffset(offset int) unsafe.Pointer { - return unsafe.Pointer(uintptr(offset)) -} - // Str takes a null-terminated Go string and returns its GL-compatible address. // This function reaches into Go string storage in an unsafe way so the caller // must ensure the string is not garbage collected. diff --git a/internal/graphicsdriver/opengl/gl/conversions_windows.go b/internal/graphicsdriver/opengl/gl/conversions_windows.go index 55a1b15b5..2f5a6ae1e 100644 --- a/internal/graphicsdriver/opengl/gl/conversions_windows.go +++ b/internal/graphicsdriver/opengl/gl/conversions_windows.go @@ -46,13 +46,6 @@ func Ptr(data interface{}) unsafe.Pointer { return addr } -// PtrOffset takes a pointer offset and returns a GL-compatible pointer. -// Useful for functions such as glVertexAttribPointer that take pointer -// parameters indicating an offset rather than an absolute memory address. -func PtrOffset(offset int) unsafe.Pointer { - return unsafe.Pointer(uintptr(offset)) -} - // Str takes a null-terminated Go string and returns its GL-compatible address. // This function reaches into Go string storage in an unsafe way so the caller // must ensure the string is not garbage collected. diff --git a/internal/graphicsdriver/opengl/gl/package_notwindows.go b/internal/graphicsdriver/opengl/gl/package_notwindows.go index e5432602e..03d73dfc2 100644 --- a/internal/graphicsdriver/opengl/gl/package_notwindows.go +++ b/internal/graphicsdriver/opengl/gl/package_notwindows.go @@ -562,7 +562,7 @@ package gl // typedef void (APIENTRYP GPDRAWCOMMANDSSTATESNV)(GLuint buffer, const GLintptr * indirects, const GLsizei * sizes, const GLuint * states, const GLuint * fbos, GLuint count); // typedef void (APIENTRYP GPDRAWELEMENTARRAYAPPLE)(GLenum mode, GLint first, GLsizei count); // typedef void (APIENTRYP GPDRAWELEMENTARRAYATI)(GLenum mode, GLsizei count); -// typedef void (APIENTRYP GPDRAWELEMENTS)(GLenum mode, GLsizei count, GLenum type, const void * indices); +// typedef void (APIENTRYP GPDRAWELEMENTS)(GLenum mode, GLsizei count, GLenum type, const uintptr_t indices); // typedef void (APIENTRYP GPDRAWELEMENTSBASEVERTEX)(GLenum mode, GLsizei count, GLenum type, const void * indices, GLint basevertex); // typedef void (APIENTRYP GPDRAWELEMENTSINDIRECT)(GLenum mode, GLenum type, const void * indirect); // typedef void (APIENTRYP GPDRAWELEMENTSINSTANCEDARB)(GLenum mode, GLsizei count, GLenum type, const void * indices, GLsizei primcount); @@ -2746,7 +2746,7 @@ package gl // typedef void (APIENTRYP GPVERTEXATTRIBP4UI)(GLuint index, GLenum type, GLboolean normalized, GLuint value); // typedef void (APIENTRYP GPVERTEXATTRIBP4UIV)(GLuint index, GLenum type, GLboolean normalized, const GLuint * value); // typedef void (APIENTRYP GPVERTEXATTRIBPARAMETERIAMD)(GLuint index, GLenum pname, GLint param); -// typedef void (APIENTRYP GPVERTEXATTRIBPOINTER)(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void * pointer); +// typedef void (APIENTRYP GPVERTEXATTRIBPOINTER)(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const uintptr_t pointer); // typedef void (APIENTRYP GPVERTEXATTRIBPOINTERARB)(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void * pointer); // typedef void (APIENTRYP GPVERTEXATTRIBPOINTERNV)(GLuint index, GLint fsize, GLenum type, GLsizei stride, const void * pointer); // typedef void (APIENTRYP GPVERTEXATTRIBS1DVNV)(GLuint index, GLsizei count, const GLdouble * v); @@ -4267,7 +4267,7 @@ package gl // static void glowDrawElementArrayATI(GPDRAWELEMENTARRAYATI fnptr, GLenum mode, GLsizei count) { // (*fnptr)(mode, count); // } -// static void glowDrawElements(GPDRAWELEMENTS fnptr, GLenum mode, GLsizei count, GLenum type, const void * indices) { +// static void glowDrawElements(GPDRAWELEMENTS fnptr, GLenum mode, GLsizei count, GLenum type, const uintptr_t indices) { // (*fnptr)(mode, count, type, indices); // } // static void glowDrawElementsBaseVertex(GPDRAWELEMENTSBASEVERTEX fnptr, GLenum mode, GLsizei count, GLenum type, const void * indices, GLint basevertex) { @@ -10819,7 +10819,7 @@ package gl // static void glowVertexAttribParameteriAMD(GPVERTEXATTRIBPARAMETERIAMD fnptr, GLuint index, GLenum pname, GLint param) { // (*fnptr)(index, pname, param); // } -// static void glowVertexAttribPointer(GPVERTEXATTRIBPOINTER fnptr, GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void * pointer) { +// static void glowVertexAttribPointer(GPVERTEXATTRIBPOINTER fnptr, GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const uintptr_t pointer) { // (*fnptr)(index, size, type, normalized, stride, pointer); // } // static void glowVertexAttribPointerARB(GPVERTEXATTRIBPOINTERARB fnptr, GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void * pointer) { @@ -15735,8 +15735,8 @@ func DrawElementArrayATI(mode uint32, count int32) { } // render primitives from array data -func DrawElements(mode uint32, count int32, xtype uint32, indices unsafe.Pointer) { - C.glowDrawElements(gpDrawElements, (C.GLenum)(mode), (C.GLsizei)(count), (C.GLenum)(xtype), indices) +func DrawElements(mode uint32, count int32, xtype uint32, indices uintptr) { + C.glowDrawElements(gpDrawElements, (C.GLenum)(mode), (C.GLsizei)(count), (C.GLenum)(xtype), C.uintptr_t(indices)) } // render primitives from array data with a per-element offset @@ -23063,8 +23063,8 @@ func VertexAttribParameteriAMD(index uint32, pname uint32, param int32) { } // define an array of generic vertex attribute data -func VertexAttribPointer(index uint32, size int32, xtype uint32, normalized bool, stride int32, pointer unsafe.Pointer) { - C.glowVertexAttribPointer(gpVertexAttribPointer, (C.GLuint)(index), (C.GLint)(size), (C.GLenum)(xtype), (C.GLboolean)(boolToInt(normalized)), (C.GLsizei)(stride), pointer) +func VertexAttribPointer(index uint32, size int32, xtype uint32, normalized bool, stride int32, pointer uintptr) { + C.glowVertexAttribPointer(gpVertexAttribPointer, (C.GLuint)(index), (C.GLint)(size), (C.GLenum)(xtype), (C.GLboolean)(boolToInt(normalized)), (C.GLsizei)(stride), C.uintptr_t(pointer)) } func VertexAttribPointerARB(index uint32, size int32, xtype uint32, normalized bool, stride int32, pointer unsafe.Pointer) { C.glowVertexAttribPointerARB(gpVertexAttribPointerARB, (C.GLuint)(index), (C.GLint)(size), (C.GLenum)(xtype), (C.GLboolean)(boolToInt(normalized)), (C.GLsizei)(stride), pointer) diff --git a/internal/graphicsdriver/opengl/gl/package_windows.go b/internal/graphicsdriver/opengl/gl/package_windows.go index c22abfa11..f81d0f038 100644 --- a/internal/graphicsdriver/opengl/gl/package_windows.go +++ b/internal/graphicsdriver/opengl/gl/package_windows.go @@ -4477,7 +4477,7 @@ func DrawElementArrayATI(mode uint32, count int32) { } // render primitives from array data -func DrawElements(mode uint32, count int32, xtype uint32, indices unsafe.Pointer) { +func DrawElements(mode uint32, count int32, xtype uint32, indices uintptr) { syscall.Syscall6(gpDrawElements, 4, uintptr(mode), uintptr(count), uintptr(xtype), uintptr(indices), 0, 0) } @@ -11805,7 +11805,7 @@ func VertexAttribParameteriAMD(index uint32, pname uint32, param int32) { } // define an array of generic vertex attribute data -func VertexAttribPointer(index uint32, size int32, xtype uint32, normalized bool, stride int32, pointer unsafe.Pointer) { +func VertexAttribPointer(index uint32, size int32, xtype uint32, normalized bool, stride int32, pointer uintptr) { syscall.Syscall6(gpVertexAttribPointer, 6, uintptr(index), uintptr(size), uintptr(xtype), boolToUintptr(normalized), uintptr(stride), uintptr(pointer)) } func VertexAttribPointerARB(index uint32, size int32, xtype uint32, normalized bool, stride int32, pointer unsafe.Pointer) {