AdamsLair / duality

a 2D Game Development Framework
https://adamslair.github.io/duality
MIT License
1.41k stars 290 forks source link

Tilemap goes over renderer vertex limit with large maps #705

Closed Barsonax closed 5 years ago

Barsonax commented 5 years ago

Summary

When you create a large tilemap it cannot be rendered due to going over the vertex limit. This bug was introduced in duality v3.

How to reproduce

Attachments

Stacktrace:

CoreError:   There was an error while RenderSetup "Default\RenderSetup\Default" was collecting renderer drawcalls: ArgumentException: This vertex batch storage limits batch size to a maximum of 65535 vertices. Cannot provide a vertex slice that is 190400 vertices long.
CallStack:
   at Duality.Drawing.VertexBatchStore.ThrowMaxSizeExceeded(Int32 requestedLength) in C:\projects\duality\Source\Core\Duality\Drawing\VertexData\VertexBatchStore.cs:line 192
   at Duality.Drawing.VertexBatchStore.Rent[T](Int32 length) in C:\projects\duality\Source\Core\Duality\Drawing\VertexData\VertexBatchStore.cs:line 107
   at Duality.Drawing.DrawDevice.AddVertices[T](BatchInfo material, VertexMode vertexMode, T[] vertexBuffer, Int32 vertexCount) in C:\projects\duality\Source\Core\Duality\Drawing\DrawDevice.cs:line 503
   at Duality.Drawing.ExtMethodsIDrawDevice.AddVertices[T](IDrawDevice device, ContentRef`1 material, VertexMode vertexMode, T[] vertexBuffer, Int32 vertexCount) in C:\projects\duality\Source\Core\Duality\Drawing\IDrawDevice.cs:line 232
   at Duality.Plugins.Tilemaps.TilemapRenderer.Draw(IDrawDevice device) in C:\projects\duality\Source\Plugins\Tilemaps\Core\Tilemaps\Components\TilemapRenderer.cs:line 397
   at Duality.Resources.RenderSetup.OnCollectRendererDrawcalls(DrawDevice drawDevice, RawList`1 visibleRenderers, Boolean renderersSortedByType) in C:\projects\duality\Source\Core\Duality\Resources\RenderSetup\RenderSetup.cs:line 522
   at Duality.Resources.RenderSetup.CollectRendererDrawcalls(Scene scene, DrawDevice drawDevice) in C:\projects\duality\Source\Core\Duality\Resources\RenderSetup\RenderSetup.cs:line 386
ilexp commented 5 years ago

A note on addressing this issue:

ilexp commented 5 years ago

Fixed and released. Should be out there in about 20 minutes.