mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-09 12:48:32 +09:00
[Feat] (MG_State, MG_Impl/GLImpl): per-target default texture objects (name 0) - binding 0 binds a real per-context default object (the initial binding of every unit/target slot, rebound on delete of a bound texture), so glTexImage*/glTexParameter*/glGetTex* on it work like any texture while glIsTexture(0)/Gen/Delete keep excluding it and TexStorage* rejects it per spec; backends skip image-less defaults as cheaply as the old null slots (DirectGLES per-draw sync/bind loops, DirectVulkan sampler-fallback resolve); also accept the full advertised GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS range in glActiveTexture, allow zero-layer TexImage3DMultisample, and let glTexBuffer(buffer=0) detach - the texture section of GL CTS per-case state reset (gluStateReset) now runs clean
This commit is contained in:
@@ -154,6 +154,17 @@ namespace MobileGL::MG_State::GLState {
|
||||
: nullptr;
|
||||
}
|
||||
|
||||
// The per-target default texture objects (name 0) sit permanently in every texture unit's
|
||||
// binding slots, so "nothing useful bound" is no longer a null slot. While a default texture
|
||||
// has never been given an image (its internal format is still Unknown) it can contribute
|
||||
// nothing to sampling; backends treat such a binding exactly like the old empty slot and
|
||||
// skip per-draw sync/bind work for it. Once an application defines an image on a default
|
||||
// texture it loses this shortcut and is synced like any other texture.
|
||||
inline Bool IsUndefinedDefaultTexture(const ITextureObject* texture) {
|
||||
return texture != nullptr && texture->GetExternalIndex() == 0 &&
|
||||
texture->GetFormat() == TextureInternalFormat::Unknown;
|
||||
}
|
||||
|
||||
class TextureObjectWithOneMipmap : public TextureObjectMipmap {
|
||||
public:
|
||||
TextureObjectWithOneMipmap(TextureTarget target, Uint externalIndex)
|
||||
|
||||
Reference in New Issue
Block a user