refactor(srp): bind managed fullscreen auxiliary inputs through render graph
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
#include <XCEngine/Core/Asset/ResourceHandle.h>
|
||||
#include <XCEngine/Core/Containers/String.h>
|
||||
#include <XCEngine/Core/Math/Vector4.h>
|
||||
#include <XCEngine/Rendering/Builtin/BuiltinPassTypes.h>
|
||||
#include <XCEngine/Rendering/RenderPass.h>
|
||||
#include <XCEngine/Resources/Shader/Shader.h>
|
||||
#include <XCEngine/RHI/RHIEnums.h>
|
||||
@@ -27,6 +28,23 @@ public:
|
||||
RHI::RHIDescriptorSet* set = nullptr;
|
||||
};
|
||||
|
||||
struct BoundSetState {
|
||||
RHI::RHIResourceView* sourceColorTextureView = nullptr;
|
||||
std::vector<RHI::RHIResourceView*> materialTextureViews = {};
|
||||
};
|
||||
|
||||
struct PassResourceLayout {
|
||||
std::vector<BuiltinPassSetLayoutMetadata> setLayouts = {};
|
||||
std::vector<OwnedDescriptorSet> descriptorSets = {};
|
||||
std::vector<BoundSetState> boundSetStates = {};
|
||||
RHI::RHIPipelineLayout* pipelineLayout = nullptr;
|
||||
PassResourceBindingLocation passConstants = {};
|
||||
PassResourceBindingLocation sourceColorTexture = {};
|
||||
PassResourceBindingLocation linearClampSampler = {};
|
||||
uint32_t firstDescriptorSet = 0u;
|
||||
uint32_t descriptorSetCount = 0u;
|
||||
};
|
||||
|
||||
explicit BuiltinVectorFullscreenPass(
|
||||
const Math::Vector4& vectorPayload = Math::Vector4::One(),
|
||||
Containers::String shaderPath = {},
|
||||
@@ -51,7 +69,15 @@ public:
|
||||
private:
|
||||
bool EnsureInitialized(const RenderContext& renderContext, const RenderSurface& surface);
|
||||
bool CreateResources(const RenderContext& renderContext, const RenderSurface& surface);
|
||||
bool CreateOwnedDescriptorSet(
|
||||
const BuiltinPassSetLayoutMetadata& setLayout,
|
||||
OwnedDescriptorSet& descriptorSet);
|
||||
bool UpdateDescriptorSets(const RenderPassContext& context);
|
||||
RHI::RHIResourceView* ResolveExtraTextureView(
|
||||
const RenderPassContext& context,
|
||||
const BuiltinPassResourceBindingDesc& bindingDesc) const;
|
||||
void DestroyResources();
|
||||
void DestroyPassResourceLayout();
|
||||
void DestroyOwnedDescriptorSet(OwnedDescriptorSet& descriptorSet);
|
||||
|
||||
Containers::String m_shaderPath;
|
||||
@@ -64,12 +90,8 @@ private:
|
||||
uint32_t m_renderTargetSampleQuality = 0u;
|
||||
Resources::ResourceHandle<Resources::Shader> m_shader;
|
||||
RHI::RHISampler* m_sampler = nullptr;
|
||||
RHI::RHIPipelineLayout* m_pipelineLayout = nullptr;
|
||||
RHI::RHIPipelineState* m_pipelineState = nullptr;
|
||||
OwnedDescriptorSet m_constantsSet = {};
|
||||
OwnedDescriptorSet m_textureSet = {};
|
||||
OwnedDescriptorSet m_samplerSet = {};
|
||||
RHI::RHIResourceView* m_boundSourceColorView = nullptr;
|
||||
PassResourceLayout m_passLayout = {};
|
||||
};
|
||||
|
||||
} // namespace Passes
|
||||
|
||||
@@ -23,12 +23,18 @@ class RenderGraphBuilder;
|
||||
class RenderGraphBlackboard;
|
||||
|
||||
struct RenderPassContext {
|
||||
struct TextureBindingView {
|
||||
Containers::String resourceName = {};
|
||||
RHI::RHIResourceView* resourceView = nullptr;
|
||||
};
|
||||
|
||||
const RenderContext& renderContext;
|
||||
const RenderSurface& surface;
|
||||
const RenderSceneData& sceneData;
|
||||
const RenderSurface* sourceSurface = nullptr;
|
||||
RHI::RHIResourceView* sourceColorView = nullptr;
|
||||
RHI::ResourceStates sourceColorState = RHI::ResourceStates::Common;
|
||||
std::vector<TextureBindingView> textureBindings = {};
|
||||
};
|
||||
|
||||
inline RenderPassContext BuildRenderPassContext(
|
||||
@@ -39,7 +45,8 @@ inline RenderPassContext BuildRenderPassContext(
|
||||
executionContext.sceneData,
|
||||
executionContext.sourceSurface,
|
||||
executionContext.sourceColorView,
|
||||
executionContext.sourceColorState
|
||||
executionContext.sourceColorState,
|
||||
{}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,12 @@ struct RenderPassGraphIO {
|
||||
bool writeDepth = false;
|
||||
};
|
||||
|
||||
struct RenderPassGraphTextureBindingRequest {
|
||||
Containers::String resourceName = {};
|
||||
RenderGraphTextureHandle texture = {};
|
||||
RenderGraphTextureAspect aspect = RenderGraphTextureAspect::Color;
|
||||
};
|
||||
|
||||
inline RenderPassGraphIO BuildSourceColorFullscreenRasterPassGraphIO() {
|
||||
return {
|
||||
true,
|
||||
@@ -53,7 +59,8 @@ bool RecordCallbackRasterRenderPass(
|
||||
const RenderPassGraphIO& io,
|
||||
RenderPassGraphExecutePassCallback executePassCallback,
|
||||
std::vector<RenderGraphTextureHandle> additionalReadTextures = {},
|
||||
std::vector<RenderGraphTextureHandle> additionalReadDepthTextures = {});
|
||||
std::vector<RenderGraphTextureHandle> additionalReadDepthTextures = {},
|
||||
std::vector<RenderPassGraphTextureBindingRequest> textureBindingRequests = {});
|
||||
|
||||
bool RecordRasterRenderPass(
|
||||
RenderPass& pass,
|
||||
|
||||
Reference in New Issue
Block a user