summaryrefslogtreecommitdiff
path: root/src/cairo-gl-shaders.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cairo-gl-shaders.c')
-rw-r--r--src/cairo-gl-shaders.c28
1 files changed, 23 insertions, 5 deletions
diff --git a/src/cairo-gl-shaders.c b/src/cairo-gl-shaders.c
index 48d85be0..590eb95f 100644
--- a/src/cairo-gl-shaders.c
+++ b/src/cairo-gl-shaders.c
@@ -979,7 +979,7 @@ const char *vs_draw_sources[] = {
"{\n"
" gl_Position = ftransform();\n"
" texcoords0 = gl_MultiTexCoord0.xy;\n"
- " texcoords0 = gl_MultiTexCoord1.xy;\n"
+ " texcoords1 = gl_MultiTexCoord1.xy;\n"
"}\n",
"varying vec2 texcoords0;\n"
@@ -989,8 +989,8 @@ const char *vs_draw_sources[] = {
"{\n"
" gl_Position = ftransform();\n"
" texcoords0 = gl_MultiTexCoord0.xy;\n"
- " texcoords0 = gl_MultiTexCoord1.xy;\n"
- " texcoords0 = gl_MultiTexCoord2.xy;\n"
+ " texcoords1 = gl_MultiTexCoord1.xy;\n"
+ " texcoords2 = gl_MultiTexCoord2.xy;\n"
"}\n"
};
@@ -1036,13 +1036,30 @@ const char *fs_draw_main[] = {
"void main()\n"
"{\n"
" gl_FragColor = transform_color (texture2D(texture0, texcoords0));\n"
+ "}\n",
+
+ "uniform sampler2D texture0;\n"
+ "uniform sampler2D texture1;\n"
+ "uniform sampler2D texture2;\n"
+ "varying vec2 texcoords0;\n"
+ "void main()\n"
+ "{\n"
+ " gl_FragColor = transform_color (vec4(texture2D(texture0, texcoords0).r,\n"
+ " texture2D(texture1, texcoords0).r,\n"
+ " texture2D(texture2, texcoords0).r,\n"
+ " 1.0));\n"
"}\n"
+
};
static unsigned int
_cairo_gl_draw_shader_get_index_for_format (pixman_format_code_t format)
{
switch ((unsigned int) format) {
+ case PIXMAN_y444:
+ case PIXMAN_y422:
+ case PIXMAN_y420:
+ return 1;
default:
return 0;
}
@@ -1114,7 +1131,7 @@ _cairo_gl_get_draw_shader (cairo_gl_context_t *ctx,
assert (ARRAY_LENGTH (vs_draw_sources) >= pixman_format_num_planes (format));
status = create_shader_program (&entry->program,
- vs_draw_sources[pixman_format_num_planes (format) - 1],
+ vs_draw_sources[0],
fs_source);
free (fs_source);
@@ -1123,7 +1140,8 @@ _cairo_gl_get_draw_shader (cairo_gl_context_t *ctx,
char name[20];
sprintf (name, "texture%u", i);
status = bind_texture_to_shader (entry->program.program, name, i);
- assert (status == CAIRO_STATUS_SUCCESS);
+ if (status != CAIRO_STATUS_SUCCESS)
+ printf ("failed binding %s\n", name);
}
_cairo_gl_use_program (NULL);
status = _cairo_cache_insert (&ctx->shader_cache, &entry->base);