Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/build-appimage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ jobs:
qt6-base-dev qt6-base-dev-tools libqt6opengl6-dev libqt6websockets6-dev \
qt6-multimedia-dev libqt6multimedia6 qt6-svg-dev \
libgl1-mesa-dev qt6-wayland qtkeychain-qt6-dev build-essential mold git \
zlib1g-dev libssl-dev wget zsync fuse file cmake libxcb-cursor-dev
zlib1g-dev libssl-dev wget zsync fuse file cmake libxcb-cursor-dev gcc-12 g++-12
echo "CC=gcc-12" >> $GITHUB_ENV
echo "CXX=g++-12" >> $GITHUB_ENV

- name: Download linuxdeploy
run: |
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ jobs:
qt6-base-dev qt6-base-dev-tools libqt6opengl6-dev libqt6websockets6-dev \
qt6-multimedia-dev libqt6multimedia6 qt6-svg-dev \
libgl1-mesa-dev qtkeychain-qt6-dev build-essential cmake ninja-build mold git \
zlib1g-dev libssl-dev
zlib1g-dev libssl-dev gcc-14 g++-14
echo "QMAKESPEC=linux-g++" >> $GITHUB_ENV
echo "CC=gcc-12" >> $GITHUB_ENV
echo "CXX=g++-12" >> $GITHUB_ENV
echo "CC=gcc-14" >> $GITHUB_ENV
echo "CXX=g++-14" >> $GITHUB_ENV
echo "MMAPPER_CMAKE_EXTRA=-DUSE_MOLD=true -DPACKAGE_TYPE=Deb" >> $GITHUB_ENV

# Install Dependencies (Mac)
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@ jobs:
- if: runner.os == 'Linux' && matrix.compiler == 'gcc'
name: Install GCC for Ubuntu
run: |
sudo apt install -y gcc-13 g++-13 lcov
sudo apt install -y gcc-14 g++-14 lcov
echo "QMAKESPEC=linux-g++" >> $GITHUB_ENV
echo "CC=gcc-13" >> $GITHUB_ENV
echo "CXX=g++-13" >> $GITHUB_ENV
echo "CC=gcc-14" >> $GITHUB_ENV
echo "CXX=g++-14" >> $GITHUB_ENV
echo "MMAPPER_CMAKE_EXTRA=-DUSE_CODE_COVERAGE=true -DUSE_MOLD=true -DPACKAGE_TYPE=Deb" >> $GITHUB_ENV
echo "COVERAGE=true" >> $GITHUB_ENV
echo "GCOV_TOOL=gcov-13" >> $GITHUB_ENV
echo "GCOV_TOOL=gcov-14" >> $GITHUB_ENV
- if: runner.os == 'Linux' && matrix.compiler == 'clang'
name: Install Clang for Ubuntu
run: |
Expand Down
5 changes: 4 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1091,7 +1091,10 @@ if(WIN32)
endif()

# Bundle Library Files
set(WINDEPLOYQT_ARGS ${WINDEPLOYQT_ARGS} --compiler-runtime --no-translations --no-system-d3d-compiler --no-opengl-sw --verbose 1)
set(WINDEPLOYQT_ARGS ${WINDEPLOYQT_ARGS} --no-translations --no-system-d3d-compiler --no-opengl-sw --verbose 1)
if(MSVC OR (CMAKE_CXX_COMPILER_ID STREQUAL "GNU"))
list(APPEND WINDEPLOYQT_ARGS --compiler-runtime)
endif()
find_program(WINDEPLOYQT_APP windeployqt HINTS ${QTDIR} ENV QTDIR PATH_SUFFIXES .)
message(" - windeployqt path: ${WINDEPLOYQT_APP}")
message(" - windeployqt args: ${WINDEPLOYQT_ARGS}")
Expand Down
12 changes: 7 additions & 5 deletions src/display/Connections.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,7 @@ void ConnectionDrawer::drawConnectionLine(const ExitDirEnum startDir,
const float dstZ)
{
std::vector<glm::vec3> points{};
points.reserve(2);
ConnectionLineBuilder lb{points};
lb.drawConnLineStart(startDir, neighbours, srcZ);
if (points.empty()) {
Expand All @@ -482,7 +483,7 @@ void ConnectionDrawer::drawConnectionLine(const ExitDirEnum startDir,
drawLineStrip(points);
}

void ConnectionDrawer::drawLineStrip(const std::vector<glm::vec3> &points)
void ConnectionDrawer::drawLineStrip(const std::span<const glm::vec3> points)
{
getFakeGL().drawLineStrip(points);
}
Expand Down Expand Up @@ -661,6 +662,7 @@ void MapCanvas::paintNearbyConnectionPoints()
});

std::vector<ColorVert> points;
points.reserve(128);
const auto addPoint = [isSelection, &points](const Coordinate &roomCoord,
const RoomHandle &room,
const ExitDirEnum dir,
Expand Down Expand Up @@ -764,13 +766,13 @@ void MapCanvas::paintSelectedConnection()

{
std::vector<ColorVert> verts;
verts.reserve(4);
mmgl::generateLineQuadsSafe(verts, pos1, pos2, CONNECTION_LINE_WIDTH, Colors::red);
gl.renderColoredQuads(verts, rs);
}

std::vector<ColorVert> points;
points.emplace_back(Colors::red, pos1);
points.emplace_back(Colors::red, pos2);
const std::array<ColorVert, 2> points{ColorVert{Colors::red, pos1},
ColorVert{Colors::red, pos2}};
gl.renderPoints(points, rs.withPointSize(NEW_CONNECTION_POINT_SIZE));
}

Expand All @@ -793,7 +795,7 @@ void ConnectionDrawer::ConnectionFakeGL::drawTriangle(const glm::vec3 &a,
verts.emplace_back(color, c + m_offset);
}

void ConnectionDrawer::ConnectionFakeGL::drawLineStrip(const std::vector<glm::vec3> &points)
void ConnectionDrawer::ConnectionFakeGL::drawLineStrip(const std::span<const glm::vec3> points)
{
const auto transform = [this](const glm::vec3 &vert) { return vert + m_offset; };
const float extension = CONNECTION_LINE_WIDTH * 0.5f;
Expand Down
5 changes: 3 additions & 2 deletions src/display/Connections.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <algorithm>
#include <cassert>
#include <cstddef>
#include <span>
#include <unordered_map>
#include <vector>

Expand Down Expand Up @@ -144,7 +145,7 @@ struct NODISCARD ConnectionDrawer final

public:
void drawTriangle(const glm::vec3 &a, const glm::vec3 &b, const glm::vec3 &c);
void drawLineStrip(const std::vector<glm::vec3> &points);
void drawLineStrip(const std::span<const glm::vec3> points);
};

private:
Expand Down Expand Up @@ -182,7 +183,7 @@ struct NODISCARD ConnectionDrawer final
const RoomHandle &targetRoom,
ExitDirEnum targetDir);

void drawLineStrip(const std::vector<glm::vec3> &points);
void drawLineStrip(const std::span<const glm::vec3> points);

void drawConnection(const RoomHandle &leftRoom,
const RoomHandle &rightRoom,
Expand Down
2 changes: 1 addition & 1 deletion src/display/Infomarks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ void MapCanvas::paintNewInfomarkSelection()
const auto infomarksLineStyle = GLRenderState()
.withColor(Color{Qt::yellow})
.withLineParams(LineParams{INFOMARK_GUIDE_LINE_WIDTH});
const std::vector<glm::vec3> verts{glm::vec3{pos1, layer}, glm::vec3{pos2, layer}};
const std::array<glm::vec3, 2> verts{glm::vec3{pos1, layer}, glm::vec3{pos2, layer}};
gl.renderPlainLines(verts, infomarksLineStyle);
}
}
Expand Down
20 changes: 4 additions & 16 deletions src/display/mapcanvas_gl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -779,6 +779,7 @@ void MapCanvas::paintGL()

auto &font = getGLFont();
std::vector<GLText> text;
text.reserve(12);

const auto lineHeight = font.getFontHeight();
const float rightMargin = float(w) * dpr
Expand Down Expand Up @@ -879,7 +880,7 @@ void MapCanvas::paintSelectionArea()
= GLRenderState().withBlend(BlendModeEnum::TRANSPARENCY).withDepthFunction(std::nullopt);

{
const std::vector<glm::vec3> verts{A, B, C, D};
const std::array<glm::vec3, 4> verts{A, B, C, D};
const auto &fillStyle = rs;
gl.renderPlainQuads(verts, fillStyle.withColor(selBgColor));
}
Expand All @@ -888,21 +889,8 @@ void MapCanvas::paintSelectionArea()
{
static constexpr float SELECTION_AREA_LINE_WIDTH = 2.f;
const auto lineStyle = rs.withLineParams(LineParams{SELECTION_AREA_LINE_WIDTH});
const std::vector<glm::vec3> verts{A, B, B, C, C, D, D, A};

// FIXME: ASAN flags this as out-of-bounds memory access inside an assertion
//
// Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
//
// in QOpenGLFunctions::glDrawArrays(). However, it works without ASAN,
// so maybe the problem is in my OpenGL driver?
//
// "OpenGL Version:" "3.1 Mesa 20.2.6"
// "OpenGL Renderer:" "llvmpipe (LLVM 11.0.0, 256 bits)"
// "OpenGL Vendor:" "Mesa/X.org"
// "OpenGL GLSL:" "1.40"
// "Current OpenGL Context:" "3.1 (valid)"
//
const std::array<glm::vec3, 8> verts{A, B, B, C, C, D, D, A};

gl.renderPlainLines(verts, lineStyle.withColor(selFgColor));
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/global/ConfigConsts-Computed.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ static inline constexpr PackageEnum CURRENT_PACKAGE = [] {
throw std::runtime_error("unsupported package type");
}();

static inline constexpr PlatformEnum CURRENT_PLATFORM = std::invoke([]() consteval -> PlatformEnum {
static inline constexpr PlatformEnum CURRENT_PLATFORM = std::invoke([]() constexpr -> PlatformEnum {
#if defined(Q_OS_WIN)
return PlatformEnum::Windows;
#elif defined(Q_OS_MAC)
Expand All @@ -60,7 +60,7 @@ static inline constexpr PlatformEnum CURRENT_PLATFORM = std::invoke([]() constev
});

static inline constexpr EnvironmentEnum CURRENT_ENVIRONMENT = std::invoke(
[]() consteval -> EnvironmentEnum {
[]() constexpr -> EnvironmentEnum {
#if Q_PROCESSOR_WORDSIZE == 4
return EnvironmentEnum::Env32Bit;
#elif Q_PROCESSOR_WORDSIZE == 8
Expand Down
22 changes: 11 additions & 11 deletions src/opengl/Font.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,7 @@ void FontMetrics::getFontBatchRawData(const GLText *const text,
assert(output.size() == before + expectedVerts);
}

void GLFont::render2dTextImmediate(const std::vector<GLText> &text)
void GLFont::render2dTextImmediate(const std::span<const GLText> text)
{
if (text.empty()) {
return;
Expand All @@ -861,7 +861,7 @@ void GLFont::render2dTextImmediate(const std::vector<GLText> &text)
m_gl.setProjectionMatrix(oldProj);
}

void GLFont::render3dTextImmediate(const std::vector<FontVert3d> &rawVerts)
void GLFont::render3dTextImmediate(const std::span<const FontVert3d> rawVerts)
{
if (rawVerts.empty()) {
return;
Expand All @@ -870,7 +870,7 @@ void GLFont::render3dTextImmediate(const std::vector<FontVert3d> &rawVerts)
m_gl.renderFont3d(m_texture, rawVerts);
}

void GLFont::render3dTextImmediate(const std::vector<GLText> &text)
void GLFont::render3dTextImmediate(const std::span<const GLText> text)
{
if (text.empty()) {
return;
Expand All @@ -880,14 +880,14 @@ void GLFont::render3dTextImmediate(const std::vector<GLText> &text)
render3dTextImmediate(rawVerts);
}

std::vector<FontVert3d> GLFont::getFontMeshIntermediate(const std::vector<GLText> &text)
std::vector<FontVert3d> GLFont::getFontMeshIntermediate(const std::span<const GLText> text)
{
std::vector<FontVert3d> output;
getFontMetrics().getFontBatchRawData(text.data(), text.size(), output);
return output;
}

UniqueMesh GLFont::getFontMesh(const std::vector<FontVert3d> &rawVerts)
UniqueMesh GLFont::getFontMesh(const std::span<const FontVert3d> rawVerts)
{
return m_gl.createFontMesh(m_texture, DrawModeEnum::QUADS, rawVerts);
}
Expand All @@ -898,10 +898,10 @@ void GLFont::renderTextCentered(const QString &text,
{
// here we're converting to latin1 because we cannot display unicode codepoints above 255
const auto center = glm::vec2{getScreenCenter()};
render2dTextImmediate(
std::vector<GLText>{GLText{glm::vec3{center, 0.f},
mmqt::toStdStringLatin1(text), // GL font is latin1
color,
bgcolor,
FontFormatFlags{FontFormatFlagEnum::HALIGN_CENTER}}});
const GLText glText{glm::vec3{center, 0.f},
mmqt::toStdStringLatin1(text), // GL font is latin1
color,
bgcolor,
FontFormatFlags{FontFormatFlagEnum::HALIGN_CENTER}};
render2dTextImmediate(std::span<const GLText>(&glText, 1));
}
11 changes: 6 additions & 5 deletions src/opengl/Font.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <cstddef>
#include <memory>
#include <optional>
#include <span>
#include <tuple>
#include <vector>

Expand Down Expand Up @@ -90,13 +91,13 @@ class NODISCARD GLFont final
void renderTextCentered(const QString &text,
Color color = {},
std::optional<Color> bgcolor = {});
void render2dTextImmediate(const std::vector<GLText> &text);
void render3dTextImmediate(const std::vector<GLText> &text);
void render3dTextImmediate(const std::vector<FontVert3d> &rawVerts);
void render2dTextImmediate(const std::span<const GLText> text);
void render3dTextImmediate(const std::span<const GLText> text);
void render3dTextImmediate(const std::span<const FontVert3d> rawVerts);

public:
NODISCARD std::vector<FontVert3d> getFontMeshIntermediate(const std::vector<GLText> &text);
NODISCARD UniqueMesh getFontMesh(const std::vector<FontVert3d> &text);
NODISCARD std::vector<FontVert3d> getFontMeshIntermediate(const std::span<const GLText> text);
NODISCARD UniqueMesh getFontMesh(const std::span<const FontVert3d> text);
};

extern void getFontBatchRawData(const FontMetrics &fm,
Expand Down
1 change: 1 addition & 0 deletions src/opengl/LineRendering.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

#include "../opengl/OpenGLTypes.h"

#include <span>
#include <vector>

#include <glm/glm.hpp>
Expand Down
Loading
Loading