summaryrefslogtreecommitdiffstats
path: root/src/video_core/shader/glsl_decompiler.cpp
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2018-12-23 05:18:33 +0100
committerReinUsesLisp <reinuseslisp@airmail.cc>2019-01-15 21:54:52 +0100
commit55e6786254d33e3501002bf7fbdd52552a0df32a (patch)
treec4d516419aff5dfa35c1de13efa77294afc50e16 /src/video_core/shader/glsl_decompiler.cpp
parentshader_decode: Update TLD4 reflecting #1862 changes (diff)
downloadyuzu-55e6786254d33e3501002bf7fbdd52552a0df32a.tar
yuzu-55e6786254d33e3501002bf7fbdd52552a0df32a.tar.gz
yuzu-55e6786254d33e3501002bf7fbdd52552a0df32a.tar.bz2
yuzu-55e6786254d33e3501002bf7fbdd52552a0df32a.tar.lz
yuzu-55e6786254d33e3501002bf7fbdd52552a0df32a.tar.xz
yuzu-55e6786254d33e3501002bf7fbdd52552a0df32a.tar.zst
yuzu-55e6786254d33e3501002bf7fbdd52552a0df32a.zip
Diffstat (limited to 'src/video_core/shader/glsl_decompiler.cpp')
-rw-r--r--src/video_core/shader/glsl_decompiler.cpp29
1 files changed, 27 insertions, 2 deletions
diff --git a/src/video_core/shader/glsl_decompiler.cpp b/src/video_core/shader/glsl_decompiler.cpp
index a513c0c4b..b93ea9ec6 100644
--- a/src/video_core/shader/glsl_decompiler.cpp
+++ b/src/video_core/shader/glsl_decompiler.cpp
@@ -635,8 +635,6 @@ private:
result_type));
}
-#pragma optimize("", off)
-
std::string GenerateTexture(Operation operation, const std::string& func,
std::string extra_cast(std::string) = nullptr) {
constexpr std::array<const char*, 4> coord_constructors = {"float", "vec2", "vec3", "vec4"};
@@ -1100,6 +1098,32 @@ private:
return "vec4(itof(int(" + tmp + ".y)), utof(uint(" + tmp + ".x)), 0, 0)";
}
+ std::string F4TexelFetch(Operation operation) {
+ constexpr std::array<const char*, 4> constructors = {"int", "ivec2", "ivec3", "ivec4"};
+ const auto& meta = std::get<MetaTexture>(operation.GetMeta());
+ const auto count = static_cast<u32>(operation.GetOperandsCount());
+
+ std::string expr = "texelFetch(";
+ expr += GetSampler(meta.sampler);
+ expr += ", ";
+
+ expr += constructors[meta.coords_count - 1];
+ expr += '(';
+ for (u32 i = 0; i < count; ++i) {
+ expr += VisitOperand(operation, i, Type::Int);
+ expr += ", ";
+
+ if (i + 1 == meta.coords_count) {
+ expr += ')';
+ }
+ if (i + 1 < count) {
+ expr += ", ";
+ }
+ }
+ expr += ')';
+ return expr;
+ }
+
std::string Ipa(Operation operation) {
const auto& attribute = operation[0];
// TODO(Rodrigo): Special IPA attribute interactions
@@ -1314,6 +1338,7 @@ private:
&F4TextureGather,
&F4TextureQueryDimensions,
&F4TextureQueryLod,
+ &F4TexelFetch,
&Ipa,