[Misc] Replaced const with constexpr where possible
This commit is contained in:
committed by
Radosław Gliński
parent
c4f1bf27ef
commit
47f327e848
@@ -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},
|
||||
|
||||
Reference in New Issue
Block a user