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("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);
|
||||
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
|
||||
auto writeSubpass = node->AddSubpass("G-Buffer Write");
|
||||
writeSubpass->AddColorOutput("Position");
|
||||
writeSubpass->AddColorOutput("Normals");
|
||||
writeSubpass->AddColorOutput("Present");
|
||||
|
||||
// Second subpass to read from G-Buffer
|
||||
auto compositeSubpass = node->AddSubpass("G-Buffer Composite");
|
||||
|
|
|
@ -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 the pred's storeOp to eStore and "this" loadOp to eLoad.
|
||||
newDesc.loadOp = vk::AttachmentLoadOp::eClear;
|
||||
newDesc.storeOp = vk::AttachmentStoreOp::eDontCare;
|
||||
newDesc.storeOp = vk::AttachmentStoreOp::eStore;
|
||||
|
||||
newDesc.stencilLoadOp = vk::AttachmentLoadOp::eClear;
|
||||
newDesc.stencilStoreOp = vk::AttachmentStoreOp::eDontCare;
|
||||
newDesc.stencilStoreOp = vk::AttachmentStoreOp::eStore;
|
||||
|
||||
newDesc.format = attResources[i]->resourceFormat;
|
||||
|
||||
|
@ -1030,6 +1030,8 @@ namespace SHADE
|
|||
auto& cmdBuffer = commandBuffers[frameIndex];
|
||||
cmdBuffer->BeginRecording();
|
||||
|
||||
cmdBuffer->SetviewportScissor(1920.0f, 1080.0f, 1920, 1080);
|
||||
|
||||
for (auto& node : nodes)
|
||||
{
|
||||
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
|
||||
: logicalDeviceHdl {inLogicalDeviceHdl}
|
||||
, numAttDescs {static_cast<uint32_t>(vkDescriptions.size())}
|
||||
, clearColors{}
|
||||
{
|
||||
// TODO: temporary only
|
||||
clearColors[0].color = { {{0.0f, 0.0f, 0.0f, 1.0f}} };
|
||||
clearColors[1].depthStencil = vk::ClearDepthStencilValue(1.0f, 0);
|
||||
for (uint32_t i = 0; i < vkDescriptions.size(); ++i)
|
||||
{
|
||||
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{};
|
||||
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
|
||||
: logicalDeviceHdl{ inLogicalDeviceHdl }
|
||||
, numAttDescs{ static_cast<uint32_t>(vkDescriptions.size()) }
|
||||
, clearColors{}
|
||||
{
|
||||
// TODO: temporary only
|
||||
clearColors[0].color = { {{0.0f, 0.0f, 0.0f, 1.0f}} };
|
||||
clearColors[1].depthStencil = vk::ClearDepthStencilValue(1.0f, 0);
|
||||
for (uint32_t i = 0; i < vkDescriptions.size(); ++i)
|
||||
{
|
||||
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());
|
||||
for (uint32_t i = 0; i < subpassDescriptions.size(); ++i)
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace SHADE
|
|||
/*-----------------------------------------------------------------------*/
|
||||
/* STATIC CONSTEXPR VALUES */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
static constexpr uint32_t NUM_CLEAR_COLORS = 2;
|
||||
static constexpr uint32_t NUM_CLEAR_COLORS = 10;
|
||||
|
||||
/*-----------------------------------------------------------------------*/
|
||||
/* PRIVATE MEMBER VARIABLES */
|
||||
|
@ -34,6 +34,9 @@ namespace SHADE
|
|||
//! Clear colors for the color and depth
|
||||
std::array<vk::ClearValue, NUM_CLEAR_COLORS> clearColors;
|
||||
|
||||
// number of attachment descriptions
|
||||
uint32_t numAttDescs;
|
||||
|
||||
public:
|
||||
/*-----------------------------------------------------------------------*/
|
||||
/* CTOR AND DTOR */
|
||||
|
|
Loading…
Reference in New Issue