diff options
| -rw-r--r-- | src/shader_recompiler/backend/spirv/emit_spirv.h | 1 | ||||
| -rw-r--r-- | src/video_core/renderer_vulkan/pipeline_helper.h | 6 | ||||
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp | 5 |
3 files changed, 8 insertions, 4 deletions
diff --git a/src/shader_recompiler/backend/spirv/emit_spirv.h b/src/shader_recompiler/backend/spirv/emit_spirv.h index dd6dff0c8..cf59f2572 100644 --- a/src/shader_recompiler/backend/spirv/emit_spirv.h +++ b/src/shader_recompiler/backend/spirv/emit_spirv.h | |||
| @@ -26,6 +26,7 @@ struct RescalingLayout { | |||
| 26 | alignas(16) std::array<u32, NUM_TEXTURE_SCALING_WORDS> rescaling_textures; | 26 | alignas(16) std::array<u32, NUM_TEXTURE_SCALING_WORDS> rescaling_textures; |
| 27 | alignas(16) std::array<u32, NUM_IMAGE_SCALING_WORDS> rescaling_images; | 27 | alignas(16) std::array<u32, NUM_IMAGE_SCALING_WORDS> rescaling_images; |
| 28 | }; | 28 | }; |
| 29 | constexpr u32 RESCALING_PUSH_CONSTANT_WORDS_OFFSET = offsetof(RescalingLayout, rescaling_textures); | ||
| 29 | 30 | ||
| 30 | [[nodiscard]] std::vector<u32> EmitSPIRV(const Profile& profile, const RuntimeInfo& runtime_info, | 31 | [[nodiscard]] std::vector<u32> EmitSPIRV(const Profile& profile, const RuntimeInfo& runtime_info, |
| 31 | IR::Program& program, Bindings& bindings); | 32 | IR::Program& program, Bindings& bindings); |
diff --git a/src/video_core/renderer_vulkan/pipeline_helper.h b/src/video_core/renderer_vulkan/pipeline_helper.h index 85ae726d1..3612e8a18 100644 --- a/src/video_core/renderer_vulkan/pipeline_helper.h +++ b/src/video_core/renderer_vulkan/pipeline_helper.h | |||
| @@ -22,6 +22,7 @@ | |||
| 22 | namespace Vulkan { | 22 | namespace Vulkan { |
| 23 | 23 | ||
| 24 | using Shader::Backend::SPIRV::NUM_TEXTURE_AND_IMAGE_SCALING_WORDS; | 24 | using Shader::Backend::SPIRV::NUM_TEXTURE_AND_IMAGE_SCALING_WORDS; |
| 25 | using Shader::Backend::SPIRV::RESCALING_PUSH_CONSTANT_WORDS_OFFSET; | ||
| 25 | 26 | ||
| 26 | class DescriptorLayoutBuilder { | 27 | class DescriptorLayoutBuilder { |
| 27 | public: | 28 | public: |
| @@ -71,12 +72,13 @@ public: | |||
| 71 | } | 72 | } |
| 72 | 73 | ||
| 73 | vk::PipelineLayout CreatePipelineLayout(VkDescriptorSetLayout descriptor_set_layout) const { | 74 | vk::PipelineLayout CreatePipelineLayout(VkDescriptorSetLayout descriptor_set_layout) const { |
| 75 | using Shader::Backend::SPIRV::RescalingLayout; | ||
| 76 | const u32 push_offset = is_compute ? RESCALING_PUSH_CONSTANT_WORDS_OFFSET : 0; | ||
| 74 | const VkPushConstantRange range{ | 77 | const VkPushConstantRange range{ |
| 75 | .stageFlags = static_cast<VkShaderStageFlags>( | 78 | .stageFlags = static_cast<VkShaderStageFlags>( |
| 76 | is_compute ? VK_SHADER_STAGE_COMPUTE_BIT : VK_SHADER_STAGE_ALL_GRAPHICS), | 79 | is_compute ? VK_SHADER_STAGE_COMPUTE_BIT : VK_SHADER_STAGE_ALL_GRAPHICS), |
| 77 | .offset = 0, | 80 | .offset = 0, |
| 78 | .size = (is_compute ? 0 : sizeof(f32)) + | 81 | .size = sizeof(RescalingLayout) - push_offset, |
| 79 | sizeof(std::array<u32, NUM_TEXTURE_AND_IMAGE_SCALING_WORDS>), | ||
| 80 | }; | 82 | }; |
| 81 | return device->GetLogical().CreatePipelineLayout({ | 83 | return device->GetLogical().CreatePipelineLayout({ |
| 82 | .sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO, | 84 | .sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO, |
diff --git a/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp b/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp index 5ad1180bb..f08e9e840 100644 --- a/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp +++ b/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp | |||
| @@ -483,8 +483,9 @@ void GraphicsPipeline::ConfigureDraw(const RescalingPushConstant& rescaling) { | |||
| 483 | cmdbuf.PushConstants(*pipeline_layout, VK_SHADER_STAGE_ALL_GRAPHICS, 0, | 483 | cmdbuf.PushConstants(*pipeline_layout, VK_SHADER_STAGE_ALL_GRAPHICS, 0, |
| 484 | sizeof(scale_down_factor), &scale_down_factor); | 484 | sizeof(scale_down_factor), &scale_down_factor); |
| 485 | } | 485 | } |
| 486 | cmdbuf.PushConstants(*pipeline_layout, VK_SHADER_STAGE_ALL_GRAPHICS, sizeof(f32), | 486 | cmdbuf.PushConstants(*pipeline_layout, VK_SHADER_STAGE_ALL_GRAPHICS, |
| 487 | sizeof(rescaling_data), rescaling_data.data()); | 487 | RESCALING_PUSH_CONSTANT_WORDS_OFFSET, sizeof(rescaling_data), |
| 488 | rescaling_data.data()); | ||
| 488 | if (!descriptor_set_layout) { | 489 | if (!descriptor_set_layout) { |
| 489 | return; | 490 | return; |
| 490 | } | 491 | } |