Now rendering black frames rather than empty frames when scene isn't loaded, preventing some Vulkan validation errors.
Added keepColor, clearColor, and finalLayout attributes to KRRenderPass::RenderPassInfo. Now able to render debug text on macOS.
This commit is contained in:
@@ -404,10 +404,23 @@ void KRCamera::renderFrame(VkCommandBuffer& commandBuffer, KRSurface& compositeS
|
|||||||
|
|
||||||
// fprintf(stderr, "VBO Mem: %i Kbyte Texture Mem: %i/%i Kbyte (active/total) Shader Handles: %i Visible Bounds: %i Max Texture LOD: %i\n", (int)m_pContext->getMeshManager()->getMemUsed() / 1024, (int)m_pContext->getTextureManager()->getActiveMemUsed() / 1024, (int)m_pContext->getTextureManager()->getMemUsed() / 1024, (int)m_pContext->getPipelineManager()->getShaderHandlesUsed(), (int)m_visibleBounds.size(), m_pContext->getTextureManager()->getLODDimCap());
|
// fprintf(stderr, "VBO Mem: %i Kbyte Texture Mem: %i/%i Kbyte (active/total) Shader Handles: %i Visible Bounds: %i Max Texture LOD: %i\n", (int)m_pContext->getMeshManager()->getMemUsed() / 1024, (int)m_pContext->getTextureManager()->getActiveMemUsed() / 1024, (int)m_pContext->getTextureManager()->getMemUsed() / 1024, (int)m_pContext->getPipelineManager()->getShaderHandlesUsed(), (int)m_visibleBounds.size(), m_pContext->getTextureManager()->getLODDimCap());
|
||||||
|
|
||||||
|
GL_PUSH_GROUP_MARKER("Debug Overlays");
|
||||||
|
|
||||||
|
renderDebug(commandBuffer, compositeSurface);
|
||||||
|
|
||||||
|
|
||||||
|
GL_POP_GROUP_MARKER;
|
||||||
|
|
||||||
GL_PUSH_GROUP_MARKER("Post Processing");
|
GL_PUSH_GROUP_MARKER("Post Processing");
|
||||||
|
|
||||||
|
KRRenderPass& postCompositePass = compositeSurface.getPostCompositePass();
|
||||||
|
postCompositePass.begin(commandBuffer, compositeSurface, Vector4::Create(0.0f, 0.0f, 0.0f, 1.0f));
|
||||||
|
|
||||||
renderPost(commandBuffer, compositeSurface);
|
renderPost(commandBuffer, compositeSurface);
|
||||||
|
|
||||||
|
postCompositePass.end(commandBuffer);
|
||||||
|
|
||||||
|
|
||||||
GL_POP_GROUP_MARKER;
|
GL_POP_GROUP_MARKER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -573,62 +586,67 @@ void KRCamera::destroyBuffers()
|
|||||||
void KRCamera::renderPost(VkCommandBuffer& commandBuffer, KRSurface& surface)
|
void KRCamera::renderPost(VkCommandBuffer& commandBuffer, KRSurface& surface)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
// TODO - Re-enable once post fx shader is converted for Vulkan
|
// TODO - Re-enable once post fx shader is converted for Vulkan
|
||||||
KRMeshManager::KRVBOData& vertices = getContext().getMeshManager()->KRENGINE_VBO_DATA_2D_SQUARE_VERTICES;
|
KRMeshManager::KRVBOData& vertices = getContext().getMeshManager()->KRENGINE_VBO_DATA_2D_SQUARE_VERTICES;
|
||||||
|
|
||||||
|
PipelineInfo info{};
|
||||||
|
std::string shader_name("PostShader");
|
||||||
|
info.shader_name = &shader_name;
|
||||||
|
info.pCamera = this;
|
||||||
|
info.renderPass = KRNode::RENDER_PASS_FORWARD_TRANSPARENT;
|
||||||
|
info.rasterMode = RasterMode::kOpaqueNoTest;
|
||||||
|
info.modelFormat = ModelFormat::KRENGINE_MODEL_FORMAT_STRIP;
|
||||||
|
info.vertexAttributes = vertices.getVertexAttributes();
|
||||||
|
|
||||||
|
KRPipeline *postShader = m_pContext->getPipelineManager()->getPipeline(surface, info);
|
||||||
|
|
||||||
|
postShader->setPushConstant(KRPipeline::PushConstant::fade_color, m_fade_color);
|
||||||
|
postShader->bind(commandBuffer, *this, m_viewport, Matrix4(), nullptr, nullptr, nullptr, KRNode::RENDER_PASS_FORWARD_TRANSPARENT);
|
||||||
|
|
||||||
|
m_pContext->getTextureManager()->selectTexture(GL_TEXTURE_2D, 0, compositeDepthTexture);
|
||||||
|
m_pContext->getTextureManager()->selectTexture(GL_TEXTURE_2D, 1, compositeColorTexture);
|
||||||
|
|
||||||
|
if(settings.volumetric_environment_enable) {
|
||||||
|
m_pContext->getTextureManager()->selectTexture(GL_TEXTURE_2D, 2, volumetricLightAccumulationTexture);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update attribute values.
|
||||||
|
m_pContext->getMeshManager()->bindVBO(commandBuffer, &vertices, 1.0f);
|
||||||
|
|
||||||
|
vkCmdDraw(commandBuffer, 4, 1, 0, 0);
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
// if(bShowShadowBuffer) {
|
||||||
|
// KRPipeline *blitShader = m_pContext->getPipelineManager()->getShader("simple_blit", this, false, false, false, 0, false, false, false, false, false, false, false, false, false, false, false, false, false, KRNode::RENDER_PASS_FORWARD_TRANSPARENT);
|
||||||
|
//
|
||||||
|
// for(int iShadow=0; iShadow < m_cShadowBuffers; iShadow++) {
|
||||||
|
// Matrix4 viewMatrix = Matrix4();
|
||||||
|
// viewMatrix.scale(0.20, 0.20, 0.20);
|
||||||
|
// viewMatrix.translate(-0.70, 0.70 - 0.45 * iShadow, 0.0);
|
||||||
|
// getContext().getPipelineManager()->selectShader(blitShader, KRViewport(getViewportSize(), viewMatrix, Matrix4()), shadowViewports, Matrix4(), Vector3(), NULL, 0, KRNode::RENDER_PASS_FORWARD_TRANSPARENT);
|
||||||
|
// m_pContext->getTextureManager()->selectTexture(1, NULL);
|
||||||
|
// m_pContext->getMeshManager()->bindVBO(&getContext().getMeshManager()->KRENGINE_VBO_DATA_2D_SQUARE_VERTICES);
|
||||||
|
// m_pContext->getTextureManager()->_setActiveTexture(0);
|
||||||
|
// GLDEBUG(glBindTexture(GL_TEXTURE_2D, shadowDepthTexture[iShadow]));
|
||||||
|
//#if GL_EXT_shadow_samplers
|
||||||
|
// GLDEBUG(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_EXT, GL_NONE)); // TODO - Detect GL_EXT_shadow_samplers and only activate if available
|
||||||
|
//#endif
|
||||||
|
// GLDEBUG(glDrawArrays(GL_TRIANGLE_STRIP, 0, 4));
|
||||||
|
//#if GL_EXT_shadow_samplers
|
||||||
|
// GLDEBUG(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_EXT, GL_COMPARE_REF_TO_TEXTURE_EXT)); // TODO - Detect GL_EXT_shadow_samplers and only activate if available
|
||||||
|
//#endif
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// m_pContext->getTextureManager()->selectTexture(0, NULL);
|
||||||
|
// m_pContext->getTextureManager()->_setActiveTexture(0);
|
||||||
|
// GLDEBUG(glBindTexture(GL_TEXTURE_2D, 0));
|
||||||
|
// }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
PipelineInfo info{};
|
void KRCamera::renderDebug(VkCommandBuffer& commandBuffer, KRSurface& surface)
|
||||||
std::string shader_name("PostShader");
|
{
|
||||||
info.shader_name = &shader_name;
|
|
||||||
info.pCamera = this;
|
|
||||||
info.renderPass = KRNode::RENDER_PASS_FORWARD_TRANSPARENT;
|
|
||||||
info.rasterMode = RasterMode::kOpaqueNoTest;
|
|
||||||
info.modelFormat = ModelFormat::KRENGINE_MODEL_FORMAT_STRIP;
|
|
||||||
info.vertexAttributes = vertices.getVertexAttributes();
|
|
||||||
|
|
||||||
KRPipeline *postShader = m_pContext->getPipelineManager()->getPipeline(surface, info);
|
|
||||||
|
|
||||||
postShader->setPushConstant(KRPipeline::PushConstant::fade_color, m_fade_color);
|
|
||||||
postShader->bind(commandBuffer, *this, m_viewport, Matrix4(), nullptr, nullptr, nullptr, KRNode::RENDER_PASS_FORWARD_TRANSPARENT);
|
|
||||||
|
|
||||||
m_pContext->getTextureManager()->selectTexture(GL_TEXTURE_2D, 0, compositeDepthTexture);
|
|
||||||
m_pContext->getTextureManager()->selectTexture(GL_TEXTURE_2D, 1, compositeColorTexture);
|
|
||||||
|
|
||||||
if(settings.volumetric_environment_enable) {
|
|
||||||
m_pContext->getTextureManager()->selectTexture(GL_TEXTURE_2D, 2, volumetricLightAccumulationTexture);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update attribute values.
|
|
||||||
m_pContext->getMeshManager()->bindVBO(commandBuffer, &vertices, 1.0f);
|
|
||||||
|
|
||||||
vkCmdDraw(commandBuffer, 4, 1, 0, 0);
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
// if(bShowShadowBuffer) {
|
|
||||||
// KRPipeline *blitShader = m_pContext->getPipelineManager()->getShader("simple_blit", this, false, false, false, 0, false, false, false, false, false, false, false, false, false, false, false, false, false, KRNode::RENDER_PASS_FORWARD_TRANSPARENT);
|
|
||||||
//
|
|
||||||
// for(int iShadow=0; iShadow < m_cShadowBuffers; iShadow++) {
|
|
||||||
// Matrix4 viewMatrix = Matrix4();
|
|
||||||
// viewMatrix.scale(0.20, 0.20, 0.20);
|
|
||||||
// viewMatrix.translate(-0.70, 0.70 - 0.45 * iShadow, 0.0);
|
|
||||||
// getContext().getPipelineManager()->selectShader(blitShader, KRViewport(getViewportSize(), viewMatrix, Matrix4()), shadowViewports, Matrix4(), Vector3(), NULL, 0, KRNode::RENDER_PASS_FORWARD_TRANSPARENT);
|
|
||||||
// m_pContext->getTextureManager()->selectTexture(1, NULL);
|
|
||||||
// m_pContext->getMeshManager()->bindVBO(&getContext().getMeshManager()->KRENGINE_VBO_DATA_2D_SQUARE_VERTICES);
|
|
||||||
// m_pContext->getTextureManager()->_setActiveTexture(0);
|
|
||||||
// GLDEBUG(glBindTexture(GL_TEXTURE_2D, shadowDepthTexture[iShadow]));
|
|
||||||
//#if GL_EXT_shadow_samplers
|
|
||||||
// GLDEBUG(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_EXT, GL_NONE)); // TODO - Detect GL_EXT_shadow_samplers and only activate if available
|
|
||||||
//#endif
|
|
||||||
// GLDEBUG(glDrawArrays(GL_TRIANGLE_STRIP, 0, 4));
|
|
||||||
//#if GL_EXT_shadow_samplers
|
|
||||||
// GLDEBUG(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_EXT, GL_COMPARE_REF_TO_TEXTURE_EXT)); // TODO - Detect GL_EXT_shadow_samplers and only activate if available
|
|
||||||
//#endif
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// m_pContext->getTextureManager()->selectTexture(0, NULL);
|
|
||||||
// m_pContext->getTextureManager()->_setActiveTexture(0);
|
|
||||||
// GLDEBUG(glBindTexture(GL_TEXTURE_2D, 0));
|
|
||||||
// }
|
|
||||||
const char* szText = settings.m_debug_text.c_str();
|
const char* szText = settings.m_debug_text.c_str();
|
||||||
|
|
||||||
std::string debug_text;
|
std::string debug_text;
|
||||||
@@ -755,6 +773,11 @@ void KRCamera::renderPost(VkCommandBuffer& commandBuffer, KRSurface& surface)
|
|||||||
iCol++;
|
iCol++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_debug_text_vbo_data.load(commandBuffer);
|
||||||
|
|
||||||
|
KRRenderPass& debugPass = surface.getDebugPass();
|
||||||
|
debugPass.begin(commandBuffer, surface, Vector4::Create(0.0f, 0.0f, 0.0f, 1.0f));
|
||||||
|
|
||||||
KRTexture* fontTexture = m_pContext->getTextureManager()->getTexture("font");
|
KRTexture* fontTexture = m_pContext->getTextureManager()->getTexture("font");
|
||||||
fontTexture->resetPoolExpiry(0.0f, KRTexture::TEXTURE_USAGE_UI);
|
fontTexture->resetPoolExpiry(0.0f, KRTexture::TEXTURE_USAGE_UI);
|
||||||
@@ -772,10 +795,11 @@ void KRCamera::renderPost(VkCommandBuffer& commandBuffer, KRSurface& surface)
|
|||||||
fontShader->setImageBinding("fontTexture", fontTexture, getContext().getSamplerManager()->DEFAULT_CLAMPED_SAMPLER);
|
fontShader->setImageBinding("fontTexture", fontTexture, getContext().getSamplerManager()->DEFAULT_CLAMPED_SAMPLER);
|
||||||
fontShader->bind(commandBuffer, *this, m_viewport, Matrix4(), nullptr, nullptr, nullptr, KRNode::RENDER_PASS_FORWARD_TRANSPARENT);
|
fontShader->bind(commandBuffer, *this, m_viewport, Matrix4(), nullptr, nullptr, nullptr, KRNode::RENDER_PASS_FORWARD_TRANSPARENT);
|
||||||
|
|
||||||
m_debug_text_vbo_data.load(commandBuffer);
|
|
||||||
m_debug_text_vbo_data.bind(commandBuffer);
|
m_debug_text_vbo_data.bind(commandBuffer);
|
||||||
|
|
||||||
vkCmdDraw(commandBuffer, vertex_count, 1, 0, 0);
|
vkCmdDraw(commandBuffer, vertex_count, 1, 0, 0);
|
||||||
|
|
||||||
|
debugPass.end(commandBuffer);
|
||||||
|
|
||||||
m_debug_text_vertices.unlock();
|
m_debug_text_vertices.unlock();
|
||||||
|
|
||||||
|
|||||||
@@ -90,6 +90,7 @@ private:
|
|||||||
int volumetricLightAccumulationBuffer, volumetricLightAccumulationTexture;
|
int volumetricLightAccumulationBuffer, volumetricLightAccumulationTexture;
|
||||||
|
|
||||||
void renderPost(VkCommandBuffer& commandBuffer, KRSurface& surface);
|
void renderPost(VkCommandBuffer& commandBuffer, KRSurface& surface);
|
||||||
|
void renderDebug(VkCommandBuffer& commandBuffer, KRSurface& surface);
|
||||||
|
|
||||||
void destroyBuffers();
|
void destroyBuffers();
|
||||||
|
|
||||||
|
|||||||
@@ -162,6 +162,8 @@ void KRPresentationThread::renderFrame()
|
|||||||
float deltaTime = 0.005; // TODO - Replace dummy value
|
float deltaTime = 0.005; // TODO - Replace dummy value
|
||||||
if (scene) {
|
if (scene) {
|
||||||
scene->renderFrame(commandBuffer, surface, deltaTime);
|
scene->renderFrame(commandBuffer, surface, deltaTime);
|
||||||
|
} else {
|
||||||
|
surface.renderBlackFrame(commandBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vkEndCommandBuffer(commandBuffer) != VK_SUCCESS) {
|
if (vkEndCommandBuffer(commandBuffer) != VK_SUCCESS) {
|
||||||
|
|||||||
@@ -56,12 +56,16 @@ void KRRenderPass::create(KRDevice& device, VkFormat swapChainImageFormat, VkFor
|
|||||||
VkAttachmentDescription colorAttachment{};
|
VkAttachmentDescription colorAttachment{};
|
||||||
colorAttachment.format = swapChainImageFormat;
|
colorAttachment.format = swapChainImageFormat;
|
||||||
colorAttachment.samples = VK_SAMPLE_COUNT_1_BIT;
|
colorAttachment.samples = VK_SAMPLE_COUNT_1_BIT;
|
||||||
colorAttachment.loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR;
|
colorAttachment.loadOp = info.clearColor ? VK_ATTACHMENT_LOAD_OP_CLEAR : VK_ATTACHMENT_LOAD_OP_LOAD;
|
||||||
colorAttachment.storeOp = VK_ATTACHMENT_STORE_OP_STORE;
|
colorAttachment.storeOp = info.keepColor ? VK_ATTACHMENT_STORE_OP_STORE : VK_ATTACHMENT_STORE_OP_DONT_CARE;
|
||||||
colorAttachment.stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
|
colorAttachment.stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
|
||||||
colorAttachment.stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE;
|
colorAttachment.stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE;
|
||||||
colorAttachment.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED;
|
colorAttachment.initialLayout = info.clearColor ? VK_IMAGE_LAYOUT_UNDEFINED : VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
||||||
colorAttachment.finalLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR;
|
if (info.finalPass) {
|
||||||
|
colorAttachment.finalLayout = info.keepColor ? VK_IMAGE_LAYOUT_PRESENT_SRC_KHR : VK_IMAGE_LAYOUT_UNDEFINED;
|
||||||
|
} else {
|
||||||
|
colorAttachment.finalLayout = info.keepColor ? VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL : VK_IMAGE_LAYOUT_UNDEFINED;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
VkAttachmentDescription depthAttachment{};
|
VkAttachmentDescription depthAttachment{};
|
||||||
|
|||||||
@@ -44,8 +44,11 @@ public:
|
|||||||
|
|
||||||
struct RenderPassInfo
|
struct RenderPassInfo
|
||||||
{
|
{
|
||||||
|
bool clearColor;
|
||||||
|
bool keepColor;
|
||||||
bool clearDepth;
|
bool clearDepth;
|
||||||
bool keepDepth;
|
bool keepDepth;
|
||||||
|
bool finalPass;
|
||||||
};
|
};
|
||||||
|
|
||||||
void create(KRDevice& device, VkFormat swapChainImageFormat, VkFormat depthImageFormat, const RenderPassInfo& info);
|
void create(KRDevice& device, VkFormat swapChainImageFormat, VkFormat depthImageFormat, const RenderPassInfo& info);
|
||||||
|
|||||||
@@ -49,6 +49,9 @@ KRSurface::KRSurface(KRContext& context, KrSurfaceHandle handle, void* platformH
|
|||||||
m_forwardOpaquePass = std::make_unique<KRRenderPass>(context);
|
m_forwardOpaquePass = std::make_unique<KRRenderPass>(context);
|
||||||
m_deferredGBufferPass = std::make_unique<KRRenderPass>(context);
|
m_deferredGBufferPass = std::make_unique<KRRenderPass>(context);
|
||||||
m_deferredOpaquePass = std::make_unique<KRRenderPass>(context);
|
m_deferredOpaquePass = std::make_unique<KRRenderPass>(context);
|
||||||
|
m_postCompositePass = std::make_unique<KRRenderPass>(context);
|
||||||
|
m_debugPass = std::make_unique<KRRenderPass>(context);
|
||||||
|
m_blackFramePass = std::make_unique<KRRenderPass>(context);
|
||||||
m_swapChain = std::make_unique<KRSwapchain>(context);
|
m_swapChain = std::make_unique<KRSwapchain>(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,6 +127,18 @@ void KRSurface::destroy()
|
|||||||
if (m_deferredOpaquePass) {
|
if (m_deferredOpaquePass) {
|
||||||
m_deferredOpaquePass->destroy(*device);
|
m_deferredOpaquePass->destroy(*device);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_postCompositePass) {
|
||||||
|
m_postCompositePass->destroy(*device);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_debugPass) {
|
||||||
|
m_debugPass->destroy(*device);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_blackFramePass) {
|
||||||
|
m_blackFramePass->destroy(*device);
|
||||||
|
}
|
||||||
|
|
||||||
for (int i=0; i < KRENGINE_MAX_FRAMES_IN_FLIGHT; i++) {
|
for (int i=0; i < KRENGINE_MAX_FRAMES_IN_FLIGHT; i++) {
|
||||||
if (device && m_renderFinishedSemaphores[i] != VK_NULL_HANDLE) {
|
if (device && m_renderFinishedSemaphores[i] != VK_NULL_HANDLE) {
|
||||||
@@ -184,17 +199,47 @@ KrResult KRSurface::createSwapChain()
|
|||||||
|
|
||||||
|
|
||||||
KRRenderPass::RenderPassInfo info{};
|
KRRenderPass::RenderPassInfo info{};
|
||||||
|
info.clearColor = true;
|
||||||
|
info.keepColor = true;
|
||||||
info.clearDepth = true;
|
info.clearDepth = true;
|
||||||
info.keepDepth = false;
|
info.keepDepth = false;
|
||||||
|
info.finalPass = false;
|
||||||
m_forwardOpaquePass->create(*device, selectedSurfaceFormat.format, depthImageFormat, info);
|
m_forwardOpaquePass->create(*device, selectedSurfaceFormat.format, depthImageFormat, info);
|
||||||
|
|
||||||
|
info.clearColor = true;
|
||||||
|
info.keepColor = true;
|
||||||
info.clearDepth = true;
|
info.clearDepth = true;
|
||||||
info.keepDepth = true;
|
info.keepDepth = true;
|
||||||
|
info.finalPass = false;
|
||||||
m_deferredGBufferPass->create(*device, selectedSurfaceFormat.format, depthImageFormat, info);
|
m_deferredGBufferPass->create(*device, selectedSurfaceFormat.format, depthImageFormat, info);
|
||||||
|
|
||||||
|
info.clearColor = false;
|
||||||
|
info.keepColor = true;
|
||||||
|
info.clearDepth = false;
|
||||||
|
info.keepDepth = true;
|
||||||
|
info.finalPass = false;
|
||||||
|
m_deferredOpaquePass->create(*device, selectedSurfaceFormat.format, depthImageFormat, info);
|
||||||
|
|
||||||
|
info.clearColor = false;
|
||||||
|
info.keepColor = true;
|
||||||
|
info.clearDepth = false;
|
||||||
|
info.keepDepth = true;
|
||||||
|
info.finalPass = false;
|
||||||
|
m_debugPass->create(*device, selectedSurfaceFormat.format, depthImageFormat, info);
|
||||||
|
|
||||||
|
info.clearColor = false;
|
||||||
|
info.keepColor = true;
|
||||||
info.clearDepth = false;
|
info.clearDepth = false;
|
||||||
info.keepDepth = false;
|
info.keepDepth = false;
|
||||||
m_deferredOpaquePass->create(*device, selectedSurfaceFormat.format, depthImageFormat, info);
|
info.finalPass = true;
|
||||||
|
m_postCompositePass->create(*device, selectedSurfaceFormat.format, depthImageFormat, info);
|
||||||
|
|
||||||
|
info.clearColor = true;
|
||||||
|
info.keepColor = true;
|
||||||
|
info.clearDepth = false;
|
||||||
|
info.keepDepth = false;
|
||||||
|
info.finalPass = true;
|
||||||
|
m_blackFramePass->create(*device, selectedSurfaceFormat.format, depthImageFormat, info);
|
||||||
|
|
||||||
m_swapChain->create(*device, m_surface, selectedSurfaceFormat, depthImageFormat, swapExtent, imageCount, *m_forwardOpaquePass);
|
m_swapChain->create(*device, m_surface, selectedSurfaceFormat, depthImageFormat, swapExtent, imageCount, *m_forwardOpaquePass);
|
||||||
|
|
||||||
@@ -264,7 +309,29 @@ KRRenderPass& KRSurface::getDeferredOpaquePass()
|
|||||||
return *m_deferredOpaquePass;
|
return *m_deferredOpaquePass;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
KRRenderPass& KRSurface::getPostCompositePass()
|
||||||
|
{
|
||||||
|
return *m_postCompositePass;
|
||||||
|
}
|
||||||
|
|
||||||
|
KRRenderPass& KRSurface::getDebugPass()
|
||||||
|
{
|
||||||
|
return *m_debugPass;
|
||||||
|
}
|
||||||
|
|
||||||
|
KRRenderPass& KRSurface::getBlackFramePass()
|
||||||
|
{
|
||||||
|
return *m_blackFramePass;
|
||||||
|
}
|
||||||
|
|
||||||
void KRSurface::endFrame()
|
void KRSurface::endFrame()
|
||||||
{
|
{
|
||||||
m_frameIndex++;;
|
m_frameIndex++;;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void KRSurface::renderBlackFrame(VkCommandBuffer &commandBuffer)
|
||||||
|
{
|
||||||
|
m_blackFramePass->begin(commandBuffer, *this, Vector4::Create(0.0f, 0.0f, 0.0f, 1.0f));
|
||||||
|
m_blackFramePass->end(commandBuffer);
|
||||||
|
}
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ public:
|
|||||||
uint32_t getHeight() const;
|
uint32_t getHeight() const;
|
||||||
hydra::Vector2i getDimensions() const;
|
hydra::Vector2i getDimensions() const;
|
||||||
VkFormat getDepthFormat() const;
|
VkFormat getDepthFormat() const;
|
||||||
|
void renderBlackFrame(VkCommandBuffer &commandBuffer);
|
||||||
|
|
||||||
KRSurface(const KRSurface&) = delete;
|
KRSurface(const KRSurface&) = delete;
|
||||||
KRSurface& operator=(const KRSurface&) = delete;
|
KRSurface& operator=(const KRSurface&) = delete;
|
||||||
@@ -59,6 +60,9 @@ public:
|
|||||||
|
|
||||||
KRRenderPass& getDeferredGBufferPass();
|
KRRenderPass& getDeferredGBufferPass();
|
||||||
KRRenderPass& getDeferredOpaquePass();
|
KRRenderPass& getDeferredOpaquePass();
|
||||||
|
KRRenderPass& getPostCompositePass();
|
||||||
|
KRRenderPass& getDebugPass();
|
||||||
|
KRRenderPass& getBlackFramePass();
|
||||||
|
|
||||||
void endFrame();
|
void endFrame();
|
||||||
KrSurfaceHandle m_handle;
|
KrSurfaceHandle m_handle;
|
||||||
@@ -75,6 +79,10 @@ public:
|
|||||||
std::unique_ptr<KRRenderPass> m_forwardOpaquePass;
|
std::unique_ptr<KRRenderPass> m_forwardOpaquePass;
|
||||||
std::unique_ptr<KRRenderPass> m_deferredGBufferPass;
|
std::unique_ptr<KRRenderPass> m_deferredGBufferPass;
|
||||||
std::unique_ptr<KRRenderPass> m_deferredOpaquePass;
|
std::unique_ptr<KRRenderPass> m_deferredOpaquePass;
|
||||||
|
std::unique_ptr<KRRenderPass> m_postCompositePass;
|
||||||
|
std::unique_ptr<KRRenderPass> m_debugPass;
|
||||||
|
std::unique_ptr<KRRenderPass> m_blackFramePass;
|
||||||
|
|
||||||
|
|
||||||
// TODO - This needs to be advanced per swap chain
|
// TODO - This needs to be advanced per swap chain
|
||||||
uint64_t m_frameIndex;
|
uint64_t m_frameIndex;
|
||||||
|
|||||||
Reference in New Issue
Block a user