mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2026-04-28 05:45:38 -06:00
Some checks are pending
Build and Release / reuse (push) Waiting to run
Build and Release / clang-format (push) Waiting to run
Build and Release / get-info (push) Waiting to run
Build and Release / windows-sdl (push) Blocked by required conditions
Build and Release / macos-sdl (push) Blocked by required conditions
Build and Release / linux-sdl (push) Blocked by required conditions
Build and Release / linux-sdl-gcc (push) Blocked by required conditions
Build and Release / pre-release (push) Blocked by required conditions
* Swap write access mode for read write Opening with access mode w will erase the opened file. We do not want this. * Create mode Opening with write access was previously the only way to create a file through open, so add a separate FileAccessMode that uses the write access mode to create files. * Update file_system.cpp Remove a hack added to posix_rename to bypass the file clearing behaviors of FileAccessMode::Write * Check access mode in read functions Write-only files cause the EBADF return on the various read functions. Now that we're opening files differently, properly handling this is necessary. * Separate appends into proper modes Fixes a potential regression from one of my prior PRs, and ensures the Write | Append flag combo also behaves properly in read-related functions. * Move IsWriteOnly check after device/socket reads file->f is only valid for files, so checking this before checking for sockets/devices will cause access violations. * Fix issues Now that Write is identical to ReadWrite, internal uses of Write need to be swapped to my new Create mode * Fix remaining uses of FileAccessMode write to create files Missed these before. * Fix rebase * Add stubbed get_authinfo (#3722) * mostly stubbed get_authinfo * Return value observed on console if get_authinfo was called for the current thread, esrch otherwise --------- Co-authored-by: kalaposfos13 <153381648+kalaposfos13@users.noreply.github.com> Co-authored-by: georgemoralis <giorgosmrls@gmail.com>
58 lines
1.8 KiB
C++
58 lines
1.8 KiB
C++
// SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
#include <map>
|
|
#include <string>
|
|
|
|
#include <fmt/format.h>
|
|
|
|
#include "common/config.h"
|
|
#include "common/io_file.h"
|
|
#include "common/path_util.h"
|
|
#include "shader_recompiler/ir/basic_block.h"
|
|
#include "shader_recompiler/ir/program.h"
|
|
#include "shader_recompiler/ir/value.h"
|
|
|
|
namespace Shader::IR {
|
|
|
|
void DumpProgram(const Program& program, const Info& info, const std::string& type) {
|
|
using namespace Common::FS;
|
|
|
|
if (!Config::dumpShaders()) {
|
|
return;
|
|
}
|
|
|
|
const auto dump_dir = GetUserPath(PathType::ShaderDir) / "dumps";
|
|
if (!std::filesystem::exists(dump_dir)) {
|
|
std::filesystem::create_directories(dump_dir);
|
|
}
|
|
const auto ir_filename =
|
|
fmt::format("{}_{:#018x}.{}irprogram.txt", info.stage, info.pgm_hash, type);
|
|
const auto ir_file = IOFile{dump_dir / ir_filename, FileAccessMode::Create, FileType::TextFile};
|
|
|
|
size_t index{0};
|
|
std::map<const IR::Inst*, size_t> inst_to_index;
|
|
std::map<const IR::Block*, size_t> block_to_index;
|
|
|
|
for (const IR::Block* const block : program.blocks) {
|
|
block_to_index.emplace(block, index);
|
|
++index;
|
|
}
|
|
|
|
for (const auto& block : program.blocks) {
|
|
std::string s = IR::DumpBlock(*block, block_to_index, inst_to_index, index) + '\n';
|
|
ir_file.WriteString(s);
|
|
}
|
|
|
|
const auto asl_filename = fmt::format("{}_{:#018x}.{}asl.txt", info.stage, info.pgm_hash, type);
|
|
const auto asl_file =
|
|
IOFile{dump_dir / asl_filename, FileAccessMode::Create, FileType::TextFile};
|
|
|
|
for (const auto& node : program.syntax_list) {
|
|
std::string s = IR::DumpASLNode(node, block_to_index, inst_to_index) + '\n';
|
|
asl_file.WriteString(s);
|
|
}
|
|
}
|
|
|
|
} // namespace Shader::IR
|