diff options
| author | 2021-10-16 00:30:43 -0400 | |
|---|---|---|
| committer | 2021-11-16 22:11:31 +0100 | |
| commit | 618de4e7871898f165c028293becd235ce3ccb09 (patch) | |
| tree | a41f25c847177f4f5d8c6ce8da5651f71f7418a5 /src | |
| parent | Texture Cahe: Fix downscaling on SMO. (diff) | |
| download | yuzu-618de4e7871898f165c028293becd235ce3ccb09.tar.gz yuzu-618de4e7871898f165c028293becd235ce3ccb09.tar.xz yuzu-618de4e7871898f165c028293becd235ce3ccb09.zip | |
vulkan: Fix rescaling push constant usage
Diffstat (limited to 'src')
8 files changed, 78 insertions, 69 deletions
diff --git a/src/shader_recompiler/backend/spirv/emit_context.cpp b/src/shader_recompiler/backend/spirv/emit_context.cpp index 8646fe989..723455462 100644 --- a/src/shader_recompiler/backend/spirv/emit_context.cpp +++ b/src/shader_recompiler/backend/spirv/emit_context.cpp | |||
| @@ -1006,47 +1006,47 @@ void EmitContext::DefineRescalingInput(const Info& info) { | |||
| 1006 | return; | 1006 | return; |
| 1007 | } | 1007 | } |
| 1008 | if (profile.unified_descriptor_binding) { | 1008 | if (profile.unified_descriptor_binding) { |
| 1009 | DefineRescalingInputPushConstant(info); | 1009 | DefineRescalingInputPushConstant(); |
| 1010 | } else { | 1010 | } else { |
| 1011 | DefineRescalingInputUniformConstant(); | 1011 | DefineRescalingInputUniformConstant(); |
| 1012 | } | 1012 | } |
| 1013 | } | 1013 | } |
| 1014 | 1014 | ||
| 1015 | void EmitContext::DefineRescalingInputPushConstant(const Info& info) { | 1015 | void EmitContext::DefineRescalingInputPushConstant() { |
| 1016 | boost::container::static_vector<Id, 3> members{F32[1]}; | 1016 | boost::container::static_vector<Id, 3> members{}; |
| 1017 | u32 member_index{0}; | 1017 | u32 member_index{0}; |
| 1018 | if (!info.texture_descriptors.empty()) { | 1018 | |
| 1019 | rescaling_textures_type = TypeArray(U32[1], Const(4u)); | 1019 | rescaling_textures_type = TypeArray(U32[1], Const(4u)); |
| 1020 | Decorate(rescaling_textures_type, spv::Decoration::ArrayStride, 4u); | 1020 | Decorate(rescaling_textures_type, spv::Decoration::ArrayStride, 4u); |
| 1021 | members.push_back(rescaling_textures_type); | 1021 | members.push_back(rescaling_textures_type); |
| 1022 | rescaling_textures_member_index = ++member_index; | 1022 | rescaling_textures_member_index = member_index++; |
| 1023 | } | 1023 | |
| 1024 | if (!info.image_descriptors.empty()) { | 1024 | rescaling_images_type = TypeArray(U32[1], Const(NUM_IMAGE_SCALING_WORDS)); |
| 1025 | rescaling_images_type = TypeArray(U32[1], Const(NUM_IMAGE_SCALING_WORDS)); | 1025 | Decorate(rescaling_images_type, spv::Decoration::ArrayStride, 4u); |
| 1026 | if (rescaling_textures_type.value != rescaling_images_type.value) { | 1026 | members.push_back(rescaling_images_type); |
| 1027 | Decorate(rescaling_images_type, spv::Decoration::ArrayStride, 4u); | 1027 | rescaling_images_member_index = member_index++; |
| 1028 | } | 1028 | |
| 1029 | members.push_back(rescaling_images_type); | 1029 | if (stage != Stage::Compute) { |
| 1030 | rescaling_images_member_index = ++member_index; | 1030 | members.push_back(F32[1]); |
| 1031 | rescaling_downfactor_member_index = member_index++; | ||
| 1031 | } | 1032 | } |
| 1032 | const Id push_constant_struct{TypeStruct(std::span(members.data(), members.size()))}; | 1033 | const Id push_constant_struct{TypeStruct(std::span(members.data(), members.size()))}; |
| 1033 | Decorate(push_constant_struct, spv::Decoration::Block); | 1034 | Decorate(push_constant_struct, spv::Decoration::Block); |
| 1034 | Name(push_constant_struct, "ResolutionInfo"); | 1035 | Name(push_constant_struct, "ResolutionInfo"); |
| 1035 | 1036 | ||
| 1036 | MemberDecorate(push_constant_struct, 0u, spv::Decoration::Offset, 0u); | 1037 | MemberDecorate(push_constant_struct, rescaling_textures_member_index, spv::Decoration::Offset, |
| 1037 | MemberName(push_constant_struct, 0u, "down_factor"); | 1038 | static_cast<u32>(offsetof(RescalingLayout, rescaling_textures))); |
| 1039 | MemberName(push_constant_struct, rescaling_textures_member_index, "rescaling_textures"); | ||
| 1038 | 1040 | ||
| 1039 | const u32 offset_bias = stage == Stage::Compute ? sizeof(u32) : 0; | 1041 | MemberDecorate(push_constant_struct, rescaling_images_member_index, spv::Decoration::Offset, |
| 1040 | if (!info.texture_descriptors.empty()) { | 1042 | static_cast<u32>(offsetof(RescalingLayout, rescaling_images))); |
| 1041 | MemberDecorate( | 1043 | MemberName(push_constant_struct, rescaling_images_member_index, "rescaling_images"); |
| 1042 | push_constant_struct, rescaling_textures_member_index, spv::Decoration::Offset, | 1044 | |
| 1043 | static_cast<u32>(offsetof(RescalingLayout, rescaling_textures) - offset_bias)); | 1045 | if (stage != Stage::Compute) { |
| 1044 | MemberName(push_constant_struct, rescaling_textures_member_index, "rescaling_textures"); | 1046 | MemberDecorate(push_constant_struct, rescaling_downfactor_member_index, |
| 1045 | } | 1047 | spv::Decoration::Offset, |
| 1046 | if (!info.image_descriptors.empty()) { | 1048 | static_cast<u32>(offsetof(RescalingLayout, down_factor))); |
| 1047 | MemberDecorate(push_constant_struct, rescaling_images_member_index, spv::Decoration::Offset, | 1049 | MemberName(push_constant_struct, rescaling_downfactor_member_index, "down_factor"); |
| 1048 | static_cast<u32>(offsetof(RescalingLayout, rescaling_images) - offset_bias)); | ||
| 1049 | MemberName(push_constant_struct, rescaling_images_member_index, "rescaling_images"); | ||
| 1050 | } | 1050 | } |
| 1051 | const Id pointer_type{TypePointer(spv::StorageClass::PushConstant, push_constant_struct)}; | 1051 | const Id pointer_type{TypePointer(spv::StorageClass::PushConstant, push_constant_struct)}; |
| 1052 | rescaling_push_constants = AddGlobalVariable(pointer_type, spv::StorageClass::PushConstant); | 1052 | rescaling_push_constants = AddGlobalVariable(pointer_type, spv::StorageClass::PushConstant); |
diff --git a/src/shader_recompiler/backend/spirv/emit_context.h b/src/shader_recompiler/backend/spirv/emit_context.h index b67704baa..63f8185d9 100644 --- a/src/shader_recompiler/backend/spirv/emit_context.h +++ b/src/shader_recompiler/backend/spirv/emit_context.h | |||
| @@ -244,6 +244,7 @@ public: | |||
| 244 | Id rescaling_images_type{}; | 244 | Id rescaling_images_type{}; |
| 245 | u32 rescaling_textures_member_index{}; | 245 | u32 rescaling_textures_member_index{}; |
| 246 | u32 rescaling_images_member_index{}; | 246 | u32 rescaling_images_member_index{}; |
| 247 | u32 rescaling_downfactor_member_index{}; | ||
| 247 | u32 texture_rescaling_index{}; | 248 | u32 texture_rescaling_index{}; |
| 248 | u32 image_rescaling_index{}; | 249 | u32 image_rescaling_index{}; |
| 249 | 250 | ||
| @@ -324,7 +325,7 @@ private: | |||
| 324 | void DefineAttributeMemAccess(const Info& info); | 325 | void DefineAttributeMemAccess(const Info& info); |
| 325 | void DefineGlobalMemoryFunctions(const Info& info); | 326 | void DefineGlobalMemoryFunctions(const Info& info); |
| 326 | void DefineRescalingInput(const Info& info); | 327 | void DefineRescalingInput(const Info& info); |
| 327 | void DefineRescalingInputPushConstant(const Info& info); | 328 | void DefineRescalingInputPushConstant(); |
| 328 | void DefineRescalingInputUniformConstant(); | 329 | void DefineRescalingInputUniformConstant(); |
| 329 | 330 | ||
| 330 | void DefineInputs(const IR::Program& program); | 331 | void DefineInputs(const IR::Program& program); |
diff --git a/src/shader_recompiler/backend/spirv/emit_spirv.h b/src/shader_recompiler/backend/spirv/emit_spirv.h index cf59f2572..4b25534ce 100644 --- a/src/shader_recompiler/backend/spirv/emit_spirv.h +++ b/src/shader_recompiler/backend/spirv/emit_spirv.h | |||
| @@ -22,11 +22,12 @@ constexpr u32 NUM_TEXTURE_AND_IMAGE_SCALING_WORDS = | |||
| 22 | NUM_TEXTURE_SCALING_WORDS + NUM_IMAGE_SCALING_WORDS; | 22 | NUM_TEXTURE_SCALING_WORDS + NUM_IMAGE_SCALING_WORDS; |
| 23 | 23 | ||
| 24 | struct RescalingLayout { | 24 | struct RescalingLayout { |
| 25 | u32 down_factor; | ||
| 26 | alignas(16) std::array<u32, NUM_TEXTURE_SCALING_WORDS> rescaling_textures; | 25 | alignas(16) std::array<u32, NUM_TEXTURE_SCALING_WORDS> rescaling_textures; |
| 27 | alignas(16) std::array<u32, NUM_IMAGE_SCALING_WORDS> rescaling_images; | 26 | alignas(16) std::array<u32, NUM_IMAGE_SCALING_WORDS> rescaling_images; |
| 27 | alignas(16) u32 down_factor; | ||
| 28 | }; | 28 | }; |
| 29 | constexpr u32 RESCALING_PUSH_CONSTANT_WORDS_OFFSET = offsetof(RescalingLayout, rescaling_textures); | 29 | constexpr u32 RESCALING_LAYOUT_WORDS_OFFSET = offsetof(RescalingLayout, rescaling_textures); |
| 30 | constexpr u32 RESCALING_LAYOUT_DOWN_FACTOR_OFFSET = offsetof(RescalingLayout, down_factor); | ||
| 30 | 31 | ||
| 31 | [[nodiscard]] std::vector<u32> EmitSPIRV(const Profile& profile, const RuntimeInfo& runtime_info, | 32 | [[nodiscard]] std::vector<u32> EmitSPIRV(const Profile& profile, const RuntimeInfo& runtime_info, |
| 32 | IR::Program& program, Bindings& bindings); | 33 | IR::Program& program, Bindings& bindings); |
diff --git a/src/shader_recompiler/backend/spirv/emit_spirv_context_get_set.cpp b/src/shader_recompiler/backend/spirv/emit_spirv_context_get_set.cpp index c0db7452f..bac683ae1 100644 --- a/src/shader_recompiler/backend/spirv/emit_spirv_context_get_set.cpp +++ b/src/shader_recompiler/backend/spirv/emit_spirv_context_get_set.cpp | |||
| @@ -529,8 +529,8 @@ Id EmitYDirection(EmitContext& ctx) { | |||
| 529 | Id EmitResolutionDownFactor(EmitContext& ctx) { | 529 | Id EmitResolutionDownFactor(EmitContext& ctx) { |
| 530 | if (ctx.profile.unified_descriptor_binding) { | 530 | if (ctx.profile.unified_descriptor_binding) { |
| 531 | const Id pointer_type{ctx.TypePointer(spv::StorageClass::PushConstant, ctx.F32[1])}; | 531 | const Id pointer_type{ctx.TypePointer(spv::StorageClass::PushConstant, ctx.F32[1])}; |
| 532 | const Id pointer{ | 532 | const Id index{ctx.Const(ctx.rescaling_downfactor_member_index)}; |
| 533 | ctx.OpAccessChain(pointer_type, ctx.rescaling_push_constants, ctx.u32_zero_value)}; | 533 | const Id pointer{ctx.OpAccessChain(pointer_type, ctx.rescaling_push_constants, index)}; |
| 534 | return ctx.OpLoad(ctx.F32[1], pointer); | 534 | return ctx.OpLoad(ctx.F32[1], pointer); |
| 535 | } else { | 535 | } else { |
| 536 | const Id composite{ctx.OpLoad(ctx.F32[4], ctx.rescaling_uniform_constant)}; | 536 | const Id composite{ctx.OpLoad(ctx.F32[4], ctx.rescaling_uniform_constant)}; |
diff --git a/src/video_core/renderer_vulkan/pipeline_helper.h b/src/video_core/renderer_vulkan/pipeline_helper.h index 3612e8a18..ae5e66ef4 100644 --- a/src/video_core/renderer_vulkan/pipeline_helper.h +++ b/src/video_core/renderer_vulkan/pipeline_helper.h | |||
| @@ -22,7 +22,6 @@ | |||
| 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; | ||
| 26 | 25 | ||
| 27 | class DescriptorLayoutBuilder { | 26 | class DescriptorLayoutBuilder { |
| 28 | public: | 27 | public: |
| @@ -73,12 +72,12 @@ public: | |||
| 73 | 72 | ||
| 74 | vk::PipelineLayout CreatePipelineLayout(VkDescriptorSetLayout descriptor_set_layout) const { | 73 | vk::PipelineLayout CreatePipelineLayout(VkDescriptorSetLayout descriptor_set_layout) const { |
| 75 | using Shader::Backend::SPIRV::RescalingLayout; | 74 | using Shader::Backend::SPIRV::RescalingLayout; |
| 76 | const u32 push_offset = is_compute ? RESCALING_PUSH_CONSTANT_WORDS_OFFSET : 0; | 75 | const u32 size_offset = is_compute ? sizeof(RescalingLayout::down_factor) : 0u; |
| 77 | const VkPushConstantRange range{ | 76 | const VkPushConstantRange range{ |
| 78 | .stageFlags = static_cast<VkShaderStageFlags>( | 77 | .stageFlags = static_cast<VkShaderStageFlags>( |
| 79 | is_compute ? VK_SHADER_STAGE_COMPUTE_BIT : VK_SHADER_STAGE_ALL_GRAPHICS), | 78 | is_compute ? VK_SHADER_STAGE_COMPUTE_BIT : VK_SHADER_STAGE_ALL_GRAPHICS), |
| 80 | .offset = 0, | 79 | .offset = 0, |
| 81 | .size = sizeof(RescalingLayout) - push_offset, | 80 | .size = sizeof(RescalingLayout) - size_offset, |
| 82 | }; | 81 | }; |
| 83 | return device->GetLogical().CreatePipelineLayout({ | 82 | return device->GetLogical().CreatePipelineLayout({ |
| 84 | .sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO, | 83 | .sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO, |
| @@ -139,21 +138,21 @@ private: | |||
| 139 | 138 | ||
| 140 | class RescalingPushConstant { | 139 | class RescalingPushConstant { |
| 141 | public: | 140 | public: |
| 142 | explicit RescalingPushConstant(u32 num_textures) noexcept {} | 141 | explicit RescalingPushConstant() noexcept {} |
| 143 | 142 | ||
| 144 | void PushTexture(bool is_rescaled) noexcept { | 143 | void PushTexture(bool is_rescaled) noexcept { |
| 145 | *texture_ptr |= is_rescaled ? texture_bit : 0; | 144 | *texture_ptr |= is_rescaled ? texture_bit : 0u; |
| 146 | texture_bit <<= 1; | 145 | texture_bit <<= 1u; |
| 147 | if (texture_bit == 0) { | 146 | if (texture_bit == 0u) { |
| 148 | texture_bit = 1u; | 147 | texture_bit = 1u; |
| 149 | ++texture_ptr; | 148 | ++texture_ptr; |
| 150 | } | 149 | } |
| 151 | } | 150 | } |
| 152 | 151 | ||
| 153 | void PushImage(bool is_rescaled) noexcept { | 152 | void PushImage(bool is_rescaled) noexcept { |
| 154 | *image_ptr |= is_rescaled ? image_bit : 0; | 153 | *image_ptr |= is_rescaled ? image_bit : 0u; |
| 155 | image_bit <<= 1; | 154 | image_bit <<= 1u; |
| 156 | if (image_bit == 0) { | 155 | if (image_bit == 0u) { |
| 157 | image_bit = 1u; | 156 | image_bit = 1u; |
| 158 | ++image_ptr; | 157 | ++image_ptr; |
| 159 | } | 158 | } |
| @@ -176,8 +175,10 @@ inline void PushImageDescriptors(TextureCache& texture_cache, | |||
| 176 | const Shader::Info& info, RescalingPushConstant& rescaling, | 175 | const Shader::Info& info, RescalingPushConstant& rescaling, |
| 177 | const VkSampler*& samplers, | 176 | const VkSampler*& samplers, |
| 178 | const VideoCommon::ImageViewInOut*& views) { | 177 | const VideoCommon::ImageViewInOut*& views) { |
| 179 | views += Shader::NumDescriptors(info.texture_buffer_descriptors); | 178 | const u32 num_texture_buffers = Shader::NumDescriptors(info.texture_buffer_descriptors); |
| 180 | views += Shader::NumDescriptors(info.image_buffer_descriptors); | 179 | const u32 num_image_buffers = Shader::NumDescriptors(info.image_buffer_descriptors); |
| 180 | views += num_texture_buffers; | ||
| 181 | views += num_image_buffers; | ||
| 181 | for (const auto& desc : info.texture_descriptors) { | 182 | for (const auto& desc : info.texture_descriptors) { |
| 182 | for (u32 index = 0; index < desc.count; ++index) { | 183 | for (u32 index = 0; index < desc.count; ++index) { |
| 183 | const VideoCommon::ImageViewId image_view_id{(views++)->id}; | 184 | const VideoCommon::ImageViewId image_view_id{(views++)->id}; |
diff --git a/src/video_core/renderer_vulkan/vk_compute_pipeline.cpp b/src/video_core/renderer_vulkan/vk_compute_pipeline.cpp index 6dc52e399..de36bcdb7 100644 --- a/src/video_core/renderer_vulkan/vk_compute_pipeline.cpp +++ b/src/video_core/renderer_vulkan/vk_compute_pipeline.cpp | |||
| @@ -22,6 +22,7 @@ | |||
| 22 | namespace Vulkan { | 22 | namespace Vulkan { |
| 23 | 23 | ||
| 24 | using Shader::ImageBufferDescriptor; | 24 | using Shader::ImageBufferDescriptor; |
| 25 | using Shader::Backend::SPIRV::RESCALING_LAYOUT_WORDS_OFFSET; | ||
| 25 | using Tegra::Texture::TexturePair; | 26 | using Tegra::Texture::TexturePair; |
| 26 | 27 | ||
| 27 | ComputePipeline::ComputePipeline(const Device& device_, DescriptorPool& descriptor_pool, | 28 | ComputePipeline::ComputePipeline(const Device& device_, DescriptorPool& descriptor_pool, |
| @@ -185,7 +186,7 @@ void ComputePipeline::Configure(Tegra::Engines::KeplerCompute& kepler_compute, | |||
| 185 | buffer_cache.UpdateComputeBuffers(); | 186 | buffer_cache.UpdateComputeBuffers(); |
| 186 | buffer_cache.BindHostComputeBuffers(); | 187 | buffer_cache.BindHostComputeBuffers(); |
| 187 | 188 | ||
| 188 | RescalingPushConstant rescaling(num_textures); | 189 | RescalingPushConstant rescaling; |
| 189 | const VkSampler* samplers_it{samplers.data()}; | 190 | const VkSampler* samplers_it{samplers.data()}; |
| 190 | const VideoCommon::ImageViewInOut* views_it{views.data()}; | 191 | const VideoCommon::ImageViewInOut* views_it{views.data()}; |
| 191 | PushImageDescriptors(texture_cache, update_descriptor_queue, info, rescaling, samplers_it, | 192 | PushImageDescriptors(texture_cache, update_descriptor_queue, info, rescaling, samplers_it, |
| @@ -199,21 +200,24 @@ void ComputePipeline::Configure(Tegra::Engines::KeplerCompute& kepler_compute, | |||
| 199 | }); | 200 | }); |
| 200 | } | 201 | } |
| 201 | const void* const descriptor_data{update_descriptor_queue.UpdateData()}; | 202 | const void* const descriptor_data{update_descriptor_queue.UpdateData()}; |
| 202 | scheduler.Record( | 203 | const bool is_rescaling = !info.texture_descriptors.empty() || !info.image_descriptors.empty(); |
| 203 | [this, descriptor_data, rescaling_data = rescaling.Data()](vk::CommandBuffer cmdbuf) { | 204 | scheduler.Record([this, descriptor_data, is_rescaling, |
| 204 | cmdbuf.BindPipeline(VK_PIPELINE_BIND_POINT_COMPUTE, *pipeline); | 205 | rescaling_data = rescaling.Data()](vk::CommandBuffer cmdbuf) { |
| 205 | if (!descriptor_set_layout) { | 206 | cmdbuf.BindPipeline(VK_PIPELINE_BIND_POINT_COMPUTE, *pipeline); |
| 206 | return; | 207 | if (!descriptor_set_layout) { |
| 207 | } | 208 | return; |
| 208 | if (num_textures > 0) { | 209 | } |
| 209 | cmdbuf.PushConstants(*pipeline_layout, VK_SHADER_STAGE_COMPUTE_BIT, rescaling_data); | 210 | if (is_rescaling) { |
| 210 | } | 211 | cmdbuf.PushConstants(*pipeline_layout, VK_SHADER_STAGE_COMPUTE_BIT, |
| 211 | const VkDescriptorSet descriptor_set{descriptor_allocator.Commit()}; | 212 | RESCALING_LAYOUT_WORDS_OFFSET, sizeof(rescaling_data), |
| 212 | const vk::Device& dev{device.GetLogical()}; | 213 | rescaling_data.data()); |
| 213 | dev.UpdateDescriptorSet(descriptor_set, *descriptor_update_template, descriptor_data); | 214 | } |
| 214 | cmdbuf.BindDescriptorSets(VK_PIPELINE_BIND_POINT_COMPUTE, *pipeline_layout, 0, | 215 | const VkDescriptorSet descriptor_set{descriptor_allocator.Commit()}; |
| 215 | descriptor_set, nullptr); | 216 | const vk::Device& dev{device.GetLogical()}; |
| 216 | }); | 217 | dev.UpdateDescriptorSet(descriptor_set, *descriptor_update_template, descriptor_data); |
| 218 | cmdbuf.BindDescriptorSets(VK_PIPELINE_BIND_POINT_COMPUTE, *pipeline_layout, 0, | ||
| 219 | descriptor_set, nullptr); | ||
| 220 | }); | ||
| 217 | } | 221 | } |
| 218 | 222 | ||
| 219 | } // namespace Vulkan | 223 | } // namespace Vulkan |
diff --git a/src/video_core/renderer_vulkan/vk_compute_pipeline.h b/src/video_core/renderer_vulkan/vk_compute_pipeline.h index e79ce4d7c..8c4b0a301 100644 --- a/src/video_core/renderer_vulkan/vk_compute_pipeline.h +++ b/src/video_core/renderer_vulkan/vk_compute_pipeline.h | |||
| @@ -59,7 +59,6 @@ private: | |||
| 59 | vk::PipelineLayout pipeline_layout; | 59 | vk::PipelineLayout pipeline_layout; |
| 60 | vk::DescriptorUpdateTemplateKHR descriptor_update_template; | 60 | vk::DescriptorUpdateTemplateKHR descriptor_update_template; |
| 61 | vk::Pipeline pipeline; | 61 | vk::Pipeline pipeline; |
| 62 | u32 num_textures{}; | ||
| 63 | 62 | ||
| 64 | std::condition_variable build_condvar; | 63 | std::condition_variable build_condvar; |
| 65 | std::mutex build_mutex; | 64 | std::mutex build_mutex; |
diff --git a/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp b/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp index f08e9e840..616a7b457 100644 --- a/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp +++ b/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp | |||
| @@ -32,6 +32,8 @@ namespace { | |||
| 32 | using boost::container::small_vector; | 32 | using boost::container::small_vector; |
| 33 | using boost::container::static_vector; | 33 | using boost::container::static_vector; |
| 34 | using Shader::ImageBufferDescriptor; | 34 | using Shader::ImageBufferDescriptor; |
| 35 | using Shader::Backend::SPIRV::RESCALING_LAYOUT_DOWN_FACTOR_OFFSET; | ||
| 36 | using Shader::Backend::SPIRV::RESCALING_LAYOUT_WORDS_OFFSET; | ||
| 35 | using Tegra::Texture::TexturePair; | 37 | using Tegra::Texture::TexturePair; |
| 36 | using VideoCore::Surface::PixelFormat; | 38 | using VideoCore::Surface::PixelFormat; |
| 37 | using VideoCore::Surface::PixelFormatFromDepthFormat; | 39 | using VideoCore::Surface::PixelFormatFromDepthFormat; |
| @@ -431,7 +433,7 @@ void GraphicsPipeline::ConfigureImpl(bool is_indexed) { | |||
| 431 | 433 | ||
| 432 | update_descriptor_queue.Acquire(); | 434 | update_descriptor_queue.Acquire(); |
| 433 | 435 | ||
| 434 | RescalingPushConstant rescaling(num_textures); | 436 | RescalingPushConstant rescaling; |
| 435 | const VkSampler* samplers_it{samplers.data()}; | 437 | const VkSampler* samplers_it{samplers.data()}; |
| 436 | const VideoCommon::ImageViewInOut* views_it{views.data()}; | 438 | const VideoCommon::ImageViewInOut* views_it{views.data()}; |
| 437 | const auto prepare_stage{[&](size_t stage) LAMBDA_FORCEINLINE { | 439 | const auto prepare_stage{[&](size_t stage) LAMBDA_FORCEINLINE { |
| @@ -477,15 +479,16 @@ void GraphicsPipeline::ConfigureDraw(const RescalingPushConstant& rescaling) { | |||
| 477 | if (bind_pipeline) { | 479 | if (bind_pipeline) { |
| 478 | cmdbuf.BindPipeline(VK_PIPELINE_BIND_POINT_GRAPHICS, *pipeline); | 480 | cmdbuf.BindPipeline(VK_PIPELINE_BIND_POINT_GRAPHICS, *pipeline); |
| 479 | } | 481 | } |
| 482 | cmdbuf.PushConstants(*pipeline_layout, VK_SHADER_STAGE_ALL_GRAPHICS, | ||
| 483 | RESCALING_LAYOUT_WORDS_OFFSET, sizeof(rescaling_data), | ||
| 484 | rescaling_data.data()); | ||
| 480 | if (update_rescaling) { | 485 | if (update_rescaling) { |
| 481 | const f32 config_down_factor{Settings::values.resolution_info.down_factor}; | 486 | const f32 config_down_factor{Settings::values.resolution_info.down_factor}; |
| 482 | const f32 scale_down_factor{is_rescaling ? config_down_factor : 1.0f}; | 487 | const f32 scale_down_factor{is_rescaling ? config_down_factor : 1.0f}; |
| 483 | cmdbuf.PushConstants(*pipeline_layout, VK_SHADER_STAGE_ALL_GRAPHICS, 0, | 488 | cmdbuf.PushConstants(*pipeline_layout, VK_SHADER_STAGE_ALL_GRAPHICS, |
| 484 | sizeof(scale_down_factor), &scale_down_factor); | 489 | RESCALING_LAYOUT_DOWN_FACTOR_OFFSET, sizeof(scale_down_factor), |
| 490 | &scale_down_factor); | ||
| 485 | } | 491 | } |
| 486 | cmdbuf.PushConstants(*pipeline_layout, VK_SHADER_STAGE_ALL_GRAPHICS, | ||
| 487 | RESCALING_PUSH_CONSTANT_WORDS_OFFSET, sizeof(rescaling_data), | ||
| 488 | rescaling_data.data()); | ||
| 489 | if (!descriptor_set_layout) { | 492 | if (!descriptor_set_layout) { |
| 490 | return; | 493 | return; |
| 491 | } | 494 | } |