diff options
author | ReinUsesLisp <reinuseslisp@airmail.cc> | 2021-04-26 08:53:26 +0200 |
---|---|---|
committer | ameerj <52414509+ameerj@users.noreply.github.com> | 2021-07-23 03:51:29 +0200 |
commit | 025b20f96ae588777e3ff11083cc4184bf418af6 (patch) | |
tree | 7cda9932a219409196adfc8a8d7d5793840657c1 /src/video_core/renderer_opengl/gl_shader_cache.h | |
parent | vulkan: Defer descriptor set work to the Vulkan thread (diff) | |
download | yuzu-025b20f96ae588777e3ff11083cc4184bf418af6.tar yuzu-025b20f96ae588777e3ff11083cc4184bf418af6.tar.gz yuzu-025b20f96ae588777e3ff11083cc4184bf418af6.tar.bz2 yuzu-025b20f96ae588777e3ff11083cc4184bf418af6.tar.lz yuzu-025b20f96ae588777e3ff11083cc4184bf418af6.tar.xz yuzu-025b20f96ae588777e3ff11083cc4184bf418af6.tar.zst yuzu-025b20f96ae588777e3ff11083cc4184bf418af6.zip |
Diffstat (limited to 'src/video_core/renderer_opengl/gl_shader_cache.h')
-rw-r--r-- | src/video_core/renderer_opengl/gl_shader_cache.h | 58 |
1 files changed, 45 insertions, 13 deletions
diff --git a/src/video_core/renderer_opengl/gl_shader_cache.h b/src/video_core/renderer_opengl/gl_shader_cache.h index ad3d15a76..96520e17c 100644 --- a/src/video_core/renderer_opengl/gl_shader_cache.h +++ b/src/video_core/renderer_opengl/gl_shader_cache.h @@ -36,27 +36,59 @@ class RasterizerOpenGL; using Maxwell = Tegra::Engines::Maxwell3D::Regs; -class Shader { +struct GraphicsProgramKey { + struct TransformFeedbackState { + struct Layout { + u32 stream; + u32 varying_count; + u32 stride; + }; + std::array<Layout, Maxwell::NumTransformFeedbackBuffers> layouts; + std::array<std::array<u8, 128>, Maxwell::NumTransformFeedbackBuffers> varyings; + }; + + std::array<u64, 6> unique_hashes; + std::array<u8, Maxwell::NumRenderTargets> color_formats; + union { + u32 raw; + BitField<0, 1, u32> xfb_enabled; + BitField<1, 1, u32> early_z; + BitField<2, 4, Maxwell::PrimitiveTopology> gs_input_topology; + BitField<6, 2, u32> tessellation_primitive; + BitField<8, 2, u32> tessellation_spacing; + BitField<10, 1, u32> tessellation_clockwise; + }; + u32 padding; + TransformFeedbackState xfb_state; + + [[nodiscard]] size_t Size() const noexcept { + if (xfb_enabled != 0) { + return sizeof(GraphicsProgramKey); + } else { + return offsetof(GraphicsProgramKey, padding); + } + } +}; +static_assert(std::has_unique_object_representations_v<GraphicsProgramKey>); +static_assert(std::is_trivially_copyable_v<GraphicsProgramKey>); +static_assert(std::is_trivially_constructible_v<GraphicsProgramKey>); + +class GraphicsProgram { public: - explicit Shader(); - ~Shader(); +private: }; -class ShaderCacheOpenGL final : public VideoCommon::ShaderCache<Shader> { +class ShaderCache : public VideoCommon::ShaderCache { public: - explicit ShaderCacheOpenGL(RasterizerOpenGL& rasterizer_, - Core::Frontend::EmuWindow& emu_window_, Tegra::GPU& gpu, - Tegra::Engines::Maxwell3D& maxwell3d_, - Tegra::Engines::KeplerCompute& kepler_compute_, - Tegra::MemoryManager& gpu_memory_, const Device& device_); - ~ShaderCacheOpenGL() override; + explicit ShaderCache(RasterizerOpenGL& rasterizer_, Core::Frontend::EmuWindow& emu_window_, + Tegra::GPU& gpu_, Tegra::Engines::Maxwell3D& maxwell3d_, + Tegra::Engines::KeplerCompute& kepler_compute_, + Tegra::MemoryManager& gpu_memory_, const Device& device_); + ~ShaderCache(); private: Core::Frontend::EmuWindow& emu_window; Tegra::GPU& gpu; - Tegra::MemoryManager& gpu_memory; - Tegra::Engines::Maxwell3D& maxwell3d; - Tegra::Engines::KeplerCompute& kepler_compute; const Device& device; }; |