Skip to content

Commit

Permalink
gpu: do not crash on null debug string
Browse files Browse the repository at this point in the history
  • Loading branch information
DHrpcs3 committed Oct 14, 2024
1 parent eeb9c67 commit 5102e2e
Showing 1 changed file with 28 additions and 18 deletions.
46 changes: 28 additions & 18 deletions rpcsx/gpu/Pipe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1116,17 +1116,22 @@ bool GraphicsPipe::setUConfigReg(Queue &queue) {
auto data = queue.rptr + 2;

if (index != 0) {
std::println(
stderr,
"set UConfig regs with index, offset: {:x}, count {}, index {}, {}",
offset, len, index,
gnm::mmio::registerName(decltype(uConfig)::kMmioOffset + offset));
{
auto name =
gnm::mmio::registerName(decltype(uConfig)::kMmioOffset + offset);
std::println(
stderr,
"set UConfig regs with index, offset: {:x}, count {}, index {}, {}",
offset, len, index, name ? name : "<null>");
}

for (std::size_t i = 0; i < len; ++i) {
std::println(
stderr, "writing to {} value {:x}",
gnm::mmio::registerName(decltype(uConfig)::kMmioOffset + offset + i),
data[i]);
auto id = decltype(uConfig)::kMmioOffset + offset + i;
if (auto regName = gnm::mmio::registerName(id)) {
std::println(stderr, "writing to {} value {:x}", regName, data[i]);
} else {
std::println(stderr, "writing to {:x} value {:x}", id, data[i]);
}
}
}

Expand All @@ -1152,17 +1157,22 @@ bool GraphicsPipe::setContextReg(Queue &queue) {
auto data = queue.rptr + 2;

if (index != 0) {
std::println(
stderr,
"set Context regs with index, offset: {:x}, count {}, index {}, {}",
offset, len, index,
gnm::mmio::registerName(decltype(context)::kMmioOffset + offset));
{
auto name =
gnm::mmio::registerName(decltype(context)::kMmioOffset + offset);
std::println(
stderr,
"set Context regs with index, offset: {:x}, count {}, index {}, {}",
offset, len, index, name ? name : "<null>");
}

for (std::size_t i = 0; i < len; ++i) {
std::println(
stderr, "writing to {} value {:x}",
gnm::mmio::registerName(decltype(context)::kMmioOffset + offset + i),
data[i]);
auto id = decltype(context)::kMmioOffset + offset + i;
if (auto regName = gnm::mmio::registerName(id)) {
std::println(stderr, "writing to {} value {:x}", regName, data[i]);
} else {
std::println(stderr, "writing to {:x} value {:x}", id, data[i]);
}
}
}

Expand Down

0 comments on commit 5102e2e

Please sign in to comment.