mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2026-08-24 16:30:44 +00:00
eb9280dedf
The approach on this PR moves around refactoring/ updating residual work; main issue was the whole logic behind msaa upload/download images with the constant image copy per pass required; which was gated via shaderStorageImageMultisample, which is not available on all the platforms supported including Android, making them to rely into a more heavier approach to convert msaa image copy into a non msaa image copy, not only losing precision in the conversion, but also creating bugs around the resolve of the image itself, if the supported path had to copy 2 times the same image to be actually presentable, when the fallback was enabled 3 copies were performed, not only decreasing the performance but also increasing race conditions due to the certain capabilities processed in this chain (storage_views). In order to resolve them more naturally, the constant copies were removed from the now "common" path along establishing a proper color resolve for Android and actually making them more direct. Yet this opened a new pack of outdated handling on our current backend; since we now pass msaa images more directly (whenever a game request a msaa type of image/ which seems to be not common + each fragment resolves images on how it's actually required, adding missing depth/stencil), how we often load and store them becomes a critical issue, since our current configuration renderpass/framebuffer forces to always load and load clear whenever a new attachment it's passing through the renderpass, making this really heavier on memory bandwidth limited devices as SteamDeck and others that doesn't rely on the inmediate rendering mode (Tilers vs iGPU); to prevent over allocating data, I had to re-structure part of the current renderpass and framebuffer to actually reuse part of the data/ attachments called, with flags as DON'T_CARE, simplifying partially on how we actually call attachments including their barriers and conditions (occlusion, etc), the DON'T_CARE it's specifically useful to not only prevent calling new loads (which is a flush and heavier on tiler devices) and not only reusing the actual data store, which works on the future time, this saves memory bandwidth and gives space to actually avoid the constant pressure on SYSMEM/GMEM shader resolver path. This maintenance also improved the current removal features logic on QCOM drivers, closing gaps between implementations on descriptors (VK_EXT_indexing_descriptor), adjusting the whole WMEL to avoid being so stricter if certain capabilities are missing to actually use this feature, leading to test and play more on how QCOM drivers are actually behaving; meanwhile the main objective is to open path for a robust and bigger implementation in the future, the changes made here also contains small bug fixes on SPIR-V logic, adding missing cases to resolve shaders (FP64 -> FP16), adding more robustness on how narrow features are actually being used and how to wired them whenever they're not available, meanwhile there are still some issues in regards on how Tegra vs Adreno can preserve unorms at FP32 and FP16, leaving better understanding on base for what VK_EXT_shader_float_controls is actually doing most of the times (flushes NaN's and Denorms equally). Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4212
116 lines
4.6 KiB
C++
116 lines
4.6 KiB
C++
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
// SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
#pragma once
|
|
|
|
#include "common/common_types.h"
|
|
|
|
namespace Shader {
|
|
|
|
enum class Stage : u32;
|
|
|
|
struct Profile {
|
|
u32 supported_spirv{0x00010000};
|
|
bool unified_descriptor_binding{};
|
|
bool support_descriptor_aliasing{};
|
|
bool support_int8{};
|
|
bool support_uniform_and_storage_buffer_8bit{};
|
|
bool support_storage_buffer_8bit{};
|
|
bool support_int16{};
|
|
bool support_uniform_and_storage_buffer_16bit{};
|
|
bool support_storage_buffer_16bit{};
|
|
bool support_int64{};
|
|
bool support_vertex_instance_id{};
|
|
bool support_float_controls{};
|
|
bool support_separate_denorm_behavior{};
|
|
bool support_separate_rounding_mode{};
|
|
bool support_fp16_denorm_preserve{};
|
|
bool support_fp32_denorm_preserve{};
|
|
bool support_fp16_denorm_flush{};
|
|
bool support_fp32_denorm_flush{};
|
|
bool support_fp16_signed_zero_nan_preserve{};
|
|
bool support_fp32_signed_zero_nan_preserve{};
|
|
bool support_fp64_signed_zero_nan_preserve{};
|
|
bool support_explicit_workgroup_layout{};
|
|
bool support_workgroup_layout_8bit_access{};
|
|
bool support_workgroup_layout_16bit_access{};
|
|
bool support_vote{};
|
|
u32 supported_subgroup_stages{0x7F};
|
|
bool support_viewport_index_layer_non_geometry{};
|
|
bool support_viewport_mask{};
|
|
bool support_typeless_image_loads{};
|
|
bool support_demote_to_helper_invocation{};
|
|
bool support_int64_atomics{};
|
|
bool support_shared_int64_atomics{};
|
|
bool support_derivative_control{};
|
|
bool support_geometry_shader_passthrough{};
|
|
bool support_native_ndc{};
|
|
bool support_gl_nv_gpu_shader_5{};
|
|
bool support_gl_amd_gpu_shader_half_float{};
|
|
bool support_gl_texture_shadow_lod{};
|
|
bool support_gl_warp_intrinsics{};
|
|
bool support_gl_variable_aoffi{};
|
|
bool support_gl_sparse_textures{};
|
|
bool support_gl_derivative_control{};
|
|
bool support_scaled_attributes{};
|
|
bool support_multi_viewport{};
|
|
bool support_geometry_streams{};
|
|
bool support_sampled_image_array_nonuniform_indexing{};
|
|
bool support_storage_image_array_nonuniform_indexing{};
|
|
bool support_uniform_texel_buffer_array_nonuniform_indexing{};
|
|
bool support_storage_texel_buffer_array_nonuniform_indexing{};
|
|
|
|
bool warp_size_potentially_larger_than_guest{};
|
|
|
|
bool lower_left_origin_mode{};
|
|
/// Fragment outputs have to be declared even if they are not written to avoid undefined values.
|
|
/// See Ori and the Blind Forest's main menu for reference.
|
|
bool need_declared_frag_colors{};
|
|
/// Prevents fast math optimizations that may cause inaccuracies
|
|
bool need_fastmath_off{};
|
|
/// Some GPU vendors use a different rounding precision when calculating texture pixel
|
|
/// coordinates with the 16.8 format in the ImageGather instruction than the Maxwell
|
|
/// architecture. Applying an offset does fix this mismatching rounding behaviour.
|
|
bool need_gather_subpixel_offset{};
|
|
|
|
/// OpFClamp is broken and OpFMax + OpFMin should be used instead
|
|
bool has_broken_spirv_clamp{};
|
|
/// The Position builtin needs to be wrapped in a struct when used as an input
|
|
bool has_broken_spirv_position_input{};
|
|
/// Offset image operands with an unsigned type do not work
|
|
bool has_broken_unsigned_image_offsets{};
|
|
/// Signed instructions with unsigned data types are misinterpreted
|
|
bool has_broken_signed_operations{};
|
|
/// Float controls break when fp16 is enabled
|
|
bool has_broken_fp16_float_controls{};
|
|
/// Dynamic vec4 indexing is broken on some OpenGL drivers
|
|
bool has_gl_component_indexing_bug{};
|
|
/// The precise type qualifier is broken in the fragment stage of some drivers
|
|
bool has_gl_precise_bug{};
|
|
/// Some drivers do not properly support floatBitsToUint when used on cbufs
|
|
bool has_gl_cbuf_ftou_bug{};
|
|
/// Some drivers poorly optimize boolean variable references
|
|
bool has_gl_bool_ref_bug{};
|
|
/// Ignores SPIR-V ordered vs unordered using GLSL semantics
|
|
bool ignore_nan_fp_comparisons{};
|
|
/// Some drivers have broken support for OpVectorExtractDynamic on subgroup mask inputs
|
|
bool has_broken_spirv_subgroup_mask_vector_extract_dynamic{};
|
|
|
|
u32 gl_max_compute_smem_size{};
|
|
|
|
/// Maxwell and earlier nVidia architectures have broken robust support
|
|
bool has_broken_robust{};
|
|
|
|
u64 min_ssbo_alignment{};
|
|
u32 max_user_clip_distances{};
|
|
|
|
bool SupportsSubgroupStage(Stage stage) const {
|
|
return (supported_subgroup_stages & (1u << static_cast<u32>(stage))) != 0;
|
|
}
|
|
};
|
|
|
|
} // namespace Shader
|