summaryrefslogtreecommitdiffstats
path: root/src/video_core/renderer_opengl/gl_resource_manager.h
diff options
context:
space:
mode:
authorEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2016-09-18 02:38:01 +0200
committerEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2016-09-18 02:38:01 +0200
commitdc8479928c5aee4c6ad6fe4f59006fb604cee701 (patch)
tree569a7f13128450bbab973236615587ff00bced5f /src/video_core/renderer_opengl/gl_resource_manager.h
parentTravis: Import Dolphin’s clang-format hook. (diff)
downloadyuzu-dc8479928c5aee4c6ad6fe4f59006fb604cee701.tar
yuzu-dc8479928c5aee4c6ad6fe4f59006fb604cee701.tar.gz
yuzu-dc8479928c5aee4c6ad6fe4f59006fb604cee701.tar.bz2
yuzu-dc8479928c5aee4c6ad6fe4f59006fb604cee701.tar.lz
yuzu-dc8479928c5aee4c6ad6fe4f59006fb604cee701.tar.xz
yuzu-dc8479928c5aee4c6ad6fe4f59006fb604cee701.tar.zst
yuzu-dc8479928c5aee4c6ad6fe4f59006fb604cee701.zip
Diffstat (limited to 'src/video_core/renderer_opengl/gl_resource_manager.h')
-rw-r--r--src/video_core/renderer_opengl/gl_resource_manager.h114
1 files changed, 84 insertions, 30 deletions
diff --git a/src/video_core/renderer_opengl/gl_resource_manager.h b/src/video_core/renderer_opengl/gl_resource_manager.h
index eb128966c..2f40eb646 100644
--- a/src/video_core/renderer_opengl/gl_resource_manager.h
+++ b/src/video_core/renderer_opengl/gl_resource_manager.h
@@ -16,19 +16,28 @@
class OGLTexture : private NonCopyable {
public:
OGLTexture() = default;
- OGLTexture(OGLTexture&& o) { std::swap(handle, o.handle); }
- ~OGLTexture() { Release(); }
- OGLTexture& operator=(OGLTexture&& o) { std::swap(handle, o.handle); return *this; }
+ OGLTexture(OGLTexture&& o) {
+ std::swap(handle, o.handle);
+ }
+ ~OGLTexture() {
+ Release();
+ }
+ OGLTexture& operator=(OGLTexture&& o) {
+ std::swap(handle, o.handle);
+ return *this;
+ }
/// Creates a new internal OpenGL resource and stores the handle
void Create() {
- if (handle != 0) return;
+ if (handle != 0)
+ return;
glGenTextures(1, &handle);
}
/// Deletes the internal OpenGL resource
void Release() {
- if (handle == 0) return;
+ if (handle == 0)
+ return;
glDeleteTextures(1, &handle);
OpenGLState::ResetTexture(handle);
handle = 0;
@@ -40,19 +49,28 @@ public:
class OGLSampler : private NonCopyable {
public:
OGLSampler() = default;
- OGLSampler(OGLSampler&& o) { std::swap(handle, o.handle); }
- ~OGLSampler() { Release(); }
- OGLSampler& operator=(OGLSampler&& o) { std::swap(handle, o.handle); return *this; }
+ OGLSampler(OGLSampler&& o) {
+ std::swap(handle, o.handle);
+ }
+ ~OGLSampler() {
+ Release();
+ }
+ OGLSampler& operator=(OGLSampler&& o) {
+ std::swap(handle, o.handle);
+ return *this;
+ }
/// Creates a new internal OpenGL resource and stores the handle
void Create() {
- if (handle != 0) return;
+ if (handle != 0)
+ return;
glGenSamplers(1, &handle);
}
/// Deletes the internal OpenGL resource
void Release() {
- if (handle == 0) return;
+ if (handle == 0)
+ return;
glDeleteSamplers(1, &handle);
OpenGLState::ResetSampler(handle);
handle = 0;
@@ -64,19 +82,28 @@ public:
class OGLShader : private NonCopyable {
public:
OGLShader() = default;
- OGLShader(OGLShader&& o) { std::swap(handle, o.handle); }
- ~OGLShader() { Release(); }
- OGLShader& operator=(OGLShader&& o) { std::swap(handle, o.handle); return *this; }
+ OGLShader(OGLShader&& o) {
+ std::swap(handle, o.handle);
+ }
+ ~OGLShader() {
+ Release();
+ }
+ OGLShader& operator=(OGLShader&& o) {
+ std::swap(handle, o.handle);
+ return *this;
+ }
/// Creates a new internal OpenGL resource and stores the handle
void Create(const char* vert_shader, const char* frag_shader) {
- if (handle != 0) return;
+ if (handle != 0)
+ return;
handle = GLShader::LoadProgram(vert_shader, frag_shader);
}
/// Deletes the internal OpenGL resource
void Release() {
- if (handle == 0) return;
+ if (handle == 0)
+ return;
glDeleteProgram(handle);
OpenGLState::ResetProgram(handle);
handle = 0;
@@ -88,19 +115,28 @@ public:
class OGLBuffer : private NonCopyable {
public:
OGLBuffer() = default;
- OGLBuffer(OGLBuffer&& o) { std::swap(handle, o.handle); }
- ~OGLBuffer() { Release(); }
- OGLBuffer& operator=(OGLBuffer&& o) { std::swap(handle, o.handle); return *this; }
+ OGLBuffer(OGLBuffer&& o) {
+ std::swap(handle, o.handle);
+ }
+ ~OGLBuffer() {
+ Release();
+ }
+ OGLBuffer& operator=(OGLBuffer&& o) {
+ std::swap(handle, o.handle);
+ return *this;
+ }
/// Creates a new internal OpenGL resource and stores the handle
void Create() {
- if (handle != 0) return;
+ if (handle != 0)
+ return;
glGenBuffers(1, &handle);
}
/// Deletes the internal OpenGL resource
void Release() {
- if (handle == 0) return;
+ if (handle == 0)
+ return;
glDeleteBuffers(1, &handle);
OpenGLState::ResetBuffer(handle);
handle = 0;
@@ -112,19 +148,28 @@ public:
class OGLVertexArray : private NonCopyable {
public:
OGLVertexArray() = default;
- OGLVertexArray(OGLVertexArray&& o) { std::swap(handle, o.handle); }
- ~OGLVertexArray() { Release(); }
- OGLVertexArray& operator=(OGLVertexArray&& o) { std::swap(handle, o.handle); return *this; }
+ OGLVertexArray(OGLVertexArray&& o) {
+ std::swap(handle, o.handle);
+ }
+ ~OGLVertexArray() {
+ Release();
+ }
+ OGLVertexArray& operator=(OGLVertexArray&& o) {
+ std::swap(handle, o.handle);
+ return *this;
+ }
/// Creates a new internal OpenGL resource and stores the handle
void Create() {
- if (handle != 0) return;
+ if (handle != 0)
+ return;
glGenVertexArrays(1, &handle);
}
/// Deletes the internal OpenGL resource
void Release() {
- if (handle == 0) return;
+ if (handle == 0)
+ return;
glDeleteVertexArrays(1, &handle);
OpenGLState::ResetVertexArray(handle);
handle = 0;
@@ -136,19 +181,28 @@ public:
class OGLFramebuffer : private NonCopyable {
public:
OGLFramebuffer() = default;
- OGLFramebuffer(OGLFramebuffer&& o) { std::swap(handle, o.handle); }
- ~OGLFramebuffer() { Release(); }
- OGLFramebuffer& operator=(OGLFramebuffer&& o) { std::swap(handle, o.handle); return *this; }
+ OGLFramebuffer(OGLFramebuffer&& o) {
+ std::swap(handle, o.handle);
+ }
+ ~OGLFramebuffer() {
+ Release();
+ }
+ OGLFramebuffer& operator=(OGLFramebuffer&& o) {
+ std::swap(handle, o.handle);
+ return *this;
+ }
/// Creates a new internal OpenGL resource and stores the handle
void Create() {
- if (handle != 0) return;
+ if (handle != 0)
+ return;
glGenFramebuffers(1, &handle);
}
/// Deletes the internal OpenGL resource
void Release() {
- if (handle == 0) return;
+ if (handle == 0)
+ return;
glDeleteFramebuffers(1, &handle);
OpenGLState::ResetFramebuffer(handle);
handle = 0;