diff options
| author | 2019-12-19 01:41:22 -0300 | |
|---|---|---|
| committer | 2019-12-19 01:42:13 -0300 | |
| commit | abb33d4aecd7748cd4b2e377f8c6fe18df58e67c (patch) | |
| tree | 4f0c7999a719b5008765cdc7f404599d1f259655 /src | |
| parent | Merge pull request #3221 from ReinUsesLisp/vk-scheduler (diff) | |
| download | yuzu-abb33d4aecd7748cd4b2e377f8c6fe18df58e67c.tar.gz yuzu-abb33d4aecd7748cd4b2e377f8c6fe18df58e67c.tar.xz yuzu-abb33d4aecd7748cd4b2e377f8c6fe18df58e67c.zip | |
vk_shader_decompiler: Update sirit and implement Texture AOFFI
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_shader_decompiler.cpp | 52 |
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: | |||
| 1555 | 1555 | ||
| 1556 | Expression Texture(Operation operation) { | 1556 | Expression Texture(Operation operation) { |
| 1557 | const auto& meta = std::get<MetaTexture>(operation.GetMeta()); | 1557 | const auto& meta = std::get<MetaTexture>(operation.GetMeta()); |
| 1558 | UNIMPLEMENTED_IF(!meta.aoffi.empty()); | ||
| 1559 | 1558 | ||
| 1560 | const bool can_implicit = stage == ShaderType::Fragment; | 1559 | const bool can_implicit = stage == ShaderType::Fragment; |
| 1561 | const Id sampler = GetTextureSampler(operation); | 1560 | const Id sampler = GetTextureSampler(operation); |
| 1562 | const Id coords = GetCoordinates(operation, Type::Float); | 1561 | const Id coords = GetCoordinates(operation, Type::Float); |
| 1563 | 1562 | ||
| 1563 | std::vector<Id> operands; | ||
| 1564 | spv::ImageOperandsMask mask{}; | ||
| 1565 | if (meta.bias) { | ||
| 1566 | mask = mask | spv::ImageOperandsMask::Bias; | ||
| 1567 | operands.push_back(AsFloat(Visit(meta.bias))); | ||
| 1568 | } | ||
| 1569 | |||
| 1570 | if (!can_implicit) { | ||
| 1571 | mask = mask | spv::ImageOperandsMask::Lod; | ||
| 1572 | operands.push_back(v_float_zero); | ||
| 1573 | } | ||
| 1574 | |||
| 1575 | if (!meta.aoffi.empty()) { | ||
| 1576 | mask = mask | spv::ImageOperandsMask::Offset; | ||
| 1577 | operands.push_back(GetOffsetCoordinates(operation)); | ||
| 1578 | } | ||
| 1579 | |||
| 1564 | if (meta.depth_compare) { | 1580 | if (meta.depth_compare) { |
| 1565 | // Depth sampling | 1581 | // Depth sampling |
| 1566 | UNIMPLEMENTED_IF(meta.bias); | 1582 | UNIMPLEMENTED_IF(meta.bias); |
| 1567 | const Id dref = AsFloat(Visit(meta.depth_compare)); | 1583 | const Id dref = AsFloat(Visit(meta.depth_compare)); |
| 1568 | if (can_implicit) { | 1584 | if (can_implicit) { |
| 1569 | return {OpImageSampleDrefImplicitLod(t_float, sampler, coords, dref, {}), | 1585 | return { |
| 1570 | Type::Float}; | 1586 | OpImageSampleDrefImplicitLod(t_float, sampler, coords, dref, mask, operands), |
| 1587 | Type::Float}; | ||
| 1571 | } else { | 1588 | } else { |
| 1572 | return {OpImageSampleDrefExplicitLod(t_float, sampler, coords, dref, | 1589 | return { |
| 1573 | spv::ImageOperandsMask::Lod, v_float_zero), | 1590 | OpImageSampleDrefExplicitLod(t_float, sampler, coords, dref, mask, operands), |
| 1574 | Type::Float}; | 1591 | Type::Float}; |
| 1575 | } | 1592 | } |
| 1576 | } | 1593 | } |
| 1577 | 1594 | ||
| 1578 | std::vector<Id> operands; | ||
| 1579 | spv::ImageOperandsMask mask{}; | ||
| 1580 | if (meta.bias) { | ||
| 1581 | mask = mask | spv::ImageOperandsMask::Bias; | ||
| 1582 | operands.push_back(AsFloat(Visit(meta.bias))); | ||
| 1583 | } | ||
| 1584 | |||
| 1585 | Id texture; | 1595 | Id texture; |
| 1586 | if (can_implicit) { | 1596 | if (can_implicit) { |
| 1587 | texture = OpImageSampleImplicitLod(t_float4, sampler, coords, mask, operands); | 1597 | texture = OpImageSampleImplicitLod(t_float4, sampler, coords, mask, operands); |
| 1588 | } else { | 1598 | } else { |
| 1589 | texture = OpImageSampleExplicitLod(t_float4, sampler, coords, | 1599 | texture = OpImageSampleExplicitLod(t_float4, sampler, coords, mask, operands); |
| 1590 | mask | spv::ImageOperandsMask::Lod, v_float_zero, | ||
| 1591 | operands); | ||
| 1592 | } | 1600 | } |
| 1593 | return GetTextureElement(operation, texture, Type::Float); | 1601 | return GetTextureElement(operation, texture, Type::Float); |
| 1594 | } | 1602 | } |
| @@ -1601,7 +1609,8 @@ private: | |||
| 1601 | const Id lod = AsFloat(Visit(meta.lod)); | 1609 | const Id lod = AsFloat(Visit(meta.lod)); |
| 1602 | 1610 | ||
| 1603 | spv::ImageOperandsMask mask = spv::ImageOperandsMask::Lod; | 1611 | spv::ImageOperandsMask mask = spv::ImageOperandsMask::Lod; |
| 1604 | std::vector<Id> operands; | 1612 | std::vector<Id> operands{lod}; |
| 1613 | |||
| 1605 | if (!meta.aoffi.empty()) { | 1614 | if (!meta.aoffi.empty()) { |
| 1606 | mask = mask | spv::ImageOperandsMask::Offset; | 1615 | mask = mask | spv::ImageOperandsMask::Offset; |
| 1607 | operands.push_back(GetOffsetCoordinates(operation)); | 1616 | operands.push_back(GetOffsetCoordinates(operation)); |
| @@ -1609,11 +1618,10 @@ private: | |||
| 1609 | 1618 | ||
| 1610 | if (meta.sampler.IsShadow()) { | 1619 | if (meta.sampler.IsShadow()) { |
| 1611 | const Id dref = AsFloat(Visit(meta.depth_compare)); | 1620 | const Id dref = AsFloat(Visit(meta.depth_compare)); |
| 1612 | return { | 1621 | return {OpImageSampleDrefExplicitLod(t_float, sampler, coords, dref, mask, operands), |
| 1613 | OpImageSampleDrefExplicitLod(t_float, sampler, coords, dref, mask, lod, operands), | 1622 | Type::Float}; |
| 1614 | Type::Float}; | ||
| 1615 | } | 1623 | } |
| 1616 | const Id texture = OpImageSampleExplicitLod(t_float4, sampler, coords, mask, lod, operands); | 1624 | const Id texture = OpImageSampleExplicitLod(t_float4, sampler, coords, mask, operands); |
| 1617 | return GetTextureElement(operation, texture, Type::Float); | 1625 | return GetTextureElement(operation, texture, Type::Float); |
| 1618 | } | 1626 | } |
| 1619 | 1627 | ||
| @@ -1722,7 +1730,7 @@ private: | |||
| 1722 | const std::vector grad = {dx, dy}; | 1730 | const std::vector grad = {dx, dy}; |
| 1723 | 1731 | ||
| 1724 | static constexpr auto mask = spv::ImageOperandsMask::Grad; | 1732 | static constexpr auto mask = spv::ImageOperandsMask::Grad; |
| 1725 | const Id texture = OpImageSampleImplicitLod(t_float4, sampler, coords, mask, grad); | 1733 | const Id texture = OpImageSampleExplicitLod(t_float4, sampler, coords, mask, grad); |
| 1726 | return GetTextureElement(operation, texture, Type::Float); | 1734 | return GetTextureElement(operation, texture, Type::Float); |
| 1727 | } | 1735 | } |
| 1728 | 1736 | ||