diff options
Diffstat (limited to 'src/shader_recompiler/backend')
| -rw-r--r-- | src/shader_recompiler/backend/glasm/emit_glasm.cpp | 16 | ||||
| -rw-r--r-- | src/shader_recompiler/backend/glasm/emit_glasm_image.cpp | 2 | ||||
| -rw-r--r-- | src/shader_recompiler/backend/spirv/emit_spirv.cpp | 32 |
3 files changed, 25 insertions, 25 deletions
diff --git a/src/shader_recompiler/backend/glasm/emit_glasm.cpp b/src/shader_recompiler/backend/glasm/emit_glasm.cpp index e5c96eb7f..0a76423f4 100644 --- a/src/shader_recompiler/backend/glasm/emit_glasm.cpp +++ b/src/shader_recompiler/backend/glasm/emit_glasm.cpp | |||
| @@ -212,14 +212,14 @@ void EmitCode(EmitContext& ctx, const IR::Program& program) { | |||
| 212 | for (const IR::AbstractSyntaxNode& node : program.syntax_list) { | 212 | for (const IR::AbstractSyntaxNode& node : program.syntax_list) { |
| 213 | switch (node.type) { | 213 | switch (node.type) { |
| 214 | case IR::AbstractSyntaxNode::Type::Block: | 214 | case IR::AbstractSyntaxNode::Type::Block: |
| 215 | for (IR::Inst& inst : node.block->Instructions()) { | 215 | for (IR::Inst& inst : node.data.block->Instructions()) { |
| 216 | EmitInst(ctx, &inst); | 216 | EmitInst(ctx, &inst); |
| 217 | } | 217 | } |
| 218 | break; | 218 | break; |
| 219 | case IR::AbstractSyntaxNode::Type::If: | 219 | case IR::AbstractSyntaxNode::Type::If: |
| 220 | ctx.Add("MOV.S.CC RC,{};" | 220 | ctx.Add("MOV.S.CC RC,{};" |
| 221 | "IF NE.x;", | 221 | "IF NE.x;", |
| 222 | eval(node.if_node.cond)); | 222 | eval(node.data.if_node.cond)); |
| 223 | break; | 223 | break; |
| 224 | case IR::AbstractSyntaxNode::Type::EndIf: | 224 | case IR::AbstractSyntaxNode::Type::EndIf: |
| 225 | ctx.Add("ENDIF;"); | 225 | ctx.Add("ENDIF;"); |
| @@ -228,8 +228,8 @@ void EmitCode(EmitContext& ctx, const IR::Program& program) { | |||
| 228 | ctx.Add("REP;"); | 228 | ctx.Add("REP;"); |
| 229 | break; | 229 | break; |
| 230 | case IR::AbstractSyntaxNode::Type::Repeat: | 230 | case IR::AbstractSyntaxNode::Type::Repeat: |
| 231 | if (node.repeat.cond.IsImmediate()) { | 231 | if (node.data.repeat.cond.IsImmediate()) { |
| 232 | if (node.repeat.cond.U1()) { | 232 | if (node.data.repeat.cond.U1()) { |
| 233 | ctx.Add("ENDREP;"); | 233 | ctx.Add("ENDREP;"); |
| 234 | } else { | 234 | } else { |
| 235 | ctx.Add("BRK;" | 235 | ctx.Add("BRK;" |
| @@ -239,18 +239,18 @@ void EmitCode(EmitContext& ctx, const IR::Program& program) { | |||
| 239 | ctx.Add("MOV.S.CC RC,{};" | 239 | ctx.Add("MOV.S.CC RC,{};" |
| 240 | "BRK (EQ.x);" | 240 | "BRK (EQ.x);" |
| 241 | "ENDREP;", | 241 | "ENDREP;", |
| 242 | eval(node.repeat.cond)); | 242 | eval(node.data.repeat.cond)); |
| 243 | } | 243 | } |
| 244 | break; | 244 | break; |
| 245 | case IR::AbstractSyntaxNode::Type::Break: | 245 | case IR::AbstractSyntaxNode::Type::Break: |
| 246 | if (node.break_node.cond.IsImmediate()) { | 246 | if (node.data.break_node.cond.IsImmediate()) { |
| 247 | if (node.break_node.cond.U1()) { | 247 | if (node.data.break_node.cond.U1()) { |
| 248 | ctx.Add("BRK;"); | 248 | ctx.Add("BRK;"); |
| 249 | } | 249 | } |
| 250 | } else { | 250 | } else { |
| 251 | ctx.Add("MOV.S.CC RC,{};" | 251 | ctx.Add("MOV.S.CC RC,{};" |
| 252 | "BRK (NE.x);", | 252 | "BRK (NE.x);", |
| 253 | eval(node.break_node.cond)); | 253 | eval(node.data.break_node.cond)); |
| 254 | } | 254 | } |
| 255 | break; | 255 | break; |
| 256 | case IR::AbstractSyntaxNode::Type::Return: | 256 | case IR::AbstractSyntaxNode::Type::Return: |
diff --git a/src/shader_recompiler/backend/glasm/emit_glasm_image.cpp b/src/shader_recompiler/backend/glasm/emit_glasm_image.cpp index a32d01925..4d146d34e 100644 --- a/src/shader_recompiler/backend/glasm/emit_glasm_image.cpp +++ b/src/shader_recompiler/backend/glasm/emit_glasm_image.cpp | |||
| @@ -105,7 +105,7 @@ void EmitBoundImageWrite(EmitContext&) { | |||
| 105 | throw LogicError("Unreachable instruction"); | 105 | throw LogicError("Unreachable instruction"); |
| 106 | } | 106 | } |
| 107 | 107 | ||
| 108 | std::string Texture([[maybe_unused]] EmitContext& ctx, IR::TextureInstInfo info, | 108 | static std::string Texture([[maybe_unused]] EmitContext& ctx, IR::TextureInstInfo info, |
| 109 | [[maybe_unused]] const IR::Value& index) { | 109 | [[maybe_unused]] const IR::Value& index) { |
| 110 | // FIXME | 110 | // FIXME |
| 111 | return fmt::format("texture[{}]", info.descriptor_index); | 111 | return fmt::format("texture[{}]", info.descriptor_index); |
diff --git a/src/shader_recompiler/backend/spirv/emit_spirv.cpp b/src/shader_recompiler/backend/spirv/emit_spirv.cpp index 881a5dc4c..9ed2af991 100644 --- a/src/shader_recompiler/backend/spirv/emit_spirv.cpp +++ b/src/shader_recompiler/backend/spirv/emit_spirv.cpp | |||
| @@ -112,48 +112,48 @@ void Traverse(EmitContext& ctx, IR::Program& program) { | |||
| 112 | for (const IR::AbstractSyntaxNode& node : program.syntax_list) { | 112 | for (const IR::AbstractSyntaxNode& node : program.syntax_list) { |
| 113 | switch (node.type) { | 113 | switch (node.type) { |
| 114 | case IR::AbstractSyntaxNode::Type::Block: { | 114 | case IR::AbstractSyntaxNode::Type::Block: { |
| 115 | const Id label{node.block->Definition<Id>()}; | 115 | const Id label{node.data.block->Definition<Id>()}; |
| 116 | if (current_block) { | 116 | if (current_block) { |
| 117 | ctx.OpBranch(label); | 117 | ctx.OpBranch(label); |
| 118 | } | 118 | } |
| 119 | current_block = node.block; | 119 | current_block = node.data.block; |
| 120 | ctx.AddLabel(label); | 120 | ctx.AddLabel(label); |
| 121 | for (IR::Inst& inst : node.block->Instructions()) { | 121 | for (IR::Inst& inst : node.data.block->Instructions()) { |
| 122 | EmitInst(ctx, &inst); | 122 | EmitInst(ctx, &inst); |
| 123 | } | 123 | } |
| 124 | break; | 124 | break; |
| 125 | } | 125 | } |
| 126 | case IR::AbstractSyntaxNode::Type::If: { | 126 | case IR::AbstractSyntaxNode::Type::If: { |
| 127 | const Id if_label{node.if_node.body->Definition<Id>()}; | 127 | const Id if_label{node.data.if_node.body->Definition<Id>()}; |
| 128 | const Id endif_label{node.if_node.merge->Definition<Id>()}; | 128 | const Id endif_label{node.data.if_node.merge->Definition<Id>()}; |
| 129 | ctx.OpSelectionMerge(endif_label, spv::SelectionControlMask::MaskNone); | 129 | ctx.OpSelectionMerge(endif_label, spv::SelectionControlMask::MaskNone); |
| 130 | ctx.OpBranchConditional(ctx.Def(node.if_node.cond), if_label, endif_label); | 130 | ctx.OpBranchConditional(ctx.Def(node.data.if_node.cond), if_label, endif_label); |
| 131 | break; | 131 | break; |
| 132 | } | 132 | } |
| 133 | case IR::AbstractSyntaxNode::Type::Loop: { | 133 | case IR::AbstractSyntaxNode::Type::Loop: { |
| 134 | const Id body_label{node.loop.body->Definition<Id>()}; | 134 | const Id body_label{node.data.loop.body->Definition<Id>()}; |
| 135 | const Id continue_label{node.loop.continue_block->Definition<Id>()}; | 135 | const Id continue_label{node.data.loop.continue_block->Definition<Id>()}; |
| 136 | const Id endloop_label{node.loop.merge->Definition<Id>()}; | 136 | const Id endloop_label{node.data.loop.merge->Definition<Id>()}; |
| 137 | 137 | ||
| 138 | ctx.OpLoopMerge(endloop_label, continue_label, spv::LoopControlMask::MaskNone); | 138 | ctx.OpLoopMerge(endloop_label, continue_label, spv::LoopControlMask::MaskNone); |
| 139 | ctx.OpBranch(body_label); | 139 | ctx.OpBranch(body_label); |
| 140 | break; | 140 | break; |
| 141 | } | 141 | } |
| 142 | case IR::AbstractSyntaxNode::Type::Break: { | 142 | case IR::AbstractSyntaxNode::Type::Break: { |
| 143 | const Id break_label{node.break_node.merge->Definition<Id>()}; | 143 | const Id break_label{node.data.break_node.merge->Definition<Id>()}; |
| 144 | const Id skip_label{node.break_node.skip->Definition<Id>()}; | 144 | const Id skip_label{node.data.break_node.skip->Definition<Id>()}; |
| 145 | ctx.OpBranchConditional(ctx.Def(node.break_node.cond), break_label, skip_label); | 145 | ctx.OpBranchConditional(ctx.Def(node.data.break_node.cond), break_label, skip_label); |
| 146 | break; | 146 | break; |
| 147 | } | 147 | } |
| 148 | case IR::AbstractSyntaxNode::Type::EndIf: | 148 | case IR::AbstractSyntaxNode::Type::EndIf: |
| 149 | if (current_block) { | 149 | if (current_block) { |
| 150 | ctx.OpBranch(node.end_if.merge->Definition<Id>()); | 150 | ctx.OpBranch(node.data.end_if.merge->Definition<Id>()); |
| 151 | } | 151 | } |
| 152 | break; | 152 | break; |
| 153 | case IR::AbstractSyntaxNode::Type::Repeat: { | 153 | case IR::AbstractSyntaxNode::Type::Repeat: { |
| 154 | const Id loop_header_label{node.repeat.loop_header->Definition<Id>()}; | 154 | const Id loop_header_label{node.data.repeat.loop_header->Definition<Id>()}; |
| 155 | const Id merge_label{node.repeat.merge->Definition<Id>()}; | 155 | const Id merge_label{node.data.repeat.merge->Definition<Id>()}; |
| 156 | ctx.OpBranchConditional(ctx.Def(node.repeat.cond), loop_header_label, merge_label); | 156 | ctx.OpBranchConditional(ctx.Def(node.data.repeat.cond), loop_header_label, merge_label); |
| 157 | break; | 157 | break; |
| 158 | } | 158 | } |
| 159 | case IR::AbstractSyntaxNode::Type::Return: | 159 | case IR::AbstractSyntaxNode::Type::Return: |