From f6f0762e81c45faa6293cbb1f0be0b0d9a4b7a7b Mon Sep 17 00:00:00 2001
From: Nguyen Dac Nam <nam.kazt.91@gmail.com>
Date: Tue, 18 Feb 2020 21:34:01 +0700
Subject: [PATCH] vk_shader: Implement function ImageLoad (Used by Kirby Start
 Allies)

 Please enter the commit message for your changes. Lines starting
---
 src/video_core/renderer_vulkan/vk_shader_decompiler.cpp | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp b/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp
index 24a658dce3..070c98eef7 100644
--- a/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp
+++ b/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp
@@ -1748,8 +1748,12 @@ private:
     }
 
     Expression ImageLoad(Operation operation) {
-        UNIMPLEMENTED();
-        return {};
+        const auto& meta{std::get<MetaImage>(operation.GetMeta())};
+
+        const Id coords = GetCoordinates(operation, Type::Int);
+        const Id texel = OpImageRead(t_uint4, GetImage(operation), coords);
+
+        return {OpCompositeExtract(t_uint, texel, meta.element), Type::Uint};
     }
 
     Expression ImageStore(Operation operation) {