forked from suyu/suyu
vk_shader_decompiler: Update sirit and implement Texture AOFFI
This commit is contained in:
parent
d53cf05513
commit
abb33d4aec
2 changed files with 33 additions and 25 deletions
2
externals/sirit
vendored
2
externals/sirit
vendored
|
@ -1 +1 @@
|
||||||
Subproject commit 12f40a80324d7c154f19f25c448a5ce27d38cd18
|
Subproject commit 9f4d057aa28c4e9509bdc767afb27b4aee303b7e
|
|
@ -1555,26 +1555,11 @@ private:
|
||||||
|
|
||||||
Expression Texture(Operation operation) {
|
Expression Texture(Operation operation) {
|
||||||
const auto& meta = std::get<MetaTexture>(operation.GetMeta());
|
const auto& meta = std::get<MetaTexture>(operation.GetMeta());
|
||||||
UNIMPLEMENTED_IF(!meta.aoffi.empty());
|
|
||||||
|
|
||||||
const bool can_implicit = stage == ShaderType::Fragment;
|
const bool can_implicit = stage == ShaderType::Fragment;
|
||||||
const Id sampler = GetTextureSampler(operation);
|
const Id sampler = GetTextureSampler(operation);
|
||||||
const Id coords = GetCoordinates(operation, Type::Float);
|
const Id coords = GetCoordinates(operation, Type::Float);
|
||||||
|
|
||||||
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};
|
|
||||||
} else {
|
|
||||||
return {OpImageSampleDrefExplicitLod(t_float, sampler, coords, dref,
|
|
||||||
spv::ImageOperandsMask::Lod, v_float_zero),
|
|
||||||
Type::Float};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<Id> operands;
|
std::vector<Id> operands;
|
||||||
spv::ImageOperandsMask mask{};
|
spv::ImageOperandsMask mask{};
|
||||||
if (meta.bias) {
|
if (meta.bias) {
|
||||||
|
@ -1582,13 +1567,36 @@ private:
|
||||||
operands.push_back(AsFloat(Visit(meta.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, mask, operands),
|
||||||
|
Type::Float};
|
||||||
|
} else {
|
||||||
|
return {
|
||||||
|
OpImageSampleDrefExplicitLod(t_float, sampler, coords, dref, mask, operands),
|
||||||
|
Type::Float};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Id texture;
|
Id texture;
|
||||||
if (can_implicit) {
|
if (can_implicit) {
|
||||||
texture = OpImageSampleImplicitLod(t_float4, sampler, coords, mask, operands);
|
texture = OpImageSampleImplicitLod(t_float4, sampler, coords, mask, operands);
|
||||||
} else {
|
} else {
|
||||||
texture = OpImageSampleExplicitLod(t_float4, sampler, coords,
|
texture = OpImageSampleExplicitLod(t_float4, sampler, coords, mask, operands);
|
||||||
mask | spv::ImageOperandsMask::Lod, v_float_zero,
|
|
||||||
operands);
|
|
||||||
}
|
}
|
||||||
return GetTextureElement(operation, texture, Type::Float);
|
return GetTextureElement(operation, texture, Type::Float);
|
||||||
}
|
}
|
||||||
|
@ -1601,7 +1609,8 @@ private:
|
||||||
const Id lod = AsFloat(Visit(meta.lod));
|
const Id lod = AsFloat(Visit(meta.lod));
|
||||||
|
|
||||||
spv::ImageOperandsMask mask = spv::ImageOperandsMask::Lod;
|
spv::ImageOperandsMask mask = spv::ImageOperandsMask::Lod;
|
||||||
std::vector<Id> operands;
|
std::vector<Id> operands{lod};
|
||||||
|
|
||||||
if (!meta.aoffi.empty()) {
|
if (!meta.aoffi.empty()) {
|
||||||
mask = mask | spv::ImageOperandsMask::Offset;
|
mask = mask | spv::ImageOperandsMask::Offset;
|
||||||
operands.push_back(GetOffsetCoordinates(operation));
|
operands.push_back(GetOffsetCoordinates(operation));
|
||||||
|
@ -1609,11 +1618,10 @@ private:
|
||||||
|
|
||||||
if (meta.sampler.IsShadow()) {
|
if (meta.sampler.IsShadow()) {
|
||||||
const Id dref = AsFloat(Visit(meta.depth_compare));
|
const Id dref = AsFloat(Visit(meta.depth_compare));
|
||||||
return {
|
return {OpImageSampleDrefExplicitLod(t_float, sampler, coords, dref, mask, operands),
|
||||||
OpImageSampleDrefExplicitLod(t_float, sampler, coords, dref, mask, lod, operands),
|
|
||||||
Type::Float};
|
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);
|
return GetTextureElement(operation, texture, Type::Float);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1722,7 +1730,7 @@ private:
|
||||||
const std::vector grad = {dx, dy};
|
const std::vector grad = {dx, dy};
|
||||||
|
|
||||||
static constexpr auto mask = spv::ImageOperandsMask::Grad;
|
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);
|
return GetTextureElement(operation, texture, Type::Float);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue