From f08983e14d39afa35e0044394f32e316c4f4f62e Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Thu, 17 Nov 2022 10:50:19 +0900 Subject: [PATCH] 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. --- internal/graphicsdriver/opengl/context_js.go | 2 -- internal/graphicsdriver/opengl/context_notjs.go | 7 ++----- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/internal/graphicsdriver/opengl/context_js.go b/internal/graphicsdriver/opengl/context_js.go index c56923526..ac1bbb5cd 100644 --- a/internal/graphicsdriver/opengl/context_js.go +++ b/internal/graphicsdriver/opengl/context_js.go @@ -71,8 +71,6 @@ func (p program) equal(rhs program) bool { return p.value.Equal(rhs.value) && p.id == rhs.id } -var InvalidTexture = textureNative(js.Null()) - var invalidUniform = uniformLocation(js.Null()) func getProgramID(p program) programID { diff --git a/internal/graphicsdriver/opengl/context_notjs.go b/internal/graphicsdriver/opengl/context_notjs.go index e74367cce..db53aa311 100644 --- a/internal/graphicsdriver/opengl/context_notjs.go +++ b/internal/graphicsdriver/opengl/context_notjs.go @@ -59,8 +59,6 @@ func (p program) equal(rhs program) bool { return p == rhs } -var InvalidTexture textureNative - type ( uniformLocation int32 attribLocation int32 @@ -73,7 +71,6 @@ func (u uniformLocation) equal(rhs uniformLocation) bool { type programID uint32 const ( - invalidTexture = 0 invalidFramebuffer = (1 << 32) - 1 invalidUniform = -1 ) @@ -97,7 +94,7 @@ func (c *context) reset() error { } c.locationCache = newLocationCache() - c.lastTexture = invalidTexture + c.lastTexture = 0 c.lastFramebuffer = invalidFramebuffer c.lastViewportWidth = 0 c.lastViewportHeight = 0 @@ -183,7 +180,7 @@ func (c *context) deleteTexture(t textureNative) { return } if c.lastTexture == t { - c.lastTexture = invalidTexture + c.lastTexture = 0 } c.ctx.DeleteTexture(uint32(t)) }