clear color value fix
This commit is contained in:
parent
169822c221
commit
f0b9f19f4d
|
@ -98,12 +98,12 @@ namespace SHADE
|
||||||
renderGraph.AddResource("Composite", SH_ATT_DESC_TYPE::COLOR, windowDims.first, windowDims.second, vk::Format::eR16G16B16A16Sfloat);
|
renderGraph.AddResource("Composite", SH_ATT_DESC_TYPE::COLOR, windowDims.first, windowDims.second, vk::Format::eR16G16B16A16Sfloat);
|
||||||
renderGraph.AddResource("Downscale", SH_ATT_DESC_TYPE::COLOR, windowDims.first, windowDims.second, vk::Format::eR16G16B16A16Sfloat);
|
renderGraph.AddResource("Downscale", SH_ATT_DESC_TYPE::COLOR, windowDims.first, windowDims.second, vk::Format::eR16G16B16A16Sfloat);
|
||||||
renderGraph.AddResource("Present", SH_ATT_DESC_TYPE::COLOR_PRESENT, windowDims.first, windowDims.second);
|
renderGraph.AddResource("Present", SH_ATT_DESC_TYPE::COLOR_PRESENT, windowDims.first, windowDims.second);
|
||||||
auto node = renderGraph.AddNode("G-Buffer", { "Position", "Normals", "Composite" }, {}); // no predecessors
|
auto node = renderGraph.AddNode("G-Buffer", { "Composite", "Position", "Normals", "Present" }, {}); // no predecessors
|
||||||
|
|
||||||
// First subpass to write to G-Buffer
|
// First subpass to write to G-Buffer
|
||||||
auto writeSubpass = node->AddSubpass("G-Buffer Write");
|
auto writeSubpass = node->AddSubpass("G-Buffer Write");
|
||||||
writeSubpass->AddColorOutput("Position");
|
writeSubpass->AddColorOutput("Position");
|
||||||
writeSubpass->AddColorOutput("Normals");
|
writeSubpass->AddColorOutput("Present");
|
||||||
|
|
||||||
// Second subpass to read from G-Buffer
|
// Second subpass to read from G-Buffer
|
||||||
auto compositeSubpass = node->AddSubpass("G-Buffer Composite");
|
auto compositeSubpass = node->AddSubpass("G-Buffer Composite");
|
||||||
|
@ -111,11 +111,11 @@ namespace SHADE
|
||||||
compositeSubpass->AddInput("Normals");
|
compositeSubpass->AddInput("Normals");
|
||||||
compositeSubpass->AddInput("Position");
|
compositeSubpass->AddInput("Position");
|
||||||
|
|
||||||
//auto compositeNode = renderGraph.AddNode("Bloom", { "Composite", "Downscale", "Present"}, {"G-Buffer"});
|
//auto compositeNode = renderGraph.AddNode("Bloom", { "Composite", "Downscale", "Present" }, { "G-Buffer" });
|
||||||
//auto bloomSubpass = compositeNode->AddSubpass("Downsample");
|
//auto bloomSubpass = compositeNode->AddSubpass("Downsample");
|
||||||
//bloomSubpass->AddInput("Composite");
|
//bloomSubpass->AddInput("Composite");
|
||||||
// bloomSubpass->AddColorOutput("Downscale");
|
//bloomSubpass->AddColorOutput("Downscale");
|
||||||
// bloomSubpass->AddColorOutput("Present");
|
//bloomSubpass->AddColorOutput("Present");
|
||||||
|
|
||||||
renderGraph.Generate();
|
renderGraph.Generate();
|
||||||
|
|
||||||
|
|
|
@ -459,10 +459,10 @@ namespace SHADE
|
||||||
// We set this to clear first. If later we find out that some predecessor is writing to the same attachment,
|
// We set this to clear first. If later we find out that some predecessor is writing to the same attachment,
|
||||||
// we set the pred's storeOp to eStore and "this" loadOp to eLoad.
|
// we set the pred's storeOp to eStore and "this" loadOp to eLoad.
|
||||||
newDesc.loadOp = vk::AttachmentLoadOp::eClear;
|
newDesc.loadOp = vk::AttachmentLoadOp::eClear;
|
||||||
newDesc.storeOp = vk::AttachmentStoreOp::eDontCare;
|
newDesc.storeOp = vk::AttachmentStoreOp::eStore;
|
||||||
|
|
||||||
newDesc.stencilLoadOp = vk::AttachmentLoadOp::eClear;
|
newDesc.stencilLoadOp = vk::AttachmentLoadOp::eClear;
|
||||||
newDesc.stencilStoreOp = vk::AttachmentStoreOp::eDontCare;
|
newDesc.stencilStoreOp = vk::AttachmentStoreOp::eStore;
|
||||||
|
|
||||||
newDesc.format = attResources[i]->resourceFormat;
|
newDesc.format = attResources[i]->resourceFormat;
|
||||||
|
|
||||||
|
@ -1030,6 +1030,8 @@ namespace SHADE
|
||||||
auto& cmdBuffer = commandBuffers[frameIndex];
|
auto& cmdBuffer = commandBuffers[frameIndex];
|
||||||
cmdBuffer->BeginRecording();
|
cmdBuffer->BeginRecording();
|
||||||
|
|
||||||
|
cmdBuffer->SetviewportScissor(1920.0f, 1080.0f, 1920, 1080);
|
||||||
|
|
||||||
for (auto& node : nodes)
|
for (auto& node : nodes)
|
||||||
{
|
{
|
||||||
node->Execute(commandBuffers[frameIndex], frameIndex);
|
node->Execute(commandBuffers[frameIndex], frameIndex);
|
||||||
|
|
|
@ -29,11 +29,17 @@ namespace SHADE
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
SHVkRenderpass::SHVkRenderpass(Handle<SHVkLogicalDevice> const& inLogicalDeviceHdl, std::span<vk::AttachmentDescription> const vkDescriptions, std::vector<SHVkSubpassParams> const& subpasses) noexcept
|
SHVkRenderpass::SHVkRenderpass(Handle<SHVkLogicalDevice> const& inLogicalDeviceHdl, std::span<vk::AttachmentDescription> const vkDescriptions, std::vector<SHVkSubpassParams> const& subpasses) noexcept
|
||||||
: logicalDeviceHdl {inLogicalDeviceHdl}
|
: logicalDeviceHdl {inLogicalDeviceHdl}
|
||||||
|
, numAttDescs {static_cast<uint32_t>(vkDescriptions.size())}
|
||||||
, clearColors{}
|
, clearColors{}
|
||||||
{
|
{
|
||||||
// TODO: temporary only
|
for (uint32_t i = 0; i < vkDescriptions.size(); ++i)
|
||||||
clearColors[0].color = { {{0.0f, 0.0f, 0.0f, 1.0f}} };
|
{
|
||||||
clearColors[1].depthStencil = vk::ClearDepthStencilValue(1.0f, 0);
|
if (SHVkUtil::IsDepthStencilAttachment(vkDescriptions[i].format))
|
||||||
|
clearColors[i].depthStencil = vk::ClearDepthStencilValue(1.0f, 0);
|
||||||
|
else
|
||||||
|
clearColors[i].color = { {{0.0f, 0.0f, 0.0f, 1.0f}} };
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
vk::RenderPassCreateInfo renderPassCreateInfo{};
|
vk::RenderPassCreateInfo renderPassCreateInfo{};
|
||||||
std::vector<vk::SubpassDependency> subpassDeps;
|
std::vector<vk::SubpassDependency> subpassDeps;
|
||||||
|
@ -164,11 +170,16 @@ namespace SHADE
|
||||||
|
|
||||||
SHVkRenderpass::SHVkRenderpass(Handle<SHVkLogicalDevice> const& inLogicalDeviceHdl, std::span<vk::AttachmentDescription> const vkDescriptions, std::span<vk::SubpassDescription> const spDescs, std::span<vk::SubpassDependency> const spDeps) noexcept
|
SHVkRenderpass::SHVkRenderpass(Handle<SHVkLogicalDevice> const& inLogicalDeviceHdl, std::span<vk::AttachmentDescription> const vkDescriptions, std::span<vk::SubpassDescription> const spDescs, std::span<vk::SubpassDependency> const spDeps) noexcept
|
||||||
: logicalDeviceHdl{ inLogicalDeviceHdl }
|
: logicalDeviceHdl{ inLogicalDeviceHdl }
|
||||||
|
, numAttDescs{ static_cast<uint32_t>(vkDescriptions.size()) }
|
||||||
, clearColors{}
|
, clearColors{}
|
||||||
{
|
{
|
||||||
// TODO: temporary only
|
for (uint32_t i = 0; i < vkDescriptions.size(); ++i)
|
||||||
clearColors[0].color = { {{0.0f, 0.0f, 0.0f, 1.0f}} };
|
{
|
||||||
clearColors[1].depthStencil = vk::ClearDepthStencilValue(1.0f, 0);
|
if (SHVkUtil::IsDepthStencilAttachment(vkDescriptions[i].format))
|
||||||
|
clearColors[i].depthStencil = vk::ClearDepthStencilValue(1.0f, 0);
|
||||||
|
else
|
||||||
|
clearColors[i].color = { {{0.0f, 0.0f, 0.0f, 1.0f}} };
|
||||||
|
}
|
||||||
|
|
||||||
subpassDescriptions.resize (spDescs.size());
|
subpassDescriptions.resize (spDescs.size());
|
||||||
for (uint32_t i = 0; i < subpassDescriptions.size(); ++i)
|
for (uint32_t i = 0; i < subpassDescriptions.size(); ++i)
|
||||||
|
|
|
@ -17,7 +17,7 @@ namespace SHADE
|
||||||
/*-----------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------*/
|
||||||
/* STATIC CONSTEXPR VALUES */
|
/* STATIC CONSTEXPR VALUES */
|
||||||
/*-----------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------*/
|
||||||
static constexpr uint32_t NUM_CLEAR_COLORS = 2;
|
static constexpr uint32_t NUM_CLEAR_COLORS = 10;
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------*/
|
||||||
/* PRIVATE MEMBER VARIABLES */
|
/* PRIVATE MEMBER VARIABLES */
|
||||||
|
@ -34,6 +34,9 @@ namespace SHADE
|
||||||
//! Clear colors for the color and depth
|
//! Clear colors for the color and depth
|
||||||
std::array<vk::ClearValue, NUM_CLEAR_COLORS> clearColors;
|
std::array<vk::ClearValue, NUM_CLEAR_COLORS> clearColors;
|
||||||
|
|
||||||
|
// number of attachment descriptions
|
||||||
|
uint32_t numAttDescs;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/*-----------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------*/
|
||||||
/* CTOR AND DTOR */
|
/* CTOR AND DTOR */
|
||||||
|
|
Loading…
Reference in New Issue