[cairo-commit] glitz/src glitz_agl_context.c, 1.8,
1.9 glitz_agl_extension.c, 1.12, 1.13 glitz_agl_info.c, 1.13,
1.14 glitz_agl_surface.c, 1.19, 1.20 glitz_aglint.h, 1.12,
1.13 glitz_gl.h, 1.10, 1.11 glitz_glx_context.c, 1.14,
1.15 glitz_glx_info.c, 1.19, 1.20 glitz_program.c, 1.14,
1.15 glitz_texture.c, 1.13, 1.14
David Reveman
commit at pdx.freedesktop.org
Sun Sep 19 21:59:36 PDT 2004
Committed by: davidr
Update of /cvs/cairo/glitz/src
In directory gabe:/tmp/cvs-serv9509/src
Modified Files:
glitz_agl_context.c glitz_agl_extension.c glitz_agl_info.c
glitz_agl_surface.c glitz_aglint.h glitz_gl.h
glitz_glx_context.c glitz_glx_info.c glitz_program.c
glitz_texture.c
Log Message:
Improvements to AGL backend and better checking of successful fragment program loading
Index: glitz_agl_context.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_agl_context.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** glitz_agl_context.c 3 Sep 2004 14:27:58 -0000 1.8
--- glitz_agl_context.c 20 Sep 2004 04:59:34 -0000 1.9
***************
*** 86,90 ****
context->backend.feature_mask = thread_info->feature_mask;
! context->backend.gl.need_lookup = 0;
return context;
--- 86,90 ----
context->backend.feature_mask = thread_info->feature_mask;
! context->backend.gl.need_lookup = 1;
return context;
***************
*** 99,102 ****
--- 99,236 ----
}
+ /* These function addresses are never context specific but we retrive them
+ for each context anyway. */
+ void
+ glitz_agl_context_proc_address_lookup (glitz_agl_thread_info_t *thread_info,
+ glitz_agl_context_t *context)
+ {
+ CFBundleRef bundle;
+
+ bundle = glitz_agl_get_bundle ("OpenGL.framework");
+
+ if (thread_info->gl_version >= 1.3) {
+ context->backend.gl.active_texture =
+ (glitz_gl_active_texture_t)
+ glitz_agl_get_proc_address (bundle, "glActiveTexture");
+ } else {
+ context->backend.gl.active_texture =
+ (glitz_gl_active_texture_t)
+ glitz_agl_get_proc_address (bundle, "glActiveTextureARB");
+ }
+
+ context->backend.gl.gen_programs =
+ (glitz_gl_gen_programs_t)
+ glitz_agl_get_proc_address (bundle, "glGenProgramsARB");
+ context->backend.gl.delete_programs =
+ (glitz_gl_delete_programs_t)
+ glitz_agl_get_proc_address (bundle, "glDeleteProgramsARB");
+ context->backend.gl.program_string =
+ (glitz_gl_program_string_t)
+ glitz_agl_get_proc_address (bundle, "glProgramStringARB");
+ context->backend.gl.bind_program =
+ (glitz_gl_bind_program_t)
+ glitz_agl_get_proc_address (bundle, "glBindProgramARB");
+ context->backend.gl.program_local_param_4fv =
+ (glitz_gl_program_local_param_4fv_t)
+ glitz_agl_get_proc_address (bundle, "glProgramLocalParameter4fvARB");
+ context->backend.gl.get_program_iv =
+ (glitz_gl_get_program_iv_t)
+ glitz_agl_get_proc_address (bundle, "glGetProgramivARB");
+
+ if (thread_info->gl_version >= 1.5) {
+ context->backend.gl.gen_buffers =
+ (glitz_gl_gen_buffers_t)
+ glitz_agl_get_proc_address (bundle, "glGenBuffers");
+ context->backend.gl.delete_buffers =
+ (glitz_gl_delete_buffers_t)
+ glitz_agl_get_proc_address (bundle, "glDeleteBuffers");
+ context->backend.gl.bind_buffer =
+ (glitz_gl_bind_buffer_t)
+ glitz_agl_get_proc_address (bundle, "glBindBuffer");
+ context->backend.gl.buffer_data =
+ (glitz_gl_buffer_data_t)
+ glitz_agl_get_proc_address (bundle, "glBufferData");
+ context->backend.gl.buffer_sub_data =
+ (glitz_gl_buffer_sub_data_t)
+ glitz_agl_get_proc_address (bundle, "glBufferSubData");
+ context->backend.gl.get_buffer_sub_data =
+ (glitz_gl_get_buffer_sub_data_t)
+ glitz_agl_get_proc_address (bundle, "glGetBufferSubData");
+ context->backend.gl.map_buffer =
+ (glitz_gl_map_buffer_t)
+ glitz_agl_get_proc_address (bundle, "glMapBuffer");
+ context->backend.gl.unmap_buffer =
+ (glitz_gl_unmap_buffer_t)
+ glitz_agl_get_proc_address (bundle, "glUnmapBuffer");
+ } else {
+ context->backend.gl.gen_buffers =
+ (glitz_gl_gen_buffers_t)
+ glitz_agl_get_proc_address (bundle, "glGenBuffersARB");
+ context->backend.gl.delete_buffers =
+ (glitz_gl_delete_buffers_t)
+ glitz_agl_get_proc_address (bundle, "glDeleteBuffersARB");
+ context->backend.gl.bind_buffer =
+ (glitz_gl_bind_buffer_t)
+ glitz_agl_get_proc_address (bundle, "glBindBufferARB");
+ context->backend.gl.buffer_data =
+ (glitz_gl_buffer_data_t)
+ glitz_agl_get_proc_address (bundle, "glBufferDataARB");
+ context->backend.gl.buffer_sub_data =
+ (glitz_gl_buffer_sub_data_t)
+ glitz_agl_get_proc_address (bundle, "glBufferSubDataARB");
+ context->backend.gl.get_buffer_sub_data =
+ (glitz_gl_get_buffer_sub_data_t)
+ glitz_agl_get_proc_address (bundle, "glGetBufferSubDataARB");
+ context->backend.gl.map_buffer =
+ (glitz_gl_map_buffer_t)
+ glitz_agl_get_proc_address (bundle, "glMapBufferARB");
+ context->backend.gl.unmap_buffer =
+ (glitz_gl_unmap_buffer_t)
+ glitz_agl_get_proc_address (bundle, "glUnmapBufferARB");
+ }
+
+ glitz_agl_release_bundle (bundle);
+
+ context->backend.feature_mask &= ~GLITZ_FEATURE_MULTITEXTURE_MASK;
+ context->backend.feature_mask &= ~GLITZ_FEATURE_PER_COMPONENT_RENDERING_MASK;
+ context->backend.feature_mask &= ~GLITZ_FEATURE_FRAGMENT_PROGRAM_MASK;
+ context->backend.feature_mask &= ~GLITZ_FEATURE_VERTEX_BUFFER_OBJECT_MASK;
+ context->backend.feature_mask &= ~GLITZ_FEATURE_PIXEL_BUFFER_OBJECT_MASK;
+
+ if (context->backend.gl.active_texture) {
+ context->backend.feature_mask |= GLITZ_FEATURE_MULTITEXTURE_MASK;
+
+ if (thread_info->feature_mask & GLITZ_FEATURE_PER_COMPONENT_RENDERING_MASK)
+ context->backend.feature_mask |=
+ GLITZ_FEATURE_PER_COMPONENT_RENDERING_MASK;
+
+ if (context->backend.gl.gen_programs &&
+ context->backend.gl.delete_programs &&
+ context->backend.gl.program_string &&
+ context->backend.gl.bind_program &&
+ context->backend.gl.program_local_param_4fv) {
+ if (thread_info->feature_mask & GLITZ_FEATURE_FRAGMENT_PROGRAM_MASK)
+ context->backend.feature_mask |= GLITZ_FEATURE_FRAGMENT_PROGRAM_MASK;
+ }
+ }
+
+ if (context->backend.gl.gen_buffers &&
+ context->backend.gl.delete_buffers &&
+ context->backend.gl.bind_buffer &&
+ context->backend.gl.buffer_data &&
+ context->backend.gl.buffer_sub_data &&
+ context->backend.gl.get_buffer_sub_data &&
+ context->backend.gl.map_buffer &&
+ context->backend.gl.unmap_buffer) {
+ if (thread_info->feature_mask & GLITZ_FEATURE_VERTEX_BUFFER_OBJECT_MASK)
+ context->backend.feature_mask |= GLITZ_FEATURE_VERTEX_BUFFER_OBJECT_MASK;
+
+ if (thread_info->feature_mask & GLITZ_FEATURE_PIXEL_BUFFER_OBJECT_MASK)
+ context->backend.feature_mask |= GLITZ_FEATURE_PIXEL_BUFFER_OBJECT_MASK;
+ }
+
+ context->backend.gl.need_lookup = 0;
+ }
+
void
glitz_agl_context_make_current (glitz_agl_surface_t *surface,
***************
*** 125,128 ****
--- 259,266 ----
aglSetCurrentContext (context);
+
+ if (surface->context->backend.gl.need_lookup)
+ glitz_agl_context_proc_address_lookup (surface->thread_info,
+ surface->context);
}
Index: glitz_agl_extension.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_agl_extension.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** glitz_agl_extension.c 15 Sep 2004 20:26:44 -0000 1.12
--- glitz_agl_extension.c 20 Sep 2004 04:59:34 -0000 1.13
***************
*** 57,68 ****
{ 0.0, "GL_ARB_multitexture", GLITZ_AGL_FEATURE_MULTITEXTURE_MASK },
{ 0.0, "GL_ARB_fragment_program", GLITZ_AGL_FEATURE_FRAGMENT_PROGRAM_MASK },
!
! /* TODO: lookup all symbols not part of OpenGL 1.2
! { 1.5, "GL_ARB_vertex_buffer_object",
! GLITZ_GLX_FEATURE_VERTEX_BUFFER_OBJECT_MASK },
! { 0.0, "GL_EXT_pixel_buffer_object",
! GLITZ_GLX_FEATURE_PIXEL_BUFFER_OBJECT_MASK },
! */
!
{ 0.0, NULL, 0 }
};
--- 57,64 ----
{ 0.0, "GL_ARB_multitexture", GLITZ_AGL_FEATURE_MULTITEXTURE_MASK },
{ 0.0, "GL_ARB_fragment_program", GLITZ_AGL_FEATURE_FRAGMENT_PROGRAM_MASK },
! { 0.0, "GL_ARB_vertex_buffer_object",
! GLITZ_AGL_FEATURE_VERTEX_BUFFER_OBJECT_MASK },
! { 0.0, "GL_EXT_pixel_buffer_object",
! GLITZ_AGL_FEATURE_PIXEL_BUFFER_OBJECT_MASK },
{ 0.0, NULL, 0 }
};
***************
*** 83,95 ****
glitz_agl_query_extensions (glitz_agl_thread_info_t *thread_info)
{
! glitz_gl_float_t gl_version;
!
! gl_version = atof ((const char *) glGetString (GL_VERSION));
! if (gl_version < 1.2)
return GLITZ_STATUS_NOT_SUPPORTED;
thread_info->agl_feature_mask = 0;
! thread_info->agl_feature_mask |= _glitz_agl_extension_query_gl (gl_version);
thread_info->feature_mask = 0;
--- 79,90 ----
glitz_agl_query_extensions (glitz_agl_thread_info_t *thread_info)
{
! thread_info->gl_version = atof ((const char *) glGetString (GL_VERSION));
! if (thread_info->gl_version < 1.2)
return GLITZ_STATUS_NOT_SUPPORTED;
thread_info->agl_feature_mask = 0;
! thread_info->agl_feature_mask |=
! _glitz_agl_extension_query_gl (thread_info->gl_version);
thread_info->feature_mask = 0;
Index: glitz_agl_info.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_agl_info.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** glitz_agl_info.c 13 Sep 2004 17:50:38 -0000 1.13
--- glitz_agl_info.c 20 Sep 2004 04:59:34 -0000 1.14
***************
*** 93,105 ****
(glitz_gl_get_integer_v_t) glGetIntegerv,
! (glitz_gl_active_texture_t) glActiveTextureARB,
! (glitz_gl_gen_programs_t) glGenProgramsARB,
! (glitz_gl_delete_programs_t) glDeleteProgramsARB,
! (glitz_gl_program_string_t) glProgramStringARB,
! (glitz_gl_bind_program_t) glBindProgramARB,
! (glitz_gl_program_local_param_4fv_t) glProgramLocalParameter4fvARB,
! (glitz_gl_get_program_iv_t) glGetProgramivARB,
!
! /* TODO: lookup all symbols not part of OpenGL 1.2 */
(glitz_gl_gen_buffers_t) 0,
(glitz_gl_delete_buffers_t) 0,
--- 93,103 ----
(glitz_gl_get_integer_v_t) glGetIntegerv,
! (glitz_gl_active_texture_t) 0,
! (glitz_gl_gen_programs_t) 0,
! (glitz_gl_delete_programs_t) 0,
! (glitz_gl_program_string_t) 0,
! (glitz_gl_bind_program_t) 0,
! (glitz_gl_program_local_param_4fv_t) 0,
! (glitz_gl_get_program_iv_t) 0,
(glitz_gl_gen_buffers_t) 0,
(glitz_gl_delete_buffers_t) 0,
***************
*** 111,117 ****
(glitz_gl_unmap_buffer_t) 0,
! 0
};
static void
glitz_agl_thread_info_init (glitz_agl_thread_info_t *thread_info);
--- 109,185 ----
(glitz_gl_unmap_buffer_t) 0,
! 1
};
+ CFBundleRef
+ glitz_agl_get_bundle (const char *name)
+ {
+ CFBundleRef bundle = 0;
+ FSRefParam ref_param;
+ unsigned char framework_name[256];
+
+ framework_name[0] = strlen (name);
+ strcpy (&framework_name[1], name);
+
+ memset (&ref_param, 0, sizeof (ref_param));
+
+ if (FindFolder (kSystemDomain,
+ kFrameworksFolderType,
+ kDontCreateFolder,
+ &ref_param.ioVRefNum,
+ &ref_param.ioDirID) == noErr) {
+ FSRef ref;
+
+ memset (&ref, 0, sizeof (ref));
+
+ ref_param.ioNamePtr = framework_name;
+ ref_param.newRef = &ref;
+
+ if (PBMakeFSRefSync (&ref_param) == noErr) {
+ CFURLRef url;
+
+ url = CFURLCreateFromFSRef (kCFAllocatorDefault, &ref);
+ if (url) {
+ bundle = CFBundleCreate (kCFAllocatorDefault, url);
+ CFRelease (url);
+
+ if (!CFBundleLoadExecutable (bundle)) {
+ CFRelease (bundle);
+ return (CFBundleRef) 0;
+ }
+ }
+ }
+ }
+
+ return bundle;
+ }
+
+ void
+ glitz_agl_release_bundle (CFBundleRef bundle)
+ {
+ if (bundle) {
+ CFBundleUnloadExecutable (bundle);
+ CFRelease (bundle);
+ }
+ }
+
+ glitz_function_pointer_t
+ glitz_agl_get_proc_address (CFBundleRef bundle, const char *name)
+ {
+ glitz_function_pointer_t address = NULL;
+ CFStringRef str;
+
+ if (bundle) {
+ str = CFStringCreateWithCString (kCFAllocatorDefault, name,
+ kCFStringEncodingMacRoman);
+
+ address = CFBundleGetFunctionPointerForName (bundle, str);
+
+ CFRelease (str);
+ }
+
+ return address;
+ }
+
static void
glitz_agl_thread_info_init (glitz_agl_thread_info_t *thread_info);
***************
*** 236,241 ****
aglSetCurrentContext (thread_info->root_context.context);
! if (glitz_agl_query_extensions (thread_info) == GLITZ_STATUS_SUCCESS)
glitz_agl_query_formats (thread_info);
}
}
--- 304,312 ----
aglSetCurrentContext (thread_info->root_context.context);
! if (glitz_agl_query_extensions (thread_info) == GLITZ_STATUS_SUCCESS) {
! glitz_agl_context_proc_address_lookup (thread_info,
! &thread_info->root_context);
glitz_agl_query_formats (thread_info);
+ }
}
}
***************
*** 251,256 ****
thread_info->root_context.backend.program_map = &thread_info->program_map;
thread_info->root_context.backend.feature_mask = thread_info->feature_mask;
!
! thread_info->root_context.backend.gl.need_lookup = 0;
thread_info->context_stack_size = 1;
--- 322,327 ----
thread_info->root_context.backend.program_map = &thread_info->program_map;
thread_info->root_context.backend.feature_mask = thread_info->feature_mask;
!
! thread_info->root_context.backend.gl.need_lookup = 1;
thread_info->context_stack_size = 1;
***************
*** 266,270 ****
if (thread_info->root_context.context) {
aglSetCurrentContext (thread_info->root_context.context);
! glitz_program_map_fini (&_glitz_agl_gl_proc_address,
&thread_info->program_map);
aglSetCurrentContext (NULL);
--- 337,341 ----
if (thread_info->root_context.context) {
aglSetCurrentContext (thread_info->root_context.context);
! glitz_program_map_fini (&thread_info->root_context.backend.gl,
&thread_info->program_map);
aglSetCurrentContext (NULL);
Index: glitz_agl_surface.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_agl_surface.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** glitz_agl_surface.c 9 Sep 2004 09:50:26 -0000 1.19
--- glitz_agl_surface.c 20 Sep 2004 04:59:34 -0000 1.20
***************
*** 148,151 ****
--- 148,156 ----
surface->base.flags |= GLITZ_SURFACE_FLAG_DRAWABLE_MASK;
+ if (surface->context->backend.gl.need_lookup) {
+ glitz_agl_context_push_current (surface, GLITZ_CN_SURFACE_CONTEXT_CURRENT);
+ glitz_agl_context_pop_current (surface);
+ }
+
return &surface->base;
}
***************
*** 191,194 ****
--- 196,204 ----
surface->base.flags |= GLITZ_SURFACE_FLAG_DRAWABLE_MASK;
+
+ if (surface->context->backend.gl.need_lookup) {
+ glitz_agl_context_push_current (surface, GLITZ_CN_SURFACE_CONTEXT_CURRENT);
+ glitz_agl_context_pop_current (surface);
+ }
return &surface->base;
Index: glitz_aglint.h
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_aglint.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** glitz_aglint.h 7 Sep 2004 14:28:21 -0000 1.12
--- glitz_aglint.h 20 Sep 2004 04:59:34 -0000 1.13
***************
*** 80,83 ****
--- 80,84 ----
unsigned long feature_mask;
unsigned long agl_feature_mask;
+ glitz_gl_float_t gl_version;
glitz_program_map_t program_map;
***************
*** 101,104 ****
--- 102,114 ----
glitz_agl_thread_info_get (void);
+ extern CFBundleRef __internal_linkage
+ glitz_agl_get_bundle (const char *name);
+
+ extern void __internal_linkage
+ glitz_agl_release_bundle (CFBundleRef bundle);
+
+ extern glitz_function_pointer_t __internal_linkage
+ glitz_agl_get_proc_address (CFBundleRef bundle, const char *name);
+
extern glitz_agl_context_t *__internal_linkage
glitz_agl_context_get (glitz_agl_thread_info_t *thread_info,
***************
*** 122,125 ****
--- 132,139 ----
extern void __internal_linkage
+ glitz_agl_context_proc_address_lookup (glitz_agl_thread_info_t *thread_info,
+ glitz_agl_context_t *context);
+
+ extern void __internal_linkage
glitz_agl_query_formats (glitz_agl_thread_info_t *thread_info);
Index: glitz_gl.h
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_gl.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** glitz_gl.h 13 Sep 2004 17:50:38 -0000 1.10
--- glitz_gl.h 20 Sep 2004 04:59:34 -0000 1.11
***************
*** 239,249 ****
#define GLITZ_GL_MULTISAMPLE_FILTER_HINT 0x8534
! #define GLITZ_GL_FRAGMENT_PROGRAM 0x8804
! #define GLITZ_GL_PROGRAM_STRING 0x8628
! #define GLITZ_GL_PROGRAM_FORMAT_ASCII 0x8875
! #define GLITZ_GL_PROGRAM_ERROR_POSITION 0x864B
! #define GLITZ_GL_MAX_PROGRAM_LOCAL_PARAMETERS 0x88B4
! #define GLITZ_GL_PROGRAM_UNDER_NATIVE_LIMITS 0x88B6
! #define GLITZ_GL_PROGRAM_NATIVE_INSTRUCTIONS 0x88A2
#define GLITZ_GL_ARRAY_BUFFER 0x8892
--- 239,268 ----
#define GLITZ_GL_MULTISAMPLE_FILTER_HINT 0x8534
! #define GLITZ_GL_FRAGMENT_PROGRAM 0x8804
! #define GLITZ_GL_PROGRAM_STRING 0x8628
! #define GLITZ_GL_PROGRAM_FORMAT_ASCII 0x8875
! #define GLITZ_GL_PROGRAM_ERROR_POSITION 0x864B
! #define GLITZ_GL_MAX_PROGRAM_LOCAL_PARAMETERS 0x88B4
! #define GLITZ_GL_PROGRAM_INSTRUCTIONS 0x88A0
! #define GLITZ_GL_MAX_PROGRAM_INSTRUCTIONS 0x88A1
! #define GLITZ_GL_PROGRAM_NATIVE_INSTRUCTIONS 0x88A2
! #define GLITZ_GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS 0x88A3
! #define GLITZ_GL_PROGRAM_PARAMETERS 0x88A8
! #define GLITZ_GL_MAX_PROGRAM_PARAMETERS 0x88A9
! #define GLITZ_GL_PROGRAM_NATIVE_PARAMETERS 0x88AA
! #define GLITZ_GL_MAX_PROGRAM_NATIVE_PARAMETERS 0x88AB
! #define GLITZ_GL_PROGRAM_UNDER_NATIVE_LIMITS 0x88B6
! #define GLITZ_GL_PROGRAM_ALU_INSTRUCTIONS 0x8805
! #define GLITZ_GL_PROGRAM_TEX_INSTRUCTIONS 0x8806
! #define GLITZ_GL_PROGRAM_TEX_INDIRECTIONS 0x8807
! #define GLITZ_GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS 0x8808
! #define GLITZ_GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS 0x8809
! #define GLITZ_GL_PROGRAM_NATIVE_TEX_INDIRECTIONS 0x880A
! #define GLITZ_GL_MAX_PROGRAM_ALU_INSTRUCTIONS 0x880B
! #define GLITZ_GL_MAX_PROGRAM_TEX_INSTRUCTIONS 0x880C
! #define GLITZ_GL_MAX_PROGRAM_TEX_INDIRECTIONS 0x880D
! #define GLITZ_GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS 0x880E
! #define GLITZ_GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS 0x880F
! #define GLITZ_GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS 0x8810
#define GLITZ_GL_ARRAY_BUFFER 0x8892
Index: glitz_glx_context.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_glx_context.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** glitz_glx_context.c 13 Sep 2004 17:50:38 -0000 1.14
--- glitz_glx_context.c 20 Sep 2004 04:59:34 -0000 1.15
***************
*** 189,193 ****
context->backend.n_formats = screen_info->n_formats;
context->backend.program_map = &screen_info->program_map;
! context->backend.feature_mask = 0;
context->backend.gl.need_lookup = 1;
--- 189,193 ----
context->backend.n_formats = screen_info->n_formats;
context->backend.program_map = &screen_info->program_map;
! context->backend.feature_mask = screen_info->feature_mask;
context->backend.gl.need_lookup = 1;
***************
*** 293,298 ****
}
- context->backend.feature_mask = screen_info->feature_mask;
-
context->backend.feature_mask &= ~GLITZ_FEATURE_MULTITEXTURE_MASK;
context->backend.feature_mask &= ~GLITZ_FEATURE_PER_COMPONENT_RENDERING_MASK;
--- 293,296 ----
Index: glitz_glx_info.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_glx_info.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** glitz_glx_info.c 13 Sep 2004 17:50:38 -0000 1.19
--- glitz_glx_info.c 20 Sep 2004 04:59:34 -0000 1.20
***************
*** 413,417 ****
screen_info->root_context.backend.formats = NULL;
screen_info->root_context.backend.n_formats = 0;
! screen_info->root_context.backend.program_map = &screen_info->program_map;
screen_info->root_context.backend.feature_mask = 0;
--- 413,417 ----
screen_info->root_context.backend.formats = NULL;
screen_info->root_context.backend.n_formats = 0;
! screen_info->root_context.backend.program_map = NULL;
screen_info->root_context.backend.feature_mask = 0;
***************
*** 471,474 ****
--- 471,476 ----
screen_info->root_context.backend.formats = screen_info->formats;
screen_info->root_context.backend.n_formats = screen_info->n_formats;
+ screen_info->root_context.backend.program_map = &screen_info->program_map;
+ screen_info->root_context.backend.feature_mask = screen_info->feature_mask;
screen_info->context_stack_size = 1;
Index: glitz_program.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_program.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** glitz_program.c 9 Sep 2004 23:09:03 -0000 1.14
--- glitz_program.c 20 Sep 2004 04:59:34 -0000 1.15
***************
*** 226,229 ****
--- 226,281 ----
};
+ static struct _glitz_program_query {
+ glitz_gl_enum_t query;
+ glitz_gl_enum_t max_query;
+ glitz_gl_int_t min;
+ } _program_limits[] = {
+ { GLITZ_GL_PROGRAM_INSTRUCTIONS,
+ GLITZ_GL_MAX_PROGRAM_INSTRUCTIONS, 1 },
+ { GLITZ_GL_PROGRAM_NATIVE_INSTRUCTIONS,
+ GLITZ_GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS, 1 },
+ { GLITZ_GL_PROGRAM_PARAMETERS,
+ GLITZ_GL_MAX_PROGRAM_PARAMETERS, 1 },
+ { GLITZ_GL_PROGRAM_NATIVE_PARAMETERS,
+ GLITZ_GL_MAX_PROGRAM_NATIVE_PARAMETERS, 1 },
+ { GLITZ_GL_PROGRAM_ALU_INSTRUCTIONS,
+ GLITZ_GL_MAX_PROGRAM_ALU_INSTRUCTIONS, 0 },
+ { GLITZ_GL_PROGRAM_TEX_INSTRUCTIONS,
+ GLITZ_GL_MAX_PROGRAM_TEX_INSTRUCTIONS, 1 },
+ { GLITZ_GL_PROGRAM_TEX_INDIRECTIONS,
+ GLITZ_GL_MAX_PROGRAM_TEX_INDIRECTIONS, 0 },
+ { GLITZ_GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS,
+ GLITZ_GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS, 0 },
+ { GLITZ_GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS,
+ GLITZ_GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS, 0 },
+ { GLITZ_GL_PROGRAM_NATIVE_TEX_INDIRECTIONS,
+ GLITZ_GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS, 0 },
+ };
+
+ static glitz_bool_t
+ _glitz_program_under_limits (glitz_gl_proc_address_list_t *gl)
+ {
+ int i, n_limits;
+
+ n_limits = sizeof (_program_limits) / (sizeof (struct _glitz_program_query));
+
+ for (i = 0; i < n_limits; i++) {
+ glitz_gl_int_t value, max;
+
+ gl->get_program_iv (GLITZ_GL_FRAGMENT_PROGRAM,
+ _program_limits[i].query, &value);
+ gl->get_program_iv (GLITZ_GL_FRAGMENT_PROGRAM,
+ _program_limits[i].max_query, &max);
+
+ if (value < _program_limits[i].min)
+ return 0;
+
+ if (value >= max)
+ return 0;
+ }
+
+ return 1;
+ }
+
static glitz_gl_int_t
_glitz_compile_arb_fragment_program (glitz_gl_proc_address_list_t *gl,
***************
*** 236,241 ****
/* clear error flags */
while (gl->get_error () != GLITZ_GL_NO_ERROR);
-
- gl->enable (GLITZ_GL_FRAGMENT_PROGRAM);
gl->gen_programs (1, &program);
--- 288,291 ----
***************
*** 247,269 ****
if (gl->get_error () == GLITZ_GL_NO_ERROR) {
gl->get_integer_v (GLITZ_GL_PROGRAM_ERROR_POSITION, &error);
!
if (error == -1) {
glitz_gl_int_t value;
gl->get_program_iv (GLITZ_GL_FRAGMENT_PROGRAM,
! GLITZ_GL_PROGRAM_NATIVE_INSTRUCTIONS,
&value);
! if (value > 0) {
gl->get_program_iv (GLITZ_GL_FRAGMENT_PROGRAM,
GLITZ_GL_MAX_PROGRAM_LOCAL_PARAMETERS,
&value);
! if (value >= n_parameters)
! pid = program;
}
}
}
- gl->disable (GLITZ_GL_FRAGMENT_PROGRAM);
-
if (pid == -1) {
gl->bind_program (GLITZ_GL_FRAGMENT_PROGRAM, 0);
--- 297,321 ----
if (gl->get_error () == GLITZ_GL_NO_ERROR) {
gl->get_integer_v (GLITZ_GL_PROGRAM_ERROR_POSITION, &error);
!
if (error == -1) {
glitz_gl_int_t value;
gl->get_program_iv (GLITZ_GL_FRAGMENT_PROGRAM,
! GLITZ_GL_PROGRAM_UNDER_NATIVE_LIMITS,
&value);
!
! if (value == GLITZ_GL_TRUE) {
gl->get_program_iv (GLITZ_GL_FRAGMENT_PROGRAM,
GLITZ_GL_MAX_PROGRAM_LOCAL_PARAMETERS,
&value);
!
! if (value >= n_parameters) {
! if (_glitz_program_under_limits (gl))
! pid = program;
! }
}
}
}
if (pid == -1) {
gl->bind_program (GLITZ_GL_FRAGMENT_PROGRAM, 0);
Index: glitz_texture.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_texture.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** glitz_texture.c 9 Sep 2004 09:50:26 -0000 1.13
--- glitz_texture.c 20 Sep 2004 04:59:34 -0000 1.14
***************
*** 43,48 ****
texture->format = texture_format;
texture->name = 0;
- texture->flags = GLITZ_TEXTURE_FLAG_REPEATABLE_MASK |
- GLITZ_TEXTURE_FLAG_PADABLE_MASK;
if (feature_mask & GLITZ_FEATURE_TEXTURE_BORDER_CLAMP_MASK) {
--- 43,46 ----
***************
*** 50,53 ****
--- 48,53 ----
texture->box.x2 = texture->width = width;
texture->box.y2 = texture->height = height;
+ texture->flags = GLITZ_TEXTURE_FLAG_REPEATABLE_MASK |
+ GLITZ_TEXTURE_FLAG_PADABLE_MASK;
} else {
texture->box.x1 = texture->box.y1 = 1;
***************
*** 56,63 ****
texture->width = width + 2;
texture->height = height + 2;
! texture->flags &= ~(GLITZ_TEXTURE_FLAG_REPEATABLE_MASK |
! GLITZ_TEXTURE_FLAG_PADABLE_MASK);
}
!
if ((feature_mask & GLITZ_FEATURE_TEXTURE_NON_POWER_OF_TWO_MASK) ||
(POWER_OF_TWO (texture->width) && POWER_OF_TWO (texture->height))) {
--- 56,62 ----
texture->width = width + 2;
texture->height = height + 2;
! texture->flags = 0;
}
!
if ((feature_mask & GLITZ_FEATURE_TEXTURE_NON_POWER_OF_TWO_MASK) ||
(POWER_OF_TWO (texture->width) && POWER_OF_TWO (texture->height))) {
More information about the cairo-commit
mailing list