Implemented Shadow maps (still needs improvement) #314
|
@ -560,6 +560,7 @@ namespace SHADE
|
|||
// Prepare to write to descriptor
|
||||
shadowMapImageSamplers.emplace_back(NEW_IMAGE_VIEW, shadowMapSampler, vk::ImageLayout::eShaderReadOnlyOptimal);
|
||||
|
||||
// Update descriptor set
|
||||
static constexpr uint32_t SHADOW_MAP_DESC_SET_INDEX = 0;
|
||||
uint32_t const SHADOW_MAP_DESC_ARRAY_INDEX = shadowMapImageSamplers.size() - 1;
|
||||
shadowMapDescriptorSet->ModifyWriteDescImage
|
||||
|
@ -577,6 +578,23 @@ namespace SHADE
|
|||
SHGraphicsConstants::DescriptorSetBindings::SHADOW_MAP_IMAGE_SAMPLER_DATA
|
||||
);
|
||||
|
||||
// add to barriers
|
||||
shadowMapMemoryBarriers.push_back (vk::ImageMemoryBarrier
|
||||
{
|
||||
.oldLayout = vk::ImageLayout::eDepthAttachmentOptimal,
|
||||
.newLayout = vk::ImageLayout::eShaderReadOnlyOptimal,
|
||||
.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
|
||||
.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
|
||||
.image = newShadowMap->GetImage()->GetVkImage(),
|
||||
.subresourceRange = vk::ImageSubresourceRange
|
||||
{
|
||||
.aspectMask = vk::ImageAspectFlagBits::eDepth,
|
||||
.baseMipLevel = 0,
|
||||
.levelCount = 1,
|
||||
.baseArrayLayer = 0,
|
||||
.layerCount = 1,
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Handle<SHVkDescriptorSetGroup> SHLightingSubSystem::GetLightDataDescriptorSet(void) const noexcept
|
||||
|
|
Loading…
Reference in New Issue