Set max dst images to 8 + some wording

This commit is contained in:
Zyko 2024-04-12 19:19:17 +02:00
parent 75b6e1fa6d
commit 2faf8a551d
4 changed files with 8 additions and 4 deletions

View File

@ -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),

View File

@ -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")
}
}
}

View File

@ -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 {

View File

@ -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.