1
0
Fork 0
Commit graph

4 commits

Author SHA1 Message Date
Neil Roberts
1d3d1732bd Fixes for building with --disable-gl
This fixes a few problems that occur when only using a GLES2 header.

• The use of GL_CLAMP_TO_BORDER and GL_MIRRORED_REPEAT were moved from
  cogl-pipelinelayer-state.h to cogl-sampler-cache-private.h but the
  corresponding defines were not.

• cogl-sampler-cache.c was using GL_TEXTURE_WRAP_R but this is only
  defined as GL_TEXTURE_WRAP_R_OES from the GLES2 header so it needs a
  #define.

• cogl-framebuffer-private.h uses GLuint but it does not include
  cogl-gl-header.h. It gets away with this when GLX support is enabled
  because the GL header would be included via glx.h.

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit 9cdb87c864fc262c4b26c13963670d60d7c18058)
2012-08-06 14:27:41 +01:00
Neil Roberts
6400b455b8 Don't include any GL header from the public GL headers
This splits the GL header inclusion from cogl-defines.h into a
separate headear called cogl-gl-header.h which we will only include
internally. That way we don't leak GL declarations out of our public
headers. The texture functions that were using GLenum and GLuint in
the public header have now changed to just use unsigned int. Note
however that if an EGL winsys is enabled then it will still publicly
include an EGL header. This is a bit more awkward to fix because we
have public API which returns an EGLDisplay and we can't determine
what type that is.

There is also a conformance test which just verifies that no GL header
has been included while compiling. The test isn't added to
test-conform-main because it doesn't actually test anything at
runtime.

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit ef5680d3fda5df929dbd0b420c8f598ded58dfee)
2012-08-06 14:27:38 +01:00
Neil Roberts
f676785906 Fix including a non-existent header
cogl-sampler-cache-private.h was including a header which doesn't
exist so the build was broken. The header comes from a patch which
hasn't been pushed to master yet which splits including GL/gl.h out of
cogl-defines.h into a separate header. I added the inclusion to make
it pick up the GL defines but it doesn't need to do this yet because
cogl-context.h is still including the GL header. I didn't notice the
failure because I still had a cogl-gl-header.h lying around from a
previous build with the patch.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2012-04-05 15:35:01 +01:00
Neil Roberts
c33ce5fc6b Use GL_ARB_sampler_objects
GL_ARB_sampler_objects provides a GL object which overrides the
sampler state part of a texture object with different values. The
sampler state that Cogl currently exposes is the wrap modes and
filters. Cogl exposes the state as part of the pipeline layer state
but without this extension GL only exposes it as part of the texture
object state. This means that it won't work to use a single texture
multiple times in one primitive with different sampler states. It also
makes switching between different sampler states with a single texture
not terribly efficient because it has to change the texture object
state every time.

This patch adds a cache for sampler states in a shared hash table
attached to the CoglContext. The entire set of parameters for the
sampler state is used as the key for the hash table. When a unique
state is encountered the sampler cache will create a new entry,
otherwise it will return a const pointer to an existing entry. That
means we can have a single pointer to represent any combination of
sampler state.

Pipeline layers now just store this single pointer rather than storing
all of the sampler state. The two separate state flags for wrap modes
and filters have now been combined into one. It should be faster to
compare the sampler state now because instead of comparing each value
it can just compare the pointers to the cached sampler entries. The
hash table of cached sampler states should only need to perform its
more expensive hash on the state when a property is changed on a
pipeline, not every time it is flushed.

When the sampler objects extension is available each cached sampler
state will also get a sampler object to represent it. The common code
to flush the GL state will now simply bind this object to a unit
instead of flushing the state though the CoglTexture when possible.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2012-04-05 13:47:36 +01:00