mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-11 21:58:31 +09:00
[Chore] (MG_Backend/DirectVulkan): get rid of redundant guardrails (cont.)
This commit is contained in:
@@ -17,6 +17,7 @@ namespace MobileGL::MG_Backend::DirectVulkan {
|
|||||||
auto nativeWindow = reinterpret_cast<NativeWindowType>(m_windowHandle.Handle);
|
auto nativeWindow = reinterpret_cast<NativeWindowType>(m_windowHandle.Handle);
|
||||||
|
|
||||||
pVulkanRenderer = MakeUnique<MG_Backend::DirectVulkan::VulkanRenderer>(nativeWindow);
|
pVulkanRenderer = MakeUnique<MG_Backend::DirectVulkan::VulkanRenderer>(nativeWindow);
|
||||||
|
MOBILEGL_ASSERT(pVulkanRenderer != nullptr, "InitWindowSurface: VulkanRenderer creation failed");
|
||||||
pVulkanRenderer->Initialize();
|
pVulkanRenderer->Initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -147,6 +147,10 @@ namespace MobileGL::MG_Backend::DirectVulkan {
|
|||||||
MOBILEGL_ASSERT(frameCount > 0, "UniformDescriptorBinder::Initialize requires frameCount > 0");
|
MOBILEGL_ASSERT(frameCount > 0, "UniformDescriptorBinder::Initialize requires frameCount > 0");
|
||||||
MOBILEGL_ASSERT(maxBindings > 0, "UniformDescriptorBinder::Initialize requires maxBindings > 0");
|
MOBILEGL_ASSERT(maxBindings > 0, "UniformDescriptorBinder::Initialize requires maxBindings > 0");
|
||||||
MOBILEGL_ASSERT(setsPerFrame > 0, "UniformDescriptorBinder::Initialize requires setsPerFrame > 0");
|
MOBILEGL_ASSERT(setsPerFrame > 0, "UniformDescriptorBinder::Initialize requires setsPerFrame > 0");
|
||||||
|
MOBILEGL_ASSERT(textureSamplerManager != nullptr,
|
||||||
|
"UniformDescriptorBinder::Initialize requires valid texture sampler manager");
|
||||||
|
MOBILEGL_ASSERT(framebufferManager != nullptr,
|
||||||
|
"UniformDescriptorBinder::Initialize requires valid framebuffer manager");
|
||||||
|
|
||||||
m_device = device;
|
m_device = device;
|
||||||
m_allocator = allocator;
|
m_allocator = allocator;
|
||||||
@@ -443,7 +447,8 @@ namespace MobileGL::MG_Backend::DirectVulkan {
|
|||||||
const MG_State::GLState::ProgramObject& program,
|
const MG_State::GLState::ProgramObject& program,
|
||||||
const ProgramLayout& layout, Uint32 binding,
|
const ProgramLayout& layout, Uint32 binding,
|
||||||
VkDescriptorImageInfo& outImageInfo) const {
|
VkDescriptorImageInfo& outImageInfo) const {
|
||||||
if (!m_textureSamplerManager || !MG_State::pGLContext || binding >= layout.samplerUniformLocationByBinding.size()) {
|
MOBILEGL_ASSERT(m_textureSamplerManager != nullptr, "ResolveSamplerDescriptor: texture sampler manager is null");
|
||||||
|
if (!MG_State::pGLContext || binding >= layout.samplerUniformLocationByBinding.size()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -765,7 +770,9 @@ namespace MobileGL::MG_Backend::DirectVulkan {
|
|||||||
|
|
||||||
static const Uint8 kFallbackData[16] = {};
|
static const Uint8 kFallbackData[16] = {};
|
||||||
VkDescriptorImageInfo fallbackImageInfo{};
|
VkDescriptorImageInfo fallbackImageInfo{};
|
||||||
const Bool hasFallbackImage = m_textureSamplerManager && m_textureSamplerManager->GetFallbackDescriptor(fallbackImageInfo);
|
MOBILEGL_ASSERT(m_textureSamplerManager != nullptr,
|
||||||
|
"BindProgramUniformBuffers: texture sampler manager is null");
|
||||||
|
const Bool hasFallbackImage = m_textureSamplerManager->GetFallbackDescriptor(fallbackImageInfo);
|
||||||
|
|
||||||
Vector<VkWriteDescriptorSet> writes;
|
Vector<VkWriteDescriptorSet> writes;
|
||||||
writes.reserve(m_maxBindings);
|
writes.reserve(m_maxBindings);
|
||||||
|
|||||||
@@ -216,27 +216,34 @@ namespace MobileGL::MG_Backend::DirectVulkan {
|
|||||||
|
|
||||||
CreateCommandPool();
|
CreateCommandPool();
|
||||||
m_renderPassManager = MakeUnique<VkRenderPassManager>();
|
m_renderPassManager = MakeUnique<VkRenderPassManager>();
|
||||||
|
MOBILEGL_ASSERT(m_renderPassManager != nullptr, "VkRenderPassManager creation failed.");
|
||||||
|
|
||||||
RecreateSwapchain();
|
RecreateSwapchain();
|
||||||
|
|
||||||
m_pipelineFactory = MakeUnique<PipelineFactory>(m_device, m_config);
|
m_pipelineFactory = MakeUnique<PipelineFactory>(m_device, m_config);
|
||||||
|
MOBILEGL_ASSERT(m_pipelineFactory != nullptr, "PipelineFactory creation failed.");
|
||||||
m_programFactory = MakeUnique<ProgramFactory>(m_device, m_config);
|
m_programFactory = MakeUnique<ProgramFactory>(m_device, m_config);
|
||||||
|
MOBILEGL_ASSERT(m_programFactory != nullptr, "ProgramFactory creation failed.");
|
||||||
m_textureSamplerManager = MakeUnique<VkTextureSamplerManager>();
|
m_textureSamplerManager = MakeUnique<VkTextureSamplerManager>();
|
||||||
|
MOBILEGL_ASSERT(m_textureSamplerManager != nullptr, "VkTextureSamplerManager creation failed.");
|
||||||
auto succeeded = false;
|
auto succeeded = false;
|
||||||
succeeded = m_textureSamplerManager->Initialize({m_device, m_physicalDevice.handle, m_commandPool, m_graphicsQueue});
|
succeeded = m_textureSamplerManager->Initialize({m_device, m_physicalDevice.handle, m_commandPool, m_graphicsQueue});
|
||||||
MOBILEGL_ASSERT(succeeded, "VkTextureSamplerManager initialization failed.");
|
MOBILEGL_ASSERT(succeeded, "VkTextureSamplerManager initialization failed.");
|
||||||
|
|
||||||
m_framebufferManager = MakeUnique<VkFramebufferManager>();
|
m_framebufferManager = MakeUnique<VkFramebufferManager>();
|
||||||
|
MOBILEGL_ASSERT(m_framebufferManager != nullptr, "VkFramebufferManager creation failed.");
|
||||||
succeeded = m_framebufferManager->Initialize({m_device, m_physicalDevice.handle});
|
succeeded = m_framebufferManager->Initialize({m_device, m_physicalDevice.handle});
|
||||||
MOBILEGL_ASSERT(succeeded, "VkFramebufferManager initialization failed.");
|
MOBILEGL_ASSERT(succeeded, "VkFramebufferManager initialization failed.");
|
||||||
|
|
||||||
m_uniformDescriptorBinder = MakeUnique<UniformDescriptorBinder>();
|
m_uniformDescriptorBinder = MakeUnique<UniformDescriptorBinder>();
|
||||||
|
MOBILEGL_ASSERT(m_uniformDescriptorBinder != nullptr, "UniformDescriptorBinder creation failed.");
|
||||||
succeeded = m_uniformDescriptorBinder->Initialize(m_device, m_allocator,
|
succeeded = m_uniformDescriptorBinder->Initialize(m_device, m_allocator,
|
||||||
m_physicalDevice.properties.limits.minUniformBufferOffsetAlignment,
|
m_physicalDevice.properties.limits.minUniformBufferOffsetAlignment,
|
||||||
m_config.MaxFramesInFlight, 16, 64, 4 * 1024 * 1024,
|
m_config.MaxFramesInFlight, 16, 64, 4 * 1024 * 1024,
|
||||||
m_textureSamplerManager.get(), m_framebufferManager.get());
|
m_textureSamplerManager.get(), m_framebufferManager.get());
|
||||||
MOBILEGL_ASSERT(succeeded, "UniformDescriptorBinder initialization failed.");
|
MOBILEGL_ASSERT(succeeded, "UniformDescriptorBinder initialization failed.");
|
||||||
m_vertexInputStateFactory = MakeUnique<VertexInputStateFactory>(m_config);
|
m_vertexInputStateFactory = MakeUnique<VertexInputStateFactory>(m_config);
|
||||||
|
MOBILEGL_ASSERT(m_vertexInputStateFactory != nullptr, "VertexInputStateFactory creation failed.");
|
||||||
|
|
||||||
PrepareDemoPipeline();
|
PrepareDemoPipeline();
|
||||||
CreateFrameContexts();
|
CreateFrameContexts();
|
||||||
@@ -472,9 +479,8 @@ namespace MobileGL::MG_Backend::DirectVulkan {
|
|||||||
commandBufferPtr = &frame.commandBuffer;
|
commandBufferPtr = &frame.commandBuffer;
|
||||||
} else {
|
} else {
|
||||||
commandBufferPtr = &m_frameContext.BeginCommandRecording();
|
commandBufferPtr = &m_frameContext.BeginCommandRecording();
|
||||||
if (m_uniformDescriptorBinder) {
|
MOBILEGL_ASSERT(m_uniformDescriptorBinder != nullptr, "EnsureFrameRecordingStarted: binder is null");
|
||||||
m_uniformDescriptorBinder->BeginFrame(m_frameContext.GetCurrentFrameIndex());
|
m_uniformDescriptorBinder->BeginFrame(m_frameContext.GetCurrentFrameIndex());
|
||||||
}
|
|
||||||
}
|
}
|
||||||
VkCommandBuffer& commandBuffer = *commandBufferPtr;
|
VkCommandBuffer& commandBuffer = *commandBufferPtr;
|
||||||
|
|
||||||
@@ -743,8 +749,9 @@ namespace MobileGL::MG_Backend::DirectVulkan {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MOBILEGL_ASSERT(m_vertexInputStateFactory != nullptr, "DrawArrays: vertex input state factory is null");
|
||||||
const VertexInputStateFactory::BackendVertexInputState* vertexInputState = nullptr;
|
const VertexInputStateFactory::BackendVertexInputState* vertexInputState = nullptr;
|
||||||
if (payload.vertexArray && m_vertexInputStateFactory) {
|
if (payload.vertexArray) {
|
||||||
vertexInputState = &m_vertexInputStateFactory->GetOrCreateVertexInputState(*payload.vertexArray);
|
vertexInputState = &m_vertexInputStateFactory->GetOrCreateVertexInputState(*payload.vertexArray);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -771,13 +778,11 @@ namespace MobileGL::MG_Backend::DirectVulkan {
|
|||||||
vertexInputInfo = &emptyVertexInputBuilder.Build();
|
vertexInputInfo = &emptyVertexInputBuilder.Build();
|
||||||
}
|
}
|
||||||
|
|
||||||
VkPipelineLayout pipelineLayoutToUse = m_pipelineLayout;
|
MOBILEGL_ASSERT(m_uniformDescriptorBinder != nullptr, "DrawArrays: binder is null");
|
||||||
if (m_uniformDescriptorBinder) {
|
VkPipelineLayout pipelineLayoutToUse = m_uniformDescriptorBinder->GetOrCreatePipelineLayout(*payload.program);
|
||||||
pipelineLayoutToUse = m_uniformDescriptorBinder->GetOrCreatePipelineLayout(*payload.program);
|
if (pipelineLayoutToUse == VK_NULL_HANDLE) {
|
||||||
if (pipelineLayoutToUse == VK_NULL_HANDLE) {
|
MGLOG_D("DrawArrays skipped: failed to get pipeline layout for program");
|
||||||
MGLOG_D("DrawArrays skipped: failed to get pipeline layout for program");
|
return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VkPipeline pipelineToBind =
|
VkPipeline pipelineToBind =
|
||||||
@@ -788,8 +793,7 @@ namespace MobileGL::MG_Backend::DirectVulkan {
|
|||||||
}
|
}
|
||||||
|
|
||||||
vkCmdBindPipeline(commandBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, pipelineToBind);
|
vkCmdBindPipeline(commandBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, pipelineToBind);
|
||||||
if (m_uniformDescriptorBinder &&
|
if (!m_uniformDescriptorBinder->BindProgramUniformBuffers(commandBuffer, pipelineLayoutToUse, *payload.program,
|
||||||
!m_uniformDescriptorBinder->BindProgramUniformBuffers(commandBuffer, pipelineLayoutToUse, *payload.program,
|
|
||||||
m_frameContext.GetCurrentFrameIndex())) {
|
m_frameContext.GetCurrentFrameIndex())) {
|
||||||
MGLOG_D("DrawArrays skipped: failed to bind uniform descriptors");
|
MGLOG_D("DrawArrays skipped: failed to bind uniform descriptors");
|
||||||
return;
|
return;
|
||||||
@@ -868,8 +872,9 @@ namespace MobileGL::MG_Backend::DirectVulkan {
|
|||||||
MOBILEGL_ASSERT(payload.indexByteOffset + indexDataSizeBytes <= indexBuffer->GetSize(),
|
MOBILEGL_ASSERT(payload.indexByteOffset + indexDataSizeBytes <= indexBuffer->GetSize(),
|
||||||
"DrawElements index range out of bounds");
|
"DrawElements index range out of bounds");
|
||||||
|
|
||||||
|
MOBILEGL_ASSERT(m_vertexInputStateFactory != nullptr, "DrawElements: vertex input state factory is null");
|
||||||
const VertexInputStateFactory::BackendVertexInputState* vertexInputState = nullptr;
|
const VertexInputStateFactory::BackendVertexInputState* vertexInputState = nullptr;
|
||||||
if (payload.drawArray.vertexArray && m_vertexInputStateFactory) {
|
if (payload.drawArray.vertexArray) {
|
||||||
vertexInputState = &m_vertexInputStateFactory->GetOrCreateVertexInputState(*payload.drawArray.vertexArray);
|
vertexInputState = &m_vertexInputStateFactory->GetOrCreateVertexInputState(*payload.drawArray.vertexArray);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -886,13 +891,12 @@ namespace MobileGL::MG_Backend::DirectVulkan {
|
|||||||
vertexInputInfo = &emptyVertexInputBuilder.Build();
|
vertexInputInfo = &emptyVertexInputBuilder.Build();
|
||||||
}
|
}
|
||||||
|
|
||||||
VkPipelineLayout pipelineLayoutToUse = m_pipelineLayout;
|
MOBILEGL_ASSERT(m_uniformDescriptorBinder != nullptr, "DrawElements: binder is null");
|
||||||
if (m_uniformDescriptorBinder) {
|
VkPipelineLayout pipelineLayoutToUse =
|
||||||
pipelineLayoutToUse = m_uniformDescriptorBinder->GetOrCreatePipelineLayout(*payload.drawArray.program);
|
m_uniformDescriptorBinder->GetOrCreatePipelineLayout(*payload.drawArray.program);
|
||||||
if (pipelineLayoutToUse == VK_NULL_HANDLE) {
|
if (pipelineLayoutToUse == VK_NULL_HANDLE) {
|
||||||
MGLOG_D("DrawElements skipped: failed to get pipeline layout for program");
|
MGLOG_D("DrawElements skipped: failed to get pipeline layout for program");
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VkPipeline pipelineToBind =
|
VkPipeline pipelineToBind =
|
||||||
@@ -924,9 +928,9 @@ namespace MobileGL::MG_Backend::DirectVulkan {
|
|||||||
const auto activeExtent = m_activeRenderExtent;
|
const auto activeExtent = m_activeRenderExtent;
|
||||||
|
|
||||||
vkCmdBindPipeline(commandBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, pipelineToBind);
|
vkCmdBindPipeline(commandBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, pipelineToBind);
|
||||||
if (m_uniformDescriptorBinder && !m_uniformDescriptorBinder->BindProgramUniformBuffers(
|
if (!m_uniformDescriptorBinder->BindProgramUniformBuffers(commandBuffer, pipelineLayoutToUse,
|
||||||
commandBuffer, pipelineLayoutToUse, *payload.drawArray.program,
|
*payload.drawArray.program,
|
||||||
m_frameContext.GetCurrentFrameIndex())) {
|
m_frameContext.GetCurrentFrameIndex())) {
|
||||||
MGLOG_D("DrawElements skipped: failed to bind uniform descriptors");
|
MGLOG_D("DrawElements skipped: failed to bind uniform descriptors");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1057,8 +1061,9 @@ namespace MobileGL::MG_Backend::DirectVulkan {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MOBILEGL_ASSERT(m_vertexInputStateFactory != nullptr, "MultiDrawElements: vertex input state factory is null");
|
||||||
const VertexInputStateFactory::BackendVertexInputState* vertexInputState = nullptr;
|
const VertexInputStateFactory::BackendVertexInputState* vertexInputState = nullptr;
|
||||||
if (firstPayload.drawArray.vertexArray && m_vertexInputStateFactory) {
|
if (firstPayload.drawArray.vertexArray) {
|
||||||
vertexInputState =
|
vertexInputState =
|
||||||
&m_vertexInputStateFactory->GetOrCreateVertexInputState(*firstPayload.drawArray.vertexArray);
|
&m_vertexInputStateFactory->GetOrCreateVertexInputState(*firstPayload.drawArray.vertexArray);
|
||||||
}
|
}
|
||||||
@@ -1071,13 +1076,12 @@ namespace MobileGL::MG_Backend::DirectVulkan {
|
|||||||
vertexInputInfo = &emptyVertexInputBuilder.Build();
|
vertexInputInfo = &emptyVertexInputBuilder.Build();
|
||||||
}
|
}
|
||||||
|
|
||||||
VkPipelineLayout pipelineLayoutToUse = m_pipelineLayout;
|
MOBILEGL_ASSERT(m_uniformDescriptorBinder != nullptr, "MultiDrawElements: binder is null");
|
||||||
if (m_uniformDescriptorBinder) {
|
VkPipelineLayout pipelineLayoutToUse =
|
||||||
pipelineLayoutToUse = m_uniformDescriptorBinder->GetOrCreatePipelineLayout(*firstPayload.drawArray.program);
|
m_uniformDescriptorBinder->GetOrCreatePipelineLayout(*firstPayload.drawArray.program);
|
||||||
if (pipelineLayoutToUse == VK_NULL_HANDLE) {
|
if (pipelineLayoutToUse == VK_NULL_HANDLE) {
|
||||||
MGLOG_D("MultiDrawElements skipped: failed to get pipeline layout for program");
|
MGLOG_D("MultiDrawElements skipped: failed to get pipeline layout for program");
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VkPipeline pipelineToBind = GetOrCreatePipeline(*firstPayload.drawArray.program, pipelineLayoutToUse,
|
VkPipeline pipelineToBind = GetOrCreatePipeline(*firstPayload.drawArray.program, pipelineLayoutToUse,
|
||||||
@@ -1113,9 +1117,9 @@ namespace MobileGL::MG_Backend::DirectVulkan {
|
|||||||
VkCommandBuffer& commandBuffer = frame.commandBuffer;
|
VkCommandBuffer& commandBuffer = frame.commandBuffer;
|
||||||
const auto activeExtent = m_activeRenderExtent;
|
const auto activeExtent = m_activeRenderExtent;
|
||||||
vkCmdBindPipeline(commandBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, pipelineToBind);
|
vkCmdBindPipeline(commandBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, pipelineToBind);
|
||||||
if (m_uniformDescriptorBinder && !m_uniformDescriptorBinder->BindProgramUniformBuffers(
|
if (!m_uniformDescriptorBinder->BindProgramUniformBuffers(commandBuffer, pipelineLayoutToUse,
|
||||||
commandBuffer, pipelineLayoutToUse, *firstPayload.drawArray.program,
|
*firstPayload.drawArray.program,
|
||||||
m_frameContext.GetCurrentFrameIndex())) {
|
m_frameContext.GetCurrentFrameIndex())) {
|
||||||
MGLOG_D("MultiDrawElements skipped: failed to bind uniform descriptors");
|
MGLOG_D("MultiDrawElements skipped: failed to bind uniform descriptors");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1219,9 +1223,8 @@ namespace MobileGL::MG_Backend::DirectVulkan {
|
|||||||
|
|
||||||
if (!frame.isCommandRecording) {
|
if (!frame.isCommandRecording) {
|
||||||
m_frameContext.BeginCommandRecording();
|
m_frameContext.BeginCommandRecording();
|
||||||
if (m_uniformDescriptorBinder) {
|
MOBILEGL_ASSERT(m_uniformDescriptorBinder != nullptr, "BlitFramebuffer: binder is null");
|
||||||
m_uniformDescriptorBinder->BeginFrame(m_frameContext.GetCurrentFrameIndex());
|
m_uniformDescriptorBinder->BeginFrame(m_frameContext.GetCurrentFrameIndex());
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VkCommandBuffer commandBuffer = frame.commandBuffer;
|
VkCommandBuffer commandBuffer = frame.commandBuffer;
|
||||||
@@ -1281,7 +1284,7 @@ namespace MobileGL::MG_Backend::DirectVulkan {
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_renderPassManager->EndRenderPass(commandBuffer);
|
m_renderPassManager->EndRenderPass(commandBuffer);
|
||||||
} else if (m_framebufferManager && MG_State::pGLContext) {
|
} else if (MG_State::pGLContext) {
|
||||||
const auto targetFbo = MG_State::pGLContext->GetFramebufferObject(targetFboExternalIndex);
|
const auto targetFbo = MG_State::pGLContext->GetFramebufferObject(targetFboExternalIndex);
|
||||||
VkRenderPass offscreenRenderPass = VK_NULL_HANDLE;
|
VkRenderPass offscreenRenderPass = VK_NULL_HANDLE;
|
||||||
VkFramebuffer offscreenFramebuffer = VK_NULL_HANDLE;
|
VkFramebuffer offscreenFramebuffer = VK_NULL_HANDLE;
|
||||||
@@ -1554,7 +1557,7 @@ namespace MobileGL::MG_Backend::DirectVulkan {
|
|||||||
srcDepthExtent = m_swapchainObject.GetExtent();
|
srcDepthExtent = m_swapchainObject.GetExtent();
|
||||||
srcDepthFormat = m_depthStencilFormat;
|
srcDepthFormat = m_depthStencilFormat;
|
||||||
}
|
}
|
||||||
} else if (m_framebufferManager) {
|
} else {
|
||||||
if (!MG_State::pGLContext) {
|
if (!MG_State::pGLContext) {
|
||||||
MGLOG_W("BlitFramebuffer: GL context unavailable for read depth/stencil FBO");
|
MGLOG_W("BlitFramebuffer: GL context unavailable for read depth/stencil FBO");
|
||||||
} else {
|
} else {
|
||||||
@@ -1803,14 +1806,11 @@ namespace MobileGL::MG_Backend::DirectVulkan {
|
|||||||
if (frame.hasCommandBufferRecorded) {
|
if (frame.hasCommandBufferRecorded) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!m_renderPassManager) {
|
MOBILEGL_ASSERT(m_renderPassManager != nullptr, "Present: render pass manager is null");
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (!frame.isCommandRecording) {
|
if (!frame.isCommandRecording) {
|
||||||
m_frameContext.BeginCommandRecording();
|
m_frameContext.BeginCommandRecording();
|
||||||
if (m_uniformDescriptorBinder) {
|
MOBILEGL_ASSERT(m_uniformDescriptorBinder != nullptr, "Present: binder is null");
|
||||||
m_uniformDescriptorBinder->BeginFrame(m_frameContext.GetCurrentFrameIndex());
|
m_uniformDescriptorBinder->BeginFrame(m_frameContext.GetCurrentFrameIndex());
|
||||||
}
|
|
||||||
}
|
}
|
||||||
VkCommandBuffer commandBuffer = frame.commandBuffer;
|
VkCommandBuffer commandBuffer = frame.commandBuffer;
|
||||||
|
|
||||||
@@ -1849,7 +1849,8 @@ namespace MobileGL::MG_Backend::DirectVulkan {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_framebufferManager || !MG_State::pGLContext) {
|
MOBILEGL_ASSERT(m_framebufferManager != nullptr, "Present: framebuffer manager is null");
|
||||||
|
if (!MG_State::pGLContext) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const auto pendingFbo = MG_State::pGLContext->GetFramebufferObject(targetFboExternalIndex);
|
const auto pendingFbo = MG_State::pGLContext->GetFramebufferObject(targetFboExternalIndex);
|
||||||
@@ -2670,9 +2671,8 @@ namespace MobileGL::MG_Backend::DirectVulkan {
|
|||||||
void VulkanRenderer::ShutdownSwapchain() {
|
void VulkanRenderer::ShutdownSwapchain() {
|
||||||
DestroyDepthStencilResources();
|
DestroyDepthStencilResources();
|
||||||
|
|
||||||
if (m_renderPassManager) {
|
MOBILEGL_ASSERT(m_renderPassManager != nullptr, "ShutdownSwapchain: render pass manager is null");
|
||||||
m_renderPassManager->Shutdown();
|
m_renderPassManager->Shutdown();
|
||||||
}
|
|
||||||
|
|
||||||
m_swapchainObject.Shutdown(m_device);
|
m_swapchainObject.Shutdown(m_device);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user