[nostalgia/core/userland] Cleanup

This commit is contained in:
Gary Talent 2021-05-03 13:38:12 -04:00
parent 18491dafd9
commit 239f4d149d
2 changed files with 13 additions and 10 deletions

View File

@ -9,6 +9,7 @@
#include <array>
#include <ox/std/assert.hpp>
#include <ox/std/bstring.hpp>
#include <ox/std/trace.hpp>
#include "glutils.hpp"
@ -41,9 +42,9 @@ static ox::Result<Shader> buildShader(GLuint shaderType, const GLchar *src, cons
GLint status;
glGetShaderiv(shader, GL_COMPILE_STATUS, &status);
if (status != GL_TRUE) {
std::array<char, 1000> errMsg;
glGetShaderInfoLog(shader, errMsg.size(), nullptr, errMsg.data());
oxErrorf("shader compile error in {}: {}", shaderName, errMsg.data());
ox::BString<1000> errMsg;
glGetShaderInfoLog(shader, errMsg.cap(), nullptr, errMsg.data());
oxErrorf("shader compile error in {}: {}", shaderName, errMsg);
return OxError(1, "shader compile error");
}
return ox::move(shader);

View File

@ -53,11 +53,11 @@ struct GLobject: public Base {
constexpr GLobject() noexcept = default;
explicit constexpr GLobject(GLuint id) {
explicit constexpr GLobject(GLuint id) noexcept {
this->id = id;
}
constexpr GLobject(GLobject &&o): Base(ox::move(o)) {
constexpr GLobject(GLobject &&o) noexcept: Base(ox::move(o)) {
id = o.id;
o.id = 0;
}
@ -66,11 +66,13 @@ struct GLobject: public Base {
del(id);
}
GLobject &operator=(GLobject &&o) {
this->~GLobject();
Base::operator=(ox::move(o));
id = o.id;
o.id = 0;
GLobject &operator=(GLobject &&o) noexcept {
if (this != &o) {
del(id);
Base::operator=(ox::move(o));
id = o.id;
o.id = 0;
}
return *this;
}