diff options
| author | 2019-01-13 22:36:52 -0300 | |
|---|---|---|
| committer | 2019-02-06 22:20:57 -0300 | |
| commit | 145c3ac89e14c5400e617d4af08c3b8c251cf7c8 (patch) | |
| tree | 581e011f906a7ff4db4df9d6aaf20280a3ac1112 /src | |
| parent | gl_shader_decompiler: Remove name entries (diff) | |
| download | yuzu-145c3ac89e14c5400e617d4af08c3b8c251cf7c8.tar.gz yuzu-145c3ac89e14c5400e617d4af08c3b8c251cf7c8.tar.xz yuzu-145c3ac89e14c5400e617d4af08c3b8c251cf7c8.zip | |
gl_shader_disk_cache: Add file and move BaseBindings declaration
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_shader_cache.h | 11 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_shader_disk_cache.cpp | 14 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_shader_disk_cache.h | 41 |
4 files changed, 58 insertions, 10 deletions
diff --git a/src/video_core/CMakeLists.txt b/src/video_core/CMakeLists.txt index 6113e17ff..48be37082 100644 --- a/src/video_core/CMakeLists.txt +++ b/src/video_core/CMakeLists.txt | |||
| @@ -44,6 +44,8 @@ add_library(video_core STATIC | |||
| 44 | renderer_opengl/gl_shader_cache.h | 44 | renderer_opengl/gl_shader_cache.h |
| 45 | renderer_opengl/gl_shader_decompiler.cpp | 45 | renderer_opengl/gl_shader_decompiler.cpp |
| 46 | renderer_opengl/gl_shader_decompiler.h | 46 | renderer_opengl/gl_shader_decompiler.h |
| 47 | renderer_opengl/gl_shader_disk_cache.cpp | ||
| 48 | renderer_opengl/gl_shader_disk_cache.h | ||
| 47 | renderer_opengl/gl_shader_gen.cpp | 49 | renderer_opengl/gl_shader_gen.cpp |
| 48 | renderer_opengl/gl_shader_gen.h | 50 | renderer_opengl/gl_shader_gen.h |
| 49 | renderer_opengl/gl_shader_manager.cpp | 51 | renderer_opengl/gl_shader_manager.cpp |
diff --git a/src/video_core/renderer_opengl/gl_shader_cache.h b/src/video_core/renderer_opengl/gl_shader_cache.h index 5e72912f5..18fb80bcc 100644 --- a/src/video_core/renderer_opengl/gl_shader_cache.h +++ b/src/video_core/renderer_opengl/gl_shader_cache.h | |||
| @@ -16,6 +16,7 @@ | |||
| 16 | #include "video_core/rasterizer_cache.h" | 16 | #include "video_core/rasterizer_cache.h" |
| 17 | #include "video_core/renderer_opengl/gl_resource_manager.h" | 17 | #include "video_core/renderer_opengl/gl_resource_manager.h" |
| 18 | #include "video_core/renderer_opengl/gl_shader_decompiler.h" | 18 | #include "video_core/renderer_opengl/gl_shader_decompiler.h" |
| 19 | #include "video_core/renderer_opengl/gl_shader_disk_cache.h" | ||
| 19 | #include "video_core/renderer_opengl/gl_shader_gen.h" | 20 | #include "video_core/renderer_opengl/gl_shader_gen.h" |
| 20 | 21 | ||
| 21 | namespace OpenGL { | 22 | namespace OpenGL { |
| @@ -26,16 +27,6 @@ class RasterizerOpenGL; | |||
| 26 | using Shader = std::shared_ptr<CachedShader>; | 27 | using Shader = std::shared_ptr<CachedShader>; |
| 27 | using Maxwell = Tegra::Engines::Maxwell3D::Regs; | 28 | using Maxwell = Tegra::Engines::Maxwell3D::Regs; |
| 28 | 29 | ||
| 29 | struct BaseBindings { | ||
| 30 | u32 cbuf{}; | ||
| 31 | u32 gmem{}; | ||
| 32 | u32 sampler{}; | ||
| 33 | |||
| 34 | bool operator<(const BaseBindings& rhs) const { | ||
| 35 | return std::tie(cbuf, gmem, sampler) < std::tie(rhs.cbuf, rhs.gmem, rhs.sampler); | ||
| 36 | } | ||
| 37 | }; | ||
| 38 | |||
| 39 | class CachedShader final : public RasterizerCacheObject { | 30 | class CachedShader final : public RasterizerCacheObject { |
| 40 | public: | 31 | public: |
| 41 | CachedShader(VAddr addr, Maxwell::ShaderProgram program_type); | 32 | CachedShader(VAddr addr, Maxwell::ShaderProgram program_type); |
diff --git a/src/video_core/renderer_opengl/gl_shader_disk_cache.cpp b/src/video_core/renderer_opengl/gl_shader_disk_cache.cpp new file mode 100644 index 000000000..b7876c3a7 --- /dev/null +++ b/src/video_core/renderer_opengl/gl_shader_disk_cache.cpp | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | // Copyright 2019 yuzu Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #pragma once | ||
| 6 | |||
| 7 | #include "video_core/renderer_opengl/gl_shader_disk_cache.h" | ||
| 8 | |||
| 9 | namespace OpenGL { | ||
| 10 | |||
| 11 | // Making sure sizes doesn't change by accident | ||
| 12 | static_assert(sizeof(BaseBindings) == 12); | ||
| 13 | |||
| 14 | } // namespace OpenGL \ No newline at end of file | ||
diff --git a/src/video_core/renderer_opengl/gl_shader_disk_cache.h b/src/video_core/renderer_opengl/gl_shader_disk_cache.h new file mode 100644 index 000000000..cb40e9926 --- /dev/null +++ b/src/video_core/renderer_opengl/gl_shader_disk_cache.h | |||
| @@ -0,0 +1,41 @@ | |||
| 1 | // Copyright 2019 yuzu Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #pragma once | ||
| 6 | |||
| 7 | #include <tuple> | ||
| 8 | |||
| 9 | #include "common/common_types.h" | ||
| 10 | #include "video_core/engines/maxwell_3d.h" | ||
| 11 | |||
| 12 | namespace OpenGL { | ||
| 13 | |||
| 14 | using ProgramCode = std::vector<u64>; | ||
| 15 | using Maxwell = Tegra::Engines::Maxwell3D::Regs; | ||
| 16 | |||
| 17 | struct BaseBindings { | ||
| 18 | private: | ||
| 19 | auto Tie() const { | ||
| 20 | return std::tie(cbuf, gmem, sampler); | ||
| 21 | } | ||
| 22 | |||
| 23 | public: | ||
| 24 | u32 cbuf{}; | ||
| 25 | u32 gmem{}; | ||
| 26 | u32 sampler{}; | ||
| 27 | |||
| 28 | bool operator<(const BaseBindings& rhs) const { | ||
| 29 | return Tie() < rhs.Tie(); | ||
| 30 | } | ||
| 31 | |||
| 32 | bool operator==(const BaseBindings& rhs) const { | ||
| 33 | return Tie() == rhs.Tie(); | ||
| 34 | } | ||
| 35 | |||
| 36 | bool operator!=(const BaseBindings& rhs) const { | ||
| 37 | return !this->operator==(rhs); | ||
| 38 | } | ||
| 39 | }; | ||
| 40 | |||
| 41 | } // namespace OpenGL \ No newline at end of file | ||