Commit Graph

368 Commits

Author SHA1 Message Date
Avi Levin fa8f786d44 back 2015-03-16 15:55:32 +02:00
Jean-Philippe Andre 03ab2e27c8 Evas GL common: Create OpenGL ES 3.x contexts by default
Automatically fallback to OpenGL ES 2.0 if OpenGL ES 3 is not supported.
This is a first step in trying to support GLES 3 for Evas GL.

This commit is also a wild test to see whether using GLES 3 contexts
by default will break anything. The theory says that GLES 3 is
backwards compatible with GLESv2.

So, if anything GL breaks for you... scream loudly!
But before reporting any bugs, please set the env variable:
- export EVAS_GL_DISABLE_GLES3=1

This does not add any requirement for GLESv3 support.
2015-03-05 20:59:53 +09:00
Jean-Philippe Andre 611741e65d Evas GL: Fix list of extensions with GLESv1
EGL/EvasGL extensions are also valid with GLESv1.
This means evasglCreateImage could be used.

@fix
2015-03-05 20:59:50 +09:00
Jean-Philippe Andre fecc487b3b Evas GL: Fix CRI message on shutdown
Just a simple log domain issue (EvasGL was not initialized, so
ERR() would trigger a fatal error). EvasGL is now initialized
on demand when a new GL surface is requested.
2015-03-05 16:19:18 +09:00
Jean-Philippe Andre f020171bf2 Evas GL common: Disable evas gl preload by default
Unfortunately, this "feature" has many problems and does not really
fix those it was supposed to address:

- Elm Photocam becomes horrible to use (the transition from
  low-res to high-res tiles triggers this miniature path).

- Evas async preload callback is called before the full image
  is ready (ie. the texture is not uploaded yet), when really
  the preload callback should be triggered only once the image
  is 100% ready. (TODO)

- Sometimes the miniature image keeps being used even though the
  main image has been uploaded (eg. with E background). Maybe the
  object image is not redrawn when it should.

- This uses a separate thread for the upload, which is both a good
  and bad idea because we need to do a make current. Also, this does
  not upload the full-res image tile by tile, but only in one pass,
  thus blocking the render loop until finished.

This patch changes the env var from "EVAS_GL_NOPRELOAD" to
"EVAS_GL_PRELOAD" (and only "1" will enable).

Sorry Cedric, we can talk later about how to improve this.
2015-03-04 17:31:31 +09:00
Jean-Philippe Andre 53d3cb4fec Evas GL common: Improve quality of miniature image
Sample in the middle of the "macro pixels" and fool around with the
borders (usually used to limit linear sampling artifacts) to improve
image quality on the edges.

Those miniatures are still 16x16 but MAAAYYYYYBE they will look a bit
less awful.

NOTE: The first row still doesn't scale properly (interpolates with
      garbage above y=0).
2015-03-04 17:31:07 +09:00
Jean-Philippe Andre b19d3599a5 Evas GL common: Force smooth scaling on miniature images
When evas GL uploads textures, it will first upload a 16x16 miniature
image, and then wait for some idle time in the main loop to upload the
high-res image.

Some images may not have smooth scaling enabled which results in the
miniature scaled with GL_NEAREST, showing big ugly squares. Let's
force smooth scaling instead, for a blur image rather than a
checkerboard.
2015-03-04 15:27:21 +09:00
Jean-Philippe Andre be3b011822 Evas GL: Fix build error on some systems w/o Wayland
Thanks Mythri for the report.
wl_display and wl_resource is declared in eglmesaext.h but older
systems may not have that.
2015-03-03 20:57:59 +09:00
Jean-Philippe Andre bea9567d0e Evas GL: Kill runtime warnings caused by auto fallback
The previous commit modifies the concept of direct rendering
vs. indirect rendering, so some runtime checks (in debug mode
only) will fail.

This commit introduces two new engine functions:
 - gl_get_pixels_pre
 - gl_get_pixels_post

The latter will be used in a later patch for optimization.
2015-03-03 20:08:16 +09:00
Jean-Philippe Andre a14492ef73 Evas GL: Automatic fallback to indirect rendering when the scene has
not changed.

Automatically fallback to indirect rendering on FBO or X11 Pixmap
if the Evas Object Image is not marked as dirty. This should
improve the performance and/or power consumption in those
rare cases where this area of the canvas needs to be redrawn
but the GL content has not changed.

@feature
2015-03-03 18:11:32 +09:00
Jean-Philippe Andre 21051d3252 Evas masking: Use mask_smooth to differentiate "shaders"
If mask_smooth changes, it should trigger a flush of
the pipeline (and call glDrawArrays).

This may or may not fix some potential bugs with masking.
2015-03-02 20:47:17 +09:00
Jean-Philippe Andre e531ab9bc0 Evas GL: Use Eina_Strbuf for the extensions list
The usage of strcat/strncat was not safe, and even Coverity reported
about it.

Fixes CID 1256197:
CID 1256197 (#1 of 2): Buffer not null terminated (BUFFER_SIZE_WARNING)
1. buffer_size_warning: Calling strncpy with a maximum size argument
of 10240 bytes on destination array _gl_ext_string of size 10240 bytes
might leave the destination string unterminated.
2015-03-02 19:51:30 +09:00
Minkyoung Kim de797bbd3b Evas GL: Fix abnormal extension name.
Summary: Fix abnormal extension name.

Test Plan: local test.

Reviewers: jpeg

Reviewed By: jpeg

Subscribers: wonsik, cedric, spacegrapher

Differential Revision: https://phab.enlightenment.org/D2056

Signed-off-by: Jean-Philippe Andre <jp.andre@samsung.com>
2015-03-02 16:20:07 +09:00
Dongyeon Kim a32edfaf19 evas/gl: implement dynamic hint set using tbm surface
Summary:
Currently dynamic hint set is implemented using eglMapImageSEC extension,
which is no longer supported by any drivers (should be deprecated)
This patch implements dynamic hint set using Khronos extension EGL_TIZEN_image_native_surface.
Since tbm surface library is required for this, libtbm.so is queried at context new.

Test Plan: Local tests

Reviewers: raster, Hermet, cedric, jpeg

Subscribers: mer.kim, wonsik, cedric

Differential Revision: https://phab.enlightenment.org/D2027

Signed-off-by: Jean-Philippe Andre <jp.andre@samsung.com>

jpeg: I also fixed a few minor style issues and two warnings (bad function
names, glsym instead of secsym).
2015-03-02 15:55:47 +09:00
Jean-Philippe Andre 433d24cfa0 Evas GL common: Remove uniform-related stuff
Remove last traces of the uniforms stuff for shaders, that was
removed in the following commits: 6b48c106d3 and cfd337a758.

Don't use uniforms in the evas GL pipeline, at least not like that.
2015-03-02 11:30:34 +09:00
Jean-Philippe Andre ab89dc401c Evas masking: Check fill properties to consider image as filled
Edje may not set the filled flag on an image even if its fill
properties make it fill the whole object. For masking, it can
then be considered as a filled image.
2015-02-27 15:57:36 +09:00
Jean-Philippe Andre 87aed21c05 Evas masking: Remove commented-out code
I shouldn't have pushed this :)
2015-02-27 14:11:59 +09:00
Jean-Philippe Andre 0da6278af8 Evas masking: Fix masking of maps in GL
This completes the transition to auto-scaled mask images when
using the GL engine. Now the shaders do the work on-the-fly of
resizing the mask.
2015-02-27 13:06:09 +09:00
Jean-Philippe Andre fab0d7f9d3 Evas masking: Simplify previous commit
Call object's function to get the private engine_data (here, the
image object). Thanks Dongyeon for your patch which inspired me to
do that instead of forcing pre_render.
2015-02-27 13:06:09 +09:00
Jean-Philippe Andre fddaf62fcc Evas masking: Add fast path for image-only masks in GL.
This will currently optimize most of the masks when using the
GL engine[1].

This is a very special case that adds a highly optimized path
for masking in GL. It works by creating a virtual image, containing
a pointer to the original image and a new geometry[2].

Instead of creating a new FBO-based surface (image_map_surface),
we refer to the original image and adjust the mask geometry on
the fly.

KNOWN BUGS:
- masking a map with such a scaled image is now broken.

[1] Right now all masks are simple Evas Object Image, so that means
    all cases of masking, except masks of masks, or masks of maps,
    will be optimized with this new method.

[2] This virtual image mechanism is still quite hackish and may
    be improved (for memory usage, refcounting, etc...)
2015-02-27 13:06:09 +09:00
Jean-Philippe Andre b815f57078 Evas masking: Simplify map masking shaders.
Use vertex shader for all coordinates computations.
This reduces the number of varyings used.
2015-02-26 17:49:21 +09:00
Jean-Philippe Andre 964d6e559f Evas GL: Fix leak of surfaces with GLES 1.1
When destroying a GLES 1.1 surface, it is necessary to also
destroy and remove the main surface from the list.

This issue probably never really showed up because people
don't:
- use GLES 1.1
- constantly create & destroy new Evas GL surfaces
- but mostly no one cares about 1.1 anymore :)

@fix
2015-02-25 15:01:45 +09:00
Jean-Philippe Andre 29da1113ee Evas GL: Restore viewport and scissor test for GLESv1
This is necessary when switching back to direct rendering.
But I suspect there are other corner cases that we didn't spot.
2015-02-24 22:18:53 +09:00
Jean-Philippe Andre ae2061dbe2 Evas GL: Fix support for GLES 1.1 indirect rendering
This requires a special context that matches the configuration
required for GLES 1.1. Otherwise eglMakeCurrent() would fail
miserably with EGL_BAD_MATCH in case of indirect rendering
(at least on some drivers).
2015-02-24 22:12:00 +09:00
Minkyoung Kim 9a0f591314 Evas GL: Wrap glGetString() for gles1.x.
Summary:
- Implement glGetString() wrapper func in the same way as gles2.x.
- Small bug fix glGetString() for gles2.x.

Reviewers: cedric, raster, jpeg

Subscribers: cedric, mythri, wonsik, spacegrapher

Differential Revision: https://phab.enlightenment.org/D2033
2015-02-24 22:12:00 +09:00
Jean-Philippe Andre 93d167ac87 Evas GL: Add hidden config values for direct rendering options
Those 2 new values are here to avoid using environment variables
that have side effects on the whole application.

I'm actually wondering if we shouldn't just kill off the env
vars altogether. Also, direct override is a terrible option that
should never be used.
Memory optimization can make sense (needs more testing tho).
2015-02-24 22:12:00 +09:00
Minkyoung Kim 65775c2e04 Evas GL:Add evasgl extension macro '_EVASGL_EXT_DRVNAME_PRIVATE'.
Summary:
To distinguish supported extension name from not supported.
This patch can be solution to the problem, glGetString() returns non-supported extention name.

Test Plan: Local tests

Reviewers: raster, jpeg, Hermet, cedric

Subscribers: cedric, spacegrapher, wonsik

Differential Revision: https://phab.enlightenment.org/D1981

Signed-off-by: Jean-Philippe Andre <jp.andre@samsung.com>
2015-02-24 13:57:17 +09:00
Dmytro Dadyka 1b142d09d9 evas: Evas_3D - add parallax occlusion shading.
Reviewers: Hermet, cedric

Reviewed By: cedric

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D2018
2015-02-23 15:46:25 +01:00
Dmytro Dadyka 49f350d046 evas: Evas_3D - add texture units count checking.
Reviewers: cedric

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D2023

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-02-23 15:41:37 +01:00
mythri.venugopal 88fc0e0568 Evas GL: Fix issues in gles extensions initialisation
Summary:
Fix 1- If extension is not listed in GL_EXTENSIONS, do not try
to get the function address of the extension functions.
Fix 2- For GL_EXT_robustness, for GLESv1 version, do not try to
export glGetnUniformXXX functions.

Reviewers: jpeg

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D1965

Signed-off-by: Jean-Philippe Andre <jp.andre@samsung.com>
2015-02-23 21:21:28 +09:00
Cedric BAIL b115fe108d evas: apparently some configuration can't generate this file correctly, so putting it in. 2015-02-19 23:48:52 +01:00
Dmytro Dadyka b9b5ced501 evas: Evas_3D - refactor shader system.
Reviewers: Hermet, raster, jpeg, cedric

Subscribers: artem.popov, cedric

Differential Revision: https://phab.enlightenment.org/D1947

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-02-18 22:42:07 +01:00
Minkyoung Kim c972994e01 evas: Evas GL - add glGetError() after surface capability test.
Summary:
After using gl funcs, must call glGetError().
To prevent wrong error catch for subsequent glGetError().

Test Plan: Local tests

Reviewers: raster, jpeg, Hermet, cedric

Reviewed By: cedric

Subscribers: spacegrapher, wonsik, cedric

Differential Revision: https://phab.enlightenment.org/D1978

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-02-16 11:54:27 +01:00
Jean-Philippe Andre 6b48c106d3 Revert "Evas GL: Add support for uniforms in the shaders"
This reverts commit 21d08f86e6.
2015-02-12 15:18:19 +09:00
Jean-Philippe Andre cfd337a758 Revert "Evas GL common: Use uniform instead of attribute for sample"
This reverts commit 986b60eaf0.
Added PUSH_SAMPLE for simplicity.

It was dumb of me to use uniforms, so I added a comment to prevent
other dumb people from making the same mistake later.
2015-02-12 15:01:39 +09:00
Jean-Philippe Andre 651f0ae241 Evas GL common: Improve code readability (simplify macro)
The exact same ugly macro would appear hundreds of times in the GL
code:
  GLERR(__FUNCTION__, __FILE__, __LINE__, "");

Instead, override the common GL functions iif GL_ERRORS is defined.
This greatly simplifies code and removes tons of useless lines.
Also, this will give better debugging output as the exact code line
is printed, and the function name is also printed.

Also, fix linking to the glerr function.

This is a code cleanup. Hopefully I didn't break anything with this
big operation of find & replace.
2015-02-12 11:23:03 +09:00
Jean-Philippe Andre 9eaadb2eb7 Evas GL common: Simplify GL pipe code with macros
A lot of the code was just brutal copy & paste.
Reduced by using simpler macros, which I believe are even
more readable.
2015-02-12 11:23:03 +09:00
Jean-Philippe Andre 7e26c30522 Evas GL common: Call glGetUniformLocation as early as possible
This should speed up setting uniforms in the shaders, by storing
their locations in the Evas_GL_Program description.

I kept the previous solution with name as fallback, but it won't
actually be used with the current shaders.
2015-02-12 11:23:03 +09:00
Jean-Philippe Andre 986b60eaf0 Evas GL common: Use uniform instead of attribute for sample
Image and texture programs "12", "21" and "22" used tex_sample
as a texture attribute passed to the vertex shader. Instead of
this seemingly hackish solution, use a vec2 uniform.
2015-02-12 11:23:03 +09:00
Jean-Philippe Andre b643dabc36 Evas masking: Force BLEND mode in case of image masking (GL)
This fixes some cases where the image has no alpha and COPY mode
is used, but a mask is also applied. In that case, masking
takes precedence and BLEND mode is used.

@fix
2015-02-10 18:18:05 +09:00
Dongyeon Kim 72f3e684d9 evas/gl_x11: introduce tbm native surface type
Summary:
This native surface type is based on the tbm surface used for the tizen platform.
EGL_TIZEN_image_native_surface EGL extension is used to map
tbm surface to an egl image
@feature

Reviewers: raster, cedric, jpeg

Subscribers: cedric, wonsik

Signed-off-by: Jean-Philippe Andre <jp.andre@samsung.com>
2015-02-10 14:48:22 +09:00
Jean-Philippe Andre 5df768a43a Evas 3d: Fix compilation with EGL/GLES
Please verify this. I'm not sure what the function is supposed
to return (alpha or red?).
2015-02-10 12:00:37 +09:00
Jean-Philippe Andre 21d08f86e6 Evas GL: Add support for uniforms in the shaders
This will simplify greatly the code for map masking.
2015-02-10 12:00:37 +09:00
Oleksandr Shcherbina 00c2451656 evas: Evas_3D - ColorPick mechanism finding node and mesh in scene.
Summary:
Added additional texture and framebuffer for rendering meshes to it.
Added function that return OpenGL id additional texture
Added function that return color from target texture by mouse pick coordinates
Added function that render need meshes to target texture
Added engine wrappers for possibility force render to texture

@feature

Reviewers: Hermet, raster, cedric

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D1811

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-02-09 22:03:26 +01:00
Carsten Haitzler e54af4291f evas - gl engine - pipe renderer - disabling of unused arrays for lines
@fix - this fixes disabling of unused texa and texsam arays when line
drawing - spotted in code review and bug hunting of another bug.
2015-02-10 02:30:10 +09:00
Carsten Haitzler 2ca0756ad6 evas - gl enigne - mask logic fix with texa draw arrays
this fixes a logic oops in addition of masking to evas which caused
crashes with a null texa array causing a crash in gldrawarrays
2015-02-10 02:30:10 +09:00
mythri.venugopal 48d8cdb4dd Evas GL: Fix GLES1.1 extension initialisation bug
Summary:
Extension function pointer initialisation requires glGetString(GL_EXTENSIONS).
To get GLESv1 extension string, GLESv1 context has to be bound.
Change involves updating extensions after GLESv1 context has been bound.

Reviewers: jpeg

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D1946

Signed-off-by: Jean-Philippe Andre <jp.andre@samsung.com>
2015-02-09 14:28:16 +09:00
Jean-Philippe Andre 88e5369eee Evas masking: Add forgotten file in previous commit 2015-02-06 12:35:12 +09:00
Jean-Philippe Andre 73b16a4962 Evas masking: Also fix map masking with non-bgra images 2015-02-06 12:33:29 +09:00
Jean-Philippe Andre 7d6bb7fe5a Evas masking: Fix GL masking with maps and stuff
This fixes an issue spotted after the previous fix.
Passing the Y-invert flag is necessary because in the usual
case a map is rendered with Y-invert (OpenGL coords vs. Evas coords)
but in case a map is rendered in an FBO (another map's surface)
then Y-invert must be unset.
2015-02-05 22:31:35 +09:00