From 8d911c0b9160c8b6256cc99bc9fd078f12b16569 Mon Sep 17 00:00:00 2001 From: boykopovar Date: Fri, 18 Sep 2026 16:01:27 +0300 Subject: [PATCH] feat(shader): impl ir descriptor structures primitives --- README.md | 2 +- .../IrMetadata/DescriptorBinding.hpp | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 6e905dfcc..f0967faf8 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ Reaches the `main` function with render loop (deep call chain, ~64KB stack frame A standalone [SPIR-V triangle test](core/libs/prx/libSceAgcDriver/tests/Visual.cpp) passes GPU readback checks and presents a frame through the [libSceAgcDriver](core/libs/prx/libSceAgcDriver). The first application draw passes driver state validation and reaches shader recompilation. Application shader execution remains unverified without completed [recompiler](core/shader/recompiler/Recompiler.cpp). -Now: `ShaderRecompiler::Recompile: SsaBuilder::Rewrite not implemented`. +Now: `ShaderRecompiler::Recompile: SpirvEmitter::Emit not implemented`. ## Build diff --git a/core/shader/recompiler/IntermediateRepresentation/include/IntermediateRepresentation/IrMetadata/DescriptorBinding.hpp b/core/shader/recompiler/IntermediateRepresentation/include/IntermediateRepresentation/IrMetadata/DescriptorBinding.hpp index 4b00fd2c5..9ebdb4267 100644 --- a/core/shader/recompiler/IntermediateRepresentation/include/IntermediateRepresentation/IrMetadata/DescriptorBinding.hpp +++ b/core/shader/recompiler/IntermediateRepresentation/include/IntermediateRepresentation/IrMetadata/DescriptorBinding.hpp @@ -4,7 +4,6 @@ #include #include #include -#include #include namespace ShaderRecompiler { @@ -32,10 +31,10 @@ struct PushData { std::array dwords {}; [[nodiscard]] static bool CanFit(std::uint32_t start, std::uint32_t size) { - throw std::runtime_error("CanFit not implemented"); + return size != 0u && start <= DwordCount && size <= DwordCount - start; } [[nodiscard]] static std::uint32_t StartFor(std::uint32_t cursor, std::uint32_t size) { - throw std::runtime_error("StartFor not implemented"); + return CanFit(cursor, size) ? cursor : NoStart; } }; @@ -54,13 +53,15 @@ struct IrBindingLayout { std::vector descriptors; [[nodiscard]] std::uint32_t ShaderDataDwords() const { - throw std::runtime_error("ShaderDataDwords not implemented"); + return memoryOffsetDword + (memoryOffsetCount + 3u) / 4u; } [[nodiscard]] bool UsesPushData() const { - throw std::runtime_error("UsesPushData not implemented"); + return pushDataStartDword != PushData::NoStart; } void AdvancePushData(std::uint32_t& cursor) const { - throw std::runtime_error("AdvancePushData not implemented"); + if (UsesPushData()) { + cursor = pushDataStartDword + ShaderDataDwords(); + } } bool operator==(const IrBindingLayout& other) const = default;