diff options
Diffstat (limited to '')
| -rw-r--r-- | src/video_core/CMakeLists.txt | 8 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_compute_pipeline.cpp (renamed from src/video_core/renderer_opengl/gl_compute_program.cpp) | 18 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_compute_pipeline.h (renamed from src/video_core/renderer_opengl/gl_compute_program.h) | 28 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_graphics_pipeline.cpp (renamed from src/video_core/renderer_opengl/gl_graphics_program.cpp) | 28 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_graphics_pipeline.h (renamed from src/video_core/renderer_opengl/gl_graphics_program.h) | 38 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer.cpp | 10 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer.h | 2 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_shader_cache.cpp | 42 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_shader_cache.h | 32 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_shader_manager.h | 2 |
10 files changed, 104 insertions, 104 deletions
diff --git a/src/video_core/CMakeLists.txt b/src/video_core/CMakeLists.txt index 8250f736c..1ef3a6189 100644 --- a/src/video_core/CMakeLists.txt +++ b/src/video_core/CMakeLists.txt | |||
| @@ -67,14 +67,14 @@ add_library(video_core STATIC | |||
| 67 | renderer_base.h | 67 | renderer_base.h |
| 68 | renderer_opengl/gl_buffer_cache.cpp | 68 | renderer_opengl/gl_buffer_cache.cpp |
| 69 | renderer_opengl/gl_buffer_cache.h | 69 | renderer_opengl/gl_buffer_cache.h |
| 70 | renderer_opengl/gl_compute_program.cpp | 70 | renderer_opengl/gl_compute_pipeline.cpp |
| 71 | renderer_opengl/gl_compute_program.h | 71 | renderer_opengl/gl_compute_pipeline.h |
| 72 | renderer_opengl/gl_device.cpp | 72 | renderer_opengl/gl_device.cpp |
| 73 | renderer_opengl/gl_device.h | 73 | renderer_opengl/gl_device.h |
| 74 | renderer_opengl/gl_fence_manager.cpp | 74 | renderer_opengl/gl_fence_manager.cpp |
| 75 | renderer_opengl/gl_fence_manager.h | 75 | renderer_opengl/gl_fence_manager.h |
| 76 | renderer_opengl/gl_graphics_program.cpp | 76 | renderer_opengl/gl_graphics_pipeline.cpp |
| 77 | renderer_opengl/gl_graphics_program.h | 77 | renderer_opengl/gl_graphics_pipeline.h |
| 78 | renderer_opengl/gl_rasterizer.cpp | 78 | renderer_opengl/gl_rasterizer.cpp |
| 79 | renderer_opengl/gl_rasterizer.h | 79 | renderer_opengl/gl_rasterizer.h |
| 80 | renderer_opengl/gl_resource_manager.cpp | 80 | renderer_opengl/gl_resource_manager.cpp |
diff --git a/src/video_core/renderer_opengl/gl_compute_program.cpp b/src/video_core/renderer_opengl/gl_compute_pipeline.cpp index ce52a0052..700ebd8b8 100644 --- a/src/video_core/renderer_opengl/gl_compute_program.cpp +++ b/src/video_core/renderer_opengl/gl_compute_pipeline.cpp | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | #include <cstring> | 5 | #include <cstring> |
| 6 | 6 | ||
| 7 | #include "common/cityhash.h" | 7 | #include "common/cityhash.h" |
| 8 | #include "video_core/renderer_opengl/gl_compute_program.h" | 8 | #include "video_core/renderer_opengl/gl_compute_pipeline.h" |
| 9 | #include "video_core/renderer_opengl/gl_shader_manager.h" | 9 | #include "video_core/renderer_opengl/gl_shader_manager.h" |
| 10 | 10 | ||
| 11 | namespace OpenGL { | 11 | namespace OpenGL { |
| @@ -17,20 +17,20 @@ using VideoCommon::ImageId; | |||
| 17 | constexpr u32 MAX_TEXTURES = 64; | 17 | constexpr u32 MAX_TEXTURES = 64; |
| 18 | constexpr u32 MAX_IMAGES = 16; | 18 | constexpr u32 MAX_IMAGES = 16; |
| 19 | 19 | ||
| 20 | size_t ComputeProgramKey::Hash() const noexcept { | 20 | size_t ComputePipelineKey::Hash() const noexcept { |
| 21 | return static_cast<size_t>( | 21 | return static_cast<size_t>( |
| 22 | Common::CityHash64(reinterpret_cast<const char*>(this), sizeof *this)); | 22 | Common::CityHash64(reinterpret_cast<const char*>(this), sizeof *this)); |
| 23 | } | 23 | } |
| 24 | 24 | ||
| 25 | bool ComputeProgramKey::operator==(const ComputeProgramKey& rhs) const noexcept { | 25 | bool ComputePipelineKey::operator==(const ComputePipelineKey& rhs) const noexcept { |
| 26 | return std::memcmp(this, &rhs, sizeof *this) == 0; | 26 | return std::memcmp(this, &rhs, sizeof *this) == 0; |
| 27 | } | 27 | } |
| 28 | 28 | ||
| 29 | ComputeProgram::ComputeProgram(TextureCache& texture_cache_, BufferCache& buffer_cache_, | 29 | ComputePipeline::ComputePipeline(TextureCache& texture_cache_, BufferCache& buffer_cache_, |
| 30 | Tegra::MemoryManager& gpu_memory_, | 30 | Tegra::MemoryManager& gpu_memory_, |
| 31 | Tegra::Engines::KeplerCompute& kepler_compute_, | 31 | Tegra::Engines::KeplerCompute& kepler_compute_, |
| 32 | ProgramManager& program_manager_, const Shader::Info& info_, | 32 | ProgramManager& program_manager_, const Shader::Info& info_, |
| 33 | OGLProgram source_program_, OGLAssemblyProgram assembly_program_) | 33 | OGLProgram source_program_, OGLAssemblyProgram assembly_program_) |
| 34 | : texture_cache{texture_cache_}, buffer_cache{buffer_cache_}, gpu_memory{gpu_memory_}, | 34 | : texture_cache{texture_cache_}, buffer_cache{buffer_cache_}, gpu_memory{gpu_memory_}, |
| 35 | kepler_compute{kepler_compute_}, program_manager{program_manager_}, info{info_}, | 35 | kepler_compute{kepler_compute_}, program_manager{program_manager_}, info{info_}, |
| 36 | source_program{std::move(source_program_)}, assembly_program{std::move(assembly_program_)} { | 36 | source_program{std::move(source_program_)}, assembly_program{std::move(assembly_program_)} { |
| @@ -53,7 +53,7 @@ ComputeProgram::ComputeProgram(TextureCache& texture_cache_, BufferCache& buffer | |||
| 53 | ASSERT(num_images <= MAX_IMAGES); | 53 | ASSERT(num_images <= MAX_IMAGES); |
| 54 | } | 54 | } |
| 55 | 55 | ||
| 56 | void ComputeProgram::Configure() { | 56 | void ComputePipeline::Configure() { |
| 57 | buffer_cache.SetEnabledComputeUniformBuffers(info.constant_buffer_mask); | 57 | buffer_cache.SetEnabledComputeUniformBuffers(info.constant_buffer_mask); |
| 58 | buffer_cache.UnbindComputeStorageBuffers(); | 58 | buffer_cache.UnbindComputeStorageBuffers(); |
| 59 | size_t ssbo_index{}; | 59 | size_t ssbo_index{}; |
diff --git a/src/video_core/renderer_opengl/gl_compute_program.h b/src/video_core/renderer_opengl/gl_compute_pipeline.h index ddb00dc1d..e3b94e2f3 100644 --- a/src/video_core/renderer_opengl/gl_compute_program.h +++ b/src/video_core/renderer_opengl/gl_compute_pipeline.h | |||
| @@ -30,30 +30,30 @@ namespace OpenGL { | |||
| 30 | 30 | ||
| 31 | class ProgramManager; | 31 | class ProgramManager; |
| 32 | 32 | ||
| 33 | struct ComputeProgramKey { | 33 | struct ComputePipelineKey { |
| 34 | u64 unique_hash; | 34 | u64 unique_hash; |
| 35 | u32 shared_memory_size; | 35 | u32 shared_memory_size; |
| 36 | std::array<u32, 3> workgroup_size; | 36 | std::array<u32, 3> workgroup_size; |
| 37 | 37 | ||
| 38 | size_t Hash() const noexcept; | 38 | size_t Hash() const noexcept; |
| 39 | 39 | ||
| 40 | bool operator==(const ComputeProgramKey&) const noexcept; | 40 | bool operator==(const ComputePipelineKey&) const noexcept; |
| 41 | 41 | ||
| 42 | bool operator!=(const ComputeProgramKey& rhs) const noexcept { | 42 | bool operator!=(const ComputePipelineKey& rhs) const noexcept { |
| 43 | return !operator==(rhs); | 43 | return !operator==(rhs); |
| 44 | } | 44 | } |
| 45 | }; | 45 | }; |
| 46 | static_assert(std::has_unique_object_representations_v<ComputeProgramKey>); | 46 | static_assert(std::has_unique_object_representations_v<ComputePipelineKey>); |
| 47 | static_assert(std::is_trivially_copyable_v<ComputeProgramKey>); | 47 | static_assert(std::is_trivially_copyable_v<ComputePipelineKey>); |
| 48 | static_assert(std::is_trivially_constructible_v<ComputeProgramKey>); | 48 | static_assert(std::is_trivially_constructible_v<ComputePipelineKey>); |
| 49 | 49 | ||
| 50 | class ComputeProgram { | 50 | class ComputePipeline { |
| 51 | public: | 51 | public: |
| 52 | explicit ComputeProgram(TextureCache& texture_cache_, BufferCache& buffer_cache_, | 52 | explicit ComputePipeline(TextureCache& texture_cache_, BufferCache& buffer_cache_, |
| 53 | Tegra::MemoryManager& gpu_memory_, | 53 | Tegra::MemoryManager& gpu_memory_, |
| 54 | Tegra::Engines::KeplerCompute& kepler_compute_, | 54 | Tegra::Engines::KeplerCompute& kepler_compute_, |
| 55 | ProgramManager& program_manager_, const Shader::Info& info_, | 55 | ProgramManager& program_manager_, const Shader::Info& info_, |
| 56 | OGLProgram source_program_, OGLAssemblyProgram assembly_program_); | 56 | OGLProgram source_program_, OGLAssemblyProgram assembly_program_); |
| 57 | 57 | ||
| 58 | void Configure(); | 58 | void Configure(); |
| 59 | 59 | ||
| @@ -76,8 +76,8 @@ private: | |||
| 76 | 76 | ||
| 77 | namespace std { | 77 | namespace std { |
| 78 | template <> | 78 | template <> |
| 79 | struct hash<OpenGL::ComputeProgramKey> { | 79 | struct hash<OpenGL::ComputePipelineKey> { |
| 80 | size_t operator()(const OpenGL::ComputeProgramKey& k) const noexcept { | 80 | size_t operator()(const OpenGL::ComputePipelineKey& k) const noexcept { |
| 81 | return k.Hash(); | 81 | return k.Hash(); |
| 82 | } | 82 | } |
| 83 | }; | 83 | }; |
diff --git a/src/video_core/renderer_opengl/gl_graphics_program.cpp b/src/video_core/renderer_opengl/gl_graphics_pipeline.cpp index 7c3d23f85..32df35202 100644 --- a/src/video_core/renderer_opengl/gl_graphics_program.cpp +++ b/src/video_core/renderer_opengl/gl_graphics_pipeline.cpp | |||
| @@ -7,7 +7,7 @@ | |||
| 7 | 7 | ||
| 8 | #include "common/cityhash.h" | 8 | #include "common/cityhash.h" |
| 9 | #include "shader_recompiler/shader_info.h" | 9 | #include "shader_recompiler/shader_info.h" |
| 10 | #include "video_core/renderer_opengl/gl_graphics_program.h" | 10 | #include "video_core/renderer_opengl/gl_graphics_pipeline.h" |
| 11 | #include "video_core/renderer_opengl/gl_shader_manager.h" | 11 | #include "video_core/renderer_opengl/gl_shader_manager.h" |
| 12 | #include "video_core/renderer_opengl/gl_state_tracker.h" | 12 | #include "video_core/renderer_opengl/gl_state_tracker.h" |
| 13 | #include "video_core/texture_cache/texture_cache.h" | 13 | #include "video_core/texture_cache/texture_cache.h" |
| @@ -62,22 +62,22 @@ std::pair<GLint, GLint> TransformFeedbackEnum(u8 location) { | |||
| 62 | } | 62 | } |
| 63 | } // Anonymous namespace | 63 | } // Anonymous namespace |
| 64 | 64 | ||
| 65 | size_t GraphicsProgramKey::Hash() const noexcept { | 65 | size_t GraphicsPipelineKey::Hash() const noexcept { |
| 66 | return static_cast<size_t>(Common::CityHash64(reinterpret_cast<const char*>(this), Size())); | 66 | return static_cast<size_t>(Common::CityHash64(reinterpret_cast<const char*>(this), Size())); |
| 67 | } | 67 | } |
| 68 | 68 | ||
| 69 | bool GraphicsProgramKey::operator==(const GraphicsProgramKey& rhs) const noexcept { | 69 | bool GraphicsPipelineKey::operator==(const GraphicsPipelineKey& rhs) const noexcept { |
| 70 | return std::memcmp(this, &rhs, Size()) == 0; | 70 | return std::memcmp(this, &rhs, Size()) == 0; |
| 71 | } | 71 | } |
| 72 | 72 | ||
| 73 | GraphicsProgram::GraphicsProgram(TextureCache& texture_cache_, BufferCache& buffer_cache_, | 73 | GraphicsPipeline::GraphicsPipeline(TextureCache& texture_cache_, BufferCache& buffer_cache_, |
| 74 | Tegra::MemoryManager& gpu_memory_, | 74 | Tegra::MemoryManager& gpu_memory_, |
| 75 | Tegra::Engines::Maxwell3D& maxwell3d_, | 75 | Tegra::Engines::Maxwell3D& maxwell3d_, |
| 76 | ProgramManager& program_manager_, StateTracker& state_tracker_, | 76 | ProgramManager& program_manager_, StateTracker& state_tracker_, |
| 77 | OGLProgram program_, | 77 | OGLProgram program_, |
| 78 | std::array<OGLAssemblyProgram, 5> assembly_programs_, | 78 | std::array<OGLAssemblyProgram, 5> assembly_programs_, |
| 79 | const std::array<const Shader::Info*, 5>& infos, | 79 | const std::array<const Shader::Info*, 5>& infos, |
| 80 | const VideoCommon::TransformFeedbackState* xfb_state) | 80 | const VideoCommon::TransformFeedbackState* xfb_state) |
| 81 | : texture_cache{texture_cache_}, buffer_cache{buffer_cache_}, | 81 | : texture_cache{texture_cache_}, buffer_cache{buffer_cache_}, |
| 82 | gpu_memory{gpu_memory_}, maxwell3d{maxwell3d_}, program_manager{program_manager_}, | 82 | gpu_memory{gpu_memory_}, maxwell3d{maxwell3d_}, program_manager{program_manager_}, |
| 83 | state_tracker{state_tracker_}, program{std::move(program_)}, assembly_programs{std::move( | 83 | state_tracker{state_tracker_}, program{std::move(program_)}, assembly_programs{std::move( |
| @@ -126,7 +126,7 @@ struct Spec { | |||
| 126 | static constexpr bool has_images = true; | 126 | static constexpr bool has_images = true; |
| 127 | }; | 127 | }; |
| 128 | 128 | ||
| 129 | void GraphicsProgram::Configure(bool is_indexed) { | 129 | void GraphicsPipeline::Configure(bool is_indexed) { |
| 130 | std::array<ImageId, MAX_TEXTURES + MAX_IMAGES> image_view_ids; | 130 | std::array<ImageId, MAX_TEXTURES + MAX_IMAGES> image_view_ids; |
| 131 | std::array<u32, MAX_TEXTURES + MAX_IMAGES> image_view_indices; | 131 | std::array<u32, MAX_TEXTURES + MAX_IMAGES> image_view_indices; |
| 132 | std::array<GLuint, MAX_TEXTURES> samplers; | 132 | std::array<GLuint, MAX_TEXTURES> samplers; |
| @@ -347,7 +347,7 @@ void GraphicsProgram::Configure(bool is_indexed) { | |||
| 347 | } | 347 | } |
| 348 | } | 348 | } |
| 349 | 349 | ||
| 350 | void GraphicsProgram::GenerateTransformFeedbackState( | 350 | void GraphicsPipeline::GenerateTransformFeedbackState( |
| 351 | const VideoCommon::TransformFeedbackState& xfb_state) { | 351 | const VideoCommon::TransformFeedbackState& xfb_state) { |
| 352 | // TODO(Rodrigo): Inject SKIP_COMPONENTS*_NV when required. An unimplemented message will signal | 352 | // TODO(Rodrigo): Inject SKIP_COMPONENTS*_NV when required. An unimplemented message will signal |
| 353 | // when this is required. | 353 | // when this is required. |
| @@ -394,7 +394,7 @@ void GraphicsProgram::GenerateTransformFeedbackState( | |||
| 394 | num_xfb_strides = static_cast<GLsizei>(current_stream - xfb_streams.data()); | 394 | num_xfb_strides = static_cast<GLsizei>(current_stream - xfb_streams.data()); |
| 395 | } | 395 | } |
| 396 | 396 | ||
| 397 | void GraphicsProgram::ConfigureTransformFeedbackImpl() const { | 397 | void GraphicsPipeline::ConfigureTransformFeedbackImpl() const { |
| 398 | glTransformFeedbackStreamAttribsNV(num_xfb_attribs, xfb_attribs.data(), num_xfb_strides, | 398 | glTransformFeedbackStreamAttribsNV(num_xfb_attribs, xfb_attribs.data(), num_xfb_strides, |
| 399 | xfb_streams.data(), GL_INTERLEAVED_ATTRIBS); | 399 | xfb_streams.data(), GL_INTERLEAVED_ATTRIBS); |
| 400 | } | 400 | } |
diff --git a/src/video_core/renderer_opengl/gl_graphics_program.h b/src/video_core/renderer_opengl/gl_graphics_pipeline.h index 53a57ede5..62f700cf5 100644 --- a/src/video_core/renderer_opengl/gl_graphics_program.h +++ b/src/video_core/renderer_opengl/gl_graphics_pipeline.h | |||
| @@ -24,7 +24,7 @@ class ProgramManager; | |||
| 24 | 24 | ||
| 25 | using Maxwell = Tegra::Engines::Maxwell3D::Regs; | 25 | using Maxwell = Tegra::Engines::Maxwell3D::Regs; |
| 26 | 26 | ||
| 27 | struct GraphicsProgramKey { | 27 | struct GraphicsPipelineKey { |
| 28 | std::array<u64, 6> unique_hashes; | 28 | std::array<u64, 6> unique_hashes; |
| 29 | union { | 29 | union { |
| 30 | u32 raw; | 30 | u32 raw; |
| @@ -40,34 +40,34 @@ struct GraphicsProgramKey { | |||
| 40 | 40 | ||
| 41 | size_t Hash() const noexcept; | 41 | size_t Hash() const noexcept; |
| 42 | 42 | ||
| 43 | bool operator==(const GraphicsProgramKey&) const noexcept; | 43 | bool operator==(const GraphicsPipelineKey&) const noexcept; |
| 44 | 44 | ||
| 45 | bool operator!=(const GraphicsProgramKey& rhs) const noexcept { | 45 | bool operator!=(const GraphicsPipelineKey& rhs) const noexcept { |
| 46 | return !operator==(rhs); | 46 | return !operator==(rhs); |
| 47 | } | 47 | } |
| 48 | 48 | ||
| 49 | [[nodiscard]] size_t Size() const noexcept { | 49 | [[nodiscard]] size_t Size() const noexcept { |
| 50 | if (xfb_enabled != 0) { | 50 | if (xfb_enabled != 0) { |
| 51 | return sizeof(GraphicsProgramKey); | 51 | return sizeof(GraphicsPipelineKey); |
| 52 | } else { | 52 | } else { |
| 53 | return offsetof(GraphicsProgramKey, padding); | 53 | return offsetof(GraphicsPipelineKey, padding); |
| 54 | } | 54 | } |
| 55 | } | 55 | } |
| 56 | }; | 56 | }; |
| 57 | static_assert(std::has_unique_object_representations_v<GraphicsProgramKey>); | 57 | static_assert(std::has_unique_object_representations_v<GraphicsPipelineKey>); |
| 58 | static_assert(std::is_trivially_copyable_v<GraphicsProgramKey>); | 58 | static_assert(std::is_trivially_copyable_v<GraphicsPipelineKey>); |
| 59 | static_assert(std::is_trivially_constructible_v<GraphicsProgramKey>); | 59 | static_assert(std::is_trivially_constructible_v<GraphicsPipelineKey>); |
| 60 | 60 | ||
| 61 | class GraphicsProgram { | 61 | class GraphicsPipeline { |
| 62 | public: | 62 | public: |
| 63 | explicit GraphicsProgram(TextureCache& texture_cache_, BufferCache& buffer_cache_, | 63 | explicit GraphicsPipeline(TextureCache& texture_cache_, BufferCache& buffer_cache_, |
| 64 | Tegra::MemoryManager& gpu_memory_, | 64 | Tegra::MemoryManager& gpu_memory_, |
| 65 | Tegra::Engines::Maxwell3D& maxwell3d_, | 65 | Tegra::Engines::Maxwell3D& maxwell3d_, |
| 66 | ProgramManager& program_manager_, StateTracker& state_tracker_, | 66 | ProgramManager& program_manager_, StateTracker& state_tracker_, |
| 67 | OGLProgram program_, | 67 | OGLProgram program_, |
| 68 | std::array<OGLAssemblyProgram, 5> assembly_programs_, | 68 | std::array<OGLAssemblyProgram, 5> assembly_programs_, |
| 69 | const std::array<const Shader::Info*, 5>& infos, | 69 | const std::array<const Shader::Info*, 5>& infos, |
| 70 | const VideoCommon::TransformFeedbackState* xfb_state); | 70 | const VideoCommon::TransformFeedbackState* xfb_state); |
| 71 | 71 | ||
| 72 | void Configure(bool is_indexed); | 72 | void Configure(bool is_indexed); |
| 73 | 73 | ||
| @@ -110,8 +110,8 @@ private: | |||
| 110 | 110 | ||
| 111 | namespace std { | 111 | namespace std { |
| 112 | template <> | 112 | template <> |
| 113 | struct hash<OpenGL::GraphicsProgramKey> { | 113 | struct hash<OpenGL::GraphicsPipelineKey> { |
| 114 | size_t operator()(const OpenGL::GraphicsProgramKey& k) const noexcept { | 114 | size_t operator()(const OpenGL::GraphicsPipelineKey& k) const noexcept { |
| 115 | return k.Hash(); | 115 | return k.Hash(); |
| 116 | } | 116 | } |
| 117 | }; | 117 | }; |
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index 51ff42ee9..72a6dfd2a 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp | |||
| @@ -218,13 +218,13 @@ void RasterizerOpenGL::Draw(bool is_indexed, bool is_instanced) { | |||
| 218 | 218 | ||
| 219 | SyncState(); | 219 | SyncState(); |
| 220 | 220 | ||
| 221 | GraphicsProgram* const program{shader_cache.CurrentGraphicsProgram()}; | 221 | GraphicsPipeline* const pipeline{shader_cache.CurrentGraphicsPipeline()}; |
| 222 | 222 | ||
| 223 | std::scoped_lock lock{buffer_cache.mutex, texture_cache.mutex}; | 223 | std::scoped_lock lock{buffer_cache.mutex, texture_cache.mutex}; |
| 224 | program->Configure(is_indexed); | 224 | pipeline->Configure(is_indexed); |
| 225 | 225 | ||
| 226 | const GLenum primitive_mode = MaxwellToGL::PrimitiveTopology(maxwell3d.regs.draw.topology); | 226 | const GLenum primitive_mode = MaxwellToGL::PrimitiveTopology(maxwell3d.regs.draw.topology); |
| 227 | BeginTransformFeedback(program, primitive_mode); | 227 | BeginTransformFeedback(pipeline, primitive_mode); |
| 228 | 228 | ||
| 229 | const GLuint base_instance = static_cast<GLuint>(maxwell3d.regs.vb_base_instance); | 229 | const GLuint base_instance = static_cast<GLuint>(maxwell3d.regs.vb_base_instance); |
| 230 | const GLsizei num_instances = | 230 | const GLsizei num_instances = |
| @@ -271,7 +271,7 @@ void RasterizerOpenGL::Draw(bool is_indexed, bool is_instanced) { | |||
| 271 | } | 271 | } |
| 272 | 272 | ||
| 273 | void RasterizerOpenGL::DispatchCompute() { | 273 | void RasterizerOpenGL::DispatchCompute() { |
| 274 | ComputeProgram* const program{shader_cache.CurrentComputeProgram()}; | 274 | ComputePipeline* const program{shader_cache.CurrentComputePipeline()}; |
| 275 | if (!program) { | 275 | if (!program) { |
| 276 | return; | 276 | return; |
| 277 | } | 277 | } |
| @@ -996,7 +996,7 @@ void RasterizerOpenGL::SyncFramebufferSRGB() { | |||
| 996 | oglEnable(GL_FRAMEBUFFER_SRGB, maxwell3d.regs.framebuffer_srgb); | 996 | oglEnable(GL_FRAMEBUFFER_SRGB, maxwell3d.regs.framebuffer_srgb); |
| 997 | } | 997 | } |
| 998 | 998 | ||
| 999 | void RasterizerOpenGL::BeginTransformFeedback(GraphicsProgram* program, GLenum primitive_mode) { | 999 | void RasterizerOpenGL::BeginTransformFeedback(GraphicsPipeline* program, GLenum primitive_mode) { |
| 1000 | const auto& regs = maxwell3d.regs; | 1000 | const auto& regs = maxwell3d.regs; |
| 1001 | if (regs.tfb_enabled == 0) { | 1001 | if (regs.tfb_enabled == 0) { |
| 1002 | return; | 1002 | return; |
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.h b/src/video_core/renderer_opengl/gl_rasterizer.h index 08f509c19..afd43b2ee 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.h +++ b/src/video_core/renderer_opengl/gl_rasterizer.h | |||
| @@ -194,7 +194,7 @@ private: | |||
| 194 | void SyncVertexInstances(); | 194 | void SyncVertexInstances(); |
| 195 | 195 | ||
| 196 | /// Begin a transform feedback | 196 | /// Begin a transform feedback |
| 197 | void BeginTransformFeedback(GraphicsProgram* program, GLenum primitive_mode); | 197 | void BeginTransformFeedback(GraphicsPipeline* pipeline, GLenum primitive_mode); |
| 198 | 198 | ||
| 199 | /// End a transform feedback | 199 | /// End a transform feedback |
| 200 | void EndTransformFeedback(); | 200 | void EndTransformFeedback(); |
diff --git a/src/video_core/renderer_opengl/gl_shader_cache.cpp b/src/video_core/renderer_opengl/gl_shader_cache.cpp index ceec83a8a..33757938a 100644 --- a/src/video_core/renderer_opengl/gl_shader_cache.cpp +++ b/src/video_core/renderer_opengl/gl_shader_cache.cpp | |||
| @@ -152,7 +152,7 @@ GLenum AssemblyStage(size_t stage_index) { | |||
| 152 | return GL_NONE; | 152 | return GL_NONE; |
| 153 | } | 153 | } |
| 154 | 154 | ||
| 155 | Shader::RuntimeInfo MakeRuntimeInfo(const GraphicsProgramKey& key, | 155 | Shader::RuntimeInfo MakeRuntimeInfo(const GraphicsPipelineKey& key, |
| 156 | const Shader::IR::Program& program) { | 156 | const Shader::IR::Program& program) { |
| 157 | UNIMPLEMENTED_IF_MSG(key.xfb_enabled != 0, "Transform feedbacks"); | 157 | UNIMPLEMENTED_IF_MSG(key.xfb_enabled != 0, "Transform feedbacks"); |
| 158 | 158 | ||
| @@ -282,7 +282,7 @@ ShaderCache::ShaderCache(RasterizerOpenGL& rasterizer_, Core::Frontend::EmuWindo | |||
| 282 | 282 | ||
| 283 | ShaderCache::~ShaderCache() = default; | 283 | ShaderCache::~ShaderCache() = default; |
| 284 | 284 | ||
| 285 | GraphicsProgram* ShaderCache::CurrentGraphicsProgram() { | 285 | GraphicsPipeline* ShaderCache::CurrentGraphicsPipeline() { |
| 286 | if (!RefreshStages(graphics_key.unique_hashes)) { | 286 | if (!RefreshStages(graphics_key.unique_hashes)) { |
| 287 | return nullptr; | 287 | return nullptr; |
| 288 | } | 288 | } |
| @@ -302,18 +302,18 @@ GraphicsProgram* ShaderCache::CurrentGraphicsProgram() { | |||
| 302 | const auto [pair, is_new]{graphics_cache.try_emplace(graphics_key)}; | 302 | const auto [pair, is_new]{graphics_cache.try_emplace(graphics_key)}; |
| 303 | auto& program{pair->second}; | 303 | auto& program{pair->second}; |
| 304 | if (is_new) { | 304 | if (is_new) { |
| 305 | program = CreateGraphicsProgram(); | 305 | program = CreateGraphicsPipeline(); |
| 306 | } | 306 | } |
| 307 | return program.get(); | 307 | return program.get(); |
| 308 | } | 308 | } |
| 309 | 309 | ||
| 310 | ComputeProgram* ShaderCache::CurrentComputeProgram() { | 310 | ComputePipeline* ShaderCache::CurrentComputePipeline() { |
| 311 | const VideoCommon::ShaderInfo* const shader{ComputeShader()}; | 311 | const VideoCommon::ShaderInfo* const shader{ComputeShader()}; |
| 312 | if (!shader) { | 312 | if (!shader) { |
| 313 | return nullptr; | 313 | return nullptr; |
| 314 | } | 314 | } |
| 315 | const auto& qmd{kepler_compute.launch_description}; | 315 | const auto& qmd{kepler_compute.launch_description}; |
| 316 | const ComputeProgramKey key{ | 316 | const ComputePipelineKey key{ |
| 317 | .unique_hash = shader->unique_hash, | 317 | .unique_hash = shader->unique_hash, |
| 318 | .shared_memory_size = qmd.shared_alloc, | 318 | .shared_memory_size = qmd.shared_alloc, |
| 319 | .workgroup_size{qmd.block_dim_x, qmd.block_dim_y, qmd.block_dim_z}, | 319 | .workgroup_size{qmd.block_dim_x, qmd.block_dim_y, qmd.block_dim_z}, |
| @@ -323,20 +323,20 @@ ComputeProgram* ShaderCache::CurrentComputeProgram() { | |||
| 323 | if (!is_new) { | 323 | if (!is_new) { |
| 324 | return pipeline.get(); | 324 | return pipeline.get(); |
| 325 | } | 325 | } |
| 326 | pipeline = CreateComputeProgram(key, shader); | 326 | pipeline = CreateComputePipeline(key, shader); |
| 327 | return pipeline.get(); | 327 | return pipeline.get(); |
| 328 | } | 328 | } |
| 329 | 329 | ||
| 330 | std::unique_ptr<GraphicsProgram> ShaderCache::CreateGraphicsProgram() { | 330 | std::unique_ptr<GraphicsPipeline> ShaderCache::CreateGraphicsPipeline() { |
| 331 | GraphicsEnvironments environments; | 331 | GraphicsEnvironments environments; |
| 332 | GetGraphicsEnvironments(environments, graphics_key.unique_hashes); | 332 | GetGraphicsEnvironments(environments, graphics_key.unique_hashes); |
| 333 | 333 | ||
| 334 | main_pools.ReleaseContents(); | 334 | main_pools.ReleaseContents(); |
| 335 | return CreateGraphicsProgram(main_pools, graphics_key, environments.Span(), true); | 335 | return CreateGraphicsPipeline(main_pools, graphics_key, environments.Span(), true); |
| 336 | } | 336 | } |
| 337 | 337 | ||
| 338 | std::unique_ptr<GraphicsProgram> ShaderCache::CreateGraphicsProgram( | 338 | std::unique_ptr<GraphicsPipeline> ShaderCache::CreateGraphicsPipeline( |
| 339 | ShaderPools& pools, const GraphicsProgramKey& key, std::span<Shader::Environment* const> envs, | 339 | ShaderPools& pools, const GraphicsPipelineKey& key, std::span<Shader::Environment* const> envs, |
| 340 | bool build_in_parallel) { | 340 | bool build_in_parallel) { |
| 341 | LOG_INFO(Render_OpenGL, "0x{:016x}", key.Hash()); | 341 | LOG_INFO(Render_OpenGL, "0x{:016x}", key.Hash()); |
| 342 | size_t env_index{0}; | 342 | size_t env_index{0}; |
| @@ -382,27 +382,27 @@ std::unique_ptr<GraphicsProgram> ShaderCache::CreateGraphicsProgram( | |||
| 382 | if (!device.UseAssemblyShaders()) { | 382 | if (!device.UseAssemblyShaders()) { |
| 383 | LinkProgram(source_program.handle); | 383 | LinkProgram(source_program.handle); |
| 384 | } | 384 | } |
| 385 | return std::make_unique<GraphicsProgram>( | 385 | return std::make_unique<GraphicsPipeline>( |
| 386 | texture_cache, buffer_cache, gpu_memory, maxwell3d, program_manager, state_tracker, | 386 | texture_cache, buffer_cache, gpu_memory, maxwell3d, program_manager, state_tracker, |
| 387 | std::move(source_program), std::move(assembly_programs), infos, | 387 | std::move(source_program), std::move(assembly_programs), infos, |
| 388 | key.xfb_enabled != 0 ? &key.xfb_state : nullptr); | 388 | key.xfb_enabled != 0 ? &key.xfb_state : nullptr); |
| 389 | } | 389 | } |
| 390 | 390 | ||
| 391 | std::unique_ptr<ComputeProgram> ShaderCache::CreateComputeProgram( | 391 | std::unique_ptr<ComputePipeline> ShaderCache::CreateComputePipeline( |
| 392 | const ComputeProgramKey& key, const VideoCommon::ShaderInfo* shader) { | 392 | const ComputePipelineKey& key, const VideoCommon::ShaderInfo* shader) { |
| 393 | const GPUVAddr program_base{kepler_compute.regs.code_loc.Address()}; | 393 | const GPUVAddr program_base{kepler_compute.regs.code_loc.Address()}; |
| 394 | const auto& qmd{kepler_compute.launch_description}; | 394 | const auto& qmd{kepler_compute.launch_description}; |
| 395 | ComputeEnvironment env{kepler_compute, gpu_memory, program_base, qmd.program_start}; | 395 | ComputeEnvironment env{kepler_compute, gpu_memory, program_base, qmd.program_start}; |
| 396 | env.SetCachedSize(shader->size_bytes); | 396 | env.SetCachedSize(shader->size_bytes); |
| 397 | 397 | ||
| 398 | main_pools.ReleaseContents(); | 398 | main_pools.ReleaseContents(); |
| 399 | return CreateComputeProgram(main_pools, key, env, true); | 399 | return CreateComputePipeline(main_pools, key, env, true); |
| 400 | } | 400 | } |
| 401 | 401 | ||
| 402 | std::unique_ptr<ComputeProgram> ShaderCache::CreateComputeProgram(ShaderPools& pools, | 402 | std::unique_ptr<ComputePipeline> ShaderCache::CreateComputePipeline(ShaderPools& pools, |
| 403 | const ComputeProgramKey& key, | 403 | const ComputePipelineKey& key, |
| 404 | Shader::Environment& env, | 404 | Shader::Environment& env, |
| 405 | bool build_in_parallel) { | 405 | bool build_in_parallel) { |
| 406 | LOG_INFO(Render_OpenGL, "0x{:016x}", key.Hash()); | 406 | LOG_INFO(Render_OpenGL, "0x{:016x}", key.Hash()); |
| 407 | 407 | ||
| 408 | Shader::Maxwell::Flow::CFG cfg{env, pools.flow_block, env.StartAddress()}; | 408 | Shader::Maxwell::Flow::CFG cfg{env, pools.flow_block, env.StartAddress()}; |
| @@ -418,9 +418,9 @@ std::unique_ptr<ComputeProgram> ShaderCache::CreateComputeProgram(ShaderPools& p | |||
| 418 | AddShader(GL_COMPUTE_SHADER, source_program.handle, code); | 418 | AddShader(GL_COMPUTE_SHADER, source_program.handle, code); |
| 419 | LinkProgram(source_program.handle); | 419 | LinkProgram(source_program.handle); |
| 420 | } | 420 | } |
| 421 | return std::make_unique<ComputeProgram>(texture_cache, buffer_cache, gpu_memory, kepler_compute, | 421 | return std::make_unique<ComputePipeline>(texture_cache, buffer_cache, gpu_memory, |
| 422 | program_manager, program.info, | 422 | kepler_compute, program_manager, program.info, |
| 423 | std::move(source_program), std::move(asm_program)); | 423 | std::move(source_program), std::move(asm_program)); |
| 424 | } | 424 | } |
| 425 | 425 | ||
| 426 | } // namespace OpenGL | 426 | } // namespace OpenGL |
diff --git a/src/video_core/renderer_opengl/gl_shader_cache.h b/src/video_core/renderer_opengl/gl_shader_cache.h index b49cd0ac7..a56559ea9 100644 --- a/src/video_core/renderer_opengl/gl_shader_cache.h +++ b/src/video_core/renderer_opengl/gl_shader_cache.h | |||
| @@ -15,8 +15,8 @@ | |||
| 15 | #include "shader_recompiler/frontend/maxwell/control_flow.h" | 15 | #include "shader_recompiler/frontend/maxwell/control_flow.h" |
| 16 | #include "shader_recompiler/object_pool.h" | 16 | #include "shader_recompiler/object_pool.h" |
| 17 | #include "video_core/engines/shader_type.h" | 17 | #include "video_core/engines/shader_type.h" |
| 18 | #include "video_core/renderer_opengl/gl_compute_program.h" | 18 | #include "video_core/renderer_opengl/gl_compute_pipeline.h" |
| 19 | #include "video_core/renderer_opengl/gl_graphics_program.h" | 19 | #include "video_core/renderer_opengl/gl_graphics_pipeline.h" |
| 20 | #include "video_core/shader_cache.h" | 20 | #include "video_core/shader_cache.h" |
| 21 | 21 | ||
| 22 | namespace Tegra { | 22 | namespace Tegra { |
| @@ -55,24 +55,24 @@ public: | |||
| 55 | ProgramManager& program_manager_, StateTracker& state_tracker_); | 55 | ProgramManager& program_manager_, StateTracker& state_tracker_); |
| 56 | ~ShaderCache(); | 56 | ~ShaderCache(); |
| 57 | 57 | ||
| 58 | [[nodiscard]] GraphicsProgram* CurrentGraphicsProgram(); | 58 | [[nodiscard]] GraphicsPipeline* CurrentGraphicsPipeline(); |
| 59 | 59 | ||
| 60 | [[nodiscard]] ComputeProgram* CurrentComputeProgram(); | 60 | [[nodiscard]] ComputePipeline* CurrentComputePipeline(); |
| 61 | 61 | ||
| 62 | private: | 62 | private: |
| 63 | std::unique_ptr<GraphicsProgram> CreateGraphicsProgram(); | 63 | std::unique_ptr<GraphicsPipeline> CreateGraphicsPipeline(); |
| 64 | 64 | ||
| 65 | std::unique_ptr<GraphicsProgram> CreateGraphicsProgram( | 65 | std::unique_ptr<GraphicsPipeline> CreateGraphicsPipeline( |
| 66 | ShaderPools& pools, const GraphicsProgramKey& key, | 66 | ShaderPools& pools, const GraphicsPipelineKey& key, |
| 67 | std::span<Shader::Environment* const> envs, bool build_in_parallel); | 67 | std::span<Shader::Environment* const> envs, bool build_in_parallel); |
| 68 | 68 | ||
| 69 | std::unique_ptr<ComputeProgram> CreateComputeProgram(const ComputeProgramKey& key, | 69 | std::unique_ptr<ComputePipeline> CreateComputePipeline(const ComputePipelineKey& key, |
| 70 | const VideoCommon::ShaderInfo* shader); | 70 | const VideoCommon::ShaderInfo* shader); |
| 71 | 71 | ||
| 72 | std::unique_ptr<ComputeProgram> CreateComputeProgram(ShaderPools& pools, | 72 | std::unique_ptr<ComputePipeline> CreateComputePipeline(ShaderPools& pools, |
| 73 | const ComputeProgramKey& key, | 73 | const ComputePipelineKey& key, |
| 74 | Shader::Environment& env, | 74 | Shader::Environment& env, |
| 75 | bool build_in_parallel); | 75 | bool build_in_parallel); |
| 76 | 76 | ||
| 77 | Core::Frontend::EmuWindow& emu_window; | 77 | Core::Frontend::EmuWindow& emu_window; |
| 78 | const Device& device; | 78 | const Device& device; |
| @@ -81,11 +81,11 @@ private: | |||
| 81 | ProgramManager& program_manager; | 81 | ProgramManager& program_manager; |
| 82 | StateTracker& state_tracker; | 82 | StateTracker& state_tracker; |
| 83 | 83 | ||
| 84 | GraphicsProgramKey graphics_key{}; | 84 | GraphicsPipelineKey graphics_key{}; |
| 85 | 85 | ||
| 86 | ShaderPools main_pools; | 86 | ShaderPools main_pools; |
| 87 | std::unordered_map<GraphicsProgramKey, std::unique_ptr<GraphicsProgram>> graphics_cache; | 87 | std::unordered_map<GraphicsPipelineKey, std::unique_ptr<GraphicsPipeline>> graphics_cache; |
| 88 | std::unordered_map<ComputeProgramKey, std::unique_ptr<ComputeProgram>> compute_cache; | 88 | std::unordered_map<ComputePipelineKey, std::unique_ptr<ComputePipeline>> compute_cache; |
| 89 | 89 | ||
| 90 | Shader::Profile profile; | 90 | Shader::Profile profile; |
| 91 | }; | 91 | }; |
diff --git a/src/video_core/renderer_opengl/gl_shader_manager.h b/src/video_core/renderer_opengl/gl_shader_manager.h index 5ec57d707..88b734bcb 100644 --- a/src/video_core/renderer_opengl/gl_shader_manager.h +++ b/src/video_core/renderer_opengl/gl_shader_manager.h | |||
| @@ -9,8 +9,8 @@ | |||
| 9 | 9 | ||
| 10 | #include <glad/glad.h> | 10 | #include <glad/glad.h> |
| 11 | 11 | ||
| 12 | #include "video_core/renderer_opengl/gl_resource_manager.h" | ||
| 13 | #include "video_core/renderer_opengl/gl_device.h" | 12 | #include "video_core/renderer_opengl/gl_device.h" |
| 13 | #include "video_core/renderer_opengl/gl_resource_manager.h" | ||
| 14 | 14 | ||
| 15 | namespace OpenGL { | 15 | namespace OpenGL { |
| 16 | 16 | ||