[Misc] Replaced const with constexpr where possible

This commit is contained in:
Xphalnos
2025-03-20 21:16:32 +01:00
committed by Radosław Gliński
parent d20620eb5e
commit 5f918ef28d
64 changed files with 191 additions and 190 deletions

View File

@@ -962,7 +962,7 @@ bool VulkanCommandProcessor::SetupContext() {
swap_apply_gamma_pipeline_color_blend_state.pAttachments =
&swap_apply_gamma_pipeline_color_blend_attachment_state;
static const VkDynamicState kSwapApplyGammaPipelineDynamicStates[] = {
static constexpr VkDynamicState kSwapApplyGammaPipelineDynamicStates[] = {
VK_DYNAMIC_STATE_VIEWPORT,
VK_DYNAMIC_STATE_SCISSOR,
};

View File

@@ -2148,7 +2148,7 @@ bool VulkanPipelineCache::EnsurePipelineCreated(
uint32_t color_rts_used =
description.render_pass_key.depth_and_color_used >> 1;
{
static const VkBlendFactor kBlendFactorMap[] = {
static constexpr VkBlendFactor kBlendFactorMap[] = {
VK_BLEND_FACTOR_ZERO,
VK_BLEND_FACTOR_ONE,
VK_BLEND_FACTOR_SRC_COLOR,
@@ -2166,14 +2166,14 @@ bool VulkanPipelineCache::EnsurePipelineCreated(
VK_BLEND_FACTOR_SRC_ALPHA_SATURATE,
};
// 8 entries for safety since 3 bits from the guest are passed directly.
static const VkBlendOp kBlendOpMap[] = {VK_BLEND_OP_ADD,
VK_BLEND_OP_SUBTRACT,
VK_BLEND_OP_MIN,
VK_BLEND_OP_MAX,
VK_BLEND_OP_REVERSE_SUBTRACT,
VK_BLEND_OP_ADD,
VK_BLEND_OP_ADD,
VK_BLEND_OP_ADD};
static constexpr VkBlendOp kBlendOpMap[] = {VK_BLEND_OP_ADD,
VK_BLEND_OP_SUBTRACT,
VK_BLEND_OP_MIN,
VK_BLEND_OP_MAX,
VK_BLEND_OP_REVERSE_SUBTRACT,
VK_BLEND_OP_ADD,
VK_BLEND_OP_ADD,
VK_BLEND_OP_ADD};
uint32_t color_rts_remaining = color_rts_used;
uint32_t color_rt_index;
while (xe::bit_scan_forward(color_rts_remaining, &color_rt_index)) {

View File

@@ -556,7 +556,7 @@ bool VulkanRenderTargetCache::Initialize(uint32_t shared_memory_binding_count) {
Shutdown();
return false;
}
const std::pair<const uint32_t*, size_t> host_depth_store_shaders[] = {
constexpr std::pair<const uint32_t*, size_t> host_depth_store_shaders[] = {
{shaders::host_depth_store_1xmsaa_cs,
sizeof(shaders::host_depth_store_1xmsaa_cs)},
{shaders::host_depth_store_2xmsaa_cs,

View File

@@ -773,7 +773,7 @@ VkSampler VulkanTextureCache::UseSampler(SamplerParameters parameters,
sampler_create_info.mipmapMode = parameters.mag_linear
? VK_SAMPLER_MIPMAP_MODE_LINEAR
: VK_SAMPLER_MIPMAP_MODE_NEAREST;
static const VkSamplerAddressMode kAddressModeMap[] = {
static constexpr VkSamplerAddressMode kAddressModeMap[] = {
// kRepeat
VK_SAMPLER_ADDRESS_MODE_REPEAT,
// kMirroredRepeat