mirror of
https://github.com/yuzu-emu/yuzu-android.git
synced 2025-06-11 10:38:01 -05:00
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:
@ -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;
|
||||
|
Reference in New Issue
Block a user