The ‘builtin uniforms’ are added to the GLSL code generated for the
GLES2 driver to implement missing fixed functionality such as the
builtin point sprite size and the alpha test reference. Previously the
code that accessed these was #ifdef'd to be compiled only when GLES2
was enabled. However since 2701b93f part of this code is now always
used even for non-GLES2 drivers. The code that accessed the builtin
uniforms array was however no longer #ifdef'd which meant that it
wouldn't compile any more if GLES2 was not enabled. This was further
broken becase the GL3 driver actually should be using the alpha test
uniform because that also does not provide any fixed functionality for
alpha testing.
To fix this the builtin uniform array is now always compiled in and
the code to access it is always used. A new member has been added to
the array to mark which private feature the uniform is used to
replace. That is checked before updating the uniform so that under
GLES2 it will update both uniforms but under GL3 it will only update
the alpha test reference.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
(cherry picked from commit 5469a25413883080df75a80153accf5d9124f716)
Since we used to support hybrid fixed-function + glsl pipelines when
running with OpenGL there were numerous differences in how we handled
codegen and uniform updates between GLES2 and full OpenGL. Now that we
only support end-to-end glsl pipelines this patch can largely unify how
we handle GLES2 and OpenGL.
Most notably we now never use the builtin attribute names. This should
also make it easy for us to support creating strict OpenGL 3.1 contexts
where the builtin names have been removed.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 2701b93f159bf2d3387cedf2d06fe921ad5641f3)
This adds a new "fixed-arbfp" progend so we now have 3 distinct ways of
setting up the state of a pipeline:
» fixed; where the vertex and fragment processing are implemented
using fixed function opengl apis.
» fixed-arbfp; where vertex processing is implemented using fixed
function opengl apis but fragment processing is implemented
using the ARB Fragment Processing language.
» glsl; there vertex and fragment processing are both implemented
using glsl.
This means we avoid unusual, combinations such as glsl for vertex
processing and arbfp for fragment processing, and also avoid pairing
fixed-function vertex processing with glsl fragment processing which we
happen to know hits some awkward code paths in Mesa that lead to poor
performance.
As part of this change, the progend now implies specific vertend and
fragend choices so instead of associating a vertend and fragend with a
pipeline we now just associate a progend choice.
When flushing a pipeline and choosing what progend to use, we now call a
progend->start() method that is able to determine if the vertend and
fragend together will be able to handle the given pipeline so the
vertend and fragend ->start() methods no longer need to return a boolean
status.
Since we now don't need to support glsl used in conjunction with fixed
function this will allow us to avoid ever using OpenGL builtin attribute
names, though this patch doesn't change that yet.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit cec381f50c7a2f2186bd4a8c5f38fecd5f099075)
As part of an effort towards being able to write non-opengl based
backends for Cogl this moves most of the opengl specific code under
drivers/gl. drivers/gl and drivers/gles have been moved to
drivers/gl/gl and drivers/gl/es respectively.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 7dc482facb0a265c7f48660079e7e12dd7a2813e)