add static lifetime to constexpr values to force compile time evaluation where possible
Signed-off-by: arades79 <scravers@protonmail.com>
This commit is contained in:
parent
5f5a6e4b2e
commit
45e13b03f3
101 changed files with 309 additions and 303 deletions
|
@ -890,8 +890,8 @@ void BufferCache<P>::CommitAsyncFlushesHigh() {
|
|||
buffer_id,
|
||||
});
|
||||
// Align up to avoid cache conflicts
|
||||
constexpr u64 align = 8ULL;
|
||||
constexpr u64 mask = ~(align - 1ULL);
|
||||
constexpr static u64 align = 8ULL;
|
||||
constexpr static u64 mask = ~(align - 1ULL);
|
||||
total_size_bytes += (new_size + align - 1) & mask;
|
||||
largest_copy = std::max(largest_copy, new_size);
|
||||
};
|
||||
|
@ -1843,8 +1843,8 @@ void BufferCache<P>::DownloadBufferMemory(Buffer& buffer, VAddr cpu_addr, u64 si
|
|||
.size = new_size,
|
||||
});
|
||||
// Align up to avoid cache conflicts
|
||||
constexpr u64 align = 256ULL;
|
||||
constexpr u64 mask = ~(align - 1ULL);
|
||||
constexpr static u64 align = 256ULL;
|
||||
constexpr static u64 mask = ~(align - 1ULL);
|
||||
total_size_bytes += (new_size + align - 1) & mask;
|
||||
largest_copy = std::max(largest_copy, new_size);
|
||||
};
|
||||
|
|
|
@ -75,7 +75,7 @@ bool DmaPusher::Step() {
|
|||
|
||||
// Push buffer non-empty, read a word
|
||||
command_headers.resize_destructive(command_list_header.size);
|
||||
constexpr u32 MacroRegistersStart = 0xE00;
|
||||
constexpr static u32 MacroRegistersStart = 0xE00;
|
||||
if (dma_state.method < MacroRegistersStart) {
|
||||
if (Settings::IsGPULevelHigh()) {
|
||||
memory_manager.ReadBlock(dma_state.dma_get, command_headers.data(),
|
||||
|
|
|
@ -72,7 +72,7 @@ void Fermi2D::Blit() {
|
|||
UNIMPLEMENTED_IF_MSG(regs.clip_enable != 0, "Clipped blit enabled");
|
||||
|
||||
const auto& args = regs.pixels_from_memory;
|
||||
constexpr s64 null_derivate = 1ULL << 32;
|
||||
constexpr static s64 null_derivate = 1ULL << 32;
|
||||
Surface src = regs.src;
|
||||
const auto bytes_per_pixel = BytesPerBlock(PixelFormatFromRenderTargetFormat(src.format));
|
||||
const bool delegate_to_gpu = src.width > 512 && src.height > 512 && bytes_per_pixel <= 8 &&
|
||||
|
|
|
@ -258,7 +258,7 @@ u32 Maxwell3D::GetMaxCurrentVertices() {
|
|||
size_t Maxwell3D::EstimateIndexBufferSize() {
|
||||
GPUVAddr start_address = regs.index_buffer.StartAddress();
|
||||
GPUVAddr end_address = regs.index_buffer.EndAddress();
|
||||
constexpr std::array<size_t, 4> max_sizes = {
|
||||
constexpr static std::array<size_t, 4> max_sizes = {
|
||||
std::numeric_limits<u8>::max(), std::numeric_limits<u16>::max(),
|
||||
std::numeric_limits<u32>::max(), std::numeric_limits<u32>::max()};
|
||||
const size_t byte_size = regs.index_buffer.FormatSizeInBytes();
|
||||
|
|
|
@ -694,16 +694,16 @@ private:
|
|||
};
|
||||
const auto force_to_fp16 = [](f32 base_value) {
|
||||
u32 tmp = Common::BitCast<u32>(base_value);
|
||||
constexpr size_t fp32_mantissa_bits = 23;
|
||||
constexpr size_t fp16_mantissa_bits = 10;
|
||||
constexpr size_t mantissa_mask =
|
||||
constexpr static size_t fp32_mantissa_bits = 23;
|
||||
constexpr static size_t fp16_mantissa_bits = 10;
|
||||
constexpr static size_t mantissa_mask =
|
||||
~((1ULL << (fp32_mantissa_bits - fp16_mantissa_bits)) - 1ULL);
|
||||
tmp = tmp & static_cast<u32>(mantissa_mask);
|
||||
// TODO: force the exponent within the range of half float. Not needed in UNORM / SNORM
|
||||
return Common::BitCast<f32>(tmp);
|
||||
};
|
||||
const auto from_fp_n = [&sign_extend](u32 base_value, size_t bits, size_t mantissa) {
|
||||
constexpr size_t fp32_mantissa_bits = 23;
|
||||
constexpr static size_t fp32_mantissa_bits = 23;
|
||||
size_t shift_towards = fp32_mantissa_bits - mantissa;
|
||||
const u32 new_value =
|
||||
static_cast<u32>(sign_extend(base_value, bits) << shift_towards) & (~(1U << 31));
|
||||
|
@ -770,7 +770,7 @@ private:
|
|||
component_mask[which_component];
|
||||
};
|
||||
const auto to_fp_n = [](f32 base_value, size_t bits, size_t mantissa) {
|
||||
constexpr size_t fp32_mantissa_bits = 23;
|
||||
constexpr static size_t fp32_mantissa_bits = 23;
|
||||
u32 tmp_value = Common::BitCast<u32>(std::max(base_value, 0.0f));
|
||||
size_t shift_towards = fp32_mantissa_bits - mantissa;
|
||||
return tmp_value >> shift_towards;
|
||||
|
|
|
@ -194,8 +194,8 @@ struct GPU::Impl {
|
|||
[[nodiscard]] u64 GetTicks() const {
|
||||
// This values were reversed engineered by fincs from NVN
|
||||
// The gpu clock is reported in units of 385/625 nanoseconds
|
||||
constexpr u64 gpu_ticks_num = 384;
|
||||
constexpr u64 gpu_ticks_den = 625;
|
||||
constexpr static u64 gpu_ticks_num = 384;
|
||||
constexpr static u64 gpu_ticks_den = 625;
|
||||
|
||||
u64 nanoseconds = system.CoreTiming().GetGlobalTimeNs().count();
|
||||
if (Settings::values.use_fast_gpu_time.GetValue()) {
|
||||
|
|
|
@ -283,7 +283,7 @@ void VP9::EncodeTermSubExp(VpxRangeEncoder& writer, s32 value) {
|
|||
} else {
|
||||
value -= 64;
|
||||
|
||||
constexpr s32 size = 8;
|
||||
constexpr static s32 size = 8;
|
||||
|
||||
const s32 mask = (1 << size) - 191;
|
||||
|
||||
|
@ -307,7 +307,7 @@ bool VP9::WriteLessThan(VpxRangeEncoder& writer, s32 value, s32 test) {
|
|||
void VP9::WriteCoefProbabilityUpdate(VpxRangeEncoder& writer, s32 tx_mode,
|
||||
const std::array<u8, 1728>& new_prob,
|
||||
const std::array<u8, 1728>& old_prob) {
|
||||
constexpr u32 block_bytes = 2 * 2 * 6 * 6 * 3;
|
||||
constexpr static u32 block_bytes = 2 * 2 * 6 * 6 * 3;
|
||||
|
||||
const auto needs_update = [&](u32 base_index) {
|
||||
return !std::equal(new_prob.begin() + base_index,
|
||||
|
|
|
@ -281,7 +281,7 @@ public:
|
|||
explicit HostCounterBase(std::shared_ptr<HostCounter> dependency_)
|
||||
: dependency{std::move(dependency_)}, depth{dependency ? (dependency->Depth() + 1) : 0} {
|
||||
// Avoid nesting too many dependencies to avoid a stack overflow when these are deleted.
|
||||
constexpr u64 depth_threshold = 96;
|
||||
constexpr static u64 depth_threshold = 96;
|
||||
if (depth > depth_threshold) {
|
||||
depth = 0;
|
||||
base_result = dependency->Query();
|
||||
|
|
|
@ -162,7 +162,8 @@ void ComputePipeline::Configure() {
|
|||
buffer_cache.UnbindComputeTextureBuffers();
|
||||
size_t texbuf_index{};
|
||||
const auto add_buffer{[&](const auto& desc) {
|
||||
constexpr bool is_image = std::is_same_v<decltype(desc), const ImageBufferDescriptor&>;
|
||||
constexpr static bool is_image =
|
||||
std::is_same_v<decltype(desc), const ImageBufferDescriptor&>;
|
||||
for (u32 i = 0; i < desc.count; ++i) {
|
||||
bool is_written{false};
|
||||
if constexpr (is_image) {
|
||||
|
|
|
@ -126,9 +126,9 @@ Device::Device(Core::Frontend::EmuWindow& emu_window) {
|
|||
const bool is_intel = vendor_name == "Intel";
|
||||
|
||||
#ifdef __unix__
|
||||
constexpr bool is_linux = true;
|
||||
constexpr static bool is_linux = true;
|
||||
#else
|
||||
constexpr bool is_linux = false;
|
||||
constexpr static bool is_linux = false;
|
||||
#endif
|
||||
|
||||
bool disable_fast_buffer_sub_data = false;
|
||||
|
|
|
@ -385,7 +385,8 @@ void GraphicsPipeline::ConfigureImpl(bool is_indexed) {
|
|||
const auto bind_stage_info{[&](size_t stage) LAMBDA_FORCEINLINE {
|
||||
size_t index{};
|
||||
const auto add_buffer{[&](const auto& desc) {
|
||||
constexpr bool is_image = std::is_same_v<decltype(desc), const ImageBufferDescriptor&>;
|
||||
constexpr static bool is_image =
|
||||
std::is_same_v<decltype(desc), const ImageBufferDescriptor&>;
|
||||
for (u32 i = 0; i < desc.count; ++i) {
|
||||
bool is_written{false};
|
||||
if constexpr (is_image) {
|
||||
|
|
|
@ -237,7 +237,7 @@ void RendererOpenGL::LoadFBToScreenInfo(const Tegra::FramebufferConfig& framebuf
|
|||
screen_info.display_texture = screen_info.texture.resource.handle;
|
||||
|
||||
// TODO(Rodrigo): Read this from HLE
|
||||
constexpr u32 block_height_log2 = 4;
|
||||
constexpr static u32 block_height_log2 = 4;
|
||||
const auto pixel_format{
|
||||
VideoCore::Surface::PixelFormatFromGPUPixelFormat(framebuffer.pixel_format)};
|
||||
const u32 bytes_per_pixel{VideoCore::Surface::BytesPerBlock(pixel_format)};
|
||||
|
@ -375,7 +375,7 @@ void RendererOpenGL::AddTelemetryFields() {
|
|||
LOG_INFO(Render_OpenGL, "GL_VENDOR: {}", gpu_vendor);
|
||||
LOG_INFO(Render_OpenGL, "GL_RENDERER: {}", gpu_model);
|
||||
|
||||
constexpr auto user_system = Common::Telemetry::FieldType::UserSystem;
|
||||
constexpr static auto user_system = Common::Telemetry::FieldType::UserSystem;
|
||||
telemetry_session.AddField(user_system, "GPU_Vendor", std::string(gpu_vendor));
|
||||
telemetry_session.AddField(user_system, "GPU_Model", std::string(gpu_model));
|
||||
telemetry_session.AddField(user_system, "GPU_OpenGL_Version", std::string(gl_version));
|
||||
|
|
|
@ -358,8 +358,9 @@ VkExtent2D GetConversionExtent(const ImageView& src_image_view) {
|
|||
|
||||
void TransitionImageLayout(vk::CommandBuffer& cmdbuf, VkImage image, VkImageLayout target_layout,
|
||||
VkImageLayout source_layout = VK_IMAGE_LAYOUT_GENERAL) {
|
||||
constexpr VkFlags flags{VK_ACCESS_COLOR_ATTACHMENT_READ_BIT |
|
||||
VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT | VK_ACCESS_SHADER_READ_BIT};
|
||||
constexpr static VkFlags flags{VK_ACCESS_COLOR_ATTACHMENT_READ_BIT |
|
||||
VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT |
|
||||
VK_ACCESS_SHADER_READ_BIT};
|
||||
const VkImageMemoryBarrier barrier{
|
||||
.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,
|
||||
.pNext = nullptr,
|
||||
|
|
|
@ -175,7 +175,7 @@ VkSemaphore BlitScreen::Draw(const Tegra::FramebufferConfig& framebuffer,
|
|||
const u8* const host_ptr = cpu_memory.GetPointer(framebuffer_addr);
|
||||
|
||||
// TODO(Rodrigo): Read this from HLE
|
||||
constexpr u32 block_height_log2 = 4;
|
||||
constexpr static u32 block_height_log2 = 4;
|
||||
const u32 bytes_per_pixel = GetBytesPerPixel(framebuffer);
|
||||
const u64 linear_size{GetSizeInBytes(framebuffer)};
|
||||
const u64 tiled_size{Tegra::Texture::CalculateSize(true, bytes_per_pixel,
|
||||
|
@ -1482,7 +1482,7 @@ u64 BlitScreen::CalculateBufferSize(const Tegra::FramebufferConfig& framebuffer)
|
|||
|
||||
u64 BlitScreen::GetRawImageOffset(const Tegra::FramebufferConfig& framebuffer,
|
||||
std::size_t image_index) const {
|
||||
constexpr auto first_image_offset = static_cast<u64>(sizeof(BufferData));
|
||||
constexpr static auto first_image_offset = static_cast<u64>(sizeof(BufferData));
|
||||
return first_image_offset + GetSizeInBytes(framebuffer) * image_index;
|
||||
}
|
||||
|
||||
|
|
|
@ -172,7 +172,8 @@ void ComputePipeline::Configure(Tegra::Engines::KeplerCompute& kepler_compute,
|
|||
buffer_cache.UnbindComputeTextureBuffers();
|
||||
size_t index{};
|
||||
const auto add_buffer{[&](const auto& desc) {
|
||||
constexpr bool is_image = std::is_same_v<decltype(desc), const ImageBufferDescriptor&>;
|
||||
constexpr static bool is_image =
|
||||
std::is_same_v<decltype(desc), const ImageBufferDescriptor&>;
|
||||
for (u32 i = 0; i < desc.count; ++i) {
|
||||
bool is_written{false};
|
||||
if constexpr (is_image) {
|
||||
|
|
|
@ -398,7 +398,8 @@ void GraphicsPipeline::ConfigureImpl(bool is_indexed) {
|
|||
const auto bind_stage_info{[&](size_t stage) LAMBDA_FORCEINLINE {
|
||||
size_t index{};
|
||||
const auto add_buffer{[&](const auto& desc) {
|
||||
constexpr bool is_image = std::is_same_v<decltype(desc), const ImageBufferDescriptor&>;
|
||||
constexpr static bool is_image =
|
||||
std::is_same_v<decltype(desc), const ImageBufferDescriptor&>;
|
||||
for (u32 i = 0; i < desc.count; ++i) {
|
||||
bool is_written{false};
|
||||
if constexpr (is_image) {
|
||||
|
|
|
@ -1109,9 +1109,9 @@ void RasterizerVulkan::UpdateDepthBiasEnable(Tegra::Engines::Maxwell3D::Regs& re
|
|||
if (!state_tracker.TouchDepthBiasEnable()) {
|
||||
return;
|
||||
}
|
||||
constexpr size_t POINT = 0;
|
||||
constexpr size_t LINE = 1;
|
||||
constexpr size_t POLYGON = 2;
|
||||
constexpr static size_t POINT = 0;
|
||||
constexpr static size_t LINE = 1;
|
||||
constexpr static size_t POLYGON = 2;
|
||||
static constexpr std::array POLYGON_OFFSET_ENABLE_LUT = {
|
||||
POINT, // Points
|
||||
LINE, // Lines
|
||||
|
|
|
@ -55,8 +55,9 @@ std::pair<vk::Image, MemoryCommit> CreateWrappedImage(const Device& device,
|
|||
|
||||
void TransitionImageLayout(vk::CommandBuffer& cmdbuf, VkImage image, VkImageLayout target_layout,
|
||||
VkImageLayout source_layout = VK_IMAGE_LAYOUT_GENERAL) {
|
||||
constexpr VkFlags flags{VK_ACCESS_COLOR_ATTACHMENT_READ_BIT |
|
||||
VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT | VK_ACCESS_SHADER_READ_BIT};
|
||||
constexpr static VkFlags flags{VK_ACCESS_COLOR_ATTACHMENT_READ_BIT |
|
||||
VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT |
|
||||
VK_ACCESS_SHADER_READ_BIT};
|
||||
const VkImageMemoryBarrier barrier{
|
||||
.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,
|
||||
.pNext = nullptr,
|
||||
|
@ -152,7 +153,7 @@ vk::RenderPass CreateWrappedRenderPass(const Device& device, VkFormat format) {
|
|||
.finalLayout = VK_IMAGE_LAYOUT_GENERAL,
|
||||
};
|
||||
|
||||
constexpr VkAttachmentReference color_attachment_ref{
|
||||
constexpr static VkAttachmentReference color_attachment_ref{
|
||||
.attachment = 0,
|
||||
.layout = VK_IMAGE_LAYOUT_GENERAL,
|
||||
};
|
||||
|
@ -170,7 +171,7 @@ vk::RenderPass CreateWrappedRenderPass(const Device& device, VkFormat format) {
|
|||
.pPreserveAttachments = nullptr,
|
||||
};
|
||||
|
||||
constexpr VkSubpassDependency dependency{
|
||||
constexpr static VkSubpassDependency dependency{
|
||||
.srcSubpass = VK_SUBPASS_EXTERNAL,
|
||||
.dstSubpass = 0,
|
||||
.srcStageMask = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT,
|
||||
|
@ -328,7 +329,7 @@ vk::Pipeline CreateWrappedPipeline(const Device& device, vk::RenderPass& renderp
|
|||
},
|
||||
}};
|
||||
|
||||
constexpr VkPipelineVertexInputStateCreateInfo vertex_input_ci{
|
||||
constexpr static VkPipelineVertexInputStateCreateInfo vertex_input_ci{
|
||||
.sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO,
|
||||
.pNext = nullptr,
|
||||
.flags = 0,
|
||||
|
@ -338,7 +339,7 @@ vk::Pipeline CreateWrappedPipeline(const Device& device, vk::RenderPass& renderp
|
|||
.pVertexAttributeDescriptions = nullptr,
|
||||
};
|
||||
|
||||
constexpr VkPipelineInputAssemblyStateCreateInfo input_assembly_ci{
|
||||
constexpr static VkPipelineInputAssemblyStateCreateInfo input_assembly_ci{
|
||||
.sType = VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO,
|
||||
.pNext = nullptr,
|
||||
.flags = 0,
|
||||
|
@ -346,7 +347,7 @@ vk::Pipeline CreateWrappedPipeline(const Device& device, vk::RenderPass& renderp
|
|||
.primitiveRestartEnable = VK_FALSE,
|
||||
};
|
||||
|
||||
constexpr VkPipelineViewportStateCreateInfo viewport_state_ci{
|
||||
constexpr static VkPipelineViewportStateCreateInfo viewport_state_ci{
|
||||
.sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO,
|
||||
.pNext = nullptr,
|
||||
.flags = 0,
|
||||
|
@ -356,7 +357,7 @@ vk::Pipeline CreateWrappedPipeline(const Device& device, vk::RenderPass& renderp
|
|||
.pScissors = nullptr,
|
||||
};
|
||||
|
||||
constexpr VkPipelineRasterizationStateCreateInfo rasterization_ci{
|
||||
constexpr static VkPipelineRasterizationStateCreateInfo rasterization_ci{
|
||||
.sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO,
|
||||
.pNext = nullptr,
|
||||
.flags = 0,
|
||||
|
@ -372,7 +373,7 @@ vk::Pipeline CreateWrappedPipeline(const Device& device, vk::RenderPass& renderp
|
|||
.lineWidth = 1.0f,
|
||||
};
|
||||
|
||||
constexpr VkPipelineMultisampleStateCreateInfo multisampling_ci{
|
||||
constexpr static VkPipelineMultisampleStateCreateInfo multisampling_ci{
|
||||
.sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO,
|
||||
.pNext = nullptr,
|
||||
.flags = 0,
|
||||
|
@ -384,7 +385,7 @@ vk::Pipeline CreateWrappedPipeline(const Device& device, vk::RenderPass& renderp
|
|||
.alphaToOneEnable = VK_FALSE,
|
||||
};
|
||||
|
||||
constexpr VkPipelineColorBlendAttachmentState color_blend_attachment{
|
||||
constexpr static VkPipelineColorBlendAttachmentState color_blend_attachment{
|
||||
.blendEnable = VK_FALSE,
|
||||
.srcColorBlendFactor = VK_BLEND_FACTOR_ZERO,
|
||||
.dstColorBlendFactor = VK_BLEND_FACTOR_ZERO,
|
||||
|
@ -407,7 +408,7 @@ vk::Pipeline CreateWrappedPipeline(const Device& device, vk::RenderPass& renderp
|
|||
.blendConstants = {0.0f, 0.0f, 0.0f, 0.0f},
|
||||
};
|
||||
|
||||
constexpr std::array dynamic_states{
|
||||
constexpr static std::array dynamic_states{
|
||||
VK_DYNAMIC_STATE_VIEWPORT,
|
||||
VK_DYNAMIC_STATE_SCISSOR,
|
||||
};
|
||||
|
@ -468,7 +469,7 @@ VkWriteDescriptorSet CreateWriteDescriptorSet(std::vector<VkDescriptorImageInfo>
|
|||
}
|
||||
|
||||
void ClearColorImage(vk::CommandBuffer& cmdbuf, VkImage image) {
|
||||
constexpr std::array<VkImageSubresourceRange, 1> subresources{{{
|
||||
constexpr static std::array<VkImageSubresourceRange, 1> subresources{{{
|
||||
.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
|
||||
.baseMipLevel = 0,
|
||||
.levelCount = 1,
|
||||
|
@ -528,8 +529,8 @@ SMAA::SMAA(const Device& device, MemoryAllocator& allocator, size_t image_count,
|
|||
}
|
||||
|
||||
void SMAA::CreateImages() {
|
||||
constexpr VkExtent2D area_extent{AREATEX_WIDTH, AREATEX_HEIGHT};
|
||||
constexpr VkExtent2D search_extent{SEARCHTEX_WIDTH, SEARCHTEX_HEIGHT};
|
||||
constexpr static VkExtent2D area_extent{AREATEX_WIDTH, AREATEX_HEIGHT};
|
||||
constexpr static VkExtent2D search_extent{SEARCHTEX_WIDTH, SEARCHTEX_HEIGHT};
|
||||
|
||||
std::tie(m_static_images[Area], m_static_buffer_commits[Area]) =
|
||||
CreateWrappedImage(m_device, m_allocator, area_extent, VK_FORMAT_R8G8_UNORM);
|
||||
|
@ -586,12 +587,12 @@ void SMAA::CreateSampler() {
|
|||
|
||||
void SMAA::CreateShaders() {
|
||||
// These match the order of the SMAAStage enum
|
||||
constexpr std::array vert_shader_sources{
|
||||
constexpr static std::array vert_shader_sources{
|
||||
ARRAY_TO_SPAN(SMAA_EDGE_DETECTION_VERT_SPV),
|
||||
ARRAY_TO_SPAN(SMAA_BLENDING_WEIGHT_CALCULATION_VERT_SPV),
|
||||
ARRAY_TO_SPAN(SMAA_NEIGHBORHOOD_BLENDING_VERT_SPV),
|
||||
};
|
||||
constexpr std::array frag_shader_sources{
|
||||
constexpr static std::array frag_shader_sources{
|
||||
ARRAY_TO_SPAN(SMAA_EDGE_DETECTION_FRAG_SPV),
|
||||
ARRAY_TO_SPAN(SMAA_BLENDING_WEIGHT_CALCULATION_FRAG_SPV),
|
||||
ARRAY_TO_SPAN(SMAA_NEIGHBORHOOD_BLENDING_FRAG_SPV),
|
||||
|
@ -675,8 +676,8 @@ void SMAA::UploadImages(Scheduler& scheduler) {
|
|||
return;
|
||||
}
|
||||
|
||||
constexpr VkExtent2D area_extent{AREATEX_WIDTH, AREATEX_HEIGHT};
|
||||
constexpr VkExtent2D search_extent{SEARCHTEX_WIDTH, SEARCHTEX_HEIGHT};
|
||||
constexpr static VkExtent2D area_extent{AREATEX_WIDTH, AREATEX_HEIGHT};
|
||||
constexpr static VkExtent2D search_extent{SEARCHTEX_WIDTH, SEARCHTEX_HEIGHT};
|
||||
|
||||
UploadImage(m_device, m_allocator, scheduler, m_static_images[Area], area_extent,
|
||||
VK_FORMAT_R8G8_UNORM, ARRAY_TO_SPAN(areaTexBytes));
|
||||
|
|
|
@ -299,7 +299,7 @@ void StagingBufferPool::ReleaseCache(MemoryUsage usage) {
|
|||
}
|
||||
|
||||
void StagingBufferPool::ReleaseLevel(StagingBuffersCache& cache, size_t log2) {
|
||||
constexpr size_t deletions_per_tick = 16;
|
||||
constexpr static size_t deletions_per_tick = 16;
|
||||
auto& staging = cache[log2];
|
||||
auto& entries = staging.entries;
|
||||
const size_t old_size = entries.size();
|
||||
|
|
|
@ -53,7 +53,7 @@ VkPresentModeKHR ChooseSwapPresentMode(vk::Span<VkPresentModeKHR> modes) {
|
|||
}
|
||||
|
||||
VkExtent2D ChooseSwapExtent(const VkSurfaceCapabilitiesKHR& capabilities, u32 width, u32 height) {
|
||||
constexpr auto undefined_size{std::numeric_limits<u32>::max()};
|
||||
constexpr static auto undefined_size{std::numeric_limits<u32>::max()};
|
||||
if (capabilities.currentExtent.width != undefined_size) {
|
||||
return capabilities.currentExtent;
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ void TurboMode::Run(std::stop_token stop_token) {
|
|||
auto commit = m_allocator.Commit(buffer, MemoryUsage::DeviceLocal);
|
||||
|
||||
// Create the descriptor pool to contain our descriptor.
|
||||
constexpr VkDescriptorPoolSize pool_size{
|
||||
constexpr static VkDescriptorPoolSize pool_size{
|
||||
.type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
|
||||
.descriptorCount = 1,
|
||||
};
|
||||
|
@ -63,7 +63,7 @@ void TurboMode::Run(std::stop_token stop_token) {
|
|||
});
|
||||
|
||||
// Create the descriptor set layout from the pool.
|
||||
constexpr VkDescriptorSetLayoutBinding layout_binding{
|
||||
constexpr static VkDescriptorSetLayoutBinding layout_binding{
|
||||
.binding = 0,
|
||||
.descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
|
||||
.descriptorCount = 1,
|
||||
|
|
|
@ -371,7 +371,7 @@ std::pair<u32, u32> GetASTCBlockSize(PixelFormat format) {
|
|||
}
|
||||
|
||||
u64 EstimatedDecompressedSize(u64 base_size, PixelFormat format) {
|
||||
constexpr u64 RGBA8_PIXEL_SIZE = 4;
|
||||
constexpr static u64 RGBA8_PIXEL_SIZE = 4;
|
||||
const u64 base_block_size = static_cast<u64>(DefaultBlockWidth(format)) *
|
||||
static_cast<u64>(DefaultBlockHeight(format)) * RGBA8_PIXEL_SIZE;
|
||||
return (base_size * base_block_size) / BytesPerBlock(format);
|
||||
|
|
|
@ -29,7 +29,7 @@ constexpr u32 pdep(u32 value) {
|
|||
|
||||
template <u32 mask, u32 incr_amount>
|
||||
void incrpdep(u32& value) {
|
||||
constexpr u32 swizzled_incr = pdep<mask>(incr_amount);
|
||||
constexpr static u32 swizzled_incr = pdep<mask>(incr_amount);
|
||||
value = ((value | ~mask) + swizzled_incr) & mask;
|
||||
}
|
||||
|
||||
|
|
|
@ -495,9 +495,9 @@ VkResult Free(VkDevice device, VkCommandPool handle, Span<VkCommandBuffer> buffe
|
|||
Instance Instance::Create(u32 version, Span<const char*> layers, Span<const char*> extensions,
|
||||
InstanceDispatch& dispatch) {
|
||||
#ifdef __APPLE__
|
||||
constexpr VkFlags ci_flags{VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR};
|
||||
constexpr static VkFlags ci_flags{VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR};
|
||||
#else
|
||||
constexpr VkFlags ci_flags{};
|
||||
constexpr static VkFlags ci_flags{};
|
||||
#endif
|
||||
|
||||
const VkApplicationInfo application_info{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue