vita3k: cleanup (#3357)

* module: add missing pragma once

* cmake/vita3k: delete unused files

* vita3k: delete useless semi-colons

* vita3k: cleanup headers

* audio: add missing override to destructors

* vita3k: fix typos

* external: disable unused curl targets
This commit is contained in:
scribam
2024-09-02 13:03:58 +02:00
committed by GitHub
parent f01a4e9b63
commit 612d1f8d81
97 changed files with 134 additions and 274 deletions
-64
View File
@@ -1,64 +0,0 @@
option(COMPILE_MODERN_CPP "Compile ${PROJECT_NAME} as a C++17 or C++14 program" ON)
option(COMPILE_CPP17 "Force compilation of ${PROJECT_NAME} as C++17" OFF)
option(COMPILE_CPP14 "Force compilation of ${PROJECT_NAME} as C++14" OFF)
mark_as_advanced(FORCE COMPILE_CPP17)
mark_as_advanced(FORCE COMPILE_CPP14)
# Assign the proper standard and compilation to the project based on the flags available.
# This tests for C++17 and C++14 compatibility, while applying C++11 as a fallback.
# Based on https://stackoverflow.com/a/44964919
function(get_standard_for_build)
unset(STANDARD_FLAG PARENT_SCOPE)
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(COMPILER_TEST "-std=c++1z;-std=c++1y;-std=c++0x")
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
# VS 2015.3+ does not have a C++11 option
set(COMPILER_TEST "/std:c++17;/std:c++14;INVALID")
elseif(CMAKE_CXX_COMPILER_ID MATCHES "^(Apple)?Clang$")
if(MSVC) ##for msvc-clang
set(COMPILER_TEST "/std:c++17;/std:c++14;/std:c++11")
else()
set(COMPILER_TEST "-std=c++17;-std=c++14;-std=c++11")
endif()
else()
set(COMPILER_TEST "-std:c++17;-std:c++14;-std:c++11")
endif()
if(COMPILE_MODERN_CPP)
if(NOT COMPILE_CPP17 AND NOT COMPILE_CPP14)
include(CheckCXXCompilerFlag)
list(GET COMPILER_TEST 0 STANDARD_FLAG)
check_cxx_compiler_flag(${STANDARD_FLAG} HAS_CPP17_FLAG)
include(CheckIncludeFileCXX)
check_include_file_cxx("filesystem" HAS_CPP17_INCLUDE)
if(HAS_CPP17_FLAG AND HAS_CPP17_INCLUDE)
set(COMPILE_CPP17 ON)
else()
list(GET COMPILER_TEST 1 STANDARD_FLAG)
check_cxx_compiler_flag(${STANDARD_FLAG} HAS_CPP14_FLAG)
check_include_file_cxx("experimental/filesystem" HAS_EXPERIMENTAL)
if(HAS_CPP14_FLAG AND HAS_EXPERIMENTAL)
set(COMPILE_CPP14 ON)
else()
message(FATAL_ERROR "Your compiler does not support C++14 or C++17. "
"Call\ncmake -DCOMPILE_MODERN_CPP=OFF ..\n"
"to build ${PROJECT_NAME}.")
endif()
endif()
endif()
if(COMPILE_CPP17)
set(CPP17_SUPPORTED ON PARENT_SCOPE)
list(GET COMPILER_TEST 0 STANDARD_FLAG)
elseif(COMPILE_CPP14)
set(CPP14_SUPPORTED ON PARENT_SCOPE)
list(GET COMPILER_TEST 1 STANDARD_FLAG)
endif()
else()
list(GET COMPILER_TEST 2 STANDARD_FLAG)
endif()
set(STANDARD_FLAG ${STANDARD_FLAG} PARENT_SCOPE)
endfunction()
+6
View File
@@ -304,11 +304,17 @@ find_package(CURL QUIET)
if(NOT CURL_FOUND)
message("System curl not found, compiling curl from source")
include(FetchContent)
option(BUILD_CURL_EXE "Set to ON to build curl executable." OFF)
option(CURL_DISABLE_INSTALL "Set to ON to disable installation targets" ON)
option(HTTP_ONLY "disables all protocols except HTTP (This overrides all CURL_DISABLE_* options)" ON)
option(BUILD_LIBCURL_DOCS "to build libcurl man pages" OFF)
option(BUILD_MISC_DOCS "to build misc man pages (e.g. curl-config and mk-ca-bundle)" OFF)
option(ENABLE_CURL_MANUAL "to build the man page for curl and enable its -M/--manual option" OFF)
if(WIN32)
option(CURL_USE_SCHANNEL "Enable Windows native SSL/TLS" ON)
endif()
option(CURL_CA_FALLBACK "Set ON to use built-in CA store of TLS backend. Defaults to OFF" ON)
set(CURL_DISABLE_TESTS ON)
FetchContent_Declare(curl
GIT_REPOSITORY https://github.com/curl/curl.git
GIT_TAG fd567d4f06857f4fc8e2f64ea727b1318f76ad33 # release 8.8.0
+2 -2
View File
@@ -713,7 +713,7 @@ Some applications don't use this and get default confirmation button.</enter_but
<medium>Medium</medium>
<maximum>Maximum</maximum>
<detail>Detail</detail>
<select_detail>Select your preferred perfomance overlay detail.</select_detail>
<select_detail>Select your preferred performance overlay detail.</select_detail>
<top_left>Top Left</top_left>
<top_center>Top Center</top_center>
<top_right>Top Right</top_right>
@@ -721,7 +721,7 @@ Some applications don't use this and get default confirmation button.</enter_but
<bottom_center>Bottom Center</bottom_center>
<bottom_right>Bottom Right</bottom_right>
<position>Position</position>
<select_position>Select your preferred perfomance overlay position.</select_position>
<select_position>Select your preferred performance overlay position.</select_position>
<case_insensitive>Check to enable case-insensitive path finding on case sensitive filesystems.
RESETS ON RESTART</case_insensitive>
<case_insensitive_description>Allows emulator to attempt searching for files regardless of case
+2 -2
View File
@@ -713,7 +713,7 @@ Some applications don't use this and get default confirmation button.</enter_but
<medium>Medium</medium>
<maximum>Maximum</maximum>
<detail>Detail</detail>
<select_detail>Select your preferred perfomance overlay detail.</select_detail>
<select_detail>Select your preferred performance overlay detail.</select_detail>
<top_left>Top Left</top_left>
<top_center>Top Center</top_center>
<top_right>Top Right</top_right>
@@ -721,7 +721,7 @@ Some applications don't use this and get default confirmation button.</enter_but
<bottom_center>Bottom Center</bottom_center>
<bottom_right>Bottom Right</bottom_right>
<position>Position</position>
<select_position>Select your preferred perfomance overlay position.</select_position>
<select_position>Select your preferred performance overlay position.</select_position>
<case_insensitive>Check to enable case-insensitive path finding on case sensitive filesystems.
RESETS ON RESTART</case_insensitive>
<case_insensitive_description>Allows emulator to attempt searching for files regardless of case
@@ -49,7 +49,7 @@ class CubebAudioAdapter : public AudioAdapter {
public:
CubebAudioAdapter(AudioState &audio_state);
~CubebAudioAdapter();
~CubebAudioAdapter() override;
bool init() override;
AudioOutPortPtr open_port(int nb_channels, int freq, int nb_sample) override;
+1 -1
View File
@@ -25,7 +25,7 @@ class SDLAudioAdapter : public AudioAdapter {
public:
SDLAudioAdapter(AudioState &audio_state);
~SDLAudioAdapter();
~SDLAudioAdapter() override;
bool init() override;
void switch_state(const bool pause) override;
+1 -1
View File
@@ -117,7 +117,7 @@ AudioOutPortPtr CubebAudioAdapter::open_port(int nb_channels, int freq, int nb_s
const int nb_buffers = (latency + nb_sample - 1) / nb_sample + 1;
port->audio_buffers.resize(nb_buffers);
for (AudioBuffer &audio_buffer : port->audio_buffers) {
// initialize all of the buffers
// initialize all the buffers
audio_buffer.buffer.resize(port->len_bytes);
audio_buffer.buffer_position = 0;
}
+1 -1
View File
@@ -41,7 +41,7 @@ DecoderState::~DecoderState() {
avcodec_free_context(&context);
}
// Handy to have this in logs, some debuggers dont seem to be able to evaluate there error macros properly.
// Handy to have this in logs, some debuggers don't seem to be able to evaluate there error macros properly.
std::string codec_error_name(int error) {
switch (error) {
case AVERROR(EAGAIN):
+1 -1
View File
@@ -261,7 +261,7 @@ bool PCMDecoderState::send(const uint8_t *data, uint32_t size) {
produced_samples = size / sizeof(std::int16_t) / source_channels;
}
// Try to resample if neccessary
// Try to resample if necessary
SwrContext *swr = (source_channels == 2) ? swr_stereo : swr_mono_to_stereo;
const int dest_count = swr_get_out_samples(swr, produced_samples);
+4 -4
View File
@@ -26,14 +26,14 @@ enum ModulesMode {
MANUAL
};
enum PerfomanceOverleyDetail {
enum PerformanceOverlayDetail {
MINIMUM,
LOW,
MEDIUM,
MAXIMUM,
};
enum PerfomanceOverleyPosition {
enum PerformanceOverlayPosition {
TOP_LEFT,
TOP_CENTER,
TOP_RIGHT,
@@ -107,8 +107,8 @@ enum ScreenshotFormat {
code(bool, "color-surface-debug", false, color_surface_debug) \
code(bool, "show-touchpad-cursor", true, show_touchpad_cursor) \
code(bool, "performance-overlay", false, performance_overlay) \
code(int, "perfomance-overlay-detail", static_cast<int>(MINIMUM), performance_overlay_detail) \
code(int, "perfomance-overlay-position", static_cast<int>(TOP_LEFT), performance_overlay_position) \
code(int, "performance-overlay-detail", static_cast<int>(MINIMUM), performance_overlay_detail) \
code(int, "performance-overlay-position", static_cast<int>(TOP_LEFT), performance_overlay_position) \
code(int, "screenshot-format", static_cast<int>(JPEG), screenshot_format) \
code(bool, "disable-motion", false, disable_motion) \
code(int, "keyboard-button-select", 229, keyboard_button_select) \
+2 -2
View File
@@ -18,7 +18,7 @@
#pragma once
#include <fmt/format.h>
#include <mem/ptr.h> // Address.
#include <mem/util.h> // Address.
#include <array>
#include <cstdint>
@@ -43,7 +43,7 @@ typedef void *ExclusiveMonitorPtr;
struct CPUProtocolBase {
virtual void call_svc(CPUState &cpu, uint32_t svc, Address pc, ThreadState &thread) = 0;
virtual Address get_watch_memory_addr(Address addr) = 0;
virtual ExclusiveMonitorPtr get_exlusive_monitor() = 0;
virtual ExclusiveMonitorPtr get_exclusive_monitor() = 0;
virtual ~CPUProtocolBase() = default;
};
@@ -18,7 +18,6 @@
#pragma once
#include <dynarmic/interface/A32/a32.h>
#include <dynarmic/interface/A32/coprocessor.h>
#include <dynarmic/interface/exclusive_monitor.h>
#include <cpu/functions.h>
+1
View File
@@ -20,6 +20,7 @@
#include <cpu/common.h>
#include <cpu/disasm/state.h>
#include <cpu/functions.h>
#include <mem/block.h>
struct CPUState {
CPUState() = default;
+1 -1
View File
@@ -65,7 +65,7 @@ CPUStatePtr init_cpu(CPUBackend backend, bool cpu_opt, SceUID thread_id, std::si
switch (backend) {
case CPUBackend::Dynarmic: {
Dynarmic::ExclusiveMonitor *monitor = static_cast<Dynarmic::ExclusiveMonitor *>(protocol->get_exlusive_monitor());
Dynarmic::ExclusiveMonitor *monitor = static_cast<Dynarmic::ExclusiveMonitor *>(protocol->get_exclusive_monitor());
state->cpu = std::make_unique<DynarmicCPU>(state.get(), processor_id, monitor, cpu_opt);
break;
}
+1
View File
@@ -25,6 +25,7 @@
#include <mem/ptr.h>
#include <dynarmic/frontend/A32/a32_ir_emitter.h>
#include <dynarmic/interface/A32/coprocessor.h>
class ArmDynarmicCP15 : public Dynarmic::A32::Coprocessor {
uint32_t tpidruro;
-25
View File
@@ -1,25 +0,0 @@
// Vita3K emulator project
// Copyright (C) 2024 Vita3K team
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this program; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#include <cpu/read_arg.h>
#include <cpu/vargs.h>
// Workaround for old Clang and GCC
template <>
module::vargs make_vargs(const LayoutArgsState &state) {
return module::vargs{ state };
}
+2
View File
@@ -17,7 +17,9 @@
#include <cpu/functions.h>
#include <cpu/impl/unicorn_cpu.h>
#include <mem/functions.h>
#include <mem/ptr.h>
#include <mem/util.h>
#include <util/log.h>
#include <cassert>
+5 -5
View File
@@ -146,9 +146,9 @@ static void draw_trophy_setup_dialog(DialogState &common_dialog, float FONT_SCAL
}
}
static std::string get_save_date_time(SceSystemParamDateFormat date_fromat, const SceDateTime &date_time) {
static std::string get_save_date_time(SceSystemParamDateFormat date_format, const SceDateTime &date_time) {
std::string date_str;
switch (date_fromat) {
switch (date_format) {
case SCE_SYSTEM_PARAM_DATE_FORMAT_YYYYMMDD:
date_str = fmt::format("{}/{}/{}", date_time.year, date_time.month, date_time.day);
break;
@@ -615,12 +615,12 @@ static void draw_savedata_dialog(GuiState &gui, EmuEnvState &emuenv, float FONT_
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 12.f * SCALE.x);
const auto BUTTON_SIZE_HEIGHT = 46.f * SCALE.y;
const ImVec2 buttons_size(320.f * SCALE.x, BUTTON_SIZE_HEIGHT);
const auto boutton_height_pos = WINDOW_SIZE.y - BUTTON_SIZE_HEIGHT - (22 * SCALE.y);
const auto boutton_width_pos = HALF_WINDOW_SIZE.x - (emuenv.common_dialog.savedata.btn_num == 2 ? (buttons_size.x + (20.f * SCALE.x)) : (buttons_size.x / 2.f));
const auto button_height_pos = WINDOW_SIZE.y - BUTTON_SIZE_HEIGHT - (22 * SCALE.y);
const auto button_width_pos = HALF_WINDOW_SIZE.x - (emuenv.common_dialog.savedata.btn_num == 2 ? (buttons_size.x + (20.f * SCALE.x)) : (buttons_size.x / 2.f));
ImGui::BeginGroup();
for (int i = 0; i < emuenv.common_dialog.savedata.btn_num; i++) {
ImGui::PushID(i);
const ImVec2 button_id_pos(boutton_width_pos + (i * (buttons_size.x + (40.f * SCALE.x))), boutton_height_pos);
const ImVec2 button_id_pos(button_width_pos + (i * (buttons_size.x + (40.f * SCALE.x))), button_height_pos);
ImGui::SetCursorPos(button_id_pos);
if (ImGui::Button(emuenv.common_dialog.savedata.btn[i].c_str(), buttons_size)) {
emuenv.common_dialog.savedata.button_id = emuenv.common_dialog.savedata.btn_val[i];
+1 -1
View File
@@ -252,7 +252,7 @@ void init_ime_lang(Ime &ime, const SceImeLanguage &lang) {
size_button = 135.f;
size_key = 88.f;
break;
};
}
}
static std::map<int, float> key_row_pos = { { FIRST, 11.f }, { SECOND, 69.f }, { THIRD, 127.f } };
+1 -1
View File
@@ -645,7 +645,7 @@ void draw_information_bar(GuiState &gui, EmuEnvState &emuenv) {
battery_size /= 100.f;
}
// Set battery color depending on battery level: red for levels below or egale 25% and green for levels above this threshold.
// Set battery color depending on battery level: red for levels less than or equal to 25% and green for levels above this threshold.
const ImU32 BATTERY_COLOR = (res >= 0) && (res <= 25) ? IM_COL32(225.f, 50.f, 50.f, 255.f) : IM_COL32(90.f, 200.f, 30.f, 255.f);
// Draw battery level
+4 -4
View File
@@ -203,16 +203,16 @@ void draw_manual(GuiState &gui, EmuEnvState &emuenv) {
const std::string slider = fmt::format("{:0>2d}/{:0>2d}", current_page + 1, (int32_t)gui.manuals.size());
if (ImGui::Button(slider.c_str(), BUTTON_SIZE))
ImGui::OpenPopup("Manual Slider");
const auto POPUP_HEIGTH = 64.f * SCALE.y;
ImGui::SetNextWindowPos(ImVec2(0.f, display_size.y - POPUP_HEIGTH), ImGuiCond_Always);
ImGui::SetNextWindowSize(ImVec2(display_size.x, POPUP_HEIGTH), ImGuiCond_Always);
const auto POPUP_HEIGHT = 64.f * SCALE.y;
ImGui::SetNextWindowPos(ImVec2(0.f, display_size.y - POPUP_HEIGHT), ImGuiCond_Always);
ImGui::SetNextWindowSize(ImVec2(display_size.x, POPUP_HEIGHT), ImGuiCond_Always);
ImGui::SetNextWindowBgAlpha(0.7f);
if (ImGui::BeginPopupModal("Manual Slider", nullptr, ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoSavedSettings)) {
const auto SLIDER_WIDTH = 800.f * SCALE.x;
ImGui::PushItemWidth(SLIDER_WIDTH);
ImGui::PushStyleVar(ImGuiStyleVar_GrabMinSize, 26.f * SCALE.y);
ImGui::PushStyleVar(ImGuiStyleVar_GrabRounding, 50.f * SCALE.y);
ImGui::SetCursorPos(ImVec2((display_size.x / 2) - (SLIDER_WIDTH / 2.f), (POPUP_HEIGTH / 2) - (15.f * SCALE.x)));
ImGui::SetCursorPos(ImVec2((display_size.x / 2) - (SLIDER_WIDTH / 2.f), (POPUP_HEIGHT / 2) - (15.f * SCALE.x)));
ImGui::SliderInt("##slider_current_manual", &current_page, 0, (int32_t)gui.manuals.size() - 1, slider.c_str());
ImGui::PopStyleVar(2);
ImGui::PopItemWidth();
+3 -3
View File
@@ -76,11 +76,11 @@ void draw_perf_overlay(GuiState &gui, EmuEnvState &emuenv) {
ImGui::BeginChild("#perf_stats", WINDOW_SIZE, true, ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoSavedSettings);
ImGui::PushFont(gui.vita_font);
ImGui::SetWindowFontScale(0.7f * RES_SCALE.x);
if (emuenv.cfg.performance_overlay_detail == PerfomanceOverleyDetail::MINIMUM)
if (emuenv.cfg.performance_overlay_detail == PerformanceOverlayDetail::MINIMUM)
ImGui::Text("FPS: %d", emuenv.fps);
else
ImGui::Text("FPS: %d %s: %d", emuenv.fps, lang["avg"].c_str(), emuenv.avg_fps);
if (emuenv.cfg.performance_overlay_detail >= PerfomanceOverleyDetail::MEDIUM) {
if (emuenv.cfg.performance_overlay_detail >= PerformanceOverlayDetail::MEDIUM) {
ImGui::Separator();
ImGui::Text("%s: %d %s: %d", lang["min"].c_str(), emuenv.min_fps, lang["max"].c_str(), emuenv.max_fps);
}
@@ -88,7 +88,7 @@ void draw_perf_overlay(GuiState &gui, EmuEnvState &emuenv) {
ImGui::EndChild();
ImGui::PopStyleVar();
ImGui::PopStyleColor();
if (emuenv.cfg.performance_overlay_detail == PerfomanceOverleyDetail::MAXIMUM) {
if (emuenv.cfg.performance_overlay_detail == PerformanceOverlayDetail::MAXIMUM) {
ImGui::SetCursorPosY(ImGui::GetCursorPosY() - (3.f * SCALE.y));
ImGui::PlotLines("##fps_graphic", emuenv.fps_values, IM_ARRAYSIZE(emuenv.fps_values), emuenv.current_fps_offset, nullptr, 0.f, float(emuenv.max_fps), WINDOW_SIZE);
}
+2 -2
View File
@@ -875,8 +875,8 @@ void draw_settings_dialog(GuiState &gui, EmuEnvState &emuenv) {
ImGui::Checkbox(lang.emulator["check_for_updates"].c_str(), &emuenv.cfg.check_for_updates);
SetTooltipEx(lang.emulator["check_for_updates_description"].c_str());
ImGui::Separator();
const auto perfomance_overley_size = ImGui::CalcTextSize(lang.emulator["performance_overlay"].c_str()).x;
ImGui::SetCursorPosX((ImGui::GetWindowWidth() / 2.f) - (perfomance_overley_size / 2.f));
const auto performance_overlay_size = ImGui::CalcTextSize(lang.emulator["performance_overlay"].c_str()).x;
ImGui::SetCursorPosX((ImGui::GetWindowWidth() / 2.f) - (performance_overlay_size / 2.f));
ImGui::TextColored(GUI_COLOR_TEXT_TITLE, "%s", lang.emulator["performance_overlay"].c_str());
ImGui::Spacing();
ImGui::Checkbox(lang.emulator["performance_overlay"].c_str(), &emuenv.cfg.performance_overlay);
+4 -4
View File
@@ -415,7 +415,7 @@ enum SceGxmTextureBaseFormat : uint32_t {
template <typename T>
constexpr static inline uint32_t operator|(const SceGxmTextureBaseFormat a, const T b) {
return static_cast<uint32_t>(a) | static_cast<uint32_t>(b);
};
}
enum SceGxmTextureFormat : uint32_t {
// Supported formats
@@ -842,7 +842,7 @@ enum SceGxmColorBaseFormat : uint32_t {
template <typename T>
constexpr static inline uint32_t operator|(const SceGxmColorBaseFormat a, const T b) {
return static_cast<uint32_t>(a) | static_cast<uint32_t>(b);
};
}
enum SceGxmColorFormat : uint32_t {
@@ -1057,7 +1057,7 @@ enum SceGxmDepthStencilForceLoadMode : uint32_t {
template <typename T>
constexpr static inline uint32_t operator|(const SceGxmDepthStencilForceLoadMode a, const T b) {
return static_cast<uint32_t>(a) | static_cast<uint32_t>(b);
};
}
enum SceGxmDepthStencilForceStoreMode : uint32_t {
SCE_GXM_DEPTH_STENCIL_FORCE_STORE_DISABLED = 0x00000000u,
@@ -1067,7 +1067,7 @@ enum SceGxmDepthStencilForceStoreMode : uint32_t {
template <typename T>
constexpr static inline uint32_t operator|(const SceGxmDepthStencilForceStoreMode a, const T b) {
return static_cast<uint32_t>(a) | static_cast<uint32_t>(b);
};
}
enum SceGxmColorSurfaceDitherMode : uint32_t {
SCE_GXM_COLOR_SURFACE_DITHER_DISABLED = 0x00000000u,
+5 -5
View File
@@ -296,7 +296,7 @@ uint32_t texture_size_full(const SceGxmTexture &texture) {
break;
default:
break;
};
}
uint32_t max_possible_mip = std::bit_width(std::min(width, height));
if (type == SCE_GXM_TEXTURE_TILED) {
@@ -358,9 +358,9 @@ uint32_t texture_size_full(const SceGxmTexture &texture) {
const bool twok_align_cond2 = width >= 16 && height >= 16 && (bpp == 16 || bpp == 32);
const bool twok_align_cond3 = width >= 8 && height >= 8 && bpp == 64;
// if one of these conditions is true, alignement between faces is 2K
const uint32_t face_alignement = (twok_align_cond1 || twok_align_cond2 || twok_align_cond3) ? 2048 : 4;
const uint32_t face_full_size = align(texture_size, face_alignement);
// if one of these conditions is true, alignment between faces is 2K
const uint32_t face_alignment = (twok_align_cond1 || twok_align_cond2 || twok_align_cond3) ? 2048 : 4;
const uint32_t face_full_size = align(texture_size, face_alignment);
// don't take into account what is after the end of the last texture
texture_size = 5 * face_full_size + texture_size;
@@ -414,7 +414,7 @@ uint32_t texture_size_first_mip(const SceGxmTexture &texture) {
break;
default:
break;
};
}
auto [block_width, block_height] = get_block_size(format);
width = align(width, block_width);
@@ -39,7 +39,7 @@ namespace filesystem {
*/
enum Result {
/**
* @brief An error has ocurred
* @brief An error has occurred
*/
ERROR,
+5 -5
View File
@@ -62,7 +62,7 @@ std::string format_file_filter_extension_list(const std::vector<std::string> &fi
}
return formatted_string;
};
}
namespace host {
namespace dialog {
@@ -116,7 +116,7 @@ Result open_file(std::filesystem::path &resulting_path, const std::vector<FileFi
// File filter names can be used as they are, but the pointers of the
// file extension lists have to point to the formatted strings
file_filters_converted.push_back({ file_filter.display_name.c_str(), file_extensions_converted.at(file_extensions_converted.size() - 1).c_str() });
};
}
/* --- Then nativefiledialog can be called --- */
@@ -153,7 +153,7 @@ Result open_file(std::filesystem::path &resulting_path, const std::vector<FileFi
default:
return Result::ERROR;
}
};
}
Result pick_folder(std::filesystem::path &resulting_path, const std::filesystem::path &default_path) {
// Initialize NFD
@@ -196,7 +196,7 @@ Result pick_folder(std::filesystem::path &resulting_path, const std::filesystem:
default:
return Result::ERROR;
}
};
}
std::string get_error() {
std::string error = "";
@@ -205,7 +205,7 @@ std::string get_error() {
error.assign(NFD::GetError());
return error;
};
}
} // namespace filesystem
} // namespace dialog
+2 -2
View File
@@ -55,7 +55,7 @@ enum SceHttpStatusCode {
SCE_HTTP_STATUS_CODE_SWITCHING_PROTOCOLS = 101,
SCE_HTTP_STATUS_CODE_PROCESSING = 102,
SCE_HTTP_STATUS_CODE_EARLY_HINTS = 103,
// 2xx Sucessful
// 2xx Successful
SCE_HTTP_STATUS_CODE_OK = 200,
SCE_HTTP_STATUS_CODE_CREATED = 201,
SCE_HTTP_STATUS_CODE_ACCEPTED = 202,
@@ -184,7 +184,7 @@ enum SceHttpErrorCode : uint32_t {
SCE_HTTP_ERROR_BEFORE_SEND = 0x80431065,
SCE_HTTP_ERROR_AFTER_SEND = 0x80431066,
SCE_HTTP_ERROR_TIMEOUT = 0x80431068,
SCE_HTTP_ERROR_UNKOWN_AUTH_TYPE = 0x80431069,
SCE_HTTP_ERROR_UNKNOWN_AUTH_TYPE = 0x80431069,
SCE_HTTP_ERROR_UNKNOWN_METHOD = 0x8043106B,
SCE_HTTP_ERROR_READ_BY_HEAD_METHOD = 0x8043106F,
SCE_HTTP_ERROR_NOT_IN_COM = 0x80431070,
-1
View File
@@ -26,7 +26,6 @@
#include <display/state.h>
#include <gui/functions.h>
#include <gxm/state.h>
#include <io/device.h>
#include <io/functions.h>
#include <io/vfs.h>
#include <kernel/state.h>
+1 -1
View File
@@ -28,7 +28,7 @@ struct CPUProtocol : public CPUProtocolBase {
~CPUProtocol() override = default;
void call_svc(CPUState &cpu, uint32_t svc, Address pc, ThreadState &thread) override;
Address get_watch_memory_addr(Address addr) override;
ExclusiveMonitorPtr get_exlusive_monitor() override;
ExclusiveMonitorPtr get_exclusive_monitor() override;
private:
CallImportFunc call_import;
+1 -1
View File
@@ -69,7 +69,7 @@ struct Debugger {
void remove_watch_memory_addr(KernelState &state, Address addr);
void add_breakpoint(MemState &mem, uint32_t addr, bool thumb_mode);
void remove_breakpoint(MemState &mem, uint32_t addr);
void add_trampoile(MemState &mem, uint32_t addr, bool thumb_mode, const TrampolineCallback &callback);
void add_trampoline(MemState &mem, uint32_t addr, bool thumb_mode, const TrampolineCallback &callback);
Trampoline *get_trampoline(Address addr);
void remove_trampoline(MemState &mem, uint32_t addr);
Address get_watch_memory_addr(Address addr);
+1 -1
View File
@@ -17,7 +17,7 @@
#pragma once
#include <mem/ptr.h>
#include <mem/util.h>
#include <map>
+1 -1
View File
@@ -61,6 +61,6 @@ Address CPUProtocol::get_watch_memory_addr(Address addr) {
return kernel->debugger.get_watch_memory_addr(addr);
}
ExclusiveMonitorPtr CPUProtocol::get_exlusive_monitor() {
ExclusiveMonitorPtr CPUProtocol::get_exclusive_monitor() {
return kernel->exclusive_monitor;
}
+1 -1
View File
@@ -52,7 +52,7 @@ void Debugger::remove_breakpoint(MemState &mem, uint32_t addr) {
}
}
void Debugger::add_trampoile(MemState &mem, uint32_t addr, bool thumb_mode, const TrampolineCallback &callback) {
void Debugger::add_trampoline(MemState &mem, uint32_t addr, bool thumb_mode, const TrampolineCallback &callback) {
const auto swap_inst = [](uint32_t inst) {
return (inst << 16) | ((inst >> 16) & 0xFFFF);
};
-1
View File
@@ -30,7 +30,6 @@
#include <util/log.h>
#include <SDL_thread.h>
#include <spdlog/fmt/fmt.h>
#include <util/lock_and_find.h>
int CorenumAllocator::new_corenum() {
+1
View File
@@ -16,6 +16,7 @@
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#include <kernel/relocation.h>
#include <mem/ptr.h>
#include <util/log.h>
#include <self.h>
+2 -2
View File
@@ -625,7 +625,7 @@ struct LangState {
{ "medium", "Medium" },
{ "maximum", "Maximum" },
{ "detail", "Detail" },
{ "select_detail", "Select your preferred perfomance overlay detail." },
{ "select_detail", "Select your preferred performance overlay detail." },
{ "top_left", "Top Left" },
{ "top_center", "Top Center" },
{ "top_right", "Top Right" },
@@ -633,7 +633,7 @@ struct LangState {
{ "bottom_center", "Bottom Center" },
{ "bottom_right", "Bottom Right" },
{ "position", "Position" },
{ "select_position", "Select your preferred perfomance overlay position." },
{ "select_position", "Select your preferred performance overlay position." },
{ "case_insensitive", "Check to enable case-insensitive path finding on case sensitive filesystems.\nRESETS ON RESTART" },
{ "case_insensitive_description", "Allows emulator to attempt to search for files regardless of case\non non-Windows platforms." },
{ "emu_storage_folder", "Emulated System Storage Folder" },
+1 -1
View File
@@ -342,7 +342,7 @@ void init_lang(LangState &lang, EmuEnvState &emuenv) {
auto &lang_settings = lang.settings.language;
set_lang_string(lang.settings.language.main, language);
// Input Languague
// Input Language
const auto input_language = language.child("input_language");
if (!input_language.empty()) {
// Main
+1 -1
View File
@@ -83,7 +83,7 @@ static void run_execv(char *argv[], EmuEnvState &emuenv) {
#elif defined(__unix__) || defined(__APPLE__) && defined(__MACH__)
execv(argv[0], const_cast<char *const *>(args));
#endif
};
}
int main(int argc, char *argv[]) {
ZoneScoped; // Tracy - Track main function scope
+1 -1
View File
@@ -18,9 +18,9 @@
#pragma once
#include <mem/allocator.h>
#include <mem/functions.h>
#include <mem/util.h>
#include <array>
#include <map>
#include <mutex>
-2
View File
@@ -23,10 +23,8 @@
#include "lay_out_args.h"
#include "read_arg.h"
#include "vargs.h"
#include "write_return_value.h"
#include <config/functions.h>
#include <config/state.h>
#include <emuenv/state.h>
+2 -2
View File
@@ -89,7 +89,7 @@ constexpr std::enable_if_t<sizeof...(Args) == 0> add_args_to_layout(ArgLayout &h
// One or more arguments to add.
template <typename Head, typename... Tail>
constexpr void add_args_to_layout(ArgLayout &head, LayoutArgsState &state) {
// Returns immediately if the Head is an varargs
// Returns immediately if the Head is a varargs
if constexpr (std::is_same_v<Head, module::vargs>) {
return;
} else {
@@ -99,7 +99,7 @@ constexpr void add_args_to_layout(ArgLayout &head, LayoutArgsState &state) {
state = std::get<1>(result);
// Recursively add the remaining arguments.
// If the last argument is varargs, abadon adding
// If the last argument is varargs, abandon adding
if (sizeof...(Tail) > 0) {
add_args_to_layout<Tail...>(*(&head + 1), state);
}
@@ -15,10 +15,13 @@
// with this program; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#pragma once
#include <emuenv/state.h>
#include <kernel/types.h>
#include <array>
#include <map>
#include <vector>
static constexpr auto SYSMODULE_COUNT = 0x56;
-2
View File
@@ -17,8 +17,6 @@
#pragma once
#include <cstdint>
#include "args_layout.h"
#include "lay_out_args.h"
#include "read_arg.h"
+1 -1
View File
@@ -67,7 +67,7 @@ private:
// Gyroscope vector measurement in radians/s.
Util::Vec3f gyro;
// Vector to be substracted from gyro measurements
// Vector to be subtracted from gyro measurements
Util::Vec3f gyro_bias;
// Minimum gyro amplitude to detect if the device is moving
-1
View File
@@ -15,7 +15,6 @@
// with this program; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#include <net/functions.h>
#include <net/state.h>
bool init(NetState &state) {
-3
View File
@@ -21,10 +21,7 @@
#include <mem/ptr.h>
#include <thread>
#include <condition_variable>
#include <optional>
#include <queue>
#include <vector>
-4
View File
@@ -17,13 +17,9 @@
#pragma once
#include <array>
#include <cstdint>
#include <vector>
#include <mem/mempool.h>
#include <mem/ptr.h>
#include <ngs/common.h>
struct MemState;
+4 -4
View File
@@ -129,10 +129,10 @@ bool Atrac9Module::decode_more_data(KernelState &kern, const MemState &mem, cons
uint32_t frame_bytes_gotten = bufparam.bytes_count - state->current_byte_position_in_buffer;
if (frame_bytes_gotten < superframe_size || !temp_buffer.empty()) {
// the superframe overlaps two buffers...
uint32_t bytes_transfered = std::min<uint32_t>(frame_bytes_gotten, superframe_size - temp_buffer.size());
uint32_t bytes_transferred = std::min<uint32_t>(frame_bytes_gotten, superframe_size - temp_buffer.size());
uint32_t old_size = temp_buffer.size();
temp_buffer.resize(old_size + bytes_transfered);
memcpy(temp_buffer.data() + old_size, input, bytes_transfered);
temp_buffer.resize(old_size + bytes_transferred);
memcpy(temp_buffer.data() + old_size, input, bytes_transferred);
if (temp_buffer.size() < superframe_size) {
// continue getting data
@@ -173,7 +173,7 @@ bool Atrac9Module::decode_more_data(KernelState &kern, const MemState &mem, cons
// if the superframe is across two buffers, I don't know how to interpret the skipped samples (which are in the middle of the frame)...
if (temp_buffer.empty()) {
// remove skipped samples at the beginnning and the end of the buffer
// remove skipped samples at the beginning and the end of the buffer
// in case you have more than a superframe of samples skipped (I don't know if this can happen)
const uint32_t sample_index = (state->current_byte_position_in_buffer / superframe_size) * samples_per_superframe;
if (bufparam.samples_discard_start_off > sample_index) {
+1 -1
View File
@@ -202,7 +202,7 @@ static void decrypt_segments(std::ifstream &infile, const fs::path &outdir, cons
EVP_CIPHER_CTX_free(cipher_ctx);
EVP_CIPHER_free(cipher);
};
}
static void join_files(const fs::path &path, const std::string &filename, const fs::path &output) {
std::vector<fs::path> files;
+1 -1
View File
@@ -30,7 +30,7 @@ void init_regmgr(RegMgrState &regmgr, const fs::path &pref_path);
void get_bin_value(RegMgrState &regmgr, const std::string &category, const std::string &name, void *buf, uint32_t bufSize);
void set_bin_value(RegMgrState &regmgr, const std::string &category, const std::string &name, const void *buf, uint32_t bufSize);
// Geters and setters for int values
// Getters and setters for int values
int32_t get_int_value(RegMgrState &regmgr, const std::string &category, const std::string &name);
void set_int_value(RegMgrState &regmgr, const std::string &category, const std::string &name, const int32_t value);
+1
View File
@@ -15,6 +15,7 @@
// with this program; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#include <array>
#include <regex>
#include <regmgr/functions.h>
@@ -25,10 +25,8 @@
#include <renderer/gl/state.h>
#include <renderer/gl/types.h>
#include <map>
#include <memory>
#include <string>
#include <tuple>
struct MemState;
struct FeatureState;
@@ -25,6 +25,7 @@
#include <array>
#include <memory>
#include <unordered_map>
#include <vector>
#include <glad/gl.h>
+1 -3
View File
@@ -24,12 +24,10 @@
#include <renderer/gl/ring_buffer.h>
#include <renderer/texture_cache.h>
#include <shader/usse_program_analyzer.h>
#include <shader/uniform_block.h>
#include <map>
#include <memory>
#include <set>
#include <tuple>
#include <vector>
typedef void *SDL_GLContext;
@@ -25,6 +25,7 @@
#include <gxm/types.h>
#include <array>
#include <condition_variable>
#include <memory>
#include <mutex>
@@ -100,7 +100,7 @@ public:
bool use_sampler_cache = false;
int anisotropic_filtering = 1;
// used to quicky get the info from a hash of a gxm_texture
// used to quickly get the info from a hash of a gxm_texture
unordered_map_fast<TextureGxmDataRepr, TextureCacheInfo *> texture_lookup;
lru::Queue<TextureCacheInfo> texture_queue;
+1 -1
View File
@@ -90,7 +90,7 @@ struct GXMStreamInfo {
size_t size = 0;
};
// We seperate the following two parts of the stencil state because the first is part of the pipeline creation
// We separate the following two parts of the stencil state because the first is part of the pipeline creation
// while the second is dynamic
struct GxmStencilStateOp {
SceGxmStencilFunc func = SCE_GXM_STENCIL_FUNC_ALWAYS;
@@ -25,8 +25,6 @@
#include <gxm/types.h>
#include <util/log.h>
namespace renderer::vulkan {
vk::Format translate_attribute_format(SceGxmAttributeFormat format, unsigned int component_count, bool is_integer, bool is_signed);
@@ -19,8 +19,7 @@
#include <renderer/texture_cache.h>
#include <renderer/types.h>
#include <threads/queue.h>
#include <shader/uniform_block.h>
#include <vkutil/objects.h>
struct MemState;
+1 -1
View File
@@ -175,7 +175,7 @@ bool create(SDL_Window *window, std::unique_ptr<State> &state, const Config &con
auto &gl_state = dynamic_cast<GLState &>(*state);
// Recursively create GL version until one accepts
// Major 4 is mandantory
// Major 4 is mandatory
// We use glBufferStorage which needs OpenGL 4.4
constexpr std::array accept_gl_minor_versions = {
6, // OpenGL 4.6
+2 -2
View File
@@ -112,7 +112,7 @@ GLuint GLSurfaceCache::retrieve_color_surface_texture_handle(const State &state,
// There are four situations I think of:
// 1. Different base address, lookup for write, in this case, if the cached surface range contains the given address, then
// probably this cached surface has already been freed GPU-wise. So erase.
// 2. Same base address, but width and height change to be larger, or format change if write. Remake a new one for both read and write sitatation.
// 2. Same base address, but width and height change to be larger, or format change if write. Remake a new one for both read and write situation.
// 3. Out of cache range. In write case, create a new one, in read case, lul
// 4. Read situation with smaller width and height, probably need to extract the needed region out.
const bool addr_in_range_of_cache = ((key + total_surface_size) <= (ite->first + info.total_bytes));
@@ -449,7 +449,7 @@ GLuint GLSurfaceCache::retrieve_color_surface_texture_handle(const State &state,
}
if (color_surface_textures.contains(key)) {
LOG_WARN_ONCE("Two different surfaces have the same base adress, this is not handled, an openGL error will happen.");
LOG_WARN_ONCE("Two different surfaces have the same base address, this is not handled, an openGL error will happen.");
}
color_surface_textures.emplace(key, std::move(info_added));
-1
View File
@@ -23,7 +23,6 @@
#include <renderer/gl/types.h>
#include <gxm/functions.h>
#include <mem/ptr.h>
namespace renderer::gl {
+3 -3
View File
@@ -218,18 +218,18 @@ COMMAND(handle_draw) {
TRACY_FUNC_COMMANDS(handle_draw);
SceGxmPrimitiveType type = helper.pop<SceGxmPrimitiveType>();
SceGxmIndexFormat format = helper.pop<SceGxmIndexFormat>();
Ptr<const void> indicies = helper.pop<Ptr<const void>>();
Ptr<const void> indices = helper.pop<Ptr<const void>>();
const std::uint32_t count = helper.pop<const std::uint32_t>();
const std::uint32_t instance_count = helper.pop<const std::uint32_t>();
switch (renderer.current_backend) {
case Backend::OpenGL:
gl::draw(dynamic_cast<gl::GLState &>(renderer), *reinterpret_cast<gl::GLContext *>(render_context),
features, type, format, indicies.cast<void>().get(mem), count, instance_count, mem, config);
features, type, format, indices.cast<void>().get(mem), count, instance_count, mem, config);
break;
case Backend::Vulkan:
vulkan::draw(*reinterpret_cast<vulkan::VKContext *>(render_context), type, format, indicies.cast<void>(),
vulkan::draw(*reinterpret_cast<vulkan::VKContext *>(render_context), type, format, indices.cast<void>(),
count, instance_count, mem, config);
break;
+1 -1
View File
@@ -19,6 +19,7 @@
#include "renderer/texture_cache.h"
#include "gxm/functions.h"
#include "util/align.h"
#include "util/float_to_half.h"
#include "util/log.h"
@@ -809,7 +810,6 @@ static ddspp::DXGIFormat gxm_to_dxgi(const SceGxmTextureBaseFormat format) {
return R32G32_FLOAT;
case SCE_GXM_TEXTURE_BASE_FORMAT_U32U32:
return R32G32_UINT;
;
case SCE_GXM_TEXTURE_BASE_FORMAT_UBC1:
return BC1_UNORM;
case SCE_GXM_TEXTURE_BASE_FORMAT_UBC2:
-1
View File
@@ -25,7 +25,6 @@
#include <util/log.h>
#include <util/tracy.h>
#include <renderer/vulkan/functions.h>
#include <renderer/vulkan/state.h>
// keywords.h must be after tracy.h for msvc compiler
+1 -2
View File
@@ -24,7 +24,6 @@
#include <gxm/types.h>
#include <util/log.h>
#include <vkutil/vkutil.h>
namespace renderer::vulkan {
@@ -41,7 +40,7 @@ VKContext::VKContext(VKState &state, MemState &mem)
memset(&prev_vert_ublock, 0, sizeof(shader::RenderVertUniformBlock));
memset(&prev_frag_ublock, 0, sizeof(shader::RenderFragUniformBlock));
// specify the alignement
// specify the alignment
// for the index buffer, we only have 16 or 32bit types
index_stream_ring_buffer.alignment = sizeof(uint32_t);
// for the vertex buffer, nothing should need more alignment than a vec4
@@ -18,6 +18,7 @@
#include <renderer/vulkan/gxm_to_vulkan.h>
#include <gxm/functions.h>
#include <util/log.h>
namespace renderer::vulkan {
+4 -4
View File
@@ -169,7 +169,7 @@ SurfaceRetrieveResult VKSurfaceCache::retrieve_color_surface_for_framebuffer(Mem
// There are four situations I think of:
// 1. Different base address, lookup for write, in this case, if the cached surface range contains the given address, then
// probably this cached surface has already been freed GPU-wise. So erase.
// 2. Same base address, but width and height change to be larger, or format change if write. Remake a new one for both read and write sitatation.
// 2. Same base address, but width and height change to be larger, or format change if write. Remake a new one for both read and write situation.
// 3. Out of cache range. In write case, create a new one, in read case, lul
// 4. Read situation with smaller width and height, probably need to extract the needed region out.
// 5. the surface is a gbuffer and we are currently trying to read the 2nd component, in this case key == ite->first + 4
@@ -280,7 +280,7 @@ SurfaceRetrieveResult VKSurfaceCache::retrieve_color_surface_for_framebuffer(Mem
// we only support surface sync of linear surfaces for now
if (!can_mprotect_mapped_memory) {
// peform surface sync on everything
// perform surface sync on everything
// it is slow but well... we can't mprotect the buffer
*info_added.need_surface_sync = color->surfaceType == SCE_GXM_COLOR_SURFACE_LINEAR;
} else if (color->surfaceType == SCE_GXM_COLOR_SURFACE_LINEAR && format_support_surface_sync(base_format)) {
@@ -1133,7 +1133,7 @@ ColorSurfaceCacheInfo *VKSurfaceCache::perform_surface_sync() {
}
if (state.res_multiplier != 1.0f) {
// scale bacl the image using a blit command first
// scale back the image using a blit command first
if (!last_written_surface->blit_image)
last_written_surface->blit_image = std::make_unique<vkutil::Image>();
@@ -1406,4 +1406,4 @@ std::vector<uint32_t> VKSurfaceCache::dump_frame(Ptr<const void> address, uint32
return frame;
}
}; // namespace renderer::vulkan
} // namespace renderer::vulkan
-8
View File
@@ -27,11 +27,3 @@ if(TRACY_ENABLE_ON_CORE_COMPONENTS)
target_link_libraries(shader PRIVATE tracy)
endif()
add_executable(
shader-tests
tests/usse_program_analyzer_test.cpp
)
target_include_directories(shader-tests PRIVATE include)
target_link_libraries(shader-tests PRIVATE googletest shader util)
add_test(NAME shader COMMAND shader-tests)
@@ -18,7 +18,6 @@
#pragma once
#include <gxm/types.h>
#include <shader/uniform_block.h>
#include <shader/usse_translator_types.h>
#include <shader/usse_types.h>
@@ -430,4 +430,4 @@ static const float f16_constant_table_bank3[] = {
0.0f,
0.0f
};
}; // namespace shader::usse
} // namespace shader::usse
@@ -22,9 +22,7 @@
#include <functional>
#include <map>
#include <memory>
#include <queue>
#include <shader/usse_types.h>
#include <tuple>
#include <vector>
using UniformBufferSizes = std::array<std::uint32_t, 15>;
@@ -26,7 +26,6 @@
#include <SPIRV/SpvBuilder.h>
#include <array>
#include <map>
struct FeatureState;
@@ -20,7 +20,6 @@
#include <shader/usse_types.h>
#include <map>
#include <unordered_map>
#include <vector>
namespace spv {
@@ -91,7 +90,7 @@ struct SpirvShaderParameters {
int viewport_ratio_id;
int viewport_offset_id;
// when using a thread, texture or litteral buffer, if not -1, this fields contain the sa register
// when using a thread, texture or literal buffer, if not -1, this fields contain the sa register
// with the matching address, this assumes of course that this address is not copied somewhere
// else and that this register is not overwritten
// the base field is the offset to be applied when reading this buffer (almost always -4)
@@ -35,7 +35,7 @@ struct SpirvUtilFunctions {
spv::Function *fetch_memory{ nullptr };
spv::Function *unpack_fx10{ nullptr };
// buffer_addres_vec[i][1] contains the buffer pointer with an array of vec_i and stride 16 bytes
// buffer_address_vec[i][1] contains the buffer pointer with an array of vec_i and stride 16 bytes
// 0 in the last index is for the read buffer, 1 is for the write buffer
// this is technically not a function but is the best place to put it
// buffer_address_vec[0] is for a packed float[] array
+2 -1
View File
@@ -17,6 +17,7 @@
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#include <shader/spirv_recompiler.h>
#include <shader/uniform_block.h>
#include <shader/usse_disasm.h>
#include <shader/usse_program_analyzer.h>
#include <shader/usse_utilities.h>
@@ -437,7 +438,7 @@ static void create_fragment_inputs(spv::Builder &b, SpirvShaderParameters &param
const auto num_comp = ((descriptor->attribute_info >> 22) & 3) + 1;
// Force this to 4. TODO: Don't
// Reason is for compability between vertex and fragment. This is like an anti-crash when linking.
// Reason is for compatibility between vertex and fragment. This is like an anti-crash when linking.
// Fragment will only copy what it needed.
const auto pa_iter_type = b.makeVectorType(b.makeFloatType(32), 4);
const auto pa_iter_size = num_comp;
+3 -3
View File
@@ -131,7 +131,7 @@ bool USSETranslatorVisitor::vmad(
set_repeat_multiplier(2, 2, 2, 4);
// Write mask is a 4-bit immidiate
// Write mask is a 4-bit immediate
// If a bit is one, a swizzle is active
BEGIN_REPEAT(repeat_count)
GET_REPEAT(inst, repeat_mode);
@@ -195,7 +195,7 @@ bool USSETranslatorVisitor::vmad2(
const DataType inst_dt = (dat_fmt) ? DataType::F16 : DataType::F32;
// Decode mandantory info first
// Decode mandatory info first
inst.opr.dest = decode_dest(inst.opr.dest, dest_n, dest_bank, false, true, 7, m_second_program);
inst.opr.src0 = decode_src0(inst.opr.src0, src0_n, src0_bank, false, true, 7, m_second_program);
inst.opr.src1 = decode_src12(inst.opr.src1, src1_n, src1_bank, src1_bank_ext, true, 7, m_second_program);
@@ -1675,7 +1675,7 @@ bool USSETranslatorVisitor::vdual(
};
// Each instruction might have a different source layout or write mask depending on how the instruction works.
// Let's store insturction information in a map so it's easy for each instruction to be loaded.
// Let's store instruction information in a map so it's easy for each instruction to be loaded.
struct DualOpInfo {
uint8_t src_count;
bool vector_load;
+1 -1
View File
@@ -208,7 +208,7 @@ inline bool is_sub_opcode(Opcode test_op) {
spv::Id USSETranslatorVisitor::vtst_impl(Instruction inst, ExtPredicate pred, int zero_test, int sign_test, Imm4 load_mask, bool mask) {
// Usually we would expect this to have a compare behavior
// Comparision is done by subtracting the first src by the second src, and compare the result value.
// Comparison is done by subtracting the first src by the second src, and compare the result value.
// We currently optimize for that case first
const DataType load_data_type = inst.opr.src1.type;
const DataType store_data_type = inst.opr.dest.type;
+1 -1
View File
@@ -337,7 +337,7 @@ bool USSETranslatorVisitor::i8mad(
}
bool USSETranslatorVisitor::i8mad2() {
LOG_DISASM("Unimplmenet Opcode: i8mad2");
LOG_DISASM("Unimplemented Opcode: i8mad2");
return true;
}
-2
View File
@@ -16,8 +16,6 @@
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#include <shader/usse_translator.h>
#include <shader/usse_types.h>
#include <util/log.h>
bool shader::usse::USSETranslatorVisitor::illegal22() {
+1 -1
View File
@@ -57,7 +57,7 @@ static spv::Id get_uv_coeffs(spv::Builder &b, const spv::Id std_builtins, spv::I
// un-normalize the coordinates
coords = b.createBinOp(spv::OpFMul, v2f32, coords, image_size);
// substract 0.5 to each coord
// subtract 0.5 to each coord
const spv::Id half = b.makeFloatConstant(0.5f);
const spv::Id v2half = b.makeCompositeConstant(v2f32, { half, half });
coords = b.createBinOp(spv::OpFSub, v2f32, coords, v2half);
+1 -1
View File
@@ -30,7 +30,7 @@ namespace shader::usse {
* \brief Changes TEMP registers to FPINTERNAL if certain conditions are met
*/
static void check_reg_internal(Operand &inout_reg, bool is_double_regs, uint8_t reg_bits) {
// TODO: Check top bit if neccessary! Sometimes it may contains type info.
// TODO: Check top bit if necessary! Sometimes it may contains type info.
const auto temps = is_double_regs ? 8 : 4;
const auto max_reg_num = 1 << reg_bits;
const auto temp_reg_limit = max_reg_num - temps;
+3 -3
View File
@@ -19,10 +19,10 @@
#include <gxm/types.h>
#include <shader/gxp_parser.h>
#include <shader/usse_program_analyzer.h>
#include <shader/usse_types.h>
#include <cassert>
#include <shader/usse_types.h>
#include <queue>
namespace shader::usse {
bool is_kill(const std::uint64_t inst) {
@@ -537,7 +537,7 @@ void analyze(USSEBlockNode &root, USSEOffset end_offset, const AnalyzeReadFuncti
// Either if the instruction has different predicate with the block,
// or the predicate value is being invalidated (overwritten)
// which means continuing is obselete. Stop now
// which means continuing is obsolete. Stop now
if (pred != current_code->condition) {
current_code->size = baddr - current_code->offset;
offset_end = baddr;
+1 -1
View File
@@ -1073,7 +1073,7 @@ spv::Id load(spv::Builder &b, const SpirvShaderParameters &params, SpirvUtilFunc
}
}
// For non-F32 and non-I32 type, we need to make a destination mask to extract neccessary F32 components out
// For non-F32 and non-I32 type, we need to make a destination mask to extract necessary F32 components out
// For example: sa6.xz with DataType = f16
// Would result at least sa6 and sa7 to be extracted out, since sa6 contains f16 x and y, sa7 contains f16 z and w
Imm4 extract_mask = dest_mask;
@@ -1,26 +0,0 @@
// Vita3K emulator project
// Copyright (C) 2024 Vita3K team
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this program; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#include <gtest/gtest.h>
#include <shader/usse_program_analyzer.h>
#include <unordered_map>
using namespace shader;
TEST(program_analyzer, simple_branching) {
}
+2 -2
View File
@@ -15,10 +15,10 @@
// with this program; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#include <cstdint>
#pragma once
#include <cstdint>
#define INSTRUCTION_UNKNOWN 0 ///< Unknown/unsupported instruction
#define INSTRUCTION_MOVW 1 ///< MOVW Rd, \#imm instruction
#define INSTRUCTION_MOVT 2 ///< MOVT Rd, \#imm instruction
+1 -3
View File
@@ -1,10 +1,8 @@
#pragma once
#include <algorithm>
#include <atomic>
#include <memory>
#include <cassert>
#include <memory>
// Ring buffer for bytes - not multi-thread safe, bring your own locks
class ByteRingBuffer {
-1
View File
@@ -18,7 +18,6 @@
#pragma once
#include <cstdint>
#include <vector>
template <typename T>
T byte_swap(T val);
+1 -1
View File
@@ -17,7 +17,7 @@
#pragma once
#include <stdint.h>
#include <cstdint>
namespace util {
static inline void cpuid(int output[4], int functionnumber, int ecxleaf = 0);
+2 -4
View File
@@ -1,13 +1,11 @@
#pragma once
#include <boost/algorithm/string/compare.hpp>
#include <condition_variable>
#include <http/state.h>
#include <util/log.h>
#include <map>
#include <condition_variable>
#include <cstdint>
#include <regex>
#include <stdint.h>
namespace net_utils {
+1 -1
View File
@@ -47,7 +47,7 @@ public:
// borrow returns PoolItem instance wrapping one of available resources in the pool
// if there's no available resource, the thread will wait until resources are returned to the pool
// if PoolItem instance is destroyed, the corresponding resource is considerd to be returned to the pool
// if PoolItem instance is destroyed, the corresponding resource is considered to be returned to the pool
PoolItem<T> borrow();
private:
-4
View File
@@ -17,11 +17,7 @@
#pragma once
#include <algorithm>
#include <codecvt>
#include <cstdint>
#include <locale>
#include <sstream>
#include <string>
#include <vector>
+2 -2
View File
@@ -379,7 +379,7 @@ std::string get_web_regex_result(const std::string &url, const std::regex &regex
uint64_t get_current_time_ms() {
return std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::high_resolution_clock::now().time_since_epoch()).count();
};
}
static size_t write_data(void *ptr, size_t size, size_t nmemb, void *stream) {
size_t written = fwrite(ptr, size, nmemb, (FILE *)stream);
@@ -418,7 +418,7 @@ bool download_file(const std::string &url, const std::string &output_file_path,
});
if (!callback_result->download) {
return 1; // Returning anything thats not 0 aborts the request
return 1; // Returning anything that's not 0 aborts the request
}
return 0;
};
+5
View File
@@ -19,6 +19,11 @@
#include <util/log.h>
#include <algorithm>
#include <codecvt>
#include <locale>
#include <sstream>
namespace string_utils {
std::vector<std::string> split_string(const std::string &str, char delimiter) {
+1 -1
View File
@@ -15,6 +15,7 @@
// with this program; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#ifdef TRACY_ENABLE
#include <util/log.h>
#include <util/vector_utils.h>
@@ -22,7 +23,6 @@
#include <bitset>
#include <vector>
#ifdef TRACY_ENABLE
#include <util/tracy_module_utils.h>
namespace tracy_module_utils {
+1 -1
View File
@@ -177,4 +177,4 @@ public:
void destroy_objects();
};
}; // namespace vkutil
} // namespace vkutil