From 00d745e4e55823bf2e281d99ba95084229c481d5 Mon Sep 17 00:00:00 2001 From: lizzie Date: Mon, 27 Apr 2026 15:12:17 +0000 Subject: [PATCH] coalesce --- src/shader_recompiler/ir_opt/texture_pass.cpp | 10 +++++----- src/video_core/renderer_vulkan/vk_compute_pipeline.cpp | 5 ++--- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/shader_recompiler/ir_opt/texture_pass.cpp b/src/shader_recompiler/ir_opt/texture_pass.cpp index a0122e6761..2c1d9b0720 100644 --- a/src/shader_recompiler/ir_opt/texture_pass.cpp +++ b/src/shader_recompiler/ir_opt/texture_pass.cpp @@ -30,9 +30,9 @@ struct TextureInst { using TextureInstVector = boost::container::small_vector; -constexpr u32 DESCRIPTOR_SIZE = 8; -constexpr u32 DESCRIPTOR_SIZE_SHIFT = static_cast(std::countr_zero(DESCRIPTOR_SIZE)); -constexpr u32 BINDLESS_ARRAY_LENGTH = 1024; +// TODO: We need to implement scatter/gather CBuf stuff +constexpr u32 DESCRIPTOR_SIZE = 1024; +constexpr u32 DESCRIPTOR_SIZE_SHIFT = u32(std::countr_zero(u32(8))); IR::Opcode IndexedInstruction(const IR::Inst& inst) { switch (inst.GetOpcode()) { @@ -363,7 +363,7 @@ std::optional TryGetConstBuffer(const IR::Inst* inst, Environme .secondary_offset = 0, .secondary_shift_left = 0, .dynamic_offset = dynamic_offset, - .count = BINDLESS_ARRAY_LENGTH, + .count = DESCRIPTOR_SIZE, .has_secondary = false, }; } @@ -717,7 +717,7 @@ void TexturePass(Environment& env, IR::Program& program, const HostTranslateInfo const auto insert_point{IR::Block::InstructionList::s_iterator_to(*inst)}; IR::IREmitter ir{*texture_inst.block, insert_point}; const IR::U32 shift{ir.Imm32(DESCRIPTOR_SIZE_SHIFT)}; - inst->SetArg(0, ir.UMin(ir.ShiftRightLogical(cbuf.dynamic_offset, shift), ir.Imm32(BINDLESS_ARRAY_LENGTH - 1))); + inst->SetArg(0, ir.UMin(ir.ShiftRightLogical(cbuf.dynamic_offset, shift), ir.Imm32(DESCRIPTOR_SIZE - 1))); } else { inst->SetArg(0, IR::Value{}); } diff --git a/src/video_core/renderer_vulkan/vk_compute_pipeline.cpp b/src/video_core/renderer_vulkan/vk_compute_pipeline.cpp index bf3e671e59..490dd7acfe 100644 --- a/src/video_core/renderer_vulkan/vk_compute_pipeline.cpp +++ b/src/video_core/renderer_vulkan/vk_compute_pipeline.cpp @@ -127,9 +127,8 @@ void ComputePipeline::Configure(Tegra::Engines::KeplerCompute& kepler_compute, texture_cache.SynchronizeComputeDescriptors(); - static constexpr size_t max_elements = 16384; - boost::container::static_vector views; - boost::container::static_vector samplers; + boost::container::small_vector views; + boost::container::small_vector samplers; const auto& qmd{kepler_compute.launch_description}; const auto& cbufs{qmd.const_buffer_config};