diff options
| author | 2018-04-20 20:03:57 -0400 | |
|---|---|---|
| committer | 2018-04-20 20:04:00 -0400 | |
| commit | ab71997b2cc104b06cae1d50ee80a1600cab7662 (patch) | |
| tree | ff0c19b0f8f70e6306f9d0b754c16c5390d28023 /src | |
| parent | Merge pull request #340 from mailwl/vi-update (diff) | |
| download | yuzu-ab71997b2cc104b06cae1d50ee80a1600cab7662.tar.gz yuzu-ab71997b2cc104b06cae1d50ee80a1600cab7662.tar.xz yuzu-ab71997b2cc104b06cae1d50ee80a1600cab7662.zip | |
gl_resource_manager: Add missing noexcept specifiers to move constructors and assignment operators
Standard library containers may use std::move_if_noexcept to perform
move operations. If a move cannot be performed under these
circumstances, then a copy is attempted. Given we only intend for these
types to be move-only this can be somewhat problematic. By defining
these to be noexcept we prevent cases where copies may be attempted.
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/renderer_opengl/gl_resource_manager.h | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/src/video_core/renderer_opengl/gl_resource_manager.h b/src/video_core/renderer_opengl/gl_resource_manager.h index 2f0e7ac1a..93f9172e7 100644 --- a/src/video_core/renderer_opengl/gl_resource_manager.h +++ b/src/video_core/renderer_opengl/gl_resource_manager.h | |||
| @@ -14,13 +14,13 @@ class OGLTexture : private NonCopyable { | |||
| 14 | public: | 14 | public: |
| 15 | OGLTexture() = default; | 15 | OGLTexture() = default; |
| 16 | 16 | ||
| 17 | OGLTexture(OGLTexture&& o) : handle(std::exchange(o.handle, 0)) {} | 17 | OGLTexture(OGLTexture&& o) noexcept : handle(std::exchange(o.handle, 0)) {} |
| 18 | 18 | ||
| 19 | ~OGLTexture() { | 19 | ~OGLTexture() { |
| 20 | Release(); | 20 | Release(); |
| 21 | } | 21 | } |
| 22 | 22 | ||
| 23 | OGLTexture& operator=(OGLTexture&& o) { | 23 | OGLTexture& operator=(OGLTexture&& o) noexcept { |
| 24 | Release(); | 24 | Release(); |
| 25 | handle = std::exchange(o.handle, 0); | 25 | handle = std::exchange(o.handle, 0); |
| 26 | return *this; | 26 | return *this; |
| @@ -49,13 +49,13 @@ class OGLSampler : private NonCopyable { | |||
| 49 | public: | 49 | public: |
| 50 | OGLSampler() = default; | 50 | OGLSampler() = default; |
| 51 | 51 | ||
| 52 | OGLSampler(OGLSampler&& o) : handle(std::exchange(o.handle, 0)) {} | 52 | OGLSampler(OGLSampler&& o) noexcept : handle(std::exchange(o.handle, 0)) {} |
| 53 | 53 | ||
| 54 | ~OGLSampler() { | 54 | ~OGLSampler() { |
| 55 | Release(); | 55 | Release(); |
| 56 | } | 56 | } |
| 57 | 57 | ||
| 58 | OGLSampler& operator=(OGLSampler&& o) { | 58 | OGLSampler& operator=(OGLSampler&& o) noexcept { |
| 59 | Release(); | 59 | Release(); |
| 60 | handle = std::exchange(o.handle, 0); | 60 | handle = std::exchange(o.handle, 0); |
| 61 | return *this; | 61 | return *this; |
| @@ -84,13 +84,13 @@ class OGLShader : private NonCopyable { | |||
| 84 | public: | 84 | public: |
| 85 | OGLShader() = default; | 85 | OGLShader() = default; |
| 86 | 86 | ||
| 87 | OGLShader(OGLShader&& o) : handle(std::exchange(o.handle, 0)) {} | 87 | OGLShader(OGLShader&& o) noexcept : handle(std::exchange(o.handle, 0)) {} |
| 88 | 88 | ||
| 89 | ~OGLShader() { | 89 | ~OGLShader() { |
| 90 | Release(); | 90 | Release(); |
| 91 | } | 91 | } |
| 92 | 92 | ||
| 93 | OGLShader& operator=(OGLShader&& o) { | 93 | OGLShader& operator=(OGLShader&& o) noexcept { |
| 94 | Release(); | 94 | Release(); |
| 95 | handle = std::exchange(o.handle, 0); | 95 | handle = std::exchange(o.handle, 0); |
| 96 | return *this; | 96 | return *this; |
| @@ -118,13 +118,13 @@ class OGLProgram : private NonCopyable { | |||
| 118 | public: | 118 | public: |
| 119 | OGLProgram() = default; | 119 | OGLProgram() = default; |
| 120 | 120 | ||
| 121 | OGLProgram(OGLProgram&& o) : handle(std::exchange(o.handle, 0)) {} | 121 | OGLProgram(OGLProgram&& o) noexcept : handle(std::exchange(o.handle, 0)) {} |
| 122 | 122 | ||
| 123 | ~OGLProgram() { | 123 | ~OGLProgram() { |
| 124 | Release(); | 124 | Release(); |
| 125 | } | 125 | } |
| 126 | 126 | ||
| 127 | OGLProgram& operator=(OGLProgram&& o) { | 127 | OGLProgram& operator=(OGLProgram&& o) noexcept { |
| 128 | Release(); | 128 | Release(); |
| 129 | handle = std::exchange(o.handle, 0); | 129 | handle = std::exchange(o.handle, 0); |
| 130 | return *this; | 130 | return *this; |
| @@ -165,13 +165,12 @@ public: | |||
| 165 | class OGLPipeline : private NonCopyable { | 165 | class OGLPipeline : private NonCopyable { |
| 166 | public: | 166 | public: |
| 167 | OGLPipeline() = default; | 167 | OGLPipeline() = default; |
| 168 | OGLPipeline(OGLPipeline&& o) { | 168 | OGLPipeline(OGLPipeline&& o) noexcept : handle{std::exchange<GLuint>(o.handle, 0)} {} |
| 169 | handle = std::exchange<GLuint>(o.handle, 0); | 169 | |
| 170 | } | ||
| 171 | ~OGLPipeline() { | 170 | ~OGLPipeline() { |
| 172 | Release(); | 171 | Release(); |
| 173 | } | 172 | } |
| 174 | OGLPipeline& operator=(OGLPipeline&& o) { | 173 | OGLPipeline& operator=(OGLPipeline&& o) noexcept { |
| 175 | handle = std::exchange<GLuint>(o.handle, 0); | 174 | handle = std::exchange<GLuint>(o.handle, 0); |
| 176 | return *this; | 175 | return *this; |
| 177 | } | 176 | } |
| @@ -199,13 +198,13 @@ class OGLBuffer : private NonCopyable { | |||
| 199 | public: | 198 | public: |
| 200 | OGLBuffer() = default; | 199 | OGLBuffer() = default; |
| 201 | 200 | ||
| 202 | OGLBuffer(OGLBuffer&& o) : handle(std::exchange(o.handle, 0)) {} | 201 | OGLBuffer(OGLBuffer&& o) noexcept : handle(std::exchange(o.handle, 0)) {} |
| 203 | 202 | ||
| 204 | ~OGLBuffer() { | 203 | ~OGLBuffer() { |
| 205 | Release(); | 204 | Release(); |
| 206 | } | 205 | } |
| 207 | 206 | ||
| 208 | OGLBuffer& operator=(OGLBuffer&& o) { | 207 | OGLBuffer& operator=(OGLBuffer&& o) noexcept { |
| 209 | Release(); | 208 | Release(); |
| 210 | handle = std::exchange(o.handle, 0); | 209 | handle = std::exchange(o.handle, 0); |
| 211 | return *this; | 210 | return *this; |
| @@ -234,12 +233,12 @@ class OGLSync : private NonCopyable { | |||
| 234 | public: | 233 | public: |
| 235 | OGLSync() = default; | 234 | OGLSync() = default; |
| 236 | 235 | ||
| 237 | OGLSync(OGLSync&& o) : handle(std::exchange(o.handle, nullptr)) {} | 236 | OGLSync(OGLSync&& o) noexcept : handle(std::exchange(o.handle, nullptr)) {} |
| 238 | 237 | ||
| 239 | ~OGLSync() { | 238 | ~OGLSync() { |
| 240 | Release(); | 239 | Release(); |
| 241 | } | 240 | } |
| 242 | OGLSync& operator=(OGLSync&& o) { | 241 | OGLSync& operator=(OGLSync&& o) noexcept { |
| 243 | Release(); | 242 | Release(); |
| 244 | handle = std::exchange(o.handle, nullptr); | 243 | handle = std::exchange(o.handle, nullptr); |
| 245 | return *this; | 244 | return *this; |
| @@ -267,13 +266,13 @@ class OGLVertexArray : private NonCopyable { | |||
| 267 | public: | 266 | public: |
| 268 | OGLVertexArray() = default; | 267 | OGLVertexArray() = default; |
| 269 | 268 | ||
| 270 | OGLVertexArray(OGLVertexArray&& o) : handle(std::exchange(o.handle, 0)) {} | 269 | OGLVertexArray(OGLVertexArray&& o) noexcept : handle(std::exchange(o.handle, 0)) {} |
| 271 | 270 | ||
| 272 | ~OGLVertexArray() { | 271 | ~OGLVertexArray() { |
| 273 | Release(); | 272 | Release(); |
| 274 | } | 273 | } |
| 275 | 274 | ||
| 276 | OGLVertexArray& operator=(OGLVertexArray&& o) { | 275 | OGLVertexArray& operator=(OGLVertexArray&& o) noexcept { |
| 277 | Release(); | 276 | Release(); |
| 278 | handle = std::exchange(o.handle, 0); | 277 | handle = std::exchange(o.handle, 0); |
| 279 | return *this; | 278 | return *this; |
| @@ -302,13 +301,13 @@ class OGLFramebuffer : private NonCopyable { | |||
| 302 | public: | 301 | public: |
| 303 | OGLFramebuffer() = default; | 302 | OGLFramebuffer() = default; |
| 304 | 303 | ||
| 305 | OGLFramebuffer(OGLFramebuffer&& o) : handle(std::exchange(o.handle, 0)) {} | 304 | OGLFramebuffer(OGLFramebuffer&& o) noexcept : handle(std::exchange(o.handle, 0)) {} |
| 306 | 305 | ||
| 307 | ~OGLFramebuffer() { | 306 | ~OGLFramebuffer() { |
| 308 | Release(); | 307 | Release(); |
| 309 | } | 308 | } |
| 310 | 309 | ||
| 311 | OGLFramebuffer& operator=(OGLFramebuffer&& o) { | 310 | OGLFramebuffer& operator=(OGLFramebuffer&& o) noexcept { |
| 312 | Release(); | 311 | Release(); |
| 313 | handle = std::exchange(o.handle, 0); | 312 | handle = std::exchange(o.handle, 0); |
| 314 | return *this; | 313 | return *this; |