summaryrefslogtreecommitdiff
path: root/src/video_core/renderer_vulkan
diff options
context:
space:
mode:
authorGravatar Fernando Sahmkow2019-12-30 13:54:53 -0400
committerGravatar FernandoS272019-12-30 15:31:48 -0400
commitb3371ed09e6866e235141119f9eecc2bb962dc8d (patch)
tree06619df9bd72cc0d73a3869b040b20804e2d3109 /src/video_core/renderer_vulkan
parentMerge pull request #3250 from ReinUsesLisp/empty-fragment (diff)
downloadyuzu-b3371ed09e6866e235141119f9eecc2bb962dc8d.tar.gz
yuzu-b3371ed09e6866e235141119f9eecc2bb962dc8d.tar.xz
yuzu-b3371ed09e6866e235141119f9eecc2bb962dc8d.zip
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:
954 954
955 Expression Visit(const Node& node) { 955 Expression Visit(const Node& node) {
956 if (const auto operation = std::get_if<OperationNode>(&*node)) { 956 if (const auto operation = std::get_if<OperationNode>(&*node)) {
957 auto amend_index = operation->GetAmendIndex();
958 if (amend_index) {
959 const Node& amend_node = ir.GetAmendNode(*amend_index);
960 [[maybe_unused]] const Type type = Visit(amend_node).type;
961 ASSERT(type == Type::Void);
962 }
957 const auto operation_index = static_cast<std::size_t>(operation->GetCode()); 963 const auto operation_index = static_cast<std::size_t>(operation->GetCode());
958 const auto decompiler = operation_decompilers[operation_index]; 964 const auto decompiler = operation_decompilers[operation_index];
959 if (decompiler == nullptr) { 965 if (decompiler == nullptr) {
@@ -1142,6 +1148,12 @@ private:
1142 } 1148 }
1143 1149
1144 if (const auto conditional = std::get_if<ConditionalNode>(&*node)) { 1150 if (const auto conditional = std::get_if<ConditionalNode>(&*node)) {
1151 auto amend_index = conditional->GetAmendIndex();
1152 if (amend_index) {
1153 const Node& amend_node = ir.GetAmendNode(*amend_index);
1154 [[maybe_unused]] const Type type = Visit(amend_node).type;
1155 ASSERT(type == Type::Void);
1156 }
1145 // It's invalid to call conditional on nested nodes, use an operation instead 1157 // It's invalid to call conditional on nested nodes, use an operation instead
1146 const Id true_label = OpLabel(); 1158 const Id true_label = OpLabel();
1147 const Id skip_label = OpLabel(); 1159 const Id skip_label = OpLabel();
@@ -1164,6 +1176,12 @@ private:
1164 } 1176 }
1165 1177
1166 if (const auto comment = std::get_if<CommentNode>(&*node)) { 1178 if (const auto comment = std::get_if<CommentNode>(&*node)) {
1179 auto amend_index = comment->GetAmendIndex();
1180 if (amend_index) {
1181 const Node& amend_node = ir.GetAmendNode(*amend_index);
1182 [[maybe_unused]] const Type type = Visit(amend_node).type;
1183 ASSERT(type == Type::Void);
1184 }
1167 Name(OpUndef(t_void), comment->GetText()); 1185 Name(OpUndef(t_void), comment->GetText());
1168 return {}; 1186 return {};
1169 } 1187 }