From 68296d9474b828b42317ab0f99a2cd764017d240 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 6 Sep 2018 14:54:46 -0400 Subject: gl_buffer_cache: Make constructor explicit Implicit conversions during construction isn't desirable here. --- src/video_core/renderer_opengl/gl_buffer_cache.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/video_core') diff --git a/src/video_core/renderer_opengl/gl_buffer_cache.h b/src/video_core/renderer_opengl/gl_buffer_cache.h index 9c7ad27e6..33a6c0d69 100644 --- a/src/video_core/renderer_opengl/gl_buffer_cache.h +++ b/src/video_core/renderer_opengl/gl_buffer_cache.h @@ -31,7 +31,7 @@ struct CachedBufferEntry final { class OGLBufferCache final : public RasterizerCache> { public: - OGLBufferCache(size_t size); + explicit OGLBufferCache(size_t size); GLintptr UploadMemory(Tegra::GPUVAddr gpu_addr, size_t size, size_t alignment = 4, bool cache = true); -- cgit v1.2.3 From 14230fe2af492401ebc4b2b60be913a784beb7fa Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 6 Sep 2018 14:57:40 -0400 Subject: gl_buffer_cache: Remove unnecessary includes --- src/video_core/renderer_opengl/gl_buffer_cache.cpp | 4 +++- src/video_core/renderer_opengl/gl_buffer_cache.h | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'src/video_core') diff --git a/src/video_core/renderer_opengl/gl_buffer_cache.cpp b/src/video_core/renderer_opengl/gl_buffer_cache.cpp index c85fbd306..3a81a966e 100644 --- a/src/video_core/renderer_opengl/gl_buffer_cache.cpp +++ b/src/video_core/renderer_opengl/gl_buffer_cache.cpp @@ -2,8 +2,10 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include +#include + #include "common/alignment.h" -#include "common/assert.h" #include "core/core.h" #include "core/memory.h" #include "video_core/renderer_opengl/gl_buffer_cache.h" diff --git a/src/video_core/renderer_opengl/gl_buffer_cache.h b/src/video_core/renderer_opengl/gl_buffer_cache.h index 33a6c0d69..256d5b83f 100644 --- a/src/video_core/renderer_opengl/gl_buffer_cache.h +++ b/src/video_core/renderer_opengl/gl_buffer_cache.h @@ -4,8 +4,8 @@ #pragma once +#include #include -#include #include "common/common_types.h" #include "video_core/rasterizer_cache.h" -- cgit v1.2.3 From 8d685a29bc489b68e578df3c8be2eaeb5d1f6d5d Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 6 Sep 2018 14:58:15 -0400 Subject: gl_buffer_cache: Make GetHandle() a const member function GetHandle() internally calls GetHandle() on the stream_buffer instance, which is a const member function, so this can be made const as well. --- src/video_core/renderer_opengl/gl_buffer_cache.cpp | 2 +- src/video_core/renderer_opengl/gl_buffer_cache.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/video_core') diff --git a/src/video_core/renderer_opengl/gl_buffer_cache.cpp b/src/video_core/renderer_opengl/gl_buffer_cache.cpp index 3a81a966e..0b5d18bcb 100644 --- a/src/video_core/renderer_opengl/gl_buffer_cache.cpp +++ b/src/video_core/renderer_opengl/gl_buffer_cache.cpp @@ -77,7 +77,7 @@ void OGLBufferCache::Unmap() { stream_buffer.Unmap(buffer_offset - buffer_offset_base); } -GLuint OGLBufferCache::GetHandle() { +GLuint OGLBufferCache::GetHandle() const { return stream_buffer.GetHandle(); } diff --git a/src/video_core/renderer_opengl/gl_buffer_cache.h b/src/video_core/renderer_opengl/gl_buffer_cache.h index 256d5b83f..3ae78cb26 100644 --- a/src/video_core/renderer_opengl/gl_buffer_cache.h +++ b/src/video_core/renderer_opengl/gl_buffer_cache.h @@ -41,7 +41,7 @@ public: void Map(size_t max_size); void Unmap(); - GLuint GetHandle(); + GLuint GetHandle() const; protected: void AlignBuffer(size_t alignment); -- cgit v1.2.3 From ddcdbce0679652bd16016abcce0a711ba2449d07 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 6 Sep 2018 15:03:01 -0400 Subject: gl_buffer_cache: Default initialize member variables Ensures that the cache always has a deterministic initial state. --- src/video_core/renderer_opengl/gl_buffer_cache.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/video_core') diff --git a/src/video_core/renderer_opengl/gl_buffer_cache.h b/src/video_core/renderer_opengl/gl_buffer_cache.h index 3ae78cb26..6da862902 100644 --- a/src/video_core/renderer_opengl/gl_buffer_cache.h +++ b/src/video_core/renderer_opengl/gl_buffer_cache.h @@ -49,9 +49,9 @@ protected: private: OGLStreamBuffer stream_buffer; - u8* buffer_ptr; - GLintptr buffer_offset; - GLintptr buffer_offset_base; + u8* buffer_ptr = nullptr; + GLintptr buffer_offset = 0; + GLintptr buffer_offset_base = 0; }; } // namespace OpenGL -- cgit v1.2.3