internal/graphicsdriver/opengl/gl: refactoring: replace GetIntegerv -> GetInteger

This commit is contained in:
Hajime Hoshi 2022-11-16 23:59:28 +09:00
parent c7c9500ba6
commit 098fed65d5
5 changed files with 11 additions and 11 deletions

View File

@ -105,9 +105,7 @@ func (c *context) reset() error {
c.ctx.Enable(gl.BLEND)
c.ctx.Enable(gl.SCISSOR_TEST)
c.blend(graphicsdriver.BlendSourceOver)
f := make([]int32, 1)
c.ctx.GetIntegerv(f, gl.FRAMEBUFFER_BINDING)
c.screenFramebuffer = framebufferNative(f[0])
c.screenFramebuffer = framebufferNative(c.ctx.GetInteger(gl.FRAMEBUFFER_BINDING))
// TODO: Need to update screenFramebufferWidth/Height?
return nil
}
@ -441,9 +439,7 @@ func (c *context) drawElements(len int, offsetInBytes int) {
}
func (c *context) maxTextureSizeImpl() int {
v := make([]int32, 1)
c.ctx.GetIntegerv(v, gl.MAX_TEXTURE_SIZE)
return int(v[0])
return c.ctx.GetInteger(gl.MAX_TEXTURE_SIZE)
}
func (c *context) flush() {

View File

@ -584,8 +584,10 @@ func (c *defaultContext) GetError() uint32 {
return uint32(ret)
}
func (c *defaultContext) GetIntegerv(dst []int32, pname uint32) {
func (c *defaultContext) GetInteger(pname uint32) int {
dst := make([]int32, 1)
C.glowGetIntegerv(c.gpGetIntegerv, (C.GLenum)(pname), (*C.GLint)(unsafe.Pointer(&dst[0])))
return int(dst[0])
}
func (c *defaultContext) GetProgramInfoLog(program uint32) string {

View File

@ -283,8 +283,10 @@ func (c *defaultContext) GetError() uint32 {
return uint32(ret)
}
func (c *defaultContext) GetIntegerv(dst []int32, pname uint32) {
func (c *defaultContext) GetInteger(pname uint32) int {
dst := make([]int32, 1)
purego.SyscallN(c.gpGetIntegerv, uintptr(pname), uintptr(unsafe.Pointer(&dst[0])))
return int(dst[0])
}
func (c *defaultContext) GetProgramInfoLog(program uint32) string {

View File

@ -218,8 +218,8 @@ func (g *gomobileContext) GetError() uint32 {
return uint32(g.ctx.GetError())
}
func (g *gomobileContext) GetIntegerv(dst []int32, pname uint32) {
g.ctx.GetIntegerv(dst, gl.Enum(pname))
func (g *gomobileContext) GetInteger(pname uint32) int {
return g.ctx.GetInteger(gl.Enum(pname))
}
func (g *gomobileContext) GetProgramInfoLog(program uint32) string {

View File

@ -58,7 +58,7 @@ type Context interface {
GenRenderbuffers(n int32) []uint32
GenTextures(n int32) []uint32
GetError() uint32
GetIntegerv(dst []int32, pname uint32)
GetInteger(pname uint32) int
GetProgramInfoLog(program uint32) string
GetProgramiv(dst []int32, program uint32, pname uint32)
GetShaderInfoLog(shader uint32) string