From c59bcbdb5b4236233c977aa52fd03cc961182a06 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Thu, 23 Mar 2023 14:07:22 +0900 Subject: [PATCH] Revert "internal/graphicscommand: add graphics.MaxVertexFloatCount and use it instead of IndicesCount" This reverts commit 54e2790a068bea1b73c3e875a0535b21d4be350c. Reason: test failures on browsers: `GOOS=js GOARCH=wasm go test . -shuffle=1679547510163000000` failed https://github.com/hajimehoshi/ebiten/actions/runs/4497182906/jobs/7912544699 --- internal/graphics/vertex.go | 13 ++----------- internal/graphicscommand/command.go | 6 +----- 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/internal/graphics/vertex.go b/internal/graphics/vertex.go index ca1e8e78e..f8d5c114b 100644 --- a/internal/graphics/vertex.go +++ b/internal/graphics/vertex.go @@ -14,10 +14,6 @@ package graphics -import ( - "math" -) - const ( ShaderImageCount = 4 @@ -52,13 +48,8 @@ const ( ) const ( - IndicesCount = (1 << 16) / 3 * 3 // Adjust num for triangles. TODO: Remove this (#2460). -) - -const ( - VertexFloatCount = 8 - MaxVertexCount = math.MaxUint16 + 1 - MaxVertexFloatCount = MaxVertexCount * VertexFloatCount + IndicesCount = (1 << 16) / 3 * 3 // Adjust num for triangles. TODO: Remove this (#2460). + VertexFloatCount = 8 ) var ( diff --git a/internal/graphicscommand/command.go b/internal/graphicscommand/command.go index b8d23c09c..dfbc1c0b7 100644 --- a/internal/graphicscommand/command.go +++ b/internal/graphicscommand/command.go @@ -86,15 +86,11 @@ func (q *commandQueue) appendIndices(indices []uint16, offset uint16) { // mustUseDifferentVertexBuffer reports whether a different vertex buffer must be used. func mustUseDifferentVertexBuffer(nextNumVertexFloats int) bool { - return nextNumVertexFloats > graphics.MaxVertexFloatCount + return nextNumVertexFloats > graphics.IndicesCount*graphics.VertexFloatCount } // EnqueueDrawTrianglesCommand enqueues a drawing-image command. func (q *commandQueue) EnqueueDrawTrianglesCommand(dst *Image, srcs [graphics.ShaderImageCount]*Image, offsets [graphics.ShaderImageCount - 1][2]float32, vertices []float32, indices []uint16, blend graphicsdriver.Blend, dstRegion, srcRegion graphicsdriver.Region, shader *Shader, uniforms []uint32, evenOdd bool) { - if len(vertices) > graphics.MaxVertexFloatCount { - panic(fmt.Sprintf("graphicscommand: len(vertices) must not exceed %d but was %d", graphics.MaxVertexFloatCount, len(vertices))) - } - split := false if mustUseDifferentVertexBuffer(q.tmpNumVertexFloats + len(vertices)) { q.tmpNumVertexFloats = 0