mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-11 05:38:31 +09:00
[Fix] (MG_Impl/Framebuffer, MG_State/Framebuffer, MG_Backend/DirectGLES): redone fbo attachment management. remap GL -> ES attachment names
This commit is contained in:
@@ -83,12 +83,32 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
||||
class BackendFramebufferObject {
|
||||
public:
|
||||
BackendFramebufferObject();
|
||||
void SyncToBackend(SharedPtr<MG_State::GLState::FramebufferObject>& stateFBOObject);
|
||||
void SyncToBackend(SharedPtr<MG_State::GLState::FramebufferObject>& stateFBOObject, FramebufferTarget asTarget);
|
||||
Uint GetBackendFramebufferId() { return m_backendFBOId; }
|
||||
void Bind(FramebufferTarget target);
|
||||
|
||||
private:
|
||||
Uint m_backendFBOId = 0;
|
||||
|
||||
/* this will save buffers in its original form,
|
||||
reversion, absence or not consecutive are all allowed, as long as GL spec allows it
|
||||
i.e. it could be like [COLOR_ATTACHMENT0, COLOR_ATTACHMENT5, NONE, COLOR_ATTACHMENT4]
|
||||
Probably useful to re-link shader output according to this.
|
||||
aka. realizing `glBindFragDataLocation`
|
||||
*/
|
||||
GLenum m_frontendBuffers[MG_State::GLState::FramebufferObject::MAX_DRAW_BUFFERS] = {GL_NONE};
|
||||
/* this will save buffers in its compacted GL form,
|
||||
not consecutive is not allowed
|
||||
i.e. it could be like [COLOR_ATTACHMENT0, COLOR_ATTACHMENT5, COLOR_ATTACHMENT4]
|
||||
(no GL_NONE among those)
|
||||
*/
|
||||
GLenum m_compactedFrontendBuffers[MG_State::GLState::FramebufferObject::MAX_DRAW_BUFFERS] = {GL_NONE};
|
||||
/* this will save buffers in stricter ES rules
|
||||
reversion, absence or not consecutive are not allowed, according to ES spec
|
||||
i.e. it could be like [COLOR_ATTACHMENT0, COLOR_ATTACHMENT1, NONE, NONE, ...]
|
||||
this array could be provided as data directly to ES `glDrawBuffers` function
|
||||
*/
|
||||
GLenum m_backendBuffers[MG_State::GLState::FramebufferObject::MAX_DRAW_BUFFERS] = {GL_NONE};
|
||||
};
|
||||
|
||||
extern UnorderedMap<SharedPtr<MG_State::GLState::FramebufferObject>, SharedPtr<BackendFramebufferObject>>
|
||||
|
||||
Reference in New Issue
Block a user