Fix build errors related to formatting non-scoped enums
This commit is contained in:
parent
b051903c3d
commit
cc5640245c
|
@ -132,7 +132,7 @@ std::string DSPDisassembler::DisassembleParameters(const DSPOPCTemplate& opc, u1
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ERROR_LOG_FMT(DSPLLE, "Unknown parameter type: {:x}", opc.params[j].type);
|
ERROR_LOG_FMT(DSPLLE, "Unknown parameter type: {:x}", static_cast<u32>(opc.params[j].type));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -365,24 +365,39 @@ void DSPJitRegCache::FlushRegs()
|
||||||
ASSERT_MSG(DSPLLE, !m_regs[i].loc.IsSimpleReg(), "register {} is still a simple reg", i);
|
ASSERT_MSG(DSPLLE, !m_regs[i].loc.IsSimpleReg(), "register {} is still a simple reg", i);
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT_MSG(DSPLLE, m_xregs[RSP].guest_reg == DSP_REG_STATIC, "wrong xreg state for {}", RSP);
|
ASSERT_MSG(DSPLLE, m_xregs[RSP].guest_reg == DSP_REG_STATIC, "wrong xreg state for {}",
|
||||||
ASSERT_MSG(DSPLLE, m_xregs[RBX].guest_reg == DSP_REG_STATIC, "wrong xreg state for {}", RBX);
|
static_cast<u32>(RSP));
|
||||||
ASSERT_MSG(DSPLLE, m_xregs[RBP].guest_reg == DSP_REG_NONE, "wrong xreg state for {}", RBP);
|
ASSERT_MSG(DSPLLE, m_xregs[RBX].guest_reg == DSP_REG_STATIC, "wrong xreg state for {}",
|
||||||
ASSERT_MSG(DSPLLE, m_xregs[RSI].guest_reg == DSP_REG_NONE, "wrong xreg state for {}", RSI);
|
static_cast<u32>(RBX));
|
||||||
ASSERT_MSG(DSPLLE, m_xregs[RDI].guest_reg == DSP_REG_NONE, "wrong xreg state for {}", RDI);
|
ASSERT_MSG(DSPLLE, m_xregs[RBP].guest_reg == DSP_REG_NONE, "wrong xreg state for {}",
|
||||||
|
static_cast<u32>(RBP));
|
||||||
|
ASSERT_MSG(DSPLLE, m_xregs[RSI].guest_reg == DSP_REG_NONE, "wrong xreg state for {}",
|
||||||
|
static_cast<u32>(RSI));
|
||||||
|
ASSERT_MSG(DSPLLE, m_xregs[RDI].guest_reg == DSP_REG_NONE, "wrong xreg state for {}",
|
||||||
|
static_cast<u32>(RDI));
|
||||||
#ifdef STATIC_REG_ACCS
|
#ifdef STATIC_REG_ACCS
|
||||||
ASSERT_MSG(DSPLLE, m_xregs[R8].guest_reg == DSP_REG_STATIC, "wrong xreg state for {}", R8);
|
ASSERT_MSG(DSPLLE, m_xregs[R8].guest_reg == DSP_REG_STATIC, "wrong xreg state for {}",
|
||||||
ASSERT_MSG(DSPLLE, m_xregs[R9].guest_reg == DSP_REG_STATIC, "wrong xreg state for {}", R9);
|
static_cast<u32>(R8));
|
||||||
|
ASSERT_MSG(DSPLLE, m_xregs[R9].guest_reg == DSP_REG_STATIC, "wrong xreg state for {}",
|
||||||
|
static_cast<u32>(R9));
|
||||||
#else
|
#else
|
||||||
ASSERT_MSG(DSPLLE, m_xregs[R8].guest_reg == DSP_REG_NONE, "wrong xreg state for {}", R8);
|
ASSERT_MSG(DSPLLE, m_xregs[R8].guest_reg == DSP_REG_NONE, "wrong xreg state for {}",
|
||||||
ASSERT_MSG(DSPLLE, m_xregs[R9].guest_reg == DSP_REG_NONE, "wrong xreg state for {}", R9);
|
static_cast<u32>(R8));
|
||||||
|
ASSERT_MSG(DSPLLE, m_xregs[R9].guest_reg == DSP_REG_NONE, "wrong xreg state for {}",
|
||||||
|
static_cast<u32>(R9));
|
||||||
#endif
|
#endif
|
||||||
ASSERT_MSG(DSPLLE, m_xregs[R10].guest_reg == DSP_REG_NONE, "wrong xreg state for {}", R10);
|
ASSERT_MSG(DSPLLE, m_xregs[R10].guest_reg == DSP_REG_NONE, "wrong xreg state for {}",
|
||||||
ASSERT_MSG(DSPLLE, m_xregs[R11].guest_reg == DSP_REG_NONE, "wrong xreg state for {}", R11);
|
static_cast<u32>(R10));
|
||||||
ASSERT_MSG(DSPLLE, m_xregs[R12].guest_reg == DSP_REG_NONE, "wrong xreg state for {}", R12);
|
ASSERT_MSG(DSPLLE, m_xregs[R11].guest_reg == DSP_REG_NONE, "wrong xreg state for {}",
|
||||||
ASSERT_MSG(DSPLLE, m_xregs[R13].guest_reg == DSP_REG_NONE, "wrong xreg state for {}", R13);
|
static_cast<u32>(R11));
|
||||||
ASSERT_MSG(DSPLLE, m_xregs[R14].guest_reg == DSP_REG_NONE, "wrong xreg state for {}", R14);
|
ASSERT_MSG(DSPLLE, m_xregs[R12].guest_reg == DSP_REG_NONE, "wrong xreg state for {}",
|
||||||
ASSERT_MSG(DSPLLE, m_xregs[R15].guest_reg == DSP_REG_STATIC, "wrong xreg state for {}", R15);
|
static_cast<u32>(R12));
|
||||||
|
ASSERT_MSG(DSPLLE, m_xregs[R13].guest_reg == DSP_REG_NONE, "wrong xreg state for {}",
|
||||||
|
static_cast<u32>(R13));
|
||||||
|
ASSERT_MSG(DSPLLE, m_xregs[R14].guest_reg == DSP_REG_NONE, "wrong xreg state for {}",
|
||||||
|
static_cast<u32>(R14));
|
||||||
|
ASSERT_MSG(DSPLLE, m_xregs[R15].guest_reg == DSP_REG_STATIC, "wrong xreg state for {}",
|
||||||
|
static_cast<u32>(R15));
|
||||||
|
|
||||||
m_use_ctr = 0;
|
m_use_ctr = 0;
|
||||||
}
|
}
|
||||||
|
@ -968,15 +983,15 @@ void DSPJitRegCache::SpillXReg(X64Reg reg)
|
||||||
if (m_xregs[reg].guest_reg <= DSP_REG_MAX_MEM_BACKED)
|
if (m_xregs[reg].guest_reg <= DSP_REG_MAX_MEM_BACKED)
|
||||||
{
|
{
|
||||||
ASSERT_MSG(DSPLLE, !m_regs[m_xregs[reg].guest_reg].used,
|
ASSERT_MSG(DSPLLE, !m_regs[m_xregs[reg].guest_reg].used,
|
||||||
"to be spilled host reg {:#x} (guest reg {:#x}) still in use!", reg,
|
"to be spilled host reg {:#x} (guest reg {:#x}) still in use!",
|
||||||
m_xregs[reg].guest_reg);
|
static_cast<u32>(reg), m_xregs[reg].guest_reg);
|
||||||
|
|
||||||
MovToMemory(m_xregs[reg].guest_reg);
|
MovToMemory(m_xregs[reg].guest_reg);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ASSERT_MSG(DSPLLE, m_xregs[reg].guest_reg == DSP_REG_NONE,
|
ASSERT_MSG(DSPLLE, m_xregs[reg].guest_reg == DSP_REG_NONE,
|
||||||
"to be spilled host reg {:#x} still in use!", reg);
|
"to be spilled host reg {:#x} still in use!", static_cast<u32>(reg));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1021,7 +1036,7 @@ void DSPJitRegCache::GetXReg(X64Reg reg)
|
||||||
{
|
{
|
||||||
if (m_xregs[reg].guest_reg == DSP_REG_STATIC)
|
if (m_xregs[reg].guest_reg == DSP_REG_STATIC)
|
||||||
{
|
{
|
||||||
ERROR_LOG_FMT(DSPLLE, "Trying to get statically used XReg {}", reg);
|
ERROR_LOG_FMT(DSPLLE, "Trying to get statically used XReg {}", static_cast<u32>(reg));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1037,7 +1052,7 @@ void DSPJitRegCache::PutXReg(X64Reg reg)
|
||||||
{
|
{
|
||||||
if (m_xregs[reg].guest_reg == DSP_REG_STATIC)
|
if (m_xregs[reg].guest_reg == DSP_REG_STATIC)
|
||||||
{
|
{
|
||||||
ERROR_LOG_FMT(DSPLLE, "Trying to put statically used XReg {}", reg);
|
ERROR_LOG_FMT(DSPLLE, "Trying to put statically used XReg {}", static_cast<u32>(reg));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,15 +14,12 @@
|
||||||
#include "Core/Config/MainSettings.h"
|
#include "Core/Config/MainSettings.h"
|
||||||
#include "Core/HW/Memmap.h"
|
#include "Core/HW/Memmap.h"
|
||||||
|
|
||||||
enum
|
constexpr u32 FILE_ID = 0x0d01f1f0;
|
||||||
{
|
constexpr u32 VERSION_NUMBER = 5;
|
||||||
FILE_ID = 0x0d01f1f0,
|
constexpr u32 MIN_LOADER_VERSION = 1;
|
||||||
VERSION_NUMBER = 5,
|
|
||||||
MIN_LOADER_VERSION = 1,
|
|
||||||
// This value is only used if the DFF file was created with overridden RAM sizes.
|
// This value is only used if the DFF file was created with overridden RAM sizes.
|
||||||
// If the MIN_LOADER_VERSION ever exceeds this, it's alright to remove it.
|
// If the MIN_LOADER_VERSION ever exceeds this, it's alright to remove it.
|
||||||
MIN_LOADER_VERSION_FOR_RAM_OVERRIDE = 5,
|
constexpr u32 MIN_LOADER_VERSION_FOR_RAM_OVERRIDE = 5;
|
||||||
};
|
|
||||||
|
|
||||||
#pragma pack(push, 1)
|
#pragma pack(push, 1)
|
||||||
|
|
||||||
|
|
|
@ -210,7 +210,7 @@ void Wiimote::HandleExtensionSwap(ExtensionNumber desired_extension_number,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
INFO_LOG_FMT(WIIMOTE, "Switching to Extension {} (Wiimote {} in slot {})",
|
INFO_LOG_FMT(WIIMOTE, "Switching to Extension {} (Wiimote {} in slot {})",
|
||||||
desired_extension_number, m_index, m_bt_device_index);
|
static_cast<u8>(desired_extension_number), m_index, m_bt_device_index);
|
||||||
|
|
||||||
m_active_extension = desired_extension_number;
|
m_active_extension = desired_extension_number;
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,7 +91,7 @@ ESDevice::ESDevice(Kernel& ios, const std::string& device_name) : Device(ios, de
|
||||||
if (result != FS::ResultCode::Success && result != FS::ResultCode::AlreadyExists)
|
if (result != FS::ResultCode::Success && result != FS::ResultCode::AlreadyExists)
|
||||||
{
|
{
|
||||||
ERROR_LOG_FMT(IOS_ES, "Failed to create {}: error {}", directory.path,
|
ERROR_LOG_FMT(IOS_ES, "Failed to create {}: error {}", directory.path,
|
||||||
FS::ConvertResult(result));
|
static_cast<s32>(FS::ConvertResult(result)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now update the UID/GID and other attributes.
|
// Now update the UID/GID and other attributes.
|
||||||
|
@ -1060,7 +1060,8 @@ ReturnCode ESDevice::VerifyContainer(VerifyContainerType type, VerifyMode mode,
|
||||||
ret = iosc.ImportCertificate(ca_cert, IOSC::HANDLE_ROOT_KEY, ca_handle, PID_ES);
|
ret = iosc.ImportCertificate(ca_cert, IOSC::HANDLE_ROOT_KEY, ca_handle, PID_ES);
|
||||||
if (ret != IPC_SUCCESS)
|
if (ret != IPC_SUCCESS)
|
||||||
{
|
{
|
||||||
ERROR_LOG_FMT(IOS_ES, "VerifyContainer: IOSC_ImportCertificate(ca) failed with error {}", ret);
|
ERROR_LOG_FMT(IOS_ES, "VerifyContainer: IOSC_ImportCertificate(ca) failed with error {}",
|
||||||
|
static_cast<s32>(ret));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1075,7 +1076,7 @@ ReturnCode ESDevice::VerifyContainer(VerifyContainerType type, VerifyMode mode,
|
||||||
if (ret != IPC_SUCCESS)
|
if (ret != IPC_SUCCESS)
|
||||||
{
|
{
|
||||||
ERROR_LOG_FMT(IOS_ES, "VerifyContainer: IOSC_ImportCertificate(issuer) failed with error {}",
|
ERROR_LOG_FMT(IOS_ES, "VerifyContainer: IOSC_ImportCertificate(issuer) failed with error {}",
|
||||||
ret);
|
static_cast<s32>(ret));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1084,7 +1085,8 @@ ReturnCode ESDevice::VerifyContainer(VerifyContainerType type, VerifyMode mode,
|
||||||
ret = iosc.VerifyPublicKeySign(signed_blob.GetSha1(), issuer_handle, signature, PID_ES);
|
ret = iosc.VerifyPublicKeySign(signed_blob.GetSha1(), issuer_handle, signature, PID_ES);
|
||||||
if (ret != IPC_SUCCESS)
|
if (ret != IPC_SUCCESS)
|
||||||
{
|
{
|
||||||
ERROR_LOG_FMT(IOS_ES, "VerifyContainer: IOSC_VerifyPublicKeySign failed with error {}", ret);
|
ERROR_LOG_FMT(IOS_ES, "VerifyContainer: IOSC_VerifyPublicKeySign failed with error {}",
|
||||||
|
static_cast<s32>(ret));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1094,12 +1096,13 @@ ReturnCode ESDevice::VerifyContainer(VerifyContainerType type, VerifyMode mode,
|
||||||
if (ret != IPC_SUCCESS)
|
if (ret != IPC_SUCCESS)
|
||||||
{
|
{
|
||||||
ERROR_LOG_FMT(IOS_ES, "VerifyContainer: Writing the issuer cert failed with return code {}",
|
ERROR_LOG_FMT(IOS_ES, "VerifyContainer: Writing the issuer cert failed with return code {}",
|
||||||
ret);
|
static_cast<s32>(ret));
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = WriteNewCertToStore(ca_cert);
|
ret = WriteNewCertToStore(ca_cert);
|
||||||
if (ret != IPC_SUCCESS)
|
if (ret != IPC_SUCCESS)
|
||||||
ERROR_LOG_FMT(IOS_ES, "VerifyContainer: Writing the CA cert failed with return code {}", ret);
|
ERROR_LOG_FMT(IOS_ES, "VerifyContainer: Writing the CA cert failed with return code {}",
|
||||||
|
static_cast<s32>(ret));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret == IPC_SUCCESS && issuer_handle_out)
|
if (ret == IPC_SUCCESS && issuer_handle_out)
|
||||||
|
|
|
@ -146,14 +146,16 @@ ReturnCode ESDevice::VerifySign(const std::vector<u8>& hash, const std::vector<u
|
||||||
certs_bytes, ng_cert);
|
certs_bytes, ng_cert);
|
||||||
if (ret != IPC_SUCCESS)
|
if (ret != IPC_SUCCESS)
|
||||||
{
|
{
|
||||||
ERROR_LOG_FMT(IOS_ES, "VerifySign: VerifyContainer(ng) failed with error {}", ret);
|
ERROR_LOG_FMT(IOS_ES, "VerifySign: VerifyContainer(ng) failed with error {}",
|
||||||
|
static_cast<s32>(ret));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = iosc.VerifyPublicKeySign(ap.GetSha1(), ng_cert, ap.GetSignatureData(), PID_ES);
|
ret = iosc.VerifyPublicKeySign(ap.GetSha1(), ng_cert, ap.GetSignatureData(), PID_ES);
|
||||||
if (ret != IPC_SUCCESS)
|
if (ret != IPC_SUCCESS)
|
||||||
{
|
{
|
||||||
ERROR_LOG_FMT(IOS_ES, "VerifySign: IOSC_VerifyPublicKeySign(ap) failed with error {}", ret);
|
ERROR_LOG_FMT(IOS_ES, "VerifySign: IOSC_VerifyPublicKeySign(ap) failed with error {}",
|
||||||
|
static_cast<s32>(ret));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,7 +168,8 @@ ReturnCode ESDevice::VerifySign(const std::vector<u8>& hash, const std::vector<u
|
||||||
ret = iosc.ImportPublicKey(ap_cert, ap.GetPublicKey().data(), nullptr, PID_ES);
|
ret = iosc.ImportPublicKey(ap_cert, ap.GetPublicKey().data(), nullptr, PID_ES);
|
||||||
if (ret != IPC_SUCCESS)
|
if (ret != IPC_SUCCESS)
|
||||||
{
|
{
|
||||||
ERROR_LOG_FMT(IOS_ES, "VerifySign: IOSC_ImportPublicKey(ap) failed with error {}", ret);
|
ERROR_LOG_FMT(IOS_ES, "VerifySign: IOSC_ImportPublicKey(ap) failed with error {}",
|
||||||
|
static_cast<s32>(ret));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -174,7 +177,8 @@ ReturnCode ESDevice::VerifySign(const std::vector<u8>& hash, const std::vector<u
|
||||||
ret = iosc.VerifyPublicKeySign(hash_digest, ap_cert, ecc_signature, PID_ES);
|
ret = iosc.VerifyPublicKeySign(hash_digest, ap_cert, ecc_signature, PID_ES);
|
||||||
if (ret != IPC_SUCCESS)
|
if (ret != IPC_SUCCESS)
|
||||||
{
|
{
|
||||||
ERROR_LOG_FMT(IOS_ES, "VerifySign: IOSC_VerifyPublicKeySign(data) failed with error {}", ret);
|
ERROR_LOG_FMT(IOS_ES, "VerifySign: IOSC_VerifyPublicKeySign(data) failed with error {}",
|
||||||
|
static_cast<s32>(ret));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@ ReturnCode ESDevice::ImportTicket(const std::vector<u8>& ticket_bytes,
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
ERROR_LOG_FMT(IOS_ES, "ImportTicket: Failed to unpersonalise ticket for {:016x} ({})",
|
ERROR_LOG_FMT(IOS_ES, "ImportTicket: Failed to unpersonalise ticket for {:016x} ({})",
|
||||||
ticket.GetTitleId(), ret);
|
ticket.GetTitleId(), static_cast<s32>(ret));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -156,7 +156,7 @@ ReturnCode ESDevice::ImportTmd(Context& context, const std::vector<u8>& tmd_byte
|
||||||
context.title_import_export.tmd, cert_store);
|
context.title_import_export.tmd, cert_store);
|
||||||
if (ret != IPC_SUCCESS)
|
if (ret != IPC_SUCCESS)
|
||||||
{
|
{
|
||||||
ERROR_LOG_FMT(IOS_ES, "ImportTmd: VerifyContainer failed with error {}", ret);
|
ERROR_LOG_FMT(IOS_ES, "ImportTmd: VerifyContainer failed with error {}", static_cast<s32>(ret));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -170,7 +170,7 @@ ReturnCode ESDevice::ImportTmd(Context& context, const std::vector<u8>& tmd_byte
|
||||||
&context.title_import_export.key_handle);
|
&context.title_import_export.key_handle);
|
||||||
if (ret != IPC_SUCCESS)
|
if (ret != IPC_SUCCESS)
|
||||||
{
|
{
|
||||||
ERROR_LOG_FMT(IOS_ES, "ImportTmd: InitBackupKey failed with error {}", ret);
|
ERROR_LOG_FMT(IOS_ES, "ImportTmd: InitBackupKey failed with error {}", static_cast<s32>(ret));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -109,7 +109,7 @@ static void LogResult(ResultCode code, fmt::format_string<Args...> format, Args&
|
||||||
code == ResultCode::Success ? Common::Log::LogLevel::LINFO : Common::Log::LogLevel::LERROR;
|
code == ResultCode::Success ? Common::Log::LogLevel::LINFO : Common::Log::LogLevel::LERROR;
|
||||||
|
|
||||||
GENERIC_LOG_FMT(Common::Log::LogType::IOS_FS, type, "Command: {}: Result {}", command,
|
GENERIC_LOG_FMT(Common::Log::LogType::IOS_FS, type, "Command: {}: Result {}", command,
|
||||||
ConvertResult(code));
|
static_cast<s32>(ConvertResult(code)));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, typename... Args>
|
template <typename T, typename... Args>
|
||||||
|
|
|
@ -616,7 +616,8 @@ std::shared_ptr<Device> EmulationKernel::GetDeviceByName(std::string_view device
|
||||||
std::optional<IPCReply> Kernel::OpenDevice(OpenRequest& request)
|
std::optional<IPCReply> Kernel::OpenDevice(OpenRequest& request)
|
||||||
{
|
{
|
||||||
const s32 new_fd = GetFreeDeviceID();
|
const s32 new_fd = GetFreeDeviceID();
|
||||||
INFO_LOG_FMT(IOS, "Opening {} (mode {}, fd {})", request.path, request.flags, new_fd);
|
INFO_LOG_FMT(IOS, "Opening {} (mode {}, fd {})", request.path, static_cast<u32>(request.flags),
|
||||||
|
new_fd);
|
||||||
if (new_fd < 0 || new_fd >= IPC_MAX_FDS)
|
if (new_fd < 0 || new_fd >= IPC_MAX_FDS)
|
||||||
{
|
{
|
||||||
ERROR_LOG_FMT(IOS, "Couldn't get a free fd, too many open files");
|
ERROR_LOG_FMT(IOS, "Couldn't get a free fd, too many open files");
|
||||||
|
@ -694,7 +695,7 @@ std::optional<IPCReply> Kernel::HandleIPCCommand(const Request& request)
|
||||||
ret = device->IOCtlV(IOCtlVRequest{request.address});
|
ret = device->IOCtlV(IOCtlVRequest{request.address});
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ASSERT_MSG(IOS, false, "Unexpected command: {:#x}", request.command);
|
ASSERT_MSG(IOS, false, "Unexpected command: {:#x}", static_cast<u32>(request.command));
|
||||||
ret = IPCReply{IPC_EINVAL, 978_tbticks};
|
ret = IPCReply{IPC_EINVAL, 978_tbticks};
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -210,7 +210,8 @@ static ErrorCode WriteFile(const std::string& filename, const std::vector<u8>& t
|
||||||
f_write(&dst, tmp_buffer.data() + offset, chunk_size, &written_size);
|
f_write(&dst, tmp_buffer.data() + offset, chunk_size, &written_size);
|
||||||
if (write_error_code != FR_OK)
|
if (write_error_code != FR_OK)
|
||||||
{
|
{
|
||||||
ERROR_LOG_FMT(IOS_WC24, "Failed to write file {} to VFF {}", filename, write_error_code);
|
ERROR_LOG_FMT(IOS_WC24, "Failed to write file {} to VFF: {}", filename,
|
||||||
|
static_cast<u32>(write_error_code));
|
||||||
return WC24_ERR_FILE_WRITE;
|
return WC24_ERR_FILE_WRITE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -284,7 +284,7 @@ public:
|
||||||
if (socket_entry == WiiSockets.end())
|
if (socket_entry == WiiSockets.end())
|
||||||
{
|
{
|
||||||
ERROR_LOG_FMT(IOS_NET, "DoSock: Error, fd not found ({:08x}, {:08X}, {:08X})", sock,
|
ERROR_LOG_FMT(IOS_NET, "DoSock: Error, fd not found ({:08x}, {:08X}, {:08X})", sock,
|
||||||
request.address, type);
|
request.address, static_cast<u32>(type));
|
||||||
GetIOS()->EnqueueIPCReply(request, -SO_EBADF);
|
GetIOS()->EnqueueIPCReply(request, -SO_EBADF);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -666,7 +666,8 @@ void BluetoothRealDevice::HandleCtrlTransfer(libusb_transfer* tr)
|
||||||
|
|
||||||
if (tr->status != LIBUSB_TRANSFER_COMPLETED && tr->status != LIBUSB_TRANSFER_NO_DEVICE)
|
if (tr->status != LIBUSB_TRANSFER_COMPLETED && tr->status != LIBUSB_TRANSFER_NO_DEVICE)
|
||||||
{
|
{
|
||||||
ERROR_LOG_FMT(IOS_WIIMOTE, "libusb command transfer failed, status: {:#04x}", tr->status);
|
ERROR_LOG_FMT(IOS_WIIMOTE, "libusb command transfer failed, status: {:#04x}",
|
||||||
|
static_cast<u32>(tr->status));
|
||||||
if (!m_showed_failed_transfer.IsSet())
|
if (!m_showed_failed_transfer.IsSet())
|
||||||
{
|
{
|
||||||
Core::DisplayMessage("Failed to send a command to the Bluetooth adapter.", 10000);
|
Core::DisplayMessage("Failed to send a command to the Bluetooth adapter.", 10000);
|
||||||
|
@ -693,7 +694,8 @@ void BluetoothRealDevice::HandleBulkOrIntrTransfer(libusb_transfer* tr)
|
||||||
if (tr->status != LIBUSB_TRANSFER_COMPLETED && tr->status != LIBUSB_TRANSFER_TIMED_OUT &&
|
if (tr->status != LIBUSB_TRANSFER_COMPLETED && tr->status != LIBUSB_TRANSFER_TIMED_OUT &&
|
||||||
tr->status != LIBUSB_TRANSFER_NO_DEVICE)
|
tr->status != LIBUSB_TRANSFER_NO_DEVICE)
|
||||||
{
|
{
|
||||||
ERROR_LOG_FMT(IOS_WIIMOTE, "libusb transfer failed, status: {:#04x}", tr->status);
|
ERROR_LOG_FMT(IOS_WIIMOTE, "libusb transfer failed, status: {:#04x}",
|
||||||
|
static_cast<u32>(tr->status));
|
||||||
if (!m_showed_failed_transfer.IsSet())
|
if (!m_showed_failed_transfer.IsSet())
|
||||||
{
|
{
|
||||||
Core::DisplayMessage("Failed to transfer to or from to the Bluetooth adapter.", 10000);
|
Core::DisplayMessage("Failed to transfer to or from to the Bluetooth adapter.", 10000);
|
||||||
|
|
|
@ -138,7 +138,7 @@ std::optional<IPCReply> WFSIDevice::IOCtl(const IOCtlRequest& request)
|
||||||
m_continue_install = Memory::Read_U32(request.buffer_in + 36);
|
m_continue_install = Memory::Read_U32(request.buffer_in + 36);
|
||||||
|
|
||||||
INFO_LOG_FMT(IOS_WFS, "IOCTL_WFSI_IMPORT_TITLE_INIT: patch type {}, continue install: {}",
|
INFO_LOG_FMT(IOS_WFS, "IOCTL_WFSI_IMPORT_TITLE_INIT: patch type {}, continue install: {}",
|
||||||
m_patch_type, m_continue_install ? "true" : "false");
|
static_cast<u32>(m_patch_type), m_continue_install ? "true" : "false");
|
||||||
|
|
||||||
if (m_patch_type == PatchType::PATCH_TYPE_2)
|
if (m_patch_type == PatchType::PATCH_TYPE_2)
|
||||||
{
|
{
|
||||||
|
|
|
@ -389,7 +389,7 @@ void RegCache::Discard(BitSet32 pregs)
|
||||||
for (preg_t i : pregs)
|
for (preg_t i : pregs)
|
||||||
{
|
{
|
||||||
ASSERT_MSG(DYNA_REC, !m_regs[i].IsLocked(), "Someone forgot to unlock PPC reg {} (X64 reg {}).",
|
ASSERT_MSG(DYNA_REC, !m_regs[i].IsLocked(), "Someone forgot to unlock PPC reg {} (X64 reg {}).",
|
||||||
i, RX(i));
|
i, static_cast<u32>(RX(i)));
|
||||||
ASSERT_MSG(DYNA_REC, !m_regs[i].IsRevertable(), "Register transaction is in progress for {}!",
|
ASSERT_MSG(DYNA_REC, !m_regs[i].IsRevertable(), "Register transaction is in progress for {}!",
|
||||||
i);
|
i);
|
||||||
|
|
||||||
|
@ -413,7 +413,7 @@ void RegCache::Flush(BitSet32 pregs)
|
||||||
for (preg_t i : pregs)
|
for (preg_t i : pregs)
|
||||||
{
|
{
|
||||||
ASSERT_MSG(DYNA_REC, !m_regs[i].IsLocked(), "Someone forgot to unlock PPC reg {} (X64 reg {}).",
|
ASSERT_MSG(DYNA_REC, !m_regs[i].IsLocked(), "Someone forgot to unlock PPC reg {} (X64 reg {}).",
|
||||||
i, RX(i));
|
i, static_cast<u32>(RX(i)));
|
||||||
ASSERT_MSG(DYNA_REC, !m_regs[i].IsRevertable(), "Register transaction is in progress for {}!",
|
ASSERT_MSG(DYNA_REC, !m_regs[i].IsRevertable(), "Register transaction is in progress for {}!",
|
||||||
i);
|
i);
|
||||||
|
|
||||||
|
@ -497,7 +497,7 @@ BitSet32 RegCache::RegistersInUse() const
|
||||||
|
|
||||||
void RegCache::FlushX(X64Reg reg)
|
void RegCache::FlushX(X64Reg reg)
|
||||||
{
|
{
|
||||||
ASSERT_MSG(DYNA_REC, reg < m_xregs.size(), "Flushing non-existent reg {}", reg);
|
ASSERT_MSG(DYNA_REC, reg < m_xregs.size(), "Flushing non-existent reg {}", static_cast<u32>(reg));
|
||||||
ASSERT(!m_xregs[reg].IsLocked());
|
ASSERT(!m_xregs[reg].IsLocked());
|
||||||
if (!m_xregs[reg].IsFree())
|
if (!m_xregs[reg].IsFree())
|
||||||
{
|
{
|
||||||
|
@ -521,7 +521,7 @@ void RegCache::BindToRegister(preg_t i, bool doLoad, bool makeDirty)
|
||||||
{
|
{
|
||||||
X64Reg xr = GetFreeXReg();
|
X64Reg xr = GetFreeXReg();
|
||||||
|
|
||||||
ASSERT_MSG(DYNA_REC, !m_xregs[xr].IsDirty(), "Xreg {} already dirty", xr);
|
ASSERT_MSG(DYNA_REC, !m_xregs[xr].IsDirty(), "Xreg {} already dirty", static_cast<u32>(xr));
|
||||||
ASSERT_MSG(DYNA_REC, !m_xregs[xr].IsLocked(), "GetFreeXReg returned locked register");
|
ASSERT_MSG(DYNA_REC, !m_xregs[xr].IsLocked(), "GetFreeXReg returned locked register");
|
||||||
ASSERT_MSG(DYNA_REC, !m_regs[i].IsRevertable(), "Invalid transaction state");
|
ASSERT_MSG(DYNA_REC, !m_regs[i].IsRevertable(), "Invalid transaction state");
|
||||||
|
|
||||||
|
@ -538,7 +538,7 @@ void RegCache::BindToRegister(preg_t i, bool doLoad, bool makeDirty)
|
||||||
[xr](const auto& r) {
|
[xr](const auto& r) {
|
||||||
return r.Location().has_value() && r.Location()->IsSimpleReg(xr);
|
return r.Location().has_value() && r.Location()->IsSimpleReg(xr);
|
||||||
}),
|
}),
|
||||||
"Xreg {} already bound", xr);
|
"Xreg {} already bound", static_cast<u32>(xr));
|
||||||
|
|
||||||
m_regs[i].SetBoundTo(xr);
|
m_regs[i].SetBoundTo(xr);
|
||||||
}
|
}
|
||||||
|
@ -551,7 +551,7 @@ void RegCache::BindToRegister(preg_t i, bool doLoad, bool makeDirty)
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT_MSG(DYNA_REC, !m_xregs[RX(i)].IsLocked(),
|
ASSERT_MSG(DYNA_REC, !m_xregs[RX(i)].IsLocked(),
|
||||||
"WTF, this reg ({} -> {}) should have been flushed", i, RX(i));
|
"WTF, this reg ({} -> {}) should have been flushed", i, static_cast<u32>(RX(i)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void RegCache::StoreFromRegister(preg_t i, FlushMode mode)
|
void RegCache::StoreFromRegister(preg_t i, FlushMode mode)
|
||||||
|
|
|
@ -369,7 +369,8 @@ const u8* CommonAsmRoutines::GenQuantizedStoreRuntime(bool single, EQuantizeType
|
||||||
const u8* load = AlignCode4();
|
const u8* load = AlignCode4();
|
||||||
GenQuantizedStore(single, type, -1);
|
GenQuantizedStore(single, type, -1);
|
||||||
RET();
|
RET();
|
||||||
JitRegister::Register(start, GetCodePtr(), "JIT_QuantizedStore_{}_{}", type, single);
|
JitRegister::Register(start, GetCodePtr(), "JIT_QuantizedStore_{}_{}", static_cast<u32>(type),
|
||||||
|
single);
|
||||||
|
|
||||||
return load;
|
return load;
|
||||||
}
|
}
|
||||||
|
@ -400,7 +401,8 @@ const u8* CommonAsmRoutines::GenQuantizedLoadRuntime(bool single, EQuantizeType
|
||||||
const u8* load = AlignCode4();
|
const u8* load = AlignCode4();
|
||||||
GenQuantizedLoad(single, type, -1);
|
GenQuantizedLoad(single, type, -1);
|
||||||
RET();
|
RET();
|
||||||
JitRegister::Register(start, GetCodePtr(), "JIT_QuantizedLoad_{}_{}", type, single);
|
JitRegister::Register(start, GetCodePtr(), "JIT_QuantizedLoad_{}_{}", static_cast<u32>(type),
|
||||||
|
single);
|
||||||
|
|
||||||
return load;
|
return load;
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,7 @@ static bool ImportWAD(IOS::HLE::Kernel& ios, const DiscIO::VolumeWAD& wad,
|
||||||
if (ret != IOS::HLE::IOSC_FAIL_CHECKVALUE)
|
if (ret != IOS::HLE::IOSC_FAIL_CHECKVALUE)
|
||||||
{
|
{
|
||||||
PanicAlertFmtT("WAD installation failed: Could not initialise title import (error {0}).",
|
PanicAlertFmtT("WAD installation failed: Could not initialise title import (error {0}).",
|
||||||
ret);
|
static_cast<u32>(ret));
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -548,7 +548,7 @@ UpdateResult OnlineSystemUpdater::InstallTitleFromNUS(const std::string& prefix_
|
||||||
const auto es = m_ios.GetES();
|
const auto es = m_ios.GetES();
|
||||||
if ((ret = es->ImportTicket(ticket.first, ticket.second)) < 0)
|
if ((ret = es->ImportTicket(ticket.first, ticket.second)) < 0)
|
||||||
{
|
{
|
||||||
ERROR_LOG_FMT(CORE, "Failed to import ticket: error {}", ret);
|
ERROR_LOG_FMT(CORE, "Failed to import ticket: error {}", static_cast<u32>(ret));
|
||||||
return UpdateResult::ImportFailed;
|
return UpdateResult::ImportFailed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -580,7 +580,7 @@ UpdateResult OnlineSystemUpdater::InstallTitleFromNUS(const std::string& prefix_
|
||||||
IOS::HLE::ESDevice::Context context;
|
IOS::HLE::ESDevice::Context context;
|
||||||
if ((ret = es->ImportTitleInit(context, tmd.first.GetBytes(), tmd.second)) < 0)
|
if ((ret = es->ImportTitleInit(context, tmd.first.GetBytes(), tmd.second)) < 0)
|
||||||
{
|
{
|
||||||
ERROR_LOG_FMT(CORE, "Failed to initialise title import: error {}", ret);
|
ERROR_LOG_FMT(CORE, "Failed to initialise title import: error {}", static_cast<u32>(ret));
|
||||||
return UpdateResult::ImportFailed;
|
return UpdateResult::ImportFailed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -601,7 +601,7 @@ UpdateResult OnlineSystemUpdater::InstallTitleFromNUS(const std::string& prefix_
|
||||||
if ((ret = es->ImportContentBegin(context, title.id, content.id)) < 0)
|
if ((ret = es->ImportContentBegin(context, title.id, content.id)) < 0)
|
||||||
{
|
{
|
||||||
ERROR_LOG_FMT(CORE, "Failed to initialise import for content {:08x}: error {}", content.id,
|
ERROR_LOG_FMT(CORE, "Failed to initialise import for content {:08x}: error {}", content.id,
|
||||||
ret);
|
static_cast<u32>(ret));
|
||||||
return UpdateResult::ImportFailed;
|
return UpdateResult::ImportFailed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -626,7 +626,7 @@ UpdateResult OnlineSystemUpdater::InstallTitleFromNUS(const std::string& prefix_
|
||||||
if ((all_contents_imported && (ret = es->ImportTitleDone(context)) < 0) ||
|
if ((all_contents_imported && (ret = es->ImportTitleDone(context)) < 0) ||
|
||||||
(!all_contents_imported && (ret = es->ImportTitleCancel(context)) < 0))
|
(!all_contents_imported && (ret = es->ImportTitleCancel(context)) < 0))
|
||||||
{
|
{
|
||||||
ERROR_LOG_FMT(CORE, "Failed to finalise title import: error {}", ret);
|
ERROR_LOG_FMT(CORE, "Failed to finalise title import: error {}", static_cast<u32>(ret));
|
||||||
return UpdateResult::ImportFailed;
|
return UpdateResult::ImportFailed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -107,20 +107,20 @@ D3DVertexFormat::D3DVertexFormat(const PortableVertexDeclaration& vtx_decl)
|
||||||
if (format->enable)
|
if (format->enable)
|
||||||
{
|
{
|
||||||
m_elems[m_num_elems].SemanticName = "TEXCOORD";
|
m_elems[m_num_elems].SemanticName = "TEXCOORD";
|
||||||
m_elems[m_num_elems].SemanticIndex = SHADER_POSITION_ATTRIB;
|
m_elems[m_num_elems].SemanticIndex = static_cast<u32>(ShaderAttrib::Position);
|
||||||
m_elems[m_num_elems].AlignedByteOffset = format->offset;
|
m_elems[m_num_elems].AlignedByteOffset = format->offset;
|
||||||
m_elems[m_num_elems].Format = VarToD3D(format->type, format->components, format->integer);
|
m_elems[m_num_elems].Format = VarToD3D(format->type, format->components, format->integer);
|
||||||
m_elems[m_num_elems].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
|
m_elems[m_num_elems].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
|
||||||
++m_num_elems;
|
++m_num_elems;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 3; i++)
|
for (u32 i = 0; i < 3; i++)
|
||||||
{
|
{
|
||||||
format = &vtx_decl.normals[i];
|
format = &vtx_decl.normals[i];
|
||||||
if (format->enable)
|
if (format->enable)
|
||||||
{
|
{
|
||||||
m_elems[m_num_elems].SemanticName = "TEXCOORD";
|
m_elems[m_num_elems].SemanticName = "TEXCOORD";
|
||||||
m_elems[m_num_elems].SemanticIndex = SHADER_NORMAL_ATTRIB + i;
|
m_elems[m_num_elems].SemanticIndex = static_cast<u32>(ShaderAttrib::Normal + i);
|
||||||
m_elems[m_num_elems].AlignedByteOffset = format->offset;
|
m_elems[m_num_elems].AlignedByteOffset = format->offset;
|
||||||
m_elems[m_num_elems].Format = VarToD3D(format->type, format->components, format->integer);
|
m_elems[m_num_elems].Format = VarToD3D(format->type, format->components, format->integer);
|
||||||
m_elems[m_num_elems].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
|
m_elems[m_num_elems].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
|
||||||
|
@ -128,13 +128,13 @@ D3DVertexFormat::D3DVertexFormat(const PortableVertexDeclaration& vtx_decl)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 2; i++)
|
for (u32 i = 0; i < 2; i++)
|
||||||
{
|
{
|
||||||
format = &vtx_decl.colors[i];
|
format = &vtx_decl.colors[i];
|
||||||
if (format->enable)
|
if (format->enable)
|
||||||
{
|
{
|
||||||
m_elems[m_num_elems].SemanticName = "TEXCOORD";
|
m_elems[m_num_elems].SemanticName = "TEXCOORD";
|
||||||
m_elems[m_num_elems].SemanticIndex = SHADER_COLOR0_ATTRIB + i;
|
m_elems[m_num_elems].SemanticIndex = static_cast<u32>(ShaderAttrib::Color0 + i);
|
||||||
m_elems[m_num_elems].AlignedByteOffset = format->offset;
|
m_elems[m_num_elems].AlignedByteOffset = format->offset;
|
||||||
m_elems[m_num_elems].Format = VarToD3D(format->type, format->components, format->integer);
|
m_elems[m_num_elems].Format = VarToD3D(format->type, format->components, format->integer);
|
||||||
m_elems[m_num_elems].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
|
m_elems[m_num_elems].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
|
||||||
|
@ -142,13 +142,13 @@ D3DVertexFormat::D3DVertexFormat(const PortableVertexDeclaration& vtx_decl)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 8; i++)
|
for (u32 i = 0; i < 8; i++)
|
||||||
{
|
{
|
||||||
format = &vtx_decl.texcoords[i];
|
format = &vtx_decl.texcoords[i];
|
||||||
if (format->enable)
|
if (format->enable)
|
||||||
{
|
{
|
||||||
m_elems[m_num_elems].SemanticName = "TEXCOORD";
|
m_elems[m_num_elems].SemanticName = "TEXCOORD";
|
||||||
m_elems[m_num_elems].SemanticIndex = SHADER_TEXTURE0_ATTRIB + i;
|
m_elems[m_num_elems].SemanticIndex = static_cast<u32>(ShaderAttrib::TexCoord0 + i);
|
||||||
m_elems[m_num_elems].AlignedByteOffset = format->offset;
|
m_elems[m_num_elems].AlignedByteOffset = format->offset;
|
||||||
m_elems[m_num_elems].Format = VarToD3D(format->type, format->components, format->integer);
|
m_elems[m_num_elems].Format = VarToD3D(format->type, format->components, format->integer);
|
||||||
m_elems[m_num_elems].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
|
m_elems[m_num_elems].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
|
||||||
|
@ -160,7 +160,7 @@ D3DVertexFormat::D3DVertexFormat(const PortableVertexDeclaration& vtx_decl)
|
||||||
if (format->enable)
|
if (format->enable)
|
||||||
{
|
{
|
||||||
m_elems[m_num_elems].SemanticName = "TEXCOORD";
|
m_elems[m_num_elems].SemanticName = "TEXCOORD";
|
||||||
m_elems[m_num_elems].SemanticIndex = SHADER_POSMTX_ATTRIB;
|
m_elems[m_num_elems].SemanticIndex = static_cast<u32>(ShaderAttrib::PositionMatrix);
|
||||||
m_elems[m_num_elems].AlignedByteOffset = format->offset;
|
m_elems[m_num_elems].AlignedByteOffset = format->offset;
|
||||||
m_elems[m_num_elems].Format = VarToD3D(format->type, format->components, format->integer);
|
m_elems[m_num_elems].Format = VarToD3D(format->type, format->components, format->integer);
|
||||||
m_elems[m_num_elems].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
|
m_elems[m_num_elems].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
|
||||||
|
|
|
@ -59,14 +59,14 @@ void DXVertexFormat::GetInputLayoutDesc(D3D12_INPUT_LAYOUT_DESC* desc) const
|
||||||
desc->NumElements = m_num_attributes;
|
desc->NumElements = m_num_attributes;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DXVertexFormat::AddAttribute(const char* semantic_name, u32 semantic_index, u32 slot,
|
void DXVertexFormat::AddAttribute(const char* semantic_name, ShaderAttrib semantic_index, u32 slot,
|
||||||
DXGI_FORMAT format, u32 offset)
|
DXGI_FORMAT format, u32 offset)
|
||||||
{
|
{
|
||||||
ASSERT(m_num_attributes < MAX_VERTEX_ATTRIBUTES);
|
ASSERT(m_num_attributes < MAX_VERTEX_ATTRIBUTES);
|
||||||
|
|
||||||
auto* attr_desc = &m_attribute_descriptions[m_num_attributes];
|
auto* attr_desc = &m_attribute_descriptions[m_num_attributes];
|
||||||
attr_desc->SemanticName = semantic_name;
|
attr_desc->SemanticName = semantic_name;
|
||||||
attr_desc->SemanticIndex = semantic_index;
|
attr_desc->SemanticIndex = static_cast<u32>(semantic_index);
|
||||||
attr_desc->Format = format;
|
attr_desc->Format = format;
|
||||||
attr_desc->InputSlot = slot;
|
attr_desc->InputSlot = slot;
|
||||||
attr_desc->AlignedByteOffset = offset;
|
attr_desc->AlignedByteOffset = offset;
|
||||||
|
@ -83,38 +83,38 @@ void DXVertexFormat::MapAttributes()
|
||||||
if (m_decl.position.enable)
|
if (m_decl.position.enable)
|
||||||
{
|
{
|
||||||
AddAttribute(
|
AddAttribute(
|
||||||
"TEXCOORD", SHADER_POSITION_ATTRIB, 0,
|
"TEXCOORD", ShaderAttrib::Position, 0,
|
||||||
VarToDXGIFormat(m_decl.position.type, m_decl.position.components, m_decl.position.integer),
|
VarToDXGIFormat(m_decl.position.type, m_decl.position.components, m_decl.position.integer),
|
||||||
m_decl.position.offset);
|
m_decl.position.offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (uint32_t i = 0; i < 3; i++)
|
for (u32 i = 0; i < 3; i++)
|
||||||
{
|
{
|
||||||
if (m_decl.normals[i].enable)
|
if (m_decl.normals[i].enable)
|
||||||
{
|
{
|
||||||
AddAttribute("TEXCOORD", SHADER_NORMAL_ATTRIB + i, 0,
|
AddAttribute("TEXCOORD", ShaderAttrib::Normal + i, 0,
|
||||||
VarToDXGIFormat(m_decl.normals[i].type, m_decl.normals[i].components,
|
VarToDXGIFormat(m_decl.normals[i].type, m_decl.normals[i].components,
|
||||||
m_decl.normals[i].integer),
|
m_decl.normals[i].integer),
|
||||||
m_decl.normals[i].offset);
|
m_decl.normals[i].offset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (uint32_t i = 0; i < 2; i++)
|
for (u32 i = 0; i < 2; i++)
|
||||||
{
|
{
|
||||||
if (m_decl.colors[i].enable)
|
if (m_decl.colors[i].enable)
|
||||||
{
|
{
|
||||||
AddAttribute("TEXCOORD", SHADER_COLOR0_ATTRIB + i, 0,
|
AddAttribute("TEXCOORD", ShaderAttrib::Color0 + i, 0,
|
||||||
VarToDXGIFormat(m_decl.colors[i].type, m_decl.colors[i].components,
|
VarToDXGIFormat(m_decl.colors[i].type, m_decl.colors[i].components,
|
||||||
m_decl.colors[i].integer),
|
m_decl.colors[i].integer),
|
||||||
m_decl.colors[i].offset);
|
m_decl.colors[i].offset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (uint32_t i = 0; i < 8; i++)
|
for (u32 i = 0; i < 8; i++)
|
||||||
{
|
{
|
||||||
if (m_decl.texcoords[i].enable)
|
if (m_decl.texcoords[i].enable)
|
||||||
{
|
{
|
||||||
AddAttribute("TEXCOORD", SHADER_TEXTURE0_ATTRIB + i, 0,
|
AddAttribute("TEXCOORD", ShaderAttrib::TexCoord0 + i, 0,
|
||||||
VarToDXGIFormat(m_decl.texcoords[i].type, m_decl.texcoords[i].components,
|
VarToDXGIFormat(m_decl.texcoords[i].type, m_decl.texcoords[i].components,
|
||||||
m_decl.texcoords[i].integer),
|
m_decl.texcoords[i].integer),
|
||||||
m_decl.texcoords[i].offset);
|
m_decl.texcoords[i].offset);
|
||||||
|
@ -124,7 +124,7 @@ void DXVertexFormat::MapAttributes()
|
||||||
if (m_decl.posmtx.enable)
|
if (m_decl.posmtx.enable)
|
||||||
{
|
{
|
||||||
AddAttribute(
|
AddAttribute(
|
||||||
"TEXCOORD", SHADER_POSMTX_ATTRIB, 0,
|
"TEXCOORD", ShaderAttrib::PositionMatrix, 0,
|
||||||
VarToDXGIFormat(m_decl.posmtx.type, m_decl.posmtx.components, m_decl.posmtx.integer),
|
VarToDXGIFormat(m_decl.posmtx.type, m_decl.posmtx.components, m_decl.posmtx.integer),
|
||||||
m_decl.posmtx.offset);
|
m_decl.posmtx.offset);
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
#include "VideoCommon/NativeVertexFormat.h"
|
#include "VideoCommon/NativeVertexFormat.h"
|
||||||
|
|
||||||
|
enum class ShaderAttrib : u32;
|
||||||
|
|
||||||
namespace DX12
|
namespace DX12
|
||||||
{
|
{
|
||||||
class DXVertexFormat : public NativeVertexFormat
|
class DXVertexFormat : public NativeVertexFormat
|
||||||
|
@ -22,8 +24,8 @@ public:
|
||||||
void GetInputLayoutDesc(D3D12_INPUT_LAYOUT_DESC* desc) const;
|
void GetInputLayoutDesc(D3D12_INPUT_LAYOUT_DESC* desc) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void AddAttribute(const char* semantic_name, u32 semantic_index, u32 slot, DXGI_FORMAT format,
|
void AddAttribute(const char* semantic_name, ShaderAttrib semantic_index, u32 slot,
|
||||||
u32 offset);
|
DXGI_FORMAT format, u32 offset);
|
||||||
void MapAttributes();
|
void MapAttributes();
|
||||||
|
|
||||||
std::array<D3D12_INPUT_ELEMENT_DESC, MAX_VERTEX_ATTRIBUTES> m_attribute_descriptions = {};
|
std::array<D3D12_INPUT_ELEMENT_DESC, MAX_VERTEX_ATTRIBUTES> m_attribute_descriptions = {};
|
||||||
|
|
|
@ -113,18 +113,20 @@ static MTLVertexFormat ConvertFormat(ComponentFormat format, int count, bool int
|
||||||
// clang-format on
|
// clang-format on
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SetAttribute(MTLVertexDescriptor* desc, u32 attribute, const AttributeFormat& format)
|
static void SetAttribute(MTLVertexDescriptor* desc, ShaderAttrib attribute,
|
||||||
|
const AttributeFormat& format)
|
||||||
{
|
{
|
||||||
if (!format.enable)
|
if (!format.enable)
|
||||||
return;
|
return;
|
||||||
MTLVertexAttributeDescriptor* attr_desc = [[desc attributes] objectAtIndexedSubscript:attribute];
|
MTLVertexAttributeDescriptor* attr_desc =
|
||||||
|
[[desc attributes] objectAtIndexedSubscript:(u32)attribute];
|
||||||
[attr_desc setFormat:ConvertFormat(format.type, format.components, format.integer)];
|
[attr_desc setFormat:ConvertFormat(format.type, format.components, format.integer)];
|
||||||
[attr_desc setOffset:format.offset];
|
[attr_desc setOffset:format.offset];
|
||||||
[attr_desc setBufferIndex:0];
|
[attr_desc setBufferIndex:0];
|
||||||
}
|
}
|
||||||
|
|
||||||
template <size_t N>
|
template <size_t N>
|
||||||
static void SetAttributes(MTLVertexDescriptor* desc, u32 attribute,
|
static void SetAttributes(MTLVertexDescriptor* desc, ShaderAttrib attribute,
|
||||||
const std::array<AttributeFormat, N>& format)
|
const std::array<AttributeFormat, N>& format)
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < N; ++i)
|
for (size_t i = 0; i < N; ++i)
|
||||||
|
@ -135,9 +137,9 @@ Metal::VertexFormat::VertexFormat(const PortableVertexDeclaration& vtx_decl)
|
||||||
: NativeVertexFormat(vtx_decl), m_desc(MRCTransfer([MTLVertexDescriptor new]))
|
: NativeVertexFormat(vtx_decl), m_desc(MRCTransfer([MTLVertexDescriptor new]))
|
||||||
{
|
{
|
||||||
[[[m_desc layouts] objectAtIndexedSubscript:0] setStride:vtx_decl.stride];
|
[[[m_desc layouts] objectAtIndexedSubscript:0] setStride:vtx_decl.stride];
|
||||||
SetAttribute(m_desc, SHADER_POSITION_ATTRIB, vtx_decl.position);
|
SetAttribute(m_desc, ShaderAttrib::Position, vtx_decl.position);
|
||||||
SetAttributes(m_desc, SHADER_NORMAL_ATTRIB, vtx_decl.normals);
|
SetAttributes(m_desc, ShaderAttrib::Normal, vtx_decl.normals);
|
||||||
SetAttributes(m_desc, SHADER_COLOR0_ATTRIB, vtx_decl.colors);
|
SetAttributes(m_desc, ShaderAttrib::Color0, vtx_decl.colors);
|
||||||
SetAttributes(m_desc, SHADER_TEXTURE0_ATTRIB, vtx_decl.texcoords);
|
SetAttributes(m_desc, ShaderAttrib::TexCoord0, vtx_decl.texcoords);
|
||||||
SetAttribute(m_desc, SHADER_POSMTX_ATTRIB, vtx_decl.posmtx);
|
SetAttribute(m_desc, ShaderAttrib::PositionMatrix, vtx_decl.posmtx);
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,18 +32,18 @@ static inline GLuint VarToGL(ComponentFormat t)
|
||||||
return lookup[t];
|
return lookup[t];
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SetPointer(u32 attrib, u32 stride, const AttributeFormat& format)
|
static void SetPointer(ShaderAttrib attrib, u32 stride, const AttributeFormat& format)
|
||||||
{
|
{
|
||||||
if (!format.enable)
|
if (!format.enable)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
glEnableVertexAttribArray(attrib);
|
glEnableVertexAttribArray(static_cast<GLuint>(attrib));
|
||||||
if (format.integer)
|
if (format.integer)
|
||||||
glVertexAttribIPointer(attrib, format.components, VarToGL(format.type), stride,
|
glVertexAttribIPointer(static_cast<GLuint>(attrib), format.components, VarToGL(format.type),
|
||||||
(u8*)nullptr + format.offset);
|
stride, (u8*)nullptr + format.offset);
|
||||||
else
|
else
|
||||||
glVertexAttribPointer(attrib, format.components, VarToGL(format.type), true, stride,
|
glVertexAttribPointer(static_cast<GLuint>(attrib), format.components, VarToGL(format.type),
|
||||||
(u8*)nullptr + format.offset);
|
true, stride, (u8*)nullptr + format.offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
GLVertexFormat::GLVertexFormat(const PortableVertexDeclaration& vtx_decl)
|
GLVertexFormat::GLVertexFormat(const PortableVertexDeclaration& vtx_decl)
|
||||||
|
@ -65,18 +65,18 @@ GLVertexFormat::GLVertexFormat(const PortableVertexDeclaration& vtx_decl)
|
||||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, vm->GetIndexBufferHandle());
|
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, vm->GetIndexBufferHandle());
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, vm->GetVertexBufferHandle());
|
glBindBuffer(GL_ARRAY_BUFFER, vm->GetVertexBufferHandle());
|
||||||
|
|
||||||
SetPointer(SHADER_POSITION_ATTRIB, vertex_stride, vtx_decl.position);
|
SetPointer(ShaderAttrib::Position, vertex_stride, vtx_decl.position);
|
||||||
|
|
||||||
for (int i = 0; i < 3; i++)
|
for (u32 i = 0; i < 3; i++)
|
||||||
SetPointer(SHADER_NORMAL_ATTRIB + i, vertex_stride, vtx_decl.normals[i]);
|
SetPointer(ShaderAttrib::Normal + i, vertex_stride, vtx_decl.normals[i]);
|
||||||
|
|
||||||
for (int i = 0; i < 2; i++)
|
for (u32 i = 0; i < 2; i++)
|
||||||
SetPointer(SHADER_COLOR0_ATTRIB + i, vertex_stride, vtx_decl.colors[i]);
|
SetPointer(ShaderAttrib::Color0 + i, vertex_stride, vtx_decl.colors[i]);
|
||||||
|
|
||||||
for (int i = 0; i < 8; i++)
|
for (u32 i = 0; i < 8; i++)
|
||||||
SetPointer(SHADER_TEXTURE0_ATTRIB + i, vertex_stride, vtx_decl.texcoords[i]);
|
SetPointer(ShaderAttrib::TexCoord0 + i, vertex_stride, vtx_decl.texcoords[i]);
|
||||||
|
|
||||||
SetPointer(SHADER_POSMTX_ATTRIB, vertex_stride, vtx_decl.posmtx);
|
SetPointer(ShaderAttrib::PositionMatrix, vertex_stride, vtx_decl.posmtx);
|
||||||
}
|
}
|
||||||
|
|
||||||
GLVertexFormat::~GLVertexFormat()
|
GLVertexFormat::~GLVertexFormat()
|
||||||
|
|
|
@ -133,23 +133,24 @@ void SHADER::SetProgramBindings(bool is_compute)
|
||||||
glBindFragDataLocationIndexed(glprogid, 0, 1, "ocol1");
|
glBindFragDataLocationIndexed(glprogid, 0, 1, "ocol1");
|
||||||
}
|
}
|
||||||
// Need to set some attribute locations
|
// Need to set some attribute locations
|
||||||
glBindAttribLocation(glprogid, SHADER_POSITION_ATTRIB, "rawpos");
|
glBindAttribLocation(glprogid, static_cast<GLuint>(ShaderAttrib::Position), "rawpos");
|
||||||
|
|
||||||
glBindAttribLocation(glprogid, SHADER_POSMTX_ATTRIB, "posmtx");
|
glBindAttribLocation(glprogid, static_cast<GLuint>(ShaderAttrib::PositionMatrix), "posmtx");
|
||||||
|
|
||||||
glBindAttribLocation(glprogid, SHADER_COLOR0_ATTRIB, "rawcolor0");
|
glBindAttribLocation(glprogid, static_cast<GLuint>(ShaderAttrib::Color0), "rawcolor0");
|
||||||
glBindAttribLocation(glprogid, SHADER_COLOR1_ATTRIB, "rawcolor1");
|
glBindAttribLocation(glprogid, static_cast<GLuint>(ShaderAttrib::Color1), "rawcolor1");
|
||||||
|
|
||||||
glBindAttribLocation(glprogid, SHADER_NORMAL_ATTRIB, "rawnormal");
|
glBindAttribLocation(glprogid, static_cast<GLuint>(ShaderAttrib::Normal), "rawnormal");
|
||||||
glBindAttribLocation(glprogid, SHADER_TANGENT_ATTRIB, "rawtangent");
|
glBindAttribLocation(glprogid, static_cast<GLuint>(ShaderAttrib::Tangent), "rawtangent");
|
||||||
glBindAttribLocation(glprogid, SHADER_BINORMAL_ATTRIB, "rawbinormal");
|
glBindAttribLocation(glprogid, static_cast<GLuint>(ShaderAttrib::Binormal), "rawbinormal");
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 8; i++)
|
for (int i = 0; i < 8; i++)
|
||||||
{
|
{
|
||||||
// Per documentation: OpenGL copies the name string when glBindAttribLocation is called, so an
|
// Per documentation: OpenGL copies the name string when glBindAttribLocation is called, so an
|
||||||
// application may free its copy of the name string immediately after the function returns.
|
// application may free its copy of the name string immediately after the function returns.
|
||||||
glBindAttribLocation(glprogid, SHADER_TEXTURE0_ATTRIB + i, fmt::format("rawtex{}", i).c_str());
|
glBindAttribLocation(glprogid, static_cast<GLuint>(ShaderAttrib::TexCoord0 + i),
|
||||||
|
fmt::format("rawtex{}", i).c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -310,13 +310,15 @@ void Renderer::BindBackbuffer(const ClearColor& clear_color)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ERROR_LOG_FMT(VIDEO, "Unknown present error {:#010X}, please report.", res);
|
ERROR_LOG_FMT(VIDEO, "Unknown present error {:#010X} {}, please report.",
|
||||||
|
static_cast<u32>(res), VkResultToString(res));
|
||||||
m_swap_chain->RecreateSwapChain();
|
m_swap_chain->RecreateSwapChain();
|
||||||
}
|
}
|
||||||
|
|
||||||
res = m_swap_chain->AcquireNextImage();
|
res = m_swap_chain->AcquireNextImage();
|
||||||
if (res != VK_SUCCESS)
|
if (res != VK_SUCCESS)
|
||||||
PanicAlertFmt("Failed to grab image from swap chain: {:#010X}", res);
|
PanicAlertFmt("Failed to grab image from swap chain: {:#010X} {}", static_cast<u32>(res),
|
||||||
|
VkResultToString(res));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transition from undefined (or present src, but it can be substituted) to
|
// Transition from undefined (or present src, but it can be substituted) to
|
||||||
|
|
|
@ -66,14 +66,14 @@ void VertexFormat::MapAttributes()
|
||||||
|
|
||||||
if (m_decl.position.enable)
|
if (m_decl.position.enable)
|
||||||
AddAttribute(
|
AddAttribute(
|
||||||
SHADER_POSITION_ATTRIB, 0,
|
ShaderAttrib::Position, 0,
|
||||||
VarToVkFormat(m_decl.position.type, m_decl.position.components, m_decl.position.integer),
|
VarToVkFormat(m_decl.position.type, m_decl.position.components, m_decl.position.integer),
|
||||||
m_decl.position.offset);
|
m_decl.position.offset);
|
||||||
|
|
||||||
for (uint32_t i = 0; i < 3; i++)
|
for (uint32_t i = 0; i < 3; i++)
|
||||||
{
|
{
|
||||||
if (m_decl.normals[i].enable)
|
if (m_decl.normals[i].enable)
|
||||||
AddAttribute(SHADER_NORMAL_ATTRIB + i, 0,
|
AddAttribute(ShaderAttrib::Normal + i, 0,
|
||||||
VarToVkFormat(m_decl.normals[i].type, m_decl.normals[i].components,
|
VarToVkFormat(m_decl.normals[i].type, m_decl.normals[i].components,
|
||||||
m_decl.normals[i].integer),
|
m_decl.normals[i].integer),
|
||||||
m_decl.normals[i].offset);
|
m_decl.normals[i].offset);
|
||||||
|
@ -82,7 +82,7 @@ void VertexFormat::MapAttributes()
|
||||||
for (uint32_t i = 0; i < 2; i++)
|
for (uint32_t i = 0; i < 2; i++)
|
||||||
{
|
{
|
||||||
if (m_decl.colors[i].enable)
|
if (m_decl.colors[i].enable)
|
||||||
AddAttribute(SHADER_COLOR0_ATTRIB + i, 0,
|
AddAttribute(ShaderAttrib::Color0 + i, 0,
|
||||||
VarToVkFormat(m_decl.colors[i].type, m_decl.colors[i].components,
|
VarToVkFormat(m_decl.colors[i].type, m_decl.colors[i].components,
|
||||||
m_decl.colors[i].integer),
|
m_decl.colors[i].integer),
|
||||||
m_decl.colors[i].offset);
|
m_decl.colors[i].offset);
|
||||||
|
@ -91,14 +91,14 @@ void VertexFormat::MapAttributes()
|
||||||
for (uint32_t i = 0; i < 8; i++)
|
for (uint32_t i = 0; i < 8; i++)
|
||||||
{
|
{
|
||||||
if (m_decl.texcoords[i].enable)
|
if (m_decl.texcoords[i].enable)
|
||||||
AddAttribute(SHADER_TEXTURE0_ATTRIB + i, 0,
|
AddAttribute(ShaderAttrib::TexCoord0 + i, 0,
|
||||||
VarToVkFormat(m_decl.texcoords[i].type, m_decl.texcoords[i].components,
|
VarToVkFormat(m_decl.texcoords[i].type, m_decl.texcoords[i].components,
|
||||||
m_decl.texcoords[i].integer),
|
m_decl.texcoords[i].integer),
|
||||||
m_decl.texcoords[i].offset);
|
m_decl.texcoords[i].offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_decl.posmtx.enable)
|
if (m_decl.posmtx.enable)
|
||||||
AddAttribute(SHADER_POSMTX_ATTRIB, 0,
|
AddAttribute(ShaderAttrib::PositionMatrix, 0,
|
||||||
VarToVkFormat(m_decl.posmtx.type, m_decl.posmtx.components, m_decl.posmtx.integer),
|
VarToVkFormat(m_decl.posmtx.type, m_decl.posmtx.components, m_decl.posmtx.integer),
|
||||||
m_decl.posmtx.offset);
|
m_decl.posmtx.offset);
|
||||||
}
|
}
|
||||||
|
@ -118,12 +118,12 @@ void VertexFormat::SetupInputState()
|
||||||
m_input_state_info.pVertexAttributeDescriptions = m_attribute_descriptions.data();
|
m_input_state_info.pVertexAttributeDescriptions = m_attribute_descriptions.data();
|
||||||
}
|
}
|
||||||
|
|
||||||
void VertexFormat::AddAttribute(uint32_t location, uint32_t binding, VkFormat format,
|
void VertexFormat::AddAttribute(ShaderAttrib location, uint32_t binding, VkFormat format,
|
||||||
uint32_t offset)
|
uint32_t offset)
|
||||||
{
|
{
|
||||||
ASSERT(m_num_attributes < MAX_VERTEX_ATTRIBUTES);
|
ASSERT(m_num_attributes < MAX_VERTEX_ATTRIBUTES);
|
||||||
|
|
||||||
m_attribute_descriptions[m_num_attributes].location = location;
|
m_attribute_descriptions[m_num_attributes].location = static_cast<uint32_t>(location);
|
||||||
m_attribute_descriptions[m_num_attributes].binding = binding;
|
m_attribute_descriptions[m_num_attributes].binding = binding;
|
||||||
m_attribute_descriptions[m_num_attributes].format = format;
|
m_attribute_descriptions[m_num_attributes].format = format;
|
||||||
m_attribute_descriptions[m_num_attributes].offset = offset;
|
m_attribute_descriptions[m_num_attributes].offset = offset;
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
#include "VideoBackends/Vulkan/Constants.h"
|
#include "VideoBackends/Vulkan/Constants.h"
|
||||||
#include "VideoCommon/NativeVertexFormat.h"
|
#include "VideoCommon/NativeVertexFormat.h"
|
||||||
|
|
||||||
|
enum class ShaderAttrib : u32;
|
||||||
|
|
||||||
namespace Vulkan
|
namespace Vulkan
|
||||||
{
|
{
|
||||||
class VertexFormat : public ::NativeVertexFormat
|
class VertexFormat : public ::NativeVertexFormat
|
||||||
|
@ -23,7 +25,7 @@ public:
|
||||||
void SetupInputState();
|
void SetupInputState();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void AddAttribute(uint32_t location, uint32_t binding, VkFormat format, uint32_t offset);
|
void AddAttribute(ShaderAttrib location, uint32_t binding, VkFormat format, uint32_t offset);
|
||||||
|
|
||||||
VkVertexInputBindingDescription m_binding_description = {};
|
VkVertexInputBindingDescription m_binding_description = {};
|
||||||
|
|
||||||
|
|
|
@ -107,7 +107,7 @@ void CPState::LoadCPReg(u8 sub_cmd, u32 value)
|
||||||
WARN_LOG_FMT(VIDEO,
|
WARN_LOG_FMT(VIDEO,
|
||||||
"CP MATINDEX_A: an exact value of {:02x} was expected "
|
"CP MATINDEX_A: an exact value of {:02x} was expected "
|
||||||
"but instead a value of {:02x} was seen",
|
"but instead a value of {:02x} was seen",
|
||||||
MATINDEX_A, sub_cmd);
|
static_cast<u16>(MATINDEX_A), sub_cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
matrix_index_a.Hex = value;
|
matrix_index_a.Hex = value;
|
||||||
|
@ -120,7 +120,7 @@ void CPState::LoadCPReg(u8 sub_cmd, u32 value)
|
||||||
WARN_LOG_FMT(VIDEO,
|
WARN_LOG_FMT(VIDEO,
|
||||||
"CP MATINDEX_B: an exact value of {:02x} was expected "
|
"CP MATINDEX_B: an exact value of {:02x} was expected "
|
||||||
"but instead a value of {:02x} was seen",
|
"but instead a value of {:02x} was seen",
|
||||||
MATINDEX_B, sub_cmd);
|
static_cast<u16>(MATINDEX_B), sub_cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
matrix_index_b.Hex = value;
|
matrix_index_b.Hex = value;
|
||||||
|
@ -133,7 +133,7 @@ void CPState::LoadCPReg(u8 sub_cmd, u32 value)
|
||||||
WARN_LOG_FMT(VIDEO,
|
WARN_LOG_FMT(VIDEO,
|
||||||
"CP VCD_LO: an exact value of {:02x} was expected "
|
"CP VCD_LO: an exact value of {:02x} was expected "
|
||||||
"but instead a value of {:02x} was seen",
|
"but instead a value of {:02x} was seen",
|
||||||
VCD_LO, sub_cmd);
|
static_cast<u16>(VCD_LO), sub_cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
vtx_desc.low.Hex = value;
|
vtx_desc.low.Hex = value;
|
||||||
|
@ -146,7 +146,7 @@ void CPState::LoadCPReg(u8 sub_cmd, u32 value)
|
||||||
WARN_LOG_FMT(VIDEO,
|
WARN_LOG_FMT(VIDEO,
|
||||||
"CP VCD_HI: an exact value of {:02x} was expected "
|
"CP VCD_HI: an exact value of {:02x} was expected "
|
||||||
"but instead a value of {:02x} was seen",
|
"but instead a value of {:02x} was seen",
|
||||||
VCD_HI, sub_cmd);
|
static_cast<u16>(VCD_HI), sub_cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
vtx_desc.high.Hex = value;
|
vtx_desc.high.Hex = value;
|
||||||
|
|
|
@ -98,16 +98,16 @@ void EmitVertexMainDeclaration(ShaderCode& code, u32 num_tex_inputs, u32 num_col
|
||||||
{
|
{
|
||||||
for (u32 i = 0; i < num_tex_inputs; i++)
|
for (u32 i = 0; i < num_tex_inputs; i++)
|
||||||
{
|
{
|
||||||
const auto attribute = SHADER_TEXTURE0_ATTRIB + i;
|
const auto attribute = ShaderAttrib::TexCoord0 + i;
|
||||||
code.Write("ATTRIBUTE_LOCATION({}) in float3 rawtex{};\n", attribute, i);
|
code.Write("ATTRIBUTE_LOCATION({:s}) in float3 rawtex{};\n", attribute, i);
|
||||||
}
|
}
|
||||||
for (u32 i = 0; i < num_color_inputs; i++)
|
for (u32 i = 0; i < num_color_inputs; i++)
|
||||||
{
|
{
|
||||||
const auto attribute = SHADER_COLOR0_ATTRIB + i;
|
const auto attribute = ShaderAttrib::Color0 + i;
|
||||||
code.Write("ATTRIBUTE_LOCATION({}) in float4 rawcolor{};\n", attribute, i);
|
code.Write("ATTRIBUTE_LOCATION({:s}) in float4 rawcolor{};\n", attribute, i);
|
||||||
}
|
}
|
||||||
if (position_input)
|
if (position_input)
|
||||||
code.Write("ATTRIBUTE_LOCATION({}) in float4 rawpos;\n", SHADER_POSITION_ATTRIB);
|
code.Write("ATTRIBUTE_LOCATION({:s}) in float4 rawpos;\n", ShaderAttrib::Position);
|
||||||
|
|
||||||
if (g_ActiveConfig.backend_info.bSupportsGeometryShaders)
|
if (g_ActiveConfig.backend_info.bSupportsGeometryShaders)
|
||||||
{
|
{
|
||||||
|
|
|
@ -118,10 +118,12 @@ void WriteVertexLighting(ShaderCode& out, APIType api_type, std::string_view wor
|
||||||
|
|
||||||
out.Write(" if ({} != 0u) {{\n", BitfieldExtract<&LitChannel::enablelighting>("alphareg"));
|
out.Write(" if ({} != 0u) {{\n", BitfieldExtract<&LitChannel::enablelighting>("alphareg"));
|
||||||
out.Write(" if ({} != 0u) {{\n", BitfieldExtract<&LitChannel::ambsource>("alphareg"));
|
out.Write(" if ({} != 0u) {{\n", BitfieldExtract<&LitChannel::ambsource>("alphareg"));
|
||||||
out.Write(" if ((components & ({}u << chan)) != 0u) // VB_HAS_COL0\n", VB_HAS_COL0);
|
out.Write(" if ((components & ({}u << chan)) != 0u) // VB_HAS_COL0\n",
|
||||||
|
static_cast<u32>(VB_HAS_COL0));
|
||||||
out.Write(" lacc.w = int(round(((chan == 0u) ? {}.w : {}.w) * 255.0));\n", in_color_0_var,
|
out.Write(" lacc.w = int(round(((chan == 0u) ? {}.w : {}.w) * 255.0));\n", in_color_0_var,
|
||||||
in_color_1_var);
|
in_color_1_var);
|
||||||
out.Write(" else if ((components & {}u) != 0u) // VB_HAS_COLO0\n", VB_HAS_COL0);
|
out.Write(" else if ((components & {}u) != 0u) // VB_HAS_COLO0\n",
|
||||||
|
static_cast<u32>(VB_HAS_COL0));
|
||||||
out.Write(" lacc.w = int(round({}.w * 255.0));\n", in_color_0_var);
|
out.Write(" lacc.w = int(round({}.w * 255.0));\n", in_color_0_var);
|
||||||
out.Write(" else\n"
|
out.Write(" else\n"
|
||||||
" lacc.w = 255;\n"
|
" lacc.w = 255;\n"
|
||||||
|
|
|
@ -147,15 +147,15 @@ float3 load_input_float3_rawtex(uint vtx_offset, uint attr_offset) {{
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
out.Write("ATTRIBUTE_LOCATION({}) in float4 rawpos;\n", SHADER_POSITION_ATTRIB);
|
out.Write("ATTRIBUTE_LOCATION({:s}) in float4 rawpos;\n", ShaderAttrib::Position);
|
||||||
out.Write("ATTRIBUTE_LOCATION({}) in uint4 posmtx;\n", SHADER_POSMTX_ATTRIB);
|
out.Write("ATTRIBUTE_LOCATION({:s}) in uint4 posmtx;\n", ShaderAttrib::PositionMatrix);
|
||||||
out.Write("ATTRIBUTE_LOCATION({}) in float3 rawnormal;\n", SHADER_NORMAL_ATTRIB);
|
out.Write("ATTRIBUTE_LOCATION({:s}) in float3 rawnormal;\n", ShaderAttrib::Normal);
|
||||||
out.Write("ATTRIBUTE_LOCATION({}) in float3 rawtangent;\n", SHADER_TANGENT_ATTRIB);
|
out.Write("ATTRIBUTE_LOCATION({:s}) in float3 rawtangent;\n", ShaderAttrib::Tangent);
|
||||||
out.Write("ATTRIBUTE_LOCATION({}) in float3 rawbinormal;\n", SHADER_BINORMAL_ATTRIB);
|
out.Write("ATTRIBUTE_LOCATION({:s}) in float3 rawbinormal;\n", ShaderAttrib::Binormal);
|
||||||
out.Write("ATTRIBUTE_LOCATION({}) in float4 rawcolor0;\n", SHADER_COLOR0_ATTRIB);
|
out.Write("ATTRIBUTE_LOCATION({:s}) in float4 rawcolor0;\n", ShaderAttrib::Color0);
|
||||||
out.Write("ATTRIBUTE_LOCATION({}) in float4 rawcolor1;\n", SHADER_COLOR1_ATTRIB);
|
out.Write("ATTRIBUTE_LOCATION({:s}) in float4 rawcolor1;\n", ShaderAttrib::Color1);
|
||||||
for (int i = 0; i < 8; ++i)
|
for (u32 i = 0; i < 8; ++i)
|
||||||
out.Write("ATTRIBUTE_LOCATION({}) in float3 rawtex{};\n", SHADER_TEXTURE0_ATTRIB + i, i);
|
out.Write("ATTRIBUTE_LOCATION({:s}) in float3 rawtex{};\n", ShaderAttrib::TexCoord0 + i, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (host_config.backend_geometry_shaders)
|
if (host_config.backend_geometry_shaders)
|
||||||
|
@ -223,7 +223,7 @@ float3 load_input_float3_rawtex(uint vtx_offset, uint attr_offset) {{
|
||||||
"float3 N2;\n"
|
"float3 N2;\n"
|
||||||
"\n"
|
"\n"
|
||||||
"if ((components & {}u) != 0u) {{ // VB_HAS_POSMTXIDX\n",
|
"if ((components & {}u) != 0u) {{ // VB_HAS_POSMTXIDX\n",
|
||||||
VB_HAS_POSMTXIDX);
|
static_cast<u32>(VB_HAS_POSMTXIDX));
|
||||||
LoadVertexAttribute(out, host_config, 2, "posmtx", "uint4", "ubyte4");
|
LoadVertexAttribute(out, host_config, 2, "posmtx", "uint4", "ubyte4");
|
||||||
out.Write(" // Vertex format has a per-vertex matrix\n"
|
out.Write(" // Vertex format has a per-vertex matrix\n"
|
||||||
" int posidx = int(posmtx.r);\n"
|
" int posidx = int(posmtx.r);\n"
|
||||||
|
@ -258,7 +258,7 @@ float3 load_input_float3_rawtex(uint vtx_offset, uint attr_offset) {{
|
||||||
"float3 _normal = float3(0.0, 0.0, 0.0);\n"
|
"float3 _normal = float3(0.0, 0.0, 0.0);\n"
|
||||||
"if ((components & {}u) != 0u) // VB_HAS_NORMAL\n"
|
"if ((components & {}u) != 0u) // VB_HAS_NORMAL\n"
|
||||||
"{{\n",
|
"{{\n",
|
||||||
VB_HAS_NORMAL);
|
static_cast<u32>(VB_HAS_NORMAL));
|
||||||
LoadVertexAttribute(out, host_config, 2, "rawnormal", "float3", "float3");
|
LoadVertexAttribute(out, host_config, 2, "rawnormal", "float3", "float3");
|
||||||
out.Write(" _normal = normalize(float3(dot(N0, rawnormal), dot(N1, rawnormal), dot(N2, "
|
out.Write(" _normal = normalize(float3(dot(N0, rawnormal), dot(N1, rawnormal), dot(N2, "
|
||||||
"rawnormal)));\n"
|
"rawnormal)));\n"
|
||||||
|
@ -267,7 +267,7 @@ float3 load_input_float3_rawtex(uint vtx_offset, uint attr_offset) {{
|
||||||
"float3 _tangent = float3(0.0, 0.0, 0.0);\n"
|
"float3 _tangent = float3(0.0, 0.0, 0.0);\n"
|
||||||
"if ((components & {}u) != 0u) // VB_HAS_TANGENT\n"
|
"if ((components & {}u) != 0u) // VB_HAS_TANGENT\n"
|
||||||
"{{\n",
|
"{{\n",
|
||||||
VB_HAS_TANGENT);
|
static_cast<u32>(VB_HAS_TANGENT));
|
||||||
LoadVertexAttribute(out, host_config, 2, "rawtangent", "float3", "float3");
|
LoadVertexAttribute(out, host_config, 2, "rawtangent", "float3", "float3");
|
||||||
out.Write(" _tangent = float3(dot(N0, rawtangent), dot(N1, rawtangent), dot(N2, rawtangent));\n"
|
out.Write(" _tangent = float3(dot(N0, rawtangent), dot(N1, rawtangent), dot(N2, rawtangent));\n"
|
||||||
"}}\n"
|
"}}\n"
|
||||||
|
@ -280,7 +280,7 @@ float3 load_input_float3_rawtex(uint vtx_offset, uint attr_offset) {{
|
||||||
"float3 _binormal = float3(0.0, 0.0, 0.0);\n"
|
"float3 _binormal = float3(0.0, 0.0, 0.0);\n"
|
||||||
"if ((components & {}u) != 0u) // VB_HAS_BINORMAL\n"
|
"if ((components & {}u) != 0u) // VB_HAS_BINORMAL\n"
|
||||||
"{{\n",
|
"{{\n",
|
||||||
VB_HAS_BINORMAL);
|
static_cast<u32>(VB_HAS_BINORMAL));
|
||||||
LoadVertexAttribute(out, host_config, 2, "rawbinormal", "float3", "float3");
|
LoadVertexAttribute(out, host_config, 2, "rawbinormal", "float3", "float3");
|
||||||
out.Write(" _binormal = float3(dot(N0, rawbinormal), dot(N1, rawbinormal), dot(N2, "
|
out.Write(" _binormal = float3(dot(N0, rawbinormal), dot(N1, rawbinormal), dot(N2, "
|
||||||
"rawbinormal));\n"
|
"rawbinormal));\n"
|
||||||
|
@ -301,11 +301,11 @@ float3 load_input_float3_rawtex(uint vtx_offset, uint attr_offset) {{
|
||||||
out.Write("// To use color 1, the vertex descriptor must have color 0 and 1.\n"
|
out.Write("// To use color 1, the vertex descriptor must have color 0 and 1.\n"
|
||||||
"// If color 1 is present but not color 0, it is used for lighting channel 0.\n"
|
"// If color 1 is present but not color 0, it is used for lighting channel 0.\n"
|
||||||
"bool use_color_1 = ((components & {0}u) == {0}u); // VB_HAS_COL0 | VB_HAS_COL1\n",
|
"bool use_color_1 = ((components & {0}u) == {0}u); // VB_HAS_COL0 | VB_HAS_COL1\n",
|
||||||
VB_HAS_COL0 | VB_HAS_COL1);
|
static_cast<u32>(VB_HAS_COL0 | VB_HAS_COL1));
|
||||||
|
|
||||||
out.Write("if ((components & {0}u) == {0}u) // VB_HAS_COL0 | VB_HAS_COL1\n"
|
out.Write("if ((components & {0}u) == {0}u) // VB_HAS_COL0 | VB_HAS_COL1\n"
|
||||||
"{{\n",
|
"{{\n",
|
||||||
VB_HAS_COL0 | VB_HAS_COL1);
|
static_cast<u32>(VB_HAS_COL0 | VB_HAS_COL1));
|
||||||
LoadVertexAttribute(out, host_config, 2, "rawcolor0", "float4", "ubyte4");
|
LoadVertexAttribute(out, host_config, 2, "rawcolor0", "float4", "ubyte4");
|
||||||
LoadVertexAttribute(out, host_config, 2, "rawcolor1", "float4", "ubyte4");
|
LoadVertexAttribute(out, host_config, 2, "rawcolor1", "float4", "ubyte4");
|
||||||
out.Write(" vertex_color_0 = rawcolor0;\n"
|
out.Write(" vertex_color_0 = rawcolor0;\n"
|
||||||
|
@ -313,14 +313,14 @@ float3 load_input_float3_rawtex(uint vtx_offset, uint attr_offset) {{
|
||||||
"}}\n"
|
"}}\n"
|
||||||
"else if ((components & {}u) != 0u) // VB_HAS_COL0\n"
|
"else if ((components & {}u) != 0u) // VB_HAS_COL0\n"
|
||||||
"{{\n",
|
"{{\n",
|
||||||
VB_HAS_COL0);
|
static_cast<u32>(VB_HAS_COL0));
|
||||||
LoadVertexAttribute(out, host_config, 2, "rawcolor0", "float4", "ubyte4");
|
LoadVertexAttribute(out, host_config, 2, "rawcolor0", "float4", "ubyte4");
|
||||||
out.Write(" vertex_color_0 = rawcolor0;\n"
|
out.Write(" vertex_color_0 = rawcolor0;\n"
|
||||||
" vertex_color_1 = rawcolor0;\n"
|
" vertex_color_1 = rawcolor0;\n"
|
||||||
"}}\n"
|
"}}\n"
|
||||||
"else if ((components & {}u) != 0u) // VB_HAS_COL1\n"
|
"else if ((components & {}u) != 0u) // VB_HAS_COL1\n"
|
||||||
"{{\n",
|
"{{\n",
|
||||||
VB_HAS_COL1);
|
static_cast<u32>(VB_HAS_COL1));
|
||||||
LoadVertexAttribute(out, host_config, 2, "rawcolor1", "float4", "ubyte4");
|
LoadVertexAttribute(out, host_config, 2, "rawcolor1", "float4", "ubyte4");
|
||||||
out.Write(" vertex_color_0 = rawcolor1;\n"
|
out.Write(" vertex_color_0 = rawcolor1;\n"
|
||||||
" vertex_color_1 = rawcolor1;\n"
|
" vertex_color_1 = rawcolor1;\n"
|
||||||
|
@ -355,7 +355,7 @@ float3 load_input_float3_rawtex(uint vtx_offset, uint attr_offset) {{
|
||||||
" float4 other_p1 = P1;\n"
|
" float4 other_p1 = P1;\n"
|
||||||
" float4 other_p2 = P2;\n"
|
" float4 other_p2 = P2;\n"
|
||||||
" if ((components & {}u) != 0u) {{ // VB_HAS_POSMTXIDX\n",
|
" if ((components & {}u) != 0u) {{ // VB_HAS_POSMTXIDX\n",
|
||||||
VB_HAS_POSMTXIDX);
|
static_cast<u32>(VB_HAS_POSMTXIDX));
|
||||||
out.Write(" uint other_posidx = load_input_uint4_ubyte4(other_base_offset, "
|
out.Write(" uint other_posidx = load_input_uint4_ubyte4(other_base_offset, "
|
||||||
"vertex_offset_posmtx).r;\n"
|
"vertex_offset_posmtx).r;\n"
|
||||||
" other_p0 = " I_TRANSFORMMATRICES "[other_posidx];\n"
|
" other_p0 = " I_TRANSFORMMATRICES "[other_posidx];\n"
|
||||||
|
@ -545,7 +545,7 @@ static void GenVertexShaderTexGens(APIType api_type, const ShaderHostConfig& hos
|
||||||
out.Write(" case {:s}:\n", SourceRow::Normal);
|
out.Write(" case {:s}:\n", SourceRow::Normal);
|
||||||
out.Write(" if ((components & {}u) != 0u) // VB_HAS_NORMAL\n"
|
out.Write(" if ((components & {}u) != 0u) // VB_HAS_NORMAL\n"
|
||||||
" {{\n",
|
" {{\n",
|
||||||
VB_HAS_NORMAL);
|
static_cast<u32>(VB_HAS_NORMAL));
|
||||||
LoadVertexAttribute(out, host_config, 6, "rawnormal", "float3", "float3");
|
LoadVertexAttribute(out, host_config, 6, "rawnormal", "float3", "float3");
|
||||||
out.Write(" coord.xyz = rawnormal.xyz;\n"
|
out.Write(" coord.xyz = rawnormal.xyz;\n"
|
||||||
" }}\n"
|
" }}\n"
|
||||||
|
@ -553,7 +553,7 @@ static void GenVertexShaderTexGens(APIType api_type, const ShaderHostConfig& hos
|
||||||
out.Write(" case {:s}:\n", SourceRow::BinormalT);
|
out.Write(" case {:s}:\n", SourceRow::BinormalT);
|
||||||
out.Write(" if ((components & {}u) != 0u) // VB_HAS_TANGENT\n"
|
out.Write(" if ((components & {}u) != 0u) // VB_HAS_TANGENT\n"
|
||||||
" {{\n",
|
" {{\n",
|
||||||
VB_HAS_TANGENT);
|
static_cast<u32>(VB_HAS_TANGENT));
|
||||||
LoadVertexAttribute(out, host_config, 6, "rawtangent", "float3", "float3");
|
LoadVertexAttribute(out, host_config, 6, "rawtangent", "float3", "float3");
|
||||||
out.Write(" coord.xyz = rawtangent.xyz;\n"
|
out.Write(" coord.xyz = rawtangent.xyz;\n"
|
||||||
" }}\n"
|
" }}\n"
|
||||||
|
@ -561,7 +561,7 @@ static void GenVertexShaderTexGens(APIType api_type, const ShaderHostConfig& hos
|
||||||
out.Write(" case {:s}:\n", SourceRow::BinormalB);
|
out.Write(" case {:s}:\n", SourceRow::BinormalB);
|
||||||
out.Write(" if ((components & {}u) != 0u) // VB_HAS_BINORMAL\n"
|
out.Write(" if ((components & {}u) != 0u) // VB_HAS_BINORMAL\n"
|
||||||
" {{\n",
|
" {{\n",
|
||||||
VB_HAS_BINORMAL);
|
static_cast<u32>(VB_HAS_BINORMAL));
|
||||||
LoadVertexAttribute(out, host_config, 6, "rawbinormal", "float3", "float3");
|
LoadVertexAttribute(out, host_config, 6, "rawbinormal", "float3", "float3");
|
||||||
out.Write(" coord.xyz = rawbinormal.xyz;\n"
|
out.Write(" coord.xyz = rawbinormal.xyz;\n"
|
||||||
" }}\n"
|
" }}\n"
|
||||||
|
@ -625,7 +625,7 @@ static void GenVertexShaderTexGens(APIType api_type, const ShaderHostConfig& hos
|
||||||
out.Write(" default:\n"
|
out.Write(" default:\n"
|
||||||
" {{\n");
|
" {{\n");
|
||||||
out.Write(" if ((components & ({}u /* VB_HAS_TEXMTXIDX0 */ << texgen)) != 0u) {{\n",
|
out.Write(" if ((components & ({}u /* VB_HAS_TEXMTXIDX0 */ << texgen)) != 0u) {{\n",
|
||||||
VB_HAS_TEXMTXIDX0);
|
static_cast<u32>(VB_HAS_TEXMTXIDX0));
|
||||||
if (host_config.backend_dynamic_vertex_loader || host_config.backend_vs_point_line_expand)
|
if (host_config.backend_dynamic_vertex_loader || host_config.backend_vs_point_line_expand)
|
||||||
{
|
{
|
||||||
out.Write(" int tmp = int(load_input_float3_rawtex(vertex_base_offset, "
|
out.Write(" int tmp = int(load_input_float3_rawtex(vertex_base_offset, "
|
||||||
|
|
|
@ -118,20 +118,20 @@ ShaderCode GenerateVertexShaderCode(APIType api_type, const ShaderHostConfig& ho
|
||||||
|
|
||||||
if (uid_data->vs_expand == VSExpand::None)
|
if (uid_data->vs_expand == VSExpand::None)
|
||||||
{
|
{
|
||||||
out.Write("ATTRIBUTE_LOCATION({}) in float4 rawpos;\n", SHADER_POSITION_ATTRIB);
|
out.Write("ATTRIBUTE_LOCATION({:s}) in float4 rawpos;\n", ShaderAttrib::Position);
|
||||||
if ((uid_data->components & VB_HAS_POSMTXIDX) != 0)
|
if ((uid_data->components & VB_HAS_POSMTXIDX) != 0)
|
||||||
out.Write("ATTRIBUTE_LOCATION({}) in uint4 posmtx;\n", SHADER_POSMTX_ATTRIB);
|
out.Write("ATTRIBUTE_LOCATION({:s}) in uint4 posmtx;\n", ShaderAttrib::PositionMatrix);
|
||||||
if ((uid_data->components & VB_HAS_NORMAL) != 0)
|
if ((uid_data->components & VB_HAS_NORMAL) != 0)
|
||||||
out.Write("ATTRIBUTE_LOCATION({}) in float3 rawnormal;\n", SHADER_NORMAL_ATTRIB);
|
out.Write("ATTRIBUTE_LOCATION({:s}) in float3 rawnormal;\n", ShaderAttrib::Normal);
|
||||||
if ((uid_data->components & VB_HAS_TANGENT) != 0)
|
if ((uid_data->components & VB_HAS_TANGENT) != 0)
|
||||||
out.Write("ATTRIBUTE_LOCATION({}) in float3 rawtangent;\n", SHADER_TANGENT_ATTRIB);
|
out.Write("ATTRIBUTE_LOCATION({:s}) in float3 rawtangent;\n", ShaderAttrib::Tangent);
|
||||||
if ((uid_data->components & VB_HAS_BINORMAL) != 0)
|
if ((uid_data->components & VB_HAS_BINORMAL) != 0)
|
||||||
out.Write("ATTRIBUTE_LOCATION({}) in float3 rawbinormal;\n", SHADER_BINORMAL_ATTRIB);
|
out.Write("ATTRIBUTE_LOCATION({:s}) in float3 rawbinormal;\n", ShaderAttrib::Binormal);
|
||||||
|
|
||||||
if ((uid_data->components & VB_HAS_COL0) != 0)
|
if ((uid_data->components & VB_HAS_COL0) != 0)
|
||||||
out.Write("ATTRIBUTE_LOCATION({}) in float4 rawcolor0;\n", SHADER_COLOR0_ATTRIB);
|
out.Write("ATTRIBUTE_LOCATION({:s}) in float4 rawcolor0;\n", ShaderAttrib::Color0);
|
||||||
if ((uid_data->components & VB_HAS_COL1) != 0)
|
if ((uid_data->components & VB_HAS_COL1) != 0)
|
||||||
out.Write("ATTRIBUTE_LOCATION({}) in float4 rawcolor1;\n", SHADER_COLOR1_ATTRIB);
|
out.Write("ATTRIBUTE_LOCATION({:s}) in float4 rawcolor1;\n", ShaderAttrib::Color1);
|
||||||
|
|
||||||
for (u32 i = 0; i < 8; ++i)
|
for (u32 i = 0; i < 8; ++i)
|
||||||
{
|
{
|
||||||
|
@ -139,7 +139,7 @@ ShaderCode GenerateVertexShaderCode(APIType api_type, const ShaderHostConfig& ho
|
||||||
|
|
||||||
if ((uid_data->components & (VB_HAS_UV0 << i)) != 0 || has_texmtx != 0)
|
if ((uid_data->components & (VB_HAS_UV0 << i)) != 0 || has_texmtx != 0)
|
||||||
{
|
{
|
||||||
out.Write("ATTRIBUTE_LOCATION({}) in float{} rawtex{};\n", SHADER_TEXTURE0_ATTRIB + i,
|
out.Write("ATTRIBUTE_LOCATION({:s}) in float{} rawtex{};\n", ShaderAttrib::TexCoord0 + i,
|
||||||
has_texmtx != 0 ? 3 : 2, i);
|
has_texmtx != 0 ? 3 : 2, i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
|
#include "Common/EnumFormatter.h"
|
||||||
|
|
||||||
#include "VideoCommon/LightingShaderGen.h"
|
#include "VideoCommon/LightingShaderGen.h"
|
||||||
#include "VideoCommon/ShaderGenCommon.h"
|
#include "VideoCommon/ShaderGenCommon.h"
|
||||||
|
|
||||||
|
@ -14,25 +16,39 @@ enum class SourceRow : u32;
|
||||||
enum class VSExpand : u32;
|
enum class VSExpand : u32;
|
||||||
|
|
||||||
// TODO should be reordered
|
// TODO should be reordered
|
||||||
enum : int
|
enum class ShaderAttrib : u32
|
||||||
{
|
{
|
||||||
SHADER_POSITION_ATTRIB = 0,
|
Position = 0,
|
||||||
SHADER_POSMTX_ATTRIB = 1,
|
PositionMatrix = 1,
|
||||||
SHADER_NORMAL_ATTRIB = 2,
|
Normal = 2,
|
||||||
SHADER_TANGENT_ATTRIB = 3,
|
Tangent = 3,
|
||||||
SHADER_BINORMAL_ATTRIB = 4,
|
Binormal = 4,
|
||||||
SHADER_COLOR0_ATTRIB = 5,
|
Color0 = 5,
|
||||||
SHADER_COLOR1_ATTRIB = 6,
|
Color1 = 6,
|
||||||
|
|
||||||
SHADER_TEXTURE0_ATTRIB = 8,
|
TexCoord0 = 8,
|
||||||
SHADER_TEXTURE1_ATTRIB = 9,
|
TexCoord1 = 9,
|
||||||
SHADER_TEXTURE2_ATTRIB = 10,
|
TexCoord2 = 10,
|
||||||
SHADER_TEXTURE3_ATTRIB = 11,
|
TexCoord3 = 11,
|
||||||
SHADER_TEXTURE4_ATTRIB = 12,
|
TexCoord4 = 12,
|
||||||
SHADER_TEXTURE5_ATTRIB = 13,
|
TexCoord5 = 13,
|
||||||
SHADER_TEXTURE6_ATTRIB = 14,
|
TexCoord6 = 14,
|
||||||
SHADER_TEXTURE7_ATTRIB = 15
|
TexCoord7 = 15
|
||||||
};
|
};
|
||||||
|
template <>
|
||||||
|
struct fmt::formatter<ShaderAttrib> : EnumFormatter<ShaderAttrib::TexCoord7>
|
||||||
|
{
|
||||||
|
static constexpr array_type names = {
|
||||||
|
"Position", "Position Matrix", "Normal", "Tangent", "Binormal", "Color 0",
|
||||||
|
"Color 1", nullptr, "Tex Coord 0", "Tex Coord 1", "Tex Coord 2", "Tex Coord 3",
|
||||||
|
"Tex Coord 4", "Tex Coord 5", "Tex Coord 6", "Tex Coord 7"};
|
||||||
|
constexpr formatter() : EnumFormatter(names) {}
|
||||||
|
};
|
||||||
|
// Intended for offsetting from Color0/TexCoord0
|
||||||
|
constexpr ShaderAttrib operator+(ShaderAttrib attrib, int offset)
|
||||||
|
{
|
||||||
|
return static_cast<ShaderAttrib>(static_cast<u8>(attrib) + offset);
|
||||||
|
}
|
||||||
|
|
||||||
#pragma pack(1)
|
#pragma pack(1)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue