Commit 98f8ef5f authored by Zhigang Gong's avatar Zhigang Gong

glamor: Change to use official APIs rather than ARB version function.

Signed-off-by: default avatarZhigang Gong <zhigang.gong@linux.intel.com>
parent 0ef1698b
......@@ -74,10 +74,10 @@ glamor_set_pixmap_texture(PixmapPtr pixmap, int w, int h, unsigned int tex)
*/
pixmap_priv->gl_fbo = 1;
pixmap_priv->gl_tex = 1;
glGenFramebuffersEXT(1, &pixmap_priv->fb);
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, pixmap_priv->fb);
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT,
GL_COLOR_ATTACHMENT0_EXT,
glGenFramebuffers(1, &pixmap_priv->fb);
glBindFramebuffer(GL_FRAMEBUFFER, pixmap_priv->fb);
glFramebufferTexture2D(GL_FRAMEBUFFER,
GL_COLOR_ATTACHMENT0,
GL_TEXTURE_2D,
pixmap_priv->tex,
0);
......@@ -217,11 +217,11 @@ glamor_destroy_pixmap(PixmapPtr pixmap)
if (pixmap->refcnt == 1) {
glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap);
if (pixmap_priv->fb)
glDeleteFramebuffersEXT(1, &pixmap_priv->fb);
glDeleteFramebuffers(1, &pixmap_priv->fb);
if (pixmap_priv->tex)
glDeleteTextures(1, &pixmap_priv->tex);
if (pixmap_priv->pbo)
glDeleteBuffersARB(1, &pixmap_priv->pbo);
glDeleteBuffers(1, &pixmap_priv->pbo);
dixFreePrivates(pixmap->devPrivates, PRIVATE_PIXMAP);
}
......@@ -293,6 +293,7 @@ glamor_init(ScreenPtr screen, unsigned int flags)
glewInit();
#ifndef GLAMOR_GLES2
if (!GLEW_EXT_framebuffer_object) {
ErrorF("GL_EXT_framebuffer_object required\n");
goto fail;
......@@ -305,14 +306,17 @@ glamor_init(ScreenPtr screen, unsigned int flags)
ErrorF("GL_ARB_vertex_shader required\n");
goto fail;
}
if (!GLEW_ARB_pixel_buffer_object) {
ErrorF("GL_ARB_pixel_buffer_object required\n");
goto fail;
}
if (!GLEW_EXT_bgra) {
ErrorF("GL_EXT_bgra required\n");
goto fail;
}
#endif
if (!GLEW_ARB_pixel_buffer_object) {
ErrorF("GL_ARB_pixel_buffer_object required\n");
goto fail;
}
if (!RegisterBlockAndWakeupHandlers(glamor_block_handler,
glamor_wakeup_handler,
NULL)) {
......
......@@ -196,7 +196,7 @@ glamor_copy_n_to_n_textured(DrawablePtr src,
glClientActiveTexture(GL_TEXTURE0);
glTexCoordPointer(2, GL_FLOAT, sizeof(float) * 2, texcoords);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glUseProgramObjectARB(glamor_priv->finish_access_prog[0]);
glUseProgram(glamor_priv->finish_access_prog[0]);
}
else {
GLAMOR_CHECK_PENDING_FILL(glamor_priv, src_pixmap_priv);
......@@ -222,7 +222,7 @@ glamor_copy_n_to_n_textured(DrawablePtr src,
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
}
glUseProgramObjectARB(0);
glUseProgram(0);
glDisableClientState(GL_VERTEX_ARRAY);
if (GLAMOR_PIXMAP_PRIV_NO_PENDING(src_pixmap_priv)) {
......
......@@ -59,10 +59,10 @@ void
glamor_get_transform_uniform_locations(GLint prog,
glamor_transform_uniforms *uniform_locations)
{
uniform_locations->x_bias = glGetUniformLocationARB(prog, "x_bias");
uniform_locations->x_scale = glGetUniformLocationARB(prog, "x_scale");
uniform_locations->y_bias = glGetUniformLocationARB(prog, "y_bias");
uniform_locations->y_scale = glGetUniformLocationARB(prog, "y_scale");
uniform_locations->x_bias = glGetUniformLocation(prog, "x_bias");
uniform_locations->x_scale = glGetUniformLocation(prog, "x_scale");
uniform_locations->y_bias = glGetUniformLocation(prog, "y_bias");
uniform_locations->y_scale = glGetUniformLocation(prog, "y_scale");
}
/* We don't use a full matrix for our transformations because it's
......@@ -73,10 +73,10 @@ void
glamor_set_transform_for_pixmap(PixmapPtr pixmap,
glamor_transform_uniforms *uniform_locations)
{
glUniform1fARB(uniform_locations->x_bias, -pixmap->drawable.width / 2.0f);
glUniform1fARB(uniform_locations->x_scale, 2.0f / pixmap->drawable.width);
glUniform1fARB(uniform_locations->y_bias, -pixmap->drawable.height / 2.0f);
glUniform1fARB(uniform_locations->y_scale, -2.0f / pixmap->drawable.height);
glUniform1f(uniform_locations->x_bias, -pixmap->drawable.width / 2.0f);
glUniform1f(uniform_locations->x_scale, 2.0f / pixmap->drawable.width);
glUniform1f(uniform_locations->y_bias, -pixmap->drawable.height / 2.0f);
glUniform1f(uniform_locations->y_scale, -2.0f / pixmap->drawable.height);
}
GLint
......@@ -85,9 +85,9 @@ glamor_compile_glsl_prog(GLenum type, const char *source)
GLint ok;
GLint prog;
prog = glCreateShaderObjectARB(type);
glShaderSourceARB(prog, 1, (const GLchar **)&source, NULL);
glCompileShaderARB(prog);
prog = glCreateShader(type);
glShaderSource(prog, 1, (const GLchar **)&source, NULL);
glCompileShader(prog);
glGetObjectParameterivARB(prog, GL_OBJECT_COMPILE_STATUS_ARB, &ok);
if (!ok) {
GLchar *info;
......@@ -165,22 +165,22 @@ glamor_init_finish_access_shaders(ScreenPtr screen)
GLint fs_prog, vs_prog, avs_prog, aswizzle_prog;
glamor_priv->finish_access_prog[0] = glCreateProgramObjectARB();
glamor_priv->finish_access_prog[1] = glCreateProgramObjectARB();
glamor_priv->finish_access_prog[0] = glCreateProgram();
glamor_priv->finish_access_prog[1] = glCreateProgram();
if (GLEW_ARB_fragment_shader) {
vs_prog = glamor_compile_glsl_prog(GL_VERTEX_SHADER_ARB, vs_source);
fs_prog = glamor_compile_glsl_prog(GL_FRAGMENT_SHADER_ARB, fs_source);
glAttachObjectARB(glamor_priv->finish_access_prog[0], vs_prog);
glAttachObjectARB(glamor_priv->finish_access_prog[0], fs_prog);
avs_prog = glamor_compile_glsl_prog(GL_VERTEX_SHADER_ARB, vs_source);
aswizzle_prog = glamor_compile_glsl_prog(GL_FRAGMENT_SHADER_ARB, aswizzle_source);
glAttachObjectARB(glamor_priv->finish_access_prog[1], avs_prog);
glAttachObjectARB(glamor_priv->finish_access_prog[1], aswizzle_prog);
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);
glAttachShader(glamor_priv->finish_access_prog[1], avs_prog);
glAttachShader(glamor_priv->finish_access_prog[1], aswizzle_prog);
} else {
vs_prog = glamor_compile_glsl_prog(GL_VERTEX_SHADER_ARB, vs_source);
glAttachObjectARB(glamor_priv->finish_access_prog[0], vs_prog);
vs_prog = glamor_compile_glsl_prog(GL_VERTEX_SHADER, vs_source);
glAttachShader(glamor_priv->finish_access_prog[0], vs_prog);
ErrorF("Lack of framgment shader support.\n");
}
......@@ -191,16 +191,16 @@ glamor_init_finish_access_shaders(ScreenPtr screen)
GLint sampler_uniform_location;
sampler_uniform_location =
glGetUniformLocationARB(glamor_priv->finish_access_prog[0], "sampler");
glUseProgramObjectARB(glamor_priv->finish_access_prog[0]);
glUniform1iARB(sampler_uniform_location, 0);
glUseProgramObjectARB(0);
glGetUniformLocation(glamor_priv->finish_access_prog[0], "sampler");
glUseProgram(glamor_priv->finish_access_prog[0]);
glUniform1i(sampler_uniform_location, 0);
glUseProgram(0);
sampler_uniform_location =
glGetUniformLocationARB(glamor_priv->finish_access_prog[1], "sampler");
glUseProgramObjectARB(glamor_priv->finish_access_prog[1]);
glUniform1iARB(sampler_uniform_location, 0);
glUseProgramObjectARB(0);
glGetUniformLocation(glamor_priv->finish_access_prog[1], "sampler");
glUseProgram(glamor_priv->finish_access_prog[1]);
glUniform1i(sampler_uniform_location, 0);
glUseProgram(0);
}
}
......@@ -218,10 +218,10 @@ glamor_finish_access(DrawablePtr drawable)
}
if (pixmap_priv->pbo != 0 && pixmap_priv->pbo_valid) {
glBindBufferARB (GL_PIXEL_PACK_BUFFER_EXT, 0);
glBindBufferARB (GL_PIXEL_UNPACK_BUFFER_EXT, 0);
glBindBuffer (GL_PIXEL_PACK_BUFFER_EXT, 0);
glBindBuffer (GL_PIXEL_UNPACK_BUFFER_EXT, 0);
pixmap_priv->pbo_valid = FALSE;
glDeleteBuffersARB(1, &pixmap_priv->pbo);
glDeleteBuffers(1, &pixmap_priv->pbo);
pixmap_priv->pbo = 0;
} else
free(pixmap->devPrivate.ptr);
......
......@@ -122,20 +122,20 @@ glamor_init_solid_shader(ScreenPtr screen)
"}\n";
GLint fs_prog, vs_prog;
glamor_priv->solid_prog = glCreateProgramObjectARB();
glamor_priv->solid_prog = glCreateProgram();
if (GLEW_ARB_fragment_shader) {
vs_prog = glamor_compile_glsl_prog(GL_VERTEX_SHADER_ARB, solid_vs);
fs_prog = glamor_compile_glsl_prog(GL_FRAGMENT_SHADER_ARB, solid_fs);
glAttachObjectARB(glamor_priv->solid_prog, vs_prog);
glAttachObjectARB(glamor_priv->solid_prog, fs_prog);
vs_prog = glamor_compile_glsl_prog(GL_VERTEX_SHADER, solid_vs);
fs_prog = glamor_compile_glsl_prog(GL_FRAGMENT_SHADER, solid_fs);
glAttachShader(glamor_priv->solid_prog, vs_prog);
glAttachShader(glamor_priv->solid_prog, fs_prog);
} else {
vs_prog = glamor_compile_glsl_prog(GL_VERTEX_SHADER_ARB, solid_vs_only);
glAttachObjectARB(glamor_priv->solid_prog, vs_prog);
vs_prog = glamor_compile_glsl_prog(GL_VERTEX_SHADER, solid_vs_only);
glAttachShader(glamor_priv->solid_prog, vs_prog);
}
glamor_link_glsl_prog(glamor_priv->solid_prog);
glamor_priv->solid_color_uniform_location =
glGetUniformLocationARB(glamor_priv->solid_prog, "color");
glGetUniformLocation(glamor_priv->solid_prog, "color");
}
Bool
......@@ -184,9 +184,9 @@ glamor_solid(PixmapPtr pixmap, int x, int y, int width, int height,
glamor_set_destination_pixmap_priv_nc(pixmap_priv);
glamor_validate_pixmap(pixmap);
glUseProgramObjectARB(glamor_priv->solid_prog);
glUseProgram(glamor_priv->solid_prog);
glUniform4fvARB(glamor_priv->solid_color_uniform_location, 1, color);
glUniform4fv(glamor_priv->solid_color_uniform_location, 1, color);
glVertexPointer(2, GL_FLOAT, sizeof(float) * 2, vertices);
glEnableClientState(GL_VERTEX_ARRAY);
......@@ -199,7 +199,7 @@ glamor_solid(PixmapPtr pixmap, int x, int y, int width, int height,
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
glDisableClientState(GL_VERTEX_ARRAY);
glUseProgramObjectARB(0);
glUseProgram(0);
return TRUE;
fail:
glamor_set_alu(GXcopy);
......
......@@ -35,8 +35,8 @@ _glamor_pixmap_validate_filling(glamor_screen_private *glamor_priv,
// glamor_set_destination_pixmap_priv_nc(pixmap_priv);
glVertexPointer(2, GL_FLOAT, sizeof(float) * 2, vertices);
glEnableClientState(GL_VERTEX_ARRAY);
glUseProgramObjectARB(glamor_priv->solid_prog);
glUniform4fvARB(glamor_priv->solid_color_uniform_location,
glUseProgram(glamor_priv->solid_prog);
glUniform4fv(glamor_priv->solid_color_uniform_location,
1, pixmap_priv->pending_op.fill.color4fv);
vertices[0] = -1;
vertices[1] = -1;
......@@ -48,7 +48,7 @@ _glamor_pixmap_validate_filling(glamor_screen_private *glamor_priv,
vertices[7] = 1;
glDrawArrays(GL_QUADS, 0, 4);
glDisableClientState(GL_VERTEX_ARRAY);
glUseProgramObjectARB(0);
glUseProgram(0);
pixmap_priv->pending_op.type = GLAMOR_PENDING_NONE;
}
......@@ -223,7 +223,7 @@ __glamor_upload_pixmap_to_texture(PixmapPtr pixmap, GLenum format, GLenum type,
if (pixmap_priv->pbo && pixmap_priv->pbo_valid) {
texels = NULL;
glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_EXT, pixmap_priv->pbo);
glBindBuffer(GL_PIXEL_UNPACK_BUFFER_EXT, pixmap_priv->pbo);
}
else
texels = pixmap->devPrivate.ptr;
......@@ -300,12 +300,12 @@ _glamor_upload_pixmap_to_texture(PixmapPtr pixmap, GLenum format, GLenum type, i
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glEnable(GL_TEXTURE_2D);
glUseProgramObjectARB(glamor_priv->finish_access_prog[ax]);
glUseProgram(glamor_priv->finish_access_prog[ax]);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
glDisable(GL_TEXTURE_2D);
glUseProgramObjectARB(0);
glUseProgram(0);
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glDeleteTextures(1, &tex);
......@@ -472,16 +472,16 @@ glamor_download_pixmap_to_cpu(PixmapPtr pixmap, glamor_access_t access)
glamor_validate_pixmap(pixmap);
switch (access) {
case GLAMOR_ACCESS_RO:
gl_access = GL_READ_ONLY_ARB;
gl_usage = GL_STREAM_READ_ARB;
gl_access = GL_READ_ONLY;
gl_usage = GL_STREAM_READ;
break;
case GLAMOR_ACCESS_WO:
data = malloc(stride * pixmap->drawable.height);
goto done;
break;
case GLAMOR_ACCESS_RW:
gl_access = GL_READ_WRITE_ARB;
gl_usage = GL_DYNAMIC_DRAW_ARB;
gl_access = GL_READ_WRITE;
gl_usage = GL_DYNAMIC_DRAW;
break;
default:
ErrorF("Glamor: Invalid access code. %d\n", access);
......@@ -497,41 +497,41 @@ glamor_download_pixmap_to_cpu(PixmapPtr pixmap, glamor_access_t access)
if (!glamor_priv->yInverted)
glPixelStorei(GL_PACK_INVERT_MESA, 1);
if (pixmap_priv->pbo == 0)
glGenBuffersARB (1, &pixmap_priv->pbo);
glBindBufferARB (GL_PIXEL_PACK_BUFFER_EXT, pixmap_priv->pbo);
glBufferDataARB (GL_PIXEL_PACK_BUFFER_EXT,
glGenBuffers (1, &pixmap_priv->pbo);
glBindBuffer (GL_PIXEL_PACK_BUFFER_EXT, pixmap_priv->pbo);
glBufferData (GL_PIXEL_PACK_BUFFER_EXT,
stride * pixmap->drawable.height,
NULL, gl_usage);
glReadPixels (0, 0,
row_length, pixmap->drawable.height,
format, type, 0);
data = glMapBufferARB (GL_PIXEL_PACK_BUFFER_EXT, gl_access);
data = glMapBuffer (GL_PIXEL_PACK_BUFFER_EXT, gl_access);
pixmap_priv->pbo_valid = TRUE;
if (!glamor_priv->yInverted)
glPixelStorei(GL_PACK_INVERT_MESA, 0);
glBindBufferARB (GL_PIXEL_PACK_BUFFER_EXT, 0);
glBindBuffer (GL_PIXEL_PACK_BUFFER_EXT, 0);
} else {
data = malloc(stride * pixmap->drawable.height);
assert(data);
if (access != GLAMOR_ACCESS_WO) {
if (pixmap_priv->pbo == 0)
glGenBuffersARB(1, &pixmap_priv->pbo);
glBindBufferARB(GL_PIXEL_PACK_BUFFER_EXT, pixmap_priv->pbo);
glBufferDataARB(GL_PIXEL_PACK_BUFFER_EXT,
glGenBuffers(1, &pixmap_priv->pbo);
glBindBuffer(GL_PIXEL_PACK_BUFFER_EXT, pixmap_priv->pbo);
glBufferData(GL_PIXEL_PACK_BUFFER_EXT,
stride * pixmap->drawable.height,
NULL, GL_STREAM_READ_ARB);
NULL, GL_STREAM_READ);
glReadPixels (0, 0, row_length, pixmap->drawable.height,
format, type, 0);
read = glMapBufferARB(GL_PIXEL_PACK_BUFFER_EXT, GL_READ_ONLY_ARB);
read = glMapBuffer(GL_PIXEL_PACK_BUFFER_EXT, GL_READ_ONLY);
for (y = 0; y < pixmap->drawable.height; y++)
memcpy(data + y * stride,
read + (pixmap->drawable.height - y - 1) * stride, stride);
glUnmapBufferARB(GL_PIXEL_PACK_BUFFER_EXT);
glBindBufferARB(GL_PIXEL_PACK_BUFFER_EXT, 0);
glUnmapBuffer(GL_PIXEL_PACK_BUFFER_EXT);
glBindBuffer(GL_PIXEL_PACK_BUFFER_EXT, 0);
pixmap_priv->pbo_valid = FALSE;
glDeleteBuffersARB(1, &pixmap_priv->pbo);
glDeleteBuffers(1, &pixmap_priv->pbo);
pixmap_priv->pbo = 0;
}
}
......@@ -555,7 +555,7 @@ _glamor_destroy_upload_pixmap(PixmapPtr pixmap)
if (pixmap_priv->tex)
glDeleteTextures(1, &pixmap_priv->tex);
if (pixmap_priv->pbo)
glDeleteBuffersARB(1, &pixmap_priv->pbo);
glDeleteBuffers(1, &pixmap_priv->pbo);
pixmap_priv->fb = pixmap_priv->tex = pixmap_priv->pbo = 0;
}
......
......@@ -66,25 +66,25 @@ glamor_init_putimage_shaders(ScreenPtr screen)
if (!GLEW_ARB_fragment_shader)
return;
prog = glCreateProgramObjectARB();
vs_prog = glamor_compile_glsl_prog(GL_VERTEX_SHADER_ARB, xybitmap_vs);
fs_prog = glamor_compile_glsl_prog(GL_FRAGMENT_SHADER_ARB, xybitmap_fs);
glAttachObjectARB(prog, vs_prog);
glAttachObjectARB(prog, fs_prog);
prog = glCreateProgram();
vs_prog = glamor_compile_glsl_prog(GL_VERTEX_SHADER, xybitmap_vs);
fs_prog = glamor_compile_glsl_prog(GL_FRAGMENT_SHADER, xybitmap_fs);
glAttachShader(prog, vs_prog);
glAttachShader(prog, fs_prog);
glamor_link_glsl_prog(prog);
glUseProgramObjectARB(prog);
sampler_uniform_location = glGetUniformLocationARB(prog, "bitmap_sampler");
glUniform1iARB(sampler_uniform_location, 0);
glUseProgram(prog);
sampler_uniform_location = glGetUniformLocation(prog, "bitmap_sampler");
glUniform1i(sampler_uniform_location, 0);
glamor_priv->put_image_xybitmap_fg_uniform_location =
glGetUniformLocationARB(prog, "fg");
glGetUniformLocation(prog, "fg");
glamor_priv->put_image_xybitmap_bg_uniform_location =
glGetUniformLocationARB(prog, "bg");
glGetUniformLocation(prog, "bg");
glamor_get_transform_uniform_locations(prog,
&glamor_priv->put_image_xybitmap_transform);
glamor_priv->put_image_xybitmap_prog = prog;
glUseProgramObjectARB(0);
glUseProgram(0);
}
......@@ -160,13 +160,13 @@ glamor_put_image_xybitmap(DrawablePtr drawable, GCPtr gc,
if (!glamor_set_planemask(pixmap, gc->planemask))
goto fail;
glUseProgramObjectARB(glamor_priv->put_image_xybitmap_prog);
glUseProgram(glamor_priv->put_image_xybitmap_prog);
glamor_get_color_4f_from_pixel(pixmap, gc->fgPixel, fg);
glUniform4fvARB(glamor_priv->put_image_xybitmap_fg_uniform_location,
glUniform4fv(glamor_priv->put_image_xybitmap_fg_uniform_location,
1, fg);
glamor_get_color_4f_from_pixel(pixmap, gc->bgPixel, bg);
glUniform4fvARB(glamor_priv->put_image_xybitmap_bg_uniform_location,
glUniform4fv(glamor_priv->put_image_xybitmap_bg_uniform_location,
1, bg);
glGenTextures(1, &tex);
......@@ -322,7 +322,7 @@ glamor_put_image(DrawablePtr drawable, GCPtr gc, int depth, int x, int y,
glEnable(GL_TEXTURE_2D);
assert(GLEW_ARB_fragment_shader);
glUseProgramObjectARB(glamor_priv->finish_access_prog[ax]);
glUseProgram(glamor_priv->finish_access_prog[ax]);
x += drawable->x;
y += drawable->y;
......@@ -371,7 +371,7 @@ glamor_put_image(DrawablePtr drawable, GCPtr gc, int depth, int x, int y,
}
glDisable(GL_TEXTURE_2D);
glUseProgramObjectARB(0);
glUseProgram(0);
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glDeleteTextures(1, &tex);
......
......@@ -186,7 +186,7 @@ glamor_create_composite_fs(struct shader_key *key)
in);
prog = glamor_compile_glsl_prog(GL_FRAGMENT_SHADER_ARB, source);
prog = glamor_compile_glsl_prog(GL_FRAGMENT_SHADER, source);
free(source);
return prog;
......@@ -223,7 +223,7 @@ glamor_create_composite_vs(struct shader_key *key)
mask_coords_setup,
main_closing);
prog = glamor_compile_glsl_prog(GL_VERTEX_SHADER_ARB, source);
prog = glamor_compile_glsl_prog(GL_VERTEX_SHADER, source);
free(source);
return prog;
......@@ -243,30 +243,30 @@ glamor_create_composite_shader(ScreenPtr screen, struct shader_key *key,
if (fs == 0)
return;
prog = glCreateProgramObjectARB();
glAttachObjectARB(prog, vs);
glAttachObjectARB(prog, fs);
prog = glCreateProgram();
glAttachShader(prog, vs);
glAttachShader(prog, fs);
glamor_link_glsl_prog(prog);
shader->prog = prog;
glUseProgramObjectARB(prog);
glUseProgram(prog);
if (key->source == SHADER_SOURCE_SOLID) {
shader->source_uniform_location = glGetUniformLocationARB(prog,
shader->source_uniform_location = glGetUniformLocation(prog,
"source");
} else {
source_sampler_uniform_location = glGetUniformLocationARB(prog,
source_sampler_uniform_location = glGetUniformLocation(prog,
"source_sampler");
glUniform1i(source_sampler_uniform_location, 0);
}
if (key->mask != SHADER_MASK_NONE) {
if (key->mask == SHADER_MASK_SOLID) {
shader->mask_uniform_location = glGetUniformLocationARB(prog,
shader->mask_uniform_location = glGetUniformLocation(prog,
"mask");
} else {
mask_sampler_uniform_location = glGetUniformLocationARB(prog,
mask_sampler_uniform_location = glGetUniformLocation(prog,
"mask_sampler");
glUniform1i(mask_sampler_uniform_location, 1);
}
......@@ -397,7 +397,7 @@ glamor_set_composite_texture(ScreenPtr screen, int unit, PicturePtr picture,
static void
glamor_set_composite_solid(float *color, GLint uniform_location)
{
glUniform4fvARB(uniform_location, 1, color);
glUniform4fv(uniform_location, 1, color);
}
static int
......@@ -504,7 +504,7 @@ glamor_setup_composite_vbo(ScreenPtr screen)
if (glamor_priv->has_mask_coords)
glamor_priv->vb_stride += 2 * sizeof(float);
glBindBufferARB(GL_ARRAY_BUFFER_ARB, glamor_priv->vbo);
glBindBuffer(GL_ARRAY_BUFFER, glamor_priv->vbo);
glVertexPointer(2, GL_FLOAT, glamor_priv->vb_stride,
(void *)((long)glamor_priv->vbo_offset));
glEnableClientState(GL_VERTEX_ARRAY);
......@@ -559,8 +559,8 @@ glamor_flush_composite_rects(ScreenPtr screen)
if (!glamor_priv->render_nr_verts)
return;
glBufferDataARB(GL_ARRAY_BUFFER_ARB, glamor_priv->vbo_offset, glamor_priv->vb,
GL_STREAM_DRAW_ARB);
glBufferData(GL_ARRAY_BUFFER, glamor_priv->vbo_offset, glamor_priv->vb,
GL_STREAM_DRAW);
glDrawArrays(GL_QUADS, 0, glamor_priv->render_nr_verts);
glamor_reset_composite_vbo(screen);
......@@ -582,7 +582,7 @@ glamor_emit_composite_rect(ScreenPtr screen,
if (glamor_priv->vbo_offset == 0) {
if (glamor_priv->vbo == 0)
glGenBuffersARB(1, &glamor_priv->vbo);
glGenBuffers(1, &glamor_priv->vbo);
glamor_setup_composite_vbo(screen);
}
......@@ -882,7 +882,7 @@ glamor_composite_with_shader(CARD8 op,
goto fail;
}
glUseProgramObjectARB(shader->prog);
glUseProgram(shader->prog);
if (key.source == SHADER_SOURCE_SOLID) {
glamor_set_composite_solid(source_solid_color, shader->source_uniform_location);
} else {
......@@ -1008,7 +1008,7 @@ glamor_composite_with_shader(CARD8 op,
}
glamor_flush_composite_rects(screen);
glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
glBindBuffer(GL_ARRAY_BUFFER, 0);
glClientActiveTexture(GL_TEXTURE0);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glClientActiveTexture(GL_TEXTURE1);
......@@ -1021,7 +1021,7 @@ glamor_composite_with_shader(CARD8 op,
glDisable(GL_TEXTURE_2D);
glActiveTexture(GL_TEXTURE1);
glDisable(GL_TEXTURE_2D);
glUseProgramObjectARB(0);
glUseProgram(0);
if (saved_source_format)
source->format = saved_source_format;
return TRUE;
......@@ -1031,7 +1031,7 @@ glamor_composite_with_shader(CARD8 op,
source->format = saved_source_format;
glDisable(GL_BLEND);
glUseProgramObjectARB(0);
glUseProgram(0);
return FALSE;
}
......@@ -1223,7 +1223,7 @@ fail:
dest->pDrawable->height,
glamor_get_picture_location(dest));
glUseProgramObjectARB(0);
glUseProgram(0);
glDisable(GL_BLEND);
if (glamor_prepare_access_picture(dest, GLAMOR_ACCESS_RW)) {
if (glamor_prepare_access_picture(source, GLAMOR_ACCESS_RO))
......
......@@ -58,18 +58,18 @@ glamor_init_tile_shader(ScreenPtr screen)
if (!GLEW_ARB_fragment_shader)
return;
glamor_priv->tile_prog = glCreateProgramObjectARB();
vs_prog = glamor_compile_glsl_prog(GL_VERTEX_SHADER_ARB, tile_vs);
fs_prog = glamor_compile_glsl_prog(GL_FRAGMENT_SHADER_ARB, tile_fs);
glAttachObjectARB(glamor_priv->tile_prog, vs_prog);
glAttachObjectARB(glamor_priv->tile_prog, fs_prog);
glamor_priv->tile_prog = glCreateProgram();
vs_prog = glamor_compile_glsl_prog(GL_VERTEX_SHADER, tile_vs);
fs_prog = glamor_compile_glsl_prog(GL_FRAGMENT_SHADER, tile_fs);
glAttachShader(glamor_priv->tile_prog, vs_prog);
glAttachShader(glamor_priv->tile_prog, fs_prog);
glamor_link_glsl_prog(glamor_priv->tile_prog);
sampler_uniform_location =
glGetUniformLocationARB(glamor_priv->tile_prog, "sampler");
glUseProgramObjectARB(glamor_priv->tile_prog);
glUniform1iARB(sampler_uniform_location, 0);
glUseProgramObjectARB(0);
glGetUniformLocation(glamor_priv->tile_prog, "sampler");
glUseProgram(glamor_priv->tile_prog);
glUniform1i(sampler_uniform_location, 0);
glUseProgram(0);
}
Bool
......@@ -130,7 +130,7 @@ glamor_tile(PixmapPtr pixmap, PixmapPtr tile,
if (GLAMOR_PIXMAP_PRIV_NO_PENDING(src_pixmap_priv)) {
pixmap_priv_get_scale(src_pixmap_priv, &src_xscale, &src_yscale);
glUseProgramObjectARB(glamor_priv->tile_prog);
glUseProgram(glamor_priv->tile_prog);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, src_pixmap_priv->tex);
......@@ -169,7 +169,7 @@ glamor_tile(PixmapPtr pixmap, PixmapPtr tile,
}
glDisableClientState(GL_VERTEX_ARRAY);
glUseProgramObjectARB(0);
glUseProgram(0);
glamor_set_alu(GXcopy);
glamor_set_planemask(pixmap, ~0);
return TRUE;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment