mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-12 06:08:30 +09:00
[Fix] (Diligent/FrameBuffer): Fix UpdateDefaultFramebuffer crashing.
This commit is contained in:
@@ -45,22 +45,19 @@ namespace MG_GL::GL {
|
|||||||
MG_Util::Debug::LogE("CreateRenderPassAndFramebuffer: Swap chain not initialized for default framebuffer");
|
MG_Util::Debug::LogE("CreateRenderPassAndFramebuffer: Swap chain not initialized for default framebuffer");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
} else if (!fbInfo.ColorRTVs.empty() && fbInfo.ColorRTVs[0]) {
|
||||||
else {
|
const auto& desc = fbInfo.ColorRTVs[0]->GetTexture()->GetDesc();
|
||||||
if (!fbInfo.ColorRTVs.empty() && fbInfo.ColorRTVs[0]) {
|
width = desc.Width;
|
||||||
const auto& desc = fbInfo.ColorRTVs[0]->GetTexture()->GetDesc();
|
height = desc.Height;
|
||||||
width = desc.Width;
|
MG_Util::Debug::LogD("CreateRenderPassAndFramebuffer: Using color attachment 0 for dimensions: %ux%u", width, height);
|
||||||
height = desc.Height;
|
} else if (fbInfo.pDepthStencilRTV) {
|
||||||
MG_Util::Debug::LogD("CreateRenderPassAndFramebuffer: Using color attachment 0 for dimensions: %ux%u", width, height);
|
const auto& desc = fbInfo.pDepthStencilRTV->GetTexture()->GetDesc();
|
||||||
} else if (fbInfo.pDepthStencilRTV) {
|
width = desc.Width;
|
||||||
const auto& desc = fbInfo.pDepthStencilRTV->GetTexture()->GetDesc();
|
height = desc.Height;
|
||||||
width = desc.Width;
|
MG_Util::Debug::LogD("CreateRenderPassAndFramebuffer: Using depth/stencil attachment for dimensions: %ux%u", width, height);
|
||||||
height = desc.Height;
|
} else {
|
||||||
MG_Util::Debug::LogD("CreateRenderPassAndFramebuffer: Using depth/stencil attachment for dimensions: %ux%u", width, height);
|
MG_Util::Debug::LogE("CreateRenderPassAndFramebuffer: Failed to determine framebuffer dimensions. No attachments.");
|
||||||
} else {
|
return;
|
||||||
MG_Util::Debug::LogE("CreateRenderPassAndFramebuffer: Failed to determine framebuffer dimensions. No attachments.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (width == 0 || height == 0) {
|
if (width == 0 || height == 0) {
|
||||||
@@ -76,7 +73,8 @@ namespace MG_GL::GL {
|
|||||||
for (size_t i = 0; i < fbInfo.ColorRTVs.size(); ++i) {
|
for (size_t i = 0; i < fbInfo.ColorRTVs.size(); ++i) {
|
||||||
if (fbInfo.ColorRTVs[i]) {
|
if (fbInfo.ColorRTVs[i]) {
|
||||||
Diligent::RenderPassAttachmentDesc ColorAttachment;
|
Diligent::RenderPassAttachmentDesc ColorAttachment;
|
||||||
ColorAttachment.Format = fbInfo.ColorRTVs[i]->GetDesc().Format;
|
ColorAttachment.Format = framebuffer != 0 ? fbInfo.ColorRTVs[i]->GetDesc().Format:
|
||||||
|
MG_Diligent::g_pSwapChain->GetDesc().ColorBufferFormat;
|
||||||
ColorAttachment.SampleCount = 1;
|
ColorAttachment.SampleCount = 1;
|
||||||
ColorAttachment.InitialState = Diligent::RESOURCE_STATE_RENDER_TARGET;
|
ColorAttachment.InitialState = Diligent::RESOURCE_STATE_RENDER_TARGET;
|
||||||
ColorAttachment.FinalState = Diligent::RESOURCE_STATE_RENDER_TARGET;
|
ColorAttachment.FinalState = Diligent::RESOURCE_STATE_RENDER_TARGET;
|
||||||
|
|||||||
Reference in New Issue
Block a user