From 2faf8a551d29c4c6714a4b89714511d0ba940a70 Mon Sep 17 00:00:00 2001 From: Zyko <13394516+Zyko0@users.noreply.github.com> Date: Fri, 12 Apr 2024 19:19:17 +0200 Subject: [PATCH] Set max dst images to 8 + some wording --- examples/mrt/main.go | 2 +- internal/atlas/image.go | 2 +- internal/buffered/image.go | 2 +- internal/graphics/vertex.go | 6 +++++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/examples/mrt/main.go b/examples/mrt/main.go index 15c34d949..10e3e53a9 100644 --- a/examples/mrt/main.go +++ b/examples/mrt/main.go @@ -31,7 +31,7 @@ const ( ) var ( - dsts = [4]*ebiten.Image{ + dsts = [8]*ebiten.Image{ /*ebiten.NewImage(dstSize, dstSize), ebiten.NewImage(dstSize, dstSize), ebiten.NewImage(dstSize, dstSize), diff --git a/internal/atlas/image.go b/internal/atlas/image.go index 66e140fb6..d7915d577 100644 --- a/internal/atlas/image.go +++ b/internal/atlas/image.go @@ -590,7 +590,7 @@ func drawTrianglesMRT(dsts [graphics.ShaderDstImageCount]*Image, srcs [graphics. // i and a source image might share the same atlas even though i != src. for _, dst := range dsts { if src != nil && dst != nil && dst.backend.image == src.backend.image { - panic("atlas: Image.DrawTriangles: source must be different from the receiver") + panic("atlas: DrawTrianglesMRT: source must be different from the destination images") } } } diff --git a/internal/buffered/image.go b/internal/buffered/image.go index 185bee7bc..955e0fd51 100644 --- a/internal/buffered/image.go +++ b/internal/buffered/image.go @@ -218,7 +218,7 @@ func DrawTrianglesMRT(dsts [graphics.ShaderDstImageCount]*Image, srcs [graphics. continue } if dst == src { - panic("buffered: DrawTrianglesMRT: source images must be different from the destination") + panic("buffered: DrawTrianglesMRT: source images must be different from the destination images") } } if src != nil { diff --git a/internal/graphics/vertex.go b/internal/graphics/vertex.go index 02ba2e9fc..585e967aa 100644 --- a/internal/graphics/vertex.go +++ b/internal/graphics/vertex.go @@ -16,7 +16,11 @@ package graphics const ( ShaderSrcImageCount = 4 - ShaderDstImageCount = 4 + // The minimum guaranteed value for the number of target seems to be 8 + // OpenGL(8): https://www.khronos.org/opengl/wiki/Framebuffer_Object#Framebuffer_Object_Structure + // DirectX11(8): https://learn.microsoft.com/en-us/windows/win32/direct3d11/d3d10-graphics-programming-guide-output-merger-stage#multiple-rendertargets-overview + // Metal(8): Page 7 of 15: https://developer.apple.com/metal/Metal-Feature-Set-Tables.pdf + ShaderDstImageCount = 8 // PreservedUniformVariablesCount represents the number of preserved uniform variables. // Any shaders in Ebitengine must have these uniform variables.