Fix D3D12 pipeline format mapping and add transparent material scene test

This commit is contained in:
2026-03-27 13:01:17 +08:00
parent 79e7452245
commit 134a80b334
7 changed files with 631983 additions and 59 deletions

View File

@@ -15,6 +15,10 @@
#include <unordered_map>
namespace XCEngine {
namespace Components {
class GameObject;
} // namespace Components
namespace Resources {
class Material;
class Texture;
@@ -38,6 +42,11 @@ public:
const RenderSceneData& sceneData) override;
private:
struct OwnedDescriptorSet {
RHI::RHIDescriptorPool* pool = nullptr;
RHI::RHIDescriptorSet* set = nullptr;
};
struct PerObjectConstants {
Math::Matrix4x4 projection = Math::Matrix4x4::Identity();
Math::Matrix4x4 view = Math::Matrix4x4::Identity();
@@ -50,6 +59,9 @@ private:
RHI::RHIPipelineState* GetOrCreatePipelineState(
const RenderContext& context,
const Resources::Material* material);
RHI::RHIDescriptorSet* GetOrCreatePerObjectSet(Core::uint64 objectId);
RHI::RHIDescriptorSet* GetOrCreateTextureSet(RHI::RHIResourceView* textureView);
void DestroyOwnedDescriptorSet(OwnedDescriptorSet& descriptorSet);
const Resources::Texture* ResolveTexture(const Resources::Material* material) const;
RHI::RHIResourceView* ResolveTextureView(const VisibleRenderItem& visibleItem);
@@ -64,14 +76,12 @@ private:
RenderResourceCache m_resourceCache;
RHI::RHIDescriptorPool* m_constantPool = nullptr;
RHI::RHIDescriptorSet* m_constantSet = nullptr;
RHI::RHIDescriptorPool* m_texturePool = nullptr;
RHI::RHIDescriptorSet* m_textureSet = nullptr;
RHI::RHIDescriptorPool* m_samplerPool = nullptr;
RHI::RHIDescriptorSet* m_samplerSet = nullptr;
RHI::RHIPipelineLayout* m_pipelineLayout = nullptr;
std::unordered_map<Resources::MaterialRenderState, RHI::RHIPipelineState*, MaterialRenderStateHash> m_pipelineStates;
std::unordered_map<Core::uint64, OwnedDescriptorSet> m_perObjectSets;
std::unordered_map<RHI::RHIResourceView*, OwnedDescriptorSet> m_textureSets;
RHI::RHISampler* m_sampler = nullptr;
RHI::RHITexture* m_fallbackTexture = nullptr;
RHI::RHIResourceView* m_fallbackTextureView = nullptr;