chore: make yuzu REUSE compliant
[REUSE] is a specification that aims at making file copyright
information consistent, so that it can be both human and machine
readable. It basically requires that all files have a header containing
copyright and licensing information. When this isn't possible, like
when dealing with binary assets, generated files or embedded third-party
dependencies, it is permitted to insert copyright information in the
`.reuse/dep5` file.
Oh, and it also requires that all the licenses used in the project are
present in the `LICENSES` folder, that's why the diff is so huge.
This can be done automatically with `reuse download --all`.
The `reuse` tool also contains a handy subcommand that analyzes the
project and tells whether or not the project is (still) compliant,
`reuse lint`.
Following REUSE has a few advantages over the current approach:
- Copyright information is easy to access for users / downstream
- Files like `dist/license.md` do not need to exist anymore, as
`.reuse/dep5` is used instead
- `reuse lint` makes it easy to ensure that copyright information of
files like binary assets / images is always accurate and up to date
To add copyright information of files that didn't have it I looked up
who committed what and when, for each file. As yuzu contributors do not
have to sign a CLA or similar I couldn't assume that copyright ownership
was of the "yuzu Emulator Project", so I used the name and/or email of
the commit author instead.
[REUSE]: https://reuse.software
Follow-up to 01cf05bc75b1e47beb08937439f3ed9339e7b254
2022-05-15 02:06:02 +02:00
|
|
|
// SPDX-FileCopyrightText: 2015 Citra Emulator Project
|
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2015-05-19 06:21:33 +02:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2020-08-24 02:23:54 +02:00
|
|
|
#include <string_view>
|
2015-07-26 11:38:19 +02:00
|
|
|
#include <utility>
|
2015-08-30 08:37:42 +02:00
|
|
|
#include <glad/glad.h>
|
2022-02-02 18:59:36 +01:00
|
|
|
#include "common/common_funcs.h"
|
2015-05-19 06:21:33 +02:00
|
|
|
|
2018-08-21 10:18:27 +02:00
|
|
|
namespace OpenGL {
|
|
|
|
|
2022-02-02 18:59:36 +01:00
|
|
|
class OGLRenderbuffer final {
|
2020-02-14 04:49:15 +01:00
|
|
|
public:
|
2022-02-02 18:59:36 +01:00
|
|
|
YUZU_NON_COPYABLE(OGLRenderbuffer);
|
|
|
|
|
2020-02-14 04:49:15 +01:00
|
|
|
OGLRenderbuffer() = default;
|
|
|
|
|
|
|
|
OGLRenderbuffer(OGLRenderbuffer&& o) noexcept : handle(std::exchange(o.handle, 0)) {}
|
|
|
|
|
|
|
|
~OGLRenderbuffer() {
|
|
|
|
Release();
|
|
|
|
}
|
|
|
|
|
|
|
|
OGLRenderbuffer& operator=(OGLRenderbuffer&& o) noexcept {
|
|
|
|
Release();
|
|
|
|
handle = std::exchange(o.handle, 0);
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Creates a new internal OpenGL resource and stores the handle
|
|
|
|
void Create();
|
|
|
|
|
|
|
|
/// Deletes the internal OpenGL resource
|
|
|
|
void Release();
|
|
|
|
|
|
|
|
GLuint handle = 0;
|
|
|
|
};
|
|
|
|
|
2022-02-02 18:59:36 +01:00
|
|
|
class OGLTexture final {
|
2015-05-19 06:21:33 +02:00
|
|
|
public:
|
2022-02-02 18:59:36 +01:00
|
|
|
YUZU_NON_COPYABLE(OGLTexture);
|
|
|
|
|
2015-07-26 11:38:19 +02:00
|
|
|
OGLTexture() = default;
|
2018-04-07 05:53:19 +02:00
|
|
|
|
2018-04-21 02:03:57 +02:00
|
|
|
OGLTexture(OGLTexture&& o) noexcept : handle(std::exchange(o.handle, 0)) {}
|
2018-04-07 05:53:19 +02:00
|
|
|
|
2016-09-18 02:38:01 +02:00
|
|
|
~OGLTexture() {
|
|
|
|
Release();
|
|
|
|
}
|
2018-04-07 05:53:19 +02:00
|
|
|
|
2018-04-21 02:03:57 +02:00
|
|
|
OGLTexture& operator=(OGLTexture&& o) noexcept {
|
2018-04-07 05:53:19 +02:00
|
|
|
Release();
|
|
|
|
handle = std::exchange(o.handle, 0);
|
2016-09-18 02:38:01 +02:00
|
|
|
return *this;
|
|
|
|
}
|
2015-05-19 06:21:33 +02:00
|
|
|
|
|
|
|
/// Creates a new internal OpenGL resource and stores the handle
|
2019-01-06 22:49:23 +01:00
|
|
|
void Create(GLenum target);
|
2015-05-19 06:21:33 +02:00
|
|
|
|
|
|
|
/// Deletes the internal OpenGL resource
|
2018-11-06 10:40:49 +01:00
|
|
|
void Release();
|
2015-05-19 06:21:33 +02:00
|
|
|
|
2015-07-26 11:38:19 +02:00
|
|
|
GLuint handle = 0;
|
2015-05-19 06:21:33 +02:00
|
|
|
};
|
|
|
|
|
2022-02-02 18:59:36 +01:00
|
|
|
class OGLTextureView final {
|
2019-05-07 16:55:44 +02:00
|
|
|
public:
|
2022-02-02 18:59:36 +01:00
|
|
|
YUZU_NON_COPYABLE(OGLTextureView);
|
|
|
|
|
2019-05-07 16:55:44 +02:00
|
|
|
OGLTextureView() = default;
|
|
|
|
|
|
|
|
OGLTextureView(OGLTextureView&& o) noexcept : handle(std::exchange(o.handle, 0)) {}
|
|
|
|
|
|
|
|
~OGLTextureView() {
|
|
|
|
Release();
|
|
|
|
}
|
|
|
|
|
|
|
|
OGLTextureView& operator=(OGLTextureView&& o) noexcept {
|
|
|
|
Release();
|
|
|
|
handle = std::exchange(o.handle, 0);
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Creates a new internal OpenGL resource and stores the handle
|
|
|
|
void Create();
|
|
|
|
|
|
|
|
/// Deletes the internal OpenGL resource
|
|
|
|
void Release();
|
|
|
|
|
|
|
|
GLuint handle = 0;
|
|
|
|
};
|
|
|
|
|
2022-02-02 18:59:36 +01:00
|
|
|
class OGLSampler final {
|
2015-08-30 13:41:28 +02:00
|
|
|
public:
|
2022-02-02 18:59:36 +01:00
|
|
|
YUZU_NON_COPYABLE(OGLSampler);
|
|
|
|
|
2015-08-30 13:41:28 +02:00
|
|
|
OGLSampler() = default;
|
2018-04-07 05:53:19 +02:00
|
|
|
|
2018-04-21 02:03:57 +02:00
|
|
|
OGLSampler(OGLSampler&& o) noexcept : handle(std::exchange(o.handle, 0)) {}
|
2018-04-07 05:53:19 +02:00
|
|
|
|
2016-09-18 02:38:01 +02:00
|
|
|
~OGLSampler() {
|
|
|
|
Release();
|
|
|
|
}
|
2018-04-07 05:53:19 +02:00
|
|
|
|
2018-04-21 02:03:57 +02:00
|
|
|
OGLSampler& operator=(OGLSampler&& o) noexcept {
|
2018-04-07 05:53:19 +02:00
|
|
|
Release();
|
|
|
|
handle = std::exchange(o.handle, 0);
|
2016-09-18 02:38:01 +02:00
|
|
|
return *this;
|
|
|
|
}
|
2015-08-30 13:41:28 +02:00
|
|
|
|
|
|
|
/// Creates a new internal OpenGL resource and stores the handle
|
2018-11-06 10:40:49 +01:00
|
|
|
void Create();
|
2015-08-30 13:41:28 +02:00
|
|
|
|
|
|
|
/// Deletes the internal OpenGL resource
|
2018-11-06 10:40:49 +01:00
|
|
|
void Release();
|
2015-08-30 13:41:28 +02:00
|
|
|
|
|
|
|
GLuint handle = 0;
|
|
|
|
};
|
|
|
|
|
2022-02-02 18:59:36 +01:00
|
|
|
class OGLShader final {
|
2015-05-19 06:21:33 +02:00
|
|
|
public:
|
2022-02-02 18:59:36 +01:00
|
|
|
YUZU_NON_COPYABLE(OGLShader);
|
|
|
|
|
2015-07-26 11:38:19 +02:00
|
|
|
OGLShader() = default;
|
2018-04-07 05:53:19 +02:00
|
|
|
|
2018-04-21 02:03:57 +02:00
|
|
|
OGLShader(OGLShader&& o) noexcept : handle(std::exchange(o.handle, 0)) {}
|
2018-04-07 05:53:19 +02:00
|
|
|
|
2016-09-18 02:38:01 +02:00
|
|
|
~OGLShader() {
|
|
|
|
Release();
|
|
|
|
}
|
2018-04-07 05:53:19 +02:00
|
|
|
|
2018-04-21 02:03:57 +02:00
|
|
|
OGLShader& operator=(OGLShader&& o) noexcept {
|
2018-04-07 05:53:19 +02:00
|
|
|
Release();
|
|
|
|
handle = std::exchange(o.handle, 0);
|
2016-09-18 02:38:01 +02:00
|
|
|
return *this;
|
|
|
|
}
|
2015-05-19 06:21:33 +02:00
|
|
|
|
2018-11-06 10:40:49 +01:00
|
|
|
void Release();
|
2018-04-07 05:53:19 +02:00
|
|
|
|
|
|
|
GLuint handle = 0;
|
|
|
|
};
|
|
|
|
|
2022-02-02 18:59:36 +01:00
|
|
|
class OGLProgram final {
|
2018-04-07 05:53:19 +02:00
|
|
|
public:
|
2022-02-02 18:59:36 +01:00
|
|
|
YUZU_NON_COPYABLE(OGLProgram);
|
|
|
|
|
2018-04-07 05:53:19 +02:00
|
|
|
OGLProgram() = default;
|
|
|
|
|
2018-04-21 02:03:57 +02:00
|
|
|
OGLProgram(OGLProgram&& o) noexcept : handle(std::exchange(o.handle, 0)) {}
|
2018-04-07 05:53:19 +02:00
|
|
|
|
|
|
|
~OGLProgram() {
|
|
|
|
Release();
|
|
|
|
}
|
|
|
|
|
2018-04-21 02:03:57 +02:00
|
|
|
OGLProgram& operator=(OGLProgram&& o) noexcept {
|
2018-04-07 05:53:19 +02:00
|
|
|
Release();
|
|
|
|
handle = std::exchange(o.handle, 0);
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
2015-05-19 06:21:33 +02:00
|
|
|
/// Deletes the internal OpenGL resource
|
2018-11-06 10:40:49 +01:00
|
|
|
void Release();
|
2018-03-19 22:20:49 +01:00
|
|
|
|
|
|
|
GLuint handle = 0;
|
|
|
|
};
|
|
|
|
|
2022-02-02 18:59:36 +01:00
|
|
|
class OGLAssemblyProgram final {
|
2020-05-18 03:32:49 +02:00
|
|
|
public:
|
2022-02-02 18:59:36 +01:00
|
|
|
YUZU_NON_COPYABLE(OGLAssemblyProgram);
|
|
|
|
|
2020-05-18 03:32:49 +02:00
|
|
|
OGLAssemblyProgram() = default;
|
|
|
|
|
|
|
|
OGLAssemblyProgram(OGLAssemblyProgram&& o) noexcept : handle(std::exchange(o.handle, 0)) {}
|
|
|
|
|
|
|
|
~OGLAssemblyProgram() {
|
|
|
|
Release();
|
|
|
|
}
|
|
|
|
|
2020-07-10 05:36:38 +02:00
|
|
|
OGLAssemblyProgram& operator=(OGLAssemblyProgram&& o) noexcept {
|
|
|
|
Release();
|
|
|
|
handle = std::exchange(o.handle, 0);
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
2020-05-18 03:32:49 +02:00
|
|
|
/// Deletes the internal OpenGL resource
|
|
|
|
void Release();
|
|
|
|
|
|
|
|
GLuint handle = 0;
|
|
|
|
};
|
|
|
|
|
2022-02-02 18:59:36 +01:00
|
|
|
class OGLPipeline final {
|
2018-03-19 22:20:49 +01:00
|
|
|
public:
|
2022-02-02 18:59:36 +01:00
|
|
|
YUZU_NON_COPYABLE(OGLPipeline);
|
|
|
|
|
2018-03-19 22:20:49 +01:00
|
|
|
OGLPipeline() = default;
|
2018-04-21 02:03:57 +02:00
|
|
|
OGLPipeline(OGLPipeline&& o) noexcept : handle{std::exchange<GLuint>(o.handle, 0)} {}
|
|
|
|
|
2018-03-19 22:20:49 +01:00
|
|
|
~OGLPipeline() {
|
|
|
|
Release();
|
|
|
|
}
|
2018-04-21 02:03:57 +02:00
|
|
|
OGLPipeline& operator=(OGLPipeline&& o) noexcept {
|
2018-03-19 22:20:49 +01:00
|
|
|
handle = std::exchange<GLuint>(o.handle, 0);
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Creates a new internal OpenGL resource and stores the handle
|
2018-11-06 10:40:49 +01:00
|
|
|
void Create();
|
2018-03-19 22:20:49 +01:00
|
|
|
|
|
|
|
/// Deletes the internal OpenGL resource
|
2018-11-06 10:40:49 +01:00
|
|
|
void Release();
|
2015-05-19 06:21:33 +02:00
|
|
|
|
2015-07-26 11:38:19 +02:00
|
|
|
GLuint handle = 0;
|
2015-05-19 06:21:33 +02:00
|
|
|
};
|
|
|
|
|
2022-02-02 18:59:36 +01:00
|
|
|
class OGLBuffer final {
|
2015-05-19 06:21:33 +02:00
|
|
|
public:
|
2022-02-02 18:59:36 +01:00
|
|
|
YUZU_NON_COPYABLE(OGLBuffer);
|
|
|
|
|
2015-07-26 11:38:19 +02:00
|
|
|
OGLBuffer() = default;
|
2018-04-07 05:53:19 +02:00
|
|
|
|
2018-04-21 02:03:57 +02:00
|
|
|
OGLBuffer(OGLBuffer&& o) noexcept : handle(std::exchange(o.handle, 0)) {}
|
2018-04-07 05:53:19 +02:00
|
|
|
|
2016-09-18 02:38:01 +02:00
|
|
|
~OGLBuffer() {
|
|
|
|
Release();
|
|
|
|
}
|
2018-04-07 05:53:19 +02:00
|
|
|
|
2018-04-21 02:03:57 +02:00
|
|
|
OGLBuffer& operator=(OGLBuffer&& o) noexcept {
|
2018-04-07 05:53:19 +02:00
|
|
|
Release();
|
|
|
|
handle = std::exchange(o.handle, 0);
|
2016-09-18 02:38:01 +02:00
|
|
|
return *this;
|
|
|
|
}
|
2015-05-19 06:21:33 +02:00
|
|
|
|
|
|
|
/// Creates a new internal OpenGL resource and stores the handle
|
2018-11-06 10:40:49 +01:00
|
|
|
void Create();
|
2015-05-19 06:21:33 +02:00
|
|
|
|
|
|
|
/// Deletes the internal OpenGL resource
|
2018-11-06 10:40:49 +01:00
|
|
|
void Release();
|
2015-05-19 06:21:33 +02:00
|
|
|
|
2015-07-26 11:38:19 +02:00
|
|
|
GLuint handle = 0;
|
2015-05-19 06:21:33 +02:00
|
|
|
};
|
|
|
|
|
2022-02-02 18:59:36 +01:00
|
|
|
class OGLSync final {
|
2018-03-19 22:20:49 +01:00
|
|
|
public:
|
2022-02-02 18:59:36 +01:00
|
|
|
YUZU_NON_COPYABLE(OGLSync);
|
|
|
|
|
2018-03-19 22:20:49 +01:00
|
|
|
OGLSync() = default;
|
|
|
|
|
2018-04-21 02:03:57 +02:00
|
|
|
OGLSync(OGLSync&& o) noexcept : handle(std::exchange(o.handle, nullptr)) {}
|
2018-03-19 22:20:49 +01:00
|
|
|
|
|
|
|
~OGLSync() {
|
|
|
|
Release();
|
|
|
|
}
|
2018-04-21 02:03:57 +02:00
|
|
|
OGLSync& operator=(OGLSync&& o) noexcept {
|
2018-03-19 22:20:49 +01:00
|
|
|
Release();
|
|
|
|
handle = std::exchange(o.handle, nullptr);
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Creates a new internal OpenGL resource and stores the handle
|
2018-11-06 10:40:49 +01:00
|
|
|
void Create();
|
2018-03-19 22:20:49 +01:00
|
|
|
|
|
|
|
/// Deletes the internal OpenGL resource
|
2018-11-06 10:40:49 +01:00
|
|
|
void Release();
|
2018-03-19 22:20:49 +01:00
|
|
|
|
2023-03-08 04:33:11 +01:00
|
|
|
/// Checks if the sync has been signaled
|
|
|
|
bool IsSignaled() const noexcept;
|
|
|
|
|
2018-03-19 22:20:49 +01:00
|
|
|
GLsync handle = 0;
|
|
|
|
};
|
|
|
|
|
2022-02-02 18:59:36 +01:00
|
|
|
class OGLFramebuffer final {
|
2015-05-19 06:21:33 +02:00
|
|
|
public:
|
2022-02-02 18:59:36 +01:00
|
|
|
YUZU_NON_COPYABLE(OGLFramebuffer);
|
|
|
|
|
2015-07-26 11:38:19 +02:00
|
|
|
OGLFramebuffer() = default;
|
2018-04-07 05:53:19 +02:00
|
|
|
|
2018-04-21 02:03:57 +02:00
|
|
|
OGLFramebuffer(OGLFramebuffer&& o) noexcept : handle(std::exchange(o.handle, 0)) {}
|
2018-04-07 05:53:19 +02:00
|
|
|
|
2016-09-18 02:38:01 +02:00
|
|
|
~OGLFramebuffer() {
|
|
|
|
Release();
|
|
|
|
}
|
2018-04-07 05:53:19 +02:00
|
|
|
|
2018-04-21 02:03:57 +02:00
|
|
|
OGLFramebuffer& operator=(OGLFramebuffer&& o) noexcept {
|
2018-04-07 05:53:19 +02:00
|
|
|
Release();
|
|
|
|
handle = std::exchange(o.handle, 0);
|
2016-09-18 02:38:01 +02:00
|
|
|
return *this;
|
|
|
|
}
|
2015-05-19 06:21:33 +02:00
|
|
|
|
|
|
|
/// Creates a new internal OpenGL resource and stores the handle
|
2018-11-06 10:40:49 +01:00
|
|
|
void Create();
|
2015-05-19 06:21:33 +02:00
|
|
|
|
|
|
|
/// Deletes the internal OpenGL resource
|
2018-11-06 10:40:49 +01:00
|
|
|
void Release();
|
2015-05-19 06:21:33 +02:00
|
|
|
|
2015-07-26 11:38:19 +02:00
|
|
|
GLuint handle = 0;
|
2015-05-19 06:21:33 +02:00
|
|
|
};
|
2018-08-21 10:18:27 +02:00
|
|
|
|
2022-02-02 18:59:36 +01:00
|
|
|
class OGLQuery final {
|
2019-07-27 06:21:14 +02:00
|
|
|
public:
|
2022-02-02 18:59:36 +01:00
|
|
|
YUZU_NON_COPYABLE(OGLQuery);
|
|
|
|
|
2019-07-27 06:21:14 +02:00
|
|
|
OGLQuery() = default;
|
|
|
|
|
|
|
|
OGLQuery(OGLQuery&& o) noexcept : handle(std::exchange(o.handle, 0)) {}
|
|
|
|
|
|
|
|
~OGLQuery() {
|
|
|
|
Release();
|
|
|
|
}
|
|
|
|
|
|
|
|
OGLQuery& operator=(OGLQuery&& o) noexcept {
|
|
|
|
Release();
|
|
|
|
handle = std::exchange(o.handle, 0);
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Creates a new internal OpenGL resource and stores the handle
|
|
|
|
void Create(GLenum target);
|
|
|
|
|
|
|
|
/// Deletes the internal OpenGL resource
|
|
|
|
void Release();
|
|
|
|
|
|
|
|
GLuint handle = 0;
|
|
|
|
};
|
|
|
|
|
2018-08-21 10:18:27 +02:00
|
|
|
} // namespace OpenGL
|