From 646b6d2f56d6f2d3195cfbd0746625510d2ae92d Mon Sep 17 00:00:00 2001 From: Silverlan Date: Tue, 24 Dec 2024 13:21:32 +0100 Subject: [PATCH] feat(shader_graph): image textures are now in global descriptor set; add alpha mode --- .../pragma/rendering/shader_graph/module.hpp | 10 +-- .../shader_graph/modules/image_texture.hpp | 2 +- .../shader_graph/modules/input_data.hpp | 7 +- .../rendering/shader_graph/modules/pbr.hpp | 2 +- .../shader_graph/nodes/image_texture.hpp | 1 + .../shader_graph/nodes/scene_output.hpp | 1 + .../src/rendering/shader_graph/module.cpp | 2 +- .../shader_graph/modules/image_texture.cpp | 14 ++-- .../shader_graph/modules/input_data.cpp | 67 ++++++++++++++++--- .../rendering/shader_graph/modules/pbr.cpp | 4 +- .../shader_graph/nodes/image_texture.cpp | 18 +++-- .../shader_graph/nodes/scene_output.cpp | 17 +++-- .../shaders/world/c_shader_graph.cpp | 31 ++++++++- 13 files changed, 140 insertions(+), 36 deletions(-) diff --git a/core/client/include/pragma/rendering/shader_graph/module.hpp b/core/client/include/pragma/rendering/shader_graph/module.hpp index 71285d709..1af93f921 100644 --- a/core/client/include/pragma/rendering/shader_graph/module.hpp +++ b/core/client/include/pragma/rendering/shader_graph/module.hpp @@ -20,6 +20,7 @@ namespace prosper { namespace pragma { class CSceneComponent; class CRasterizationRendererComponent; + class ShaderGraph; }; class CModelSubMesh; @@ -27,8 +28,9 @@ namespace pragma::rendering { class ShaderProcessor; class DLLCLIENT ShaderGraphModule { public: - ShaderGraphModule(prosper::Shader &shader) : m_shader(shader) {} + ShaderGraphModule(ShaderGraph &shader) : m_shader(shader) {} virtual ~ShaderGraphModule() {} + virtual void InitializeShaderResources() {} virtual void InitializeGfxPipelineDescriptorSets() = 0; virtual void GetShaderPreprocessorDefinitions(std::unordered_map &outDefinitions, std::string &outPrefixCode) {} virtual void UpdateRenderFlags(CModelSubMesh &mesh, ShaderGameWorld::SceneFlags &inOutFlags) {} @@ -37,16 +39,16 @@ namespace pragma::rendering { virtual void RecordBindMaterial(rendering::ShaderProcessor &shaderProcessor, CMaterial &mat) const {} void SetNodes(std::vector &&nodes) { m_nodes = std::move(nodes); } protected: - prosper::Shader &m_shader; + ShaderGraph &m_shader; std::vector m_nodes; }; class DLLCLIENT ShaderGraphModuleManager { public: - using Factory = std::function(prosper::Shader &shader)>; + using Factory = std::function(ShaderGraph &shader)>; ShaderGraphModuleManager() {} void RegisterFactory(const std::string &name, const Factory &factory); - std::unique_ptr CreateModule(const std::string &name, prosper::Shader &shader, std::vector &&nodes) const; + std::unique_ptr CreateModule(const std::string &name, ShaderGraph &shader, std::vector &&nodes) const; const std::unordered_map &GetFactories() const { return m_factories; } private: std::unordered_map m_factories; diff --git a/core/client/include/pragma/rendering/shader_graph/modules/image_texture.hpp b/core/client/include/pragma/rendering/shader_graph/modules/image_texture.hpp index 75ddee3df..c1ccb200c 100644 --- a/core/client/include/pragma/rendering/shader_graph/modules/image_texture.hpp +++ b/core/client/include/pragma/rendering/shader_graph/modules/image_texture.hpp @@ -23,7 +23,7 @@ namespace pragma::rendering::shader_graph { Count }; - ImageTextureModule(prosper::Shader &shader); + ImageTextureModule(ShaderGraph &shader); virtual ~ImageTextureModule() override; virtual void InitializeGfxPipelineDescriptorSets() override; virtual void RecordBindScene(rendering::ShaderProcessor &shaderProcessor, const pragma::CSceneComponent &scene, const pragma::CRasterizationRendererComponent &renderer, ShaderGameWorld::SceneFlags &inOutSceneFlags) const override; diff --git a/core/client/include/pragma/rendering/shader_graph/modules/input_data.hpp b/core/client/include/pragma/rendering/shader_graph/modules/input_data.hpp index b93903f3e..02fc08c38 100644 --- a/core/client/include/pragma/rendering/shader_graph/modules/input_data.hpp +++ b/core/client/include/pragma/rendering/shader_graph/modules/input_data.hpp @@ -24,14 +24,19 @@ namespace pragma::rendering { namespace pragma::rendering::shader_graph { class DLLCLIENT InputDataModule : public pragma::rendering::ShaderGraphModule { public: - InputDataModule(prosper::Shader &shader); + InputDataModule(ShaderGraph &shader); virtual ~InputDataModule() override; + virtual void InitializeShaderResources() override; virtual void InitializeGfxPipelineDescriptorSets() override; virtual void GetShaderPreprocessorDefinitions(std::unordered_map &outDefinitions, std::string &outPrefixCode) override; virtual void RecordBindScene(rendering::ShaderProcessor &shaderProcessor, const pragma::CSceneComponent &scene, const pragma::CRasterizationRendererComponent &renderer, ShaderGameWorld::SceneFlags &inOutSceneFlags) const override; private: prosper::DescriptorSetInfo m_globalInputDataDsInfo; + + std::unique_ptr m_resolvedGraph; + std::shared_ptr m_globalInputDsg; + std::vector m_imageTextureNodes; }; }; diff --git a/core/client/include/pragma/rendering/shader_graph/modules/pbr.hpp b/core/client/include/pragma/rendering/shader_graph/modules/pbr.hpp index ca6abcd80..f5996cc42 100644 --- a/core/client/include/pragma/rendering/shader_graph/modules/pbr.hpp +++ b/core/client/include/pragma/rendering/shader_graph/modules/pbr.hpp @@ -23,7 +23,7 @@ namespace pragma::rendering::shader_graph { Count }; - PbrModule(prosper::Shader &shader); + PbrModule(ShaderGraph &shader); virtual ~PbrModule() override; virtual void InitializeGfxPipelineDescriptorSets() override; virtual void RecordBindScene(rendering::ShaderProcessor &shaderProcessor, const pragma::CSceneComponent &scene, const pragma::CRasterizationRendererComponent &renderer, ShaderGameWorld::SceneFlags &inOutSceneFlags) const override; diff --git a/core/client/include/pragma/rendering/shader_graph/nodes/image_texture.hpp b/core/client/include/pragma/rendering/shader_graph/nodes/image_texture.hpp index d71635c1e..ae8357343 100644 --- a/core/client/include/pragma/rendering/shader_graph/nodes/image_texture.hpp +++ b/core/client/include/pragma/rendering/shader_graph/nodes/image_texture.hpp @@ -22,6 +22,7 @@ namespace pragma::rendering::shader_graph { static constexpr const char *OUT_ALPHA = "alpha"; ImageTextureNode(const std::string_view &type); + std::string GetTextureVariableName(const pragma::shadergraph::GraphNode &gn) const; virtual std::string DoEvaluate(const pragma::shadergraph::Graph &graph, const pragma::shadergraph::GraphNode &instance) const override; virtual std::string DoEvaluateResourceDeclarations(const pragma::shadergraph::Graph &graph, const pragma::shadergraph::GraphNode &instance) const override; diff --git a/core/client/include/pragma/rendering/shader_graph/nodes/scene_output.hpp b/core/client/include/pragma/rendering/shader_graph/nodes/scene_output.hpp index 5fa9684e4..719dd2c35 100644 --- a/core/client/include/pragma/rendering/shader_graph/nodes/scene_output.hpp +++ b/core/client/include/pragma/rendering/shader_graph/nodes/scene_output.hpp @@ -18,6 +18,7 @@ namespace pragma::rendering::shader_graph { static constexpr const char *IN_COLOR = "color"; static constexpr const char *IN_ALPHA = "alpha"; static constexpr const char *IN_BLOOM_COLOR = "bloomColor"; + static constexpr const char *CONST_ALPHA_MODE = "alphaMode"; // TODO: Only allow one of these! SceneOutputNode(const std::string_view &type); diff --git a/core/client/src/rendering/shader_graph/module.cpp b/core/client/src/rendering/shader_graph/module.cpp index 45b35fcd0..adf9504a2 100644 --- a/core/client/src/rendering/shader_graph/module.cpp +++ b/core/client/src/rendering/shader_graph/module.cpp @@ -11,7 +11,7 @@ using namespace pragma::rendering; void ShaderGraphModuleManager::RegisterFactory(const std::string &name, const Factory &factory) { m_factories[name] = factory; } -std::unique_ptr ShaderGraphModuleManager::CreateModule(const std::string &name, prosper::Shader &shader, std::vector &&nodes) const +std::unique_ptr ShaderGraphModuleManager::CreateModule(const std::string &name, ShaderGraph &shader, std::vector &&nodes) const { auto it = m_factories.find(name); if(it == m_factories.end()) diff --git a/core/client/src/rendering/shader_graph/modules/image_texture.cpp b/core/client/src/rendering/shader_graph/modules/image_texture.cpp index 7439d9bea..3906e6913 100644 --- a/core/client/src/rendering/shader_graph/modules/image_texture.cpp +++ b/core/client/src/rendering/shader_graph/modules/image_texture.cpp @@ -22,7 +22,7 @@ using namespace pragma::rendering::shader_graph; extern DLLCLIENT CEngine *c_engine; extern DLLCLIENT ClientState *client; #pragma optimize("", off) -ImageTextureModule::ImageTextureModule(prosper::Shader &shader) : pragma::rendering::ShaderGraphModule {shader} +ImageTextureModule::ImageTextureModule(ShaderGraph &shader) : pragma::rendering::ShaderGraphModule {shader} { //Global settings +textures? /* prosper::PrDescriptorSetBindingFlags::Cubemap */ @@ -31,7 +31,7 @@ ImageTextureModule::~ImageTextureModule() {} void ImageTextureModule::InitializeGfxPipelineDescriptorSets() { // TODO: Move this somewhere else - std::vector bindings; + /*std::vector bindings; bindings.reserve(m_nodes.size()); for(auto *node : m_nodes) { auto texName = node->GetBaseVarName() + "_tex"; @@ -42,13 +42,13 @@ void ImageTextureModule::InitializeGfxPipelineDescriptorSets() m_descSetInfo = { "TEST", bindings, - }; + };*/ // - m_shader.AddDescriptorSetGroup(m_descSetInfo); + //m_shader.AddDescriptorSetGroup(m_descSetInfo); - auto &context = c_engine->GetRenderContext(); + /*auto &context = c_engine->GetRenderContext(); auto dsg = context.CreateDescriptorSetGroup(m_descSetInfo); auto &ds = *dsg->GetDescriptorSet(0); auto &texManager = static_cast(client->GetMaterialManager()).GetTextureManager(); @@ -65,9 +65,9 @@ void ImageTextureModule::InitializeGfxPipelineDescriptorSets() ds.SetBindingTexture(*prosperTex, bindingIdx++); } - m_dsg = dsg; + m_dsg = dsg;*/ } void ImageTextureModule::RecordBindScene(rendering::ShaderProcessor &shaderProcessor, const pragma::CSceneComponent &scene, const pragma::CRasterizationRendererComponent &renderer, ShaderGameWorld::SceneFlags &inOutSceneFlags) const { - shaderProcessor.GetCommandBuffer().RecordBindDescriptorSets(prosper::PipelineBindPoint::Graphics, shaderProcessor.GetCurrentPipelineLayout(), m_descSetInfo.setIndex, *m_dsg->GetDescriptorSet()); + //shaderProcessor.GetCommandBuffer().RecordBindDescriptorSets(prosper::PipelineBindPoint::Graphics, shaderProcessor.GetCurrentPipelineLayout(), m_descSetInfo.setIndex, *m_dsg->GetDescriptorSet()); } diff --git a/core/client/src/rendering/shader_graph/modules/input_data.cpp b/core/client/src/rendering/shader_graph/modules/input_data.cpp index 8045b3e47..b954937cd 100644 --- a/core/client/src/rendering/shader_graph/modules/input_data.cpp +++ b/core/client/src/rendering/shader_graph/modules/input_data.cpp @@ -7,10 +7,16 @@ #include "stdafx_client.h" #include "pragma/rendering/shader_graph/modules/input_data.hpp" +#include "pragma/rendering/shader_graph/nodes/image_texture.hpp" #include "pragma/rendering/render_processor.hpp" #include "pragma/rendering/shader_material/shader_material.hpp" #include "pragma/rendering/global_shader_input_manager.hpp" #include "pragma/rendering/shader_graph/manager.hpp" +#include "pragma/rendering/shaders/world/c_shader_graph.hpp" +#include +#include +#include +#include #include #include #include @@ -18,16 +24,39 @@ using namespace pragma::rendering::shader_graph; extern DLLCLIENT CEngine *c_engine; +extern DLLCLIENT ClientState *client; extern DLLCLIENT CGame *c_game; -InputDataModule::InputDataModule(prosper::Shader &shader) : pragma::rendering::ShaderGraphModule {shader} +InputDataModule::InputDataModule(ShaderGraph &shader) : pragma::rendering::ShaderGraphModule {shader} {} +InputDataModule::~InputDataModule() {} + +void InputDataModule::InitializeShaderResources() { - m_globalInputDataDsInfo = { - "SHADER_GRAPH", - {prosper::DescriptorSetInfo::Binding {"GLOBAL_INPUT_DATA", prosper::DescriptorType::UniformBuffer, prosper::ShaderStageFlags::FragmentBit | prosper::ShaderStageFlags::VertexBit | prosper::ShaderStageFlags::GeometryBit}}, - }; + std::vector bindings; + + auto *graph = m_shader.GetGraph(); + if(!graph) + return; + bindings.push_back({"GLOBAL_INPUT_DATA", prosper::DescriptorType::UniformBuffer, prosper::ShaderStageFlags::FragmentBit | prosper::ShaderStageFlags::VertexBit | prosper::ShaderStageFlags::GeometryBit}); + + // TODO + m_resolvedGraph = std::make_unique(*graph); + m_resolvedGraph->Resolve(); + for(auto &graphNode : m_resolvedGraph->GetNodes()) { + auto *node = dynamic_cast(&graphNode->node); + if(!node) + continue; + auto texVarName = node->GetTextureVariableName(*graphNode); + ustring::to_upper(texVarName); + bindings.push_back({pragma::register_global_string(texVarName), prosper::DescriptorType::CombinedImageSampler, prosper::ShaderStageFlags::FragmentBit}); + if(m_imageTextureNodes.size() == m_imageTextureNodes.capacity()) + m_imageTextureNodes.reserve(m_imageTextureNodes.size() * 2 + 10); + m_imageTextureNodes.push_back(graphNode.get()); + } + + m_globalInputDataDsInfo = {"SHADER_GRAPH", bindings}; + ShaderGraphModule::InitializeShaderResources(); } -InputDataModule::~InputDataModule() {} void InputDataModule::GetShaderPreprocessorDefinitions(std::unordered_map &outDefinitions, std::string &outPrefixCode) { @@ -42,6 +71,15 @@ void InputDataModule::GetShaderPreprocessorDefinitions(std::unordered_map(&graphNode->node); + auto texVarName = node->GetTextureVariableName(*graphNode); + auto texVarNameUpper = texVarName; + ustring::to_upper(texVarNameUpper); + code << "layout(LAYOUT_ID(SHADER_GRAPH, " << texVarNameUpper << ")) uniform sampler2D " << texVarName << ";\n"; + } + outPrefixCode += code.str(); } @@ -61,14 +99,27 @@ void InputDataModule::InitializeGfxPipelineDescriptorSets() // TODO: One per shader m_globalInputDsg = context.CreateDescriptorSetGroup(m_globalInputDataDsInfo); - auto &dummyTex = context.GetDummyTexture(); - auto &dummyCubemapTex = context.GetDummyCubemapTexture(); auto &ds = *m_globalInputDsg->GetDescriptorSet(0); constexpr uint32_t BINDING_IDX = 0; auto buf = inputDataManager.GetBuffer(); if(!buf) buf = c_engine->GetRenderContext().GetDummyBuffer(); ds.SetBindingUniformBuffer(*buf, BINDING_IDX); + + // Image texture nodes + auto &texManager = static_cast(client->GetMaterialManager()).GetTextureManager(); + uint32_t bindingIdx = 1; // Binding 0 is global input data + for(auto *node : m_imageTextureNodes) { + std::string fileName; + node->GetInputValue(pragma::rendering::shader_graph::ImageTextureNode::IN_FILENAME, fileName); + auto tex = texManager.LoadAsset(fileName); + std::shared_ptr prosperTex; + if(tex) + prosperTex = tex->GetVkTexture(); + if(!prosperTex) + prosperTex = context.GetDummyTexture(); + ds.SetBindingTexture(*prosperTex, bindingIdx++); + } } void InputDataModule::RecordBindScene(rendering::ShaderProcessor &shaderProcessor, const pragma::CSceneComponent &scene, const pragma::CRasterizationRendererComponent &renderer, ShaderGameWorld::SceneFlags &inOutSceneFlags) const { diff --git a/core/client/src/rendering/shader_graph/modules/pbr.cpp b/core/client/src/rendering/shader_graph/modules/pbr.cpp index 07e5db830..af58f55bb 100644 --- a/core/client/src/rendering/shader_graph/modules/pbr.cpp +++ b/core/client/src/rendering/shader_graph/modules/pbr.cpp @@ -6,6 +6,7 @@ */ #include "stdafx_client.h" +#include "pragma/rendering/shaders/world/c_shader_graph.hpp" #include "pragma/rendering/shader_graph/modules/pbr.hpp" #include "pragma/rendering/render_processor.hpp" #include "pragma/entities/environment/c_env_reflection_probe.hpp" @@ -15,9 +16,10 @@ using namespace pragma::rendering::shader_graph; extern DLLCLIENT CEngine *c_engine; +#pragma optimize("", off) std::shared_ptr PbrModule::g_defaultPbrDsg = {}; size_t PbrModule::g_instanceCount = 0; -PbrModule::PbrModule(prosper::Shader &shader) : pragma::rendering::ShaderGraphModule {shader} +PbrModule::PbrModule(ShaderGraph &shader) : pragma::rendering::ShaderGraphModule {shader} { m_pbrDescSetInfo = { "PBR", diff --git a/core/client/src/rendering/shader_graph/nodes/image_texture.cpp b/core/client/src/rendering/shader_graph/nodes/image_texture.cpp index 0b3a66308..1a3ade6a7 100644 --- a/core/client/src/rendering/shader_graph/nodes/image_texture.cpp +++ b/core/client/src/rendering/shader_graph/nodes/image_texture.cpp @@ -21,14 +21,19 @@ ImageTextureNode::ImageTextureNode(const std::string_view &type) : Node {type} AddModuleDependency("image_texture"); } +std::string ImageTextureNode::GetTextureVariableName(const pragma::shadergraph::GraphNode &gn) const +{ + auto prefix = gn.GetBaseVarName() + "_"; + return prefix + "tex"; +} + std::string ImageTextureNode::DoEvaluateResourceDeclarations(const pragma::shadergraph::Graph &graph, const pragma::shadergraph::GraphNode &gn) const { std::ostringstream code; - auto prefix = gn.GetBaseVarName() + "_"; - std::string texName = prefix + "tex"; - auto upperTexName = texName; - ustring::to_upper(upperTexName); - code << "layout(LAYOUT_ID(TEST, " << upperTexName << ")) uniform sampler2D " << texName << ";\n"; + //auto texName = GetTextureVariableName(gn); + //auto upperTexName = texName; + //ustring::to_upper(upperTexName); + //code << "layout(LAYOUT_ID(TEST, " << upperTexName << ")) uniform sampler2D " << texName << ";\n"; return code.str(); } @@ -42,8 +47,7 @@ std::string ImageTextureNode::DoEvaluate(const pragma::shadergraph::Graph &graph uv = "vec3(get_vertex_uv(), 0.0)"; auto prefix = gn.GetBaseVarName() + "_"; - std::string texName = prefix + "tex"; - code << "vec4 " << prefix << "texCol = texture(" << texName << ", " << uv << ".xy);\n"; + code << "vec4 " << prefix << "texCol = texture(" << GetTextureVariableName(gn) << ", " << uv << ".xy);\n"; code << gn.GetGlslOutputDeclaration(OUT_COLOR) << " = "; code << prefix << "texCol.rgb;\n"; diff --git a/core/client/src/rendering/shader_graph/nodes/scene_output.cpp b/core/client/src/rendering/shader_graph/nodes/scene_output.cpp index 0714b619b..6c36059c6 100644 --- a/core/client/src/rendering/shader_graph/nodes/scene_output.cpp +++ b/core/client/src/rendering/shader_graph/nodes/scene_output.cpp @@ -15,13 +15,22 @@ SceneOutputNode::SceneOutputNode(const std::string_view &type) : Node {type} AddInput(IN_COLOR, pragma::shadergraph::DataType::Color, Vector3 {1.f, 1.f, 1.f}); AddInput(IN_ALPHA, pragma::shadergraph::DataType::Float, 1.f); AddInput(IN_BLOOM_COLOR, pragma::shadergraph::DataType::Color, Vector3 {0.f, 0.f, 0.f}); + + AddSocketEnum(CONST_ALPHA_MODE, AlphaMode::Opaque); } -std::string SceneOutputNode::DoEvaluate(const pragma::shadergraph::Graph &graph, const pragma::shadergraph::GraphNode &instance) const +std::string SceneOutputNode::DoEvaluate(const pragma::shadergraph::Graph &graph, const pragma::shadergraph::GraphNode &gn) const { std::ostringstream code; - code << "fs_color = vec4(" << GetInputNameOrValue(instance, IN_COLOR) << ", " << GetInputNameOrValue(instance, IN_ALPHA) << ");\n"; - code << "fs_brightColor = vec4(" << GetInputNameOrValue(instance, IN_BLOOM_COLOR) << ", 1.0);\n"; + code << "fs_color = vec4(" << GetInputNameOrValue(gn, IN_COLOR) << ", " << GetInputNameOrValue(gn, IN_ALPHA) << ");\n"; + code << "fs_brightColor = vec4(" << GetInputNameOrValue(gn, IN_BLOOM_COLOR) << ", 1.0);\n"; + + auto alphaMode = *gn.GetConstantInputValue(CONST_ALPHA_MODE); + if(alphaMode == AlphaMode::Mask) { + // TODO: Use alpha cutoff value + code << "if(fs_color.a < 0.5)\n"; + code << "\tdiscard;\n"; + } + return code.str(); - // } diff --git a/core/client/src/rendering/shaders/world/c_shader_graph.cpp b/core/client/src/rendering/shaders/world/c_shader_graph.cpp index fee05869a..cf7d4f8c0 100644 --- a/core/client/src/rendering/shaders/world/c_shader_graph.cpp +++ b/core/client/src/rendering/shaders/world/c_shader_graph.cpp @@ -17,6 +17,7 @@ #include "pragma/rendering/shader_graph/module.hpp" #include "pragma/rendering/shader_graph/nodes/shader_material.hpp" #include "pragma/rendering/shader_graph/nodes/input_parameter.hpp" +#include "pragma/rendering/shader_graph/nodes/scene_output.hpp" #include "pragma/model/vk_mesh.h" #include "pragma/model/c_modelmesh.h" #include @@ -115,6 +116,9 @@ void ShaderGraph::InitializeShaderResources() } } + for(auto &mod : m_modules) + mod->InitializeShaderResources(); + ShaderGameWorldLightingPass::InitializeShaderResources(); } @@ -138,7 +142,32 @@ void ShaderGraph::InitializeMaterialData(const CMaterial &mat, const rendering:: std::shared_ptr ShaderGraph::InitializeMaterialDescriptorSet(CMaterial &mat, const prosper::DescriptorSetInfo &descSetInfo) { return ShaderGameWorldLightingPass::InitializeMaterialDescriptorSet(mat, descSetInfo); } void ShaderGraph::OnPipelinesInitialized() { ShaderGameWorldLightingPass::OnPipelinesInitialized(); } -void ShaderGraph::InitializeGfxPipeline(prosper::GraphicsPipelineCreateInfo &pipelineInfo, uint32_t pipelineIdx) { ShaderGameWorldLightingPass::InitializeGfxPipeline(pipelineInfo, pipelineIdx); } +void ShaderGraph::InitializeGfxPipeline(prosper::GraphicsPipelineCreateInfo &pipelineInfo, uint32_t pipelineIdx) +{ + ShaderGameWorldLightingPass::InitializeGfxPipeline(pipelineInfo, pipelineIdx); + + auto *graph = GetGraph(); + if(graph) { + for(auto &node : graph->GetNodes()) { + auto *outputNode = dynamic_cast(&node->node); + if(!outputNode) + continue; + AlphaMode alphaMode; + if(node->GetInputValue(pragma::rendering::shader_graph::SceneOutputNode::CONST_ALPHA_MODE, alphaMode)) { + switch(alphaMode) { + case AlphaMode::Blend: + SetGenericAlphaColorBlendAttachmentProperties(pipelineInfo); + break; + case AlphaMode::Mask: + SetGenericAlphaColorBlendAttachmentProperties(pipelineInfo); + pipelineInfo.ToggleDepthWrites(true); + break; + } + } + break; + } + } +} void ShaderGraph::RecordBindScene(rendering::ShaderProcessor &shaderProcessor, const pragma::CSceneComponent &scene, const pragma::CRasterizationRendererComponent &renderer, prosper::IDescriptorSet &dsScene, prosper::IDescriptorSet &dsRenderer, prosper::IDescriptorSet &dsRenderSettings, prosper::IDescriptorSet &dsShadows, const Vector4 &drawOrigin, ShaderGameWorld::SceneFlags &inOutSceneFlags) const