Add material render state and pipeline caching
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <XCEngine/Rendering/RenderMaterialUtility.h>
|
||||
#include <XCEngine/Rendering/RenderPipeline.h>
|
||||
#include <XCEngine/Rendering/RenderResourceCache.h>
|
||||
|
||||
@@ -11,6 +12,8 @@
|
||||
#include <XCEngine/RHI/RHISampler.h>
|
||||
#include <XCEngine/RHI/RHITexture.h>
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
namespace XCEngine {
|
||||
namespace Resources {
|
||||
class Material;
|
||||
@@ -44,6 +47,9 @@ private:
|
||||
bool EnsureInitialized(const RenderContext& context);
|
||||
bool CreatePipelineResources(const RenderContext& context);
|
||||
void DestroyPipelineResources();
|
||||
RHI::RHIPipelineState* GetOrCreatePipelineState(
|
||||
const RenderContext& context,
|
||||
const Resources::Material* material);
|
||||
|
||||
const Resources::Texture* ResolveTexture(const Resources::Material* material) const;
|
||||
RHI::RHIResourceView* ResolveTextureView(const VisibleRenderItem& visibleItem);
|
||||
@@ -65,7 +71,7 @@ private:
|
||||
RHI::RHIDescriptorPool* m_samplerPool = nullptr;
|
||||
RHI::RHIDescriptorSet* m_samplerSet = nullptr;
|
||||
RHI::RHIPipelineLayout* m_pipelineLayout = nullptr;
|
||||
RHI::RHIPipelineState* m_pipelineState = nullptr;
|
||||
std::unordered_map<Resources::MaterialRenderState, RHI::RHIPipelineState*, MaterialRenderStateHash> m_pipelineStates;
|
||||
RHI::RHISampler* m_sampler = nullptr;
|
||||
RHI::RHITexture* m_fallbackTexture = nullptr;
|
||||
RHI::RHIResourceView* m_fallbackTextureView = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user