From 00421f4ace909ae0b238bb410aeda53bb241e45a Mon Sep 17 00:00:00 2001 From: Zephyron Date: Wed, 31 Dec 2025 16:08:12 +1000 Subject: [PATCH] feat(shader): add SamplerComponentType enum and infrastructure - Add SamplerComponentType enum to shader_info.h - Add ReadTextureComponentType to Environment interface - Add texture_component_types cache to shader environments - Update texture descriptor to include component_type field This is the foundation for proper texture component type handling. Co-Authored-By: ForrestMarkX Signed-off-by: Zephyron --- src/shader_recompiler/environment.h | 3 +++ src/shader_recompiler/shader_info.h | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/src/shader_recompiler/environment.h b/src/shader_recompiler/environment.h index 5dbbc7e61..f6a7e64a8 100644 --- a/src/shader_recompiler/environment.h +++ b/src/shader_recompiler/environment.h @@ -1,4 +1,5 @@ // SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project +// SPDX-FileCopyrightText: Copyright 2025 citron Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later #pragma once @@ -22,6 +23,8 @@ public: [[nodiscard]] virtual TextureType ReadTextureType(u32 raw_handle) = 0; + [[nodiscard]] virtual SamplerComponentType ReadTextureComponentType(u32 raw_handle) = 0; + [[nodiscard]] virtual TexturePixelFormat ReadTexturePixelFormat(u32 raw_handle) = 0; [[nodiscard]] virtual bool IsTexturePixelFormatInteger(u32 raw_handle) = 0; diff --git a/src/shader_recompiler/shader_info.h b/src/shader_recompiler/shader_info.h index 74c402632..fb1f0697c 100644 --- a/src/shader_recompiler/shader_info.h +++ b/src/shader_recompiler/shader_info.h @@ -158,6 +158,14 @@ enum class ImageFormat : u32 { R32G32B32A32_SFLOAT, }; +enum class SamplerComponentType : u8 { + Float, + Sint, + Uint, + Depth, + Stencil, +}; + enum class Interpolation { Smooth, Flat, @@ -211,6 +219,7 @@ using ImageBufferDescriptors = boost::container::small_vector