internal/graphicsdriver/opengl: remove unused variables

It should be safe to assume 0 is an invalid texture ID in OpenGL.

https://registry.khronos.org/OpenGL-Refpages/gl4/html/glIsTexture.xhtml
> If texture is zero, or is a non-zero value that is not currently the
> name of a texture, or if an error occurs, glIsTexture returns GL_FALSE.
This commit is contained in:
Hajime Hoshi 2022-11-17 10:50:19 +09:00
parent de3702e4c2
commit f08983e14d
2 changed files with 2 additions and 7 deletions

View File

@ -71,8 +71,6 @@ func (p program) equal(rhs program) bool {
return p.value.Equal(rhs.value) && p.id == rhs.id return p.value.Equal(rhs.value) && p.id == rhs.id
} }
var InvalidTexture = textureNative(js.Null())
var invalidUniform = uniformLocation(js.Null()) var invalidUniform = uniformLocation(js.Null())
func getProgramID(p program) programID { func getProgramID(p program) programID {

View File

@ -59,8 +59,6 @@ func (p program) equal(rhs program) bool {
return p == rhs return p == rhs
} }
var InvalidTexture textureNative
type ( type (
uniformLocation int32 uniformLocation int32
attribLocation int32 attribLocation int32
@ -73,7 +71,6 @@ func (u uniformLocation) equal(rhs uniformLocation) bool {
type programID uint32 type programID uint32
const ( const (
invalidTexture = 0
invalidFramebuffer = (1 << 32) - 1 invalidFramebuffer = (1 << 32) - 1
invalidUniform = -1 invalidUniform = -1
) )
@ -97,7 +94,7 @@ func (c *context) reset() error {
} }
c.locationCache = newLocationCache() c.locationCache = newLocationCache()
c.lastTexture = invalidTexture c.lastTexture = 0
c.lastFramebuffer = invalidFramebuffer c.lastFramebuffer = invalidFramebuffer
c.lastViewportWidth = 0 c.lastViewportWidth = 0
c.lastViewportHeight = 0 c.lastViewportHeight = 0
@ -183,7 +180,7 @@ func (c *context) deleteTexture(t textureNative) {
return return
} }
if c.lastTexture == t { if c.lastTexture == t {
c.lastTexture = invalidTexture c.lastTexture = 0
} }
c.ctx.DeleteTexture(uint32(t)) c.ctx.DeleteTexture(uint32(t))
} }