aboutsummaryrefslogtreecommitdiff
path: root/src/video_core/renderer_vulkan
diff options
context:
space:
mode:
authorFernando Sahmkow <fsahmkow27@gmail.com>2019-12-30 13:54:53 -0400
committerFernandoS27 <fsahmkow27@gmail.com>2019-12-30 15:31:48 -0400
commitb3371ed09e6866e235141119f9eecc2bb962dc8d (patch)
tree06619df9bd72cc0d73a3869b040b20804e2d3109 /src/video_core/renderer_vulkan
parentf846e3d6d0e973485a53bb87b913059060dcfdbc (diff)
Shader_IR: add the ability to amend code in the shader ir.
This commit introduces a mechanism by which shader IR code can be amended and extended. This useful for track algorithms where certain information can derived from before the track such as indexes to array samplers.
Diffstat (limited to 'src/video_core/renderer_vulkan')
-rw-r--r--src/video_core/renderer_vulkan/vk_shader_decompiler.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp b/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp
index a8baf91de..50feeb003 100644
--- a/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp
+++ b/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp
@@ -954,6 +954,12 @@ private:
Expression Visit(const Node& node) {
if (const auto operation = std::get_if<OperationNode>(&*node)) {
+ auto amend_index = operation->GetAmendIndex();
+ if (amend_index) {
+ const Node& amend_node = ir.GetAmendNode(*amend_index);
+ [[maybe_unused]] const Type type = Visit(amend_node).type;
+ ASSERT(type == Type::Void);
+ }
const auto operation_index = static_cast<std::size_t>(operation->GetCode());
const auto decompiler = operation_decompilers[operation_index];
if (decompiler == nullptr) {
@@ -1142,6 +1148,12 @@ private:
}
if (const auto conditional = std::get_if<ConditionalNode>(&*node)) {
+ auto amend_index = conditional->GetAmendIndex();
+ if (amend_index) {
+ const Node& amend_node = ir.GetAmendNode(*amend_index);
+ [[maybe_unused]] const Type type = Visit(amend_node).type;
+ ASSERT(type == Type::Void);
+ }
// It's invalid to call conditional on nested nodes, use an operation instead
const Id true_label = OpLabel();
const Id skip_label = OpLabel();
@@ -1164,6 +1176,12 @@ private:
}
if (const auto comment = std::get_if<CommentNode>(&*node)) {
+ auto amend_index = comment->GetAmendIndex();
+ if (amend_index) {
+ const Node& amend_node = ir.GetAmendNode(*amend_index);
+ [[maybe_unused]] const Type type = Visit(amend_node).type;
+ ASSERT(type == Type::Void);
+ }
Name(OpUndef(t_void), comment->GetText());
return {};
}