mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-04 00:45:35 +00:00
gpu: specify target Texture Backend.NewFramebuffer
OpenGL doesn't care if the texture to a framebuffer changes, but Direct3D does. Change Backend to better match both APIs. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+4
-5
@@ -193,9 +193,7 @@ func newStenciler(ctx Backend) *stenciler {
|
||||
func (s *fboSet) resize(ctx Backend, sizes []image.Point) {
|
||||
// Add fbos.
|
||||
for i := len(s.fbos); i < len(sizes); i++ {
|
||||
s.fbos = append(s.fbos, stencilFBO{
|
||||
fbo: ctx.NewFramebuffer(),
|
||||
})
|
||||
s.fbos = append(s.fbos, stencilFBO{})
|
||||
}
|
||||
// Resize fbos.
|
||||
for i, sz := range sizes {
|
||||
@@ -206,13 +204,14 @@ func (s *fboSet) resize(ctx Backend, sizes []image.Point) {
|
||||
waste := float32(sz.X*sz.Y) / float32(f.size.X*f.size.Y)
|
||||
resize = resize || waste > 1.2
|
||||
if resize {
|
||||
if f.tex != nil {
|
||||
if f.fbo != nil {
|
||||
f.fbo.Release()
|
||||
f.tex.Release()
|
||||
}
|
||||
f.size = sz
|
||||
f.tex = ctx.NewTexture(TextureFormatFloat, sz.X, sz.Y, FilterNearest, FilterNearest,
|
||||
BufferBindingTexture|BufferBindingFramebuffer)
|
||||
f.fbo.BindTexture(f.tex)
|
||||
f.fbo = ctx.NewFramebuffer(f.tex)
|
||||
}
|
||||
}
|
||||
// Delete extra fbos.
|
||||
|
||||
Reference in New Issue
Block a user