mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-11 21:58:31 +09:00
[Feat] (DiligentEngine): Implement most rendering by DiligentEngine.
This commit is contained in:
@@ -47,6 +47,7 @@ GLenum FramebufferState::Bind(GLenum target, GLuint framebuffer) {
|
||||
if (framebuffer != 0 && !ValidateHandle(framebuffer))
|
||||
return GL_INVALID_OPERATION;
|
||||
if (target == GL_FRAMEBUFFER) {
|
||||
currentBindings_[GL_FRAMEBUFFER] = framebuffer;
|
||||
currentBindings_[GL_READ_FRAMEBUFFER] = framebuffer;
|
||||
currentBindings_[GL_DRAW_FRAMEBUFFER] = framebuffer;
|
||||
} else {
|
||||
@@ -60,7 +61,7 @@ GLenum FramebufferState::AttachTexture2D(GLenum target, GLenum attachment,
|
||||
if (MG_Constants::Framebuffer::VALID_ATTACHMENTS.find(attachment) == MG_Constants::Framebuffer::VALID_ATTACHMENTS.end() ||
|
||||
MG_Constants::Texture::VALID_TARGETS.find(textarget) == MG_Constants::Texture::VALID_TARGETS.end())
|
||||
return GL_INVALID_ENUM;
|
||||
if (target == GL_FRAMEBUFFER) target = GL_DRAW_FRAMEBUFFER;
|
||||
// if (target == GL_FRAMEBUFFER) target = GL_DRAW_FRAMEBUFFER;
|
||||
FramebufferObject* fbo = GetCurrentFBO(target);
|
||||
if (!fbo) return GL_INVALID_OPERATION;
|
||||
if (texture != 0 && !MG_State_T::textureState->IsTexture(texture))
|
||||
@@ -85,7 +86,7 @@ GLenum FramebufferState::AttachTexture2D(GLenum target, GLenum attachment,
|
||||
}
|
||||
|
||||
GLenum FramebufferState::ValidateCompleteness(GLenum target) {
|
||||
if (target == GL_FRAMEBUFFER) target = GL_DRAW_FRAMEBUFFER;
|
||||
// if (target == GL_FRAMEBUFFER) target = GL_DRAW_FRAMEBUFFER;
|
||||
FramebufferObject* fbo = GetCurrentFBO(target);
|
||||
if (!fbo) return GL_INVALID_OPERATION;
|
||||
return fbo->status;
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#ifndef MOBILEGL_FRAMEBUFFERSTATE_H
|
||||
#define MOBILEGL_FRAMEBUFFERSTATE_H
|
||||
#define MOBILEGL_GLSTATE_H
|
||||
#define MOBILEGL_DILIGENT_EGL_IMPL_H
|
||||
|
||||
#include "../../../Includes.h"
|
||||
|
||||
@@ -17,7 +18,7 @@ struct FramebufferAttachment {
|
||||
|
||||
struct FramebufferObject {
|
||||
bool generated = false;
|
||||
ankerl::unordered_map<GLenum, FramebufferAttachment> attachments;
|
||||
MG_Global::unordered_map<GLenum, FramebufferAttachment> attachments;
|
||||
GLenum status = GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT;
|
||||
GLsizei width = 0;
|
||||
GLsizei height = 0;
|
||||
@@ -35,10 +36,10 @@ public:
|
||||
GLenum ValidateCompleteness(GLenum target);
|
||||
FramebufferObject* GetCurrentFBO(GLenum target);
|
||||
|
||||
ankerl::unordered_map<GLenum, GLuint> currentBindings_; // READ/DRAW
|
||||
MG_Global::unordered_map<GLenum, GLuint> currentBindings_; // READ/DRAW
|
||||
|
||||
private:
|
||||
ankerl::unordered_map<GLuint, FramebufferObject> framebuffers_;
|
||||
MG_Global::unordered_map<GLuint, FramebufferObject> framebuffers_;
|
||||
std::set<GLuint> freeIds_;
|
||||
GLuint lastId_ = 0;
|
||||
bool ValidateHandle(GLuint framebuffer);
|
||||
|
||||
Reference in New Issue
Block a user