diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_shader_decompiler.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp b/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp index 9f717b836..3f23ba749 100644 --- a/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp +++ b/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp | |||
| @@ -804,6 +804,38 @@ private: | |||
| 804 | return {}; | 804 | return {}; |
| 805 | } | 805 | } |
| 806 | 806 | ||
| 807 | Id GetTextureSampler(Operation operation) { | ||
| 808 | const auto meta = std::get_if<MetaTexture>(&operation.GetMeta()); | ||
| 809 | const auto entry = sampler_images.at(static_cast<u32>(meta->sampler.GetIndex())); | ||
| 810 | return Emit(OpLoad(entry.sampled_image_type, entry.sampler)); | ||
| 811 | } | ||
| 812 | |||
| 813 | Id GetTextureImage(Operation operation) { | ||
| 814 | const auto meta = std::get_if<MetaTexture>(&operation.GetMeta()); | ||
| 815 | const auto entry = sampler_images.at(static_cast<u32>(meta->sampler.GetIndex())); | ||
| 816 | return Emit(OpImage(entry.image_type, GetTextureSampler(operation))); | ||
| 817 | } | ||
| 818 | |||
| 819 | Id GetTextureCoordinates(Operation operation) { | ||
| 820 | const auto meta = std::get_if<MetaTexture>(&operation.GetMeta()); | ||
| 821 | std::vector<Id> coords; | ||
| 822 | for (std::size_t i = 0; i < operation.GetOperandsCount(); ++i) { | ||
| 823 | coords.push_back(Visit(operation[i])); | ||
| 824 | } | ||
| 825 | if (meta->sampler.IsArray()) { | ||
| 826 | const Id array_integer = BitcastTo<Type::Int>(Visit(meta->array)); | ||
| 827 | coords.push_back(Emit(OpConvertSToF(t_float, array_integer))); | ||
| 828 | } | ||
| 829 | if (meta->sampler.IsShadow()) { | ||
| 830 | coords.push_back(Visit(meta->depth_compare)); | ||
| 831 | } | ||
| 832 | |||
| 833 | const std::array<Id, 4> t_float_lut = {nullptr, t_float2, t_float3, t_float4}; | ||
| 834 | return coords.size() == 1 | ||
| 835 | ? coords[0] | ||
| 836 | : Emit(OpCompositeConstruct(t_float_lut.at(coords.size() - 1), coords)); | ||
| 837 | } | ||
| 838 | |||
| 807 | Id Texture(Operation operation) { | 839 | Id Texture(Operation operation) { |
| 808 | UNIMPLEMENTED(); | 840 | UNIMPLEMENTED(); |
| 809 | return {}; | 841 | return {}; |