@@ -652,9 +652,9 @@ _cairo_gl_context_setup_operand (cairo_gl_context_t *ctx,
case CAIRO_GL_OPERAND_RADIAL_GRADIENT_EXT:
_cairo_gl_gradient_reference (operand->gradient.gradient);
glActiveTexture (GL_TEXTURE0 + tex_unit);
- glBindTexture (GL_TEXTURE_1D, operand->gradient.gradient->tex);
- _cairo_gl_texture_set_extend (ctx, GL_TEXTURE_1D, operand->gradient.extend);
- _cairo_gl_texture_set_filter (ctx, GL_TEXTURE_1D, CAIRO_FILTER_BILINEAR);
+ glBindTexture (ctx->tex_target, operand->gradient.gradient->tex);
+ _cairo_gl_texture_set_extend (ctx, ctx->tex_target, operand->gradient.extend);
+ _cairo_gl_texture_set_filter (ctx, ctx->tex_target, CAIRO_FILTER_BILINEAR);
dispatch->VertexAttribPointer (CAIRO_GL_TEXCOORD0_ATTRIB_INDEX + tex_unit, 2,
GL_FLOAT, GL_FALSE, vertex_size,
@@ -239,9 +239,9 @@ _cairo_gl_gradient_create (cairo_gl_context_t *ctx,
glGenTextures (1, &gradient->tex);
_cairo_gl_context_activate (ctx, CAIRO_GL_TEX_TEMP);
- glBindTexture (GL_TEXTURE_1D, gradient->tex);
- glTexImage1D (GL_TEXTURE_1D, 0, GL_RGBA8, tex_width, 0,
- GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, 0);
+ glBindTexture (ctx->tex_target, gradient->tex);
+ glTexImage2D (ctx->tex_target, 0, GL_RGBA8, tex_width, 1, 0,
+ GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, 0);
dispatch->BindBuffer (GL_PIXEL_UNPACK_BUFFER, 0);
@@ -638,34 +638,34 @@ cairo_gl_shader_emit_color (cairo_output_stream_t *stream,
_cairo_output_stream_printf (stream,
"varying vec2 %s_texcoords;\n"
"uniform vec2 %s_texdims;\n"
- "uniform sampler1D %s_sampler;\n"
+ "uniform sampler2D%s %s_sampler;\n"
"\n"
"vec4 get_%s()\n"
"{\n",
- namestr, namestr, namestr, namestr);
+ namestr, namestr, rectstr, namestr, namestr);
if (ctx->gl_flavor == CAIRO_GL_FLAVOR_ES &&
_cairo_gl_shader_needs_border_fade (op))
{
_cairo_output_stream_printf (stream,
" float border_fade = %s_border_fade (%s_texcoords.x, %s_texdims.x);\n"
- " vec4 texel = texture1D (%s_sampler, %s_texcoords.x);\n"
+ " vec4 texel = texture2D%s (%s_sampler, vec2 (%s_texcoords.x, 0.5));\n"
" return texel * border_fade;\n"
"}\n",
- namestr, namestr, namestr, namestr, namestr);
+ namestr, namestr, namestr, rectstr, namestr, namestr);
}
else
{
_cairo_output_stream_printf (stream,
- " return texture1D (%s_sampler, %s_texcoords.x);\n"
+ " return texture2D%s (%s_sampler, vec2 (%s_texcoords.x, 0.5));\n"
"}\n",
- namestr, namestr);
+ rectstr, namestr, namestr);
}
break;
case CAIRO_GL_OPERAND_RADIAL_GRADIENT_A0:
_cairo_output_stream_printf (stream,
"varying vec2 %s_texcoords;\n"
"uniform vec2 %s_texdims;\n"
- "uniform sampler1D %s_sampler;\n"
+ "uniform sampler2D%s %s_sampler;\n"
"uniform vec3 %s_circle_d;\n"
"uniform float %s_radius_0;\n"
"\n"
@@ -678,31 +678,31 @@ cairo_gl_shader_emit_color (cairo_output_stream_t *stream,
" \n"
" float t = 0.5 * C / B;\n"
" float is_valid = step (-%s_radius_0, t * %s_circle_d.z);\n",
- namestr, namestr, namestr, namestr, namestr, namestr,
+ namestr, namestr, rectstr, namestr, namestr, namestr, namestr,
namestr, namestr, namestr, namestr, namestr);
if (ctx->gl_flavor == CAIRO_GL_FLAVOR_ES &&
_cairo_gl_shader_needs_border_fade (op))
{
_cairo_output_stream_printf (stream,
" float border_fade = %s_border_fade (t, %s_texdims.x);\n"
- " vec4 texel = texture1D (%s_sampler, t);\n"
+ " vec4 texel = texture2D%s (%s_sampler, vec2 (t, 0.5));\n"
" return mix (vec4 (0.0), texel * border_fade, is_valid);\n"
"}\n",
- namestr, namestr, namestr);
+ namestr, namestr, rectstr, namestr);
}
else
{
_cairo_output_stream_printf (stream,
- " return mix (vec4 (0.0), texture1D (%s_sampler, t), is_valid);\n"
+ " return mix (vec4 (0.0), texture2D%s (%s_sampler, vec2(t, 0.5)), is_valid);\n"
"}\n",
- namestr);
+ rectstr, namestr);
}
break;
case CAIRO_GL_OPERAND_RADIAL_GRADIENT_NONE:
_cairo_output_stream_printf (stream,
"varying vec2 %s_texcoords;\n"
"uniform vec2 %s_texdims;\n"
- "uniform sampler1D %s_sampler;\n"
+ "uniform sampler2D%s %s_sampler;\n"
"uniform vec3 %s_circle_d;\n"
"uniform float %s_a;\n"
"uniform float %s_radius_0;\n"
@@ -722,30 +722,30 @@ cairo_gl_shader_emit_color (cairo_output_stream_t *stream,
" float has_color = step (0., det) * max (is_valid.x, is_valid.y);\n"
" \n"
" float upper_t = mix (t.y, t.x, is_valid.x);\n",
- namestr, namestr, namestr, namestr, namestr, namestr,
+ namestr, namestr, rectstr, namestr, namestr, namestr, namestr,
namestr, namestr, namestr, namestr, namestr, namestr);
if (ctx->gl_flavor == CAIRO_GL_FLAVOR_ES &&
_cairo_gl_shader_needs_border_fade (op))
{
_cairo_output_stream_printf (stream,
" float border_fade = %s_border_fade (upper_t, %s_texdims.x);\n"
- " vec4 texel = texture1D (%s_sampler, upper_t);\n"
+ " vec4 texel = texture2D%s (%s_sampler, vec2 (upper_t, 0.5));\n"
" return mix (vec4 (0.0), texel * border_fade, has_color);\n"
"}\n",
- namestr, namestr, namestr);
+ namestr, namestr, rectstr, namestr);
}
else
{
_cairo_output_stream_printf (stream,
- " return mix (vec4 (0.0), texture1D (%s_sampler, upper_t), has_color);\n"
+ " return mix (vec4 (0.0), texture2D%s (%s_sampler, vec2 (upper_t, 0.5)), has_color);\n"
"}\n",
- namestr);
+ rectstr, namestr);
}
break;
case CAIRO_GL_OPERAND_RADIAL_GRADIENT_EXT:
_cairo_output_stream_printf (stream,
"varying vec2 %s_texcoords;\n"
- "uniform sampler1D %s_sampler;\n"
+ "uniform sampler2D%s %s_sampler;\n"
"uniform vec3 %s_circle_d;\n"
"uniform float %s_a;\n"
"uniform float %s_radius_0;\n"
@@ -765,11 +765,11 @@ cairo_gl_shader_emit_color (cairo_output_stream_t *stream,
" float has_color = step (0., det) * max (is_valid.x, is_valid.y);\n"
" \n"
" float upper_t = mix (t.y, t.x, is_valid.x);\n"
- " return mix (vec4 (0.0), texture1D (%s_sampler, upper_t), has_color);\n"
+ " return mix (vec4 (0.0), texture2D%s (%s_sampler, vec2 (upper_t, 0.5)), has_color);\n"
"}\n",
+ namestr, rectstr, namestr, namestr, namestr, namestr,
namestr, namestr, namestr, namestr, namestr,
- namestr, namestr, namestr, namestr, namestr,
- namestr, namestr, namestr, namestr);
+ namestr, namestr, namestr, rectstr, namestr);
break;
case CAIRO_GL_OPERAND_SPANS:
_cairo_output_stream_printf (stream,