1
0
Fork 0
forked from suyu/suyu

Merge pull request #2837 from wwylele/shader-debugger-fix

Misc shader debugger fixes
This commit is contained in:
bunnei 2017-07-26 16:00:10 -04:00 committed by GitHub
commit a724fb3657

View file

@ -183,23 +183,13 @@ QVariant GraphicsVertexShaderModel::data(const QModelIndex& index, int role) con
print_input(output, src1, swizzle.negate_src1, print_input(output, src1, swizzle.negate_src1,
SelectorToString(swizzle.src1_selector)); SelectorToString(swizzle.src1_selector));
AlignToColumn(kInputOperandColumnWidth); AlignToColumn(kInputOperandColumnWidth);
if (src_is_inverted) { print_input(output, src2, swizzle.negate_src2,
print_input(output, src2, swizzle.negate_src2, SelectorToString(swizzle.src2_selector), true,
SelectorToString(swizzle.src2_selector)); src_is_inverted ? "" : instr.mad.AddressRegisterName());
} else {
print_input(output, src2, swizzle.negate_src2,
SelectorToString(swizzle.src2_selector), true,
instr.mad.AddressRegisterName());
}
AlignToColumn(kInputOperandColumnWidth); AlignToColumn(kInputOperandColumnWidth);
if (src_is_inverted) { print_input(output, src3, swizzle.negate_src3,
print_input(output, src3, swizzle.negate_src3, SelectorToString(swizzle.src3_selector), true,
SelectorToString(swizzle.src3_selector), true, src_is_inverted ? instr.mad.AddressRegisterName() : "");
instr.mad.AddressRegisterName());
} else {
print_input(output, src3, swizzle.negate_src3,
SelectorToString(swizzle.src3_selector));
}
AlignToColumn(kInputOperandColumnWidth); AlignToColumn(kInputOperandColumnWidth);
break; break;
} }
@ -222,16 +212,15 @@ QVariant GraphicsVertexShaderModel::data(const QModelIndex& index, int role) con
SourceRegister src1 = instr.common.GetSrc1(src_is_inverted); SourceRegister src1 = instr.common.GetSrc1(src_is_inverted);
print_input(output, src1, swizzle.negate_src1, print_input(output, src1, swizzle.negate_src1,
swizzle.SelectorToString(false), true, swizzle.SelectorToString(false), true,
instr.common.AddressRegisterName()); src_is_inverted ? "" : instr.common.AddressRegisterName());
AlignToColumn(kInputOperandColumnWidth); AlignToColumn(kInputOperandColumnWidth);
} }
// TODO: In some cases, the Address Register is used as an index for SRC2
// instead of SRC1
if (opcode_info.subtype & OpCode::Info::Src2) { if (opcode_info.subtype & OpCode::Info::Src2) {
SourceRegister src2 = instr.common.GetSrc2(src_is_inverted); SourceRegister src2 = instr.common.GetSrc2(src_is_inverted);
print_input(output, src2, swizzle.negate_src2, print_input(output, src2, swizzle.negate_src2,
swizzle.SelectorToString(true)); swizzle.SelectorToString(true), true,
src_is_inverted ? instr.common.AddressRegisterName() : "");
AlignToColumn(kInputOperandColumnWidth); AlignToColumn(kInputOperandColumnWidth);
} }
break; break;
@ -247,7 +236,9 @@ QVariant GraphicsVertexShaderModel::data(const QModelIndex& index, int role) con
switch (opcode.EffectiveOpCode()) { switch (opcode.EffectiveOpCode()) {
case OpCode::Id::LOOP: case OpCode::Id::LOOP:
output << "(unknown instruction format)"; output << 'i' << instr.flow_control.int_uniform_id << " (end on 0x"
<< std::setw(4) << std::right << std::setfill('0') << std::hex
<< (4 * instr.flow_control.dest_offset) << ")";
break; break;
default: default:
@ -255,7 +246,7 @@ QVariant GraphicsVertexShaderModel::data(const QModelIndex& index, int role) con
output << '('; output << '(';
if (instr.flow_control.op != instr.flow_control.JustY) { if (instr.flow_control.op != instr.flow_control.JustY) {
if (instr.flow_control.refx) if (!instr.flow_control.refx)
output << '!'; output << '!';
output << "cc.x"; output << "cc.x";
} }
@ -267,13 +258,17 @@ QVariant GraphicsVertexShaderModel::data(const QModelIndex& index, int role) con
} }
if (instr.flow_control.op != instr.flow_control.JustX) { if (instr.flow_control.op != instr.flow_control.JustX) {
if (instr.flow_control.refy) if (!instr.flow_control.refy)
output << '!'; output << '!';
output << "cc.y"; output << "cc.y";
} }
output << ") "; output << ") ";
} else if (opcode_info.subtype & OpCode::Info::HasUniformIndex) { } else if (opcode_info.subtype & OpCode::Info::HasUniformIndex) {
if (opcode.EffectiveOpCode() == OpCode::Id::JMPU &&
(instr.flow_control.num_instructions & 1) == 1) {
output << '!';
}
output << 'b' << instr.flow_control.bool_uniform_id << ' '; output << 'b' << instr.flow_control.bool_uniform_id << ' ';
} }