* clutter/cogl/gles/cogl-gles2-wrapper.h:

* clutter/cogl/gles/cogl-gles2-wrapper.c:
	Initialise the 'tex' sampler uniform to 0. The GLSL spec
	specifically says that you must initialize sampler uniforms. This
	fixes texturing for GLES 2 when using the PowerVR simulator via
	software Mesa.
This commit is contained in:
Neil Roberts 2008-11-13 14:44:27 +00:00
parent 3d2a1e2d81
commit 0ae150e462
3 changed files with 20 additions and 1 deletions

View File

@ -1,3 +1,12 @@
2008-11-13 Neil Roberts <neil@linux.intel.com>
* clutter/cogl/gles/cogl-gles2-wrapper.h:
* clutter/cogl/gles/cogl-gles2-wrapper.c:
Initialise the 'tex' sampler uniform to 0. The GLSL spec
specifically says that you must initialize sampler uniforms. This
fixes texturing for GLES 2 when using the PowerVR simulator via
software Mesa.
2008-11-13 Robert Bragg <robert@linux.intel.com> 2008-11-13 Robert Bragg <robert@linux.intel.com>
Gets the mesh API working with GLES2 Gets the mesh API working with GLES2

View File

@ -453,6 +453,9 @@ cogl_gles2_wrapper_get_uniforms (GLuint program,
uniforms->alpha_test_ref_uniform uniforms->alpha_test_ref_uniform
= glGetUniformLocation (program, "alpha_test_ref"); = glGetUniformLocation (program, "alpha_test_ref");
uniforms->texture_unit_uniform
= glGetUniformLocation (program, "texture_unit");
} }
void void
@ -885,6 +888,10 @@ cogl_wrap_glDrawArrays (GLenum mode, GLint first, GLsizei count)
glUniform1f (program->uniforms.alpha_test_ref_uniform, glUniform1f (program->uniforms.alpha_test_ref_uniform,
w->alpha_test_ref); w->alpha_test_ref);
if ((w->dirty_uniforms & COGL_GLES2_DIRTY_TEXTURE_UNIT)
&& program->uniforms.texture_unit_uniform != -1)
glUniform1i (program->uniforms.texture_unit_uniform, 0);
w->dirty_uniforms = 0; w->dirty_uniforms = 0;
} }

View File

@ -54,8 +54,9 @@ enum
COGL_GLES2_DIRTY_FOG_END = 1 << 5, COGL_GLES2_DIRTY_FOG_END = 1 << 5,
COGL_GLES2_DIRTY_FOG_COLOR = 1 << 6, COGL_GLES2_DIRTY_FOG_COLOR = 1 << 6,
COGL_GLES2_DIRTY_ALPHA_TEST_REF = 1 << 7, COGL_GLES2_DIRTY_ALPHA_TEST_REF = 1 << 7,
COGL_GLES2_DIRTY_TEXTURE_UNIT = 1 << 8,
COGL_GLES2_DIRTY_ALL = (1 << 8) - 1 COGL_GLES2_DIRTY_ALL = (1 << 9) - 1
}; };
struct _CoglGles2WrapperUniforms struct _CoglGles2WrapperUniforms
@ -71,6 +72,8 @@ struct _CoglGles2WrapperUniforms
GLint fog_color_uniform; GLint fog_color_uniform;
GLint alpha_test_ref_uniform; GLint alpha_test_ref_uniform;
GLint texture_unit_uniform;
}; };
struct _CoglGles2WrapperSettings struct _CoglGles2WrapperSettings