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,9 +45,7 @@ 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 {
|
|
||||||
if (!fbInfo.ColorRTVs.empty() && fbInfo.ColorRTVs[0]) {
|
|
||||||
const auto& desc = fbInfo.ColorRTVs[0]->GetTexture()->GetDesc();
|
const auto& desc = fbInfo.ColorRTVs[0]->GetTexture()->GetDesc();
|
||||||
width = desc.Width;
|
width = desc.Width;
|
||||||
height = desc.Height;
|
height = desc.Height;
|
||||||
@@ -61,7 +59,6 @@ namespace MG_GL::GL {
|
|||||||
MG_Util::Debug::LogE("CreateRenderPassAndFramebuffer: Failed to determine framebuffer dimensions. No attachments.");
|
MG_Util::Debug::LogE("CreateRenderPassAndFramebuffer: Failed to determine framebuffer dimensions. No attachments.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (width == 0 || height == 0) {
|
if (width == 0 || height == 0) {
|
||||||
MG_Util::Debug::LogE("CreateRenderPassAndFramebuffer: Failed to determine framebuffer dimensions. Width or Height is 0.");
|
MG_Util::Debug::LogE("CreateRenderPassAndFramebuffer: Failed to determine framebuffer dimensions. Width or Height is 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