gles2: Remove the special wrapper for glBindTexture
Previously the GLES2 backend needed a special wrapper for glBindTexture because it needed to know the internal GL format of the texture in order to correctly implement the GL_MODULATE texture env mode. When GL_MODULATE is used then the RGB values are taken from the previous texture layer rather than being fetched from the texture. However since the material API was added Cogl no longer uses the GL_MODULATE texture env mode but instead always uses GL_COMBINE. Compiling the GLES2 backend broke since the more-texture-backends branch merge because the cogl_get_internal_gl_format function was removed and there was one place in GLES2 specific code that was using this to bind the texture.
This commit is contained in:
parent
cb7a99ac69
commit
b583083a3f
7 changed files with 2 additions and 79 deletions
|
@ -1400,9 +1400,6 @@ _cogl_material_flush_layers_gl_state (CoglMaterial *material,
|
|||
CoglHandle tex_handle;
|
||||
GLuint gl_texture;
|
||||
GLenum gl_target;
|
||||
#ifdef HAVE_COGL_GLES2
|
||||
GLenum gl_internal_format;
|
||||
#endif
|
||||
CoglTextureUnit *unit;
|
||||
|
||||
_cogl_material_layer_ensure_mipmaps (layer_handle);
|
||||
|
@ -1460,14 +1457,7 @@ _cogl_material_flush_layers_gl_state (CoglMaterial *material,
|
|||
we'd need to ensure they affect the cache. Also deleting a
|
||||
texture should clear it from the cache in case a new texture
|
||||
is generated with the same number */
|
||||
#ifdef HAVE_COGL_GLES2
|
||||
gl_internal_format = _cogl_texture_get_internal_gl_format (tex_handle);
|
||||
cogl_gles2_wrapper_bind_texture (gl_target,
|
||||
gl_texture,
|
||||
gl_internal_format);
|
||||
#else
|
||||
GE (glBindTexture (gl_target, gl_texture));
|
||||
#endif
|
||||
|
||||
/* XXX: Once we add caching for glBindTexture state, these
|
||||
* checks should be moved back up to the top of the loop!
|
||||
|
|
|
@ -847,9 +847,8 @@ _cogl_texture_2d_sliced_slices_create (CoglTexture2DSliced *tex_2ds,
|
|||
y_span->size - y_span->waste);
|
||||
|
||||
/* Setup texture parameters */
|
||||
GE( _cogl_texture_driver_bind (tex_2ds->gl_target,
|
||||
gl_handles[y * n_x_slices + x],
|
||||
gl_intformat) );
|
||||
GE( glBindTexture (tex_2ds->gl_target,
|
||||
gl_handles[y * n_x_slices + x] ) );
|
||||
|
||||
_cogl_texture_driver_try_setting_gl_border_color (tex_2ds->gl_target,
|
||||
transparent_color);
|
||||
|
|
|
@ -33,13 +33,6 @@ void
|
|||
_cogl_texture_driver_gen (GLenum gl_target,
|
||||
GLsizei n,
|
||||
GLuint *textures);
|
||||
/*
|
||||
* Basically just a wrapper around glBindTexture, but the GLES2 backend
|
||||
* for example also wants to know about the internal format so it can
|
||||
* identify when alpha only textures are bound.
|
||||
*/
|
||||
void
|
||||
_cogl_texture_driver_bind (GLenum gl_target, GLuint gl_handle, GLenum gl_intformat);
|
||||
|
||||
/*
|
||||
* This sets up the glPixelStore state for an upload to a destination with
|
||||
|
|
|
@ -74,14 +74,6 @@ _cogl_texture_driver_gen (GLenum gl_target,
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
_cogl_texture_driver_bind (GLenum gl_target,
|
||||
GLuint gl_handle,
|
||||
GLenum gl_intformat)
|
||||
{
|
||||
GE (glBindTexture (gl_target, gl_handle));
|
||||
}
|
||||
|
||||
/* OpenGL - unlike GLES - can upload a sub region of pixel data from a larger
|
||||
* source buffer */
|
||||
static void
|
||||
|
@ -149,8 +141,6 @@ _cogl_texture_driver_upload_subregion_to_gl (GLenum gl_target,
|
|||
src_y,
|
||||
bpp);
|
||||
|
||||
/* We don't need to use _cogl_texture_driver_bind here because we're
|
||||
not using the bound texture to render yet */
|
||||
GE( glBindTexture (gl_target, gl_handle) );
|
||||
|
||||
GE( glTexSubImage2D (gl_target, 0,
|
||||
|
@ -174,8 +164,6 @@ _cogl_texture_driver_upload_to_gl (GLenum gl_target,
|
|||
/* Setup gl alignment to match rowstride and top-left corner */
|
||||
prep_gl_for_pixels_upload_full (source_bmp->rowstride, 0, 0, bpp);
|
||||
|
||||
/* We don't need to use _cogl_texture_driver_bind here because we're
|
||||
not using the bound texture to render yet */
|
||||
GE( glBindTexture (gl_target, gl_handle) );
|
||||
|
||||
GE( glTexImage2D (gl_target, 0,
|
||||
|
|
|
@ -1337,28 +1337,6 @@ cogl_wrap_glDrawElements (GLenum mode, GLsizei count, GLenum type,
|
|||
glDrawElements (mode, count, type, indices);
|
||||
}
|
||||
|
||||
void
|
||||
cogl_gles2_wrapper_bind_texture (GLenum target, GLuint texture,
|
||||
GLenum internal_format)
|
||||
{
|
||||
_COGL_GET_GLES2_WRAPPER (w, NO_RETVAL);
|
||||
|
||||
glBindTexture (target, texture);
|
||||
|
||||
/* We need to keep track of whether the texture is alpha-only
|
||||
because the emulation of GL_MODULATE needs to work differently in
|
||||
that case */
|
||||
if (COGL_GLES2_TEXTURE_UNIT_IS_ALPHA_ONLY (w->settings.texture_units,
|
||||
w->active_texture_unit)
|
||||
!= (internal_format == GL_ALPHA))
|
||||
{
|
||||
COGL_GLES2_TEXTURE_UNIT_SET_ALPHA_ONLY (w->settings.texture_units,
|
||||
w->active_texture_unit,
|
||||
internal_format == GL_ALPHA);
|
||||
w->settings_dirty = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
cogl_wrap_glTexEnvi (GLenum target, GLenum pname, GLint param)
|
||||
{
|
||||
|
|
|
@ -55,14 +55,10 @@ typedef struct _CoglGles2WrapperShader CoglGles2WrapperShader;
|
|||
/* Accessors for the texture unit bit mask */
|
||||
#define COGL_GLES2_TEXTURE_UNIT_IS_ENABLED(mask, unit) \
|
||||
(((mask) & (1 << ((unit) * 2))) ? TRUE : FALSE)
|
||||
#define COGL_GLES2_TEXTURE_UNIT_IS_ALPHA_ONLY(mask, unit) \
|
||||
(((mask) & (1 << ((unit) * 2 + 1))) ? TRUE : FALSE)
|
||||
#define COGL_GLES2_SET_BIT(mask, bit, val) \
|
||||
((val) ? ((mask) |= (1 << (bit))) : ((mask) &= ~(1 << (bit))))
|
||||
#define COGL_GLES2_TEXTURE_UNIT_SET_ENABLED(mask, unit, val) \
|
||||
COGL_GLES2_SET_BIT ((mask), (unit) * 2, (val))
|
||||
#define COGL_GLES2_TEXTURE_UNIT_SET_ALPHA_ONLY(mask, unit, val) \
|
||||
COGL_GLES2_SET_BIT ((mask), (unit) * 2 + 1, (val))
|
||||
|
||||
#define COGL_GLES2_MAX_TEXTURE_UNITS (sizeof (guint32) * 8 / 2)
|
||||
|
||||
|
@ -379,9 +375,6 @@ void cogl_wrap_glDrawElements (GLenum mode, GLsizei count, GLenum type,
|
|||
const GLvoid *indices);
|
||||
void cogl_wrap_glTexParameteri (GLenum target, GLenum pname, GLfloat param);
|
||||
|
||||
void cogl_gles2_wrapper_bind_texture (GLenum target, GLuint texture,
|
||||
GLenum internal_format);
|
||||
|
||||
void cogl_wrap_glMaterialfv (GLenum face, GLenum pname, const GLfloat *params);
|
||||
|
||||
/* This function is only available on GLES 2 */
|
||||
|
@ -430,11 +423,6 @@ void _cogl_gles2_clear_cache_for_program (CoglHandle program);
|
|||
|
||||
#else /* HAVE_COGL_GLES2 */
|
||||
|
||||
/* The extra third parameter of the bind texture wrapper isn't needed
|
||||
so we can just directly call glBindTexture */
|
||||
#define cogl_gles2_wrapper_bind_texture(target, texture, internal_format) \
|
||||
glBindTexture ((target), (texture))
|
||||
|
||||
/* COGL uses the automatic mipmap generation for GLES 1 so
|
||||
glGenerateMipmap doesn't need to do anything */
|
||||
#define cogl_wrap_glGenerateMipmap(x) ((void) 0)
|
||||
|
|
|
@ -74,15 +74,6 @@ _cogl_texture_driver_gen (GLenum gl_target,
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_cogl_texture_driver_bind (GLenum gl_target,
|
||||
GLuint gl_handle,
|
||||
GLenum gl_intformat)
|
||||
{
|
||||
GE (cogl_gles2_wrapper_bind_texture (gl_target, gl_handle, gl_intformat));
|
||||
}
|
||||
|
||||
void
|
||||
_cogl_texture_driver_prep_gl_for_pixels_upload (int pixels_rowstride,
|
||||
int pixels_bpp)
|
||||
|
@ -140,8 +131,6 @@ _cogl_texture_driver_upload_subregion_to_gl (GLenum gl_target,
|
|||
slice_bmp.width,
|
||||
slice_bmp.height);
|
||||
|
||||
/* We don't need to use _cogl_texture_driver_bind here because we're
|
||||
not using the bound texture to render yet */
|
||||
GE( glBindTexture (gl_target, gl_handle) );
|
||||
|
||||
GE( glTexSubImage2D (gl_target, 0,
|
||||
|
@ -186,8 +175,6 @@ _cogl_texture_driver_upload_to_gl (GLenum gl_target,
|
|||
_cogl_texture_driver_prep_gl_for_pixels_upload (bmp.rowstride,
|
||||
bpp);
|
||||
|
||||
/* We don't need to use _cogl_texture_driver_bind here because we're
|
||||
not using the bound texture to render yet */
|
||||
GE( glBindTexture (gl_target, gl_handle) );
|
||||
|
||||
GE( glTexImage2D (gl_target, 0,
|
||||
|
|
Loading…
Reference in a new issue