diff options
| author | 2020-06-12 23:14:48 -0400 | |
|---|---|---|
| committer | 2020-06-12 23:14:48 -0400 | |
| commit | 563388756951e06a2eeb4fa1e8c806993f34f4a9 (patch) | |
| tree | 5034180e818531fedf8618e5520b6e9f24315289 /src/video_core/renderer_vulkan | |
| parent | Merge pull request #4010 from ogniK5377/reserve-always-break (diff) | |
| parent | rasterizer_cache: Remove files and includes (diff) | |
| download | yuzu-563388756951e06a2eeb4fa1e8c806993f34f4a9.tar.gz yuzu-563388756951e06a2eeb4fa1e8c806993f34f4a9.tar.xz yuzu-563388756951e06a2eeb4fa1e8c806993f34f4a9.zip | |
Merge pull request #3986 from ReinUsesLisp/shader-cache
shader_cache: Implement a generic runtime shader cache
Diffstat (limited to 'src/video_core/renderer_vulkan')
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_buffer_cache.h | 1 | ||||
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_pipeline_cache.cpp | 72 | ||||
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_pipeline_cache.h | 33 | ||||
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_rasterizer.cpp | 7 | ||||
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_rasterizer.h | 2 |
5 files changed, 55 insertions, 60 deletions
diff --git a/src/video_core/renderer_vulkan/vk_buffer_cache.h b/src/video_core/renderer_vulkan/vk_buffer_cache.h index a54583e7d..65cb3c8ad 100644 --- a/src/video_core/renderer_vulkan/vk_buffer_cache.h +++ b/src/video_core/renderer_vulkan/vk_buffer_cache.h | |||
| @@ -8,7 +8,6 @@ | |||
| 8 | 8 | ||
| 9 | #include "common/common_types.h" | 9 | #include "common/common_types.h" |
| 10 | #include "video_core/buffer_cache/buffer_cache.h" | 10 | #include "video_core/buffer_cache/buffer_cache.h" |
| 11 | #include "video_core/rasterizer_cache.h" | ||
| 12 | #include "video_core/renderer_vulkan/vk_memory_manager.h" | 11 | #include "video_core/renderer_vulkan/vk_memory_manager.h" |
| 13 | #include "video_core/renderer_vulkan/vk_staging_buffer_pool.h" | 12 | #include "video_core/renderer_vulkan/vk_staging_buffer_pool.h" |
| 14 | #include "video_core/renderer_vulkan/vk_stream_buffer.h" | 13 | #include "video_core/renderer_vulkan/vk_stream_buffer.h" |
diff --git a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp index b8ccf164f..ea66e621e 100644 --- a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp | |||
| @@ -27,6 +27,7 @@ | |||
| 27 | #include "video_core/renderer_vulkan/wrapper.h" | 27 | #include "video_core/renderer_vulkan/wrapper.h" |
| 28 | #include "video_core/shader/compiler_settings.h" | 28 | #include "video_core/shader/compiler_settings.h" |
| 29 | #include "video_core/shader/memory_util.h" | 29 | #include "video_core/shader/memory_util.h" |
| 30 | #include "video_core/shader_cache.h" | ||
| 30 | 31 | ||
| 31 | namespace Vulkan { | 32 | namespace Vulkan { |
| 32 | 33 | ||
| @@ -132,19 +133,18 @@ bool ComputePipelineCacheKey::operator==(const ComputePipelineCacheKey& rhs) con | |||
| 132 | return std::memcmp(&rhs, this, sizeof *this) == 0; | 133 | return std::memcmp(&rhs, this, sizeof *this) == 0; |
| 133 | } | 134 | } |
| 134 | 135 | ||
| 135 | CachedShader::CachedShader(Core::System& system, Tegra::Engines::ShaderType stage, | 136 | Shader::Shader(Core::System& system, Tegra::Engines::ShaderType stage, GPUVAddr gpu_addr, |
| 136 | GPUVAddr gpu_addr, VAddr cpu_addr, ProgramCode program_code, | 137 | VideoCommon::Shader::ProgramCode program_code, u32 main_offset) |
| 137 | u32 main_offset) | 138 | : gpu_addr{gpu_addr}, program_code{std::move(program_code)}, |
| 138 | : RasterizerCacheObject{cpu_addr}, gpu_addr{gpu_addr}, program_code{std::move(program_code)}, | ||
| 139 | registry{stage, GetEngine(system, stage)}, shader_ir{this->program_code, main_offset, | 139 | registry{stage, GetEngine(system, stage)}, shader_ir{this->program_code, main_offset, |
| 140 | compiler_settings, registry}, | 140 | compiler_settings, registry}, |
| 141 | entries{GenerateShaderEntries(shader_ir)} {} | 141 | entries{GenerateShaderEntries(shader_ir)} {} |
| 142 | 142 | ||
| 143 | CachedShader::~CachedShader() = default; | 143 | Shader::~Shader() = default; |
| 144 | 144 | ||
| 145 | Tegra::Engines::ConstBufferEngineInterface& CachedShader::GetEngine( | 145 | Tegra::Engines::ConstBufferEngineInterface& Shader::GetEngine(Core::System& system, |
| 146 | Core::System& system, Tegra::Engines::ShaderType stage) { | 146 | Tegra::Engines::ShaderType stage) { |
| 147 | if (stage == Tegra::Engines::ShaderType::Compute) { | 147 | if (stage == ShaderType::Compute) { |
| 148 | return system.GPU().KeplerCompute(); | 148 | return system.GPU().KeplerCompute(); |
| 149 | } else { | 149 | } else { |
| 150 | return system.GPU().Maxwell3D(); | 150 | return system.GPU().Maxwell3D(); |
| @@ -156,16 +156,16 @@ VKPipelineCache::VKPipelineCache(Core::System& system, RasterizerVulkan& rasteri | |||
| 156 | VKDescriptorPool& descriptor_pool, | 156 | VKDescriptorPool& descriptor_pool, |
| 157 | VKUpdateDescriptorQueue& update_descriptor_queue, | 157 | VKUpdateDescriptorQueue& update_descriptor_queue, |
| 158 | VKRenderPassCache& renderpass_cache) | 158 | VKRenderPassCache& renderpass_cache) |
| 159 | : RasterizerCache{rasterizer}, system{system}, device{device}, scheduler{scheduler}, | 159 | : VideoCommon::ShaderCache<Shader>{rasterizer}, system{system}, device{device}, |
| 160 | descriptor_pool{descriptor_pool}, update_descriptor_queue{update_descriptor_queue}, | 160 | scheduler{scheduler}, descriptor_pool{descriptor_pool}, |
| 161 | renderpass_cache{renderpass_cache} {} | 161 | update_descriptor_queue{update_descriptor_queue}, renderpass_cache{renderpass_cache} {} |
| 162 | 162 | ||
| 163 | VKPipelineCache::~VKPipelineCache() = default; | 163 | VKPipelineCache::~VKPipelineCache() = default; |
| 164 | 164 | ||
| 165 | std::array<Shader, Maxwell::MaxShaderProgram> VKPipelineCache::GetShaders() { | 165 | std::array<Shader*, Maxwell::MaxShaderProgram> VKPipelineCache::GetShaders() { |
| 166 | const auto& gpu = system.GPU().Maxwell3D(); | 166 | const auto& gpu = system.GPU().Maxwell3D(); |
| 167 | 167 | ||
| 168 | std::array<Shader, Maxwell::MaxShaderProgram> shaders; | 168 | std::array<Shader*, Maxwell::MaxShaderProgram> shaders{}; |
| 169 | for (std::size_t index = 0; index < Maxwell::MaxShaderProgram; ++index) { | 169 | for (std::size_t index = 0; index < Maxwell::MaxShaderProgram; ++index) { |
| 170 | const auto program{static_cast<Maxwell::ShaderProgram>(index)}; | 170 | const auto program{static_cast<Maxwell::ShaderProgram>(index)}; |
| 171 | 171 | ||
| @@ -178,24 +178,28 @@ std::array<Shader, Maxwell::MaxShaderProgram> VKPipelineCache::GetShaders() { | |||
| 178 | const GPUVAddr program_addr{GetShaderAddress(system, program)}; | 178 | const GPUVAddr program_addr{GetShaderAddress(system, program)}; |
| 179 | const std::optional cpu_addr = memory_manager.GpuToCpuAddress(program_addr); | 179 | const std::optional cpu_addr = memory_manager.GpuToCpuAddress(program_addr); |
| 180 | ASSERT(cpu_addr); | 180 | ASSERT(cpu_addr); |
| 181 | auto shader = cpu_addr ? TryGet(*cpu_addr) : null_shader; | 181 | |
| 182 | if (!shader) { | 182 | Shader* result = cpu_addr ? TryGet(*cpu_addr) : null_shader.get(); |
| 183 | if (!result) { | ||
| 183 | const auto host_ptr{memory_manager.GetPointer(program_addr)}; | 184 | const auto host_ptr{memory_manager.GetPointer(program_addr)}; |
| 184 | 185 | ||
| 185 | // No shader found - create a new one | 186 | // No shader found - create a new one |
| 186 | constexpr u32 stage_offset = STAGE_MAIN_OFFSET; | 187 | constexpr u32 stage_offset = STAGE_MAIN_OFFSET; |
| 187 | const auto stage = static_cast<Tegra::Engines::ShaderType>(index == 0 ? 0 : index - 1); | 188 | const auto stage = static_cast<ShaderType>(index == 0 ? 0 : index - 1); |
| 188 | ProgramCode code = GetShaderCode(memory_manager, program_addr, host_ptr, false); | 189 | ProgramCode code = GetShaderCode(memory_manager, program_addr, host_ptr, false); |
| 190 | const std::size_t size_in_bytes = code.size() * sizeof(u64); | ||
| 191 | |||
| 192 | auto shader = std::make_unique<Shader>(system, stage, program_addr, std::move(code), | ||
| 193 | stage_offset); | ||
| 194 | result = shader.get(); | ||
| 189 | 195 | ||
| 190 | shader = std::make_shared<CachedShader>(system, stage, program_addr, *cpu_addr, | ||
| 191 | std::move(code), stage_offset); | ||
| 192 | if (cpu_addr) { | 196 | if (cpu_addr) { |
| 193 | Register(shader); | 197 | Register(std::move(shader), *cpu_addr, size_in_bytes); |
| 194 | } else { | 198 | } else { |
| 195 | null_shader = shader; | 199 | null_shader = std::move(shader); |
| 196 | } | 200 | } |
| 197 | } | 201 | } |
| 198 | shaders[index] = std::move(shader); | 202 | shaders[index] = result; |
| 199 | } | 203 | } |
| 200 | return last_shaders = shaders; | 204 | return last_shaders = shaders; |
| 201 | } | 205 | } |
| @@ -236,19 +240,22 @@ VKComputePipeline& VKPipelineCache::GetComputePipeline(const ComputePipelineCach | |||
| 236 | const auto cpu_addr = memory_manager.GpuToCpuAddress(program_addr); | 240 | const auto cpu_addr = memory_manager.GpuToCpuAddress(program_addr); |
| 237 | ASSERT(cpu_addr); | 241 | ASSERT(cpu_addr); |
| 238 | 242 | ||
| 239 | auto shader = cpu_addr ? TryGet(*cpu_addr) : null_kernel; | 243 | Shader* shader = cpu_addr ? TryGet(*cpu_addr) : null_kernel.get(); |
| 240 | if (!shader) { | 244 | if (!shader) { |
| 241 | // No shader found - create a new one | 245 | // No shader found - create a new one |
| 242 | const auto host_ptr = memory_manager.GetPointer(program_addr); | 246 | const auto host_ptr = memory_manager.GetPointer(program_addr); |
| 243 | 247 | ||
| 244 | ProgramCode code = GetShaderCode(memory_manager, program_addr, host_ptr, true); | 248 | ProgramCode code = GetShaderCode(memory_manager, program_addr, host_ptr, true); |
| 245 | shader = std::make_shared<CachedShader>(system, Tegra::Engines::ShaderType::Compute, | 249 | const std::size_t size_in_bytes = code.size() * sizeof(u64); |
| 246 | program_addr, *cpu_addr, std::move(code), | 250 | |
| 247 | KERNEL_MAIN_OFFSET); | 251 | auto shader_info = std::make_unique<Shader>(system, ShaderType::Compute, program_addr, |
| 252 | std::move(code), KERNEL_MAIN_OFFSET); | ||
| 253 | shader = shader_info.get(); | ||
| 254 | |||
| 248 | if (cpu_addr) { | 255 | if (cpu_addr) { |
| 249 | Register(shader); | 256 | Register(std::move(shader_info), *cpu_addr, size_in_bytes); |
| 250 | } else { | 257 | } else { |
| 251 | null_kernel = shader; | 258 | null_kernel = std::move(shader_info); |
| 252 | } | 259 | } |
| 253 | } | 260 | } |
| 254 | 261 | ||
| @@ -264,7 +271,7 @@ VKComputePipeline& VKPipelineCache::GetComputePipeline(const ComputePipelineCach | |||
| 264 | return *entry; | 271 | return *entry; |
| 265 | } | 272 | } |
| 266 | 273 | ||
| 267 | void VKPipelineCache::Unregister(const Shader& shader) { | 274 | void VKPipelineCache::OnShaderRemoval(Shader* shader) { |
| 268 | bool finished = false; | 275 | bool finished = false; |
| 269 | const auto Finish = [&] { | 276 | const auto Finish = [&] { |
| 270 | // TODO(Rodrigo): Instead of finishing here, wait for the fences that use this pipeline and | 277 | // TODO(Rodrigo): Instead of finishing here, wait for the fences that use this pipeline and |
| @@ -296,8 +303,6 @@ void VKPipelineCache::Unregister(const Shader& shader) { | |||
| 296 | Finish(); | 303 | Finish(); |
| 297 | it = compute_cache.erase(it); | 304 | it = compute_cache.erase(it); |
| 298 | } | 305 | } |
| 299 | |||
| 300 | RasterizerCache::Unregister(shader); | ||
| 301 | } | 306 | } |
| 302 | 307 | ||
| 303 | std::pair<SPIRVProgram, std::vector<VkDescriptorSetLayoutBinding>> | 308 | std::pair<SPIRVProgram, std::vector<VkDescriptorSetLayoutBinding>> |
| @@ -332,12 +337,11 @@ VKPipelineCache::DecompileShaders(const GraphicsPipelineCacheKey& key) { | |||
| 332 | } | 337 | } |
| 333 | 338 | ||
| 334 | const GPUVAddr gpu_addr = GetShaderAddress(system, program_enum); | 339 | const GPUVAddr gpu_addr = GetShaderAddress(system, program_enum); |
| 335 | const auto cpu_addr = memory_manager.GpuToCpuAddress(gpu_addr); | 340 | const std::optional<VAddr> cpu_addr = memory_manager.GpuToCpuAddress(gpu_addr); |
| 336 | const auto shader = cpu_addr ? TryGet(*cpu_addr) : null_shader; | 341 | Shader* const shader = cpu_addr ? TryGet(*cpu_addr) : null_shader.get(); |
| 337 | ASSERT(shader); | ||
| 338 | 342 | ||
| 339 | const std::size_t stage = index == 0 ? 0 : index - 1; // Stage indices are 0 - 5 | 343 | const std::size_t stage = index == 0 ? 0 : index - 1; // Stage indices are 0 - 5 |
| 340 | const auto program_type = GetShaderType(program_enum); | 344 | const ShaderType program_type = GetShaderType(program_enum); |
| 341 | const auto& entries = shader->GetEntries(); | 345 | const auto& entries = shader->GetEntries(); |
| 342 | program[stage] = { | 346 | program[stage] = { |
| 343 | Decompile(device, shader->GetIR(), program_type, shader->GetRegistry(), specialization), | 347 | Decompile(device, shader->GetIR(), program_type, shader->GetRegistry(), specialization), |
diff --git a/src/video_core/renderer_vulkan/vk_pipeline_cache.h b/src/video_core/renderer_vulkan/vk_pipeline_cache.h index 0b5796fef..0a36e5112 100644 --- a/src/video_core/renderer_vulkan/vk_pipeline_cache.h +++ b/src/video_core/renderer_vulkan/vk_pipeline_cache.h | |||
| @@ -17,7 +17,6 @@ | |||
| 17 | #include "common/common_types.h" | 17 | #include "common/common_types.h" |
| 18 | #include "video_core/engines/const_buffer_engine_interface.h" | 18 | #include "video_core/engines/const_buffer_engine_interface.h" |
| 19 | #include "video_core/engines/maxwell_3d.h" | 19 | #include "video_core/engines/maxwell_3d.h" |
| 20 | #include "video_core/rasterizer_cache.h" | ||
| 21 | #include "video_core/renderer_vulkan/fixed_pipeline_state.h" | 20 | #include "video_core/renderer_vulkan/fixed_pipeline_state.h" |
| 22 | #include "video_core/renderer_vulkan/vk_graphics_pipeline.h" | 21 | #include "video_core/renderer_vulkan/vk_graphics_pipeline.h" |
| 23 | #include "video_core/renderer_vulkan/vk_renderpass_cache.h" | 22 | #include "video_core/renderer_vulkan/vk_renderpass_cache.h" |
| @@ -26,6 +25,7 @@ | |||
| 26 | #include "video_core/shader/memory_util.h" | 25 | #include "video_core/shader/memory_util.h" |
| 27 | #include "video_core/shader/registry.h" | 26 | #include "video_core/shader/registry.h" |
| 28 | #include "video_core/shader/shader_ir.h" | 27 | #include "video_core/shader/shader_ir.h" |
| 28 | #include "video_core/shader_cache.h" | ||
| 29 | 29 | ||
| 30 | namespace Core { | 30 | namespace Core { |
| 31 | class System; | 31 | class System; |
| @@ -41,8 +41,6 @@ class VKFence; | |||
| 41 | class VKScheduler; | 41 | class VKScheduler; |
| 42 | class VKUpdateDescriptorQueue; | 42 | class VKUpdateDescriptorQueue; |
| 43 | 43 | ||
| 44 | class CachedShader; | ||
| 45 | using Shader = std::shared_ptr<CachedShader>; | ||
| 46 | using Maxwell = Tegra::Engines::Maxwell3D::Regs; | 44 | using Maxwell = Tegra::Engines::Maxwell3D::Regs; |
| 47 | 45 | ||
| 48 | struct GraphicsPipelineCacheKey { | 46 | struct GraphicsPipelineCacheKey { |
| @@ -102,21 +100,16 @@ struct hash<Vulkan::ComputePipelineCacheKey> { | |||
| 102 | 100 | ||
| 103 | namespace Vulkan { | 101 | namespace Vulkan { |
| 104 | 102 | ||
| 105 | class CachedShader final : public RasterizerCacheObject { | 103 | class Shader { |
| 106 | public: | 104 | public: |
| 107 | explicit CachedShader(Core::System& system, Tegra::Engines::ShaderType stage, GPUVAddr gpu_addr, | 105 | explicit Shader(Core::System& system, Tegra::Engines::ShaderType stage, GPUVAddr gpu_addr, |
| 108 | VAddr cpu_addr, VideoCommon::Shader::ProgramCode program_code, | 106 | VideoCommon::Shader::ProgramCode program_code, u32 main_offset); |
| 109 | u32 main_offset); | 107 | ~Shader(); |
| 110 | ~CachedShader(); | ||
| 111 | 108 | ||
| 112 | GPUVAddr GetGpuAddr() const { | 109 | GPUVAddr GetGpuAddr() const { |
| 113 | return gpu_addr; | 110 | return gpu_addr; |
| 114 | } | 111 | } |
| 115 | 112 | ||
| 116 | std::size_t GetSizeInBytes() const override { | ||
| 117 | return program_code.size() * sizeof(u64); | ||
| 118 | } | ||
| 119 | |||
| 120 | VideoCommon::Shader::ShaderIR& GetIR() { | 113 | VideoCommon::Shader::ShaderIR& GetIR() { |
| 121 | return shader_ir; | 114 | return shader_ir; |
| 122 | } | 115 | } |
| @@ -144,25 +137,23 @@ private: | |||
| 144 | ShaderEntries entries; | 137 | ShaderEntries entries; |
| 145 | }; | 138 | }; |
| 146 | 139 | ||
| 147 | class VKPipelineCache final : public RasterizerCache<Shader> { | 140 | class VKPipelineCache final : public VideoCommon::ShaderCache<Shader> { |
| 148 | public: | 141 | public: |
| 149 | explicit VKPipelineCache(Core::System& system, RasterizerVulkan& rasterizer, | 142 | explicit VKPipelineCache(Core::System& system, RasterizerVulkan& rasterizer, |
| 150 | const VKDevice& device, VKScheduler& scheduler, | 143 | const VKDevice& device, VKScheduler& scheduler, |
| 151 | VKDescriptorPool& descriptor_pool, | 144 | VKDescriptorPool& descriptor_pool, |
| 152 | VKUpdateDescriptorQueue& update_descriptor_queue, | 145 | VKUpdateDescriptorQueue& update_descriptor_queue, |
| 153 | VKRenderPassCache& renderpass_cache); | 146 | VKRenderPassCache& renderpass_cache); |
| 154 | ~VKPipelineCache(); | 147 | ~VKPipelineCache() override; |
| 155 | 148 | ||
| 156 | std::array<Shader, Maxwell::MaxShaderProgram> GetShaders(); | 149 | std::array<Shader*, Maxwell::MaxShaderProgram> GetShaders(); |
| 157 | 150 | ||
| 158 | VKGraphicsPipeline& GetGraphicsPipeline(const GraphicsPipelineCacheKey& key); | 151 | VKGraphicsPipeline& GetGraphicsPipeline(const GraphicsPipelineCacheKey& key); |
| 159 | 152 | ||
| 160 | VKComputePipeline& GetComputePipeline(const ComputePipelineCacheKey& key); | 153 | VKComputePipeline& GetComputePipeline(const ComputePipelineCacheKey& key); |
| 161 | 154 | ||
| 162 | protected: | 155 | protected: |
| 163 | void Unregister(const Shader& shader) override; | 156 | void OnShaderRemoval(Shader* shader) final; |
| 164 | |||
| 165 | void FlushObjectInner(const Shader& object) override {} | ||
| 166 | 157 | ||
| 167 | private: | 158 | private: |
| 168 | std::pair<SPIRVProgram, std::vector<VkDescriptorSetLayoutBinding>> DecompileShaders( | 159 | std::pair<SPIRVProgram, std::vector<VkDescriptorSetLayoutBinding>> DecompileShaders( |
| @@ -175,10 +166,10 @@ private: | |||
| 175 | VKUpdateDescriptorQueue& update_descriptor_queue; | 166 | VKUpdateDescriptorQueue& update_descriptor_queue; |
| 176 | VKRenderPassCache& renderpass_cache; | 167 | VKRenderPassCache& renderpass_cache; |
| 177 | 168 | ||
| 178 | Shader null_shader{}; | 169 | std::unique_ptr<Shader> null_shader; |
| 179 | Shader null_kernel{}; | 170 | std::unique_ptr<Shader> null_kernel; |
| 180 | 171 | ||
| 181 | std::array<Shader, Maxwell::MaxShaderProgram> last_shaders; | 172 | std::array<Shader*, Maxwell::MaxShaderProgram> last_shaders{}; |
| 182 | 173 | ||
| 183 | GraphicsPipelineCacheKey last_graphics_key; | 174 | GraphicsPipelineCacheKey last_graphics_key; |
| 184 | VKGraphicsPipeline* last_graphics_pipeline = nullptr; | 175 | VKGraphicsPipeline* last_graphics_pipeline = nullptr; |
diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.cpp b/src/video_core/renderer_vulkan/vk_rasterizer.cpp index 19b8f9da3..3170c41f8 100644 --- a/src/video_core/renderer_vulkan/vk_rasterizer.cpp +++ b/src/video_core/renderer_vulkan/vk_rasterizer.cpp | |||
| @@ -38,6 +38,7 @@ | |||
| 38 | #include "video_core/renderer_vulkan/vk_texture_cache.h" | 38 | #include "video_core/renderer_vulkan/vk_texture_cache.h" |
| 39 | #include "video_core/renderer_vulkan/vk_update_descriptor.h" | 39 | #include "video_core/renderer_vulkan/vk_update_descriptor.h" |
| 40 | #include "video_core/renderer_vulkan/wrapper.h" | 40 | #include "video_core/renderer_vulkan/wrapper.h" |
| 41 | #include "video_core/shader_cache.h" | ||
| 41 | 42 | ||
| 42 | namespace Vulkan { | 43 | namespace Vulkan { |
| 43 | 44 | ||
| @@ -98,7 +99,7 @@ VkRect2D GetScissorState(const Maxwell& regs, std::size_t index) { | |||
| 98 | } | 99 | } |
| 99 | 100 | ||
| 100 | std::array<GPUVAddr, Maxwell::MaxShaderProgram> GetShaderAddresses( | 101 | std::array<GPUVAddr, Maxwell::MaxShaderProgram> GetShaderAddresses( |
| 101 | const std::array<Shader, Maxwell::MaxShaderProgram>& shaders) { | 102 | const std::array<Shader*, Maxwell::MaxShaderProgram>& shaders) { |
| 102 | std::array<GPUVAddr, Maxwell::MaxShaderProgram> addresses; | 103 | std::array<GPUVAddr, Maxwell::MaxShaderProgram> addresses; |
| 103 | for (std::size_t i = 0; i < std::size(addresses); ++i) { | 104 | for (std::size_t i = 0; i < std::size(addresses); ++i) { |
| 104 | addresses[i] = shaders[i] ? shaders[i]->GetGpuAddr() : 0; | 105 | addresses[i] = shaders[i] ? shaders[i]->GetGpuAddr() : 0; |
| @@ -776,12 +777,12 @@ RasterizerVulkan::DrawParameters RasterizerVulkan::SetupGeometry(FixedPipelineSt | |||
| 776 | } | 777 | } |
| 777 | 778 | ||
| 778 | void RasterizerVulkan::SetupShaderDescriptors( | 779 | void RasterizerVulkan::SetupShaderDescriptors( |
| 779 | const std::array<Shader, Maxwell::MaxShaderProgram>& shaders) { | 780 | const std::array<Shader*, Maxwell::MaxShaderProgram>& shaders) { |
| 780 | texture_cache.GuardSamplers(true); | 781 | texture_cache.GuardSamplers(true); |
| 781 | 782 | ||
| 782 | for (std::size_t stage = 0; stage < Maxwell::MaxShaderStage; ++stage) { | 783 | for (std::size_t stage = 0; stage < Maxwell::MaxShaderStage; ++stage) { |
| 783 | // Skip VertexA stage | 784 | // Skip VertexA stage |
| 784 | const auto& shader = shaders[stage + 1]; | 785 | Shader* const shader = shaders[stage + 1]; |
| 785 | if (!shader) { | 786 | if (!shader) { |
| 786 | continue; | 787 | continue; |
| 787 | } | 788 | } |
diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.h b/src/video_core/renderer_vulkan/vk_rasterizer.h index 04be37a5e..c8c187606 100644 --- a/src/video_core/renderer_vulkan/vk_rasterizer.h +++ b/src/video_core/renderer_vulkan/vk_rasterizer.h | |||
| @@ -168,7 +168,7 @@ private: | |||
| 168 | bool is_indexed, bool is_instanced); | 168 | bool is_indexed, bool is_instanced); |
| 169 | 169 | ||
| 170 | /// Setup descriptors in the graphics pipeline. | 170 | /// Setup descriptors in the graphics pipeline. |
| 171 | void SetupShaderDescriptors(const std::array<Shader, Maxwell::MaxShaderProgram>& shaders); | 171 | void SetupShaderDescriptors(const std::array<Shader*, Maxwell::MaxShaderProgram>& shaders); |
| 172 | 172 | ||
| 173 | void SetupImageTransitions(Texceptions texceptions, | 173 | void SetupImageTransitions(Texceptions texceptions, |
| 174 | const std::array<View, Maxwell::NumRenderTargets>& color_attachments, | 174 | const std::array<View, Maxwell::NumRenderTargets>& color_attachments, |