summaryrefslogtreecommitdiffstats
path: root/src/video_core/renderer_vulkan
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2019-03-14 06:45:51 +0100
committerReinUsesLisp <reinuseslisp@airmail.cc>2019-04-10 19:20:25 +0200
commit4667ed8e22cff003cebfdd469b65b13b035cfe55 (patch)
tree01ae46439ddacc5d41200bc6db67667119c9b01a /src/video_core/renderer_vulkan
parentvk_shader_decompiler: Implement Assign and LogicalAssign (diff)
downloadyuzu-4667ed8e22cff003cebfdd469b65b13b035cfe55.tar
yuzu-4667ed8e22cff003cebfdd469b65b13b035cfe55.tar.gz
yuzu-4667ed8e22cff003cebfdd469b65b13b035cfe55.tar.bz2
yuzu-4667ed8e22cff003cebfdd469b65b13b035cfe55.tar.lz
yuzu-4667ed8e22cff003cebfdd469b65b13b035cfe55.tar.xz
yuzu-4667ed8e22cff003cebfdd469b65b13b035cfe55.tar.zst
yuzu-4667ed8e22cff003cebfdd469b65b13b035cfe55.zip
Diffstat (limited to 'src/video_core/renderer_vulkan')
-rw-r--r--src/video_core/renderer_vulkan/vk_shader_decompiler.cpp32
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:
return {};
}
+ Id GetTextureSampler(Operation operation) {
+ const auto meta = std::get_if<MetaTexture>(&operation.GetMeta());
+ const auto entry = sampler_images.at(static_cast<u32>(meta->sampler.GetIndex()));
+ return Emit(OpLoad(entry.sampled_image_type, entry.sampler));
+ }
+
+ Id GetTextureImage(Operation operation) {
+ const auto meta = std::get_if<MetaTexture>(&operation.GetMeta());
+ const auto entry = sampler_images.at(static_cast<u32>(meta->sampler.GetIndex()));
+ return Emit(OpImage(entry.image_type, GetTextureSampler(operation)));
+ }
+
+ Id GetTextureCoordinates(Operation operation) {
+ const auto meta = std::get_if<MetaTexture>(&operation.GetMeta());
+ std::vector<Id> coords;
+ for (std::size_t i = 0; i < operation.GetOperandsCount(); ++i) {
+ coords.push_back(Visit(operation[i]));
+ }
+ if (meta->sampler.IsArray()) {
+ const Id array_integer = BitcastTo<Type::Int>(Visit(meta->array));
+ coords.push_back(Emit(OpConvertSToF(t_float, array_integer)));
+ }
+ if (meta->sampler.IsShadow()) {
+ coords.push_back(Visit(meta->depth_compare));
+ }
+
+ const std::array<Id, 4> t_float_lut = {nullptr, t_float2, t_float3, t_float4};
+ return coords.size() == 1
+ ? coords[0]
+ : Emit(OpCompositeConstruct(t_float_lut.at(coords.size() - 1), coords));
+ }
+
Id Texture(Operation operation) {
UNIMPLEMENTED();
return {};