[Misc] Replaced const with constexpr where possible
This commit is contained in:
parent
c4f1bf27ef
commit
47f327e848
|
@ -1635,7 +1635,7 @@ EmulatorWindow::ControllerHotKey EmulatorWindow::ProcessControllerHotkey(
|
|||
}
|
||||
|
||||
// Hotkey cool-down to prevent toggling too fast
|
||||
const std::chrono::milliseconds delay(75);
|
||||
constexpr std::chrono::milliseconds delay(75);
|
||||
|
||||
// If the Xbox Gamebar is enabled or the Guide button is disabled then
|
||||
// replace the Guide button with the Back button without redeclaring the key
|
||||
|
@ -1820,7 +1820,7 @@ EmulatorWindow::ControllerHotKey EmulatorWindow::ProcessControllerHotkey(
|
|||
void EmulatorWindow::VibrateController(xe::hid::InputSystem* input_sys,
|
||||
uint32_t user_index,
|
||||
bool toggle_rumble) {
|
||||
const std::chrono::milliseconds rumble_duration(100);
|
||||
constexpr std::chrono::milliseconds rumble_duration(100);
|
||||
|
||||
// Hold lock while sleeping this thread for the duration of the rumble,
|
||||
// otherwise the rumble may fail.
|
||||
|
@ -1842,7 +1842,7 @@ void EmulatorWindow::VibrateController(xe::hid::InputSystem* input_sys,
|
|||
void EmulatorWindow::GamepadHotKeys() {
|
||||
X_INPUT_STATE state;
|
||||
|
||||
const std::chrono::milliseconds thread_delay(75);
|
||||
constexpr std::chrono::milliseconds thread_delay(75);
|
||||
|
||||
auto input_sys = emulator_->input_system();
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ class AudioSystem {
|
|||
public:
|
||||
// TODO(gibbed): respect XAUDIO2_MAX_QUEUED_BUFFERS somehow (ie min(64,
|
||||
// XAUDIO2_MAX_QUEUED_BUFFERS))
|
||||
static const size_t kMaximumQueuedFrames = 64;
|
||||
static constexpr size_t kMaximumQueuedFrames = 64;
|
||||
|
||||
virtual ~AudioSystem();
|
||||
|
||||
|
@ -81,7 +81,7 @@ class AudioSystem {
|
|||
kernel::object_ref<kernel::XHostThread> worker_thread_;
|
||||
|
||||
xe::global_critical_region global_critical_region_;
|
||||
static const size_t kMaximumClientCount = 8;
|
||||
static constexpr size_t kMaximumClientCount = 8;
|
||||
struct {
|
||||
AudioDriver* driver;
|
||||
uint32_t callback;
|
||||
|
|
|
@ -106,7 +106,7 @@ class XAudio2AudioDriver : public AudioDriver {
|
|||
uint32_t frame_size_;
|
||||
bool need_format_conversion_;
|
||||
|
||||
static const uint32_t frame_count_ = api::XE_XAUDIO2_MAX_QUEUED_BUFFERS;
|
||||
static constexpr uint32_t frame_count_ = api::XE_XAUDIO2_MAX_QUEUED_BUFFERS;
|
||||
|
||||
float frames_[frame_count_][kFrameSamplesMax];
|
||||
uint32_t current_frame_ = 0;
|
||||
|
|
|
@ -46,8 +46,8 @@ class BitMap {
|
|||
std::vector<uint64_t>& data() { return data_; }
|
||||
|
||||
private:
|
||||
const static size_t kDataSize = 8;
|
||||
const static size_t kDataSizeBits = kDataSize * 8;
|
||||
constexpr static size_t kDataSize = 8;
|
||||
constexpr static size_t kDataSizeBits = kDataSize * 8;
|
||||
std::vector<uint64_t> data_;
|
||||
inline size_t TryAcquireAt(size_t i);
|
||||
};
|
||||
|
|
|
@ -30,7 +30,7 @@ std::pair<size_t, size_t> NextUnsetRange(const Block* bits, size_t first,
|
|||
return std::make_pair(size_t(first), size_t(0));
|
||||
}
|
||||
size_t last = first + length - 1;
|
||||
const size_t block_bits = sizeof(Block) * CHAR_BIT;
|
||||
constexpr size_t block_bits = sizeof(Block) * CHAR_BIT;
|
||||
size_t block_first = first / block_bits;
|
||||
size_t block_last = last / block_bits;
|
||||
size_t range_start = SIZE_MAX;
|
||||
|
@ -80,7 +80,7 @@ void SetRange(Block* bits, size_t first, size_t length) {
|
|||
return;
|
||||
}
|
||||
size_t last = first + length - 1;
|
||||
const size_t block_bits = sizeof(Block) * CHAR_BIT;
|
||||
constexpr size_t block_bits = sizeof(Block) * CHAR_BIT;
|
||||
size_t block_first = first / block_bits;
|
||||
size_t block_last = last / block_bits;
|
||||
Block set_first = ~((Block(1) << (first & (block_bits - 1))) - 1);
|
||||
|
|
|
@ -189,8 +189,8 @@ std::string EscapeMultilineBasicString(const std::string_view view) {
|
|||
}
|
||||
|
||||
std::string EscapeString(const std::string_view view) {
|
||||
const auto multiline_chars = std::string_view("\r\n");
|
||||
const auto escape_chars = std::string_view(
|
||||
constexpr auto multiline_chars = std::string_view("\r\n");
|
||||
constexpr auto escape_chars = std::string_view(
|
||||
"\0\b\v\f"
|
||||
"\x01\x02\x03\x04\x05\x06\x07\x0E\x0F"
|
||||
"\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F"
|
||||
|
|
|
@ -248,8 +248,8 @@ class Logger {
|
|||
uint8_t buffer_[kBufferSize];
|
||||
|
||||
static constexpr size_t kBlockSize = 256;
|
||||
static const size_t kBlockCount = kBufferSize / kBlockSize;
|
||||
static const size_t kBlockIndexMask = kBlockCount - 1;
|
||||
static constexpr size_t kBlockCount = kBufferSize / kBlockSize;
|
||||
static constexpr size_t kBlockIndexMask = kBlockCount - 1;
|
||||
|
||||
static const size_t kClaimStrategyFootprint =
|
||||
sizeof(std::atomic<dp::sequence_t>[kBlockCount]);
|
||||
|
@ -353,14 +353,14 @@ class Logger {
|
|||
? line_range.second[line_range.second_length - 1]
|
||||
: line_range.first[line_range.first_length - 1];
|
||||
if (last_char != '\n') {
|
||||
const char suffix[1] = {'\n'};
|
||||
constexpr char suffix[1] = {'\n'};
|
||||
Write(suffix, 1);
|
||||
}
|
||||
|
||||
rb.EndRead(std::move(line_range));
|
||||
} else {
|
||||
// Always ensure there is a newline.
|
||||
const char suffix[1] = {'\n'};
|
||||
constexpr char suffix[1] = {'\n'};
|
||||
Write(suffix, 1);
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ class Win32MappedMemory : public MappedMemory {
|
|||
public:
|
||||
// CreateFile returns INVALID_HANDLE_VALUE in case of failure.
|
||||
// chrispy: made inline const to get around clang error
|
||||
static inline const HANDLE kFileHandleInvalid = INVALID_HANDLE_VALUE;
|
||||
static inline constexpr HANDLE kFileHandleInvalid = INVALID_HANDLE_VALUE;
|
||||
// CreateFileMapping returns nullptr in case of failure.
|
||||
static constexpr HANDLE kMappingHandleInvalid = nullptr;
|
||||
|
||||
|
|
|
@ -473,7 +473,7 @@ void copy_and_swap_16_unaligned(void* dst_ptr, const void* src_ptr,
|
|||
auto dst = reinterpret_cast<uint8_t*>(dst_ptr);
|
||||
auto src = reinterpret_cast<const uint8_t*>(src_ptr);
|
||||
|
||||
const uint8x16_t tbl_idx =
|
||||
constexpr uint8x16_t tbl_idx =
|
||||
vcombine_u8(vcreate_u8(UINT64_C(0x0607040502030001)),
|
||||
vcreate_u8(UINT64_C(0x0E0F0C0D0A0B0809)));
|
||||
|
||||
|
@ -507,7 +507,7 @@ void copy_and_swap_32_unaligned(void* dst_ptr, const void* src_ptr,
|
|||
auto dst = reinterpret_cast<uint8_t*>(dst_ptr);
|
||||
auto src = reinterpret_cast<const uint8_t*>(src_ptr);
|
||||
|
||||
const uint8x16_t tbl_idx =
|
||||
constexpr uint8x16_t tbl_idx =
|
||||
vcombine_u8(vcreate_u8(UINT64_C(0x405060700010203)),
|
||||
vcreate_u8(UINT64_C(0x0C0D0E0F08090A0B)));
|
||||
|
||||
|
@ -539,7 +539,7 @@ void copy_and_swap_64_unaligned(void* dst_ptr, const void* src_ptr,
|
|||
auto dst = reinterpret_cast<uint8_t*>(dst_ptr);
|
||||
auto src = reinterpret_cast<const uint8_t*>(src_ptr);
|
||||
|
||||
const uint8x16_t tbl_idx =
|
||||
constexpr uint8x16_t tbl_idx =
|
||||
vcombine_u8(vcreate_u8(UINT64_C(0x0001020304050607)),
|
||||
vcreate_u8(UINT64_C(0x08090A0B0C0D0E0F)));
|
||||
|
||||
|
|
|
@ -65,8 +65,8 @@ bool SetProcessPriorityClass(const uint32_t priority_class) {
|
|||
}
|
||||
|
||||
bool IsUseNexusForGameBarEnabled() {
|
||||
const LPCWSTR reg_path = L"SOFTWARE\\Microsoft\\GameBar";
|
||||
const LPCWSTR key = L"UseNexusForGameBarEnabled";
|
||||
constexpr LPCWSTR reg_path = L"SOFTWARE\\Microsoft\\GameBar";
|
||||
constexpr LPCWSTR key = L"UseNexusForGameBarEnabled";
|
||||
|
||||
DWORD value = 0;
|
||||
DWORD dataSize = sizeof(value);
|
||||
|
|
|
@ -206,7 +206,7 @@ void SaveConfig() {
|
|||
line_count = xe::utf8::count(*last);
|
||||
}
|
||||
|
||||
const size_t value_alignment = 50;
|
||||
constexpr size_t value_alignment = 50;
|
||||
const auto& description = config_var->description();
|
||||
if (!description.empty()) {
|
||||
if (line_count < value_alignment) {
|
||||
|
|
|
@ -636,7 +636,7 @@ HostToGuestThunk X64HelperEmitter::EmitHostToGuestThunk() {
|
|||
|
||||
_code_offsets code_offsets = {};
|
||||
|
||||
const size_t stack_size = StackLayout::THUNK_STACK_SIZE;
|
||||
constexpr size_t stack_size = StackLayout::THUNK_STACK_SIZE;
|
||||
|
||||
code_offsets.prolog = getSize();
|
||||
|
||||
|
@ -681,7 +681,7 @@ HostToGuestThunk X64HelperEmitter::EmitHostToGuestThunk() {
|
|||
size_t tail;
|
||||
} code_offsets = {};
|
||||
|
||||
const size_t stack_size = StackLayout::THUNK_STACK_SIZE;
|
||||
constexpr size_t stack_size = StackLayout::THUNK_STACK_SIZE;
|
||||
|
||||
code_offsets.prolog = getSize();
|
||||
// rsp + 0 = return address
|
||||
|
@ -735,7 +735,7 @@ GuestToHostThunk X64HelperEmitter::EmitGuestToHostThunk() {
|
|||
|
||||
_code_offsets code_offsets = {};
|
||||
|
||||
const size_t stack_size = StackLayout::THUNK_STACK_SIZE;
|
||||
constexpr size_t stack_size = StackLayout::THUNK_STACK_SIZE;
|
||||
|
||||
code_offsets.prolog = getSize();
|
||||
|
||||
|
@ -781,7 +781,7 @@ GuestToHostThunk X64HelperEmitter::EmitGuestToHostThunk() {
|
|||
size_t tail;
|
||||
} code_offsets = {};
|
||||
|
||||
const size_t stack_size = StackLayout::THUNK_STACK_SIZE;
|
||||
constexpr size_t stack_size = StackLayout::THUNK_STACK_SIZE;
|
||||
|
||||
code_offsets.prolog = getSize();
|
||||
|
||||
|
@ -838,7 +838,7 @@ ResolveFunctionThunk X64HelperEmitter::EmitResolveFunctionThunk() {
|
|||
|
||||
_code_offsets code_offsets = {};
|
||||
|
||||
const size_t stack_size = StackLayout::THUNK_STACK_SIZE;
|
||||
constexpr size_t stack_size = StackLayout::THUNK_STACK_SIZE;
|
||||
|
||||
code_offsets.prolog = getSize();
|
||||
|
||||
|
@ -878,7 +878,7 @@ ResolveFunctionThunk X64HelperEmitter::EmitResolveFunctionThunk() {
|
|||
size_t epilog;
|
||||
size_t tail;
|
||||
} code_offsets = {};
|
||||
const size_t stack_size = StackLayout::THUNK_STACK_SIZE;
|
||||
constexpr size_t stack_size = StackLayout::THUNK_STACK_SIZE;
|
||||
|
||||
code_offsets.prolog = getSize();
|
||||
|
||||
|
|
|
@ -298,7 +298,7 @@ struct I;
|
|||
template <hir::Opcode OPCODE, typename DEST>
|
||||
struct I<OPCODE, DEST> : DestField<DEST> {
|
||||
typedef DestField<DEST> BASE;
|
||||
static const hir::Opcode opcode = OPCODE;
|
||||
static constexpr hir::Opcode opcode = OPCODE;
|
||||
static const uint32_t key =
|
||||
InstrKey::Construct<OPCODE, DEST::key_type>::value;
|
||||
static const KeyType dest_type = DEST::key_type;
|
||||
|
@ -318,7 +318,7 @@ struct I<OPCODE, DEST> : DestField<DEST> {
|
|||
template <hir::Opcode OPCODE, typename DEST, typename SRC1>
|
||||
struct I<OPCODE, DEST, SRC1> : DestField<DEST> {
|
||||
typedef DestField<DEST> BASE;
|
||||
static const hir::Opcode opcode = OPCODE;
|
||||
static constexpr hir::Opcode opcode = OPCODE;
|
||||
static const uint32_t key =
|
||||
InstrKey::Construct<OPCODE, DEST::key_type, SRC1::key_type>::value;
|
||||
static const KeyType dest_type = DEST::key_type;
|
||||
|
@ -341,7 +341,7 @@ struct I<OPCODE, DEST, SRC1> : DestField<DEST> {
|
|||
template <hir::Opcode OPCODE, typename DEST, typename SRC1, typename SRC2>
|
||||
struct I<OPCODE, DEST, SRC1, SRC2> : DestField<DEST> {
|
||||
typedef DestField<DEST> BASE;
|
||||
static const hir::Opcode opcode = OPCODE;
|
||||
static constexpr hir::Opcode opcode = OPCODE;
|
||||
static const uint32_t key =
|
||||
InstrKey::Construct<OPCODE, DEST::key_type, SRC1::key_type,
|
||||
SRC2::key_type>::value;
|
||||
|
@ -369,7 +369,7 @@ template <hir::Opcode OPCODE, typename DEST, typename SRC1, typename SRC2,
|
|||
typename SRC3>
|
||||
struct I<OPCODE, DEST, SRC1, SRC2, SRC3> : DestField<DEST> {
|
||||
typedef DestField<DEST> BASE;
|
||||
static const hir::Opcode opcode = OPCODE;
|
||||
static constexpr hir::Opcode opcode = OPCODE;
|
||||
static const uint32_t key =
|
||||
InstrKey::Construct<OPCODE, DEST::key_type, SRC1::key_type,
|
||||
SRC2::key_type, SRC3::key_type>::value;
|
||||
|
|
|
@ -95,7 +95,7 @@ class StackLayout {
|
|||
});
|
||||
static_assert(sizeof(Thunk) % 16 == 0,
|
||||
"sizeof(Thunk) must be a multiple of 16!");
|
||||
static const size_t THUNK_STACK_SIZE = sizeof(Thunk) + 8;
|
||||
static constexpr size_t THUNK_STACK_SIZE = sizeof(Thunk) + 8;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -121,16 +121,16 @@ class StackLayout {
|
|||
* +------------------+
|
||||
*
|
||||
*/
|
||||
static const size_t GUEST_STACK_SIZE = 104;
|
||||
static constexpr size_t GUEST_STACK_SIZE = 104;
|
||||
// was GUEST_CTX_HOME, can't remove because that'd throw stack alignment off.
|
||||
// instead, can be used as a temporary in sequences
|
||||
static const size_t GUEST_SCRATCH = 0;
|
||||
static constexpr size_t GUEST_SCRATCH = 0;
|
||||
|
||||
// when profiling is on, this stores the nanosecond time at the start of the
|
||||
// function
|
||||
static const size_t GUEST_PROFILER_START = 80;
|
||||
static const size_t GUEST_RET_ADDR = 88;
|
||||
static const size_t GUEST_CALL_RET_ADDR = 96;
|
||||
static constexpr size_t GUEST_PROFILER_START = 80;
|
||||
static constexpr size_t GUEST_RET_ADDR = 88;
|
||||
static constexpr size_t GUEST_CALL_RET_ADDR = 96;
|
||||
};
|
||||
|
||||
} // namespace x64
|
||||
|
|
|
@ -55,7 +55,7 @@ void DebugWindow::DebugDialog::OnDraw(ImGuiIO& io) {
|
|||
debug_window_.DrawFrame(io);
|
||||
}
|
||||
|
||||
static const std::string kBaseTitle = "Xenia Debugger";
|
||||
static constexpr std::string_view kBaseTitle = "Xenia Debugger";
|
||||
|
||||
DebugWindow::DebugWindow(Emulator* emulator,
|
||||
xe::ui::WindowedAppContext& app_context)
|
||||
|
@ -1460,7 +1460,7 @@ void DebugWindow::UpdateCache() {
|
|||
auto object_table = kernel_state->object_table();
|
||||
|
||||
app_context_.CallInUIThread([this]() {
|
||||
std::string title = kBaseTitle;
|
||||
std::string title = std::string(kBaseTitle);
|
||||
switch (processor_->execution_state()) {
|
||||
case cpu::ExecutionState::kEnded:
|
||||
title += " (ended)";
|
||||
|
|
|
@ -137,8 +137,8 @@ class DebugWindow : public cpu::DebugListener {
|
|||
// The current state of the UI. Use this to synchronize multiple parts of the
|
||||
// UI.
|
||||
struct ImState {
|
||||
static const int kRightPaneThreads = 0;
|
||||
static const int kRightPaneMemory = 1;
|
||||
static constexpr int kRightPaneThreads = 0;
|
||||
static constexpr int kRightPaneMemory = 1;
|
||||
int right_pane_tab = kRightPaneThreads;
|
||||
|
||||
cpu::ThreadDebugInfo* thread_info = nullptr;
|
||||
|
|
|
@ -285,7 +285,7 @@ void CommandProcessor::WorkerThreadMain() {
|
|||
do {
|
||||
// If we spin around too much, revert to a "low-power" state.
|
||||
if (loop_count > 500) {
|
||||
const int wait_time_ms = 2;
|
||||
constexpr int wait_time_ms = 2;
|
||||
xe::threading::Wait(write_ptr_index_event_.get(), true,
|
||||
std::chrono::milliseconds(wait_time_ms));
|
||||
} else {
|
||||
|
|
|
@ -109,7 +109,7 @@ namespace shaders {
|
|||
#include "xenia/gpu/shaders/bytecode/d3d12_5_1/resolve_full_8bpp_scaled_cs.h"
|
||||
} // namespace shaders
|
||||
|
||||
const D3D12RenderTargetCache::ResolveCopyShaderCode
|
||||
constexpr D3D12RenderTargetCache::ResolveCopyShaderCode
|
||||
D3D12RenderTargetCache::kResolveCopyShaders[size_t(
|
||||
draw_util::ResolveCopyShaderIndex::kCount)] = {
|
||||
{shaders::resolve_fast_32bpp_1x2xmsaa_cs,
|
||||
|
@ -146,7 +146,7 @@ const D3D12RenderTargetCache::ResolveCopyShaderCode
|
|||
sizeof(shaders::resolve_full_128bpp_scaled_cs)},
|
||||
};
|
||||
|
||||
const uint32_t D3D12RenderTargetCache::kTransferUsedRootParameters[size_t(
|
||||
constexpr uint32_t D3D12RenderTargetCache::kTransferUsedRootParameters[size_t(
|
||||
TransferRootSignatureIndex::kCount)] = {
|
||||
// kColor
|
||||
kTransferUsedRootParameterColorSRVBit |
|
||||
|
@ -184,7 +184,7 @@ const uint32_t D3D12RenderTargetCache::kTransferUsedRootParameters[size_t(
|
|||
kTransferUsedRootParameterHostDepthAddressConstantBit,
|
||||
};
|
||||
|
||||
const D3D12RenderTargetCache::TransferModeInfo
|
||||
constexpr D3D12RenderTargetCache::TransferModeInfo
|
||||
D3D12RenderTargetCache::kTransferModes[size_t(TransferMode::kCount)] = {
|
||||
// kColorToDepth
|
||||
{TransferOutput::kDepth, TransferRootSignatureIndex::kColor,
|
||||
|
|
|
@ -269,7 +269,7 @@ class DeferredCommandList {
|
|||
return;
|
||||
}
|
||||
static_assert(alignof(D3D12_RESOURCE_BARRIER) <= alignof(uintmax_t));
|
||||
const size_t header_size =
|
||||
constexpr size_t header_size =
|
||||
xe::align(sizeof(UINT), alignof(D3D12_RESOURCE_BARRIER));
|
||||
uint8_t* args = reinterpret_cast<uint8_t*>(WriteCommand(
|
||||
Command::kD3DResourceBarrier,
|
||||
|
|
|
@ -272,7 +272,7 @@ void PipelineCache::InitializeShaderStorage(
|
|||
}
|
||||
pipeline_storage_file_flush_needed_ = false;
|
||||
// 'XEPS'.
|
||||
const uint32_t pipeline_storage_magic = 0x53504558;
|
||||
constexpr uint32_t pipeline_storage_magic = 0x53504558;
|
||||
// 'DXRO' or 'DXRT'.
|
||||
const uint32_t pipeline_storage_magic_api =
|
||||
edram_rov_used ? 0x4F525844 : 0x54525844;
|
||||
|
@ -367,7 +367,7 @@ void PipelineCache::InitializeShaderStorage(
|
|||
uint32_t version_swapped;
|
||||
} shader_storage_file_header;
|
||||
// 'XESH'.
|
||||
const uint32_t shader_storage_magic = 0x48534558;
|
||||
constexpr uint32_t shader_storage_magic = 0x48534558;
|
||||
if (fread(&shader_storage_file_header, sizeof(shader_storage_file_header), 1,
|
||||
shader_storage_file_) &&
|
||||
shader_storage_file_header.magic == shader_storage_magic &&
|
||||
|
@ -1577,7 +1577,7 @@ bool PipelineCache::GetCurrentStateDescription(
|
|||
|
||||
// Render targets and blending state. 32 because of 0x1F mask, for safety
|
||||
// (all unknown to zero).
|
||||
static const PipelineBlendFactor kBlendFactorMap[32] = {
|
||||
static constexpr PipelineBlendFactor kBlendFactorMap[32] = {
|
||||
/* 0 */ PipelineBlendFactor::kZero,
|
||||
/* 1 */ PipelineBlendFactor::kOne,
|
||||
/* 2 */ PipelineBlendFactor::kZero, // ?
|
||||
|
@ -1603,7 +1603,7 @@ bool PipelineCache::GetCurrentStateDescription(
|
|||
// Like kBlendFactorMap, but with color modes changed to alpha. Some
|
||||
// pipelines aren't created in 545407E0 because a color mode is used for
|
||||
// alpha.
|
||||
static const PipelineBlendFactor kBlendFactorAlphaMap[32] = {
|
||||
static constexpr PipelineBlendFactor kBlendFactorAlphaMap[32] = {
|
||||
/* 0 */ PipelineBlendFactor::kZero,
|
||||
/* 1 */ PipelineBlendFactor::kOne,
|
||||
/* 2 */ PipelineBlendFactor::kZero, // ?
|
||||
|
|
|
@ -907,7 +907,7 @@ void GetResolveEdramTileSpan(ResolveEdramInfo edram_info,
|
|||
rows_out = y1 - y0;
|
||||
}
|
||||
|
||||
const ResolveCopyShaderInfo
|
||||
constexpr ResolveCopyShaderInfo
|
||||
resolve_copy_shader_info[size_t(ResolveCopyShaderIndex::kCount)] = {
|
||||
{"Resolve Copy Fast 32bpp 1x/2xMSAA", false, 4, 4, 6, 3},
|
||||
{"Resolve Copy Fast 32bpp 4xMSAA", false, 4, 4, 6, 3},
|
||||
|
|
|
@ -2051,7 +2051,7 @@ void DxbcShaderTranslator::ProcessAllocInstruction(
|
|||
}
|
||||
}
|
||||
|
||||
const DxbcShaderTranslator::ShaderRdefType
|
||||
constexpr DxbcShaderTranslator::ShaderRdefType
|
||||
DxbcShaderTranslator::rdef_types_[size_t(
|
||||
DxbcShaderTranslator::ShaderRdefTypeIndex::kCount)] = {
|
||||
// kFloat
|
||||
|
@ -2104,7 +2104,7 @@ const DxbcShaderTranslator::ShaderRdefType
|
|||
dxbc::RdefVariableType::kUInt, 1, 4, 0, ShaderRdefTypeIndex::kUint4},
|
||||
};
|
||||
|
||||
const DxbcShaderTranslator::SystemConstantRdef
|
||||
constexpr DxbcShaderTranslator::SystemConstantRdef
|
||||
DxbcShaderTranslator::system_constant_rdef_[size_t(
|
||||
DxbcShaderTranslator::SystemConstants::Index::kCount)] = {
|
||||
{"xe_flags", ShaderRdefTypeIndex::kUint, sizeof(uint32_t)},
|
||||
|
|
|
@ -47,8 +47,8 @@ PacketCategory PacketDisassembler::GetPacketCategory(const uint8_t* base_ptr) {
|
|||
bool PacketDisassembler::DisasmPacketType0(const uint8_t* base_ptr,
|
||||
uint32_t packet,
|
||||
PacketInfo* out_info) {
|
||||
static const PacketTypeInfo type_0_info = {PacketCategory::kGeneric,
|
||||
"PM4_TYPE0"};
|
||||
static constexpr PacketTypeInfo type_0_info = {PacketCategory::kGeneric,
|
||||
"PM4_TYPE0"};
|
||||
out_info->type_info = &type_0_info;
|
||||
|
||||
uint32_t count = ((packet >> 16) & 0x3FFF) + 1;
|
||||
|
@ -72,8 +72,8 @@ bool PacketDisassembler::DisasmPacketType0(const uint8_t* base_ptr,
|
|||
bool PacketDisassembler::DisasmPacketType1(const uint8_t* base_ptr,
|
||||
uint32_t packet,
|
||||
PacketInfo* out_info) {
|
||||
static const PacketTypeInfo type_1_info = {PacketCategory::kGeneric,
|
||||
"PM4_TYPE1"};
|
||||
static constexpr PacketTypeInfo type_1_info = {PacketCategory::kGeneric,
|
||||
"PM4_TYPE1"};
|
||||
out_info->type_info = &type_1_info;
|
||||
|
||||
out_info->count = 1 + 2;
|
||||
|
@ -94,8 +94,8 @@ bool PacketDisassembler::DisasmPacketType1(const uint8_t* base_ptr,
|
|||
bool PacketDisassembler::DisasmPacketType2(const uint8_t* base_ptr,
|
||||
uint32_t packet,
|
||||
PacketInfo* out_info) {
|
||||
static const PacketTypeInfo type_2_info = {PacketCategory::kGeneric,
|
||||
"PM4_TYPE2"};
|
||||
static constexpr PacketTypeInfo type_2_info = {PacketCategory::kGeneric,
|
||||
"PM4_TYPE2"};
|
||||
out_info->type_info = &type_2_info;
|
||||
|
||||
out_info->count = 1;
|
||||
|
@ -106,8 +106,8 @@ bool PacketDisassembler::DisasmPacketType2(const uint8_t* base_ptr,
|
|||
bool PacketDisassembler::DisasmPacketType3(const uint8_t* base_ptr,
|
||||
uint32_t packet,
|
||||
PacketInfo* out_info) {
|
||||
static const PacketTypeInfo type_3_unknown_info = {PacketCategory::kGeneric,
|
||||
"PM4_TYPE3_UNKNOWN"};
|
||||
static constexpr PacketTypeInfo type_3_unknown_info = {
|
||||
PacketCategory::kGeneric, "PM4_TYPE3_UNKNOWN"};
|
||||
out_info->type_info = &type_3_unknown_info;
|
||||
|
||||
uint32_t opcode = (packet >> 8) & 0x7F;
|
||||
|
@ -127,8 +127,8 @@ bool PacketDisassembler::DisasmPacketType3(const uint8_t* base_ptr,
|
|||
switch (opcode) {
|
||||
case PM4_ME_INIT: {
|
||||
// initialize CP's micro-engine
|
||||
static const PacketTypeInfo op_info = {PacketCategory::kGeneric,
|
||||
"PM4_ME_INIT"};
|
||||
static constexpr PacketTypeInfo op_info = {PacketCategory::kGeneric,
|
||||
"PM4_ME_INIT"};
|
||||
|
||||
out_actions.emplace_back(PacketAction::MeInit((uint32_t*)ptr, count));
|
||||
|
||||
|
@ -138,15 +138,15 @@ bool PacketDisassembler::DisasmPacketType3(const uint8_t* base_ptr,
|
|||
case PM4_NOP: {
|
||||
// skip N 32-bit words to get to the next packet
|
||||
// No-op, ignore some data.
|
||||
static const PacketTypeInfo op_info = {PacketCategory::kGeneric,
|
||||
"PM4_NOP"};
|
||||
static constexpr PacketTypeInfo op_info = {PacketCategory::kGeneric,
|
||||
"PM4_NOP"};
|
||||
out_info->type_info = &op_info;
|
||||
break;
|
||||
}
|
||||
case PM4_INTERRUPT: {
|
||||
// generate interrupt from the command stream
|
||||
static const PacketTypeInfo op_info = {PacketCategory::kGeneric,
|
||||
"PM4_INTERRUPT"};
|
||||
static constexpr PacketTypeInfo op_info = {PacketCategory::kGeneric,
|
||||
"PM4_INTERRUPT"};
|
||||
out_info->type_info = &op_info;
|
||||
|
||||
PacketAction intaction;
|
||||
|
@ -160,8 +160,8 @@ bool PacketDisassembler::DisasmPacketType3(const uint8_t* base_ptr,
|
|||
// VdSwap will post this to tell us we need to swap the screen/fire an
|
||||
// interrupt.
|
||||
// 63 words here, but only the first has any data.
|
||||
static const PacketTypeInfo op_info = {PacketCategory::kSwap,
|
||||
"PM4_XE_SWAP"};
|
||||
static constexpr PacketTypeInfo op_info = {PacketCategory::kSwap,
|
||||
"PM4_XE_SWAP"};
|
||||
out_info->type_info = &op_info;
|
||||
|
||||
PacketAction xsa;
|
||||
|
@ -175,8 +175,8 @@ bool PacketDisassembler::DisasmPacketType3(const uint8_t* base_ptr,
|
|||
case PM4_INDIRECT_BUFFER:
|
||||
case PM4_INDIRECT_BUFFER_PFD: {
|
||||
// indirect buffer dispatch
|
||||
static const PacketTypeInfo op_info = {PacketCategory::kGeneric,
|
||||
"PM4_INDIRECT_BUFFER"};
|
||||
static constexpr PacketTypeInfo op_info = {PacketCategory::kGeneric,
|
||||
"PM4_INDIRECT_BUFFER"};
|
||||
out_info->type_info = &op_info;
|
||||
|
||||
PacketAction iba;
|
||||
|
@ -189,8 +189,8 @@ bool PacketDisassembler::DisasmPacketType3(const uint8_t* base_ptr,
|
|||
}
|
||||
case PM4_WAIT_REG_MEM: {
|
||||
// wait until a register or memory location is a specific value
|
||||
static const PacketTypeInfo op_info = {PacketCategory::kGeneric,
|
||||
"PM4_WAIT_REG_MEM"};
|
||||
static constexpr PacketTypeInfo op_info = {PacketCategory::kGeneric,
|
||||
"PM4_WAIT_REG_MEM"};
|
||||
out_info->type_info = &op_info;
|
||||
|
||||
PacketAction wait_action;
|
||||
|
@ -209,8 +209,8 @@ bool PacketDisassembler::DisasmPacketType3(const uint8_t* base_ptr,
|
|||
case PM4_REG_RMW: {
|
||||
// register read/modify/write
|
||||
// ? (used during shader upload and edram setup)
|
||||
static const PacketTypeInfo op_info = {PacketCategory::kGeneric,
|
||||
"PM4_REG_RMW"};
|
||||
static constexpr PacketTypeInfo op_info = {PacketCategory::kGeneric,
|
||||
"PM4_REG_RMW"};
|
||||
out_info->type_info = &op_info;
|
||||
PacketAction rmw_action;
|
||||
rmw_action.type = PacketAction::Type::kRegRmw;
|
||||
|
@ -227,8 +227,8 @@ bool PacketDisassembler::DisasmPacketType3(const uint8_t* base_ptr,
|
|||
}
|
||||
case PM4_COND_WRITE: {
|
||||
// conditional write to memory or register
|
||||
static const PacketTypeInfo op_info = {PacketCategory::kGeneric,
|
||||
"PM4_COND_WRITE"};
|
||||
static constexpr PacketTypeInfo op_info = {PacketCategory::kGeneric,
|
||||
"PM4_COND_WRITE"};
|
||||
out_info->type_info = &op_info;
|
||||
PacketAction cwr_action;
|
||||
cwr_action.type = PacketAction::Type::kCondWrite;
|
||||
|
@ -247,8 +247,8 @@ bool PacketDisassembler::DisasmPacketType3(const uint8_t* base_ptr,
|
|||
}
|
||||
case PM4_EVENT_WRITE: {
|
||||
// generate an event that creates a write to memory when completed
|
||||
static const PacketTypeInfo op_info = {PacketCategory::kGeneric,
|
||||
"PM4_EVENT_WRITE"};
|
||||
static constexpr PacketTypeInfo op_info = {PacketCategory::kGeneric,
|
||||
"PM4_EVENT_WRITE"};
|
||||
out_info->type_info = &op_info;
|
||||
PacketAction evw_action;
|
||||
evw_action.type = Type::kEventWrite;
|
||||
|
@ -260,8 +260,8 @@ bool PacketDisassembler::DisasmPacketType3(const uint8_t* base_ptr,
|
|||
}
|
||||
case PM4_EVENT_WRITE_SHD: {
|
||||
// generate a VS|PS_done event
|
||||
static const PacketTypeInfo op_info = {PacketCategory::kGeneric,
|
||||
"PM4_EVENT_WRITE_SHD"};
|
||||
static constexpr PacketTypeInfo op_info = {PacketCategory::kGeneric,
|
||||
"PM4_EVENT_WRITE_SHD"};
|
||||
out_info->type_info = &op_info;
|
||||
PacketAction evws_action;
|
||||
evws_action.type = Type::kEventWriteSHD;
|
||||
|
@ -276,8 +276,8 @@ bool PacketDisassembler::DisasmPacketType3(const uint8_t* base_ptr,
|
|||
}
|
||||
case PM4_EVENT_WRITE_EXT: {
|
||||
// generate a screen extent event
|
||||
static const PacketTypeInfo op_info = {PacketCategory::kGeneric,
|
||||
"PM4_EVENT_WRITE_EXT"};
|
||||
static constexpr PacketTypeInfo op_info = {PacketCategory::kGeneric,
|
||||
"PM4_EVENT_WRITE_EXT"};
|
||||
out_info->type_info = &op_info;
|
||||
|
||||
PacketAction eve_action;
|
||||
|
@ -295,8 +295,8 @@ bool PacketDisassembler::DisasmPacketType3(const uint8_t* base_ptr,
|
|||
case PM4_DRAW_INDX: {
|
||||
// initiate fetch of index buffer and draw
|
||||
// dword0 = viz query info
|
||||
static const PacketTypeInfo op_info = {PacketCategory::kDraw,
|
||||
"PM4_DRAW_INDX"};
|
||||
static constexpr PacketTypeInfo op_info = {PacketCategory::kDraw,
|
||||
"PM4_DRAW_INDX"};
|
||||
out_info->type_info = &op_info;
|
||||
uint32_t dword0 = xe::load_and_swap<uint32_t>(ptr + 0);
|
||||
uint32_t dword1 = xe::load_and_swap<uint32_t>(ptr + 4);
|
||||
|
@ -337,8 +337,8 @@ bool PacketDisassembler::DisasmPacketType3(const uint8_t* base_ptr,
|
|||
}
|
||||
case PM4_DRAW_INDX_2: {
|
||||
// draw using supplied indices in packet
|
||||
static const PacketTypeInfo op_info = {PacketCategory::kDraw,
|
||||
"PM4_DRAW_INDX_2"};
|
||||
static constexpr PacketTypeInfo op_info = {PacketCategory::kDraw,
|
||||
"PM4_DRAW_INDX_2"};
|
||||
out_info->type_info = &op_info;
|
||||
uint32_t dword0 = xe::load_and_swap<uint32_t>(ptr + 0);
|
||||
uint32_t index_count = dword0 >> 16;
|
||||
|
@ -372,8 +372,8 @@ bool PacketDisassembler::DisasmPacketType3(const uint8_t* base_ptr,
|
|||
// load constant into chip and to memory
|
||||
// PM4_REG(reg) ((0x4 << 16) | (GSL_HAL_SUBBLOCK_OFFSET(reg)))
|
||||
// reg - 0x2000
|
||||
static const PacketTypeInfo op_info = {PacketCategory::kGeneric,
|
||||
"PM4_SET_CONSTANT"};
|
||||
static constexpr PacketTypeInfo op_info = {PacketCategory::kGeneric,
|
||||
"PM4_SET_CONSTANT"};
|
||||
out_info->type_info = &op_info;
|
||||
uint32_t offset_type = xe::load_and_swap<uint32_t>(ptr + 0);
|
||||
uint32_t index = offset_type & 0x7FF;
|
||||
|
@ -407,8 +407,8 @@ bool PacketDisassembler::DisasmPacketType3(const uint8_t* base_ptr,
|
|||
break;
|
||||
}
|
||||
case PM4_SET_CONSTANT2: {
|
||||
static const PacketTypeInfo op_info = {PacketCategory::kGeneric,
|
||||
"PM4_SET_CONSTANT2"};
|
||||
static constexpr PacketTypeInfo op_info = {PacketCategory::kGeneric,
|
||||
"PM4_SET_CONSTANT2"};
|
||||
out_info->type_info = &op_info;
|
||||
uint32_t offset_type = xe::load_and_swap<uint32_t>(ptr + 0);
|
||||
uint32_t index = offset_type & 0xFFFF;
|
||||
|
@ -424,8 +424,8 @@ bool PacketDisassembler::DisasmPacketType3(const uint8_t* base_ptr,
|
|||
}
|
||||
case PM4_LOAD_ALU_CONSTANT: {
|
||||
// load constants from memory
|
||||
static const PacketTypeInfo op_info = {PacketCategory::kGeneric,
|
||||
"PM4_LOAD_ALU_CONSTANT"};
|
||||
static constexpr PacketTypeInfo op_info = {PacketCategory::kGeneric,
|
||||
"PM4_LOAD_ALU_CONSTANT"};
|
||||
out_info->type_info = &op_info;
|
||||
uint32_t address = xe::load_and_swap<uint32_t>(ptr + 0);
|
||||
address &= 0x3FFFFFFF;
|
||||
|
@ -465,8 +465,8 @@ bool PacketDisassembler::DisasmPacketType3(const uint8_t* base_ptr,
|
|||
break;
|
||||
}
|
||||
case PM4_SET_SHADER_CONSTANTS: {
|
||||
static const PacketTypeInfo op_info = {PacketCategory::kGeneric,
|
||||
"PM4_SET_SHADER_CONSTANTS"};
|
||||
static constexpr PacketTypeInfo op_info = {PacketCategory::kGeneric,
|
||||
"PM4_SET_SHADER_CONSTANTS"};
|
||||
out_info->type_info = &op_info;
|
||||
uint32_t offset_type = xe::load_and_swap<uint32_t>(ptr + 0);
|
||||
uint32_t index = offset_type & 0xFFFF;
|
||||
|
@ -481,8 +481,8 @@ bool PacketDisassembler::DisasmPacketType3(const uint8_t* base_ptr,
|
|||
}
|
||||
case PM4_IM_LOAD: {
|
||||
// load sequencer instruction memory (pointer-based)
|
||||
static const PacketTypeInfo op_info = {PacketCategory::kGeneric,
|
||||
"PM4_IM_LOAD"};
|
||||
static constexpr PacketTypeInfo op_info = {PacketCategory::kGeneric,
|
||||
"PM4_IM_LOAD"};
|
||||
out_info->type_info = &op_info;
|
||||
uint32_t addr_type = xe::load_and_swap<uint32_t>(ptr + 0);
|
||||
auto shader_type = static_cast<xenos::ShaderType>(addr_type & 0x3);
|
||||
|
@ -506,8 +506,8 @@ bool PacketDisassembler::DisasmPacketType3(const uint8_t* base_ptr,
|
|||
}
|
||||
case PM4_IM_LOAD_IMMEDIATE: {
|
||||
// load sequencer instruction memory (code embedded in packet)
|
||||
static const PacketTypeInfo op_info = {PacketCategory::kGeneric,
|
||||
"PM4_IM_LOAD_IMMEDIATE"};
|
||||
static constexpr PacketTypeInfo op_info = {PacketCategory::kGeneric,
|
||||
"PM4_IM_LOAD_IMMEDIATE"};
|
||||
out_info->type_info = &op_info;
|
||||
uint32_t dword0 = xe::load_and_swap<uint32_t>(ptr + 0);
|
||||
uint32_t dword1 = xe::load_and_swap<uint32_t>(ptr + 4);
|
||||
|
@ -534,8 +534,8 @@ bool PacketDisassembler::DisasmPacketType3(const uint8_t* base_ptr,
|
|||
}
|
||||
case PM4_INVALIDATE_STATE: {
|
||||
// selective invalidation of state pointers
|
||||
static const PacketTypeInfo op_info = {PacketCategory::kGeneric,
|
||||
"PM4_INVALIDATE_STATE"};
|
||||
static constexpr PacketTypeInfo op_info = {PacketCategory::kGeneric,
|
||||
"PM4_INVALIDATE_STATE"};
|
||||
out_info->type_info = &op_info;
|
||||
uint32_t mask = xe::load_and_swap<uint32_t>(ptr + 0);
|
||||
|
||||
|
@ -547,8 +547,8 @@ bool PacketDisassembler::DisasmPacketType3(const uint8_t* base_ptr,
|
|||
break;
|
||||
}
|
||||
case PM4_SET_BIN_MASK_LO: {
|
||||
static const PacketTypeInfo op_info = {PacketCategory::kGeneric,
|
||||
"PM4_SET_BIN_MASK_LO"};
|
||||
static constexpr PacketTypeInfo op_info = {PacketCategory::kGeneric,
|
||||
"PM4_SET_BIN_MASK_LO"};
|
||||
out_info->type_info = &op_info;
|
||||
uint32_t value = xe::load_and_swap<uint32_t>(ptr);
|
||||
// bin_mask_ = (bin_mask_ & 0xFFFFFFFF00000000ull) | value;
|
||||
|
@ -561,8 +561,8 @@ bool PacketDisassembler::DisasmPacketType3(const uint8_t* base_ptr,
|
|||
break;
|
||||
}
|
||||
case PM4_SET_BIN_MASK_HI: {
|
||||
static const PacketTypeInfo op_info = {PacketCategory::kGeneric,
|
||||
"PM4_SET_BIN_MASK_HI"};
|
||||
static constexpr PacketTypeInfo op_info = {PacketCategory::kGeneric,
|
||||
"PM4_SET_BIN_MASK_HI"};
|
||||
out_info->type_info = &op_info;
|
||||
uint32_t value = xe::load_and_swap<uint32_t>(ptr);
|
||||
|
||||
|
@ -573,8 +573,8 @@ bool PacketDisassembler::DisasmPacketType3(const uint8_t* base_ptr,
|
|||
break;
|
||||
}
|
||||
case PM4_SET_BIN_SELECT_LO: {
|
||||
static const PacketTypeInfo op_info = {PacketCategory::kGeneric,
|
||||
"PM4_SET_BIN_SELECT_LO"};
|
||||
static constexpr PacketTypeInfo op_info = {PacketCategory::kGeneric,
|
||||
"PM4_SET_BIN_SELECT_LO"};
|
||||
out_info->type_info = &op_info;
|
||||
uint32_t value = xe::load_and_swap<uint32_t>(ptr);
|
||||
PacketAction action;
|
||||
|
@ -585,8 +585,8 @@ bool PacketDisassembler::DisasmPacketType3(const uint8_t* base_ptr,
|
|||
break;
|
||||
}
|
||||
case PM4_SET_BIN_SELECT_HI: {
|
||||
static const PacketTypeInfo op_info = {PacketCategory::kGeneric,
|
||||
"PM4_SET_BIN_SELECT_HI"};
|
||||
static constexpr PacketTypeInfo op_info = {PacketCategory::kGeneric,
|
||||
"PM4_SET_BIN_SELECT_HI"};
|
||||
out_info->type_info = &op_info;
|
||||
uint32_t value = xe::load_and_swap<uint32_t>(ptr);
|
||||
|
||||
|
@ -670,14 +670,14 @@ bool PacketDisassembler::DisasmPacketType3(const uint8_t* base_ptr,
|
|||
|
||||
// Ignored packets - useful if breaking on the default handler below.
|
||||
case 0x50: { // 0xC0015000 usually 2 words, 0xFFFFFFFF / 0x00000000
|
||||
static const PacketTypeInfo op_info = {PacketCategory::kGeneric,
|
||||
"PM4_TYPE3_0x50"};
|
||||
static constexpr PacketTypeInfo op_info = {PacketCategory::kGeneric,
|
||||
"PM4_TYPE3_0x50"};
|
||||
out_info->type_info = &op_info;
|
||||
break;
|
||||
}
|
||||
case 0x51: { // 0xC0015100 usually 2 words, 0xFFFFFFFF / 0xFFFFFFFF
|
||||
static const PacketTypeInfo op_info = {PacketCategory::kGeneric,
|
||||
"PM4_TYPE3_0x51"};
|
||||
static constexpr PacketTypeInfo op_info = {PacketCategory::kGeneric,
|
||||
"PM4_TYPE3_0x51"};
|
||||
out_info->type_info = &op_info;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -763,7 +763,7 @@ void SpirvShaderTranslator::ProcessTextureFetchInstruction(
|
|||
// multiplication in texture sampling apparently round differently, so
|
||||
// `mul` gives a value that would be floored as expected, but the
|
||||
// left/upper pixel is still sampled instead.
|
||||
const float kRoundingOffset = 1.5f / 1024.0f;
|
||||
constexpr float kRoundingOffset = 1.5f / 1024.0f;
|
||||
switch (instr.dimension) {
|
||||
case xenos::FetchOpDimension::k1D:
|
||||
offset_values[0] = instr.attributes.offset_x + kRoundingOffset;
|
||||
|
|
|
@ -19,7 +19,7 @@ using namespace xe::gpu::xenos;
|
|||
#define FORMAT_INFO(texture_format, format, block_width, block_height, bits_per_pixel) \
|
||||
{xenos::TextureFormat::texture_format, FormatType::format, block_width, block_height, bits_per_pixel}
|
||||
const FormatInfo* FormatInfo::Get(uint32_t gpu_format) {
|
||||
static const FormatInfo format_infos[64] = {
|
||||
static constexpr FormatInfo format_infos[64] = {
|
||||
#include "texture_info_formats.inl"
|
||||
};
|
||||
return &format_infos[gpu_format];
|
||||
|
|
|
@ -306,7 +306,7 @@ class DeferredCommandBuffer {
|
|||
|
||||
void CmdVkSetScissor(uint32_t first_scissor, uint32_t scissor_count,
|
||||
const VkRect2D* scissors) {
|
||||
const size_t header_size =
|
||||
constexpr size_t header_size =
|
||||
xe::align(sizeof(ArgsVkSetScissor), alignof(VkRect2D));
|
||||
uint8_t* args_ptr = reinterpret_cast<uint8_t*>(
|
||||
WriteCommand(Command::kVkSetScissor,
|
||||
|
@ -345,7 +345,7 @@ class DeferredCommandBuffer {
|
|||
|
||||
void CmdVkSetViewport(uint32_t first_viewport, uint32_t viewport_count,
|
||||
const VkViewport* viewports) {
|
||||
const size_t header_size =
|
||||
constexpr size_t header_size =
|
||||
xe::align(sizeof(ArgsVkSetViewport), alignof(VkViewport));
|
||||
uint8_t* args_ptr = reinterpret_cast<uint8_t*>(
|
||||
WriteCommand(Command::kVkSetViewport,
|
||||
|
|
|
@ -54,18 +54,18 @@ namespace shaders {
|
|||
#include "xenia/gpu/shaders/bytecode/vulkan_spirv/fullscreen_cw_vs.h"
|
||||
} // namespace shaders
|
||||
|
||||
const VkDescriptorPoolSize
|
||||
constexpr VkDescriptorPoolSize
|
||||
VulkanCommandProcessor::kDescriptorPoolSizeUniformBuffer = {
|
||||
VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER,
|
||||
SpirvShaderTranslator::kConstantBufferCount*
|
||||
kLinkedTypeDescriptorPoolSetCount};
|
||||
|
||||
const VkDescriptorPoolSize
|
||||
constexpr VkDescriptorPoolSize
|
||||
VulkanCommandProcessor::kDescriptorPoolSizeStorageBuffer = {
|
||||
VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, kLinkedTypeDescriptorPoolSetCount};
|
||||
|
||||
// 2x descriptors for texture images because of unsigned and signed bindings.
|
||||
const VkDescriptorPoolSize
|
||||
constexpr VkDescriptorPoolSize
|
||||
VulkanCommandProcessor::kDescriptorPoolSizeTextures[2] = {
|
||||
{VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE,
|
||||
2 * kLinkedTypeDescriptorPoolSetCount},
|
||||
|
|
|
@ -442,7 +442,7 @@ void VulkanPipelineCache::WritePipelineRenderTargetDescription(
|
|||
if (write_mask) {
|
||||
assert_zero(write_mask & ~uint32_t(0b1111));
|
||||
// 32 because of 0x1F mask, for safety (all unknown to zero).
|
||||
static const PipelineBlendFactor kBlendFactorMap[32] = {
|
||||
static constexpr PipelineBlendFactor kBlendFactorMap[32] = {
|
||||
/* 0 */ PipelineBlendFactor::kZero,
|
||||
/* 1 */ PipelineBlendFactor::kOne,
|
||||
/* 2 */ PipelineBlendFactor::kZero, // ?
|
||||
|
|
|
@ -88,7 +88,7 @@ namespace shaders {
|
|||
static_assert(VK_FORMAT_UNDEFINED == VkFormat(0),
|
||||
"Assuming that skipping a VkFormat in an initializer results in "
|
||||
"VK_FORMAT_UNDEFINED");
|
||||
const VulkanTextureCache::HostFormatPair
|
||||
constexpr VulkanTextureCache::HostFormatPair
|
||||
VulkanTextureCache::kBestHostFormats[64] = {
|
||||
// k_1_REVERSE
|
||||
{{kLoadShaderIndexUnknown},
|
||||
|
@ -408,14 +408,14 @@ const VulkanTextureCache::HostFormatPair
|
|||
// Always decompressing them to RGBA8, which is required to be linear-filterable
|
||||
// as UNORM and SNORM.
|
||||
|
||||
const VulkanTextureCache::HostFormatPair
|
||||
constexpr VulkanTextureCache::HostFormatPair
|
||||
VulkanTextureCache::kHostFormatGBGRUnaligned = {
|
||||
{kLoadShaderIndexGBGR8ToRGB8, VK_FORMAT_R8G8B8A8_UNORM, false, true},
|
||||
{kLoadShaderIndexGBGR8ToRGB8, VK_FORMAT_R8G8B8A8_SNORM, false, true},
|
||||
xenos::XE_GPU_TEXTURE_SWIZZLE_RGBB,
|
||||
true};
|
||||
|
||||
const VulkanTextureCache::HostFormatPair
|
||||
constexpr VulkanTextureCache::HostFormatPair
|
||||
VulkanTextureCache::kHostFormatBGRGUnaligned = {
|
||||
{kLoadShaderIndexBGRG8ToRGB8, VK_FORMAT_R8G8B8A8_UNORM, false, true},
|
||||
{kLoadShaderIndexBGRG8ToRGB8, VK_FORMAT_R8G8B8A8_SNORM, false, true},
|
||||
|
|
|
@ -221,7 +221,7 @@ bool HidDemoApp::OnInitialize() {
|
|||
void HidDemoApp::HidDemoDialog::OnDraw(ImGuiIO& io) { app_.Draw(io); }
|
||||
|
||||
void HidDemoApp::Draw(ImGuiIO& io) {
|
||||
const ImGuiWindowFlags wflags =
|
||||
constexpr ImGuiWindowFlags wflags =
|
||||
ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove |
|
||||
ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoSavedSettings |
|
||||
ImGuiWindowFlags_NoScrollbar;
|
||||
|
|
|
@ -51,7 +51,7 @@ struct X_ACHIEVEMENT_DETAILS {
|
|||
X_FILETIME unlock_time;
|
||||
xe::be<uint32_t> flags;
|
||||
|
||||
static const size_t kStringBufferSize = 464;
|
||||
static constexpr size_t kStringBufferSize = 464;
|
||||
};
|
||||
static_assert_size(X_ACHIEVEMENT_DETAILS, 36);
|
||||
|
||||
|
|
|
@ -32,13 +32,13 @@ namespace xam {
|
|||
// will not be recognized properly.
|
||||
#define ONE_GB (1024ull * 1024ull * 1024ull)
|
||||
|
||||
static const DummyDeviceInfo dummy_hdd_device_info_ = {
|
||||
static constexpr DummyDeviceInfo dummy_hdd_device_info_ = {
|
||||
DummyDeviceId::HDD, DeviceType::HDD,
|
||||
20ull * ONE_GB, // 20GB
|
||||
3ull * ONE_GB, // 3GB, so it looks a little used.
|
||||
u"Dummy HDD",
|
||||
};
|
||||
static const DummyDeviceInfo dummy_odd_device_info_ = {
|
||||
static constexpr DummyDeviceInfo dummy_odd_device_info_ = {
|
||||
DummyDeviceId::ODD, DeviceType::ODD,
|
||||
7ull * ONE_GB, // 7GB (rough maximum)
|
||||
0ull * ONE_GB, // read-only FS, so no free space
|
||||
|
|
|
@ -550,11 +550,11 @@ DECLARE_XAM_EXPORT1(NetDll_XNetSetSystemLinkPort, kNetworking, kStub);
|
|||
|
||||
// https://github.com/ILOVEPIE/Cxbx-Reloaded/blob/master/src/CxbxKrnl/EmuXOnline.h#L39
|
||||
struct XEthernetStatus {
|
||||
static const uint32_t XNET_ETHERNET_LINK_ACTIVE = 0x01;
|
||||
static const uint32_t XNET_ETHERNET_LINK_100MBPS = 0x02;
|
||||
static const uint32_t XNET_ETHERNET_LINK_10MBPS = 0x04;
|
||||
static const uint32_t XNET_ETHERNET_LINK_FULL_DUPLEX = 0x08;
|
||||
static const uint32_t XNET_ETHERNET_LINK_HALF_DUPLEX = 0x10;
|
||||
static constexpr uint32_t XNET_ETHERNET_LINK_ACTIVE = 0x01;
|
||||
static constexpr uint32_t XNET_ETHERNET_LINK_100MBPS = 0x02;
|
||||
static constexpr uint32_t XNET_ETHERNET_LINK_10MBPS = 0x04;
|
||||
static constexpr uint32_t XNET_ETHERNET_LINK_FULL_DUPLEX = 0x08;
|
||||
static constexpr uint32_t XNET_ETHERNET_LINK_HALF_DUPLEX = 0x10;
|
||||
};
|
||||
|
||||
dword_result_t NetDll_XNetGetEthernetLinkStatus_entry(dword_t caller) {
|
||||
|
|
|
@ -1554,7 +1554,7 @@ bool xeDrawProfileContent(ui::ImGuiDrawer* imgui_drawer, const uint64_t xuid,
|
|||
uint64_t* selected_xuid) {
|
||||
auto profile_manager = kernel_state()->xam_state()->profile_manager();
|
||||
|
||||
const float default_image_size = 75.0f;
|
||||
constexpr float default_image_size = 75.0f;
|
||||
const ImVec2 next_window_position =
|
||||
ImVec2(ImGui::GetWindowPos().x + ImGui::GetWindowSize().x + 20.f,
|
||||
ImGui::GetWindowPos().y);
|
||||
|
|
|
@ -39,7 +39,7 @@ class XIOCompletion : public XObject {
|
|||
bool WaitForNotification(uint64_t wait_ticks, IONotification* notify);
|
||||
|
||||
private:
|
||||
static const uint32_t kMaxNotifications = 1024;
|
||||
static constexpr uint32_t kMaxNotifications = 1024;
|
||||
|
||||
std::mutex notification_lock_;
|
||||
std::queue<IONotification> notifications_;
|
||||
|
|
|
@ -307,7 +307,7 @@ X_STATUS XThread::Create() {
|
|||
module->GetOptHeader(XEX_HEADER_TLS_INFO, &tls_header);
|
||||
}
|
||||
|
||||
const uint32_t kDefaultTlsSlotCount = 1024;
|
||||
constexpr uint32_t kDefaultTlsSlotCount = 1024;
|
||||
uint32_t tls_slots = kDefaultTlsSlotCount;
|
||||
uint32_t tls_extended_size = 0;
|
||||
if (tls_header && tls_header->slot_count) {
|
||||
|
|
|
@ -235,7 +235,7 @@ void PluginLoader::LoadTitlePlugin(const PluginInfoEntry& entry) {
|
|||
}
|
||||
|
||||
void PluginLoader::CreatePluginDevice(const uint32_t title_id) {
|
||||
const std::string mount_plugins = "\\Device\\Plugins";
|
||||
constexpr std::string_view mount_plugins = "\\Device\\Plugins";
|
||||
|
||||
const std::filesystem::path plugins_host_path =
|
||||
plugins_root_ / fmt::format("{:08X}", title_id);
|
||||
|
|
|
@ -17,9 +17,11 @@ namespace ui {
|
|||
namespace d3d12 {
|
||||
namespace util {
|
||||
|
||||
const D3D12_HEAP_PROPERTIES kHeapPropertiesDefault = {D3D12_HEAP_TYPE_DEFAULT};
|
||||
const D3D12_HEAP_PROPERTIES kHeapPropertiesUpload = {D3D12_HEAP_TYPE_UPLOAD};
|
||||
const D3D12_HEAP_PROPERTIES kHeapPropertiesReadback = {
|
||||
constexpr D3D12_HEAP_PROPERTIES kHeapPropertiesDefault = {
|
||||
D3D12_HEAP_TYPE_DEFAULT};
|
||||
constexpr D3D12_HEAP_PROPERTIES kHeapPropertiesUpload = {
|
||||
D3D12_HEAP_TYPE_UPLOAD};
|
||||
constexpr D3D12_HEAP_PROPERTIES kHeapPropertiesReadback = {
|
||||
D3D12_HEAP_TYPE_READBACK};
|
||||
|
||||
ID3D12RootSignature* CreateRootSignature(
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -4599,7 +4599,7 @@ static constexpr uint8_t locked_achievement_icon_data[] = {
|
|||
0x68, 0x68, 0x68, 0x68, 0x68, 0xec, 0x24, 0xfe, 0x07, 0x09, 0xfe, 0x9c,
|
||||
0xfd, 0xaa, 0x0b, 0xa9, 0xc4, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e,
|
||||
0x44, 0xae, 0x42, 0x60, 0x82};
|
||||
static const uint32_t locked_achievement_icon_len = 3941;
|
||||
static constexpr uint32_t locked_achievement_icon_len = 3941;
|
||||
|
||||
static const std::vector<std::pair<const uint8_t*, uint32_t>>
|
||||
notification_icons = {
|
||||
|
@ -4610,5 +4610,5 @@ static const std::vector<std::pair<const uint8_t*, uint32_t>>
|
|||
{player_any_notification_icon, player_any_notification_icon_len},
|
||||
};
|
||||
|
||||
static const std::pair<const uint8_t*, uint32_t> locked_achievement_icon = {
|
||||
static constexpr std::pair<const uint8_t*, uint32_t> locked_achievement_icon = {
|
||||
locked_achievement_icon_data, locked_achievement_icon_len};
|
||||
|
|
|
@ -1027,12 +1027,12 @@ VkSwapchainKHR VulkanPresenter::PaintContext::CreateSwapchainForVulkanSurface(
|
|||
}
|
||||
#if XE_PLATFORM_ANDROID
|
||||
// Android uses R8G8B8A8.
|
||||
static const VkFormat kFormat8888Primary = VK_FORMAT_R8G8B8A8_UNORM;
|
||||
static const VkFormat kFormat8888Secondary = VK_FORMAT_B8G8R8A8_UNORM;
|
||||
static constexpr VkFormat kFormat8888Primary = VK_FORMAT_R8G8B8A8_UNORM;
|
||||
static constexpr VkFormat kFormat8888Secondary = VK_FORMAT_B8G8R8A8_UNORM;
|
||||
#else
|
||||
// GNU/Linux X11 and Windows DWM use B8G8R8A8.
|
||||
static const VkFormat kFormat8888Primary = VK_FORMAT_B8G8R8A8_UNORM;
|
||||
static const VkFormat kFormat8888Secondary = VK_FORMAT_R8G8B8A8_UNORM;
|
||||
static constexpr VkFormat kFormat8888Primary = VK_FORMAT_B8G8R8A8_UNORM;
|
||||
static constexpr VkFormat kFormat8888Secondary = VK_FORMAT_R8G8B8A8_UNORM;
|
||||
#endif
|
||||
VkSurfaceFormatKHR image_format;
|
||||
if (surface_formats.empty() ||
|
||||
|
@ -2504,7 +2504,7 @@ VkPipeline VulkanPresenter::CreateGuestOutputPaintPipeline(
|
|||
color_blend_state.attachmentCount = 1;
|
||||
color_blend_state.pAttachments = &color_blend_attachment_state;
|
||||
|
||||
static const VkDynamicState kPipelineDynamicStates[] = {
|
||||
static constexpr VkDynamicState kPipelineDynamicStates[] = {
|
||||
VK_DYNAMIC_STATE_VIEWPORT,
|
||||
VK_DYNAMIC_STATE_SCISSOR,
|
||||
};
|
||||
|
|
|
@ -163,7 +163,7 @@ bool AndroidWindow::OnActivitySurfaceMotionEvent(jobject event) {
|
|||
event, jni_ids.motion_event_get_y, 0),
|
||||
0.0f, float(GetActualPhysicalHeight())) +
|
||||
0.5f);
|
||||
static const MouseEvent::Button kMouseEventButtons[] = {
|
||||
static constexpr MouseEvent::Button kMouseEventButtons[] = {
|
||||
MouseEvent::Button::kLeft, MouseEvent::Button::kRight,
|
||||
MouseEvent::Button::kMiddle, MouseEvent::Button::kX1,
|
||||
MouseEvent::Button::kX2,
|
||||
|
|
Loading…
Reference in New Issue