[cogl/wip/rib/cogl-1.12: 95/139] Fix point sprite coordinates in shaders on GLES2
- From: Robert Bragg <rbragg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cogl/wip/rib/cogl-1.12: 95/139] Fix point sprite coordinates in shaders on GLES2
- Date: Wed, 15 Aug 2012 13:11:25 +0000 (UTC)
commit 2ae352b0a6cef8c00fb1d0098701d22d736a06fe
Author: Neil Roberts <neil linux intel com>
Date: Mon Jul 2 14:23:10 2012 +0100
Fix point sprite coordinates in shaders on GLES2
When using the GLES2 driver with a pipeline layer that has point
sprite coordinates enabled it extracts the texture coordinates from
the gl_PointCoord builtin instead of cogl_tex_coord_in[*].
gl_PointCoord is not quite the same as the regular texture coordinates
because it is only a vec2 instead of a vec4. This used to work ok
because either set of texture coordinates would always immediately be
accessed using a swizzle of '.st' so it would effectively be converted
to a vec2 anyway. However since the snippet hook for texture lookups
was added the texture coordinates are now passed to a function to
perform the actual lookup instead. This function always takes a vec4
so the shader would not compile. This patch fixes it to construct a
vec4 from gl_PointCoord by setting the third and fourth components to
0.0 and 1.0.
Reviewed-by: Robert Bragg <robert linux intel com>
(cherry picked from commit cb3409b23caf324a548f82cfb88acc684cc71930)
cogl/cogl-pipeline-fragend-glsl.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/cogl/cogl-pipeline-fragend-glsl.c b/cogl/cogl-pipeline-fragend-glsl.c
index 6264f9b..44ebb59 100644
--- a/cogl/cogl-pipeline-fragend-glsl.c
+++ b/cogl/cogl-pipeline-fragend-glsl.c
@@ -455,7 +455,7 @@ ensure_texture_lookup_generated (CoglPipelineShaderState *shader_state,
cogl_pipeline_get_layer_point_sprite_coords_enabled (pipeline,
layer->index))
g_string_append_printf (shader_state->source,
- "gl_PointCoord");
+ "vec4 (gl_PointCoord, 0.0, 1.0)");
else
g_string_append_printf (shader_state->source,
"cogl_tex_coord_in[%d]",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]