mirror of
https://git.eden-emu.dev/archive/citron
synced 2026-03-22 17:46:08 -04:00
feat(shader): add SamplerComponentType enum and infrastructure
Add SamplerComponentType enum to classify texture component types (float, signed int, unsigned int, depth, stencil) and add ReadTextureComponentType method to Environment interface. - Add SamplerComponentType enum with constexpr helper functions - Add component_type field to TextureDescriptor struct - Add ReadTextureComponentType virtual method to Environment base class Co-Authored-By: ForrestMarkX <forrestmarkx@outlook.com> Signed-off-by: Zephyron <zephyron@citron-emu.org>
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
// SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project
|
||||||
|
// SPDX-FileCopyrightText: Copyright 2026 citron Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
@@ -22,6 +23,11 @@ public:
|
|||||||
|
|
||||||
[[nodiscard]] virtual TextureType ReadTextureType(u32 raw_handle) = 0;
|
[[nodiscard]] virtual TextureType ReadTextureType(u32 raw_handle) = 0;
|
||||||
|
|
||||||
|
/// Read the component type of a texture from its raw handle
|
||||||
|
/// @param raw_handle The raw texture handle to query
|
||||||
|
/// @return The component type of the texture (float, signed int, unsigned int, depth, or stencil)
|
||||||
|
[[nodiscard]] virtual SamplerComponentType ReadTextureComponentType(u32 raw_handle) = 0;
|
||||||
|
|
||||||
[[nodiscard]] virtual TexturePixelFormat ReadTexturePixelFormat(u32 raw_handle) = 0;
|
[[nodiscard]] virtual TexturePixelFormat ReadTexturePixelFormat(u32 raw_handle) = 0;
|
||||||
|
|
||||||
[[nodiscard]] virtual bool IsTexturePixelFormatInteger(u32 raw_handle) = 0;
|
[[nodiscard]] virtual bool IsTexturePixelFormatInteger(u32 raw_handle) = 0;
|
||||||
|
|||||||
@@ -158,6 +158,25 @@ enum class ImageFormat : u32 {
|
|||||||
R32G32B32A32_SFLOAT,
|
R32G32B32A32_SFLOAT,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// Texture sampler component type classification
|
||||||
|
enum class SamplerComponentType : u8 {
|
||||||
|
Float, ///< Floating-point texture components
|
||||||
|
Sint, ///< Signed integer texture components
|
||||||
|
Uint, ///< Unsigned integer texture components
|
||||||
|
Depth, ///< Depth texture components
|
||||||
|
Stencil, ///< Stencil texture components
|
||||||
|
};
|
||||||
|
|
||||||
|
/// Check if a component type represents an integer type
|
||||||
|
[[nodiscard]] constexpr bool IsInteger(SamplerComponentType type) noexcept {
|
||||||
|
return type == SamplerComponentType::Sint || type == SamplerComponentType::Uint;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Check if a component type represents a depth or stencil type
|
||||||
|
[[nodiscard]] constexpr bool IsDepthStencil(SamplerComponentType type) noexcept {
|
||||||
|
return type == SamplerComponentType::Depth || type == SamplerComponentType::Stencil;
|
||||||
|
}
|
||||||
|
|
||||||
enum class Interpolation {
|
enum class Interpolation {
|
||||||
Smooth,
|
Smooth,
|
||||||
Flat,
|
Flat,
|
||||||
@@ -211,6 +230,7 @@ using ImageBufferDescriptors = boost::container::small_vector<ImageBufferDescrip
|
|||||||
|
|
||||||
struct TextureDescriptor {
|
struct TextureDescriptor {
|
||||||
TextureType type;
|
TextureType type;
|
||||||
|
SamplerComponentType component_type;
|
||||||
bool is_depth;
|
bool is_depth;
|
||||||
bool is_multisample;
|
bool is_multisample;
|
||||||
bool has_secondary;
|
bool has_secondary;
|
||||||
|
|||||||
Reference in New Issue
Block a user