summaryrefslogtreecommitdiff
path: root/gfx
diff options
context:
space:
mode:
Diffstat (limited to 'gfx')
-rw-r--r--gfx/gl/program.cpp3
-rw-r--r--gfx/gl/shader.cpp3
-rw-r--r--gfx/image.cpp6
3 files changed, 8 insertions, 4 deletions
diff --git a/gfx/gl/program.cpp b/gfx/gl/program.cpp
index 0b60eaa..7287fde 100644
--- a/gfx/gl/program.cpp
+++ b/gfx/gl/program.cpp
@@ -1,5 +1,6 @@
#include "program.h"
#include "shader.h"
+#include <format>
#include <glm/gtc/type_ptr.hpp>
#include <glm/gtx/transform.hpp>
#include <location.h>
@@ -30,6 +31,6 @@ Program::RequiredUniformLocation::RequiredUniformLocation(GLuint program, const
UniformLocation {program, name}
{
if (location < 0) {
- throw std::logic_error(std::string {"Required uniform does not exist: "} + name);
+ throw std::logic_error {std::format("Required uniform does not exist: {}", name)};
}
}
diff --git a/gfx/gl/shader.cpp b/gfx/gl/shader.cpp
index 0f75817..0bc127a 100644
--- a/gfx/gl/shader.cpp
+++ b/gfx/gl/shader.cpp
@@ -1,6 +1,7 @@
#include "shader.h"
#include <algorithm>
#include <array>
+#include <format>
#include <stdexcept>
#include <string>
@@ -70,6 +71,6 @@ Shader::CheckShaderError(GLuint shader, GLuint flag, bool isProgram, std::string
glGetShaderInfoLog(shader, error.size(), nullptr, error.data());
}
- throw std::runtime_error {std::string {errorMessage} + ": '" + std::string {error.data(), error.size()} + "'"};
+ throw std::runtime_error {std::format("{}: '{}'", errorMessage, error.data())};
}
}
diff --git a/gfx/image.cpp b/gfx/image.cpp
index fb86cb6..3b63054 100644
--- a/gfx/image.cpp
+++ b/gfx/image.cpp
@@ -1,5 +1,6 @@
#include "image.h"
#include <cstddef>
+#include <format>
#include <stb/stb_image.h>
#include <stdexcept>
@@ -13,7 +14,7 @@ Image::Image(const char * fileName, int flags) : width {}, height {}, numCompone
numComponents = static_cast<unsigned int>(nc);
if (!bytes) {
- throw std::runtime_error {std::string {"Unable to load image: "} + fileName};
+ throw std::runtime_error {std::format("Unable to load image: {}", fileName)};
}
data = {bytes, static_cast<size_t>(width * height * numComponents)};
@@ -29,7 +30,8 @@ Image::Image(std::span<unsigned char> buffer, int flags)
numComponents = static_cast<unsigned int>(nc);
if (!bytes) {
- throw std::runtime_error {"Unable to load image from memory buffer "};
+ throw std::runtime_error {std::format("Unable to load image from memory buffer @ {} ({} bytes)",
+ static_cast<void *>(buffer.data()), buffer.size_bytes())};
}
data = {bytes, static_cast<size_t>(width * height * numComponents)};