From d8c295bbc8453de3609ee232b40c0d156df414c2 Mon Sep 17 00:00:00 2001 From: TurtleP Date: Wed, 15 Nov 2023 12:14:08 -0500 Subject: [PATCH] fix lots of text usage crashing, needs optimizing --- CMakeLists.txt | 6 +- include/modules/graphics/graphics.tcc | 4 +- include/objects/font/font.hpp | 8 +- .../utilities/driver/renderer/drawcommand.tcc | 14 ++- .../utilities/driver/renderer/renderstate.hpp | 17 ++++ .../include/utilities/driver/renderer_ext.hpp | 4 +- platform/cafe/source/objects/texture_ext.cpp | 2 +- .../source/utilities/driver/renderer_ext.cpp | 2 +- .../include/utilities/driver/renderer_ext.hpp | 12 ++- platform/ctr/source/objects/texture_ext.cpp | 2 +- .../driver/renderer/renderer_ext.cpp | 31 +++++-- .../include/utilities/driver/renderer_ext.hpp | 2 +- platform/hac/source/objects/texture_ext.cpp | 2 +- .../source/utilities/driver/renderer_ext.cpp | 2 +- source/modules/graphics/wrap_graphics.cpp | 3 - source/objects/font/font.cpp | 89 +++++++++++++------ source/objects/mesh/mesh.cpp | 5 +- source/objects/spritebatch/spritebatch.cpp | 4 +- source/objects/textbatch/textbatch.cpp | 2 +- .../driver/renderer/polyline/polyline.cpp | 2 +- source/utilities/shaper/genericshaper.cpp | 2 +- 21 files changed, 151 insertions(+), 64 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 50816c7f..09298443 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -234,7 +234,11 @@ FetchContent_Declare(lua-https GIT_TAG TurtleP/certs ) -FetchContent_MakeAvailable(lua-https) +FetchContent_GetProperties(lua-https) +if(NOT lua-https_POPULATED) + FetchContent_Populate(lua-https) + add_subdirectory(${lua-https_SOURCE_DIR} ${lua-https_BINARY_DIR}) +endif() add_library(lua-https STATIC ${lua-https_SOURCE_DIR}/src/common/config.h diff --git a/include/modules/graphics/graphics.tcc b/include/modules/graphics/graphics.tcc index 39bc37d7..467bc39d 100644 --- a/include/modules/graphics/graphics.tcc +++ b/include/modules/graphics/graphics.tcc @@ -1166,7 +1166,7 @@ namespace love bool is2D = transform.IsAffine2DTransform(); const int count = points.size() - (skipLastVertex ? 1 : 0); - DrawCommand command(count, vertex::PRIMITIVE_TRIANGLE_FAN); + DrawCommand command(count, vertex::PRIMITIVE_TRIANGLE_FAN); if (is2D) transform.TransformXY(std::span(command.Positions().get(), command.count), @@ -1398,7 +1398,7 @@ namespace love const auto& transform = this->GetTransform(); bool is2D = transform.IsAffine2DTransform(); - DrawCommand command(points.size(), vertex::PRIMITIVE_POINTS); + DrawCommand command(points.size(), vertex::PRIMITIVE_POINTS); if (is2D) transform.TransformXY(std::span(command.Positions().get(), points.size()), points); diff --git a/include/objects/font/font.hpp b/include/objects/font/font.hpp index d719fbb5..131da4d5 100644 --- a/include/objects/font/font.hpp +++ b/include/objects/font/font.hpp @@ -18,6 +18,7 @@ #include #include +#include #include #if defined(__3DS__) @@ -99,8 +100,7 @@ namespace love const Matrix4& localTransform, const Color& color); void Printf(Graphics& graphics, const ColoredStrings& text, float wrap, - AlignMode alignment, const Matrix4& localTransform, - const Color& color); + AlignMode alignment, const Matrix4& localTransform, const Color& color); int GetAscent() const; @@ -175,7 +175,7 @@ namespace love const Glyph& FindGlyph(TextShaper::GlyphIndex glyphIndex); - void Printv(Graphics& graphics, const Matrix4& transform, + void Render(Graphics& graphics, const Matrix4& transform, const std::vector& drawCommands, const std::vector& vertices); @@ -196,7 +196,7 @@ namespace love StrongReference shaper; - std::unordered_map glyphs; + std::map glyphs; std::unordered_map kernings; static constexpr auto SPACES_PER_TAB = 0x04; diff --git a/include/utilities/driver/renderer/drawcommand.tcc b/include/utilities/driver/renderer/drawcommand.tcc index 9437b81c..cacbb64e 100644 --- a/include/utilities/driver/renderer/drawcommand.tcc +++ b/include/utilities/driver/renderer/drawcommand.tcc @@ -19,8 +19,6 @@ namespace love #else using Handle = Texture; #endif - - template struct DrawCommand { public: @@ -68,11 +66,21 @@ namespace love return this->positions; } + const std::span GetPositions() const + { + return std::span(this->positions.get(), this->count); + } + const std::unique_ptr& Vertices() const { return this->vertices; } + const std::span GetVertices() const + { + return std::span(this->vertices.get(), this->count); + } + /* primitive */ void FillVertices(const Color& color) { @@ -166,4 +174,4 @@ namespace love std::vector handles; CullMode cullMode; }; // namespace love -} // namespace love \ No newline at end of file +} // namespace love diff --git a/include/utilities/driver/renderer/renderstate.hpp b/include/utilities/driver/renderer/renderstate.hpp index 77e34581..7bed4566 100644 --- a/include/utilities/driver/renderer/renderstate.hpp +++ b/include/utilities/driver/renderer/renderstate.hpp @@ -149,6 +149,23 @@ namespace love } }; + struct StencilState + { + CompareMode compare = COMPARE_ALWAYS; + StencilAction action = STENCIL_KEEP; + + int value = 0; + uint32_t readMask = 0xFFFFFFFF; + uint32_t writeMask = 0xFFFFFFFF; + + bool operator==(const StencilState& other) const + { + return this->compare == other.compare && this->action == other.action && + this->value == other.value && this->readMask == other.readMask && + this->writeMask == other.writeMask; + } + }; + struct ColorMask { bool r : 1, g : 1, b : 1, a : 1; diff --git a/platform/cafe/include/utilities/driver/renderer_ext.hpp b/platform/cafe/include/utilities/driver/renderer_ext.hpp index c68f0826..cbbeb352 100644 --- a/platform/cafe/include/utilities/driver/renderer_ext.hpp +++ b/platform/cafe/include/utilities/driver/renderer_ext.hpp @@ -131,7 +131,7 @@ namespace love void SetPointSize(float size); - bool Render(DrawCommand& command); + bool Render(DrawCommand& command); void UseProgram(const WHBGfxShaderGroup& group); @@ -253,7 +253,7 @@ namespace love Framebuffer* current; GX2ContextState* state; - static inline std::vector> m_commands {}; + static inline std::vector::Draw(Graphics& graphics, Quad* quad, Matrix4 transform(stateTransform, matrix); - love::DrawCommand command(4); + love::DrawCommand command(4); command.shader = Shader<>::STANDARD_TEXTURE; command.format = vertex::CommonFormat::TEXTURE; command.type = vertex::PRIMITIVE_QUADS; diff --git a/platform/cafe/source/utilities/driver/renderer_ext.cpp b/platform/cafe/source/utilities/driver/renderer_ext.cpp index 6aca14fd..4d79ddda 100644 --- a/platform/cafe/source/utilities/driver/renderer_ext.cpp +++ b/platform/cafe/source/utilities/driver/renderer_ext.cpp @@ -318,7 +318,7 @@ void Renderer::FlushVertices() m_commands.clear(); } -bool Renderer::Render(DrawCommand& command) +bool Renderer::Render(DrawCommand& command) { if (!Shader::IsDefaultActive(command.shader)) { diff --git a/platform/ctr/include/utilities/driver/renderer_ext.hpp b/platform/ctr/include/utilities/driver/renderer_ext.hpp index 0bcaf5f3..a684c8f2 100644 --- a/platform/ctr/include/utilities/driver/renderer_ext.hpp +++ b/platform/ctr/include/utilities/driver/renderer_ext.hpp @@ -8,6 +8,7 @@ #include #include +#include #include #include @@ -65,7 +66,7 @@ namespace love /* todo: canvases */ void BindFramebuffer(Texture* texture = nullptr); - bool Render(DrawCommand& command); + bool Render(DrawCommand& command); void Present(); @@ -202,6 +203,13 @@ namespace love C3D_Mtx modelView; C3D_Mtx projection; C3D_RenderTarget* target; + bool dirtyProjection; + + vertex::CullMode cullMode; + + love::RenderState::ColorMask colorMask; + love::RenderState::BlendState blendState; + love::RenderState::StencilState stencilState; } context; std::vector> deferred; @@ -212,7 +220,7 @@ namespace love static inline PrimitiveType currentPrimitiveType = PRIMITIVE_MAX_ENUM; static inline int totalVertices = 0; - static inline std::vector> m_commands {}; + static inline std::vector m_commands {}; C3D_BufInfo bufferInfo; diff --git a/platform/ctr/source/objects/texture_ext.cpp b/platform/ctr/source/objects/texture_ext.cpp index 0ed46aea..6d01d84a 100644 --- a/platform/ctr/source/objects/texture_ext.cpp +++ b/platform/ctr/source/objects/texture_ext.cpp @@ -335,7 +335,7 @@ void Texture::Draw(Graphics& graphics, Quad* quad, Matrix4 translated(graphics.GetTransform(), matrix); - DrawCommand command(0x04, vertex::PRIMITIVE_TRIANGLE_FAN); + DrawCommand command(0x04, vertex::PRIMITIVE_TRIANGLE_FAN); command.handles = { this->texture }; command.format = CommonFormat::TEXTURE; diff --git a/platform/ctr/source/utilities/driver/renderer/renderer_ext.cpp b/platform/ctr/source/utilities/driver/renderer/renderer_ext.cpp index b3109cf4..c153e47a 100644 --- a/platform/ctr/source/utilities/driver/renderer/renderer_ext.cpp +++ b/platform/ctr/source/utilities/driver/renderer/renderer_ext.cpp @@ -82,7 +82,6 @@ void Renderer::DestroyFramebuffers() void Renderer::Clear(const Color& color) { - C3D_FrameSplit(0); C3D_RenderTargetClear(this->context.target, C3D_CLEAR_ALL, color.abgr(), 0); } @@ -152,20 +151,22 @@ void Renderer::FlushVertices() m_commands.clear(); } -bool Renderer::Render(DrawCommand& command) +bool Renderer::Render(DrawCommand& command) { { Shader::defaults[command.shader]->Attach(); - auto uniforms = Shader::current->GetUniformLocations(); - C3D_FVUnifMtx4x4(GPU_VERTEX_SHADER, uniforms.uLocProjMtx, &this->context.projection); - C3D_FVUnifMtx4x4(GPU_VERTEX_SHADER, uniforms.uLocMdlView, &this->context.modelView); + if (this->context.dirtyProjection) + { + C3D_FVUnifMtx4x4(GPU_VERTEX_SHADER, uniforms.uLocProjMtx, &this->context.projection); + C3D_FVUnifMtx4x4(GPU_VERTEX_SHADER, uniforms.uLocMdlView, &this->context.modelView); + this->context.dirtyProjection = false; + } } // check if texture is the same, or no texture at all - if (command.handles.empty() || - (command.handles.size() > 0 && this->currentTexture == command.handles.back())) + if (command.handles.empty() || (this->currentTexture == command.handles.back())) { ++drawCalls; m_commands.push_back(command.Clone()); @@ -182,6 +183,7 @@ bool Renderer::Render(DrawCommand& command) C3D_TexBind(0, command.handles.back()); } + ++drawCalls; m_commands.push_back(command.Clone()); return true; @@ -221,17 +223,20 @@ void Renderer::SetViewport(const Rect& rect, bool tilt) if (newView.w == GSP_SCREEN_HEIGHT_TOP || newView.w == GSP_SCREEN_HEIGHT_TOP_2X) { Mtx_Copy(&this->context.projection, &this->targets[0].GetProjView()); + this->context.dirtyProjection = true; return; } else if (newView.w == GSP_SCREEN_HEIGHT_BOTTOM) { Mtx_Copy(&this->context.projection, &this->targets[2].GetProjView()); + this->context.dirtyProjection = true; return; } } auto* ortho = tilt ? Mtx_OrthoTilt : Mtx_Ortho; ortho(&this->context.projection, 0.0f, rect.w, rect.h, 0.0f, Z_NEAR, Z_FAR, true); + this->context.dirtyProjection = true; C3D_SetViewport(0, 0, rect.w, rect.h); } @@ -259,7 +264,11 @@ void Renderer::SetMeshCullMode(vertex::CullMode mode) if (!(cullMode = Renderer::cullModes.Find(mode))) return; + if (this->context.cullMode == mode) + return; + C3D_CullFace(*cullMode); + this->context.cullMode = mode; } /* ??? */ @@ -300,6 +309,10 @@ void Renderer::SetColorMask(const RenderState::ColorMask& mask) uint8_t writeMask = GPU_WRITE_DEPTH; writeMask |= mask.GetColorMask(); + if (this->context.colorMask == mask) + return; + + this->context.colorMask = mask; C3D_DepthTest(true, GPU_GEQUAL, (GPU_WRITEMASK)writeMask); } @@ -329,5 +342,9 @@ void Renderer::SetBlendMode(const RenderState::BlendState& state) if (!(dstAlpha = Renderer::blendFactors.Find(state.dstFactorA))) return; + if (this->context.blendState == state) + return; + + this->context.blendState = state; C3D_AlphaBlend(*opRGB, *opAlpha, *srcColor, *dstColor, *srcAlpha, *dstAlpha); } diff --git a/platform/hac/include/utilities/driver/renderer_ext.hpp b/platform/hac/include/utilities/driver/renderer_ext.hpp index 9cac2639..a89cb3cf 100644 --- a/platform/hac/include/utilities/driver/renderer_ext.hpp +++ b/platform/hac/include/utilities/driver/renderer_ext.hpp @@ -137,7 +137,7 @@ namespace love void CheckDescriptorsDirty(const std::vector& handles); - bool Render(const DrawCommand& command); + bool Render(const DrawCommand& command); void UseProgram(Shader::Program program); diff --git a/platform/hac/source/objects/texture_ext.cpp b/platform/hac/source/objects/texture_ext.cpp index d8579c41..b1ab881c 100644 --- a/platform/hac/source/objects/texture_ext.cpp +++ b/platform/hac/source/objects/texture_ext.cpp @@ -399,7 +399,7 @@ void Texture::Draw(Graphics& graphics, Quad* quad, Matrix4 transform(stateTransform, matrix); - DrawCommand command(4); + DrawCommand command(4); command.shader = Shader<>::STANDARD_TEXTURE; command.format = vertex::CommonFormat::TEXTURE; command.type = vertex::PRIMITIVE_QUADS; diff --git a/platform/hac/source/utilities/driver/renderer_ext.cpp b/platform/hac/source/utilities/driver/renderer_ext.cpp index ee1bdb41..e94c38e4 100644 --- a/platform/hac/source/utilities/driver/renderer_ext.cpp +++ b/platform/hac/source/utilities/driver/renderer_ext.cpp @@ -322,7 +322,7 @@ void Renderer::SetAttributes(const vertex::attributes::Attribs& at this->commandBuffer.bindVtxBufferState(attributes.bufferState); } -bool Renderer::Render(const DrawCommand& command) +bool Renderer::Render(const DrawCommand& command) { if (command.count > (this->vertices.getSize() - this->firstVertex)) return false; diff --git a/source/modules/graphics/wrap_graphics.cpp b/source/modules/graphics/wrap_graphics.cpp index e3f5e2b4..31e1b232 100644 --- a/source/modules/graphics/wrap_graphics.cpp +++ b/source/modules/graphics/wrap_graphics.cpp @@ -684,17 +684,14 @@ getImageData(lua_State* L, int index, bool allowCompressed, float* dpiScale) if (allowCompressed && module->IsCompressed(data)) { - LOG("Loading compressed image."); luax::CatchException(L, [&]() { compressed.Set(module->NewCompressedImageData(data), Acquire::NORETAIN); }); - LOG("Compressed image loaded."); } else { luax::CatchException( L, [&]() { image.Set(module->NewImageData(data), Acquire::NORETAIN); }); - LOG("Imagedata loaded."); } } else diff --git a/source/objects/font/font.cpp b/source/objects/font/font.cpp index a073eb7f..84ea4beb 100644 --- a/source/objects/font/font.cpp +++ b/source/objects/font/font.cpp @@ -266,7 +266,6 @@ const Font::Glyph& Font::AddGlyph(TextShaper::GlyphIndex glyphIndex) Glyph _glyph {}; _glyph.texture = nullptr; - _glyph.spacing = std::floor(data->GetAdvance() / dpiScale + 0.5f); std::fill_n(_glyph.vertices.data(), 6, Vertex {}); @@ -380,16 +379,17 @@ const Font::Glyph& Font::AddGlyph(TextShaper::GlyphIndex glyphIndex) // clang-format on /* copy the vertex data into the Glyph and set proper bearing */ + _glyph.vertices = vertices; + for (size_t index = 0; index < vertices.size(); index++) { - _glyph.vertices[index] = vertices[index]; - _glyph.vertices[index].position[0] += data->GetBearingX() / dpiScale; + auto bearingY = data->GetBearingY() / dpiScale; + + if (!Console::Is(Console::CTR)) + bearingY = -bearingY; - if (Console::Is(Console::CTR)) - _glyph.vertices[index].position[1] += data->GetBearingY() / dpiScale; - else - _glyph.vertices[index].position[1] -= data->GetBearingY() / dpiScale; + _glyph.vertices[index].position[1] += bearingY; } this->textureX += width + Font::TEXTURE_PADDING; @@ -430,6 +430,25 @@ static bool shouldCreateCommand(const Font::DrawCommand& command, const Font::Gl return command.texture != glyph.texture; } +struct PositionedGlyph +{ + const TextShaper::GlyphPosition* position; + const Font::Glyph* glyph; +}; + +static int glyphCompare(const void* a, const void* b) +{ + const auto* glyph = (const PositionedGlyph*)a; + const auto* other = (const PositionedGlyph*)b; + + const int result = glyph->glyph->sheet - other->glyph->sheet; + + if (result == 0) + return (int)glyph->glyph - (int)other->glyph; + + return result; +} + std::vector Font::GenerateVertices(const ColoredCodepoints& codepoints, Range range, const Color& color, std::vector& vertices, @@ -451,14 +470,30 @@ std::vector Font::GenerateVertices(const ColoredCodepoints& c int currentColorIndex = 0; int colorCount = colors.size(); + /* sort glyphs on 3DS beforehand */ + std::vector glyphs {}; + + { + for (int index = 0; index < (int)positions.size(); index++) + { + const auto& info = positions[index]; + const auto& glyph = this->FindGlyph(info.glyphIndex); + + glyphs.emplace_back(&info, &glyph); + } + } + + if (Console::Is(Console::CTR)) + std::qsort(glyphs.data(), glyphs.size(), sizeof(PositionedGlyph), glyphCompare); + std::vector commands {}; for (int index = 0; index < (int)positions.size(); index++) { - const auto& info = positions[index]; + const auto& info = *glyphs[index].position; uint32_t cacheId = this->textureCacheID; - const auto& glyph = this->FindGlyph(info.glyphIndex); + const auto& glyph = *glyphs[index].glyph; if (cacheId != this->textureCacheID) { @@ -514,15 +549,10 @@ std::vector Font::GenerateVertices(const ColoredCodepoints& c } const auto drawSort = [](const DrawCommand& left, const DrawCommand& right) -> bool { - if (Console::Is(Console::CTR)) - return left.sheet < right.sheet; + if (left.texture != right.texture) + return left.texture < right.texture; else - { - if (left.texture != right.texture) - return left.texture < right.texture; - else - return left.start < right.start; - } + return left.start < right.start; }; if (!Console::Is(Console::CTR)) @@ -647,17 +677,19 @@ std::vector Font::GenerateVerticesFormatted( return drawCommands; } -void Font::Printv(Graphics<>& graphics, const Matrix4& transform, - const std::vector& commands, const std::vector& vertices) +void Font::Render(Graphics<>& graphics, const Matrix4& transform, + const std::vector& drawCommands, const std::vector& vertices) { - if (vertices.empty() || commands.empty()) + if (vertices.empty() || drawCommands.empty()) return; Matrix4 matrix(graphics.GetTransform(), transform); - for (const auto& command : commands) + for (const auto& command : drawCommands) { - love::DrawCommand drawCommand(command.count); + /* total vertices for the quads */ + love::DrawCommand drawCommand(command.count); + if (!Console::Is(Console::CTR)) { drawCommand.shader = Shader<>::STANDARD_TEXTURE; @@ -666,12 +698,15 @@ void Font::Printv(Graphics<>& graphics, const Matrix4& transform, else drawCommand.format = CommonFormat::FONT; + /* texture to use - single texture */ drawCommand.handles = { command.texture }; - matrix.TransformXY(std::span(drawCommand.Positions().get(), command.count), - std::span(&vertices[command.start], command.count)); + const auto start = command.start; + const auto count = command.count; + + std::memcpy(drawCommand.Vertices().get(), &vertices[start], drawCommand.size); + matrix.TransformXY(drawCommand.GetVertices(), std::span(&vertices[start], count)); - drawCommand.FillVertices(&vertices[command.start]); Renderer::Instance().Render(drawCommand); } } @@ -685,7 +720,7 @@ void Font::Print(Graphics<>& graphics, const ColoredStrings& text, const Matrix4 std::vector vertices {}; auto commands = this->GenerateVertices(codepoints, Range(), color, vertices); - this->Printv(graphics, matrix, commands, vertices); + this->Render(graphics, matrix, commands, vertices); } void Font::Printf(Graphics<>& graphics, const ColoredStrings& text, float wrap, AlignMode alignment, @@ -697,7 +732,7 @@ void Font::Printf(Graphics<>& graphics, const ColoredStrings& text, float wrap, std::vector vertices {}; auto commands = this->GenerateVerticesFormatted(codepoints, color, wrap, alignment, vertices); - this->Printv(graphics, matrix, commands, vertices); + this->Render(graphics, matrix, commands, vertices); } #if !defined(__3DS__) diff --git a/source/objects/mesh/mesh.cpp b/source/objects/mesh/mesh.cpp index 6203a0bc..c59bee90 100644 --- a/source/objects/mesh/mesh.cpp +++ b/source/objects/mesh/mesh.cpp @@ -179,7 +179,8 @@ void Mesh::DrawInternal(Graphics& graphics, const Matrix4& matri // TODO what do we do? if (indirectArgs != nullptr) - {} + { + } if (this->mode == PRIMITIVE_TRIANGLE_FAN && this->useIndexBuffer && !this->indexBuffer.empty()) { @@ -202,7 +203,7 @@ void Mesh::DrawInternal(Graphics& graphics, const Matrix4& matri if (range.isValid()) _range.intersect(range); - DrawCommand command(_range.getSize(), this->mode); + DrawCommand command(_range.getSize(), this->mode); command.FillVertices(this->buffer.data()); transform.TransformXYPure(std::span(command.vertices.get(), command.count), diff --git a/source/objects/spritebatch/spritebatch.cpp b/source/objects/spritebatch/spritebatch.cpp index 9307efa9..faaf1d67 100644 --- a/source/objects/spritebatch/spritebatch.cpp +++ b/source/objects/spritebatch/spritebatch.cpp @@ -78,7 +78,7 @@ int SpriteBatch::Add(Quad* quad, const Matrix4& matrix, int index) 1 2 */ - std::array textureVertices = + std::array textureVertices = { /* x y z u v */ Vertex {{ quadPositions[0].x, quadPositions[0].y, 0.0f }, color, { textureCoords[0].x, textureCoords[0].y }}, @@ -245,7 +245,7 @@ void SpriteBatch::Draw(Graphics& graphics, const Matrix4& matrix if (Console::Is(Console::CTR)) shaderType = Shader<>::STANDARD_DEFAULT; - DrawCommand command(count * 0x06, PRIMITIVE_TRIANGLES, shaderType); + DrawCommand command(count * 0x06, PRIMITIVE_TRIANGLES, shaderType); command.format = CommonFormat::TEXTURE; #if defined(__3DS__) diff --git a/source/objects/textbatch/textbatch.cpp b/source/objects/textbatch/textbatch.cpp index db5bd798..e76f3322 100644 --- a/source/objects/textbatch/textbatch.cpp +++ b/source/objects/textbatch/textbatch.cpp @@ -215,7 +215,7 @@ void TextBatch::Draw(Graphics& graphics, const Matrix4& matrix) for (const auto& command : drawCommands) { - love::DrawCommand drawCommand(command.count); + love::DrawCommand drawCommand(command.count); if (!Console::Is(Console::CTR)) { diff --git a/source/utilities/driver/renderer/polyline/polyline.cpp b/source/utilities/driver/renderer/polyline/polyline.cpp index 043ff4e6..4e08c2da 100644 --- a/source/utilities/driver/renderer/polyline/polyline.cpp +++ b/source/utilities/driver/renderer/polyline/polyline.cpp @@ -192,7 +192,7 @@ void Polyline::draw(Graphics* gfx) if (this->triangle_mode == vertex::TRIANGLE_QUADS) mode = vertex::PRIMITIVE_QUADS; - DrawCommand command(totalVertices, mode); + DrawCommand command(totalVertices, mode); if (is2D) t.TransformXY(std::span(command.Positions().get(), totalVertices), diff --git a/source/utilities/shaper/genericshaper.cpp b/source/utilities/shaper/genericshaper.cpp index d657abec..82635f23 100644 --- a/source/utilities/shaper/genericshaper.cpp +++ b/source/utilities/shaper/genericshaper.cpp @@ -14,7 +14,7 @@ void GenericShaper::ComputeGlyphPositions(const ColoredCodepoints& codepoints, R std::vector* positions, std::vector* colors, TextInfo* info) { - if (!range.isValid() && !codepoints.cps.empty()) + if (!range.isValid()) range = Range(0, codepoints.cps.size()); if (this->rasterizers[0]->GetDataType() == Rasterizer::DATA_TRUETYPE)