mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 15:45:38 +00:00
ui/app/internal/gl: fix GetProgramInfoLog and GetShaderInfoLog
I should read the manual more carefully. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -336,15 +336,10 @@ func (f *Functions) GetProgrami(p Program, pname Enum) int {
|
||||
}
|
||||
|
||||
func (f *Functions) GetProgramInfoLog(p Program) string {
|
||||
var plen C.GLsizei
|
||||
C.glGetProgramInfoLog(C.GLuint(p.V), 0, &plen, nil)
|
||||
if plen == 0 {
|
||||
return ""
|
||||
}
|
||||
// Make room for the string and the null terminator.
|
||||
buf := make([]byte, plen+1)
|
||||
C.glGetProgramInfoLog(C.GLuint(p.V), C.GLsizei(len(buf)), &plen, (*C.GLchar)(unsafe.Pointer(&buf[0])))
|
||||
return string(buf[:len(buf)-1])
|
||||
n := f.GetProgrami(p, INFO_LOG_LENGTH)
|
||||
buf := make([]byte, n)
|
||||
C.glGetProgramInfoLog(C.GLuint(p.V), C.GLsizei(len(buf)), nil, (*C.GLchar)(unsafe.Pointer(&buf[0])))
|
||||
return string(buf)
|
||||
}
|
||||
|
||||
func (f *Functions) GetQueryObjectuiv(query Query, pname Enum) uint {
|
||||
@@ -358,15 +353,10 @@ func (f *Functions) GetShaderi(s Shader, pname Enum) int {
|
||||
}
|
||||
|
||||
func (f *Functions) GetShaderInfoLog(s Shader) string {
|
||||
var plen C.GLsizei
|
||||
C.glGetShaderInfoLog(C.GLuint(s.V), 0, &plen, nil)
|
||||
if plen == 0 {
|
||||
return ""
|
||||
}
|
||||
// Make room for the string and the null terminator.
|
||||
buf := make([]byte, plen+1)
|
||||
C.glGetShaderInfoLog(C.GLuint(s.V), C.GLsizei(len(buf)), &plen, (*C.GLchar)(unsafe.Pointer(&buf[0])))
|
||||
return string(buf[:len(buf)-1])
|
||||
n := f.GetShaderi(s, INFO_LOG_LENGTH)
|
||||
buf := make([]byte, n)
|
||||
C.glGetShaderInfoLog(C.GLuint(s.V), C.GLsizei(len(buf)), nil, (*C.GLchar)(unsafe.Pointer(&buf[0])))
|
||||
return string(buf)
|
||||
}
|
||||
|
||||
func (f *Functions) GetString(pname Enum) string {
|
||||
|
||||
@@ -38,6 +38,7 @@ const (
|
||||
FRAMEBUFFER_COMPLETE = 0x8cd5
|
||||
HALF_FLOAT = 0x140b
|
||||
HALF_FLOAT_OES = 0x8d61
|
||||
INFO_LOG_LENGTH = 0x8B84
|
||||
GREATER = 0x204
|
||||
LINEAR = 0x2601
|
||||
LINK_STATUS = 0x8b82
|
||||
|
||||
@@ -263,15 +263,10 @@ func (c *Functions) GetProgrami(p Program, pname Enum) int {
|
||||
return int(c.int32s[0])
|
||||
}
|
||||
func (c *Functions) GetProgramInfoLog(p Program) string {
|
||||
var n uintptr
|
||||
syscall.Syscall6(_glGetProgramInfoLog.Addr(), 4, uintptr(p.V), 0, uintptr(unsafe.Pointer(&n)), 0, 0, 0)
|
||||
if n == 0 {
|
||||
return ""
|
||||
}
|
||||
// Make space for the null terminator.
|
||||
buf := make([]byte, n+1)
|
||||
syscall.Syscall6(_glGetProgramInfoLog.Addr(), 4, uintptr(p.V), uintptr(len(buf)), uintptr(unsafe.Pointer(&n)), uintptr(unsafe.Pointer(&buf[0])), 0, 0)
|
||||
return string(buf[:len(buf)-1])
|
||||
n := c.GetProgrami(p, INFO_LOG_LENGTH)
|
||||
buf := make([]byte, n)
|
||||
syscall.Syscall6(_glGetProgramInfoLog.Addr(), 4, uintptr(p.V), uintptr(len(buf)), 0, uintptr(unsafe.Pointer(&buf[0])), 0, 0)
|
||||
return string(buf)
|
||||
}
|
||||
func (c *Functions) GetQueryObjectuiv(query Query, pname Enum) uint {
|
||||
syscall.Syscall(_glGetQueryObjectuiv.Addr(), 3, uintptr(query.V), uintptr(pname), uintptr(unsafe.Pointer(&c.int32s[0])))
|
||||
@@ -282,15 +277,10 @@ func (c *Functions) GetShaderi(s Shader, pname Enum) int {
|
||||
return int(c.int32s[0])
|
||||
}
|
||||
func (c *Functions) GetShaderInfoLog(s Shader) string {
|
||||
var n uintptr
|
||||
syscall.Syscall6(_glGetShaderInfoLog.Addr(), 4, uintptr(s.V), 0, uintptr(unsafe.Pointer(&n)), 0, 0, 0)
|
||||
if n == 0 {
|
||||
return ""
|
||||
}
|
||||
// Make space for the null terminator.
|
||||
buf := make([]byte, n+1)
|
||||
syscall.Syscall6(_glGetShaderInfoLog.Addr(), 4, uintptr(s.V), uintptr(len(buf)), uintptr(unsafe.Pointer(&n)), uintptr(unsafe.Pointer(&buf[0])), 0, 0)
|
||||
return string(buf[:len(buf)-1])
|
||||
n := c.GetShaderi(s, INFO_LOG_LENGTH)
|
||||
buf := make([]byte, n)
|
||||
syscall.Syscall6(_glGetShaderInfoLog.Addr(), 4, uintptr(s.V), uintptr(len(buf)), 0, uintptr(unsafe.Pointer(&buf[0])), 0, 0)
|
||||
return string(buf)
|
||||
}
|
||||
func (c *Functions) GetString(pname Enum) string {
|
||||
s, _, _ := syscall.Syscall(_glGetString.Addr(), 1, uintptr(pname), 0, 0)
|
||||
|
||||
Reference in New Issue
Block a user