mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-12 14:18:31 +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::ValidateFramebufferAttachmentType(attachmentType)) return;
|
||||||
if (!FramebufferImpl::ValidateFramebufferTarget(framebufferTarget)) 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& bindingSlot = MG_State::pGLContext->GetFramebufferBindingSlot(framebufferTarget);
|
||||||
auto framebufferObject = bindingSlot.GetBoundObject();
|
auto framebufferObject = bindingSlot.GetBoundObject();
|
||||||
@@ -101,6 +101,11 @@ namespace MobileGL {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (texture == 0) {
|
||||||
|
framebufferObject->Detach(attachmentType);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
auto textureObject = MG_State::pGLContext->GetTextureObject(texture);
|
auto textureObject = MG_State::pGLContext->GetTextureObject(texture);
|
||||||
if (!textureObject) {
|
if (!textureObject) {
|
||||||
MG_State::pGLContext->RecordError(
|
MG_State::pGLContext->RecordError(
|
||||||
@@ -110,7 +115,7 @@ namespace MobileGL {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
framebufferObject->AttachTexture(attachmentType, textureObject, level);
|
framebufferObject->AttachTexture(attachmentType, textureObject, textureObject ? level : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FramebufferTexture1D_State(GLenum target, GLenum attachment, GLenum textarget, GLuint texture,
|
void FramebufferTexture1D_State(GLenum target, GLenum attachment, GLenum textarget, GLuint texture,
|
||||||
|
|||||||
@@ -337,7 +337,7 @@ namespace MobileGL {
|
|||||||
|
|
||||||
GLboolean IsTexture_State(GLuint texture) {
|
GLboolean IsTexture_State(GLuint texture) {
|
||||||
// ======================= Processing ================================
|
// ======================= Processing ================================
|
||||||
if (!TextureImpl::ValidateTextureName(texture)) return GL_FALSE;
|
if (!TextureImpl::ValidateTextureName(texture, true)) return GL_FALSE;
|
||||||
return MG_State::pGLContext->ValidateTextureObject(texture) ? GL_TRUE : GL_FALSE;
|
return MG_State::pGLContext->ValidateTextureObject(texture) ? GL_TRUE : GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user