mirror of
https://github.com/Vita3K/Vita3K-Android.git
synced 2024-11-27 15:30:43 +00:00
Fix compiler warnings
This commit is contained in:
parent
e4c166ec70
commit
8edd333400
@ -262,9 +262,6 @@ bool PCMDecoderState::send(const uint8_t *data, uint32_t size) {
|
||||
}
|
||||
|
||||
// Try to resample if neccessary
|
||||
const int source_channel_type = (source_channels == 2) ? AV_CH_LAYOUT_STEREO : AV_CH_LAYOUT_MONO;
|
||||
const int dest_channel_type = AV_CH_LAYOUT_STEREO;
|
||||
|
||||
SwrContext *swr = (source_channels == 2) ? swr_stereo : swr_mono_to_stereo;
|
||||
|
||||
const int dest_count = swr_get_out_samples(swr, produced_samples);
|
||||
@ -296,9 +293,9 @@ bool PCMDecoderState::receive(uint8_t *data, DecoderSize *size) {
|
||||
|
||||
PCMDecoderState::PCMDecoderState(const float dest_frequency)
|
||||
: dest_frequency(dest_frequency)
|
||||
, he_adpcm(false)
|
||||
, source_channels(2)
|
||||
, source_frequency(48000.0f) {
|
||||
, source_frequency(48000.0f)
|
||||
, he_adpcm(false) {
|
||||
// we are not resampling, we don't care about the sample rate
|
||||
swr_mono_to_stereo = swr_alloc_set_opts(nullptr,
|
||||
AV_CH_LAYOUT_STEREO, AV_SAMPLE_FMT_FLT, 48000,
|
||||
|
@ -297,7 +297,7 @@ bool is_tracy_advanced_profiling_active_for_module(std::vector<std::string> &act
|
||||
}
|
||||
|
||||
// If index is being requested and the module name was found
|
||||
if ((index != nullptr) && (result)) {
|
||||
if (result) {
|
||||
// Calculate the distance between the first element in the module and
|
||||
*index = std::distance(active_modules.begin(), iterator);
|
||||
}
|
||||
|
@ -42,8 +42,6 @@ class DynarmicCPU : public CPUInterface {
|
||||
std::shared_ptr<ArmDynarmicCP15> cp15;
|
||||
Dynarmic::ExclusiveMonitor *monitor;
|
||||
|
||||
Address tpidruro;
|
||||
|
||||
std::size_t core_id = 0;
|
||||
|
||||
bool exit_request = false;
|
||||
|
@ -299,13 +299,13 @@ std::unique_ptr<Dynarmic::A32::Jit> DynarmicCPU::make_jit() {
|
||||
}
|
||||
|
||||
DynarmicCPU::DynarmicCPU(CPUState *state, std::size_t processor_id, Dynarmic::ExclusiveMonitor *monitor, bool cpu_opt)
|
||||
: parent(state)
|
||||
, fallback(state)
|
||||
: fallback(state)
|
||||
, parent(state)
|
||||
, cb(std::make_unique<ArmDynarmicCallback>(*state, *this))
|
||||
, cp15(std::make_shared<ArmDynarmicCP15>())
|
||||
, monitor(monitor)
|
||||
, cpu_opt(cpu_opt)
|
||||
, core_id(processor_id) {
|
||||
, core_id(processor_id)
|
||||
, cpu_opt(cpu_opt) {
|
||||
jit = make_jit();
|
||||
}
|
||||
|
||||
|
@ -67,7 +67,6 @@ void UnicornCPU::read_hook(uc_engine *uc, uc_mem_type type, uint64_t address, in
|
||||
|
||||
void UnicornCPU::write_hook(uc_engine *uc, uc_mem_type type, uint64_t address, int size, int64_t value, void *user_data) {
|
||||
UnicornCPU &state = *static_cast<UnicornCPU *>(user_data);
|
||||
MemState &mem = *state.parent->mem;
|
||||
auto start = state.parent->protocol->get_watch_memory_addr(address);
|
||||
if (start) {
|
||||
MemState &mem = *state.parent->mem;
|
||||
|
@ -82,4 +82,4 @@ EmuEnvState::EmuEnvState()
|
||||
}
|
||||
|
||||
// this is necessary to forward declare unique_ptrs (so that they can call the appropriate destructor)
|
||||
EmuEnvState::~EmuEnvState() {}
|
||||
EmuEnvState::~EmuEnvState() = default;
|
||||
|
@ -456,7 +456,7 @@ static std::string cmd_continue(EmuEnvState &state, PacketCommand &command) {
|
||||
// resume the worlld
|
||||
{
|
||||
auto lock = std::unique_lock(state.kernel.mutex);
|
||||
for (const auto pair : state.kernel.threads) {
|
||||
for (const auto &pair : state.kernel.threads) {
|
||||
auto &thread = pair.second;
|
||||
if (thread->status == ThreadStatus::suspend) {
|
||||
lock.unlock();
|
||||
@ -474,7 +474,7 @@ static std::string cmd_continue(EmuEnvState &state, PacketCommand &command) {
|
||||
|
||||
if (state.gdb.server_die)
|
||||
return "";
|
||||
for (const auto [id, thread] : state.kernel.threads) {
|
||||
for (const auto &[id, thread] : state.kernel.threads) {
|
||||
const auto thread_guard = std::lock_guard(thread->mutex);
|
||||
if (thread->status == ThreadStatus::suspend && hit_breakpoint(*thread->cpu)) {
|
||||
state.gdb.inferior_thread = id;
|
||||
@ -496,7 +496,7 @@ static std::string cmd_continue(EmuEnvState &state, PacketCommand &command) {
|
||||
// stop the world
|
||||
{
|
||||
auto lock = std::unique_lock(state.kernel.mutex);
|
||||
for (const auto pair : state.kernel.threads) {
|
||||
for (const auto &pair : state.kernel.threads) {
|
||||
auto thread = pair.second;
|
||||
if (thread->status == ThreadStatus::run) {
|
||||
thread->suspend();
|
||||
|
@ -251,7 +251,7 @@ inline ConfigModuleMode init_modules_mode() {
|
||||
|
||||
const ConfigModuleMode config_modules_mode = init_modules_mode();
|
||||
|
||||
const std::vector<std::pair<SceSystemParamLang, std::string>> LIST_SYS_LANG = {
|
||||
inline const std::vector<std::pair<SceSystemParamLang, std::string>> LIST_SYS_LANG = {
|
||||
{ SCE_SYSTEM_PARAM_LANG_DANISH, "Dansk" },
|
||||
{ SCE_SYSTEM_PARAM_LANG_GERMAN, "Deutsch" },
|
||||
{ SCE_SYSTEM_PARAM_LANG_ENGLISH_GB, "English (United Kingdom)" },
|
||||
|
@ -48,7 +48,7 @@ void draw_allocations_dialog(GuiState &gui, EmuEnvState &emuenv) {
|
||||
continue;
|
||||
|
||||
if (ImGui::TreeNode(fmt::format("{}: {}", generation_num, generation_name).c_str())) {
|
||||
ImGui::Text("Range %08lx - %08lx.", generation_num * KiB(4), (generation_num + page.size) * KiB(4));
|
||||
ImGui::Text("Range %08llx - %08llx.", generation_num * KiB(4), (generation_num + page.size) * KiB(4));
|
||||
ImGui::Text("Size: %i KiB (%i page[s])", page.size * 4, page.size);
|
||||
if (ImGui::Selectable("View/Edit")) {
|
||||
gui.memory_editor_start = generation_num * KiB(4);
|
||||
|
@ -261,7 +261,7 @@ void draw_archive_install_dialog(GuiState &gui, EmuEnvState &emuenv) {
|
||||
fs::remove(archive.first);
|
||||
}
|
||||
if (delete_archive_file && !invalid_archives.empty()) {
|
||||
for (const auto archive : invalid_archives)
|
||||
for (const auto &archive : invalid_archives)
|
||||
fs::remove(archive);
|
||||
}
|
||||
archive_path = "";
|
||||
|
@ -25,7 +25,7 @@ namespace gui {
|
||||
|
||||
static std::vector<std::string> points = { ".", "..", "..." };
|
||||
static int pos = 2;
|
||||
static uint64_t time = std::time(nullptr);
|
||||
static auto time = std::time(nullptr);
|
||||
void draw_pre_compiling_shaders_progress(GuiState &gui, EmuEnvState &emuenv, const uint32_t &total) {
|
||||
const auto display_size = ImGui::GetIO().DisplaySize;
|
||||
const auto RES_SCALE = ImVec2(display_size.x / emuenv.res_width_dpi_scale, display_size.y / emuenv.res_height_dpi_scale);
|
||||
@ -89,7 +89,7 @@ void draw_shaders_count_compiled(GuiState &gui, EmuEnvState &emuenv) {
|
||||
ImGui::SetNextWindowPos(ImVec2(emuenv.viewport_pos.x + (2.f * emuenv.dpi_scale), emuenv.viewport_pos.y + emuenv.viewport_size.y - (42.f * emuenv.dpi_scale)));
|
||||
ImGui::SetNextWindowBgAlpha(0.6f);
|
||||
ImGui::Begin("##shaders_compiled", nullptr, ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_AlwaysAutoResize);
|
||||
ImGui::Text("%lu %s", gui.shaders_compiled_display[Count], gui.lang.compile_shaders["shaders_compiled"].c_str());
|
||||
ImGui::Text("%llu %s", gui.shaders_compiled_display[Count], gui.lang.compile_shaders["shaders_compiled"].c_str());
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
|
@ -206,8 +206,6 @@ static void get_content_info(GuiState &gui, EmuEnvState &emuenv) {
|
||||
for (const auto &addcont : fs::directory_iterator(ADDCONT_PATH)) {
|
||||
const auto content_id = addcont.path().stem().string();
|
||||
|
||||
tm updated_tm = {};
|
||||
|
||||
const auto last_writen = fs::last_write_time(addcont);
|
||||
SAFE_LOCALTIME(&last_writen, &addcont_info[content_id].date);
|
||||
|
||||
@ -502,7 +500,6 @@ void draw_content_manager(GuiState &gui, EmuEnvState &emuenv) {
|
||||
} else if (menu == "info") {
|
||||
// Information
|
||||
auto info = gui.lang.app_context;
|
||||
const auto app_index = get_app_index(gui, app_selected);
|
||||
ImGui::SetWindowFontScale(1.f);
|
||||
ImGui::TextColored(GUI_COLOR_TEXT, "%s", info["trophy_earning"].c_str());
|
||||
ImGui::SameLine(310.f * SCALE.x);
|
||||
|
@ -40,7 +40,6 @@ static void evaluate_code(GuiState &gui, EmuEnvState &emuenv, uint32_t from, uin
|
||||
for (std::uint32_t a = 0; a < count && size != 0; a++) {
|
||||
// Apparently some THUMB instructions are 4 bytes long, so check all 4 just to be safe.
|
||||
size_t addr_page = addr / KiB(4);
|
||||
size_t end_page = (addr + 4) / KiB(4);
|
||||
|
||||
if (addr_page == 0 || !is_valid_addr(emuenv.mem, addr_page * KiB(4))) {
|
||||
gui.disassembly.emplace_back(fmt::format("Disassembled {} instructions.", a));
|
||||
|
@ -250,7 +250,7 @@ static IconData load_app_icon(GuiState &gui, EmuEnvState &emuenv, const std::str
|
||||
return {};
|
||||
}
|
||||
|
||||
return std::move(image);
|
||||
return image;
|
||||
}
|
||||
|
||||
void init_app_icon(GuiState &gui, EmuEnvState &emuenv, const std::string app_path) {
|
||||
@ -534,7 +534,7 @@ void get_user_apps_title(GuiState &gui, EmuEnvState &emuenv) {
|
||||
|
||||
void get_sys_apps_title(GuiState &gui, EmuEnvState &emuenv) {
|
||||
gui.app_selector.sys_apps.clear();
|
||||
const std::vector<std::string> sys_apps_list = { "NPXS10003", "NPXS10008", "NPXS10015", "NPXS10026" };
|
||||
const std::array<std::string, 4> sys_apps_list = { "NPXS10003", "NPXS10008", "NPXS10015", "NPXS10026" };
|
||||
for (const auto &app : sys_apps_list) {
|
||||
vfs::FileBuffer params;
|
||||
if (vfs::read_file(VitaIoDevice::vs0, params, emuenv.pref_path, "app/" + app + "/sce_sys/param.sfo")) {
|
||||
|
@ -222,7 +222,6 @@ static void TextureUpdateDescriptorSet(ImGui_VulkanState &state, TextureState *t
|
||||
|
||||
static void CreateOrResizeBuffer(ImGui_VulkanState &state, vk::Buffer &buffer, vma::Allocation &buffer_allocation, vk::DeviceSize &p_buffer_size, size_t new_size, vk::BufferUsageFlagBits usage) {
|
||||
auto &vk_state = get_renderer(state);
|
||||
VkResult err;
|
||||
if (buffer)
|
||||
vk_state.allocator.destroyBuffer(buffer, buffer_allocation);
|
||||
|
||||
@ -241,8 +240,6 @@ static void CreateOrResizeBuffer(ImGui_VulkanState &state, vk::Buffer &buffer, v
|
||||
}
|
||||
|
||||
static void ImGui_ImplVulkan_SetupRenderState(ImGui_VulkanState &state, ImDrawData *draw_data, vk::Pipeline pipeline, vk::CommandBuffer command_buffer, ImGui_ImplVulkanH_FrameRenderBuffers *rb, int fb_width, int fb_height) {
|
||||
auto &vk_state = get_renderer(state);
|
||||
|
||||
// Bind pipeline:
|
||||
command_buffer.bindPipeline(vk::PipelineBindPoint::eGraphics, pipeline);
|
||||
|
||||
@ -280,7 +277,7 @@ static void ImGui_ImplVulkan_SetupRenderState(ImGui_VulkanState &state, ImDrawDa
|
||||
}
|
||||
}
|
||||
|
||||
constexpr vk::IndexType imgui_index_type = sizeof(ImDrawIdx) == 2 ? vk::IndexType::eUint16 : vk::IndexType::eUint32;
|
||||
// constexpr vk::IndexType imgui_index_type = sizeof(ImDrawIdx) == 2 ? vk::IndexType::eUint16 : vk::IndexType::eUint32;
|
||||
|
||||
IMGUI_API ImGui_VulkanState *ImGui_ImplSdlVulkan_Init(renderer::State *renderer, SDL_Window *window, const std::string &base_path) {
|
||||
auto *state = new ImGui_VulkanState;
|
||||
@ -449,7 +446,7 @@ IMGUI_API void ImGui_ImplSdlVulkan_RenderDrawData(ImGui_VulkanState &state) {
|
||||
}
|
||||
|
||||
state.CommandBuffer = vk_state.screen_renderer.current_cmd_buffer;
|
||||
uint32_t image_index = vk_state.screen_renderer.swapchain_image_idx;
|
||||
// uint32_t image_index = vk_state.screen_renderer.swapchain_image_idx;
|
||||
|
||||
if (vk_state.screen_renderer.need_rebuild) {
|
||||
ImGui_ImplSdlVulkan_DeletePipeline(state);
|
||||
|
@ -99,7 +99,7 @@ static bool set_notice_info(GuiState &gui, EmuEnvState &emuenv, const NoticeList
|
||||
if (info.type == "content") {
|
||||
if (info.group.find("gd") != std::string::npos) {
|
||||
content_path = fs::path("app") / info.id;
|
||||
msg = lang["app_added_home"].c_str();
|
||||
msg = lang["app_added_home"];
|
||||
} else {
|
||||
if (info.group == "ac")
|
||||
content_path = fs::path("addcont") / info.id / info.content_id;
|
||||
@ -107,7 +107,7 @@ static bool set_notice_info(GuiState &gui, EmuEnvState &emuenv, const NoticeList
|
||||
content_path = fs::path("app") / info.id;
|
||||
else if (info.group == "theme")
|
||||
content_path = fs::path("theme") / info.content_id;
|
||||
msg = lang["install_complete"].c_str();
|
||||
msg = lang["install_complete"];
|
||||
}
|
||||
vfs::FileBuffer params;
|
||||
if (vfs::read_file(VitaIoDevice::ux0, params, emuenv.pref_path, content_path / "sce_sys/param.sfo")) {
|
||||
@ -176,7 +176,7 @@ void init_notice_info(GuiState &gui, EmuEnvState &emuenv) {
|
||||
}
|
||||
|
||||
if (!notice_list.empty()) {
|
||||
for (const auto user : notice_list) {
|
||||
for (const auto &user : notice_list) {
|
||||
if ((user.first == "global") || (user.first == emuenv.io.user_id)) {
|
||||
for (const auto ¬ice : user.second) {
|
||||
if (!set_notice_info(gui, emuenv, notice)) {
|
||||
|
@ -91,7 +91,7 @@ void draw_initial_setup(GuiState &gui, EmuEnvState &emuenv) {
|
||||
ImGui::PushStyleColor(ImGuiCol_Header, SELECT_COLOR);
|
||||
ImGui::PushStyleColor(ImGuiCol_HeaderHovered, SELECT_COLOR_HOVERED);
|
||||
ImGui::PushStyleColor(ImGuiCol_HeaderActive, SELECT_COLOR_ACTIVE);
|
||||
for (const auto sys_lang : LIST_SYS_LANG) {
|
||||
for (const auto &sys_lang : LIST_SYS_LANG) {
|
||||
ImGui::PushID(sys_lang.first);
|
||||
// Empty Padding
|
||||
ImGui::NextColumn();
|
||||
|
@ -198,7 +198,6 @@ void draw_settings(GuiState &gui, EmuEnvState &emuenv) {
|
||||
const auto SCALE = ImVec2(RES_SCALE.x * emuenv.dpi_scale, RES_SCALE.y * emuenv.dpi_scale);
|
||||
|
||||
const auto BUTTON_SIZE = ImVec2(310.f * SCALE.x, 46.f * SCALE.y);
|
||||
const auto ICON_SIZE = ImVec2(100.f * SCALE.x, 100.f * SCALE.y);
|
||||
const auto INFORMATION_BAR_HEIGHT = 32.f * SCALE.y;
|
||||
const auto WINDOW_SIZE = ImVec2(display_size.x, display_size.y - INFORMATION_BAR_HEIGHT);
|
||||
const auto SIZE_PREVIEW = ImVec2(360.f * SCALE.x, 204.f * SCALE.y);
|
||||
@ -675,7 +674,6 @@ void draw_settings(GuiState &gui, EmuEnvState &emuenv) {
|
||||
ImGui::Separator();
|
||||
ImGui::PopStyleVar();
|
||||
if (!menu.empty()) {
|
||||
const auto WINDOW_TIME_SIZE = ImVec2(WINDOW_SIZE.x - 70.f * emuenv.dpi_scale, WINDOW_SIZE.y);
|
||||
const auto TIME_SELECT_SIZE = 336.f * SCALE.x;
|
||||
ImGui::SetNextWindowPos(ImVec2(WINDOW_SIZE.x - TIME_SELECT_SIZE, INFORMATION_BAR_HEIGHT), ImGuiCond_Always, ImVec2(0.f, 0.f));
|
||||
ImGui::SetNextWindowSize(ImVec2(TIME_SELECT_SIZE, WINDOW_SIZE.y), ImGuiCond_Always);
|
||||
|
@ -86,7 +86,7 @@ static ImU32 convert_hex_color(const std::string src_color) {
|
||||
std::string result = src_color.substr(src_color.length() - 6, 6);
|
||||
result.insert(0, "ff");
|
||||
|
||||
int color;
|
||||
unsigned int color;
|
||||
sscanf(result.c_str(), "%x", &color);
|
||||
return (color & 0xFF00FF00u) | ((color & 0x00FF0000u) >> 16u) | ((color & 0x000000FFu) << 16u);
|
||||
}
|
||||
@ -242,7 +242,7 @@ bool init_theme(GuiState &gui, EmuEnvState &emuenv, const std::string content_id
|
||||
|
||||
// Font Color
|
||||
if (!param.child("m_fontColor").text().empty()) {
|
||||
int color;
|
||||
unsigned int color;
|
||||
sscanf(param.child("m_fontColor").text().as_string(), "%x", &color);
|
||||
gui.theme_backgrounds_font_color.push_back(ImVec4((float((color >> 16) & 0xFF)) / 255.f, (float((color >> 8) & 0xFF)) / 255.f, (float((color >> 0) & 0xFF)) / 255.f, 1.f));
|
||||
}
|
||||
@ -336,7 +336,7 @@ bool init_theme(GuiState &gui, EmuEnvState &emuenv, const std::string content_id
|
||||
stbi_image_free(data);
|
||||
}
|
||||
|
||||
for (const auto bg : theme_bg_name) {
|
||||
for (const auto &bg : theme_bg_name) {
|
||||
int32_t width = 0;
|
||||
int32_t height = 0;
|
||||
vfs::FileBuffer buffer;
|
||||
|
@ -92,7 +92,7 @@ bool init_vita3k_update(GuiState &gui) {
|
||||
}
|
||||
|
||||
uint32_t commit_pos = 0;
|
||||
for (const auto page : page_count) {
|
||||
for (const auto &page : page_count) {
|
||||
const auto continuous_link = fmt::format(R"(https://api.github.com/repos/Vita3K/Vita3K/commits?sha=continuous&page={}&per_page={})", page.first, dif_from_current < 100 ? dif_from_current : 100);
|
||||
#ifdef WIN32
|
||||
const auto github_commit_sha_cmd = fmt::format(R"(powershell ((Invoke-RestMethod \"{}\").sha ^| Select-Object -first {}))", continuous_link, page.second);
|
||||
@ -206,7 +206,6 @@ void draw_vita3k_update(GuiState &gui, EmuEnvState &emuenv) {
|
||||
const auto SCALE = ImVec2(RES_SCALE.x * emuenv.dpi_scale, RES_SCALE.y * emuenv.dpi_scale);
|
||||
|
||||
const auto BUTTON_SIZE = ImVec2(150.f * SCALE.x, 46.f * SCALE.y);
|
||||
const auto as_update = app_number < git_version;
|
||||
const auto is_background = gui.apps_background.find("NPXS10015") != gui.apps_background.end();
|
||||
|
||||
auto common = emuenv.common_dialog.lang.common;
|
||||
@ -265,7 +264,7 @@ void draw_vita3k_update(GuiState &gui, EmuEnvState &emuenv) {
|
||||
ImGui::SetNextWindowBgAlpha(0.f);
|
||||
ImGui::BeginChild("##description_child", ImVec2(860 * SCALE.x, 334.f * SCALE.y), true, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoSavedSettings);
|
||||
ImGui::SetWindowFontScale(0.8f);
|
||||
for (const auto desc : git_commit_desc_list) {
|
||||
for (const auto &desc : git_commit_desc_list) {
|
||||
const auto pos = ImGui::GetCursorPosY();
|
||||
ImGui::Spacing();
|
||||
ImGui::TextWrapped("%s", !desc.second.empty() ? desc.second.c_str() : "Loading...");
|
||||
|
@ -77,7 +77,7 @@ enum SceGxmBlendFactor : uint8_t {
|
||||
SCE_GXM_BLEND_FACTOR_DST_ALPHA_SATURATE
|
||||
};
|
||||
|
||||
enum SceGxmStencilFunc {
|
||||
enum SceGxmStencilFunc : uint32_t {
|
||||
SCE_GXM_STENCIL_FUNC_NEVER = 0x00000000u,
|
||||
SCE_GXM_STENCIL_FUNC_LESS = 0x02000000u,
|
||||
SCE_GXM_STENCIL_FUNC_EQUAL = 0x04000000u,
|
||||
@ -88,7 +88,7 @@ enum SceGxmStencilFunc {
|
||||
SCE_GXM_STENCIL_FUNC_ALWAYS = 0x0E000000u
|
||||
};
|
||||
|
||||
enum SceGxmStencilOp {
|
||||
enum SceGxmStencilOp : uint32_t {
|
||||
SCE_GXM_STENCIL_OP_KEEP = 0x00000000u,
|
||||
SCE_GXM_STENCIL_OP_ZERO = 0x00000001u,
|
||||
SCE_GXM_STENCIL_OP_REPLACE = 0x00000002u,
|
||||
@ -99,18 +99,18 @@ enum SceGxmStencilOp {
|
||||
SCE_GXM_STENCIL_OP_DECR_WRAP = 0x00000007u
|
||||
};
|
||||
|
||||
enum SceGxmViewportMode {
|
||||
enum SceGxmViewportMode : uint32_t {
|
||||
SCE_GXM_VIEWPORT_DISABLED = 0x00010000u,
|
||||
SCE_GXM_VIEWPORT_ENABLED = 0x00000000u
|
||||
};
|
||||
|
||||
enum SceGxmCullMode {
|
||||
enum SceGxmCullMode : uint32_t {
|
||||
SCE_GXM_CULL_NONE = 0x00000000u,
|
||||
SCE_GXM_CULL_CW = 0x00000001u,
|
||||
SCE_GXM_CULL_CCW = 0x00000002u
|
||||
};
|
||||
|
||||
enum SceGxmPassType {
|
||||
enum SceGxmPassType : uint32_t {
|
||||
SCE_GXM_PASS_TYPE_OPAQUE = 0x00000000u,
|
||||
SCE_GXM_PASS_TYPE_TRANSLUCENT = 0x02000000u,
|
||||
SCE_GXM_PASS_TYPE_DISCARD = 0x04000000u,
|
||||
@ -118,19 +118,19 @@ enum SceGxmPassType {
|
||||
SCE_GXM_PASS_TYPE_DEPTH_REPLACE = 0x0A000000u
|
||||
};
|
||||
|
||||
enum SceGxmRegionClipMode {
|
||||
enum SceGxmRegionClipMode : uint32_t {
|
||||
SCE_GXM_REGION_CLIP_NONE = 0x00000000u,
|
||||
SCE_GXM_REGION_CLIP_ALL = 0x40000000u,
|
||||
SCE_GXM_REGION_CLIP_OUTSIDE = 0x80000000u,
|
||||
SCE_GXM_REGION_CLIP_INSIDE = 0xC0000000u
|
||||
};
|
||||
|
||||
enum SceGxmTwoSidedMode {
|
||||
enum SceGxmTwoSidedMode : uint32_t {
|
||||
SCE_GXM_TWO_SIDED_DISABLED = 0x00000000u,
|
||||
SCE_GXM_TWO_SIDED_ENABLED = 0x00000800u
|
||||
};
|
||||
|
||||
enum SceGxmDepthFunc {
|
||||
enum SceGxmDepthFunc : uint32_t {
|
||||
SCE_GXM_DEPTH_FUNC_NEVER = 0x00000000u,
|
||||
SCE_GXM_DEPTH_FUNC_LESS = 0x00400000u,
|
||||
SCE_GXM_DEPTH_FUNC_EQUAL = 0x00800000u,
|
||||
@ -141,12 +141,12 @@ enum SceGxmDepthFunc {
|
||||
SCE_GXM_DEPTH_FUNC_ALWAYS = 0x01C00000u
|
||||
};
|
||||
|
||||
enum SceGxmDepthWriteMode {
|
||||
enum SceGxmDepthWriteMode : uint32_t {
|
||||
SCE_GXM_DEPTH_WRITE_DISABLED = 0x00100000u,
|
||||
SCE_GXM_DEPTH_WRITE_ENABLED = 0x00000000u
|
||||
};
|
||||
|
||||
enum SceGxmPolygonMode {
|
||||
enum SceGxmPolygonMode : uint32_t {
|
||||
SCE_GXM_POLYGON_MODE_TRIANGLE_FILL = 0x00000000u,
|
||||
SCE_GXM_POLYGON_MODE_LINE = 0x00008000u,
|
||||
SCE_GXM_POLYGON_MODE_POINT_10UV = 0x00010000u,
|
||||
@ -165,7 +165,7 @@ enum SceGxmPrimitiveType : uint32_t {
|
||||
SCE_GXM_PRIMITIVE_TRIANGLE_EDGES = 0x14000000u
|
||||
};
|
||||
|
||||
enum SceGxmDepthStencilFormat {
|
||||
enum SceGxmDepthStencilFormat : uint32_t {
|
||||
SCE_GXM_DEPTH_STENCIL_FORMAT_DF32 = 0x00044000u,
|
||||
SCE_GXM_DEPTH_STENCIL_FORMAT_S8 = 0x00022000u,
|
||||
SCE_GXM_DEPTH_STENCIL_FORMAT_DF32_S8 = 0x00066000u,
|
||||
@ -175,17 +175,17 @@ enum SceGxmDepthStencilFormat {
|
||||
SCE_GXM_DEPTH_STENCIL_FORMAT_D16 = 0x02444000u
|
||||
};
|
||||
|
||||
enum SceGxmIndexFormat {
|
||||
enum SceGxmIndexFormat : uint32_t {
|
||||
SCE_GXM_INDEX_FORMAT_U16 = 0x00000000u,
|
||||
SCE_GXM_INDEX_FORMAT_U32 = 0x01000000u
|
||||
};
|
||||
|
||||
enum SceGxmFragmentProgramMode {
|
||||
enum SceGxmFragmentProgramMode : uint32_t {
|
||||
SCE_GXM_FRAGMENT_PROGRAM_DISABLED = 0x00200000u,
|
||||
SCE_GXM_FRAGMENT_PROGRAM_ENABLED = 0x00000000u
|
||||
};
|
||||
|
||||
enum SceGxmLineFillLastPixelMode {
|
||||
enum SceGxmLineFillLastPixelMode : uint32_t {
|
||||
SCE_GXM_LINE_FILL_LAST_PIXEL_DISABLED = 0x00000000u,
|
||||
SCE_GXM_LINE_FILL_LAST_PIXEL_ENABLED = 0x00080000u
|
||||
};
|
||||
@ -231,7 +231,7 @@ enum SceGxmParameterSemantic {
|
||||
SCE_GXM_PARAMETER_SEMANTIC_INSTANCE
|
||||
};
|
||||
|
||||
enum SceGxmTextureType : unsigned int {
|
||||
enum SceGxmTextureType : uint32_t {
|
||||
SCE_GXM_TEXTURE_SWIZZLED = 0x00000000u,
|
||||
SCE_GXM_TEXTURE_CUBE = 0x40000000u,
|
||||
SCE_GXM_TEXTURE_LINEAR = 0x60000000u,
|
||||
@ -241,7 +241,7 @@ enum SceGxmTextureType : unsigned int {
|
||||
SCE_GXM_TEXTURE_CUBE_ARBITRARY = 0xE0000000U
|
||||
};
|
||||
|
||||
enum SceGxmTextureSwizzle4Mode {
|
||||
enum SceGxmTextureSwizzle4Mode : uint32_t {
|
||||
SCE_GXM_TEXTURE_SWIZZLE4_ABGR = 0x00000000u,
|
||||
SCE_GXM_TEXTURE_SWIZZLE4_ARGB = 0x00001000u,
|
||||
SCE_GXM_TEXTURE_SWIZZLE4_RGBA = 0x00002000u,
|
||||
@ -252,12 +252,12 @@ enum SceGxmTextureSwizzle4Mode {
|
||||
SCE_GXM_TEXTURE_SWIZZLE4_BGR1 = 0x00007000u
|
||||
};
|
||||
|
||||
enum SceGxmTextureSwizzle3Mode {
|
||||
enum SceGxmTextureSwizzle3Mode : uint32_t {
|
||||
SCE_GXM_TEXTURE_SWIZZLE3_BGR = 0x00000000u,
|
||||
SCE_GXM_TEXTURE_SWIZZLE3_RGB = 0x00001000u
|
||||
};
|
||||
|
||||
enum SceGxmTextureSwizzle2Mode {
|
||||
enum SceGxmTextureSwizzle2Mode : uint32_t {
|
||||
SCE_GXM_TEXTURE_SWIZZLE2_GR = 0x00000000u,
|
||||
SCE_GXM_TEXTURE_SWIZZLE2_00GR = 0x00001000u,
|
||||
SCE_GXM_TEXTURE_SWIZZLE2_GRRR = 0x00002000u,
|
||||
@ -266,12 +266,12 @@ enum SceGxmTextureSwizzle2Mode {
|
||||
SCE_GXM_TEXTURE_SWIZZLE2_00RG = 0x00005000u
|
||||
};
|
||||
|
||||
enum SceGxmTextureSwizzle2ModeAlt {
|
||||
enum SceGxmTextureSwizzle2ModeAlt : uint32_t {
|
||||
SCE_GXM_TEXTURE_SWIZZLE2_SD = 0x00000000u,
|
||||
SCE_GXM_TEXTURE_SWIZZLE2_DS = 0x00001000u
|
||||
};
|
||||
|
||||
enum SceGxmTextureSwizzle1Mode {
|
||||
enum SceGxmTextureSwizzle1Mode : uint32_t {
|
||||
SCE_GXM_TEXTURE_SWIZZLE1_R = 0x00000000u,
|
||||
SCE_GXM_TEXTURE_SWIZZLE1_000R = 0x00001000u,
|
||||
SCE_GXM_TEXTURE_SWIZZLE1_111R = 0x00002000u,
|
||||
@ -282,7 +282,7 @@ enum SceGxmTextureSwizzle1Mode {
|
||||
SCE_GXM_TEXTURE_SWIZZLE1_R111 = 0x00007000u
|
||||
};
|
||||
|
||||
enum SceGxmTextureSwizzleYUV422Mode {
|
||||
enum SceGxmTextureSwizzleYUV422Mode : uint32_t {
|
||||
SCE_GXM_TEXTURE_SWIZZLE_YUYV_CSC0 = 0x00000000u,
|
||||
SCE_GXM_TEXTURE_SWIZZLE_YVYU_CSC0 = 0x00001000u,
|
||||
SCE_GXM_TEXTURE_SWIZZLE_UYVY_CSC0 = 0x00002000u,
|
||||
@ -293,26 +293,26 @@ enum SceGxmTextureSwizzleYUV422Mode {
|
||||
SCE_GXM_TEXTURE_SWIZZLE_VYUY_CSC1 = 0x00007000u
|
||||
};
|
||||
|
||||
enum SceGxmTextureSwizzleYUV420Mode {
|
||||
enum SceGxmTextureSwizzleYUV420Mode : uint32_t {
|
||||
SCE_GXM_TEXTURE_SWIZZLE_YUV_CSC0 = 0x00000000u,
|
||||
SCE_GXM_TEXTURE_SWIZZLE_YVU_CSC0 = 0x00001000u,
|
||||
SCE_GXM_TEXTURE_SWIZZLE_YUV_CSC1 = 0x00002000u,
|
||||
SCE_GXM_TEXTURE_SWIZZLE_YVU_CSC1 = 0x00003000u
|
||||
};
|
||||
|
||||
enum SceGxmTextureFilter {
|
||||
enum SceGxmTextureFilter : uint32_t {
|
||||
SCE_GXM_TEXTURE_FILTER_POINT = 0x00000000u,
|
||||
SCE_GXM_TEXTURE_FILTER_LINEAR = 0x00000001u,
|
||||
SCE_GXM_TEXTURE_FILTER_MIPMAP_LINEAR = 0x00000002u,
|
||||
SCE_GXM_TEXTURE_FILTER_MIPMAP_POINT = 0x00000003u
|
||||
};
|
||||
|
||||
enum SceGxmTextureMipFilter {
|
||||
enum SceGxmTextureMipFilter : uint32_t {
|
||||
SCE_GXM_TEXTURE_MIP_FILTER_DISABLED = 0x00000000u,
|
||||
SCE_GXM_TEXTURE_MIP_FILTER_ENABLED = 0x00000200u
|
||||
};
|
||||
|
||||
enum SceGxmTextureAddrMode {
|
||||
enum SceGxmTextureAddrMode : uint32_t {
|
||||
SCE_GXM_TEXTURE_ADDR_REPEAT = 0x00000000u,
|
||||
SCE_GXM_TEXTURE_ADDR_MIRROR = 0x00000001u,
|
||||
SCE_GXM_TEXTURE_ADDR_CLAMP = 0x00000002u,
|
||||
@ -333,7 +333,7 @@ struct SceGxmRenderTargetParams {
|
||||
SceUID driverMemBlock;
|
||||
};
|
||||
|
||||
enum SceGxmTextureBaseFormat {
|
||||
enum SceGxmTextureBaseFormat : uint32_t {
|
||||
SCE_GXM_TEXTURE_BASE_FORMAT_U8 = 0x00000000,
|
||||
SCE_GXM_TEXTURE_BASE_FORMAT_S8 = 0x01000000,
|
||||
SCE_GXM_TEXTURE_BASE_FORMAT_U4U4U4U4 = 0x02000000,
|
||||
@ -391,7 +391,7 @@ constexpr static inline uint32_t operator|(const SceGxmTextureBaseFormat a, cons
|
||||
return static_cast<uint32_t>(a) | static_cast<uint32_t>(b);
|
||||
};
|
||||
|
||||
enum SceGxmTextureFormat {
|
||||
enum SceGxmTextureFormat : uint32_t {
|
||||
// Supported formats
|
||||
|
||||
SCE_GXM_TEXTURE_FORMAT_U8_000R = SCE_GXM_TEXTURE_BASE_FORMAT_U8 | SCE_GXM_TEXTURE_SWIZZLE1_000R,
|
||||
@ -759,32 +759,32 @@ enum SceGxmTextureFormat {
|
||||
SCE_GXM_TEXTURE_FORMAT_PVRTII4BPP = SCE_GXM_TEXTURE_FORMAT_PVRTII4BPP_ABGR
|
||||
};
|
||||
|
||||
enum SceGxmColorSwizzle4Mode {
|
||||
enum SceGxmColorSwizzle4Mode : uint32_t {
|
||||
SCE_GXM_COLOR_SWIZZLE4_ABGR = 0x00000000u,
|
||||
SCE_GXM_COLOR_SWIZZLE4_ARGB = 0x00100000u,
|
||||
SCE_GXM_COLOR_SWIZZLE4_RGBA = 0x00200000u,
|
||||
SCE_GXM_COLOR_SWIZZLE4_BGRA = 0x00300000u
|
||||
};
|
||||
|
||||
enum SceGxmColorSwizzle3Mode {
|
||||
enum SceGxmColorSwizzle3Mode : uint32_t {
|
||||
SCE_GXM_COLOR_SWIZZLE3_BGR = 0x00000000u,
|
||||
SCE_GXM_COLOR_SWIZZLE3_RGB = 0x00100000u
|
||||
};
|
||||
|
||||
enum SceGxmColorSwizzle2Mode {
|
||||
enum SceGxmColorSwizzle2Mode : uint32_t {
|
||||
SCE_GXM_COLOR_SWIZZLE2_GR = 0x00000000u,
|
||||
SCE_GXM_COLOR_SWIZZLE2_RG = 0x00100000u,
|
||||
SCE_GXM_COLOR_SWIZZLE2_RA = 0x00200000u,
|
||||
SCE_GXM_COLOR_SWIZZLE2_AR = 0x00300000u
|
||||
};
|
||||
|
||||
enum SceGxmColorSwizzle1Mode {
|
||||
enum SceGxmColorSwizzle1Mode : uint32_t {
|
||||
SCE_GXM_COLOR_SWIZZLE1_R = 0x00000000u,
|
||||
SCE_GXM_COLOR_SWIZZLE1_G = 0x00100000u,
|
||||
SCE_GXM_COLOR_SWIZZLE1_A = 0x00100000u
|
||||
};
|
||||
|
||||
enum SceGxmColorBaseFormat {
|
||||
enum SceGxmColorBaseFormat : uint32_t {
|
||||
SCE_GXM_COLOR_BASE_FORMAT_U8U8U8U8 = 0x00000000,
|
||||
SCE_GXM_COLOR_BASE_FORMAT_U8U8U8 = 0x10000000,
|
||||
SCE_GXM_COLOR_BASE_FORMAT_U5U6U5 = 0x30000000,
|
||||
@ -818,7 +818,7 @@ constexpr static inline uint32_t operator|(const SceGxmColorBaseFormat a, const
|
||||
return static_cast<uint32_t>(a) | static_cast<uint32_t>(b);
|
||||
};
|
||||
|
||||
enum SceGxmColorFormat {
|
||||
enum SceGxmColorFormat : uint32_t {
|
||||
|
||||
SCE_GXM_COLOR_FORMAT_U8U8U8U8_ABGR = SCE_GXM_COLOR_BASE_FORMAT_U8U8U8U8 | SCE_GXM_COLOR_SWIZZLE4_ABGR,
|
||||
SCE_GXM_COLOR_FORMAT_U8U8U8U8_ARGB = SCE_GXM_COLOR_BASE_FORMAT_U8U8U8U8 | SCE_GXM_COLOR_SWIZZLE4_ARGB,
|
||||
@ -926,7 +926,7 @@ enum SceGxmColorFormat {
|
||||
SCE_GXM_COLOR_FORMAT_A8 = SCE_GXM_COLOR_FORMAT_U8_A
|
||||
};
|
||||
|
||||
enum SceGxmColorSurfaceType {
|
||||
enum SceGxmColorSurfaceType : uint32_t {
|
||||
SCE_GXM_COLOR_SURFACE_LINEAR = 0x00000000u,
|
||||
SCE_GXM_COLOR_SURFACE_TILED = 0x04000000u,
|
||||
SCE_GXM_COLOR_SURFACE_SWIZZLED = 0x08000000u
|
||||
@ -939,26 +939,26 @@ enum SceGxmColorSurfaceGammaMode : uint32_t {
|
||||
SCE_GXM_COLOR_SURFACE_GAMMA_BGR = 0x00001000u
|
||||
};
|
||||
|
||||
enum SceGxmColorSurfaceScaleMode {
|
||||
enum SceGxmColorSurfaceScaleMode : uint32_t {
|
||||
SCE_GXM_COLOR_SURFACE_SCALE_NONE = 0x00000000u,
|
||||
SCE_GXM_COLOR_SURFACE_SCALE_MSAA_DOWNSCALE = 0x00000001u
|
||||
};
|
||||
|
||||
enum SceGxmMidSceneFlags {
|
||||
enum SceGxmMidSceneFlags : uint32_t {
|
||||
SCE_GXM_MIDSCENE_PRESERVE_DEFAULT_UNIFORM_BUFFERS = 0x00000001U
|
||||
};
|
||||
|
||||
enum SceGxmOutputRegisterSize {
|
||||
enum SceGxmOutputRegisterSize : uint32_t {
|
||||
SCE_GXM_OUTPUT_REGISTER_SIZE_32BIT = 0x00000000u,
|
||||
SCE_GXM_OUTPUT_REGISTER_SIZE_64BIT = 0x00000001u
|
||||
};
|
||||
|
||||
enum SceGxmVisibilityTestMode {
|
||||
enum SceGxmVisibilityTestMode : uint32_t {
|
||||
SCE_GXM_VISIBILITY_TEST_DISABLED = 0x00000000u,
|
||||
SCE_GXM_VISIBILITY_TEST_ENABLED = 0x00004000u
|
||||
};
|
||||
|
||||
enum SceGxmVisibilityTestOp {
|
||||
enum SceGxmVisibilityTestOp : uint32_t {
|
||||
SCE_GXM_VISIBILITY_TEST_OP_INCREMENT = 0x00000000u,
|
||||
SCE_GXM_VISIBILITY_TEST_OP_SET = 0x00040000u
|
||||
};
|
||||
@ -975,14 +975,14 @@ enum SceGxmOutputRegisterFormat {
|
||||
SCE_GXM_OUTPUT_REGISTER_FORMAT_FLOAT
|
||||
};
|
||||
|
||||
enum SceGxmTextureGammaMode {
|
||||
enum SceGxmTextureGammaMode : uint32_t {
|
||||
SCE_GXM_TEXTURE_GAMMA_NONE = 0x00000000u,
|
||||
SCE_GXM_TEXTURE_GAMMA_R = 0x08000000u,
|
||||
SCE_GXM_TEXTURE_GAMMA_GR = 0x18000000u,
|
||||
SCE_GXM_TEXTURE_GAMMA_BGR = 0x08000000u
|
||||
};
|
||||
|
||||
enum SceGxmTextureNormalizeMode {
|
||||
enum SceGxmTextureNormalizeMode : uint32_t {
|
||||
SCE_GXM_TEXTURE_NORMALIZE_DISABLED = 0x00000000u,
|
||||
SCE_GXM_TEXTURE_NORMALIZE_ENABLED = 0x80000000u
|
||||
};
|
||||
@ -993,12 +993,12 @@ enum SceGxmTransferColorKeyMode {
|
||||
SCE_GXM_TRANSFER_COLORKEY_REJECT
|
||||
};
|
||||
|
||||
enum SceGxmTransferFlags {
|
||||
enum SceGxmTransferFlags : uint32_t {
|
||||
SCE_GXM_TRANSFER_FRAGMENT_SYNC = 0x00000001U,
|
||||
SCE_GXM_TRANSFER_VERTEX_SYNC = 0x00000002U
|
||||
};
|
||||
|
||||
enum SceGxmTransferFormat {
|
||||
enum SceGxmTransferFormat : uint32_t {
|
||||
SCE_GXM_TRANSFER_FORMAT_U8_R = 0x00000000U,
|
||||
SCE_GXM_TRANSFER_FORMAT_U4U4U4U4_ABGR = 0x00010000U,
|
||||
SCE_GXM_TRANSFER_FORMAT_U1U5U5U5_ABGR = 0x00020000U,
|
||||
@ -1017,13 +1017,13 @@ enum SceGxmTransferFormat {
|
||||
SCE_GXM_TRANSFER_FORMAT_RAW128 = 0x00130000U
|
||||
};
|
||||
|
||||
enum SceGxmTransferType {
|
||||
enum SceGxmTransferType : uint32_t {
|
||||
SCE_GXM_TRANSFER_LINEAR = 0x00000000U,
|
||||
SCE_GXM_TRANSFER_TILED = 0x00400000U,
|
||||
SCE_GXM_TRANSFER_SWIZZLED = 0x00800000U
|
||||
};
|
||||
|
||||
enum SceGxmDepthStencilForceLoadMode {
|
||||
enum SceGxmDepthStencilForceLoadMode : uint32_t {
|
||||
SCE_GXM_DEPTH_STENCIL_FORCE_LOAD_DISABLED = 0x00000000u,
|
||||
SCE_GXM_DEPTH_STENCIL_FORCE_LOAD_ENABLED = 0x00000002u
|
||||
};
|
||||
@ -1033,7 +1033,7 @@ constexpr static inline uint32_t operator|(const SceGxmDepthStencilForceLoadMode
|
||||
return static_cast<uint32_t>(a) | static_cast<uint32_t>(b);
|
||||
};
|
||||
|
||||
enum SceGxmDepthStencilForceStoreMode {
|
||||
enum SceGxmDepthStencilForceStoreMode : uint32_t {
|
||||
SCE_GXM_DEPTH_STENCIL_FORCE_STORE_DISABLED = 0x00000000u,
|
||||
SCE_GXM_DEPTH_STENCIL_FORCE_STORE_ENABLED = 0x00000004u
|
||||
};
|
||||
@ -1043,12 +1043,12 @@ constexpr static inline uint32_t operator|(const SceGxmDepthStencilForceStoreMod
|
||||
return static_cast<uint32_t>(a) | static_cast<uint32_t>(b);
|
||||
};
|
||||
|
||||
enum SceGxmColorSurfaceDitherMode {
|
||||
enum SceGxmColorSurfaceDitherMode : uint32_t {
|
||||
SCE_GXM_COLOR_SURFACE_DITHER_DISABLED = 0x00000000u,
|
||||
SCE_GXM_COLOR_SURFACE_DITHER_ENABLED = 0x00000008u
|
||||
};
|
||||
|
||||
enum SceGxmDepthStencilSurfaceType {
|
||||
enum SceGxmDepthStencilSurfaceType : uint32_t {
|
||||
SCE_GXM_DEPTH_STENCIL_SURFACE_LINEAR = 0x00000000u,
|
||||
SCE_GXM_DEPTH_STENCIL_SURFACE_TILED = 0x00011000u
|
||||
};
|
||||
@ -1079,7 +1079,7 @@ enum SceGxmAttributeFormat {
|
||||
SCE_GXM_ATTRIBUTE_FORMAT_UNTYPED
|
||||
};
|
||||
|
||||
enum SceGxmErrorCode {
|
||||
enum SceGxmErrorCode : uint32_t {
|
||||
SCE_GXM_ERROR_UNINITIALIZED = 0x805B0000,
|
||||
SCE_GXM_ERROR_ALREADY_INITIALIZED = 0x805B0001,
|
||||
SCE_GXM_ERROR_OUT_OF_MEMORY = 0x805B0002,
|
||||
@ -1257,9 +1257,9 @@ struct SceGxmProgramVertexVaryings {
|
||||
};
|
||||
};
|
||||
|
||||
std::uint32_t vertex_outputs1; // includes everything except texcoord outputs
|
||||
std::uint32_t vertex_outputs2; // includes texcoord outputs
|
||||
std::uint32_t texcoord_pack_format; // 1 bit per texcoord. (0 - float, 1 - half)
|
||||
uint32_t vertex_outputs1; // includes everything except texcoord outputs
|
||||
uint32_t vertex_outputs2; // includes texcoord outputs
|
||||
uint32_t texcoord_pack_format; // 1 bit per texcoord. (0 - float, 1 - half)
|
||||
std::uint16_t semantic_index_offset;
|
||||
std::uint16_t semantic_instance_offset;
|
||||
};
|
||||
@ -1268,10 +1268,10 @@ struct SceGxmProgramVertexVaryings {
|
||||
static_assert(sizeof(SceGxmProgramVertexVaryings) == 32);
|
||||
|
||||
struct SceGxmProgramAttributeDescriptor {
|
||||
std::uint32_t attribute_info;
|
||||
std::uint32_t resource_index;
|
||||
std::uint32_t size;
|
||||
std::uint32_t component_info; ///< Total components and type
|
||||
uint32_t attribute_info;
|
||||
uint32_t resource_index;
|
||||
uint32_t size;
|
||||
uint32_t component_info; ///< Total components and type
|
||||
};
|
||||
|
||||
struct SceGxmDependentSampler {
|
||||
@ -1301,7 +1301,7 @@ enum SceGxmFragmentProgramInputs : int {
|
||||
_SCE_GXM_FRAGMENT_PROGRAM_INPUT_LAST = 1 << 15
|
||||
};
|
||||
|
||||
enum SceGxmProgramFlags : std::uint32_t {
|
||||
enum SceGxmProgramFlags : uint32_t {
|
||||
SCE_GXM_PROGRAM_FLAG_PER_INSTANCE_MODE = 1 << 1,
|
||||
SCE_GXM_PROGRAM_FLAG_DISCARD_USED = 1 << 3,
|
||||
SCE_GXM_PROGRAM_FLAG_DEPTH_USED = 1 << 4,
|
||||
@ -1322,64 +1322,64 @@ struct SceGxmUniformBufferInfo {
|
||||
};
|
||||
|
||||
struct SceGxmProgram {
|
||||
std::uint32_t magic; // should be "GXP\0"
|
||||
uint32_t magic; // should be "GXP\0"
|
||||
|
||||
std::uint8_t major_version; // min 1
|
||||
std::uint8_t minor_version; // min 4
|
||||
std::uint16_t sdk_version; // 0x350 - 3.50
|
||||
|
||||
std::uint32_t size; // size of file - ignoring padding bytes at the end after SceGxmProgramParameter table
|
||||
uint32_t size; // size of file - ignoring padding bytes at the end after SceGxmProgramParameter table
|
||||
|
||||
std::uint32_t binary_guid;
|
||||
std::uint32_t source_guid;
|
||||
uint32_t binary_guid;
|
||||
uint32_t source_guid;
|
||||
|
||||
std::uint32_t program_flags;
|
||||
uint32_t program_flags;
|
||||
|
||||
std::uint32_t buffer_flags; // Buffer flags. 2 bits per buffer. 0x1 - loaded into registers. 0x2 - read from memory
|
||||
uint32_t buffer_flags; // Buffer flags. 2 bits per buffer. 0x1 - loaded into registers. 0x2 - read from memory
|
||||
|
||||
std::uint32_t texunit_flags[2]; // Tex unit flags. 4 bits per tex unit. 0x1 is non dependent read, 0x2 is dependent.
|
||||
uint32_t texunit_flags[2]; // Tex unit flags. 4 bits per tex unit. 0x1 is non dependent read, 0x2 is dependent.
|
||||
|
||||
std::uint32_t parameter_count;
|
||||
std::uint32_t parameters_offset; // Number of bytes from the start of this field to the first parameter.
|
||||
std::uint32_t varyings_offset; // offset to vertex outputs / fragment inputs, relative to this field
|
||||
uint32_t parameter_count;
|
||||
uint32_t parameters_offset; // Number of bytes from the start of this field to the first parameter.
|
||||
uint32_t varyings_offset; // offset to vertex outputs / fragment inputs, relative to this field
|
||||
|
||||
std::uint16_t primary_reg_count; // (PAs)
|
||||
std::uint16_t secondary_reg_count; // (SAs)
|
||||
std::uint32_t temp_reg_count1;
|
||||
uint32_t temp_reg_count1;
|
||||
std::uint16_t temp_reg_count2; // Temp reg count in selective rate(programmable blending) phase
|
||||
|
||||
std::uint16_t primary_program_phase_count;
|
||||
std::uint32_t primary_program_instr_count;
|
||||
std::uint32_t primary_program_offset;
|
||||
uint32_t primary_program_instr_count;
|
||||
uint32_t primary_program_offset;
|
||||
|
||||
std::uint32_t secondary_program_instr_count;
|
||||
std::uint32_t secondary_program_offset; // relative to the beginning of this field
|
||||
std::uint32_t secondary_program_offset_end; // relative to the beginning of this field
|
||||
uint32_t secondary_program_instr_count;
|
||||
uint32_t secondary_program_offset; // relative to the beginning of this field
|
||||
uint32_t secondary_program_offset_end; // relative to the beginning of this field
|
||||
|
||||
std::uint32_t scratch_buffer_count;
|
||||
std::uint32_t thread_buffer_count;
|
||||
std::uint32_t literal_buffer_count;
|
||||
uint32_t scratch_buffer_count;
|
||||
uint32_t thread_buffer_count;
|
||||
uint32_t literal_buffer_count;
|
||||
|
||||
std::uint32_t data_buffer_count;
|
||||
std::uint32_t texture_buffer_count;
|
||||
std::uint32_t default_uniform_buffer_count;
|
||||
uint32_t data_buffer_count;
|
||||
uint32_t texture_buffer_count;
|
||||
uint32_t default_uniform_buffer_count;
|
||||
|
||||
std::uint32_t literal_buffer_data_offset;
|
||||
uint32_t literal_buffer_data_offset;
|
||||
|
||||
std::uint32_t compiler_version; // The version is shifted 4 bits to the left.
|
||||
uint32_t compiler_version; // The version is shifted 4 bits to the left.
|
||||
|
||||
std::uint32_t literals_count;
|
||||
std::uint32_t literals_offset;
|
||||
std::uint32_t uniform_buffer_count;
|
||||
std::uint32_t uniform_buffer_offset;
|
||||
uint32_t literals_count;
|
||||
uint32_t literals_offset;
|
||||
uint32_t uniform_buffer_count;
|
||||
uint32_t uniform_buffer_offset;
|
||||
|
||||
std::uint32_t dependent_sampler_count;
|
||||
std::uint32_t dependent_sampler_offset;
|
||||
std::uint32_t texture_buffer_dependent_sampler_count;
|
||||
std::uint32_t texture_buffer_dependent_sampler_offset;
|
||||
std::uint32_t container_count;
|
||||
std::uint32_t container_offset;
|
||||
std::uint32_t sampler_query_info_offset; // Offset to array of uint16_t
|
||||
uint32_t dependent_sampler_count;
|
||||
uint32_t dependent_sampler_offset;
|
||||
uint32_t texture_buffer_dependent_sampler_count;
|
||||
uint32_t texture_buffer_dependent_sampler_offset;
|
||||
uint32_t container_count;
|
||||
uint32_t container_offset;
|
||||
uint32_t sampler_query_info_offset; // Offset to array of uint16_t
|
||||
|
||||
SceGxmProgramType get_type() const {
|
||||
return static_cast<SceGxmProgramType>(program_flags & SceGxmProgramType::Fragment);
|
||||
|
@ -387,7 +387,6 @@ TextureInfo get_textures_used(const SceGxmProgram &program_gxp) {
|
||||
|
||||
const auto parameters = gxp::program_parameters(program_gxp);
|
||||
|
||||
int max_texture_index = -1;
|
||||
for (uint32_t i = 0; i < program_gxp.parameter_count; ++i) {
|
||||
const auto parameter = parameters[i];
|
||||
if (parameter.category == SCE_GXM_PARAMETER_CATEGORY_SAMPLER) {
|
||||
|
@ -736,7 +736,6 @@ ExitCode run_app(EmuEnvState &emuenv, Ptr<const void> &entry_point) {
|
||||
buf.insert(buf.end(), arg.c_str(), arg.c_str() + arg.size() + 1);
|
||||
auto arr = Ptr<uint8_t>(alloc(emuenv.mem, buf.size(), "arg"));
|
||||
memcpy(arr.get(emuenv.mem), buf.data(), buf.size());
|
||||
auto abc = arr.get(emuenv.mem);
|
||||
param.size = SceSize(buf.size());
|
||||
param.attr = arr.address();
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ template <typename T>
|
||||
class ThreadDataQueueInteratorBase {
|
||||
public:
|
||||
virtual ~ThreadDataQueueInteratorBase() = default;
|
||||
virtual bool operator==(const ThreadDataQueueInteratorBase &rhs) = 0;
|
||||
virtual bool operator==(const ThreadDataQueueInteratorBase &rhs) const = 0;
|
||||
virtual ThreadDataQueueInteratorBase<T> &operator++() = 0;
|
||||
virtual ThreadDataQueueInteratorBase<T> *clone() const = 0;
|
||||
virtual T operator*() = 0;
|
||||
@ -108,7 +108,7 @@ public:
|
||||
|
||||
~FIFOThreadDataQueueInteratorBase() override = default;
|
||||
|
||||
bool operator==(const ThreadDataQueueInteratorBase<T> &rhs) override {
|
||||
bool operator==(const ThreadDataQueueInteratorBase<T> &rhs) const override {
|
||||
auto casted = static_cast<const FIFOThreadDataQueueInteratorBase<T> &>(rhs);
|
||||
return it == casted.it;
|
||||
}
|
||||
@ -192,7 +192,7 @@ public:
|
||||
|
||||
~PriorityThreadDataQueueInteratorBase() override = default;
|
||||
|
||||
bool operator==(const ThreadDataQueueInteratorBase<T> &rhs) override {
|
||||
bool operator==(const ThreadDataQueueInteratorBase<T> &rhs) const override {
|
||||
auto casted = static_cast<const PriorityThreadDataQueueInteratorBase<T> &>(rhs);
|
||||
return it == casted.it;
|
||||
}
|
||||
|
@ -504,7 +504,7 @@ SceUID load_self(Ptr<const void> &entry_point, KernelState &kernel, MemState &me
|
||||
std::vector<uint8_t> dump_elf(self_bytes + self_header.header_len, self_bytes + self_header.self_filesize);
|
||||
Elf32_Phdr *dump_segments = reinterpret_cast<Elf32_Phdr *>(dump_elf.data() + elf.e_phoff);
|
||||
uint16_t last_index = 0;
|
||||
for (const auto [seg_index, segment] : segment_reloc_info) {
|
||||
for (const auto &[seg_index, segment] : segment_reloc_info) {
|
||||
uint8_t *seg_bytes = Ptr<uint8_t>(segment.addr).get(mem);
|
||||
memcpy(dump_elf.data() + dump_segments[seg_index].p_offset, seg_bytes, dump_segments[seg_index].p_filesz);
|
||||
dump_segments[seg_index].p_vaddr = segment.addr;
|
||||
@ -526,7 +526,7 @@ SceUID load_self(Ptr<const void> &entry_point, KernelState &kernel, MemState &me
|
||||
const uint8_t *const module_info_segment_bytes = module_info_segment_address.get(mem);
|
||||
const sce_module_info_raw *const module_info = reinterpret_cast<const sce_module_info_raw *>(module_info_segment_bytes + module_info_offset);
|
||||
|
||||
for (const auto [seg, infos] : segment_reloc_info) {
|
||||
for (const auto &[seg, infos] : segment_reloc_info) {
|
||||
LOG_INFO("Loaded module segment {} @ [0x{:08X} - 0x{:08X} / 0x{:08X}] (size: 0x{:08X}) of module {}", seg, infos.addr, infos.addr + infos.size, infos.p_vaddr, infos.size, self_path);
|
||||
}
|
||||
|
||||
|
@ -651,7 +651,7 @@ bool relocate(const void *entries, uint32_t size, const SegmentInfosForReloc &se
|
||||
const uint32_t orgval = *Ptr<uint32_t>(patch_seg_start + g_offset).get(mem);
|
||||
|
||||
uint32_t segbase = 0;
|
||||
for (const auto seg_ : segments) {
|
||||
for (const auto &seg_ : segments) {
|
||||
const auto seg = seg_.second;
|
||||
if (orgval >= seg.p_vaddr && orgval < seg.p_vaddr + seg.size) {
|
||||
segbase = seg.p_vaddr;
|
||||
|
@ -242,6 +242,8 @@ bool ThreadState::run_loop() {
|
||||
case ThreadToDo::wait:
|
||||
something_to_do.wait(lock);
|
||||
break;
|
||||
case ThreadToDo::suspend:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -105,7 +105,6 @@ int BitmapAllocator::allocate_from(const std::uint32_t start_offset, int &size,
|
||||
|
||||
// We have arrived at le word that still have free position (bit 1)
|
||||
std::uint32_t *word_end = &words[words.size() - 1];
|
||||
std::uint32_t soc = start_offset;
|
||||
|
||||
int bflmin = 0xFFFFFF;
|
||||
int bofmin = -1;
|
||||
@ -135,7 +134,6 @@ int BitmapAllocator::allocate_from(const std::uint32_t start_offset, int &size,
|
||||
|
||||
if (cursor < 0 && (word + 1 <= word_end)) {
|
||||
cursor = 31;
|
||||
soc = 32;
|
||||
word++;
|
||||
wv = *word;
|
||||
}
|
||||
@ -163,7 +161,6 @@ int BitmapAllocator::allocate_from(const std::uint32_t start_offset, int &size,
|
||||
}
|
||||
}
|
||||
|
||||
soc = 32;
|
||||
word++;
|
||||
}
|
||||
|
||||
|
@ -27,19 +27,18 @@ namespace module {
|
||||
class vargs {
|
||||
Address currentVaList;
|
||||
LayoutArgsState layoutState;
|
||||
ArgLayout currentLayout;
|
||||
|
||||
public:
|
||||
vargs() = default;
|
||||
|
||||
explicit vargs(LayoutArgsState layoutState)
|
||||
: layoutState(layoutState)
|
||||
, currentVaList(0) {
|
||||
: currentVaList(0)
|
||||
, layoutState(layoutState) {
|
||||
}
|
||||
|
||||
explicit vargs(Address addr)
|
||||
: layoutState()
|
||||
, currentVaList(addr) {
|
||||
: currentVaList(addr)
|
||||
, layoutState() {
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
@ -48,7 +47,7 @@ public:
|
||||
const auto state_tuple = add_arg_to_layout<T>(layoutState);
|
||||
|
||||
layoutState = std::move(std::get<1>(state_tuple));
|
||||
currentLayout = std::move(std::get<0>(state_tuple));
|
||||
ArgLayout currentLayout = std::move(std::get<0>(state_tuple));
|
||||
|
||||
return read<T>(cpu, currentLayout, mem);
|
||||
} else {
|
||||
|
@ -76,7 +76,7 @@ std::string to_debug_str<SceAudioOutAlcMode>(const MemState &mem, SceAudioOutAlc
|
||||
|
||||
template <>
|
||||
std::string to_debug_str<SceAudioOutChannelFlag>(const MemState &mem, SceAudioOutChannelFlag type) {
|
||||
switch (type) {
|
||||
switch (static_cast<uint32_t>(type)) {
|
||||
case SCE_AUDIO_VOLUME_FLAG_L_CH:
|
||||
return "SCE_AUDIO_VOLUME_FLAG_L_CH";
|
||||
case SCE_AUDIO_VOLUME_FLAG_R_CH:
|
||||
|
@ -1235,7 +1235,6 @@ EXPORT(int, sceSaveDataDialogInit, const Ptr<SceSaveDataDialogParam> param) {
|
||||
SceSaveDataDialogSystemMessageParam *sys_message;
|
||||
std::vector<SceAppUtilSaveDataSlot> slot_list;
|
||||
std::vector<SceAppUtilSaveDataSlotParam> slot_param;
|
||||
std::string thumbnail_path;
|
||||
SceUID fd;
|
||||
|
||||
emuenv.common_dialog.savedata.mode = p->mode;
|
||||
|
@ -100,7 +100,6 @@ void setup_fiber_to_run(EmuEnvState &emuenv, const ThreadStatePtr thread, SceFib
|
||||
}
|
||||
|
||||
void initialize_fiber(EmuEnvState &emuenv, const ThreadStatePtr thread, SceFiber *fiber, const char *name, Ptr<SceFiberEntry> entry, SceUInt32 argOnInitialize, Ptr<void> addrContext, SceSize sizeContext, SceFiberOptParam *params) {
|
||||
const auto state = emuenv.kernel.obj_store.get<FiberState>();
|
||||
fiber->entry = entry;
|
||||
strncpy(fiber->name, name, 32);
|
||||
fiber->argOnInitialize = argOnInitialize;
|
||||
@ -125,8 +124,7 @@ EXPORT(int, _sceFiberAttachContextAndRun, SceFiber *fiber, Address addrContext,
|
||||
const auto state = emuenv.kernel.obj_store.get<FiberState>();
|
||||
const std::lock_guard<std::mutex> lock(state->mutex);
|
||||
const auto thread = lock_and_find(thread_id, emuenv.kernel.threads, emuenv.kernel.mutex);
|
||||
SceFiber *thread_fiber = get_thread_fiber(*state, thread->id);
|
||||
assert(!thread_fiber);
|
||||
assert(!get_thread_fiber(*state, thread->id));
|
||||
assert(!fiber->addrContext);
|
||||
if (LOG_FIBER) {
|
||||
log_fiber(*state, thread, fiber, "Attach context and run");
|
||||
@ -319,8 +317,7 @@ EXPORT(SceUInt32, sceFiberRun, SceFiber *fiber, SceUInt32 argOnRunTo, Ptr<SceUIn
|
||||
return RET_ERROR(SCE_FIBER_ERROR_NULL);
|
||||
}
|
||||
|
||||
SceFiber *thread_fiber = get_thread_fiber(*state, thread->id);
|
||||
assert(!thread_fiber);
|
||||
assert(!get_thread_fiber(*state, thread->id));
|
||||
if (LOG_FIBER) {
|
||||
log_fiber(*state, thread, fiber, "Run");
|
||||
}
|
||||
|
@ -2654,7 +2654,7 @@ EXPORT(int, sceGxmNotificationWait, const SceGxmNotification *notification) {
|
||||
return RET_ERROR(SCE_GXM_ERROR_INVALID_POINTER);
|
||||
}
|
||||
|
||||
std::uint32_t *value = notification->address.get(emuenv.mem);
|
||||
std::uint32_t volatile *value = notification->address.get(emuenv.mem);
|
||||
const std::uint32_t target_value = notification->value;
|
||||
|
||||
std::unique_lock<std::mutex> lock(emuenv.renderer->notification_mutex);
|
||||
@ -5037,10 +5037,8 @@ EXPORT(int, sceGxmTransferCopy, uint32_t width, uint32_t height, uint32_t colorK
|
||||
if (!srcAddress || !destAddress)
|
||||
return RET_ERROR(SCE_GXM_ERROR_INVALID_POINTER);
|
||||
|
||||
const auto src_type_is_linear = srcType == SCE_GXM_TRANSFER_LINEAR;
|
||||
const auto src_type_is_tiled = srcType == SCE_GXM_TRANSFER_TILED;
|
||||
const auto src_type_is_swizzled = srcType == SCE_GXM_TRANSFER_SWIZZLED;
|
||||
const auto dest_type_is_linear = destType == SCE_GXM_TRANSFER_LINEAR;
|
||||
const auto dest_type_is_tiled = destType == SCE_GXM_TRANSFER_TILED;
|
||||
const auto dest_type_is_swizzled = destType == SCE_GXM_TRANSFER_SWIZZLED;
|
||||
|
||||
@ -5083,7 +5081,6 @@ EXPORT(int, sceGxmTransferCopy, uint32_t width, uint32_t height, uint32_t colorK
|
||||
renderer::send_single_command(*emuenv.renderer, nullptr, renderer::CommandOpcode::SignalNotification, false, *notification, true);
|
||||
|
||||
if (syncObject) {
|
||||
SceGxmSyncObject *sync = syncObject.get(emuenv.mem);
|
||||
renderer::send_single_command(*emuenv.renderer, nullptr, renderer::CommandOpcode::SignalSyncObject, false,
|
||||
syncObject, cmd_timestamp);
|
||||
}
|
||||
@ -5139,7 +5136,6 @@ EXPORT(int, sceGxmTransferDownscale, SceGxmTransferFormat srcFormat, Ptr<void> s
|
||||
renderer::send_single_command(*emuenv.renderer, nullptr, renderer::CommandOpcode::SignalNotification, false, *notification, true);
|
||||
|
||||
if (syncObject) {
|
||||
SceGxmSyncObject *sync = syncObject.get(emuenv.mem);
|
||||
renderer::send_single_command(*emuenv.renderer, nullptr, renderer::CommandOpcode::SignalSyncObject, false,
|
||||
syncObject, cmd_timestamp);
|
||||
}
|
||||
@ -5183,7 +5179,6 @@ EXPORT(int, sceGxmTransferFill, uint32_t fillColor, SceGxmTransferFormat destFor
|
||||
renderer::send_single_command(*emuenv.renderer, nullptr, renderer::CommandOpcode::SignalNotification, false, *notification, true);
|
||||
|
||||
if (syncObject) {
|
||||
SceGxmSyncObject *sync = syncObject.get(emuenv.mem);
|
||||
renderer::send_single_command(*emuenv.renderer, nullptr, renderer::CommandOpcode::SignalSyncObject, false,
|
||||
syncObject, cmd_timestamp);
|
||||
}
|
||||
|
@ -748,8 +748,8 @@ EXPORT(SceInt, sceHttpParseResponseHeader, Ptr<const char> headers, SceSize head
|
||||
// use while loop to check ptr is not null
|
||||
while (ptr != NULL) {
|
||||
auto line = std::string(ptr);
|
||||
auto name = line.substr(0, line.find(":"));
|
||||
auto value = line.substr(line.find(" ") + 1);
|
||||
auto name = line.substr(0, line.find(':'));
|
||||
auto value = line.substr(line.find(' ') + 1);
|
||||
|
||||
if (strcmp(name.c_str(), fieldStr) == 0) { // found header
|
||||
|
||||
@ -791,23 +791,23 @@ EXPORT(SceInt, sceHttpParseStatusLine, const char *statusLine, SceSize lineLen,
|
||||
auto cleanLine = line.substr(0, line.find("\r\n"));
|
||||
// even if there is no \r\n, the result will still be the whole string
|
||||
|
||||
auto httpString = cleanLine.substr(0, cleanLine.find(" "));
|
||||
auto version = httpString.substr(httpString.find("/") + 1);
|
||||
auto httpString = cleanLine.substr(0, cleanLine.find(' '));
|
||||
auto version = httpString.substr(httpString.find('/') + 1);
|
||||
auto majorVer = version.substr(0, 1);
|
||||
*httpMajorVer = std::stoi(majorVer);
|
||||
if (version.find(".") != std::string::npos) {
|
||||
auto minorVer = version.substr(version.find(".") + 1);
|
||||
if (version.find('.') != std::string::npos) {
|
||||
auto minorVer = version.substr(version.find('.') + 1);
|
||||
*httpMinorVer = std::stoi(minorVer);
|
||||
} else {
|
||||
*httpMinorVer = 0;
|
||||
}
|
||||
|
||||
auto statusCodeLine = cleanLine.substr(cleanLine.find(" ") + 1, 3);
|
||||
auto statusCodeLine = cleanLine.substr(cleanLine.find(' ') + 1, 3);
|
||||
*responseCode = std::stoi(statusCodeLine);
|
||||
|
||||
auto codeAndPhrase = cleanLine.substr(cleanLine.find(" ") + 1); // 200 OK
|
||||
auto codeAndPhrase = cleanLine.substr(cleanLine.find(' ') + 1); // 200 OK
|
||||
|
||||
auto reason = codeAndPhrase.substr(codeAndPhrase.find(" ") + 1); // OK
|
||||
auto reason = codeAndPhrase.substr(codeAndPhrase.find(' ') + 1); // OK
|
||||
|
||||
auto h = Ptr<char>(alloc(emuenv.mem, sizeof(char), "reasonPhrase"));
|
||||
memcpy(h.get(emuenv.mem), reason.data(), reason.length() + 1);
|
||||
|
@ -49,7 +49,6 @@ EXPORT(SceInt32, sceImeOpen, SceImeParam *param) {
|
||||
emuenv.ime.edit_text = {};
|
||||
emuenv.ime.enter_label.clear();
|
||||
emuenv.ime.str.clear();
|
||||
emuenv.ime.param = {};
|
||||
emuenv.ime.param = *param;
|
||||
|
||||
switch (emuenv.ime.param.enterLabel) {
|
||||
|
@ -93,7 +93,6 @@ EXPORT(int, _sceIoIoctlAsync) {
|
||||
|
||||
EXPORT(SceOff, _sceIoLseek, const SceUID fd, Ptr<_sceIoLseekOpt> opt) {
|
||||
TRACY_FUNC(_sceIoLseek, fd, opt);
|
||||
_sceIoLseekOpt kk = *opt.get(emuenv.mem);
|
||||
return seek_file(fd, opt.get(emuenv.mem)->offset, opt.get(emuenv.mem)->whence, emuenv.io, export_name);
|
||||
}
|
||||
|
||||
|
@ -61,11 +61,11 @@ EXPORT(int, sceDbgLoggingHandler, const char *pFile, int line, int severity, con
|
||||
|
||||
std::string output = fmt::format("SCE libdbg LOG, LEVEL: {}", severity);
|
||||
|
||||
if (pComponent && (strlen(pComponent) > 0)) {
|
||||
if (pComponent && (pComponent[0] != '\0')) {
|
||||
output += fmt::format(", COMPONENT: {}", pComponent);
|
||||
}
|
||||
|
||||
if (pFile && (strlen(pFile) > 0)) {
|
||||
if (pFile && (pFile[0] != '\0')) {
|
||||
output += fmt::format(", FILE:{}, LINE:{}", pFile, line);
|
||||
}
|
||||
|
||||
|
@ -478,8 +478,6 @@ EXPORT(int, sceIoDevctl, const char *dev, SceInt cmd, const void *indata, SceSiz
|
||||
case 12289: { // Get device capacity info?
|
||||
assert(outlen == sizeof(SceIoDevInfo));
|
||||
|
||||
uint64_t max_size, free_size = 0;
|
||||
|
||||
auto device = device::get_device(dev);
|
||||
if (device == VitaIoDevice::_INVALID) {
|
||||
LOG_ERROR("Cannot find device for path: {}", dev);
|
||||
@ -1572,7 +1570,7 @@ EXPORT(int, sceKernelPulseEventWithNotifyCallback) {
|
||||
EXPORT(SceInt32, sceKernelReceiveMsgPipe, SceUID msgPipeId, void *pRecvBuf, SceSize recvSize, SceUInt32 waitMode, SceSize *pResult, SceUInt32 *pTimeout) {
|
||||
TRACY_FUNC(sceKernelReceiveMsgPipe, msgPipeId, pRecvBuf, recvSize, waitMode, pResult, pTimeout);
|
||||
const auto ret = msgpipe_recv(emuenv.kernel, export_name, thread_id, msgPipeId, waitMode, pRecvBuf, recvSize, pTimeout);
|
||||
if (ret < 0) {
|
||||
if (static_cast<int>(ret) < 0) {
|
||||
return ret;
|
||||
}
|
||||
if (pResult) {
|
||||
@ -1605,7 +1603,7 @@ EXPORT(int, sceKernelRegisterThreadEventHandler) {
|
||||
EXPORT(SceInt32, sceKernelSendMsgPipe, SceUID msgPipeId, const void *pSendBuf, SceSize sendSize, SceUInt32 waitMode, SceSize *pResult, SceUInt32 *pTimeout) {
|
||||
TRACY_FUNC(sceKernelSendMsgPipe, msgPipeId, pSendBuf, sendSize, waitMode, pResult, pTimeout);
|
||||
const auto ret = msgpipe_send(emuenv.kernel, export_name, thread_id, msgPipeId, waitMode, pSendBuf, sendSize, pTimeout);
|
||||
if (ret < 0) {
|
||||
if (static_cast<int>(ret) < 0) {
|
||||
return ret;
|
||||
}
|
||||
if (pResult) {
|
||||
|
@ -98,7 +98,7 @@ EXPORT(int, sceNgsAT9GetSectionDetails, std::uint32_t samples_start, const std::
|
||||
return RET_ERROR(SCE_NGS_ERROR_INVALID_ARG);
|
||||
}
|
||||
// Check magic!
|
||||
if ((config_data & 0xFF) != 0xFE && info) {
|
||||
if ((config_data & 0xFF) != 0xFE) {
|
||||
return RET_ERROR(SCE_NGS_ERROR);
|
||||
}
|
||||
samples_start &= ~SCE_NGS_SAMPLE_OFFSET_FROM_AT9_HEADER;
|
||||
|
@ -243,7 +243,7 @@ EXPORT(int, sceNpTrophyGetTrophyInfo, np::trophy::ContextHandle context_handle,
|
||||
details->hidden = context->is_trophy_hidden(trophy_id);
|
||||
int32_t id = 0;
|
||||
for (uint32_t gid = 0; gid < context->group_count + 1; gid++) {
|
||||
for (auto count = 0; count < context->trophy_count_by_group[gid]; count++, id++) {
|
||||
for (uint32_t count = 0; count < context->trophy_count_by_group[gid]; count++, id++) {
|
||||
if (trophy_id == id) {
|
||||
details->groupId = gid;
|
||||
break;
|
||||
|
@ -73,11 +73,11 @@ struct State {
|
||||
SceInt32 total_bytes_consumed = 0;
|
||||
|
||||
// INTERNAL
|
||||
std::int8_t current_loop_count = 0;
|
||||
std::uint32_t decoded_samples_pending = 0;
|
||||
std::uint32_t decoded_passed = 0;
|
||||
// used if the input must be resampled
|
||||
SwrContext *swr = nullptr;
|
||||
std::int8_t current_loop_count = 0;
|
||||
// set to true if all the input has been read but not all data has been processed
|
||||
bool is_finished = false;
|
||||
};
|
||||
|
@ -221,7 +221,7 @@ bool Module::decode_more_data(KernelState &kern, const MemState &mem, const SceU
|
||||
uint32_t decoded_superframe_pos = 0;
|
||||
bool got_decode_error = false;
|
||||
// decode a whole superframe at a time
|
||||
for (int frame = 0; frame < decoder->get(DecoderQuery::AT9_FRAMES_IN_SUPERFRAME); frame++) {
|
||||
for (uint32_t frame = 0; frame < decoder->get(DecoderQuery::AT9_FRAMES_IN_SUPERFRAME); frame++) {
|
||||
if (!decoder->send(input, 0)) {
|
||||
got_decode_error = true;
|
||||
break;
|
||||
@ -229,7 +229,6 @@ bool Module::decode_more_data(KernelState &kern, const MemState &mem, const SceU
|
||||
|
||||
// convert from int16 to float
|
||||
uint32_t const channel_count = decoder->get(DecoderQuery::CHANNELS);
|
||||
uint32_t const sample_rate = decoder->get(DecoderQuery::SAMPLE_RATE);
|
||||
std::vector<uint8_t> temporary_bytes(samples_per_frame * sizeof(int16_t) * channel_count);
|
||||
DecoderSize decoder_size;
|
||||
decoder->receive(temporary_bytes.data(), &decoder_size);
|
||||
@ -341,7 +340,6 @@ bool Module::process(KernelState &kern, const MemState &mem, const SceUID thread
|
||||
return true;
|
||||
}
|
||||
|
||||
bool finished = false;
|
||||
// making this maybe too early...
|
||||
if (!decoder || (params->config_data != last_config)) {
|
||||
decoder = std::make_unique<Atrac9DecoderState>(params->config_data);
|
||||
|
@ -42,7 +42,7 @@ bool Module::process(KernelState &kern, const MemState &mem, const SceUID thread
|
||||
float *source_data = reinterpret_cast<float *>(data.parent->inputs.inputs[0].data());
|
||||
|
||||
// Convert FLTP to S16
|
||||
for (std::uint32_t i = 0; i < data.parent->rack->system->granularity * 2; i++) {
|
||||
for (int32_t i = 0; i < data.parent->rack->system->granularity * 2; i++) {
|
||||
dest_data[i] = static_cast<std::int16_t>(std::clamp(source_data[i] * 32768.0f, -32768.0f, 32767.0f));
|
||||
}
|
||||
|
||||
|
@ -94,8 +94,8 @@ std::int32_t VoiceInputManager::receive(ngs::Patch *patch, const VoiceProduct &p
|
||||
ModuleData::ModuleData()
|
||||
: callback(0)
|
||||
, user_data(0)
|
||||
, flags(0)
|
||||
, is_bypassed(false) {
|
||||
, is_bypassed(false)
|
||||
, flags(0) {
|
||||
}
|
||||
|
||||
BufferParamsInfo *ModuleData::lock_params(const MemState &mem) {
|
||||
@ -309,7 +309,7 @@ bool Voice::set_preset(const MemState &mem, const VoicePreset *preset) {
|
||||
if (preset->bypass_flags_offset) {
|
||||
const auto *bypass_flags = reinterpret_cast<const SceUInt32 *>(data_origin + preset->bypass_flags_offset);
|
||||
// should we disable bypass on all modules first?
|
||||
for (int i = 0; i < preset->bypass_flags_nb; i++) {
|
||||
for (SceUInt32 i = 0; i < preset->bypass_flags_nb; i++) {
|
||||
ModuleData *module_data = module_storage(*bypass_flags);
|
||||
if (!module_data)
|
||||
return false;
|
||||
|
@ -34,7 +34,7 @@ bool deliver_data(const MemState &mem, Voice *source, const std::uint8_t output_
|
||||
continue;
|
||||
}
|
||||
|
||||
if (data_to_deliver.data != nullptr) {
|
||||
{
|
||||
const std::lock_guard<std::mutex> guard(*patch->dest->voice_mutex);
|
||||
patch->dest->inputs.receive(patch, data_to_deliver);
|
||||
}
|
||||
|
@ -128,8 +128,9 @@ bool TRPFile::get_entry_data(const std::uint32_t idx, TRPWriteFunc write_func) {
|
||||
}
|
||||
|
||||
const std::int32_t TRPFile::search_file(const char *name) {
|
||||
auto name_len = strlen(name);
|
||||
for (std::size_t i = 0; i < entries.size(); i++) {
|
||||
if (strncmp(entries[i].filename.c_str(), name, strlen(name)) == 0) {
|
||||
if (strncmp(entries[i].filename.c_str(), name, name_len) == 0) {
|
||||
return static_cast<std::int32_t>(i);
|
||||
}
|
||||
}
|
||||
|
@ -173,7 +173,7 @@ public:
|
||||
auto &key_entries = *self_type;
|
||||
|
||||
for (auto item : key_entries.second) {
|
||||
if (sysver < 0 || (sysver >= item.minver && sysver <= item.maxver) && (keyrev < 0 || keyrev == item.keyrev)) {
|
||||
if ((sysver < 0 || (sysver >= item.minver && sysver <= item.maxver)) && (keyrev < 0 || keyrev == item.keyrev)) {
|
||||
return item;
|
||||
}
|
||||
}
|
||||
|
@ -35,7 +35,7 @@
|
||||
namespace sfo {
|
||||
|
||||
bool get_data_by_id(std::string &out_data, SfoFile &file, int id) {
|
||||
if (id < 0 || file.entries.size() < id) {
|
||||
if (id < 0 || file.entries.size() <= id) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@ void finish(State &state, Context *context);
|
||||
|
||||
/**
|
||||
* \brief Wait for all subjects to be done with the given sync object.
|
||||
*
|
||||
*
|
||||
* Return true if the wait didn't timeout
|
||||
*/
|
||||
bool wishlist(SceGxmSyncObject *sync_object, const uint32_t timestamp, const int32_t timeout_micros = -1);
|
||||
@ -96,8 +96,10 @@ void generic_command_free(Command *cmd);
|
||||
|
||||
template <typename... Args>
|
||||
bool add_command(Context *ctx, const CommandOpcode opcode, int *status, Args... arguments) {
|
||||
auto cmd_maked = make_command(ctx ? ctx->alloc_func : generic_command_allocate, ctx ? ctx->free_func : generic_command_free,
|
||||
opcode, status, arguments...);
|
||||
if (!ctx) {
|
||||
return false;
|
||||
}
|
||||
auto cmd_maked = make_command(ctx->alloc_func, ctx->free_func, opcode, status, arguments...);
|
||||
|
||||
if (!cmd_maked) {
|
||||
return false;
|
||||
|
@ -193,7 +193,7 @@ void pre_compile_program(GLState &renderer, const char *base_path, const char *t
|
||||
// Compile Fragment Shader
|
||||
const auto frag_hash_hex = convert_hash_to_hex(hash.frag);
|
||||
const SharedGLObject frag_shader = compile_shader(base_path, title_id, self_name, renderer.shader_version,
|
||||
frag_hash_hex.c_str(), "frag", GL_FRAGMENT_SHADER, renderer.fragment_shader_cache, hash.frag);
|
||||
frag_hash_hex, "frag", GL_FRAGMENT_SHADER, renderer.fragment_shader_cache, hash.frag);
|
||||
if (!frag_shader) {
|
||||
return;
|
||||
}
|
||||
@ -201,7 +201,7 @@ void pre_compile_program(GLState &renderer, const char *base_path, const char *t
|
||||
// Compile Vertex Shader
|
||||
const auto vert_hash_hex = convert_hash_to_hex(hash.vert);
|
||||
const SharedGLObject vert_shader = compile_shader(base_path, title_id, self_name, renderer.shader_version,
|
||||
vert_hash_hex.c_str(), "vert", GL_VERTEX_SHADER, renderer.vertex_shader_cache, hash.vert);
|
||||
vert_hash_hex, "vert", GL_VERTEX_SHADER, renderer.vertex_shader_cache, hash.vert);
|
||||
if (!vert_shader) {
|
||||
return;
|
||||
}
|
||||
|
@ -530,8 +530,8 @@ static void post_process_pixels_data(GLState &renderer, std::uint32_t *pixels, s
|
||||
std::vector<uint8_t> buffer;
|
||||
|
||||
buffer.resize(((width + 31) / 32) * ((height + 31) / 32) * 1024 * bytes_per_pixel);
|
||||
for (int j = 0; j < height; j++) {
|
||||
for (int hori_tile = 0; hori_tile < (width >> 5); hori_tile++) {
|
||||
for (uint32_t j = 0; j < height; j++) {
|
||||
for (uint32_t hori_tile = 0; hori_tile < (width >> 5); hori_tile++) {
|
||||
const size_t tile_position = hori_tile + (j >> 5) * ((width + 31) >> 5);
|
||||
const size_t first_pixel_offset_in_tile = (tile_position << 10) + (j & 31) * 32;
|
||||
const size_t first_pixel_offset_in_linear = (j * stride) + hori_tile * 32;
|
||||
|
@ -26,8 +26,7 @@
|
||||
namespace renderer::gl {
|
||||
static constexpr std::uint64_t CASTED_UNUSED_TEXTURE_PURGE_SECS = 40;
|
||||
|
||||
GLSurfaceCache::GLSurfaceCache() {
|
||||
}
|
||||
GLSurfaceCache::GLSurfaceCache() = default;
|
||||
|
||||
void GLSurfaceCache::do_typeless_copy(const GLuint dest_texture, const GLuint source_texture, const GLenum dest_internal,
|
||||
const GLenum dest_upload_format, const GLenum dest_type, const GLenum source_format, const GLenum source_type, const int offset_x,
|
||||
@ -507,7 +506,7 @@ GLuint GLSurfaceCache::retrieve_depth_stencil_texture_handle(const State &state,
|
||||
|
||||
// The whole depth stencil struct is reserved for future use
|
||||
for (std::size_t i = 0; i < depth_stencil_textures.size(); i++) {
|
||||
if ((depth_stencil_textures[i].surface.depthData == surface.depthData) && (packed_ds || (!packed_ds && (depth_stencil_textures[i].surface.stencilData == surface.stencilData)))) {
|
||||
if ((depth_stencil_textures[i].surface.depthData == surface.depthData) && (packed_ds || depth_stencil_textures[i].surface.stencilData == surface.stencilData)) {
|
||||
found_index = i;
|
||||
break;
|
||||
}
|
||||
@ -624,7 +623,6 @@ GLuint GLSurfaceCache::retrieve_framebuffer_handle(const State &state, const Mem
|
||||
}
|
||||
|
||||
if (depth_stencil) {
|
||||
SceGxmDepthStencilSurface surface_copy = *depth_stencil;
|
||||
ds_handle = static_cast<GLuint>(retrieve_depth_stencil_texture_handle(state, mem, *depth_stencil));
|
||||
} else {
|
||||
ds_handle = target->attachments[1];
|
||||
|
@ -116,7 +116,7 @@ void configure_bound_texture(const renderer::TextureCacheState &state, const Sce
|
||||
if (block_compressed) {
|
||||
size_t compressed_size = renderer::texture::get_compressed_size(base_fmt, width, height);
|
||||
glCompressedTexImage2D(upload_type, mip_index, internal_format, width, height, 0, static_cast<GLsizei>(compressed_size), nullptr);
|
||||
} else if (!is_swizzled || (is_swizzled && renderer::texture::can_texture_be_unswizzled_without_decode(base_fmt, false))) {
|
||||
} else if (!is_swizzled || (renderer::texture::can_texture_be_unswizzled_without_decode(base_fmt, false))) {
|
||||
glTexImage2D(upload_type, mip_index, internal_format, width, height, 0, format, type, nullptr);
|
||||
} else {
|
||||
if (is_swizzled) {
|
||||
|
@ -332,7 +332,6 @@ static void convert_u2f10f10f10_to_f16f16f16f16(void *dest, const void *data, co
|
||||
for (uint32_t row = 0; row < height; ++row) {
|
||||
for (uint32_t col = 0; col < width; ++col) {
|
||||
uint32_t src_value = src[col];
|
||||
uint16_t f1, f2, f3;
|
||||
int dst_idx;
|
||||
// first get the 2 alpha bits
|
||||
if (is_alpha_upper) {
|
||||
@ -804,7 +803,7 @@ void cache_and_bind_texture(TextureCacheState &cache, const SceGxmTexture &gxm_t
|
||||
upload_bound_texture(cache, gxm_texture, mem);
|
||||
if (!info->use_hash) {
|
||||
info->dirty = false;
|
||||
add_protect(mem, range_protect_begin, range_protect_end - range_protect_begin, MEM_PERM_READONLY, [&cache, info, gxm_texture](Address, bool) {
|
||||
add_protect(mem, range_protect_begin, range_protect_end - range_protect_begin, MEM_PERM_READONLY, [info, gxm_texture](Address, bool) {
|
||||
if (memcmp(&info->texture, &gxm_texture, sizeof(SceGxmTexture)) == 0) {
|
||||
info->dirty = true;
|
||||
}
|
||||
|
@ -635,8 +635,6 @@ void resolve_z_order_compressed_image(std::uint32_t width, std::uint32_t height,
|
||||
std::uint32_t block_count_y = (height + 3) / 4;
|
||||
std::size_t block_size = (bc_type != 1 && bc_type != 4 && bc_type != 5) ? 16 : 8;
|
||||
|
||||
std::uint32_t temp_block_result[16] = {};
|
||||
|
||||
size_t min = block_count_x < block_count_y ? block_count_x : block_count_y;
|
||||
size_t k = static_cast<size_t>(log2(min));
|
||||
|
||||
|
@ -165,9 +165,9 @@ VKContext::VKContext(VKState &state)
|
||||
}
|
||||
|
||||
VKRenderTarget::VKRenderTarget(VKState &state, vma::Allocator allocator, uint16_t width, uint16_t height, uint16_t samples_per_frame)
|
||||
: color(allocator, width * state.res_multiplier, height * state.res_multiplier, vk::Format::eR8G8B8A8Unorm)
|
||||
, depthstencil(allocator, width * state.res_multiplier, height * state.res_multiplier, vk::Format::eD32SfloatS8Uint)
|
||||
, mask(allocator, width, height, vk::Format::eR8G8B8A8Unorm) {
|
||||
: mask(allocator, width, height, vk::Format::eR8G8B8A8Unorm)
|
||||
, color(allocator, width * state.res_multiplier, height * state.res_multiplier, vk::Format::eR8G8B8A8Unorm)
|
||||
, depthstencil(allocator, width * state.res_multiplier, height * state.res_multiplier, vk::Format::eD32SfloatS8Uint) {
|
||||
this->width = width * state.res_multiplier;
|
||||
this->height = height * state.res_multiplier;
|
||||
|
||||
@ -209,7 +209,6 @@ VKRenderTarget::VKRenderTarget(VKState &state, vma::Allocator allocator, uint16_
|
||||
for (int i = 0; i < fences.size(); i++)
|
||||
fences[i] = state.device.createFence(fence_info);
|
||||
|
||||
vk::SemaphoreCreateInfo semaphore_info{};
|
||||
for (int i = 0; i < MAX_FRAMES_RENDERING; i++) {
|
||||
vk::CommandBufferAllocateInfo buffer_info{
|
||||
.commandPool = reinterpret_cast<VKContext *>(state.context)->frames[i].command_pool,
|
||||
|
@ -416,7 +416,6 @@ vk::PipelineVertexInputStateCreateInfo PipelineCache::get_vertex_input_state(Mem
|
||||
|
||||
used_streams |= (1 << attribute.streamIndex);
|
||||
|
||||
const SceGxmVertexStream &stream = vertex_program.streams[attribute.streamIndex];
|
||||
const SceGxmAttributeFormat attribute_format = static_cast<SceGxmAttributeFormat>(attribute.format);
|
||||
shader::usse::AttributeInformation info = vkvert->attribute_infos.at(attribute.regIndex);
|
||||
|
||||
|
@ -146,11 +146,11 @@ bool create(SDL_Window *window, std::unique_ptr<renderer::State> &state, const c
|
||||
}
|
||||
|
||||
VKState::VKState(int gpu_idx)
|
||||
: screen_renderer(*this)
|
||||
: gpu_idx(gpu_idx)
|
||||
, surface_cache(*this)
|
||||
, pipeline_cache(*this)
|
||||
, texture_cache(*this)
|
||||
, gpu_idx(gpu_idx) {
|
||||
, screen_renderer(*this) {
|
||||
}
|
||||
|
||||
bool VKState::init(const char *base_path, const bool hashless_texture_cache) {
|
||||
|
@ -171,7 +171,7 @@ void ScreenRenderer::create_swapchain() {
|
||||
}
|
||||
|
||||
swapchain_framebuffers.resize(swapchain_size);
|
||||
for (int i = 0; i < swapchain_size; i++) {
|
||||
for (uint32_t i = 0; i < swapchain_size; i++) {
|
||||
vk::FramebufferCreateInfo fb_info{
|
||||
.renderPass = render_pass,
|
||||
.width = extent.width,
|
||||
|
@ -228,8 +228,6 @@ vkutil::Image *VKSurfaceCache::retrieve_color_surface_texture_handle(uint16_t wi
|
||||
|
||||
std::vector<CastedTexture> &casted_vec = info.casted_textures;
|
||||
|
||||
vk::Format source_format = color::translate_format(info.format);
|
||||
|
||||
CastedTexture *casted = nullptr;
|
||||
|
||||
// Look in cast cache and grab one. The cache really does not store immediate grab on now, but rather to reduce the synchronization in the pipeline (use different texture)
|
||||
@ -503,7 +501,7 @@ vkutil::Image *VKSurfaceCache::retrieve_depth_stencil_texture_handle(const MemSt
|
||||
|
||||
// The whole depth stencil struct is reserved for future use
|
||||
for (size_t i = 0; i < depth_stencil_textures.size(); i++) {
|
||||
if ((depth_stencil_textures[i].surface.depthData == surface.depthData) && (packed_ds || (!packed_ds && (depth_stencil_textures[i].surface.stencilData == surface.stencilData)))) {
|
||||
if ((depth_stencil_textures[i].surface.depthData == surface.depthData) && (packed_ds || depth_stencil_textures[i].surface.stencilData == surface.stencilData)) {
|
||||
found_index = i;
|
||||
break;
|
||||
}
|
||||
@ -687,7 +685,6 @@ vk::Framebuffer VKSurfaceCache::retrieve_framebuffer_handle(const MemState &mem,
|
||||
}
|
||||
|
||||
if (depth_stencil && (depth_stencil->depthData || depth_stencil->stencilData)) {
|
||||
SceGxmDepthStencilSurface surface_copy = *depth_stencil;
|
||||
ds_handle = retrieve_depth_stencil_texture_handle(mem, *depth_stencil);
|
||||
} else {
|
||||
ds_handle = &target->depthstencil;
|
||||
|
@ -32,7 +32,6 @@ void sync_clipping(VKContext &context) {
|
||||
|
||||
const int res_multiplier = context.state.res_multiplier;
|
||||
|
||||
const int display_h = context.render_target->height / res_multiplier;
|
||||
const int scissor_x = context.record.region_clip_min.x;
|
||||
const int scissor_y = context.record.region_clip_min.y;
|
||||
|
||||
@ -105,9 +104,6 @@ void sync_mask(VKContext &context, const MemState &mem) {
|
||||
return;
|
||||
|
||||
auto control = context.record.depth_stencil_surface.control.content;
|
||||
// mask is not upscaled
|
||||
auto width = context.render_target->width / context.state.res_multiplier;
|
||||
auto height = context.render_target->height / context.state.res_multiplier;
|
||||
float initial_val = (control & SceGxmDepthStencilControl::mask_bit) ? 1.0f : 0.0f;
|
||||
|
||||
std::array<float, 4> clear_bytes = { initial_val, initial_val, initial_val, initial_val };
|
||||
|
@ -50,8 +50,6 @@ void sync_texture(VKContext &context, MemState &mem, std::size_t index, SceGxmTe
|
||||
}
|
||||
|
||||
vkutil::Image *image = nullptr;
|
||||
vk::ComponentMapping swizzle_surface;
|
||||
bool only_nearest = false;
|
||||
|
||||
SceGxmColorBaseFormat format_target_of_texture;
|
||||
|
||||
@ -146,10 +144,6 @@ bool init(VKTextureCacheState &cache, const bool hashless_texture_cache) {
|
||||
return true;
|
||||
}
|
||||
|
||||
static uint32_t max_mip(uint32_t pixels) {
|
||||
return std::bit_width(pixels);
|
||||
}
|
||||
|
||||
static vk::Format linear_to_srgb(const vk::Format format) {
|
||||
switch (format) {
|
||||
case vk::Format::eR8Unorm:
|
||||
@ -177,8 +171,6 @@ void configure_bound_texture(const renderer::TextureCacheState &state, const Sce
|
||||
const SceGxmTextureFormat format = gxm::get_format(&gxm_texture);
|
||||
const SceGxmTextureBaseFormat base_format = gxm::get_base_format(format);
|
||||
|
||||
const bool mipmap_enabled = static_cast<bool>(gxm_texture.mip_filter);
|
||||
|
||||
const vk::ComponentMapping swizzle = translate_swizzle(format);
|
||||
|
||||
const bool is_cube = (gxm_texture.texture_type() == SCE_GXM_TEXTURE_CUBE || gxm_texture.texture_type() == SCE_GXM_TEXTURE_CUBE_ARBITRARY);
|
||||
@ -201,10 +193,6 @@ void configure_bound_texture(const renderer::TextureCacheState &state, const Sce
|
||||
vk_format = linear_to_srgb(vk_format);
|
||||
}
|
||||
|
||||
const auto texture_type = gxm_texture.texture_type();
|
||||
const bool is_swizzled = (texture_type == SCE_GXM_TEXTURE_SWIZZLED) || (texture_type == SCE_GXM_TEXTURE_CUBE) || (texture_type == SCE_GXM_TEXTURE_SWIZZLED_ARBITRARY) || (texture_type == SCE_GXM_TEXTURE_CUBE_ARBITRARY);
|
||||
const auto base_fmt = gxm::get_base_format(format);
|
||||
|
||||
const VKTextureCacheState &cache = static_cast<const VKTextureCacheState &>(state);
|
||||
vkutil::Image &image = *cache.current_texture;
|
||||
|
||||
@ -292,8 +280,8 @@ static void *add_alpha_channel(const void *pixels, const uint32_t width, const u
|
||||
|
||||
const uint8_t *src = reinterpret_cast<const uint8_t *>(pixels);
|
||||
uint8_t *dst = data.data();
|
||||
for (int y = 0; y < height; y++) {
|
||||
for (int x = 0; x < width; x++) {
|
||||
for (uint32_t y = 0; y < height; y++) {
|
||||
for (uint32_t x = 0; x < width; x++) {
|
||||
dst[0] = src[0];
|
||||
dst[1] = src[1];
|
||||
dst[2] = src[2];
|
||||
|
@ -72,7 +72,7 @@ std::tuple<DataType, std::string> get_parameter_type_store_and_name(const SceGxm
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
return std::make_tuple(DataType::UNK, "unk");
|
||||
}
|
||||
}
|
||||
|
||||
@ -91,7 +91,6 @@ ProgramInput get_program_input(const SceGxmProgram &program) {
|
||||
const SceGxmProgramParameter ¶meter = gxp_parameters[i];
|
||||
|
||||
bool is_uniform = false;
|
||||
uint16_t curi = parameter.category;
|
||||
|
||||
switch (parameter.category) {
|
||||
case SCE_GXM_PARAMETER_CATEGORY_UNIFORM:
|
||||
@ -446,6 +445,7 @@ DataType get_texture_component_type(SceGxmTextureFormat format) {
|
||||
case SCE_GXM_TEXTURE_BASE_FORMAT_YUV422:
|
||||
return DataType::UINT8;
|
||||
}
|
||||
return DataType::UNK;
|
||||
}
|
||||
|
||||
uint8_t get_texture_component_count(SceGxmTextureFormat format) {
|
||||
|
@ -94,10 +94,10 @@ struct StructDeclContext {
|
||||
// TODO do we need this? This is made to avoid spir-v validation error regarding interface variables
|
||||
struct VarToReg {
|
||||
spv::Id var;
|
||||
bool pa; // otherwise sa
|
||||
uint32_t offset;
|
||||
uint32_t size;
|
||||
DataType dtype;
|
||||
bool pa; // otherwise sa
|
||||
};
|
||||
|
||||
struct TranslationState {
|
||||
@ -446,10 +446,10 @@ static void create_fragment_inputs(spv::Builder &b, SpirvShaderParameters ¶m
|
||||
|
||||
translation_state.var_to_regs.push_back(
|
||||
{ pa_iter_var,
|
||||
true,
|
||||
pa_offset,
|
||||
pa_iter_size,
|
||||
pa_dtype });
|
||||
pa_dtype,
|
||||
true });
|
||||
translation_state.interfaces.push_back(pa_iter_var);
|
||||
LOG_DEBUG("Iterator: pa{} = ({}{}) {}", pa_offset, pa_type, num_comp, pa_name);
|
||||
|
||||
@ -1016,7 +1016,6 @@ static SpirvShaderParameters create_parameters(spv::Builder &b, const SceGxmProg
|
||||
// Log parameters
|
||||
for (size_t i = 0; i < program.parameter_count; ++i) {
|
||||
const SceGxmProgramParameter ¶meter = gxp_parameters[i];
|
||||
uint16_t curi = parameter.category;
|
||||
if (parameter.category == SCE_GXM_PARAMETER_CATEGORY_UNIFORM || parameter.category == SCE_GXM_PARAMETER_CATEGORY_ATTRIBUTE) {
|
||||
bool is_uniform = parameter.category == SCE_GXM_PARAMETER_CATEGORY_UNIFORM;
|
||||
std::string var_name = gxp::parameter_name(parameter);
|
||||
|
@ -364,7 +364,6 @@ bool USSETranslatorVisitor::smp(
|
||||
// expected to be in this order but reversed...
|
||||
const spv::Id one = m_b.makeFloatConstant(1.0);
|
||||
const spv::Id zero = m_b.makeFloatConstant(0.0);
|
||||
const spv::Id zeros = m_b.makeCompositeConstant(type_f32_v[2], { zero, zero });
|
||||
const spv::Id u = m_b.createBinOp(spv::OpVectorExtractDynamic, type_f32, uv, m_b.makeIntConstant(0));
|
||||
const spv::Id v = m_b.createBinOp(spv::OpVectorExtractDynamic, type_f32, uv, m_b.makeIntConstant(1));
|
||||
|
||||
|
@ -1073,7 +1073,6 @@ void convert_gxp_usse_to_spirv(spv::Builder &b, const SceGxmProgram &program, co
|
||||
// Call end hook. If it's discard, this is not even called, so no worry
|
||||
b.createFunctionCall(end_hook_func, {});
|
||||
|
||||
std::vector<spv::Id> empty_args;
|
||||
if (features.should_use_shader_interlock() && program.is_fragment() && program.is_frag_color_used())
|
||||
b.createNoResultOp(spv::OpEndInvocationInterlockEXT);
|
||||
}
|
||||
|
@ -240,7 +240,6 @@ static spv::Function *make_unpack_func(spv::Builder &b, const FeatureState &feat
|
||||
extracted = b.createUnaryOp(spv::OpBitcast, is_signed ? type_i32 : type_ui32, extracted);
|
||||
|
||||
std::vector<spv::Id> comps;
|
||||
std::vector<spv::Id> bias_comps;
|
||||
|
||||
const auto comp_bits = 32 / comp_count;
|
||||
|
||||
@ -467,7 +466,6 @@ static spv::Function *make_fetch_memory_func_for_array(spv::Builder &b, spv::Id
|
||||
|
||||
static spv::Function *make_fetch_memory_func(spv::Builder &b, const SpirvShaderParameters ¶ms) {
|
||||
spv::Id type_f32 = b.makeFloatType(32);
|
||||
spv::Id type_ui32 = b.makeUintType(32);
|
||||
spv::Id type_i32 = b.makeIntType(32);
|
||||
spv::Id type_bool = b.makeBoolType();
|
||||
|
||||
@ -1026,8 +1024,6 @@ spv::Id shader::usse::utils::unpack(spv::Builder &b, SpirvUtilFunctions &utils,
|
||||
|
||||
unpack_results.resize(target_comp_count);
|
||||
|
||||
spv::Id unpacked_type = spv::NoResult;
|
||||
|
||||
for (std::size_t i = 0; i < unpack_results.size(); i++) {
|
||||
spv::Id extracted = target;
|
||||
|
||||
@ -1042,7 +1038,6 @@ spv::Id shader::usse::utils::unpack(spv::Builder &b, SpirvUtilFunctions &utils,
|
||||
}
|
||||
|
||||
unpack_results[i] = unpack_one(b, utils, features, extracted, type);
|
||||
unpacked_type = b.getTypeId(unpack_results[i]);
|
||||
}
|
||||
|
||||
return finalize(b, unpack_results[0], unpack_results.size() > 1 ? unpack_results[1] : unpack_results[0],
|
||||
@ -1309,6 +1304,7 @@ static std::pair<float, float> get_int_normalize_range_constants(DataType type)
|
||||
return { 2147483648.0f, 2147483647.0f };
|
||||
default:
|
||||
assert(false);
|
||||
return { 0.0f, 0.0f };
|
||||
}
|
||||
}
|
||||
|
||||
@ -1361,8 +1357,7 @@ spv::Id shader::usse::utils::convert_to_float(spv::Builder &b, spv::Id opr, Data
|
||||
|
||||
spv::Id shader::usse::utils::convert_to_int(spv::Builder &b, spv::Id opr, DataType type, bool normal) {
|
||||
const auto opr_type = b.getTypeId(opr);
|
||||
const auto spv_type = unwrap_type(b, b.getTypeId(opr));
|
||||
assert(b.isFloatType(spv_type));
|
||||
assert(b.isFloatType(unwrap_type(b, b.getTypeId(opr))));
|
||||
|
||||
const auto comp_count = b.isVector(opr) ? b.getNumComponents(opr) : 1;
|
||||
const auto is_uint = is_unsigned_integer_data_type(type);
|
||||
|
@ -209,7 +209,7 @@ int touch_get(const SceUID thread_id, EmuEnvState &emuenv, const SceUInt32 &port
|
||||
if (registered_touch() && port == touchscreen_port) {
|
||||
// less accurate implementation, but which is able to take a real touchscreen as the input
|
||||
pData[0] = recover_touch_events();
|
||||
for (uint32_t i = 0; i < nb_returned_data; i++) {
|
||||
for (int32_t i = 0; i < nb_returned_data; i++) {
|
||||
memcpy(&pData[i], &pData[0], sizeof(SceTouchData));
|
||||
}
|
||||
} else {
|
||||
@ -220,7 +220,7 @@ int touch_get(const SceUID thread_id, EmuEnvState &emuenv, const SceUInt32 &port
|
||||
// give the oldest buffer first
|
||||
corr_buffer_idx = (touch_buffer_idx - nb_returned_data + 1 + MAX_TOUCH_BUFFER_SAVED) % MAX_TOUCH_BUFFER_SAVED;
|
||||
}
|
||||
for (uint32_t i = 0; i < nb_returned_data; i++) {
|
||||
for (int32_t i = 0; i < nb_returned_data; i++) {
|
||||
memcpy(&pData[i], &touch_buffers[corr_buffer_idx][port_idx], sizeof(SceTouchData));
|
||||
// if peek, repeat the last buffer
|
||||
if (!is_peek) {
|
||||
|
@ -18,12 +18,14 @@
|
||||
// original source:https://stackoverflow.com/questions/1659440/32-bit-to-16-bit-floating-point-conversion
|
||||
// public domain
|
||||
|
||||
#include <bit>
|
||||
#include <climits> // CHAR_BIT
|
||||
#include <cstdint> // uint32_t, uint64_t, etc.
|
||||
#include <cstring> // memcpy
|
||||
#include <limits> // numeric_limits
|
||||
#include <utility> // is_integral_v, is_floating_point_v, forward
|
||||
|
||||
#ifndef __cpp_lib_bit_cast
|
||||
namespace std {
|
||||
template <typename T, typename U>
|
||||
T bit_cast(U &&u) {
|
||||
@ -35,6 +37,7 @@ T bit_cast(U &&u) {
|
||||
return t;
|
||||
}
|
||||
} // namespace std
|
||||
#endif
|
||||
|
||||
namespace util {
|
||||
template <typename T>
|
||||
|
@ -75,7 +75,6 @@ std::string log_hex(T val) {
|
||||
|
||||
template <typename T>
|
||||
std::string log_hex_full(T val) {
|
||||
using unsigned_type = typename std::make_unsigned<T>::type;
|
||||
std::stringstream ss;
|
||||
ss << "0x";
|
||||
ss << std::setfill('0') << std::setw(sizeof(T) * 2) << std::hex << val;
|
||||
@ -91,6 +90,6 @@ std::string log_hex_fast(T val) {
|
||||
using unsigned_type = typename std::make_unsigned<T>::type;
|
||||
std::stringstream ss;
|
||||
ss << "0x";
|
||||
ss << std::hex << val;
|
||||
ss << std::hex << static_cast<unsigned_type>(val);
|
||||
return ss.str();
|
||||
}
|
@ -445,8 +445,8 @@ void parseResponse(std::string res, SceRequestResponse &reqres) {
|
||||
// use while loop to check ptr is not null
|
||||
while (ptr != NULL) {
|
||||
auto line = std::string(ptr);
|
||||
auto name = line.substr(0, line.find(":"));
|
||||
auto value = line.substr(line.find(" ") + 1);
|
||||
auto name = line.substr(0, line.find(':'));
|
||||
auto value = line.substr(line.find(' ') + 1);
|
||||
|
||||
reqres.headers.insert({ name, value });
|
||||
ptr = strtok(NULL, "\r\n");
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include <util/log.h>
|
||||
|
||||
namespace vkutil {
|
||||
Image::Image() {}
|
||||
Image::Image() = default;
|
||||
|
||||
Image::Image(Image &&other) noexcept {
|
||||
memcpy(this, &other, sizeof(Image));
|
||||
@ -111,7 +111,7 @@ void Image::transition_to_discard(vk::CommandBuffer buffer, ImageLayout new_layo
|
||||
layout = new_layout;
|
||||
}
|
||||
|
||||
Buffer::Buffer() {}
|
||||
Buffer::Buffer() = default;
|
||||
|
||||
Buffer::Buffer(Buffer &&other) noexcept {
|
||||
memcpy(this, &other, sizeof(Buffer));
|
||||
|
Loading…
Reference in New Issue
Block a user