summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGwenole Beauchesne <gbeauchesne@splitted-desktop.com>2010-10-06 09:20:34 +0000
committerGwenole Beauchesne <gbeauchesne@splitted-desktop.com>2010-10-06 09:20:34 +0000
commit56f0c346f309d2c5d14c69fdd56cea375b37461e (patch)
tree0f451b6f056b0ab2ade9fa6ab0075feaa18bf04c
parent4a2f6ed7f834c2935a73f3eef6cd7e36a0da980a (diff)
Add support for GL_TEXTURE_RECTANGLE_ARB textures.
-rw-r--r--NEWS1
-rw-r--r--src/utils_glx.c33
-rw-r--r--src/utils_glx.h1
-rw-r--r--src/vdpau_video_glx.c3
4 files changed, 31 insertions, 7 deletions
diff --git a/NEWS b/NEWS
index 1b27297..1f53714 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,7 @@ Copyright (C) 2009-2010 Splitted-Desktop Systems
Version 0.7.1 - DD.Oct.2010
* Fix X11 display locking issues
+* Add support for GL_TEXTURE_RECTANGLE_ARB textures
Version 0.7.0 - 09.Aug.2010
* Add support for VA-API 0.31.1-sds1
diff --git a/src/utils_glx.c b/src/utils_glx.c
index 4821b60..f041e97 100644
--- a/src/utils_glx.c
+++ b/src/utils_glx.c
@@ -566,11 +566,30 @@ gl_unbind_texture(GLTextureState *ts)
GLuint
gl_create_texture(GLenum target, GLenum format, unsigned int width, unsigned int height)
{
+ GLVTable * const gl_vtable = gl_get_vtable();
GLenum internal_format;
GLuint texture;
GLTextureState ts;
unsigned int bytes_per_component;
+ switch (target) {
+ case GL_TEXTURE_2D:
+ if (!gl_vtable->has_texture_non_power_of_two) {
+ D(bug("Unsupported GL_ARB_texture_non_power_of_two extension\n"));
+ return 0;
+ }
+ break;
+ case GL_TEXTURE_RECTANGLE_ARB:
+ if (!gl_vtable->has_texture_rectangle) {
+ D(bug("Unsupported GL_ARB_texture_rectangle extension\n"));
+ return 0;
+ }
+ break;
+ default:
+ D(bug("Unsupported texture target 0x%04x\n", target));
+ return 0;
+ }
+
internal_format = format;
switch (format) {
case GL_LUMINANCE:
@@ -682,6 +701,13 @@ gl_init_vtable(void)
if (has_extension)
gl_vtable->has_texture_non_power_of_two = 1;
+ /* GL_ARB_texture_rectangle */
+ has_extension = (
+ find_string("GL_ARB_texture_rectangle", gl_extensions, " ")
+ );
+ if (has_extension)
+ gl_vtable->has_texture_rectangle = 1;
+
/* GLX_EXT_texture_from_pixmap */
gl_vtable->glx_bind_tex_image = (PFNGLXBINDTEXIMAGEEXTPROC)
get_proc_address("glXBindTexImageEXT");
@@ -979,6 +1005,7 @@ gl_create_pixmap_object(Display *dpy, unsigned int width, unsigned int height)
goto error;
pixo->target = GL_TEXTURE_2D;
+ glEnable(pixo->target);
glGenTextures(1, &pixo->texture);
if (!gl_bind_texture(&pixo->old_texture, pixo->target, pixo->texture))
goto error;
@@ -1122,10 +1149,6 @@ gl_create_framebuffer_object(
if (!gl_vtable || !gl_vtable->has_framebuffer_object)
return NULL;
- /* XXX: we only support GL_TEXTURE_2D at this time */
- if (target != GL_TEXTURE_2D)
- return NULL;
-
fbo = calloc(1, sizeof(*fbo));
if (!fbo)
return NULL;
@@ -1329,6 +1352,7 @@ gl_vdpau_create_video_surface(VdpVideoSurface surface)
s->num_textures = 4;
s->is_bound = 0;
+ glEnable(s->target);
glGenTextures(s->num_textures, &s->textures[0]);
s->surface = gl_vtable->gl_vdpau_register_video_surface(
@@ -1387,6 +1411,7 @@ gl_vdpau_create_output_surface(VdpOutputSurface surface)
s->num_textures = 1;
s->is_bound = 0;
+ glEnable(s->target);
glGenTextures(1, &s->textures[0]);
s->surface = gl_vtable->gl_vdpau_register_output_surface(
diff --git a/src/utils_glx.h b/src/utils_glx.h
index 18d15b6..f29d1a8 100644
--- a/src/utils_glx.h
+++ b/src/utils_glx.h
@@ -181,6 +181,7 @@ struct _GLVTable {
PFNGLVDPAUMAPSURFACESNVPROC gl_vdpau_map_surfaces;
PFNGLVDPAUUNMAPSURFACESNVPROC gl_vdpau_unmap_surfaces;
unsigned int has_texture_non_power_of_two : 1;
+ unsigned int has_texture_rectangle : 1;
unsigned int has_texture_from_pixmap : 1;
unsigned int has_framebuffer_object : 1;
unsigned int has_fragment_program : 1;
diff --git a/src/vdpau_video_glx.c b/src/vdpau_video_glx.c
index 358f72c..e296f5d 100644
--- a/src/vdpau_video_glx.c
+++ b/src/vdpau_video_glx.c
@@ -250,9 +250,6 @@ vdpau_CreateSurfaceGLX(
return VA_STATUS_ERROR_INVALID_PARAMETER;
/* Make sure it is a valid GL texture object */
- /* XXX: we only support 2D textures */
- if (target != GL_TEXTURE_2D)
- return VA_STATUS_ERROR_INVALID_PARAMETER;
if (!glIsTexture(texture))
return VA_STATUS_ERROR_INVALID_PARAMETER;