internal/graphicsdriver/opengl: Refactoring: Rename a variable

This commit is contained in:
Hajime Hoshi 2021-07-03 02:41:37 +09:00
parent 269ea7c489
commit 56f4e6b2d0
2 changed files with 16 additions and 16 deletions

View File

@ -97,7 +97,7 @@ func (g *Graphics) NewImage(width, height int) (driver.Image, error) {
if err != nil { if err != nil {
return nil, err return nil, err
} }
i.textureNative = t i.texture = t
g.addImage(i) g.addImage(i)
return i, nil return i, nil
} }
@ -301,7 +301,7 @@ func (g *Graphics) DrawTriangles(dstID driver.ImageID, srcIDs [graphics.ShaderIm
continue continue
} }
imgs[i].valid = true imgs[i].valid = true
imgs[i].native = g.images[srcID].textureNative imgs[i].native = g.images[srcID].texture
} }
if err := g.useProgram(program, uniformVars, imgs); err != nil { if err := g.useProgram(program, uniformVars, imgs); err != nil {

View File

@ -22,7 +22,7 @@ import (
type Image struct { type Image struct {
id driver.ImageID id driver.ImageID
graphics *Graphics graphics *Graphics
textureNative textureNative texture textureNative
framebuffer *framebuffer framebuffer *framebuffer
pbo buffer pbo buffer
width int width int
@ -35,7 +35,7 @@ func (i *Image) ID() driver.ImageID {
} }
func (i *Image) IsInvalidated() bool { func (i *Image) IsInvalidated() bool {
return !i.graphics.context.isTexture(i.textureNative) return !i.graphics.context.isTexture(i.texture)
} }
func (i *Image) Dispose() { func (i *Image) Dispose() {
@ -45,8 +45,8 @@ func (i *Image) Dispose() {
if i.framebuffer != nil { if i.framebuffer != nil {
i.framebuffer.delete(&i.graphics.context) i.framebuffer.delete(&i.graphics.context)
} }
if !i.textureNative.equal(*new(textureNative)) { if !i.texture.equal(*new(textureNative)) {
i.graphics.context.deleteTexture(i.textureNative) i.graphics.context.deleteTexture(i.texture)
} }
i.graphics.removeImage(i) i.graphics.removeImage(i)
@ -97,7 +97,7 @@ func (i *Image) ensureFramebuffer() error {
i.framebuffer = newScreenFramebuffer(&i.graphics.context, w, h) i.framebuffer = newScreenFramebuffer(&i.graphics.context, w, h)
return nil return nil
} }
f, err := newFramebufferFromTexture(&i.graphics.context, i.textureNative, w, h) f, err := newFramebufferFromTexture(&i.graphics.context, i.texture, w, h)
if err != nil { if err != nil {
return err return err
} }
@ -122,7 +122,7 @@ func (i *Image) ReplacePixels(args []*driver.ReplacePixelsArgs) {
// TODO: Now canUsePBO always returns false (#1678). Remove the code for PBO. // TODO: Now canUsePBO always returns false (#1678). Remove the code for PBO.
if !i.graphics.context.canUsePBO() { if !i.graphics.context.canUsePBO() {
i.graphics.context.texSubImage2D(i.textureNative, args) i.graphics.context.texSubImage2D(i.texture, args)
return return
} }
@ -139,5 +139,5 @@ func (i *Image) ReplacePixels(args []*driver.ReplacePixelsArgs) {
if i.pbo.equal(*new(buffer)) { if i.pbo.equal(*new(buffer)) {
panic("opengl: newPixelBufferObject failed") panic("opengl: newPixelBufferObject failed")
} }
i.graphics.context.replacePixelsWithPBO(i.pbo, i.textureNative, w, h, args) i.graphics.context.replacePixelsWithPBO(i.pbo, i.texture, w, h, args)
} }