return 1;
}
- static void
- _create_rt_buffers(Render_Engine *data __UNUSED__,
- Render_Engine_GL_Surface *sfc)
+ static int
+ _attach_fbo_surface(Render_Engine *data __UNUSED__,
+ Render_Engine_GL_Surface *sfc,
+ int fbo)
{
- // Render Target texture
- if (sfc->rt_fmt)
- {
- glGenTextures(1, &sfc->rt_tex);
- }
+ int fb_status, curr_tex, curr_rb;
- // First check if packed buffer is to be used.
- if (sfc->rb_depth_stencil_fmt)
- {
+ glBindFramebuffer(GL_FRAMEBUFFER, fbo);
+
+ // Detach any previously attached buffers
+ glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, 0, 0);
+ glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, 0);
+ glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, 0);
#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
- glGenTextures(1, &sfc->rb_depth_stencil);
+ glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, 0, 0);
+ glFramebufferTexture2D(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_TEXTURE_2D, 0, 0);
#else
- glGenRenderbuffers(1, &sfc->rb_depth_stencil);
+ glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, 0);
#endif
- return;
- }
- // Depth RenderBuffer - Create storage here...
- if (sfc->rb_depth_fmt)
- glGenRenderbuffers(1, &sfc->rb_depth);
- // Stencil RenderBuffer - Create Storage here...
- if (sfc->rb_stencil_fmt)
- glGenRenderbuffers(1, &sfc->rb_stencil);
- }
+ // Render Target Texture
+ if (sfc->rt_tex)
+ {
+ curr_tex = 0;
+ glGetIntegerv(GL_TEXTURE_BINDING_2D, &curr_tex);
+ glBindTexture(GL_TEXTURE_2D, sfc->rt_tex );
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, sfc->w, sfc->h, 0,
+ GL_RGBA, GL_UNSIGNED_BYTE, NULL);
+ glBindTexture(GL_TEXTURE_2D, curr_tex);
- static int
- _attach_fbo_surface(Render_Engine *data __UNUSED__,
- Render_Engine_GL_Surface *sfc,
- Render_Engine_GL_Context *ctx)
- {
- int fb_status;
+ // Attach texture to FBO
+ if (sfc->rt_msaa_samples)
+ glsym_glFramebufferTexture2DMultisample(GL_FRAMEBUFFER,
+ GL_COLOR_ATTACHMENT0,
+ GL_TEXTURE_2D, sfc->rt_tex,
+ 0, sfc->rt_msaa_samples);
+ else
+ glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
+ GL_TEXTURE_2D, sfc->rt_tex, 0);
+ }
++<<<<<<< HEAD
+ glBindFramebuffer(GL_FRAMEBUFFER, ctx->context_fbo);
+
+ // Render Target Texture
+ if (sfc->rt_tex)
+ {
+ glBindTexture(GL_TEXTURE_2D, sfc->rt_tex );
++=======
+
+ // Depth Stencil RenderBuffer - Attach it to FBO
+ if (sfc->rb_depth_stencil)
+ {
+ #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
+ curr_tex = 0;
+ glGetIntegerv(GL_TEXTURE_BINDING_2D, &curr_tex);
+ glBindTexture(GL_TEXTURE_2D, sfc->rb_depth_stencil);
++>>>>>>> origin/upstream
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
++<<<<<<< HEAD
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, sfc->w, sfc->h, 0,
+ GL_RGBA, GL_UNSIGNED_BYTE, NULL);
+ glBindTexture(GL_TEXTURE_2D, 0);
+
+ // Attach texture to FBO
+ if (sfc->rt_msaa_samples)
+ glsym_glFramebufferTexture2DMultisample(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, sfc->rt_tex, 0, sfc->rt_msaa_samples);
+ else
+ glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
+ GL_TEXTURE_2D, sfc->rt_tex, 0);
+ }
+
+
+
+
+ // Depth Stencil RenderBuffer - Attach it to FBO
+ if (sfc->rb_depth_stencil)
+ {
+#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
+ glBindTexture(GL_TEXTURE_2D, sfc->rb_depth_stencil);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_STENCIL_OES, sfc->w, sfc->h,
0, GL_DEPTH_STENCIL_OES, GL_UNSIGNED_INT_24_8_OES, NULL);
+ glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
+ GL_TEXTURE_2D, sfc->rb_depth_stencil, 0);
+ glFramebufferTexture2D(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT,
+ GL_TEXTURE_2D, sfc->rb_depth_stencil, 0);
+ glBindTexture(GL_TEXTURE_2D, 0);
+
+#else
++=======
++ glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_STENCIL_OES, sfc->w, sfc->h,
++ 0, GL_DEPTH_STENCIL_OES, GL_UNSIGNED_INT_24_8_OES, NULL);
+ if (sfc->rt_msaa_samples)
+ {
+ glsym_glFramebufferTexture2DMultisample(GL_FRAMEBUFFER,
+ GL_DEPTH_ATTACHMENT,
+ GL_TEXTURE_2D,
+ sfc->rb_depth_stencil,
+ 0, sfc->rt_msaa_samples);
+ glsym_glFramebufferTexture2DMultisample(GL_FRAMEBUFFER,
+ GL_STENCIL_ATTACHMENT,
+ GL_TEXTURE_2D,
+ sfc->rb_depth_stencil,
+ 0, sfc->rt_msaa_samples);
+ }
+ else
+ {
+ glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
+ GL_TEXTURE_2D, sfc->rb_depth_stencil, 0);
+ glFramebufferTexture2D(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT,
+ GL_TEXTURE_2D, sfc->rb_depth_stencil, 0);
+ }
+ glBindTexture(GL_TEXTURE_2D, curr_tex);
+
+ #else
+ curr_rb = 0;
+ glGetIntegerv(GL_RENDERBUFFER_BINDING, &curr_rb);
++>>>>>>> origin/upstream
glBindRenderbuffer(GL_RENDERBUFFER, sfc->rb_depth_stencil);
glRenderbufferStorage(GL_RENDERBUFFER, sfc->rb_depth_stencil_fmt,
sfc->w, sfc->h);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT,
GL_RENDERBUFFER, sfc->rb_depth_stencil);
++<<<<<<< HEAD
+ glBindRenderbuffer(GL_RENDERBUFFER, 0);
++=======
+ glBindRenderbuffer(GL_RENDERBUFFER, curr_rb);
++>>>>>>> origin/upstream
#endif
}
{
ERR("xxxMakeCurrent() finish!");
goto finish;
++<<<<<<< HEAD
++=======
+ }
+
+ // Set the engine surface capability first if it hasn't been set
+ if (!re->gl_cap_initted) _set_gl_surface_cap(re);
+
+ // Check the size of the surface
+ if ( (w > re->gl_cap.max_rb_size) || (h > re->gl_cap.max_rb_size) )
+ {
+ ERR("Surface size greater than the supported size. Max Surface Size: %d", re->gl_cap.max_rb_size);
+ goto finish;
+ }
+
+ // Set the internal config value
+ if (!_set_internal_config(re, sfc, cfg))
+ {
+ ERR("Unsupported Format!");
+ goto finish;
++>>>>>>> origin/upstream
}
- // Create Render texture
- if (!_create_rt_buffers(re, sfc))
+ // Set the engine surface capability first if it hasn't been set
+ if (!re->gl_cap_initted) _set_gl_surface_cap(re);
+
+ // Check the size of the surface
+ if ( (w > re->gl_cap.max_rb_size) || (h > re->gl_cap.max_rb_size) )
{
++<<<<<<< HEAD
+ ERR("Surface size greater than the supported size. Max Surface Size: %d", re->gl_cap.max_rb_size);
+ goto finish;
+ }
++=======
+ ERR("Unable Create Specificed Surfaces. Unsupported format!");
+ goto finish;
+ };
+
+ ret = sfc;
+
+ finish:
++>>>>>>> origin/upstream
+
+ // Set the internal config value
+ if (!_set_internal_config(re, sfc, cfg))
+ {
+ ERR("Unsupported Format!");
+ goto finish;
+ }
+
+ // Create Render texture
+ _create_rt_buffers(re, sfc);
#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
res = eglMakeCurrent(re->win->egl_disp, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
#endif
if (!res)
{
++<<<<<<< HEAD
+ ERR("xxxMakeCurrent() finish!");
+ goto finish;
+ }
+
+ ret = sfc;
+
+finish:
+
++=======
+ ERR("xxxMakeCurrent() (NULL, NULL) Error!");
+ }
+
++>>>>>>> origin/upstream
if (!ret)
{
if (sfc) free(sfc);
(eglGetCurrentSurface(EGL_READ) != re->win->egl_surface[0]) ||
(eglGetCurrentSurface(EGL_DRAW) != re->win->egl_surface[0]) )
{
++<<<<<<< HEAD
++
++ // Flush remainder of what's in Evas' pipeline
++ eng_window_use(NULL);
++
++=======
// Flush remainder of what's in Evas' pipeline
eng_window_use(NULL);
++>>>>>>> origin/upstream
// Do a make current
ret = eglMakeCurrent(re->win->egl_disp, re->win->egl_surface[0],
re->win->egl_surface[0], ctx->context);
if (getenv("EVAS_GL_DIRECT_OVERRIDE"))
{
gl_direct_override = 1;
++<<<<<<< HEAD
+ fprintf(stderr, "########################################################\n");
+ fprintf(stderr, "######### [Evas] Direct overriding is enabled ##########\n");
+ fprintf(stderr, "########################################################\n");
++=======
+ DBG("########################################################");
+ DBG("######### [Evas] Direct overriding is enabled ##########");
+ DBG("########################################################");
++>>>>>>> origin/upstream
}
/* store it for later use */