mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-08 04:08:32 +09:00
[Fix] (MG_Impl/TextureImpl|FramebufferImpl): Handle texture 0.
This commit is contained in:
@@ -89,7 +89,7 @@ namespace MobileGL {
|
||||
|
||||
if (!FramebufferImpl::ValidateFramebufferAttachmentType(attachmentType)) return;
|
||||
if (!FramebufferImpl::ValidateFramebufferTarget(framebufferTarget)) return;
|
||||
if (!TextureImpl::ValidateTextureName(texture)) return;
|
||||
if (!TextureImpl::ValidateTextureName(texture, true)) return;
|
||||
|
||||
auto& bindingSlot = MG_State::pGLContext->GetFramebufferBindingSlot(framebufferTarget);
|
||||
auto framebufferObject = bindingSlot.GetBoundObject();
|
||||
@@ -101,6 +101,11 @@ namespace MobileGL {
|
||||
return;
|
||||
}
|
||||
|
||||
if (texture == 0) {
|
||||
framebufferObject->Detach(attachmentType);
|
||||
return;
|
||||
}
|
||||
|
||||
auto textureObject = MG_State::pGLContext->GetTextureObject(texture);
|
||||
if (!textureObject) {
|
||||
MG_State::pGLContext->RecordError(
|
||||
@@ -110,7 +115,7 @@ namespace MobileGL {
|
||||
return;
|
||||
}
|
||||
|
||||
framebufferObject->AttachTexture(attachmentType, textureObject, level);
|
||||
framebufferObject->AttachTexture(attachmentType, textureObject, textureObject ? level : 0);
|
||||
}
|
||||
|
||||
void FramebufferTexture1D_State(GLenum target, GLenum attachment, GLenum textarget, GLuint texture,
|
||||
|
||||
Reference in New Issue
Block a user