Open wxdut opened 2 years ago
Hi, Fbo is not resource. It is a container object. Hence not shareable. Same as VAO. Pls see https://www.khronos.org/opengl/wiki/OpenGL_Context
Most OpenGL objects are sharable, including Sync Objects and GLSL Objects. Container Objects are not sharable, nor are Query Objects.
you can share textures then reattach them to two different fbos in two contexts though.
Thanks for your quick reply.
But I test this code on iphone, fbos seem to be shared in same group.
EAGLContext *glCtx1 = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
EAGLContext *glCtx2 = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2 sharegroup:glCtx1.sharegroup];
[EAGLContext setCurrentContext:glCtx1];
GLuint fbo1 = 0;
glGenFramebuffers(1, &fbo1);
[EAGLContext setCurrentContext:glCtx2];
GLuint fbo2 = 0;
glGenFramebuffers(1, &fbo2);
assert(fbo1 + 1 == fbo2); // pass
Do you know the reason? Thanks.
Update:
I think I figured it out.
I looked up Apple's documentation, FBOs are shared between contexts of the same group. Apple doesn't seem to follow khronos' specifications exactly.
In addition, I also refer to the stackoverflow discussion, there does not have this inconsistency problem on Android platform.
Hi, Le Hoang Quyen, thank you so much for developing MetalANGLE.
I recently used MetalANGLE in my project, found that multiple egl contexts of the same group don't share FBOs, this is inconsistent with standard OpenGLES.
look at this snippet please:
If you execute this code with MetalANGLE, you'll see that fbo1 and fbo2 are both 1, which is not in line with expectations. If you execute same code with standard OpenGLES, you'll see that fbo1 is 1 and fbo2 are 2.
I read the source code and found some clues here. the 'mFramebufferManager' isn't shared(not using AllocateOrGetSharedResourceManager).
Is this a bug or a feature? If it's a bug, I'd be happy to submit a PR to fix it. If it is a feature, could you please explain the reason.
Thank you again!!