Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into remaplast
Browse files Browse the repository at this point in the history
  • Loading branch information
rainmakerv3 committed Dec 15, 2024
2 parents 2fafd3d + e7c4ffe commit 92bf45c
Show file tree
Hide file tree
Showing 14 changed files with 83 additions and 26 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,13 @@ For more information on how to test, debug and report issues with the emulator o

# Keyboard mapping

| Button | Function |
|-------------|-------------|
F10 | FPS Counter
Ctrl+F10 | Video Debug Info
F11 | Fullscreen
F12 | Trigger RenderDoc Capture

> [!NOTE]
> Xbox and DualShock controllers work out of the box.
Expand Down
2 changes: 1 addition & 1 deletion externals/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ option(TRACY_ENABLE "" ON)
option(TRACY_NO_CRASH_HANDLER "" ON) # Otherwise texture cache exceptions will be treaten as a crash
option(TRACY_ON_DEMAND "" ON)
option(TRACY_NO_FRAME_IMAGE "" ON)
option(TRACY_FIBERS "" ON) # For AmdGpu frontend profiling
option(TRACY_FIBERS "" OFF) # For AmdGpu frontend profiling, disabled due to instability
option(TRACY_NO_SYSTEM_TRACING "" ON)
option(TRACY_NO_CALLSTACK "" ON)
option(TRACY_NO_CODE_TRANSFER "" ON)
Expand Down
7 changes: 7 additions & 0 deletions src/common/debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ static inline bool IsProfilerConnected() {
return tracy::GetProfiler().IsConnected();
}

#define TRACY_GPU_ENABLED 0

#define CUSTOM_LOCK(type, varname) \
tracy::LockableCtx varname { \
[]() -> const tracy::SourceLocationData* { \
Expand Down Expand Up @@ -58,5 +60,10 @@ enum MarkersPalette : int {

#define FRAME_END FrameMark

#ifdef TRACY_FIBERS
#define FIBER_ENTER(name) TracyFiberEnter(name)
#define FIBER_EXIT TracyFiberLeave
#else
#define FIBER_ENTER(name)
#define FIBER_EXIT
#endif
3 changes: 3 additions & 0 deletions src/core/libraries/gnmdriver/gnmdriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,7 @@ int PS4_SYSV_ABI sceGnmDestroyWorkloadStream() {
}

void PS4_SYSV_ABI sceGnmDingDong(u32 gnm_vqid, u32 next_offs_dw) {
HLE_TRACE;
LOG_DEBUG(Lib_GnmDriver, "vqid {}, offset_dw {}", gnm_vqid, next_offs_dw);

if (gnm_vqid == 0) {
Expand Down Expand Up @@ -2166,6 +2167,7 @@ int PS4_SYSV_ABI sceGnmSubmitCommandBuffersForWorkload(u32 workload, u32 count,
u32* dcb_sizes_in_bytes,
const u32* ccb_gpu_addrs[],
u32* ccb_sizes_in_bytes) {
HLE_TRACE;
LOG_DEBUG(Lib_GnmDriver, "called");

if (!dcb_gpu_addrs || !dcb_sizes_in_bytes) {
Expand Down Expand Up @@ -2258,6 +2260,7 @@ s32 PS4_SYSV_ABI sceGnmSubmitCommandBuffers(u32 count, const u32* dcb_gpu_addrs[
}

int PS4_SYSV_ABI sceGnmSubmitDone() {
HLE_TRACE;
LOG_DEBUG(Lib_GnmDriver, "called");
WaitGpuIdle();
if (!liverpool->IsGpuIdle()) {
Expand Down
2 changes: 1 addition & 1 deletion src/qt_gui/game_list_frame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ void GameListFrame::PopulateGameList() {
formattedPlayTime = formattedPlayTime.trimmed();
m_game_info->m_games[i].play_time = playTime.toStdString();
if (formattedPlayTime.isEmpty()) {
SetTableItem(i, 7, "0");
SetTableItem(i, 7, QString("%1s").arg(seconds));
} else {
SetTableItem(i, 7, formattedPlayTime);
}
Expand Down
13 changes: 13 additions & 0 deletions src/qt_gui/main_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ void MainWindow::CreateActions() {
m_theme_act_group->addAction(ui->setThemeGreen);
m_theme_act_group->addAction(ui->setThemeBlue);
m_theme_act_group->addAction(ui->setThemeViolet);
m_theme_act_group->addAction(ui->setThemeGruvbox);
}

void MainWindow::AddUiWidgets() {
Expand Down Expand Up @@ -550,6 +551,14 @@ void MainWindow::CreateConnects() {
isIconBlack = false;
}
});
connect(ui->setThemeGruvbox, &QAction::triggered, &m_window_themes, [this]() {
m_window_themes.SetWindowTheme(Theme::Gruvbox, ui->mw_searchbar);
Config::setMainWindowTheme(static_cast<int>(Theme::Gruvbox));
if (isIconBlack) {
SetUiIcons(false);
isIconBlack = false;
}
});
}

void MainWindow::StartGame() {
Expand Down Expand Up @@ -922,6 +931,10 @@ void MainWindow::SetLastUsedTheme() {
ui->setThemeViolet->setChecked(true);
isIconBlack = false;
SetUiIcons(false);
case Theme::Gruvbox:
ui->setThemeGruvbox->setChecked(true);
isIconBlack = false;
SetUiIcons(false);
break;
}
}
Expand Down
22 changes: 20 additions & 2 deletions src/qt_gui/main_window_themes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ void WindowThemes::SetWindowTheme(Theme theme, QLineEdit* mw_searchbar) {
themePalette.setColor(QPalette::Window, QColor(50, 50, 50));
themePalette.setColor(QPalette::WindowText, Qt::white);
themePalette.setColor(QPalette::Base, QColor(20, 20, 20));
themePalette.setColor(QPalette::AlternateBase, QColor(25, 25, 25));
themePalette.setColor(QPalette::AlternateBase, QColor(53, 53, 53));
themePalette.setColor(QPalette::ToolTipBase, Qt::white);
themePalette.setColor(QPalette::ToolTipText, Qt::white);
Expand All @@ -28,7 +27,6 @@ void WindowThemes::SetWindowTheme(Theme theme, QLineEdit* mw_searchbar) {
themePalette.setColor(QPalette::HighlightedText, Qt::black);
qApp->setPalette(themePalette);
break;

case Theme::Light:
mw_searchbar->setStyleSheet("background-color: #ffffff;" // Light gray background
"color: #000000;" // Black text
Expand Down Expand Up @@ -115,6 +113,26 @@ void WindowThemes::SetWindowTheme(Theme theme, QLineEdit* mw_searchbar) {
themePalette.setColor(QPalette::Highlight, QColor(42, 130, 218)); // Light blue highlight
themePalette.setColor(QPalette::HighlightedText, Qt::black); // Black highlighted text

qApp->setPalette(themePalette);
break;
case Theme::Gruvbox:
mw_searchbar->setStyleSheet("background-color: #1d2021;"
"color: #f9f5d7;"
"border: 2px solid #f9f5d7;"
"padding: 5px;");
themePalette.setColor(QPalette::Window, QColor(29, 32, 33));
themePalette.setColor(QPalette::WindowText, QColor(249, 245, 215));
themePalette.setColor(QPalette::Base, QColor(29, 32, 33));
themePalette.setColor(QPalette::AlternateBase, QColor(50, 48, 47));
themePalette.setColor(QPalette::ToolTipBase, QColor(249, 245, 215));
themePalette.setColor(QPalette::ToolTipText, QColor(249, 245, 215));
themePalette.setColor(QPalette::Text, QColor(249, 245, 215));
themePalette.setColor(QPalette::Button, QColor(40, 40, 40));
themePalette.setColor(QPalette::ButtonText, QColor(249, 245, 215));
themePalette.setColor(QPalette::BrightText, QColor(251, 73, 52));
themePalette.setColor(QPalette::Link, QColor(131, 165, 152));
themePalette.setColor(QPalette::Highlight, QColor(131, 165, 152));
themePalette.setColor(QPalette::HighlightedText, Qt::black);
qApp->setPalette(themePalette);
break;
}
Expand Down
8 changes: 1 addition & 7 deletions src/qt_gui/main_window_themes.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,7 @@
#include <QLineEdit>
#include <QWidget>

enum class Theme : int {
Dark,
Light,
Green,
Blue,
Violet,
};
enum class Theme : int { Dark, Light, Green, Blue, Violet, Gruvbox };

class WindowThemes : public QObject {
Q_OBJECT
Expand Down
6 changes: 6 additions & 0 deletions src/qt_gui/main_window_ui.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class Ui_MainWindow {
QAction* setThemeGreen;
QAction* setThemeBlue;
QAction* setThemeViolet;
QAction* setThemeGruvbox;
QWidget* centralWidget;
QLineEdit* mw_searchbar;
QPushButton* playButton;
Expand Down Expand Up @@ -158,6 +159,9 @@ class Ui_MainWindow {
setThemeViolet = new QAction(MainWindow);
setThemeViolet->setObjectName("setThemeViolet");
setThemeViolet->setCheckable(true);
setThemeGruvbox = new QAction(MainWindow);
setThemeGruvbox->setObjectName("setThemeGruvbox");
setThemeGruvbox->setCheckable(true);
centralWidget = new QWidget(MainWindow);
centralWidget->setObjectName("centralWidget");
sizePolicy.setHeightForWidth(centralWidget->sizePolicy().hasHeightForWidth());
Expand Down Expand Up @@ -282,6 +286,7 @@ class Ui_MainWindow {
menuThemes->addAction(setThemeGreen);
menuThemes->addAction(setThemeBlue);
menuThemes->addAction(setThemeViolet);
menuThemes->addAction(setThemeGruvbox);
menuGame_List_Icons->addAction(setIconSizeTinyAct);
menuGame_List_Icons->addAction(setIconSizeSmallAct);
menuGame_List_Icons->addAction(setIconSizeMediumAct);
Expand Down Expand Up @@ -368,6 +373,7 @@ class Ui_MainWindow {
setThemeGreen->setText(QCoreApplication::translate("MainWindow", "Green", nullptr));
setThemeBlue->setText(QCoreApplication::translate("MainWindow", "Blue", nullptr));
setThemeViolet->setText(QCoreApplication::translate("MainWindow", "Violet", nullptr));
setThemeGruvbox->setText("Gruvbox");
toolBar->setWindowTitle(QCoreApplication::translate("MainWindow", "toolBar", nullptr));
} // retranslateUi
};
Expand Down
20 changes: 12 additions & 8 deletions src/shader_recompiler/frontend/translate/scalar_alu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,9 @@ void Translator::EmitSOPK(const GcnInst& inst) {
switch (inst.opcode) {
// SOPK
case Opcode::S_MOVK_I32:
return S_MOVK(inst);

return S_MOVK(inst, false);
case Opcode::S_CMOVK_I32:
return S_MOVK(inst, true);
case Opcode::S_CMPK_EQ_I32:
return S_CMPK(ConditionOp::EQ, true, inst);
case Opcode::S_CMPK_LG_I32:
Expand Down Expand Up @@ -458,13 +459,16 @@ void Translator::S_ABSDIFF_I32(const GcnInst& inst) {

// SOPK

void Translator::S_MOVK(const GcnInst& inst) {
const auto simm16 = inst.control.sopk.simm;
if (simm16 & (1 << 15)) {
// TODO: need to verify the case of imm sign extension
UNREACHABLE();
void Translator::S_MOVK(const GcnInst& inst, bool is_conditional) {
const s16 simm16 = inst.control.sopk.simm;
// do the sign extension
const s32 simm32 = static_cast<s32>(simm16);
IR::U32 val = ir.Imm32(simm32);
if (is_conditional) {
// if !SCC its a NOP
val = IR::U32{ir.Select(ir.GetScc(), val, GetSrc(inst.dst[0]))};
}
SetDst(inst.dst[0], ir.Imm32(simm16));
SetDst(inst.dst[0], val);
}

void Translator::S_CMPK(ConditionOp cond, bool is_signed, const GcnInst& inst) {
Expand Down
2 changes: 1 addition & 1 deletion src/shader_recompiler/frontend/translate/translate.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class Translator {
void S_NOT_B32(const GcnInst& inst);

// SOPK
void S_MOVK(const GcnInst& inst);
void S_MOVK(const GcnInst& inst, bool is_conditional);
void S_CMPK(ConditionOp cond, bool is_signed, const GcnInst& inst);
void S_ADDK_I32(const GcnInst& inst);
void S_MULK_I32(const GcnInst& inst);
Expand Down
10 changes: 6 additions & 4 deletions src/shader_recompiler/ir/passes/hull_shader_transform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -398,18 +398,20 @@ void HullShaderTransform(IR::Program& program, RuntimeInfo& runtime_info) {
// communicated to the driver.
// The layout seems to be implied by the type of the abstract domain.
switch (runtime_info.hs_info.tess_type) {
case AmdGpu::TessellationType::Quad:
ASSERT(gcn_factor_idx < 6);
case AmdGpu::TessellationType::Isoline:
ASSERT(gcn_factor_idx < 2);
return IR::PatchFactor(gcn_factor_idx);
case AmdGpu::TessellationType::Triangle:
ASSERT(gcn_factor_idx < 4);
if (gcn_factor_idx == 3) {
return IR::Patch::TessellationLodInteriorU;
}
return IR::PatchFactor(gcn_factor_idx);
case AmdGpu::TessellationType::Quad:
ASSERT(gcn_factor_idx < 6);
return IR::PatchFactor(gcn_factor_idx);
default:
// Point domain types haven't been seen so far
UNREACHABLE_MSG("Unhandled tess type");
UNREACHABLE();
}
};

Expand Down
3 changes: 2 additions & 1 deletion src/video_core/amdgpu/liverpool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,8 @@ Liverpool::Task Liverpool::ProcessGraphics(std::span<const u32> dcb, std::span<c
// there are no other submits to yield to we can sleep the thread
// instead and allow other tasks to run.
const u64* wait_addr = wait_reg_mem->Address<u64*>();
if (vo_port->IsVoLabel(wait_addr) && num_submits == 1) {
if (vo_port->IsVoLabel(wait_addr) &&
num_submits == mapped_queues[GfxQueueId].submits.size()) {
vo_port->WaitVoLabel([&] { return wait_reg_mem->Test(); });
}
while (!wait_reg_mem->Test()) {
Expand Down
4 changes: 3 additions & 1 deletion src/video_core/renderer_vulkan/vk_instance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

#include "common/assert.h"
#include "common/config.h"
#include "common/debug.h"
#include "sdl_window.h"
#include "video_core/renderer_vulkan/liverpool_to_vk.h"
#include "video_core/renderer_vulkan/vk_instance.h"
Expand Down Expand Up @@ -261,7 +262,8 @@ bool Instance::CreateDevice() {
// The next two extensions are required to be available together in order to support write masks
color_write_en = add_extension(VK_EXT_COLOR_WRITE_ENABLE_EXTENSION_NAME);
color_write_en &= add_extension(VK_EXT_EXTENDED_DYNAMIC_STATE_3_EXTENSION_NAME);
const bool calibrated_timestamps = add_extension(VK_EXT_CALIBRATED_TIMESTAMPS_EXTENSION_NAME);
const bool calibrated_timestamps =
TRACY_GPU_ENABLED ? add_extension(VK_EXT_CALIBRATED_TIMESTAMPS_EXTENSION_NAME) : false;
const bool robustness = add_extension(VK_EXT_ROBUSTNESS_2_EXTENSION_NAME);
list_restart = add_extension(VK_EXT_PRIMITIVE_TOPOLOGY_LIST_RESTART_EXTENSION_NAME);
maintenance5 = add_extension(VK_KHR_MAINTENANCE_5_EXTENSION_NAME);
Expand Down

0 comments on commit 92bf45c

Please sign in to comment.