diff options
author | ReinUsesLisp <reinuseslisp@airmail.cc> | 2020-05-11 21:35:04 +0200 |
---|---|---|
committer | ReinUsesLisp <reinuseslisp@airmail.cc> | 2020-06-24 07:36:14 +0200 |
commit | 32485917ba7cb7b2f0cad766c0897365294650a7 (patch) | |
tree | 48805f8321d9352203664a2fb28e6e504684b11d /src/video_core/renderer_opengl/gl_buffer_cache.h | |
parent | gl_device: Expose NV_vertex_buffer_unified_memory except on Turing (diff) | |
download | yuzu-32485917ba7cb7b2f0cad766c0897365294650a7.tar yuzu-32485917ba7cb7b2f0cad766c0897365294650a7.tar.gz yuzu-32485917ba7cb7b2f0cad766c0897365294650a7.tar.bz2 yuzu-32485917ba7cb7b2f0cad766c0897365294650a7.tar.lz yuzu-32485917ba7cb7b2f0cad766c0897365294650a7.tar.xz yuzu-32485917ba7cb7b2f0cad766c0897365294650a7.tar.zst yuzu-32485917ba7cb7b2f0cad766c0897365294650a7.zip |
Diffstat (limited to 'src/video_core/renderer_opengl/gl_buffer_cache.h')
-rw-r--r-- | src/video_core/renderer_opengl/gl_buffer_cache.h | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/video_core/renderer_opengl/gl_buffer_cache.h b/src/video_core/renderer_opengl/gl_buffer_cache.h index a49aaf9c4..6462cfae5 100644 --- a/src/video_core/renderer_opengl/gl_buffer_cache.h +++ b/src/video_core/renderer_opengl/gl_buffer_cache.h @@ -25,15 +25,20 @@ class RasterizerOpenGL; class Buffer : public VideoCommon::BufferBlock { public: - explicit Buffer(VAddr cpu_addr, const std::size_t size); + explicit Buffer(const Device& device, VAddr cpu_addr, std::size_t size); ~Buffer(); - GLuint Handle() const { + GLuint Handle() const noexcept { return gl_buffer.handle; } + u64 Address() const noexcept { + return gpu_address; + } + private: OGLBuffer gl_buffer; + u64 gpu_address = 0; }; using GenericBufferCache = VideoCommon::BufferCache<Buffer, GLuint, OGLStreamBuffer>; @@ -43,7 +48,7 @@ public: const Device& device, std::size_t stream_size); ~OGLBufferCache(); - GLuint GetEmptyBuffer(std::size_t) override; + BufferInfo GetEmptyBuffer(std::size_t) override; void Acquire() noexcept { cbuf_cursor = 0; @@ -64,10 +69,13 @@ protected: BufferInfo ConstBufferUpload(const void* raw_pointer, std::size_t size) override; private: + static constexpr std::size_t NUM_CBUFS = Tegra::Engines::Maxwell3D::Regs::MaxConstBuffers * + Tegra::Engines::Maxwell3D::Regs::MaxShaderProgram; + + const Device& device; + std::size_t cbuf_cursor = 0; - std::array<GLuint, Tegra::Engines::Maxwell3D::Regs::MaxConstBuffers * - Tegra::Engines::Maxwell3D::Regs::MaxShaderProgram> - cbufs; + std::array<GLuint, NUM_CBUFS> cbufs{}; }; } // namespace OpenGL |