summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2019-12-19 05:41:22 +0100
committerReinUsesLisp <reinuseslisp@airmail.cc>2019-12-19 05:42:13 +0100
commitabb33d4aecd7748cd4b2e377f8c6fe18df58e67c (patch)
tree4f0c7999a719b5008765cdc7f404599d1f259655 /src
parentMerge pull request #3221 from ReinUsesLisp/vk-scheduler (diff)
downloadyuzu-abb33d4aecd7748cd4b2e377f8c6fe18df58e67c.tar
yuzu-abb33d4aecd7748cd4b2e377f8c6fe18df58e67c.tar.gz
yuzu-abb33d4aecd7748cd4b2e377f8c6fe18df58e67c.tar.bz2
yuzu-abb33d4aecd7748cd4b2e377f8c6fe18df58e67c.tar.lz
yuzu-abb33d4aecd7748cd4b2e377f8c6fe18df58e67c.tar.xz
yuzu-abb33d4aecd7748cd4b2e377f8c6fe18df58e67c.tar.zst
yuzu-abb33d4aecd7748cd4b2e377f8c6fe18df58e67c.zip
Diffstat (limited to 'src')
-rw-r--r--src/video_core/renderer_vulkan/vk_shader_decompiler.cpp52
1 files changed, 30 insertions, 22 deletions
diff --git a/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp b/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp
index 6227bc70b..93e2704b4 100644
--- a/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp
+++ b/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp
@@ -1555,40 +1555,48 @@ private:
Expression Texture(Operation operation) {
const auto& meta = std::get<MetaTexture>(operation.GetMeta());
- UNIMPLEMENTED_IF(!meta.aoffi.empty());
const bool can_implicit = stage == ShaderType::Fragment;
const Id sampler = GetTextureSampler(operation);
const Id coords = GetCoordinates(operation, Type::Float);
+ std::vector<Id> operands;
+ spv::ImageOperandsMask mask{};
+ if (meta.bias) {
+ mask = mask | spv::ImageOperandsMask::Bias;
+ operands.push_back(AsFloat(Visit(meta.bias)));
+ }
+
+ if (!can_implicit) {
+ mask = mask | spv::ImageOperandsMask::Lod;
+ operands.push_back(v_float_zero);
+ }
+
+ if (!meta.aoffi.empty()) {
+ mask = mask | spv::ImageOperandsMask::Offset;
+ operands.push_back(GetOffsetCoordinates(operation));
+ }
+
if (meta.depth_compare) {
// Depth sampling
UNIMPLEMENTED_IF(meta.bias);
const Id dref = AsFloat(Visit(meta.depth_compare));
if (can_implicit) {
- return {OpImageSampleDrefImplicitLod(t_float, sampler, coords, dref, {}),
- Type::Float};
+ return {
+ OpImageSampleDrefImplicitLod(t_float, sampler, coords, dref, mask, operands),
+ Type::Float};
} else {
- return {OpImageSampleDrefExplicitLod(t_float, sampler, coords, dref,
- spv::ImageOperandsMask::Lod, v_float_zero),
- Type::Float};
+ return {
+ OpImageSampleDrefExplicitLod(t_float, sampler, coords, dref, mask, operands),
+ Type::Float};
}
}
- std::vector<Id> operands;
- spv::ImageOperandsMask mask{};
- if (meta.bias) {
- mask = mask | spv::ImageOperandsMask::Bias;
- operands.push_back(AsFloat(Visit(meta.bias)));
- }
-
Id texture;
if (can_implicit) {
texture = OpImageSampleImplicitLod(t_float4, sampler, coords, mask, operands);
} else {
- texture = OpImageSampleExplicitLod(t_float4, sampler, coords,
- mask | spv::ImageOperandsMask::Lod, v_float_zero,
- operands);
+ texture = OpImageSampleExplicitLod(t_float4, sampler, coords, mask, operands);
}
return GetTextureElement(operation, texture, Type::Float);
}
@@ -1601,7 +1609,8 @@ private:
const Id lod = AsFloat(Visit(meta.lod));
spv::ImageOperandsMask mask = spv::ImageOperandsMask::Lod;
- std::vector<Id> operands;
+ std::vector<Id> operands{lod};
+
if (!meta.aoffi.empty()) {
mask = mask | spv::ImageOperandsMask::Offset;
operands.push_back(GetOffsetCoordinates(operation));
@@ -1609,11 +1618,10 @@ private:
if (meta.sampler.IsShadow()) {
const Id dref = AsFloat(Visit(meta.depth_compare));
- return {
- OpImageSampleDrefExplicitLod(t_float, sampler, coords, dref, mask, lod, operands),
- Type::Float};
+ return {OpImageSampleDrefExplicitLod(t_float, sampler, coords, dref, mask, operands),
+ Type::Float};
}
- const Id texture = OpImageSampleExplicitLod(t_float4, sampler, coords, mask, lod, operands);
+ const Id texture = OpImageSampleExplicitLod(t_float4, sampler, coords, mask, operands);
return GetTextureElement(operation, texture, Type::Float);
}
@@ -1722,7 +1730,7 @@ private:
const std::vector grad = {dx, dy};
static constexpr auto mask = spv::ImageOperandsMask::Grad;
- const Id texture = OpImageSampleImplicitLod(t_float4, sampler, coords, mask, grad);
+ const Id texture = OpImageSampleExplicitLod(t_float4, sampler, coords, mask, grad);
return GetTextureElement(operation, texture, Type::Float);
}