Generalize builtin pass resource binding plan

This commit is contained in:
2026-04-03 16:59:18 +08:00
parent e0e5c1fcaa
commit 2de254a16f
5 changed files with 311 additions and 159 deletions

View File

@@ -68,19 +68,10 @@ private:
Math::Vector4 mainLightColorAndFlags = Math::Vector4::Zero();
};
struct PerMaterialConstants {
struct FallbackPerMaterialConstants {
Math::Vector4 baseColorFactor = Math::Vector4::One();
};
struct DescriptorBindingLocation {
Core::uint32 set = UINT32_MAX;
Core::uint32 binding = UINT32_MAX;
bool IsValid() const {
return set != UINT32_MAX && binding != UINT32_MAX;
}
};
struct PassLayoutKey {
const Resources::Shader* shader = nullptr;
Containers::String passName;
@@ -115,10 +106,10 @@ private:
Core::uint32 descriptorSetCount = 0;
std::vector<PassSetLayoutMetadata> setLayouts;
std::vector<OwnedDescriptorSet> staticDescriptorSets;
DescriptorBindingLocation perObject = {};
DescriptorBindingLocation material = {};
DescriptorBindingLocation baseColorTexture = {};
DescriptorBindingLocation linearClampSampler = {};
PassResourceBindingLocation perObject = {};
PassResourceBindingLocation material = {};
PassResourceBindingLocation baseColorTexture = {};
PassResourceBindingLocation linearClampSampler = {};
};
struct DynamicDescriptorSetKey {
@@ -209,7 +200,7 @@ private:
Core::uint32 setIndex,
Core::uint64 objectId,
const Resources::Material* material,
const PerMaterialConstants& materialConstants,
const MaterialConstantPayloadView& materialConstants,
RHI::RHIResourceView* textureView);
void DestroyOwnedDescriptorSet(OwnedDescriptorSet& descriptorSet);
void DestroyPassResourceLayout(PassResourceLayout& passLayout);