glamor: Remove useless glVertexPointer related code.
As glVertexPointer is not supported by GLES2, I totally replaced it by VertexAttribArray. This commit remove those old code. Signed-off-by: Zhigang Gong <zhigang.gong@gmail.com>
This commit is contained in:
parent
5cbb2a4ca0
commit
a228effbeb
@ -180,15 +180,10 @@ glamor_copy_n_to_n_textured(DrawablePtr src,
|
||||
|
||||
|
||||
|
||||
#if 0
|
||||
glVertexPointer(2, GL_FLOAT, sizeof(float) * 2, vertices);
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
#else
|
||||
glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT, GL_FALSE,
|
||||
2 * sizeof(float),
|
||||
vertices);
|
||||
glEnableVertexAttribArray(GLAMOR_VERTEX_POS);
|
||||
#endif
|
||||
|
||||
if (GLAMOR_PIXMAP_PRIV_NO_PENDING(src_pixmap_priv)) {
|
||||
glamor_get_drawable_deltas(src, src_pixmap, &src_x_off, &src_y_off);
|
||||
@ -201,19 +196,12 @@ glamor_copy_n_to_n_textured(DrawablePtr src,
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
#if 0
|
||||
glClientActiveTexture(GL_TEXTURE0);
|
||||
glTexCoordPointer(2, GL_FLOAT, sizeof(float) * 2, texcoords);
|
||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
glUseProgram(glamor_priv->finish_access_prog[0]);
|
||||
#else
|
||||
|
||||
glVertexAttribPointer(GLAMOR_VERTEX_SOURCE, 2, GL_FLOAT, GL_FALSE,
|
||||
2 * sizeof(float),
|
||||
texcoords);
|
||||
glEnableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
|
||||
glUseProgram(glamor_priv->finish_access_prog[2]);
|
||||
#endif
|
||||
glUseProgram(glamor_priv->finish_access_prog[0]);
|
||||
|
||||
}
|
||||
else {
|
||||
@ -240,19 +228,11 @@ glamor_copy_n_to_n_textured(DrawablePtr src,
|
||||
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||
}
|
||||
|
||||
#if 0
|
||||
glDisableClientState(GL_VERTEX_ARRAY);
|
||||
if (GLAMOR_PIXMAP_PRIV_NO_PENDING(src_pixmap_priv)) {
|
||||
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
}
|
||||
#else
|
||||
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
|
||||
if (GLAMOR_PIXMAP_PRIV_NO_PENDING(src_pixmap_priv)) {
|
||||
glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
}
|
||||
#endif
|
||||
glUseProgram(0);
|
||||
/* The source texture is bound to a fbo, we have to flush it here. */
|
||||
if (flush_needed)
|
||||
|
@ -141,30 +141,7 @@ void
|
||||
glamor_init_finish_access_shaders(ScreenPtr screen)
|
||||
{
|
||||
glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
|
||||
#ifndef GLAMOR_GLES2
|
||||
const char *vs_source =
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" gl_Position = gl_Vertex;\n"
|
||||
" gl_TexCoord[0] = gl_MultiTexCoord0;\n"
|
||||
"}\n";
|
||||
const char *fs_source =
|
||||
"varying vec2 texcoords;\n"
|
||||
"uniform sampler2D sampler;\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" gl_FragColor = texture2D(sampler, gl_TexCoord[0].xy);\n"
|
||||
"}\n";
|
||||
|
||||
const char *aswizzle_source =
|
||||
"varying vec2 texcoords;\n"
|
||||
"uniform sampler2D sampler;\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" gl_FragColor = vec4(texture2D(sampler, gl_TexCoord[0].xy).rgb, 1);\n"
|
||||
"}\n";
|
||||
#endif
|
||||
const char *es_vs_source =
|
||||
"attribute vec4 v_position;\n"
|
||||
"attribute vec4 v_texcoord0;\n"
|
||||
"varying vec2 source_texture;\n"
|
||||
@ -174,7 +151,7 @@ glamor_init_finish_access_shaders(ScreenPtr screen)
|
||||
" source_texture = v_texcoord0.xy;\n"
|
||||
"}\n";
|
||||
|
||||
const char *es_fs_source =
|
||||
const char *fs_source =
|
||||
"varying vec2 source_texture;\n"
|
||||
"uniform sampler2D sampler;\n"
|
||||
"void main()\n"
|
||||
@ -182,62 +159,37 @@ glamor_init_finish_access_shaders(ScreenPtr screen)
|
||||
" gl_FragColor = texture2D(sampler, source_texture);\n"
|
||||
"}\n";
|
||||
|
||||
const char *es_aswizzle_source =
|
||||
const char *set_alpha_source =
|
||||
"varying vec2 source_texture;\n"
|
||||
"varying vec2 texcoords;\n"
|
||||
"uniform sampler2D sampler;\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" gl_FragColor = vec4(texture2D(sampler, source_texture).rgb, 1);\n"
|
||||
"}\n";
|
||||
|
||||
|
||||
|
||||
GLint fs_prog, vs_prog, avs_prog, aswizzle_prog;
|
||||
GLint es_fs_prog, es_vs_prog, es_avs_prog, es_aswizzle_prog;
|
||||
GLint fs_prog, vs_prog, avs_prog, set_alpha_prog;
|
||||
GLint sampler_uniform_location;
|
||||
|
||||
glamor_priv->finish_access_prog[0] = glCreateProgram();
|
||||
glamor_priv->finish_access_prog[1] = glCreateProgram();
|
||||
glamor_priv->finish_access_prog[2] = glCreateProgram();
|
||||
glamor_priv->finish_access_prog[3] = glCreateProgram();
|
||||
|
||||
#ifndef GLAMOR_GLES2
|
||||
vs_prog = glamor_compile_glsl_prog(GL_VERTEX_SHADER, vs_source);
|
||||
fs_prog = glamor_compile_glsl_prog(GL_FRAGMENT_SHADER, fs_source);
|
||||
glAttachShader(glamor_priv->finish_access_prog[0], vs_prog);
|
||||
glAttachShader(glamor_priv->finish_access_prog[0], fs_prog);
|
||||
|
||||
avs_prog = glamor_compile_glsl_prog(GL_VERTEX_SHADER, vs_source);
|
||||
aswizzle_prog = glamor_compile_glsl_prog(GL_FRAGMENT_SHADER, aswizzle_source);
|
||||
set_alpha_prog = glamor_compile_glsl_prog(GL_FRAGMENT_SHADER, set_alpha_source);
|
||||
glAttachShader(glamor_priv->finish_access_prog[1], avs_prog);
|
||||
glAttachShader(glamor_priv->finish_access_prog[1], aswizzle_prog);
|
||||
#endif
|
||||
es_vs_prog = glamor_compile_glsl_prog(GL_VERTEX_SHADER, es_vs_source);
|
||||
es_fs_prog = glamor_compile_glsl_prog(GL_FRAGMENT_SHADER, es_fs_source);
|
||||
glAttachShader(glamor_priv->finish_access_prog[2], es_vs_prog);
|
||||
glAttachShader(glamor_priv->finish_access_prog[2], es_fs_prog);
|
||||
glAttachShader(glamor_priv->finish_access_prog[1], set_alpha_prog);
|
||||
|
||||
es_avs_prog = glamor_compile_glsl_prog(GL_VERTEX_SHADER, es_vs_source);
|
||||
es_aswizzle_prog = glamor_compile_glsl_prog(GL_FRAGMENT_SHADER, es_aswizzle_source);
|
||||
glAttachShader(glamor_priv->finish_access_prog[3], es_avs_prog);
|
||||
glAttachShader(glamor_priv->finish_access_prog[3], es_aswizzle_prog);
|
||||
|
||||
|
||||
|
||||
#ifndef GLAMOR_GLES2
|
||||
glBindAttribLocation(glamor_priv->finish_access_prog[0], GLAMOR_VERTEX_POS, "v_position");
|
||||
glBindAttribLocation(glamor_priv->finish_access_prog[0], GLAMOR_VERTEX_SOURCE, "v_texcoord0");
|
||||
glamor_link_glsl_prog(glamor_priv->finish_access_prog[0]);
|
||||
|
||||
glBindAttribLocation(glamor_priv->finish_access_prog[1], GLAMOR_VERTEX_POS, "v_position");
|
||||
glBindAttribLocation(glamor_priv->finish_access_prog[1], GLAMOR_VERTEX_SOURCE, "v_texcoord0");
|
||||
glamor_link_glsl_prog(glamor_priv->finish_access_prog[1]);
|
||||
#endif
|
||||
glBindAttribLocation(glamor_priv->finish_access_prog[2], GLAMOR_VERTEX_POS, "v_position");
|
||||
glBindAttribLocation(glamor_priv->finish_access_prog[2], GLAMOR_VERTEX_SOURCE, "v_texcoord0");
|
||||
glamor_link_glsl_prog(glamor_priv->finish_access_prog[2]);
|
||||
|
||||
glBindAttribLocation(glamor_priv->finish_access_prog[3], GLAMOR_VERTEX_POS, "v_position");
|
||||
glBindAttribLocation(glamor_priv->finish_access_prog[3], GLAMOR_VERTEX_SOURCE, "v_texcoord0");
|
||||
glamor_link_glsl_prog(glamor_priv->finish_access_prog[3]);
|
||||
|
||||
GLint sampler_uniform_location;
|
||||
#ifndef GLAMOR_GLES2
|
||||
sampler_uniform_location =
|
||||
glGetUniformLocation(glamor_priv->finish_access_prog[0], "sampler");
|
||||
glUseProgram(glamor_priv->finish_access_prog[0]);
|
||||
@ -249,19 +201,6 @@ glamor_init_finish_access_shaders(ScreenPtr screen)
|
||||
glUseProgram(glamor_priv->finish_access_prog[1]);
|
||||
glUniform1i(sampler_uniform_location, 0);
|
||||
glUseProgram(0);
|
||||
#endif
|
||||
sampler_uniform_location =
|
||||
glGetUniformLocation(glamor_priv->finish_access_prog[2], "sampler");
|
||||
glUseProgram(glamor_priv->finish_access_prog[2]);
|
||||
glUniform1i(sampler_uniform_location, 0);
|
||||
glUseProgram(0);
|
||||
|
||||
sampler_uniform_location =
|
||||
glGetUniformLocation(glamor_priv->finish_access_prog[3], "sampler");
|
||||
glUseProgram(glamor_priv->finish_access_prog[3]);
|
||||
glUniform1i(sampler_uniform_location, 0);
|
||||
glUseProgram(0);
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -102,33 +102,11 @@ void
|
||||
glamor_init_solid_shader(ScreenPtr screen)
|
||||
{
|
||||
glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
|
||||
const char *solid_vs_only =
|
||||
#if 0
|
||||
#else
|
||||
"attribute vec4 v_position;"
|
||||
#endif
|
||||
"uniform vec4 color;\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
#if 0
|
||||
" gl_Position = gl_Vertex;\n"
|
||||
#else
|
||||
" gl_Position = v_position;\n"
|
||||
#endif
|
||||
" gl_Color = color;\n"
|
||||
"}\n";
|
||||
const char *solid_vs =
|
||||
#if 0
|
||||
#else
|
||||
"attribute vec4 v_position;"
|
||||
#endif
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
#if 0
|
||||
" gl_Position = gl_Vertex;\n"
|
||||
#else
|
||||
" gl_Position = v_position;\n"
|
||||
#endif
|
||||
"}\n";
|
||||
const char *solid_fs =
|
||||
"uniform vec4 color;\n"
|
||||
@ -201,25 +179,16 @@ glamor_solid(PixmapPtr pixmap, int x, int y, int width, int height,
|
||||
|
||||
glUniform4fv(glamor_priv->solid_color_uniform_location, 1, color);
|
||||
|
||||
#if 0
|
||||
glVertexPointer(2, GL_FLOAT, sizeof(float) * 2, vertices);
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
#else
|
||||
glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT, GL_FALSE,
|
||||
2 * sizeof(float), vertices);
|
||||
glEnableVertexAttribArray(GLAMOR_VERTEX_POS);
|
||||
#endif
|
||||
pixmap_priv_get_scale(pixmap_priv, &xscale, &yscale);
|
||||
|
||||
glamor_set_normalize_vcoords(xscale, yscale, x1, y1, x2, y2,
|
||||
glamor_priv->yInverted,
|
||||
vertices);
|
||||
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||
#if 0
|
||||
glDisableClientState(GL_VERTEX_ARRAY);
|
||||
#else
|
||||
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
|
||||
#endif
|
||||
glUseProgram(0);
|
||||
return TRUE;
|
||||
fail:
|
||||
|
@ -32,14 +32,9 @@ _glamor_pixmap_validate_filling(glamor_screen_private *glamor_priv,
|
||||
glamor_pixmap_private *pixmap_priv)
|
||||
{
|
||||
GLfloat vertices[8];
|
||||
#if 0
|
||||
glVertexPointer(2, GL_FLOAT, sizeof(float) * 2, vertices);
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
#else
|
||||
glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT, GL_FALSE,
|
||||
2 * sizeof(float), vertices);
|
||||
glEnableVertexAttribArray(GLAMOR_VERTEX_POS);
|
||||
#endif
|
||||
glUseProgram(glamor_priv->solid_prog);
|
||||
glUniform4fv(glamor_priv->solid_color_uniform_location,
|
||||
1, pixmap_priv->pending_op.fill.color4fv);
|
||||
@ -52,11 +47,7 @@ _glamor_pixmap_validate_filling(glamor_screen_private *glamor_priv,
|
||||
vertices[6] = -1;
|
||||
vertices[7] = 1;
|
||||
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||
#if 0
|
||||
glDisableClientState(GL_VERTEX_ARRAY);
|
||||
#else
|
||||
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
|
||||
#endif
|
||||
glUseProgram(0);
|
||||
pixmap_priv->pending_op.type = GLAMOR_PENDING_NONE;
|
||||
}
|
||||
@ -341,23 +332,14 @@ _glamor_upload_pixmap_to_texture(PixmapPtr pixmap, GLenum format,
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
#if 0
|
||||
glUseProgram(glamor_priv->finish_access_prog[no_alpha]);
|
||||
#else
|
||||
glUseProgram(glamor_priv->finish_access_prog[no_alpha + 2]);
|
||||
#endif
|
||||
|
||||
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
glUseProgram(0);
|
||||
#if 0
|
||||
glDisableClientState(GL_VERTEX_ARRAY);
|
||||
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
#else
|
||||
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
|
||||
glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
|
||||
#endif
|
||||
glDeleteTextures(1, &tex);
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
}
|
||||
@ -516,7 +498,7 @@ glamor_download_pixmap_to_cpu(PixmapPtr pixmap, glamor_access_t access)
|
||||
unsigned int stride, row_length, y;
|
||||
GLenum format, type, gl_access, gl_usage;
|
||||
int no_alpha;
|
||||
uint8_t *data, *read;
|
||||
uint8_t *data = NULL, *read;
|
||||
glamor_screen_private *glamor_priv =
|
||||
glamor_get_screen_private(pixmap->drawable.pScreen);
|
||||
|
||||
|
@ -235,7 +235,7 @@ typedef struct glamor_screen_private {
|
||||
int max_fbo_size;
|
||||
|
||||
/* glamor_finishaccess */
|
||||
GLint finish_access_prog[4];
|
||||
GLint finish_access_prog[2];
|
||||
|
||||
/* glamor_solid */
|
||||
GLint solid_prog;
|
||||
|
@ -35,8 +35,8 @@
|
||||
void
|
||||
glamor_init_putimage_shaders(ScreenPtr screen)
|
||||
{
|
||||
glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
|
||||
#if 0
|
||||
glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
|
||||
const char *xybitmap_vs =
|
||||
"uniform float x_bias;\n"
|
||||
"uniform float x_scale;\n"
|
||||
@ -346,11 +346,7 @@ glamor_put_image(DrawablePtr drawable, GCPtr gc, int depth, int x, int y,
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
|
||||
#if 0
|
||||
glUseProgram(glamor_priv->finish_access_prog[no_alpha]);
|
||||
#else
|
||||
glUseProgram(glamor_priv->finish_access_prog[no_alpha + 2]);
|
||||
#endif
|
||||
|
||||
x += drawable->x;
|
||||
y += drawable->y;
|
||||
@ -400,13 +396,8 @@ glamor_put_image(DrawablePtr drawable, GCPtr gc, int depth, int x, int y,
|
||||
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
glUseProgram(0);
|
||||
#if 0
|
||||
glDisableClientState(GL_VERTEX_ARRAY);
|
||||
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
#else
|
||||
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
|
||||
glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
|
||||
#endif
|
||||
glDeleteTextures(1, &tex);
|
||||
if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP)
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
|
||||
|
@ -523,47 +523,25 @@ glamor_setup_composite_vbo(ScreenPtr screen)
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, glamor_priv->vbo);
|
||||
|
||||
#if 0
|
||||
glVertexPointer(2, GL_FLOAT, glamor_priv->vb_stride,
|
||||
(void *)((long)glamor_priv->vbo_offset));
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
#else
|
||||
glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT, GL_FALSE,
|
||||
glamor_priv->vb_stride,
|
||||
(void *)((long)glamor_priv->vbo_offset));
|
||||
glEnableVertexAttribArray(GLAMOR_VERTEX_POS);
|
||||
#endif
|
||||
|
||||
if (glamor_priv->has_source_coords) {
|
||||
#if 0
|
||||
glClientActiveTexture(GL_TEXTURE0);
|
||||
glTexCoordPointer(2, GL_FLOAT, glamor_priv->vb_stride,
|
||||
(void *)(glamor_priv->vbo_offset + 2 * sizeof(float)));
|
||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
#else
|
||||
glVertexAttribPointer(GLAMOR_VERTEX_SOURCE, 2, GL_FLOAT, GL_FALSE,
|
||||
glamor_priv->vb_stride,
|
||||
(void *)((long)glamor_priv->vbo_offset + 2 * sizeof(float)));
|
||||
glEnableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (glamor_priv->has_mask_coords) {
|
||||
#if 0
|
||||
glClientActiveTexture(GL_TEXTURE1);
|
||||
glTexCoordPointer(2, GL_FLOAT, glamor_priv->vb_stride,
|
||||
(void *)(glamor_priv->vbo_offset +
|
||||
(glamor_priv->has_source_coords ? 4 : 2) *
|
||||
sizeof(float)));
|
||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
#else
|
||||
glVertexAttribPointer(GLAMOR_VERTEX_MASK, 2, GL_FLOAT, GL_FALSE,
|
||||
glamor_priv->vb_stride,
|
||||
(void *)((long)glamor_priv->vbo_offset +
|
||||
(glamor_priv->has_source_coords ? 4 : 2) *
|
||||
sizeof(float)));
|
||||
glEnableVertexAttribArray(GLAMOR_VERTEX_MASK);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -1054,17 +1032,9 @@ glamor_composite_with_shader(CARD8 op,
|
||||
glamor_flush_composite_rects(screen);
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
#if 0
|
||||
glClientActiveTexture(GL_TEXTURE0);
|
||||
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
glClientActiveTexture(GL_TEXTURE1);
|
||||
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
glDisableClientState(GL_VERTEX_ARRAY);
|
||||
#else
|
||||
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
|
||||
glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
|
||||
glDisableVertexAttribArray(GLAMOR_VERTEX_MASK);
|
||||
#endif
|
||||
REGION_UNINIT(dst->pDrawable->pScreen, ®ion);
|
||||
glDisable(GL_BLEND);
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
|
@ -41,35 +41,20 @@ glamor_init_tile_shader(ScreenPtr screen)
|
||||
{
|
||||
glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
|
||||
const char *tile_vs =
|
||||
#if 0
|
||||
#else
|
||||
"attribute vec4 v_position;\n"
|
||||
"attribute vec4 v_texcoord0;\n"
|
||||
"varying vec2 tile_texture;\n"
|
||||
#endif
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
#if 0
|
||||
" gl_Position = gl_Vertex;\n"
|
||||
" gl_TexCoord[0] = gl_MultiTexCoord0;\n"
|
||||
#else
|
||||
" gl_Position = v_position;\n"
|
||||
" tile_texture = v_texcoord0.xy;\n"
|
||||
#endif
|
||||
"}\n";
|
||||
const char *tile_fs =
|
||||
#if 0
|
||||
#else
|
||||
"varying vec2 tile_texture;\n"
|
||||
#endif
|
||||
"uniform sampler2D sampler;\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
#if 0
|
||||
" gl_FragColor = texture2D(sampler, gl_TexCoord[0].xy);\n"
|
||||
#else
|
||||
" gl_FragColor = texture2D(sampler, tile_texture);\n"
|
||||
#endif
|
||||
"}\n";
|
||||
GLint fs_prog, vs_prog;
|
||||
GLint sampler_uniform_location;
|
||||
@ -163,16 +148,10 @@ glamor_tile(PixmapPtr pixmap, PixmapPtr tile,
|
||||
tile_x2, tile_y2,
|
||||
glamor_priv->yInverted,
|
||||
source_texcoords);
|
||||
#if 0
|
||||
glClientActiveTexture(GL_TEXTURE0);
|
||||
glTexCoordPointer(2, GL_FLOAT, sizeof(float) * 2, source_texcoords);
|
||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
#else
|
||||
glVertexAttribPointer(GLAMOR_VERTEX_SOURCE, 2, GL_FLOAT, GL_FALSE,
|
||||
2 * sizeof(float),
|
||||
source_texcoords);
|
||||
glEnableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
GLAMOR_CHECK_PENDING_FILL(glamor_priv, src_pixmap_priv);
|
||||
@ -183,31 +162,17 @@ glamor_tile(PixmapPtr pixmap, PixmapPtr tile,
|
||||
glamor_priv->yInverted,
|
||||
vertices);
|
||||
|
||||
#if 0
|
||||
glVertexPointer(2, GL_FLOAT, sizeof(float) * 2, vertices);
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
#else
|
||||
glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT, GL_FALSE,
|
||||
2 * sizeof(float),
|
||||
vertices);
|
||||
glEnableVertexAttribArray(GLAMOR_VERTEX_POS);
|
||||
#endif
|
||||
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||
|
||||
#if 0
|
||||
if (GLAMOR_PIXMAP_PRIV_NO_PENDING(src_pixmap_priv)) {
|
||||
glClientActiveTexture(GL_TEXTURE0);
|
||||
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
}
|
||||
glDisableClientState(GL_VERTEX_ARRAY);
|
||||
#else
|
||||
if (GLAMOR_PIXMAP_PRIV_NO_PENDING(src_pixmap_priv)) {
|
||||
glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
}
|
||||
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
|
||||
#endif
|
||||
glUseProgram(0);
|
||||
glamor_set_alu(GXcopy);
|
||||
glamor_set_planemask(pixmap, ~0);
|
||||
|
Loading…
Reference in New Issue
Block a user