Skip to content

Commit

Permalink
CXX: Fix duplicate createImmediateRenderTargets.
Browse files Browse the repository at this point in the history
  • Loading branch information
jamievlin committed May 1, 2024
1 parent 80454fd commit 6161b67
Showing 1 changed file with 0 additions and 70 deletions.
70 changes: 0 additions & 70 deletions src/vkrender.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2633,76 +2633,6 @@ void AsyVkRender::createMaterialAndLightBuffers() {
VARIABLE_NAME(lightBf));
}

void AsyVkRender::createImmediateRenderTargets()
{
immRenderTargetViews.clear();
immediateRenderTargetImgs.clear();
prePresentationImages.clear();
prePresentationImgViews.clear();
immRenderTargetSampler.clear();

auto const framebufferSize= backbufferImages.size();

immRenderTargetViews.reserve(framebufferSize);
immediateRenderTargetImgs.reserve(framebufferSize);
prePresentationImages.reserve(framebufferSize);
prePresentationImgViews.reserve(framebufferSize);
immRenderTargetSampler.reserve(framebufferSize);

for (size_t i= 0; i < framebufferSize; ++i)
{
// for immediate render target (after pixel shader)
auto const& immRenderTarget= immediateRenderTargetImgs.emplace_back(createImage(
backbufferExtent.width,
backbufferExtent.height,
vk::SampleCountFlagBits::e1,
backbufferImageFormat,
vk::ImageUsageFlagBits::eColorAttachment
| vk::ImageUsageFlagBits::eSampled
| vk::ImageUsageFlagBits::eStorage,
VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT
));


auto& immRenderImgView= immRenderTargetViews.emplace_back();
createImageView(
backbufferImageFormat,
vk::ImageAspectFlagBits::eColor,
immRenderTarget.getImage(),
immRenderImgView
);

// for sampling imm render target
immRenderTargetSampler.emplace_back(device->createSamplerUnique(vk::SamplerCreateInfo(
{},
vk::Filter::eLinear, vk::Filter::eLinear, vk::SamplerMipmapMode::eNearest,
vk::SamplerAddressMode::eClampToEdge, vk::SamplerAddressMode::eClampToEdge,
vk::SamplerAddressMode::eClampToEdge,
0.f, false, 0.0, false, vk::CompareOp::eNever, 0.0, 0.0, vk::BorderColor::eFloatTransparentBlack,
true
)));

// for pre-presentation (after post-processing)
auto const& prePresentationTarget= prePresentationImages.emplace_back(createImage(
backbufferExtent.width,
backbufferExtent.height,
vk::SampleCountFlagBits::e1,
backbufferImageFormat,
vk::ImageUsageFlagBits::eTransferSrc | vk::ImageUsageFlagBits::eStorage,
VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT
));

auto& prePresentationImageView= prePresentationImgViews.emplace_back();
createImageView(
backbufferImageFormat,
vk::ImageAspectFlagBits::eColor,
prePresentationTarget.getImage(),
prePresentationImageView
);

}
}

void AsyVkRender::createImmediateRenderTargets()
{
immRenderTargetViews.clear();
Expand Down

0 comments on commit 6161b67

Please sign in to comment.