summaryrefslogtreecommitdiffstats
path: root/src/shader_recompiler/ir_opt
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2021-06-02 07:15:07 +0200
committerameerj <52414509+ameerj@users.noreply.github.com>2021-07-23 03:51:34 +0200
commit4a2361a1e2271727f3259e8e4a60869165537253 (patch)
treed741b0e808aa6a622c01dd047d66211c201e0f85 /src/shader_recompiler/ir_opt
parenttransform_feedback: Read buffer stride from index instead of layout (diff)
downloadyuzu-4a2361a1e2271727f3259e8e4a60869165537253.tar
yuzu-4a2361a1e2271727f3259e8e4a60869165537253.tar.gz
yuzu-4a2361a1e2271727f3259e8e4a60869165537253.tar.bz2
yuzu-4a2361a1e2271727f3259e8e4a60869165537253.tar.lz
yuzu-4a2361a1e2271727f3259e8e4a60869165537253.tar.xz
yuzu-4a2361a1e2271727f3259e8e4a60869165537253.tar.zst
yuzu-4a2361a1e2271727f3259e8e4a60869165537253.zip
Diffstat (limited to 'src/shader_recompiler/ir_opt')
-rw-r--r--src/shader_recompiler/ir_opt/collect_shader_info_pass.cpp19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/shader_recompiler/ir_opt/collect_shader_info_pass.cpp b/src/shader_recompiler/ir_opt/collect_shader_info_pass.cpp
index 6a5243c9f..fb2031fc8 100644
--- a/src/shader_recompiler/ir_opt/collect_shader_info_pass.cpp
+++ b/src/shader_recompiler/ir_opt/collect_shader_info_pass.cpp
@@ -560,32 +560,45 @@ void VisitUsages(Info& info, IR::Inst& inst) {
case IR::Opcode::GetCbufU32:
case IR::Opcode::GetCbufF32:
case IR::Opcode::GetCbufU32x2: {
- if (const IR::Value index{inst.Arg(0)}; index.IsImmediate()) {
- AddConstantBufferDescriptor(info, index.U32(), 1);
- } else {
+ const IR::Value index{inst.Arg(0)};
+ const IR::Value offset{inst.Arg(1)};
+ if (!index.IsImmediate()) {
throw NotImplementedException("Constant buffer with non-immediate index");
}
+ AddConstantBufferDescriptor(info, index.U32(), 1);
+ u32 element_size{};
switch (inst.GetOpcode()) {
case IR::Opcode::GetCbufU8:
case IR::Opcode::GetCbufS8:
info.used_constant_buffer_types |= IR::Type::U8;
+ element_size = 1;
break;
case IR::Opcode::GetCbufU16:
case IR::Opcode::GetCbufS16:
info.used_constant_buffer_types |= IR::Type::U16;
+ element_size = 2;
break;
case IR::Opcode::GetCbufU32:
info.used_constant_buffer_types |= IR::Type::U32;
+ element_size = 4;
break;
case IR::Opcode::GetCbufF32:
info.used_constant_buffer_types |= IR::Type::F32;
+ element_size = 4;
break;
case IR::Opcode::GetCbufU32x2:
info.used_constant_buffer_types |= IR::Type::U32x2;
+ element_size = 8;
break;
default:
break;
}
+ u32& size{info.constant_buffer_used_sizes[index.U32()]};
+ if (offset.IsImmediate()) {
+ size = std::max(size, offset.U32() + element_size);
+ } else {
+ size = 0x10'000;
+ }
break;
}
case IR::Opcode::BindlessImageSampleImplicitLod: