diff options
Diffstat (limited to 'src/shader_recompiler')
| -rw-r--r-- | src/shader_recompiler/ir_opt/collect_shader_info_pass.cpp | 19 | ||||
| -rw-r--r-- | src/shader_recompiler/shader_info.h | 1 |
2 files changed, 17 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) { | |||
| 560 | case IR::Opcode::GetCbufU32: | 560 | case IR::Opcode::GetCbufU32: |
| 561 | case IR::Opcode::GetCbufF32: | 561 | case IR::Opcode::GetCbufF32: |
| 562 | case IR::Opcode::GetCbufU32x2: { | 562 | case IR::Opcode::GetCbufU32x2: { |
| 563 | if (const IR::Value index{inst.Arg(0)}; index.IsImmediate()) { | 563 | const IR::Value index{inst.Arg(0)}; |
| 564 | AddConstantBufferDescriptor(info, index.U32(), 1); | 564 | const IR::Value offset{inst.Arg(1)}; |
| 565 | } else { | 565 | if (!index.IsImmediate()) { |
| 566 | throw NotImplementedException("Constant buffer with non-immediate index"); | 566 | throw NotImplementedException("Constant buffer with non-immediate index"); |
| 567 | } | 567 | } |
| 568 | AddConstantBufferDescriptor(info, index.U32(), 1); | ||
| 569 | u32 element_size{}; | ||
| 568 | switch (inst.GetOpcode()) { | 570 | switch (inst.GetOpcode()) { |
| 569 | case IR::Opcode::GetCbufU8: | 571 | case IR::Opcode::GetCbufU8: |
| 570 | case IR::Opcode::GetCbufS8: | 572 | case IR::Opcode::GetCbufS8: |
| 571 | info.used_constant_buffer_types |= IR::Type::U8; | 573 | info.used_constant_buffer_types |= IR::Type::U8; |
| 574 | element_size = 1; | ||
| 572 | break; | 575 | break; |
| 573 | case IR::Opcode::GetCbufU16: | 576 | case IR::Opcode::GetCbufU16: |
| 574 | case IR::Opcode::GetCbufS16: | 577 | case IR::Opcode::GetCbufS16: |
| 575 | info.used_constant_buffer_types |= IR::Type::U16; | 578 | info.used_constant_buffer_types |= IR::Type::U16; |
| 579 | element_size = 2; | ||
| 576 | break; | 580 | break; |
| 577 | case IR::Opcode::GetCbufU32: | 581 | case IR::Opcode::GetCbufU32: |
| 578 | info.used_constant_buffer_types |= IR::Type::U32; | 582 | info.used_constant_buffer_types |= IR::Type::U32; |
| 583 | element_size = 4; | ||
| 579 | break; | 584 | break; |
| 580 | case IR::Opcode::GetCbufF32: | 585 | case IR::Opcode::GetCbufF32: |
| 581 | info.used_constant_buffer_types |= IR::Type::F32; | 586 | info.used_constant_buffer_types |= IR::Type::F32; |
| 587 | element_size = 4; | ||
| 582 | break; | 588 | break; |
| 583 | case IR::Opcode::GetCbufU32x2: | 589 | case IR::Opcode::GetCbufU32x2: |
| 584 | info.used_constant_buffer_types |= IR::Type::U32x2; | 590 | info.used_constant_buffer_types |= IR::Type::U32x2; |
| 591 | element_size = 8; | ||
| 585 | break; | 592 | break; |
| 586 | default: | 593 | default: |
| 587 | break; | 594 | break; |
| 588 | } | 595 | } |
| 596 | u32& size{info.constant_buffer_used_sizes[index.U32()]}; | ||
| 597 | if (offset.IsImmediate()) { | ||
| 598 | size = std::max(size, offset.U32() + element_size); | ||
| 599 | } else { | ||
| 600 | size = 0x10'000; | ||
| 601 | } | ||
| 589 | break; | 602 | break; |
| 590 | } | 603 | } |
| 591 | case IR::Opcode::BindlessImageSampleImplicitLod: | 604 | case IR::Opcode::BindlessImageSampleImplicitLod: |
diff --git a/src/shader_recompiler/shader_info.h b/src/shader_recompiler/shader_info.h index d5b2ca7bc..32f8a50ea 100644 --- a/src/shader_recompiler/shader_info.h +++ b/src/shader_recompiler/shader_info.h | |||
| @@ -197,6 +197,7 @@ struct Info { | |||
| 197 | IR::Type used_storage_buffer_types{}; | 197 | IR::Type used_storage_buffer_types{}; |
| 198 | 198 | ||
| 199 | u32 constant_buffer_mask{}; | 199 | u32 constant_buffer_mask{}; |
| 200 | std::array<u32, MAX_CBUFS> constant_buffer_used_sizes{}; | ||
| 200 | u32 nvn_buffer_base{}; | 201 | u32 nvn_buffer_base{}; |
| 201 | std::bitset<16> nvn_buffer_used{}; | 202 | std::bitset<16> nvn_buffer_used{}; |
| 202 | 203 | ||