mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2026-11-02 04:04:56 +00:00
3d3ed4b7d1
- [x] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions). - [x] I have read and followed the [AI Policy](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/AI.md). - [x] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability. ------------------- credit: Ghael-V Draw sprites whose texture handle comes from a vertex attribute. A bindless handle read from an interpolated vertex attribute could not be tracked to a constant buffer, so pipeline creation threw and every draw using the shader was dropped (FIFA player indicators, shadows and some text). The handle now gets a sentinel descriptor, and the Vulkan rasterizer splits a triangle-list draw into runs of vertices that share a handle and binds each run's texture before drawing it. https://github.com/Ghael-V/Lemon-Project/commit/4fec247e9eb29a6e81a51d8252323c5cda6b2cb9 Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4566 Reviewed-by: Shinmegumi <shinmegumi@eden-emu.dev>
71 lines
3.3 KiB
C++
71 lines
3.3 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 {
|
|
|
|
// Try to keep entries here to a minimum
|
|
// They can accidentally change the cached information in a shader
|
|
|
|
/// Misc information about the host
|
|
struct HostTranslateInfo {
|
|
static constexpr u32 DEFAULT_DESCRIPTOR_LIMIT = 1024;
|
|
|
|
u64 min_ssbo_alignment{}; ///< Minimum alignment supported by the device for SSBOs
|
|
u32 max_per_stage_descriptor_sampled_images{}; ///< maximum sampled descriptors per stage
|
|
u32 max_per_stage_resources{}; ///< maximum resources per stage
|
|
u32 max_descriptor_set_samplers{};
|
|
u32 max_descriptor_set_uniform_buffers{};
|
|
u32 max_descriptor_set_uniform_buffers_dynamic{};
|
|
u32 max_descriptor_set_storage_buffers{};
|
|
u32 max_descriptor_set_storage_buffers_dynamic{};
|
|
u32 max_descriptor_set_sampled_images{};
|
|
u32 max_descriptor_set_storage_images{};
|
|
u32 max_descriptor_set_input_attachements{};
|
|
bool support_float64{}; ///< True when the device supports 64-bit floats
|
|
bool support_float16{}; ///< True when the device supports 16-bit floats
|
|
bool support_int64{}; ///< True when the device supports 64-bit integers
|
|
bool needs_demote_reorder{}; ///< True when the device needs DemoteToHelperInvocation reordered
|
|
bool support_snorm_render_buffer{}; ///< True when the device supports SNORM render buffers
|
|
bool support_viewport_index_layer{}; ///< True when the device supports gl_Layer in VS
|
|
bool support_viewport_mask{};
|
|
bool support_geometry_shader_passthrough{}; ///< True when the device supports geometry
|
|
///< passthrough shaders
|
|
bool support_conditional_barrier{}; ///< True when the device supports barriers in conditional
|
|
///< control flow
|
|
bool single_lane_geometry_subgroups{};
|
|
bool support_attribute_texture_handle{}; ///< True when the host binds texture handles that
|
|
///< arrive as vertex attributes
|
|
|
|
void ApplyDescriptorLimitPolicy() noexcept {
|
|
if (min_ssbo_alignment == 0) {
|
|
min_ssbo_alignment = 1;
|
|
}
|
|
ApplyDescriptorLimitFallback(max_per_stage_descriptor_sampled_images);
|
|
ApplyDescriptorLimitFallback(max_per_stage_resources);
|
|
ApplyDescriptorLimitFallback(max_descriptor_set_samplers);
|
|
ApplyDescriptorLimitFallback(max_descriptor_set_uniform_buffers);
|
|
ApplyDescriptorLimitFallback(max_descriptor_set_uniform_buffers_dynamic);
|
|
ApplyDescriptorLimitFallback(max_descriptor_set_storage_buffers);
|
|
ApplyDescriptorLimitFallback(max_descriptor_set_storage_buffers_dynamic);
|
|
ApplyDescriptorLimitFallback(max_descriptor_set_sampled_images);
|
|
ApplyDescriptorLimitFallback(max_descriptor_set_storage_images);
|
|
ApplyDescriptorLimitFallback(max_descriptor_set_input_attachements);
|
|
}
|
|
|
|
private:
|
|
static void ApplyDescriptorLimitFallback(u32& limit) noexcept {
|
|
if (limit == 0) {
|
|
limit = DEFAULT_DESCRIPTOR_LIMIT;
|
|
}
|
|
}
|
|
};
|
|
|
|
} // namespace Shader
|