code: Cleanup and warning fixes from the Vulkan PR (#6163)

Co-authored-by: emufan4568 <geoster3d@gmail.com>
Co-authored-by: Kyle Kienapfel <Docteh@users.noreply.github.com>
This commit is contained in:
Tobias 2022-11-04 23:32:57 +01:00 committed by GitHub
parent aa84022704
commit 1ddea27ac8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
72 changed files with 895 additions and 626 deletions

View file

@ -9,7 +9,6 @@
#include <QVBoxLayout>
#include "citra_qt/debugger/graphics/graphics_breakpoints.h"
#include "citra_qt/debugger/graphics/graphics_breakpoints_p.h"
#include "common/assert.h"
BreakPointModel::BreakPointModel(std::shared_ptr<Pica::DebugContext> debug_context, QObject* parent)
: QAbstractListModel(parent), context_weak(debug_context),
@ -60,12 +59,15 @@ QVariant BreakPointModel::data(const QModelIndex& index, int role) const {
}
Qt::ItemFlags BreakPointModel::flags(const QModelIndex& index) const {
if (!index.isValid())
return 0;
if (!index.isValid()) {
return {};
}
Qt::ItemFlags flags = Qt::ItemIsEnabled;
if (index.column() == 0)
if (index.column() == 0) {
flags |= Qt::ItemIsUserCheckable;
}
return flags;
}

View file

@ -14,7 +14,6 @@
#include <QTreeView>
#include <QVBoxLayout>
#include "citra_qt/debugger/graphics/graphics_cmdlists.h"
#include "citra_qt/util/spinbox.h"
#include "citra_qt/util/util.h"
#include "common/vector_math.h"
#include "core/core.h"
@ -130,7 +129,7 @@ void GPUCommandListWidget::OnCommandDoubleClicked(const QModelIndex& index) {
COMMAND_IN_RANGE(command_id, texturing.texture1) ||
COMMAND_IN_RANGE(command_id, texturing.texture2)) {
unsigned texture_index;
[[maybe_unused]] u32 texture_index;
if (COMMAND_IN_RANGE(command_id, texturing.texture0)) {
texture_index = 0;
} else if (COMMAND_IN_RANGE(command_id, texturing.texture1)) {

View file

@ -34,12 +34,15 @@ void SurfacePicture::mousePressEvent(QMouseEvent* event) {
if (!(event->buttons() & Qt::LeftButton))
return;
if (pixmap() == nullptr)
const QPixmap pixmap = this->pixmap(Qt::ReturnByValue);
if (pixmap.isNull()) {
return;
}
if (surface_widget)
surface_widget->Pick(event->x() * pixmap()->width() / width(),
event->y() * pixmap()->height() / height());
if (surface_widget) {
surface_widget->Pick(event->x() * pixmap.width() / width(),
event->y() * pixmap.height() / height());
}
}
void SurfacePicture::mouseMoveEvent(QMouseEvent* event) {
@ -314,57 +317,46 @@ void GraphicsSurfaceWidget::Pick(int x, int y) {
case Format::RGBA8: {
auto value = Color::DecodeRGBA8(pixel) / 255.0f;
return QStringLiteral("Red: %1, Green: %2, Blue: %3, Alpha: %4")
.arg(QString::number(value.r(), 'f', 2))
.arg(QString::number(value.g(), 'f', 2))
.arg(QString::number(value.b(), 'f', 2))
.arg(QString::number(value.a(), 'f', 2));
.arg(QString::number(value.r(), 'f', 2), QString::number(value.g(), 'f', 2),
QString::number(value.b(), 'f', 2), QString::number(value.a(), 'f', 2));
}
case Format::RGB8: {
auto value = Color::DecodeRGB8(pixel) / 255.0f;
return QStringLiteral("Red: %1, Green: %2, Blue: %3")
.arg(QString::number(value.r(), 'f', 2))
.arg(QString::number(value.g(), 'f', 2))
.arg(QString::number(value.b(), 'f', 2));
.arg(QString::number(value.r(), 'f', 2), QString::number(value.g(), 'f', 2),
QString::number(value.b(), 'f', 2));
}
case Format::RGB5A1: {
auto value = Color::DecodeRGB5A1(pixel) / 255.0f;
return QStringLiteral("Red: %1, Green: %2, Blue: %3, Alpha: %4")
.arg(QString::number(value.r(), 'f', 2))
.arg(QString::number(value.g(), 'f', 2))
.arg(QString::number(value.b(), 'f', 2))
.arg(QString::number(value.a(), 'f', 2));
.arg(QString::number(value.r(), 'f', 2), QString::number(value.g(), 'f', 2),
QString::number(value.b(), 'f', 2), QString::number(value.a(), 'f', 2));
}
case Format::RGB565: {
auto value = Color::DecodeRGB565(pixel) / 255.0f;
return QStringLiteral("Red: %1, Green: %2, Blue: %3")
.arg(QString::number(value.r(), 'f', 2))
.arg(QString::number(value.g(), 'f', 2))
.arg(QString::number(value.b(), 'f', 2));
.arg(QString::number(value.r(), 'f', 2), QString::number(value.g(), 'f', 2),
QString::number(value.b(), 'f', 2));
}
case Format::RGBA4: {
auto value = Color::DecodeRGBA4(pixel) / 255.0f;
return QStringLiteral("Red: %1, Green: %2, Blue: %3, Alpha: %4")
.arg(QString::number(value.r(), 'f', 2))
.arg(QString::number(value.g(), 'f', 2))
.arg(QString::number(value.b(), 'f', 2))
.arg(QString::number(value.a(), 'f', 2));
.arg(QString::number(value.r(), 'f', 2), QString::number(value.g(), 'f', 2),
QString::number(value.b(), 'f', 2), QString::number(value.a(), 'f', 2));
}
case Format::IA8:
return QStringLiteral("Index: %1, Alpha: %2").arg(pixel[0]).arg(pixel[1]);
return QStringLiteral("Index: %1, Alpha: %2").arg(pixel[0], pixel[1]);
case Format::RG8: {
auto value = Color::DecodeRG8(pixel) / 255.0f;
return QStringLiteral("Red: %1, Green: %2")
.arg(QString::number(value.r(), 'f', 2))
.arg(QString::number(value.g(), 'f', 2));
.arg(QString::number(value.r(), 'f', 2), QString::number(value.g(), 'f', 2));
}
case Format::I8:
return QStringLiteral("Index: %1").arg(*pixel);
case Format::A8:
return QStringLiteral("Alpha: %1").arg(QString::number(*pixel / 255.0f, 'f', 2));
case Format::IA4:
return QStringLiteral("Index: %1, Alpha: %2")
.arg(*pixel & 0xF)
.arg((*pixel & 0xF0) >> 4);
return QStringLiteral("Index: %1, Alpha: %2").arg(*pixel & 0xF, (*pixel & 0xF0) >> 4);
case Format::I4: {
u8 i = (*pixel >> ((offset % 2) ? 4 : 0)) & 0xF;
return QStringLiteral("Index: %1").arg(i);
@ -390,8 +382,7 @@ void GraphicsSurfaceWidget::Pick(int x, int y) {
case Format::X24S8: {
auto values = Color::DecodeD24S8(pixel);
return QStringLiteral("Depth: %1, Stencil: %2")
.arg(QString::number(values[0] / (float)0xFFFFFF, 'f', 4))
.arg(values[1]);
.arg(QString::number(values[0] / (float)0xFFFFFF, 'f', 4), values[1]);
}
case Format::Unknown:
return QStringLiteral("Unknown format");
@ -401,8 +392,8 @@ void GraphicsSurfaceWidget::Pick(int x, int y) {
};
QString nibbles;
for (unsigned i = 0; i < nibbles_per_pixel; i++) {
unsigned nibble_index = i;
for (u32 i = 0; i < nibbles_per_pixel; i++) {
u32 nibble_index = i;
if (nibble_mode) {
nibble_index += (offset % 2) ? 0 : 1;
}
@ -412,7 +403,7 @@ void GraphicsSurfaceWidget::Pick(int x, int y) {
}
surface_info_label->setText(
QStringLiteral("Raw: 0x%3\n(%4)").arg(nibbles).arg(GetText(surface_format, pixel)));
QStringLiteral("Raw: 0x%3\n(%4)").arg(nibbles, GetText(surface_format, pixel)));
surface_info_label->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
}
@ -676,8 +667,8 @@ void GraphicsSurfaceWidget::SaveSurface() {
}
if (selected_filter == png_filter) {
const QPixmap* const pixmap = surface_picture_label->pixmap();
ASSERT_MSG(pixmap != nullptr, "No pixmap set");
const QPixmap pixmap = surface_picture_label->pixmap(Qt::ReturnByValue);
ASSERT_MSG(!pixmap.isNull(), "No pixmap set");
QFile file{filename};
if (!file.open(QIODevice::WriteOnly)) {
@ -685,7 +676,7 @@ void GraphicsSurfaceWidget::SaveSurface() {
return;
}
if (!pixmap->save(&file, "PNG")) {
if (!pixmap.save(&file, "PNG")) {
QMessageBox::warning(this, tr("Error"),
tr("Failed to save surface data to file '%1'").arg(filename));
}

View file

@ -111,13 +111,13 @@ QVariant GraphicsVertexShaderModel::data(const QModelIndex& index, int role) con
}
};
const Instruction instr = par->info.code[index.row()];
const Instruction& instr = par->info.code[index.row()];
const OpCode opcode = instr.opcode;
const OpCode::Info opcode_info = opcode.GetInfo();
const u32 operand_desc_id = opcode_info.type == OpCode::Type::MultiplyAdd
? instr.mad.operand_desc_id.Value()
: instr.common.operand_desc_id.Value();
const SwizzlePattern swizzle = par->info.swizzle_info[operand_desc_id].pattern;
const SwizzlePattern& swizzle = par->info.swizzle_info[operand_desc_id].pattern;
// longest known instruction name: "setemit "
int kOpcodeColumnWidth = 8;
@ -407,8 +407,8 @@ GraphicsVertexShaderWidget::GraphicsVertexShaderWidget(
static_cast<void (QSignalMapper::*)()>(&QSignalMapper::map));
input_data_mapper->setMapping(input_data[i], i);
}
connect(input_data_mapper, static_cast<void (QSignalMapper::*)(int)>(&QSignalMapper::mapped),
this, &GraphicsVertexShaderWidget::OnInputAttributeChanged);
connect(input_data_mapper, &QSignalMapper::mappedInt, this,
&GraphicsVertexShaderWidget::OnInputAttributeChanged);
auto main_widget = new QWidget;
auto main_layout = new QVBoxLayout;
@ -514,8 +514,10 @@ void GraphicsVertexShaderWidget::Reload(bool replace_vertex_data, void* vertex_d
info.code.push_back({instr});
int num_attributes = shader_config.max_input_attribute_index + 1;
for (auto pattern : shader_setup.swizzle_data)
info.swizzle_info.push_back({pattern});
for (auto pattern : shader_setup.swizzle_data) {
const nihstro::SwizzleInfo swizzle_info = {.pattern = nihstro::SwizzlePattern{pattern}};
info.swizzle_info.push_back(swizzle_info);
}
u32 entry_point = Pica::g_state.regs.vs.main_offset;
info.labels.insert({entry_point, "main"});

View file

@ -57,6 +57,7 @@ QString IPCRecorderWidget::GetStatusStr(const IPCDebugger::RequestRecord& record
return tr("HLE Unimplemented");
default:
UNREACHABLE();
return QLatin1String{};
}
}

View file

@ -160,7 +160,8 @@ void MicroProfileWidget::mouseReleaseEvent(QMouseEvent* event) {
}
void MicroProfileWidget::wheelEvent(QWheelEvent* event) {
MicroProfileMousePosition(event->x() / x_scale, event->y() / y_scale, event->delta() / 120);
MicroProfileMousePosition(event->position().x() / x_scale, event->position().y() / y_scale,
event->angleDelta().y() / 120);
event->accept();
}