apple: Initial import of libGL for OSX from AppleSGLX svn repository.
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
This commit is contained in:
parent
f1381880a8
commit
ad503c4155
|
@ -0,0 +1,4 @@
|
|||
apple_xgl_api.[hc]
|
||||
exports.list
|
||||
stage.[1234]
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
#GL_EXT_texture_object
|
||||
alias AreTexturesResidentEXT AreTexturesResident
|
||||
alias BindTextureEXT BindTexture
|
||||
alias DeleteTexturesEXT DeleteTextures
|
||||
alias GenTexturesEXT GenTextures
|
||||
alias IsTextureEXT IsTexture
|
||||
alias PrioritizeTexturesEXT PrioritizeTextures
|
||||
alias TexImage3DEXT TexImage3D
|
|
@ -0,0 +1,106 @@
|
|||
extension ARB_transpose_matrix
|
||||
extension ARB_vertex_program
|
||||
extension ARB_vertex_blend
|
||||
extension ARB_window_pos
|
||||
extension ARB_shader_objects
|
||||
extension ARB_vertex_shader
|
||||
extension ARB_shading_language_100
|
||||
extension ARB_imaging
|
||||
extension ARB_point_parameters
|
||||
extension ARB_texture_env_crossbar
|
||||
extension ARB_texture_border_clamp
|
||||
extension ARB_multitexture
|
||||
extension ARB_texture_env_add
|
||||
extension ARB_texture_cube_map
|
||||
extension ARB_texture_env_dot3
|
||||
extension ARB_multisample
|
||||
extension ARB_texture_env_combine
|
||||
extension ARB_texture_compression
|
||||
extension ARB_texture_mirrored_repeat
|
||||
extension ARB_shadow
|
||||
extension ARB_depth_texture
|
||||
extension ARB_shadow_ambient
|
||||
extension ARB_fragment_program
|
||||
extension ARB_fragment_program_shadow
|
||||
extension ARB_fragment_shader
|
||||
extension ARB_occlusion_query
|
||||
extension ARB_point_sprite
|
||||
extension ARB_texture_non_power_of_two
|
||||
extension ARB_vertex_buffer_object
|
||||
extension ARB_pixel_buffer_object
|
||||
extension ARB_draw_buffers
|
||||
extension ARB_shader_texture_lod
|
||||
extension ARB_texture_rectangle
|
||||
extension ARB_texture_float
|
||||
extension ARB_half_float_pixel
|
||||
|
||||
extension EXT_multi_draw_arrays
|
||||
extension EXT_clip_volume_hint
|
||||
extension EXT_rescale_normal
|
||||
extension EXT_draw_range_elements
|
||||
extension EXT_fog_coord
|
||||
extension EXT_gpu_program_parameters
|
||||
extension EXT_geometry_shader4
|
||||
|
||||
#The gl.spec has the wrong arguments for GetTransformFeedbackVaryingEXT
|
||||
#extension EXT_transform_feedback
|
||||
extension EXT_compiled_vertex_array
|
||||
extension EXT_framebuffer_object
|
||||
extension EXT_framebuffer_blit
|
||||
extension EXT_framebuffer_multisample
|
||||
extension EXT_texture_rectangle
|
||||
extension EXT_texture_env_add
|
||||
extension EXT_blend_color
|
||||
extension EXT_blend_minmax
|
||||
extension EXT_blend_subtract
|
||||
extension EXT_texture_lod_bias
|
||||
extension EXT_abgr
|
||||
extension EXT_bgra
|
||||
extension EXT_stencil_wrap
|
||||
extension EXT_texture_filter_anisotropic
|
||||
extension EXT_separate_specular_color
|
||||
extension EXT_secondary_color
|
||||
extension EXT_blend_func_separate
|
||||
extension EXT_shadow_funcs
|
||||
extension EXT_stencil_two_side
|
||||
extension EXT_texture_compression_s3tc
|
||||
extension EXT_texture_compression_dxt1
|
||||
extension EXT_texture_sRGB
|
||||
extension EXT_blend_equation_separate
|
||||
extension EXT_texture_mirror_clamp
|
||||
extension EXT_packed_depth_stencil
|
||||
|
||||
extension APPLE_client_storage
|
||||
extension APPLE_specular_vector
|
||||
extension APPLE_transform_hint
|
||||
extension APPLE_packed_pixels
|
||||
#The gl.spec has different argument types for this:
|
||||
#extension APPLE_fence
|
||||
extension APPLE_vertex_array_object
|
||||
extension APPLE_vertex_program_evaluators
|
||||
extension APPLE_element_array
|
||||
extension APPLE_flush_render
|
||||
extension APPLE_aux_depth_stencil
|
||||
extension APPLE_flush_buffer_range
|
||||
extension APPLE_ycbcr_422
|
||||
#The gl.spec has different argument types for this:
|
||||
#extension APPLE_vertex_array_range
|
||||
extension APPLE_texture_range
|
||||
extension APPLE_float_pixels
|
||||
extension APPLE_pixel_buffer
|
||||
extension APPLE_object_purgeable
|
||||
|
||||
#The OpenGL framework has moved this to the core OpenGL, and eliminated EXT_convolution listing.
|
||||
#extension EXT_convolution
|
||||
|
||||
#Leopard supports these according to nm.
|
||||
#Applications should use the GL_EXTENSIONS list to determine capabilities.
|
||||
extension EXT_paletted_texture
|
||||
extension APPLE_fence
|
||||
extension NV_vertex_program4
|
||||
extension EXT_draw_buffers2
|
||||
extension EXT_gpu_shader4
|
||||
extension ATI_pn_triangles
|
||||
extension NV_register_combiners
|
||||
extension EXT_depth_bounds_test
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
#These are for compatibility with the old libGL.
|
||||
noop SGI_color_table
|
||||
noop EXT_convolution
|
||||
noop EXT_cull_vertex
|
||||
noop NV_fence
|
||||
noop SGIS_detail_texture
|
||||
noop SGIX_fragment_lighting
|
||||
noop SGIX_flush_raster
|
||||
noop EXT_vertex_array
|
||||
noop SGIX_instruments
|
||||
noop EXT_histogram
|
||||
noop NV_vertex_program
|
||||
noop PGI_misc_hints
|
||||
noop SGIS_multisample
|
||||
noop EXT_multisample
|
|
@ -0,0 +1,4 @@
|
|||
promoted MESA_window_pos
|
||||
promoted ARB_window_pos
|
||||
promoted EXT_copy_texture
|
||||
promoted ARB_vertex_program
|
|
@ -0,0 +1,97 @@
|
|||
INSTALL_DIR = /usr/X11
|
||||
X11_DIR = $(INSTALL_DIR)
|
||||
|
||||
CC=gcc
|
||||
GL_CFLAGS=-Wall -ggdb3 -Os -DPTHREADS -D_REENTRANT -DGLX_USE_APPLEGL -DGLX_ALIAS_UNSUPPORTED $(RC_CFLAGS) $(CFLAGS)
|
||||
GL_LDFLAGS=-L$(INSTALL_DIR)/lib -L$(X11_DIR)/lib $(LDFLAGS) -Wl,-single_module
|
||||
|
||||
TCLSH=tclsh8.5
|
||||
|
||||
MKDIR=mkdir
|
||||
INSTALL=install
|
||||
LN=ln
|
||||
RM=rm
|
||||
|
||||
INCLUDE=-I. -Iinclude -Iinclude/internal -I.. -I../../../include -I$(INSTALL_DIR)/include -I$(X11_DIR)/include
|
||||
COMPILE=$(CC) $(INCLUDE) $(GL_CFLAGS) -c
|
||||
|
||||
#The directory with the final binaries.
|
||||
BUILD_DIR=builds
|
||||
|
||||
all: $(BUILD_DIR)/libGL.1.2.dylib
|
||||
|
||||
OBJECTS=glxext.o glxcmds.o glx_pbuffer.o glx_query.o glxcurrent.o glxextensions.o \
|
||||
appledri.o apple_glx_context.o apple_glx.o pixel.o \
|
||||
compsize.o apple_visual.o apple_cgl.o glxreply.o glcontextmodes.o \
|
||||
apple_xgl_api.o apple_glx_drawable.o xfont.o apple_glx_pbuffer.o \
|
||||
apple_glx_pixmap.o apple_xgl_api_read.o glx_empty.o glx_error.o \
|
||||
apple_xgl_api_viewport.o apple_glx_surface.o apple_xgl_api_stereo.o
|
||||
|
||||
$(BUILD_DIR)/libGL.1.2.dylib: $(OBJECTS)
|
||||
-if ! test -d $(BUILD_DIR); then $(MKDIR) $(BUILD_DIR); fi
|
||||
$(CC) $(GL_CFLAGS) -o $@ -dynamiclib -install_name $(INSTALL_DIR)/lib/libGL.1.dylib -compatibility_version 1.2 -current_version 1.2 -lXplugin -framework ApplicationServices -framework CoreFoundation $(GL_LDFLAGS) -lXext -lX11 -Wl,-exported_symbols_list,exports.list $(OBJECTS)
|
||||
|
||||
.c.o:
|
||||
$(COMPILE) $<
|
||||
|
||||
apple_glx_drawable.o: apple_glx_drawable.h apple_glx_drawable.c include/GL/gl.h
|
||||
apple_xgl_api.o: apple_xgl_api.h apple_xgl_api.c apple_xgl_api_stereo.c include/GL/gl.h
|
||||
apple_xgl_api_read.o: apple_xgl_api_read.h apple_xgl_api_read.c apple_xgl_api.h include/GL/gl.h
|
||||
apple_xgl_api_viewport.o: apple_xgl_api_viewport.h apple_xgl_api_viewport.c apple_xgl_api.h include/GL/gl.h
|
||||
apple_xgl_api_stereo.o: apple_xgl_api_stereo.h apple_xgl_api_stereo.c apple_xgl_api.h include/GL/gl.h
|
||||
glcontextmodes.o: glcontextmodes.c include/GL/gl.h
|
||||
glxext.o: glxext.c include/GL/gl.h
|
||||
glxreply.o: glxreply.c include/GL/gl.h
|
||||
glxcmds.o: glxcmds.c apple_glx_context.h include/GL/gl.h
|
||||
glx_pbuffer.o: glx_pbuffer.c include/GL/gl.h
|
||||
glx_error.o: glx_error.c include/GL/gl.h
|
||||
glx_query.o: glx_query.c include/GL/gl.h
|
||||
glxcurrent.o: glxcurrent.c include/GL/gl.h
|
||||
glxextensions.o: glxextensions.c include/GL/gl.h
|
||||
glxhash.o: glxhash.h glxhash.c include/GL/gl.h
|
||||
appledri.o: appledri.h appledristr.h appledri.c include/GL/gl.h
|
||||
apple_glx_context.o: apple_glx_context.c apple_glx_context.h apple_glx_context.h include/GL/gl.h
|
||||
apple_glx.o: apple_glx.h apple_glx.c apple_xgl_api.h include/GL/gl.h
|
||||
apple_visual.o: apple_visual.h apple_visual.c include/GL/gl.h
|
||||
apple_cgl.o: apple_cgl.h apple_cgl.c include/GL/gl.h
|
||||
apple_glx_pbuffer.o: apple_glx_drawable.h apple_glx_pbuffer.c include/GL/gl.h
|
||||
apple_glx_pixmap.o: apple_glx_drawable.h apple_glx_pixmap.c appledri.h include/GL/gl.h
|
||||
apple_glx_surface.o: apple_glx_drawable.h apple_glx_surface.c appledri.h include/GL/gl.h
|
||||
xfont.o: xfont.c include/GL/gl.h
|
||||
compsize.o: compsize.c include/GL/gl.h
|
||||
renderpix.o: renderpix.c include/GL/gl.h
|
||||
singlepix.o: singlepix.c include/GL/gl.h
|
||||
pixel.o: pixel.c include/GL/gl.h
|
||||
glx_empty.o: glx_empty.c include/GL/gl.h
|
||||
|
||||
apple_xgl_api.c: apple_xgl_api.h
|
||||
apple_xgl_api.h: gen_api_header.tcl gen_api_library.tcl gen_code.tcl gen_defs.tcl gen_exports.tcl gen_funcs.tcl gen_types.tcl
|
||||
$(TCLSH) gen_code.tcl
|
||||
|
||||
include/GL/gl.h: include/GL/gl.h.template gen_gl_h.sh
|
||||
./gen_gl_h.sh include/GL/gl.h.template $@
|
||||
|
||||
install_headers: include/GL/gl.h
|
||||
$(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/include/GL
|
||||
$(INSTALL) -m 644 include/GL/gl.h include/GL/glext.h include/GL/glx.h include/GL/glxext.h $(DESTDIR)$(INSTALL_DIR)/include/GL
|
||||
|
||||
install_libraries: $(BUILD_DIR)/libGL.1.2.dylib
|
||||
$(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/lib
|
||||
$(INSTALL) -m 755 $(BUILD_DIR)/libGL.1.2.dylib $(DESTDIR)$(INSTALL_DIR)/lib
|
||||
$(RM) -f $(DESTDIR)$(INSTALL_DIR)/lib/libGL.dylib
|
||||
$(LN) -s libGL.1.2.dylib $(DESTDIR)$(INSTALL_DIR)/lib/libGL.dylib
|
||||
$(RM) -f $(DESTDIR)$(INSTALL_DIR)/lib/libGL.1.dylib
|
||||
$(LN) -s libGL.1.2.dylib $(DESTDIR)$(INSTALL_DIR)/lib/libGL.1.dylib
|
||||
|
||||
install: install_headers install_libraries
|
||||
|
||||
clean:
|
||||
rm -rf $(BUILD_DIR)
|
||||
rm -f *.o *.a
|
||||
rm -f *.c~ *.h~
|
||||
rm -f apple_xgl_api.h apple_xgl_api.c
|
||||
rm -f *.dylib
|
||||
rm -f include/GL/gl.h
|
||||
|
||||
%.c : ../%.c
|
||||
ln -s $<
|
|
@ -0,0 +1,18 @@
|
|||
A lot of the code is automatically generated.
|
||||
|
||||
The following are generated based on specs/gl.spec and specs/enum.spec (from OpenGL.org):
|
||||
|
||||
apple_xgl_api.h
|
||||
apple_xgl_api.c
|
||||
exports.list
|
||||
include/GL/gl.h
|
||||
include/GL/glext.h (includes the OpenGL framework glext.h)
|
||||
|
||||
The gen_code.tcl script is what executes the various gen_*.tcl scripts to produce those.
|
||||
|
||||
You will need Tcl 8.5 for the gen_code.tcl script.
|
||||
|
||||
The tests/ directory contains some tests that are built in testbuilds.
|
||||
|
||||
The tests built in testbuilds don't require installation of the library.
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
The design of most of this code is such that we extend the GLX structures
|
||||
with a void * named apple.
|
||||
|
||||
The GLX functions that need to do Apple-specific things are passed
|
||||
&s->apple in order to initialize the private structures.
|
||||
|
||||
Thus when updating, just run a diff against glxext.c or glxcmds.c, and
|
||||
manually merge from there as needed.
|
|
@ -0,0 +1,71 @@
|
|||
AppleSGLX Release Notes
|
||||
|
||||
o OpenGL Support
|
||||
|
||||
AppleSGLX supports the same version of OpenGL as Leopard (OpenGL 2.1).
|
||||
Many extensions from the OpenGL framework are now builtin.
|
||||
|
||||
This adds support for GLSL, and a variety of other features.
|
||||
|
||||
o Thread Support
|
||||
|
||||
Thread support has been improved since the libGL in XQuartz 2.3.2.1.
|
||||
|
||||
o GLX 1.4 Support
|
||||
|
||||
The GLX 1.3 and 1.4 functions should all work with a few exceptions
|
||||
as outlined in this document.
|
||||
|
||||
o glXMakeContextCurrent (a GLX 1.3 feature)
|
||||
|
||||
glXMakeContextCurrent should work with the readable drawable. The
|
||||
OpenGL functions: glReadPixels, glCopyPixels, and glCopyColorTable,
|
||||
should use the readable drawable if it's different than the rendering
|
||||
drawable.
|
||||
|
||||
o glXGetProcAddress (a GLX 1.4 feature and ARB extension)
|
||||
|
||||
glXGetProcAddress should work and allow getting the address of any
|
||||
extension functions you may need from the X11 libGL, or OpenGL framework
|
||||
libGL. Previous versions of the X11 libGL didn't allow getting the newer
|
||||
OpenGL framework addresses.
|
||||
|
||||
o GLXPixmaps
|
||||
|
||||
New support for GLXPixmaps works well with mixed X11 and OpenGL drawing
|
||||
operations. You can create them using glXCreateGLXPixmap or
|
||||
glXCreatePixmap.
|
||||
|
||||
o GLXPbuffers
|
||||
|
||||
Support for GLXPbuffers has been added. These are drawables that are
|
||||
not possible to render to with X11, which is allowed by the spec.
|
||||
A GLXPbuffer will never generate a clobber event, however
|
||||
glXSelectEvent and glXGetSelectedEvent should operate normally.
|
||||
|
||||
Clobber events are not generated due to low-level architectural
|
||||
differences. The contents of your pbuffers will not be clobbered.
|
||||
|
||||
o Shared Contexts
|
||||
|
||||
Due to basic low-level architectural differences the usage of shared
|
||||
contexts requires a similar visual or GLXFBConfig be used in the
|
||||
creation of a shared context. It's best if you specify the same
|
||||
visual. This is due to a CGL design difference, and not something
|
||||
that is easily worked around. UPDATE: some changes made seem to
|
||||
help resolve this issue in many cases, so you may be able to use a
|
||||
shared context without this restriction.
|
||||
|
||||
|
||||
o Indirect
|
||||
|
||||
The X server supports indirect fairly well, so OpenGL applications
|
||||
can be run remotely and displayed by XQuartz. This means you can run
|
||||
applications from a remote host on an XQuartz X server.
|
||||
|
||||
AppleSGLX does not support indirect rendering. Any indirect context
|
||||
created will appear to glXIsDirect as an indirect context, but it
|
||||
does not actually support indirect rendering to a remote X server.
|
||||
|
||||
AppleSGLX supports GLXPixmaps and GLXPbuffers with direct and indirect
|
||||
contexts, though they are all direct contexts by definition (see above).
|
|
@ -0,0 +1,26 @@
|
|||
Test shared contexts!
|
||||
|
||||
Go over every glxcmd in glxcmds.c and make sure we have them working.
|
||||
Verify the XError behavior of GLXPixmap support functions.
|
||||
|
||||
Test GLXPixmap support with various pixmap depths.
|
||||
|
||||
Test GLXPixmap support with invalid pixmaps (to stress the protocol code).
|
||||
|
||||
-- Feb 10, 2009
|
||||
|
||||
Test glXCopyContext.
|
||||
|
||||
-- Dec 12 2008
|
||||
|
||||
TEST glXCopyContext needs some work and additional code in apple_glx.c.
|
||||
|
||||
----
|
||||
|
||||
Make sure we report the proper list of GLX extensions available. Apple direct may not support some
|
||||
that Mesa does, and vice-versa.
|
||||
|
||||
Modify create_destroy_context and create a new test called create_destroy_context_thread_race.
|
||||
Where 2 threads are doing the same sort of path of create and destroy. The locking should protect
|
||||
us there, but we need to verify nothing goes wrong.
|
||||
|
|
@ -0,0 +1,128 @@
|
|||
/*
|
||||
Copyright (c) 2008 Apple Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation files
|
||||
(the "Software"), to deal in the Software without restriction,
|
||||
including without limitation the rights to use, copy, modify, merge,
|
||||
publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT
|
||||
HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name(s) of the above
|
||||
copyright holders shall not be used in advertising or otherwise to
|
||||
promote the sale, use or other dealings in this Software without
|
||||
prior written authorization.
|
||||
*/
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <dlfcn.h>
|
||||
|
||||
#include "apple_cgl.h"
|
||||
#include "apple_glx.h"
|
||||
|
||||
#ifndef OPENGL_FRAMEWORK_PATH
|
||||
#define OPENGL_FRAMEWORK_PATH "/System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL"
|
||||
#endif
|
||||
|
||||
static void *dl_handle = NULL;
|
||||
|
||||
struct apple_cgl_api apple_cgl;
|
||||
|
||||
static bool initialized = false;
|
||||
|
||||
static void *
|
||||
sym(void *h, const char *name)
|
||||
{
|
||||
void *s;
|
||||
|
||||
s = dlsym(h, name);
|
||||
|
||||
if (NULL == s) {
|
||||
fprintf(stderr, "error: %s\n", dlerror());
|
||||
abort();
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
void
|
||||
apple_cgl_init(void)
|
||||
{
|
||||
void *h;
|
||||
GLint major = 0, minor = 0;
|
||||
const char *opengl_framework_path;
|
||||
|
||||
if (initialized)
|
||||
return;
|
||||
|
||||
opengl_framework_path = getenv("OPENGL_FRAMEWORK_PATH");
|
||||
if (!opengl_framework_path) {
|
||||
opengl_framework_path = OPENGL_FRAMEWORK_PATH;
|
||||
}
|
||||
|
||||
(void) dlerror(); /*drain dlerror */
|
||||
h = dlopen(opengl_framework_path, RTLD_NOW);
|
||||
|
||||
if (NULL == h) {
|
||||
fprintf(stderr, "error: unable to dlopen %s : %s\n",
|
||||
opengl_framework_path, dlerror());
|
||||
abort();
|
||||
}
|
||||
|
||||
dl_handle = h;
|
||||
|
||||
apple_cgl.get_version = sym(h, "CGLGetVersion");
|
||||
|
||||
apple_cgl.get_version(&major, &minor);
|
||||
|
||||
apple_glx_diagnostic("CGL major %d minor %d\n", major, minor);
|
||||
|
||||
if (1 != major) {
|
||||
fprintf(stderr, "WARNING: the CGL major version has changed!\n"
|
||||
"libGL may be incompatible!\n");
|
||||
}
|
||||
|
||||
apple_cgl.choose_pixel_format = sym(h, "CGLChoosePixelFormat");
|
||||
apple_cgl.destroy_pixel_format = sym(h, "CGLDestroyPixelFormat");
|
||||
|
||||
apple_cgl.clear_drawable = sym(h, "CGLClearDrawable");
|
||||
apple_cgl.flush_drawable = sym(h, "CGLFlushDrawable");
|
||||
|
||||
apple_cgl.create_context = sym(h, "CGLCreateContext");
|
||||
apple_cgl.destroy_context = sym(h, "CGLDestroyContext");
|
||||
|
||||
apple_cgl.set_current_context = sym(h, "CGLSetCurrentContext");
|
||||
apple_cgl.get_current_context = sym(h, "CGLGetCurrentContext");
|
||||
apple_cgl.error_string = sym(h, "CGLErrorString");
|
||||
|
||||
apple_cgl.set_off_screen = sym(h, "CGLSetOffScreen");
|
||||
|
||||
apple_cgl.copy_context = sym(h, "CGLCopyContext");
|
||||
|
||||
apple_cgl.create_pbuffer = sym(h, "CGLCreatePBuffer");
|
||||
apple_cgl.destroy_pbuffer = sym(h, "CGLDestroyPBuffer");
|
||||
apple_cgl.set_pbuffer = sym(h, "CGLSetPBuffer");
|
||||
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
void *
|
||||
apple_cgl_get_dl_handle(void)
|
||||
{
|
||||
return dl_handle;
|
||||
}
|
|
@ -0,0 +1,86 @@
|
|||
/*
|
||||
Copyright (c) 2008, 2009 Apple Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation files
|
||||
(the "Software"), to deal in the Software without restriction,
|
||||
including without limitation the rights to use, copy, modify, merge,
|
||||
publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT
|
||||
HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name(s) of the above
|
||||
copyright holders shall not be used in advertising or otherwise to
|
||||
promote the sale, use or other dealings in this Software without
|
||||
prior written authorization.
|
||||
*/
|
||||
|
||||
#ifndef APPLE_CGL_H
|
||||
#define APPLE_CGL_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <OpenGL/CGLCurrent.h>
|
||||
#include <OpenGL/CGLTypes.h>
|
||||
#include <OpenGL/OpenGL.h>
|
||||
|
||||
/* For GLint and GLsizei on Tiger */
|
||||
#include <OpenGL/gl.h>
|
||||
|
||||
struct apple_cgl_api
|
||||
{
|
||||
void (*get_version) (GLint * majorvers, GLint * minorvers);
|
||||
|
||||
CGLError(*choose_pixel_format) (const CGLPixelFormatAttribute * attribs,
|
||||
CGLPixelFormatObj * pix, GLint * npix);
|
||||
CGLError(*destroy_pixel_format) (CGLPixelFormatObj pix);
|
||||
|
||||
CGLError(*clear_drawable) (CGLContextObj ctx);
|
||||
CGLError(*flush_drawable) (CGLContextObj ctx);
|
||||
|
||||
CGLError(*create_context) (CGLPixelFormatObj pix, CGLContextObj share,
|
||||
CGLContextObj * ctx);
|
||||
CGLError(*destroy_context) (CGLContextObj pix);
|
||||
|
||||
CGLError(*set_current_context) (CGLContextObj ctx);
|
||||
CGLContextObj(*get_current_context) (void);
|
||||
const char *(*error_string) (CGLError error);
|
||||
|
||||
CGLError(*set_off_screen) (CGLContextObj ctx,
|
||||
GLsizei width, GLsizei height, GLint rowbytes,
|
||||
void *baseaddr);
|
||||
|
||||
CGLError(*copy_context) (CGLContextObj src, CGLContextObj dst,
|
||||
GLbitfield mask);
|
||||
|
||||
CGLError(*create_pbuffer) (GLsizei width,
|
||||
GLsizei height,
|
||||
GLenum target,
|
||||
GLenum internalFormat,
|
||||
GLint max_level, CGLPBufferObj * pbuffer);
|
||||
|
||||
CGLError(*destroy_pbuffer) (CGLPBufferObj pbuffer);
|
||||
|
||||
CGLError(*set_pbuffer) (CGLContextObj ctx,
|
||||
CGLPBufferObj pbuffer,
|
||||
GLenum face, GLint level, GLint screen);
|
||||
};
|
||||
|
||||
extern struct apple_cgl_api apple_cgl;
|
||||
|
||||
extern void apple_cgl_init(void);
|
||||
|
||||
extern void *apple_cgl_get_dl_handle(void);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,623 @@
|
|||
_glAccum
|
||||
_glAlphaFunc
|
||||
_glAreTexturesResident
|
||||
_glArrayElement
|
||||
_glBegin
|
||||
_glBindTexture
|
||||
_glBitmap
|
||||
_glBlendColor
|
||||
_glBlendEquation
|
||||
_glBlendEquationSeparate
|
||||
_glBlendFunc
|
||||
_glCallList
|
||||
_glCallLists
|
||||
_glClear
|
||||
_glClearAccum
|
||||
_glClearColor
|
||||
_glClearDepth
|
||||
_glClearIndex
|
||||
_glClearStencil
|
||||
_glClipPlane
|
||||
_glColor3b
|
||||
_glColor3bv
|
||||
_glColor3d
|
||||
_glColor3dv
|
||||
_glColor3f
|
||||
_glColor3fv
|
||||
_glColor3i
|
||||
_glColor3iv
|
||||
_glColor3s
|
||||
_glColor3sv
|
||||
_glColor3ub
|
||||
_glColor3ubv
|
||||
_glColor3ui
|
||||
_glColor3uiv
|
||||
_glColor3us
|
||||
_glColor3usv
|
||||
_glColor4b
|
||||
_glColor4bv
|
||||
_glColor4d
|
||||
_glColor4dv
|
||||
_glColor4f
|
||||
_glColor4fv
|
||||
_glColor4i
|
||||
_glColor4iv
|
||||
_glColor4s
|
||||
_glColor4sv
|
||||
_glColor4ub
|
||||
_glColor4ubv
|
||||
_glColor4ui
|
||||
_glColor4uiv
|
||||
_glColor4us
|
||||
_glColor4usv
|
||||
_glColorMask
|
||||
_glColorMaterial
|
||||
_glColorPointer
|
||||
_glColorSubTable
|
||||
_glColorTable
|
||||
_glColorTableParameterfv
|
||||
_glColorTableParameteriv
|
||||
_glConvolutionFilter1D
|
||||
_glConvolutionFilter2D
|
||||
_glConvolutionParameterf
|
||||
_glConvolutionParameterfv
|
||||
_glConvolutionParameteri
|
||||
_glConvolutionParameteriv
|
||||
_glCopyColorSubTable
|
||||
_glCopyColorTable
|
||||
_glCopyConvolutionFilter1D
|
||||
_glCopyConvolutionFilter2D
|
||||
_glCopyPixels
|
||||
_glCopyTexImage1D
|
||||
_glCopyTexImage2D
|
||||
_glCopyTexSubImage1D
|
||||
_glCopyTexSubImage2D
|
||||
_glCopyTexSubImage3D
|
||||
_glCullFace
|
||||
_glDeleteLists
|
||||
_glDeleteTextures
|
||||
_glDepthFunc
|
||||
_glDepthMask
|
||||
_glDepthRange
|
||||
_glDisable
|
||||
_glDisableClientState
|
||||
_glDrawArrays
|
||||
_glDrawBuffer
|
||||
_glDrawElements
|
||||
_glDrawPixels
|
||||
_glDrawRangeElements
|
||||
_glEdgeFlag
|
||||
_glEdgeFlagPointer
|
||||
_glEdgeFlagv
|
||||
_glEnable
|
||||
_glEnableClientState
|
||||
_glEnd
|
||||
_glEndList
|
||||
_glEvalCoord1d
|
||||
_glEvalCoord1dv
|
||||
_glEvalCoord1f
|
||||
_glEvalCoord1fv
|
||||
_glEvalCoord2d
|
||||
_glEvalCoord2dv
|
||||
_glEvalCoord2f
|
||||
_glEvalCoord2fv
|
||||
_glEvalMesh1
|
||||
_glEvalMesh2
|
||||
_glEvalPoint1
|
||||
_glEvalPoint2
|
||||
_glFeedbackBuffer
|
||||
_glFinish
|
||||
_glFlush
|
||||
_glFogf
|
||||
_glFogfv
|
||||
_glFogi
|
||||
_glFogiv
|
||||
_glFrontFace
|
||||
_glFrustum
|
||||
_glGenLists
|
||||
_glGenTextures
|
||||
_glGetBooleanv
|
||||
_glGetClipPlane
|
||||
_glGetColorTable
|
||||
_glGetColorTableParameterfv
|
||||
_glGetColorTableParameteriv
|
||||
_glGetConvolutionFilter
|
||||
_glGetConvolutionParameterfv
|
||||
_glGetConvolutionParameteriv
|
||||
_glGetDoublev
|
||||
_glGetError
|
||||
_glGetFloatv
|
||||
_glGetHistogram
|
||||
_glGetHistogramParameterfv
|
||||
_glGetHistogramParameteriv
|
||||
_glGetIntegerv
|
||||
_glGetLightfv
|
||||
_glGetLightiv
|
||||
_glGetMapdv
|
||||
_glGetMapfv
|
||||
_glGetMapiv
|
||||
_glGetMaterialfv
|
||||
_glGetMaterialiv
|
||||
_glGetMinmax
|
||||
_glGetMinmaxParameterfv
|
||||
_glGetMinmaxParameteriv
|
||||
_glGetPixelMapfv
|
||||
_glGetPixelMapuiv
|
||||
_glGetPixelMapusv
|
||||
_glGetPointerv
|
||||
_glGetPolygonStipple
|
||||
_glGetSeparableFilter
|
||||
_glGetString
|
||||
_glGetTexEnvfv
|
||||
_glGetTexEnviv
|
||||
_glGetTexGendv
|
||||
_glGetTexGenfv
|
||||
_glGetTexGeniv
|
||||
_glGetTexImage
|
||||
_glGetTexLevelParameterfv
|
||||
_glGetTexLevelParameteriv
|
||||
_glGetTexParameterfv
|
||||
_glGetTexParameteriv
|
||||
_glHint
|
||||
_glHistogram
|
||||
_glIndexMask
|
||||
_glIndexPointer
|
||||
_glIndexd
|
||||
_glIndexdv
|
||||
_glIndexf
|
||||
_glIndexfv
|
||||
_glIndexi
|
||||
_glIndexiv
|
||||
_glIndexs
|
||||
_glIndexsv
|
||||
_glIndexub
|
||||
_glIndexubv
|
||||
_glInitNames
|
||||
_glInterleavedArrays
|
||||
_glIsEnabled
|
||||
_glIsList
|
||||
_glIsTexture
|
||||
_glLightModelf
|
||||
_glLightModelfv
|
||||
_glLightModeli
|
||||
_glLightModeliv
|
||||
_glLightf
|
||||
_glLightfv
|
||||
_glLighti
|
||||
_glLightiv
|
||||
_glLineStipple
|
||||
_glLineWidth
|
||||
_glListBase
|
||||
_glLoadIdentity
|
||||
_glLoadMatrixd
|
||||
_glLoadMatrixf
|
||||
_glLoadName
|
||||
_glLogicOp
|
||||
_glMap1d
|
||||
_glMap1f
|
||||
_glMap2d
|
||||
_glMap2f
|
||||
_glMapGrid1d
|
||||
_glMapGrid1f
|
||||
_glMapGrid2d
|
||||
_glMapGrid2f
|
||||
_glMaterialf
|
||||
_glMaterialfv
|
||||
_glMateriali
|
||||
_glMaterialiv
|
||||
_glMatrixMode
|
||||
_glMinmax
|
||||
_glMultMatrixd
|
||||
_glMultMatrixf
|
||||
_glNewList
|
||||
_glNormal3b
|
||||
_glNormal3bv
|
||||
_glNormal3d
|
||||
_glNormal3dv
|
||||
_glNormal3f
|
||||
_glNormal3fv
|
||||
_glNormal3i
|
||||
_glNormal3iv
|
||||
_glNormal3s
|
||||
_glNormal3sv
|
||||
_glNormalPointer
|
||||
_glOrtho
|
||||
_glPassThrough
|
||||
_glPixelMapfv
|
||||
_glPixelMapuiv
|
||||
_glPixelMapusv
|
||||
_glPixelStoref
|
||||
_glPixelStorei
|
||||
_glPixelTransferf
|
||||
_glPixelTransferi
|
||||
_glPixelZoom
|
||||
_glPointSize
|
||||
_glPolygonMode
|
||||
_glPolygonOffset
|
||||
_glPolygonStipple
|
||||
_glPopAttrib
|
||||
_glPopClientAttrib
|
||||
_glPopMatrix
|
||||
_glPopName
|
||||
_glPrioritizeTextures
|
||||
_glPushAttrib
|
||||
_glPushClientAttrib
|
||||
_glPushMatrix
|
||||
_glPushName
|
||||
_glRasterPos2d
|
||||
_glRasterPos2dv
|
||||
_glRasterPos2f
|
||||
_glRasterPos2fv
|
||||
_glRasterPos2i
|
||||
_glRasterPos2iv
|
||||
_glRasterPos2s
|
||||
_glRasterPos2sv
|
||||
_glRasterPos3d
|
||||
_glRasterPos3dv
|
||||
_glRasterPos3f
|
||||
_glRasterPos3fv
|
||||
_glRasterPos3i
|
||||
_glRasterPos3iv
|
||||
_glRasterPos3s
|
||||
_glRasterPos3sv
|
||||
_glRasterPos4d
|
||||
_glRasterPos4dv
|
||||
_glRasterPos4f
|
||||
_glRasterPos4fv
|
||||
_glRasterPos4i
|
||||
_glRasterPos4iv
|
||||
_glRasterPos4s
|
||||
_glRasterPos4sv
|
||||
_glReadBuffer
|
||||
_glReadPixels
|
||||
_glRectd
|
||||
_glRectdv
|
||||
_glRectf
|
||||
_glRectfv
|
||||
_glRecti
|
||||
_glRectiv
|
||||
_glRects
|
||||
_glRectsv
|
||||
_glRenderMode
|
||||
_glResetHistogram
|
||||
_glResetMinmax
|
||||
_glRotated
|
||||
_glRotatef
|
||||
_glScaled
|
||||
_glScalef
|
||||
_glScissor
|
||||
_glSelectBuffer
|
||||
_glSeparableFilter2D
|
||||
_glShadeModel
|
||||
_glStencilFunc
|
||||
_glStencilMask
|
||||
_glStencilOp
|
||||
_glTexCoord1d
|
||||
_glTexCoord1dv
|
||||
_glTexCoord1f
|
||||
_glTexCoord1fv
|
||||
_glTexCoord1i
|
||||
_glTexCoord1iv
|
||||
_glTexCoord1s
|
||||
_glTexCoord1sv
|
||||
_glTexCoord2d
|
||||
_glTexCoord2dv
|
||||
_glTexCoord2f
|
||||
_glTexCoord2fv
|
||||
_glTexCoord2i
|
||||
_glTexCoord2iv
|
||||
_glTexCoord2s
|
||||
_glTexCoord2sv
|
||||
_glTexCoord3d
|
||||
_glTexCoord3dv
|
||||
_glTexCoord3f
|
||||
_glTexCoord3fv
|
||||
_glTexCoord3i
|
||||
_glTexCoord3iv
|
||||
_glTexCoord3s
|
||||
_glTexCoord3sv
|
||||
_glTexCoord4d
|
||||
_glTexCoord4dv
|
||||
_glTexCoord4f
|
||||
_glTexCoord4fv
|
||||
_glTexCoord4i
|
||||
_glTexCoord4iv
|
||||
_glTexCoord4s
|
||||
_glTexCoord4sv
|
||||
_glTexCoordPointer
|
||||
_glTexEnvf
|
||||
_glTexEnvfv
|
||||
_glTexEnvi
|
||||
_glTexEnviv
|
||||
_glTexGend
|
||||
_glTexGendv
|
||||
_glTexGenf
|
||||
_glTexGenfv
|
||||
_glTexGeni
|
||||
_glTexGeniv
|
||||
_glTexImage1D
|
||||
_glTexImage2D
|
||||
_glTexImage3D
|
||||
_glTexParameterf
|
||||
_glTexParameterfv
|
||||
_glTexParameteri
|
||||
_glTexParameteriv
|
||||
_glTexSubImage1D
|
||||
_glTexSubImage2D
|
||||
_glTexSubImage3D
|
||||
_glTranslated
|
||||
_glTranslatef
|
||||
_glVertex2d
|
||||
_glVertex2dv
|
||||
_glVertex2f
|
||||
_glVertex2fv
|
||||
_glVertex2i
|
||||
_glVertex2iv
|
||||
_glVertex2s
|
||||
_glVertex2sv
|
||||
_glVertex3d
|
||||
_glVertex3dv
|
||||
_glVertex3f
|
||||
_glVertex3fv
|
||||
_glVertex3i
|
||||
_glVertex3iv
|
||||
_glVertex3s
|
||||
_glVertex3sv
|
||||
_glVertex4d
|
||||
_glVertex4dv
|
||||
_glVertex4f
|
||||
_glVertex4fv
|
||||
_glVertex4i
|
||||
_glVertex4iv
|
||||
_glVertex4s
|
||||
_glVertex4sv
|
||||
_glVertexPointer
|
||||
_glViewport
|
||||
_glSampleCoverage
|
||||
_glSamplePass
|
||||
_glLoadTransposeMatrixf
|
||||
_glLoadTransposeMatrixd
|
||||
_glMultTransposeMatrixf
|
||||
_glMultTransposeMatrixd
|
||||
_glCompressedTexImage3D
|
||||
_glCompressedTexImage2D
|
||||
_glCompressedTexImage1D
|
||||
_glCompressedTexSubImage3D
|
||||
_glCompressedTexSubImage2D
|
||||
_glCompressedTexSubImage1D
|
||||
_glGetCompressedTexImage
|
||||
_glActiveTexture
|
||||
_glClientActiveTexture
|
||||
_glMultiTexCoord1d
|
||||
_glMultiTexCoord1dv
|
||||
_glMultiTexCoord1f
|
||||
_glMultiTexCoord1fv
|
||||
_glMultiTexCoord1i
|
||||
_glMultiTexCoord1iv
|
||||
_glMultiTexCoord1s
|
||||
_glMultiTexCoord1sv
|
||||
_glMultiTexCoord2d
|
||||
_glMultiTexCoord2dv
|
||||
_glMultiTexCoord2f
|
||||
_glMultiTexCoord2fv
|
||||
_glMultiTexCoord2i
|
||||
_glMultiTexCoord2iv
|
||||
_glMultiTexCoord2s
|
||||
_glMultiTexCoord2sv
|
||||
_glMultiTexCoord3d
|
||||
_glMultiTexCoord3dv
|
||||
_glMultiTexCoord3f
|
||||
_glMultiTexCoord3fv
|
||||
_glMultiTexCoord3i
|
||||
_glMultiTexCoord3iv
|
||||
_glMultiTexCoord3s
|
||||
_glMultiTexCoord3sv
|
||||
_glMultiTexCoord4d
|
||||
_glMultiTexCoord4dv
|
||||
_glMultiTexCoord4f
|
||||
_glMultiTexCoord4fv
|
||||
_glMultiTexCoord4i
|
||||
_glMultiTexCoord4iv
|
||||
_glMultiTexCoord4s
|
||||
_glMultiTexCoord4sv
|
||||
_glFogCoordf
|
||||
_glFogCoordfv
|
||||
_glFogCoordd
|
||||
_glFogCoorddv
|
||||
_glFogCoordPointer
|
||||
_glSecondaryColor3b
|
||||
_glSecondaryColor3bv
|
||||
_glSecondaryColor3d
|
||||
_glSecondaryColor3dv
|
||||
_glSecondaryColor3f
|
||||
_glSecondaryColor3fv
|
||||
_glSecondaryColor3i
|
||||
_glSecondaryColor3iv
|
||||
_glSecondaryColor3s
|
||||
_glSecondaryColor3sv
|
||||
_glSecondaryColor3ub
|
||||
_glSecondaryColor3ubv
|
||||
_glSecondaryColor3ui
|
||||
_glSecondaryColor3uiv
|
||||
_glSecondaryColor3us
|
||||
_glSecondaryColor3usv
|
||||
_glSecondaryColorPointer
|
||||
_glPointParameterf
|
||||
_glPointParameterfv
|
||||
_glPointParameteri
|
||||
_glPointParameteriv
|
||||
_glBlendFuncSeparate
|
||||
_glMultiDrawArrays
|
||||
_glMultiDrawElements
|
||||
_glWindowPos2d
|
||||
_glWindowPos2dv
|
||||
_glWindowPos2f
|
||||
_glWindowPos2fv
|
||||
_glWindowPos2i
|
||||
_glWindowPos2iv
|
||||
_glWindowPos2s
|
||||
_glWindowPos2sv
|
||||
_glWindowPos3d
|
||||
_glWindowPos3dv
|
||||
_glWindowPos3f
|
||||
_glWindowPos3fv
|
||||
_glWindowPos3i
|
||||
_glWindowPos3iv
|
||||
_glWindowPos3s
|
||||
_glWindowPos3sv
|
||||
_glGenQueries
|
||||
_glDeleteQueries
|
||||
_glIsQuery
|
||||
_glBeginQuery
|
||||
_glEndQuery
|
||||
_glGetQueryiv
|
||||
_glGetQueryObjectiv
|
||||
_glGetQueryObjectuiv
|
||||
_glBindBuffer
|
||||
_glDeleteBuffers
|
||||
_glGenBuffers
|
||||
_glIsBuffer
|
||||
_glBufferData
|
||||
_glBufferSubData
|
||||
_glGetBufferSubData
|
||||
_glMapBuffer
|
||||
_glUnmapBuffer
|
||||
_glGetBufferParameteriv
|
||||
_glGetBufferPointerv
|
||||
_glDrawBuffers
|
||||
_glVertexAttrib1d
|
||||
_glVertexAttrib1dv
|
||||
_glVertexAttrib1f
|
||||
_glVertexAttrib1fv
|
||||
_glVertexAttrib1s
|
||||
_glVertexAttrib1sv
|
||||
_glVertexAttrib2d
|
||||
_glVertexAttrib2dv
|
||||
_glVertexAttrib2f
|
||||
_glVertexAttrib2fv
|
||||
_glVertexAttrib2s
|
||||
_glVertexAttrib2sv
|
||||
_glVertexAttrib3d
|
||||
_glVertexAttrib3dv
|
||||
_glVertexAttrib3f
|
||||
_glVertexAttrib3fv
|
||||
_glVertexAttrib3s
|
||||
_glVertexAttrib3sv
|
||||
_glVertexAttrib4Nbv
|
||||
_glVertexAttrib4Niv
|
||||
_glVertexAttrib4Nsv
|
||||
_glVertexAttrib4Nub
|
||||
_glVertexAttrib4Nubv
|
||||
_glVertexAttrib4Nuiv
|
||||
_glVertexAttrib4Nusv
|
||||
_glVertexAttrib4bv
|
||||
_glVertexAttrib4d
|
||||
_glVertexAttrib4dv
|
||||
_glVertexAttrib4f
|
||||
_glVertexAttrib4fv
|
||||
_glVertexAttrib4iv
|
||||
_glVertexAttrib4s
|
||||
_glVertexAttrib4sv
|
||||
_glVertexAttrib4ubv
|
||||
_glVertexAttrib4uiv
|
||||
_glVertexAttrib4usv
|
||||
_glVertexAttribPointer
|
||||
_glEnableVertexAttribArray
|
||||
_glDisableVertexAttribArray
|
||||
_glGetVertexAttribdv
|
||||
_glGetVertexAttribfv
|
||||
_glGetVertexAttribiv
|
||||
_glGetVertexAttribPointerv
|
||||
_glDeleteShader
|
||||
_glDetachShader
|
||||
_glCreateShader
|
||||
_glShaderSource
|
||||
_glCompileShader
|
||||
_glCreateProgram
|
||||
_glAttachShader
|
||||
_glLinkProgram
|
||||
_glUseProgram
|
||||
_glDeleteProgram
|
||||
_glValidateProgram
|
||||
_glUniform1f
|
||||
_glUniform2f
|
||||
_glUniform3f
|
||||
_glUniform4f
|
||||
_glUniform1i
|
||||
_glUniform2i
|
||||
_glUniform3i
|
||||
_glUniform4i
|
||||
_glUniform1fv
|
||||
_glUniform2fv
|
||||
_glUniform3fv
|
||||
_glUniform4fv
|
||||
_glUniform1iv
|
||||
_glUniform2iv
|
||||
_glUniform3iv
|
||||
_glUniform4iv
|
||||
_glUniformMatrix2fv
|
||||
_glUniformMatrix3fv
|
||||
_glUniformMatrix4fv
|
||||
_glIsShader
|
||||
_glIsProgram
|
||||
_glGetShaderiv
|
||||
_glGetProgramiv
|
||||
_glGetAttachedShaders
|
||||
_glGetShaderInfoLog
|
||||
_glGetProgramInfoLog
|
||||
_glGetUniformLocation
|
||||
_glGetActiveUniform
|
||||
_glGetUniformfv
|
||||
_glGetUniformiv
|
||||
_glGetShaderSource
|
||||
_glBindAttribLocation
|
||||
_glGetActiveAttrib
|
||||
_glGetAttribLocation
|
||||
_glStencilFuncSeparate
|
||||
_glStencilOpSeparate
|
||||
_glStencilMaskSeparate
|
||||
_glUniformMatrix2x3fv
|
||||
_glUniformMatrix3x2fv
|
||||
_glUniformMatrix2x4fv
|
||||
_glUniformMatrix4x2fv
|
||||
_glUniformMatrix3x4fv
|
||||
_glUniformMatrix4x3fv
|
||||
_glXChooseVisual
|
||||
_glXCreateContext
|
||||
_glXDestroyContext
|
||||
_glXMakeCurrent
|
||||
_glXCopyContext
|
||||
_glXSwapBuffers
|
||||
_glXCreateGLXPixmap
|
||||
_glXDestroyGLXPixmap
|
||||
_glXQueryExtension
|
||||
_glXQueryVersion
|
||||
_glXIsDirect
|
||||
_glXGetConfig
|
||||
_glXGetCurrentContext
|
||||
_glXGetCurrentDrawable
|
||||
_glXWaitGL
|
||||
_glXWaitX
|
||||
_glXUseXFont
|
||||
_glXQueryExtensionsString
|
||||
_glXQueryServerString
|
||||
_glXGetClientString
|
||||
_glXGetCurrentDisplay
|
||||
_glXChooseFBConfig
|
||||
_glXGetFBConfigAttrib
|
||||
_glXGetFBConfigs
|
||||
_glXGetVisualFromFBConfig
|
||||
_glXCreateWindow
|
||||
_glXDestroyWindow
|
||||
_glXCreatePixmap
|
||||
_glXDestroyPixmap
|
||||
_glXCreatePbuffer
|
||||
_glXDestroyPbuffer
|
||||
_glXQueryDrawable
|
||||
_glXCreateNewContext
|
||||
_glXMakeContextCurrent
|
||||
_glXGetCurrentReadDrawable
|
||||
_glXQueryContext
|
||||
_glXSelectEvent
|
||||
_glXGetSelectedEvent
|
||||
_glXGetProcAddress
|
|
@ -0,0 +1,214 @@
|
|||
/*
|
||||
Copyright (c) 2008, 2009 Apple Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation files
|
||||
(the "Software"), to deal in the Software without restriction,
|
||||
including without limitation the rights to use, copy, modify, merge,
|
||||
publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT
|
||||
HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name(s) of the above
|
||||
copyright holders shall not be used in advertising or otherwise to
|
||||
promote the sale, use or other dealings in this Software without
|
||||
prior written authorization.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <stdarg.h>
|
||||
#include <dlfcn.h>
|
||||
#include "appledri.h"
|
||||
#include "apple_glx.h"
|
||||
#include "apple_glx_context.h"
|
||||
#include "apple_cgl.h"
|
||||
#include "apple_xgl_api.h"
|
||||
|
||||
static bool initialized = false;
|
||||
static int dri_event_base = 0;
|
||||
|
||||
const GLuint __glXDefaultPixelStore[9] = { 0, 0, 0, 0, 0, 0, 0, 0, 1 };
|
||||
|
||||
#ifndef OPENGL_LIB_PATH
|
||||
#define OPENGL_LIB_PATH "/System/Library/Frameworks/OpenGL.framework/Libraries/libGL.dylib"
|
||||
#endif
|
||||
|
||||
static void *libgl_handle = NULL;
|
||||
|
||||
static bool diagnostic = false;
|
||||
|
||||
void
|
||||
apple_glx_diagnostic(const char *fmt, ...)
|
||||
{
|
||||
va_list vl;
|
||||
|
||||
if (diagnostic) {
|
||||
fprintf(stderr, "DIAG: ");
|
||||
|
||||
va_start(vl, fmt);
|
||||
vfprintf(stderr, fmt, vl);
|
||||
va_end(vl);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
apple_get_dri_event_base(void)
|
||||
{
|
||||
if (!initialized) {
|
||||
fprintf(stderr,
|
||||
"error: dri_event_base called before apple_init_glx!\n");
|
||||
abort();
|
||||
}
|
||||
return dri_event_base;
|
||||
}
|
||||
|
||||
static void
|
||||
surface_notify_handler(Display * dpy, unsigned int uid, int kind)
|
||||
{
|
||||
|
||||
switch (kind) {
|
||||
case AppleDRISurfaceNotifyDestroyed:
|
||||
apple_glx_diagnostic("%s: surface destroyed %u\n", __func__, uid);
|
||||
apple_glx_surface_destroy(uid);
|
||||
break;
|
||||
|
||||
case AppleDRISurfaceNotifyChanged:{
|
||||
int updated;
|
||||
|
||||
updated = apple_glx_context_surface_changed(uid, pthread_self());
|
||||
|
||||
apple_glx_diagnostic("surface notify updated %d\n", updated);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
fprintf(stderr, "unhandled kind of event: %d in %s\n", kind, __func__);
|
||||
}
|
||||
}
|
||||
|
||||
xp_client_id
|
||||
apple_glx_get_client_id(void)
|
||||
{
|
||||
static xp_client_id id;
|
||||
|
||||
if (0 == id) {
|
||||
if ((XP_Success != xp_init(XP_IN_BACKGROUND)) ||
|
||||
(Success != xp_get_client_id(&id))) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return id;
|
||||
}
|
||||
|
||||
/* Return true if an error occured. */
|
||||
bool
|
||||
apple_init_glx(Display * dpy)
|
||||
{
|
||||
int eventBase, errorBase;
|
||||
int major, minor, patch;
|
||||
|
||||
if (!XAppleDRIQueryExtension(dpy, &eventBase, &errorBase))
|
||||
return true;
|
||||
|
||||
if (!XAppleDRIQueryVersion(dpy, &major, &minor, &patch))
|
||||
return true;
|
||||
|
||||
if (initialized)
|
||||
return false;
|
||||
|
||||
if (getenv("LIBGL_DIAGNOSTIC")) {
|
||||
printf("initializing libGL in %s\n", __func__);
|
||||
diagnostic = true;
|
||||
}
|
||||
|
||||
apple_cgl_init();
|
||||
apple_xgl_init_direct();
|
||||
libgl_handle = dlopen(OPENGL_LIB_PATH, RTLD_LAZY);
|
||||
(void) apple_glx_get_client_id();
|
||||
|
||||
XAppleDRISetSurfaceNotifyHandler(surface_notify_handler);
|
||||
|
||||
/* This should really be per display. */
|
||||
dri_event_base = eventBase;
|
||||
initialized = true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
apple_glx_swap_buffers(void *ptr)
|
||||
{
|
||||
struct apple_glx_context *ac = ptr;
|
||||
|
||||
/* This may not be needed with CGLFlushDrawable: */
|
||||
glFlush();
|
||||
apple_cgl.flush_drawable(ac->context_obj);
|
||||
}
|
||||
|
||||
void *
|
||||
apple_glx_get_proc_address(const GLubyte * procname)
|
||||
{
|
||||
size_t len;
|
||||
void *h, *s;
|
||||
char *pname = (char *) procname;
|
||||
|
||||
assert(NULL != procname);
|
||||
len = strlen(pname);
|
||||
|
||||
if (len < 3) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((pname != strstr(pname, "glX")) && (pname != strstr(pname, "gl"))) {
|
||||
fprintf(stderr,
|
||||
"warning: get proc address request is not for a gl or glX function");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Search using the default symbols first. */
|
||||
(void) dlerror(); /*drain dlerror */
|
||||
h = dlopen(NULL, RTLD_NOW);
|
||||
if (NULL == h) {
|
||||
fprintf(stderr, "warning: get proc address: %s\n", dlerror());
|
||||
return NULL;
|
||||
}
|
||||
|
||||
s = dlsym(h, pname);
|
||||
|
||||
if (NULL == s) {
|
||||
/* Try the libGL.dylib from the OpenGL.framework. */
|
||||
s = dlsym(libgl_handle, pname);
|
||||
}
|
||||
|
||||
dlclose(h);
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
void
|
||||
apple_glx_waitx(Display * dpy, void *ptr)
|
||||
{
|
||||
struct apple_private_context *ac = ptr;
|
||||
|
||||
(void) ac;
|
||||
|
||||
glFlush();
|
||||
glFinish();
|
||||
XSync(dpy, False);
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
Copyright (c) 2008 Apple Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation files
|
||||
(the "Software"), to deal in the Software without restriction,
|
||||
including without limitation the rights to use, copy, modify, merge,
|
||||
publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT
|
||||
HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name(s) of the above
|
||||
copyright holders shall not be used in advertising or otherwise to
|
||||
promote the sale, use or other dealings in this Software without
|
||||
prior written authorization.
|
||||
*/
|
||||
|
||||
#ifndef APPLE_GLX_H
|
||||
#define APPLE_GLX_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <OpenGL/CGLTypes.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glxint.h>
|
||||
#include <X11/Xlib.h>
|
||||
#define XP_NO_X_HEADERS
|
||||
#include <Xplugin.h>
|
||||
|
||||
void apple_glx_diagnostic(const char *fmt, ...);
|
||||
xp_client_id apple_glx_get_client_id(void);
|
||||
bool apple_init_glx(Display * dpy);
|
||||
void apple_glx_swap_buffers(void *ptr);
|
||||
void *apple_glx_get_proc_address(const GLubyte * procname);
|
||||
void apple_glx_waitx(Display * dpy, void *ptr);
|
||||
int apple_get_dri_event_base(void);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,616 @@
|
|||
/*
|
||||
Copyright (c) 2008, 2009 Apple Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation files
|
||||
(the "Software"), to deal in the Software without restriction,
|
||||
including without limitation the rights to use, copy, modify, merge,
|
||||
publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT
|
||||
HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name(s) of the above
|
||||
copyright holders shall not be used in advertising or otherwise to
|
||||
promote the sale, use or other dealings in this Software without
|
||||
prior written authorization.
|
||||
*/
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <limits.h>
|
||||
#include <assert.h>
|
||||
#include <pthread.h>
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <sys/mman.h>
|
||||
#include <unistd.h>
|
||||
|
||||
// Get the newer glext.h first
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glext.h>
|
||||
|
||||
#include <OpenGL/CGLTypes.h>
|
||||
#include <OpenGL/CGLCurrent.h>
|
||||
#include <OpenGL/OpenGL.h>
|
||||
|
||||
#include "glxclient.h"
|
||||
|
||||
#include "apple_glx.h"
|
||||
#include "apple_glx_context.h"
|
||||
#include "appledri.h"
|
||||
#include "apple_visual.h"
|
||||
#include "apple_cgl.h"
|
||||
#include "apple_glx_drawable.h"
|
||||
|
||||
static pthread_mutex_t context_lock = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
/*
|
||||
* This should be locked on creation and destruction of the
|
||||
* apple_glx_contexts.
|
||||
*
|
||||
* It's also locked when the surface_notify_handler is searching
|
||||
* for a uid associated with a surface.
|
||||
*/
|
||||
static struct apple_glx_context *context_list = NULL;
|
||||
|
||||
/* This guards the context_list above. */
|
||||
static void
|
||||
lock_context_list(void)
|
||||
{
|
||||
int err;
|
||||
|
||||
err = pthread_mutex_lock(&context_lock);
|
||||
|
||||
if (err) {
|
||||
fprintf(stderr, "pthread_mutex_lock failure in %s: %d\n",
|
||||
__func__, err);
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
unlock_context_list(void)
|
||||
{
|
||||
int err;
|
||||
|
||||
err = pthread_mutex_unlock(&context_lock);
|
||||
|
||||
if (err) {
|
||||
fprintf(stderr, "pthread_mutex_unlock failure in %s: %d\n",
|
||||
__func__, err);
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
static bool
|
||||
is_context_valid(struct apple_glx_context *ac)
|
||||
{
|
||||
struct apple_glx_context *i;
|
||||
|
||||
lock_context_list();
|
||||
|
||||
for (i = context_list; i; i = i->next) {
|
||||
if (ac == i) {
|
||||
unlock_context_list();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
unlock_context_list();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/* This creates an apple_private_context struct.
|
||||
*
|
||||
* It's typically called to save the struct in a GLXContext.
|
||||
*
|
||||
* This is also where the CGLContextObj is created, and the CGLPixelFormatObj.
|
||||
*/
|
||||
bool
|
||||
apple_glx_create_context(void **ptr, Display * dpy, int screen,
|
||||
const void *mode, void *sharedContext,
|
||||
int *errorptr, bool * x11errorptr)
|
||||
{
|
||||
struct apple_glx_context *ac;
|
||||
struct apple_glx_context *sharedac = sharedContext;
|
||||
CGLError error;
|
||||
|
||||
*ptr = NULL;
|
||||
|
||||
ac = malloc(sizeof *ac);
|
||||
|
||||
if (NULL == ac) {
|
||||
*errorptr = BadAlloc;
|
||||
*x11errorptr = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (sharedac && !is_context_valid(sharedac)) {
|
||||
*errorptr = GLXBadContext;
|
||||
*x11errorptr = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
ac->context_obj = NULL;
|
||||
ac->pixel_format_obj = NULL;
|
||||
ac->drawable = NULL;
|
||||
ac->thread_id = pthread_self();
|
||||
ac->screen = screen;
|
||||
ac->double_buffered = false;
|
||||
ac->uses_stereo = false;
|
||||
ac->need_update = false;
|
||||
ac->is_current = false;
|
||||
ac->made_current = false;
|
||||
ac->last_surface_window = None;
|
||||
|
||||
apple_visual_create_pfobj(&ac->pixel_format_obj, mode,
|
||||
&ac->double_buffered, &ac->uses_stereo,
|
||||
/*offscreen */ false);
|
||||
|
||||
error = apple_cgl.create_context(ac->pixel_format_obj,
|
||||
sharedac ? sharedac->context_obj : NULL,
|
||||
&ac->context_obj);
|
||||
|
||||
|
||||
if (error) {
|
||||
(void) apple_cgl.destroy_pixel_format(ac->pixel_format_obj);
|
||||
|
||||
free(ac);
|
||||
|
||||
if (kCGLBadMatch == error) {
|
||||
*errorptr = BadMatch;
|
||||
*x11errorptr = true;
|
||||
}
|
||||
else {
|
||||
*errorptr = GLXBadContext;
|
||||
*x11errorptr = false;
|
||||
}
|
||||
|
||||
if (getenv("LIBGL_DIAGNOSTIC"))
|
||||
fprintf(stderr, "error: %s\n", apple_cgl.error_string(error));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* The context creation succeeded, so we can link in the new context. */
|
||||
lock_context_list();
|
||||
|
||||
if (context_list)
|
||||
context_list->previous = ac;
|
||||
|
||||
ac->previous = NULL;
|
||||
ac->next = context_list;
|
||||
context_list = ac;
|
||||
|
||||
*ptr = ac;
|
||||
|
||||
apple_glx_diagnostic("%s: ac %p ac->context_obj %p\n",
|
||||
__func__, (void *) ac, (void *) ac->context_obj);
|
||||
|
||||
unlock_context_list();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
apple_glx_destroy_context(void **ptr, Display * dpy)
|
||||
{
|
||||
struct apple_glx_context *ac = *ptr;
|
||||
|
||||
if (NULL == ac)
|
||||
return;
|
||||
|
||||
apple_glx_diagnostic("%s: ac %p ac->context_obj %p\n",
|
||||
__func__, (void *) ac, (void *) ac->context_obj);
|
||||
|
||||
if (apple_cgl.get_current_context() == ac->context_obj) {
|
||||
apple_glx_diagnostic("%s: context ac->context_obj %p "
|
||||
"is still current!\n", __func__,
|
||||
(void *) ac->context_obj);
|
||||
if (apple_cgl.set_current_context(NULL)) {
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
/* Remove ac from the context_list as soon as possible. */
|
||||
lock_context_list();
|
||||
|
||||
if (ac->previous) {
|
||||
ac->previous->next = ac->next;
|
||||
}
|
||||
else {
|
||||
context_list = ac->next;
|
||||
}
|
||||
|
||||
if (ac->next) {
|
||||
ac->next->previous = ac->previous;
|
||||
}
|
||||
|
||||
unlock_context_list();
|
||||
|
||||
|
||||
if (apple_cgl.clear_drawable(ac->context_obj)) {
|
||||
fprintf(stderr, "error: while clearing drawable!\n");
|
||||
abort();
|
||||
}
|
||||
|
||||
/*
|
||||
* This potentially causes surface_notify_handler to be called in
|
||||
* apple_glx.c...
|
||||
* We can NOT have a lock held at this point. It would result in
|
||||
* an abort due to an attempted deadlock. This is why we earlier
|
||||
* removed the ac pointer from the double-linked list.
|
||||
*/
|
||||
if (ac->drawable) {
|
||||
ac->drawable->destroy(ac->drawable);
|
||||
}
|
||||
|
||||
if (apple_cgl.destroy_pixel_format(ac->pixel_format_obj)) {
|
||||
fprintf(stderr, "error: destroying pixel format in %s\n", __func__);
|
||||
abort();
|
||||
}
|
||||
|
||||
if (apple_cgl.destroy_context(ac->context_obj)) {
|
||||
fprintf(stderr, "error: destroying context_obj in %s\n", __func__);
|
||||
abort();
|
||||
}
|
||||
|
||||
free(ac);
|
||||
|
||||
*ptr = NULL;
|
||||
|
||||
apple_glx_garbage_collect_drawables(dpy);
|
||||
}
|
||||
|
||||
|
||||
/* Return true if an error occured. */
|
||||
bool
|
||||
apple_glx_make_current_context(Display * dpy, void *oldptr, void *ptr,
|
||||
GLXDrawable drawable)
|
||||
{
|
||||
struct apple_glx_context *oldac = oldptr;
|
||||
struct apple_glx_context *ac = ptr;
|
||||
struct apple_glx_drawable *newagd = NULL;
|
||||
CGLError cglerr;
|
||||
bool same_drawable = false;
|
||||
|
||||
#if 0
|
||||
apple_glx_diagnostic("%s: oldac %p ac %p drawable 0x%lx\n",
|
||||
__func__, (void *) oldac, (void *) ac, drawable);
|
||||
|
||||
apple_glx_diagnostic("%s: oldac->context_obj %p ac->context_obj %p\n",
|
||||
__func__,
|
||||
(void *) (oldac ? oldac->context_obj : NULL),
|
||||
(void *) (ac ? ac->context_obj : NULL));
|
||||
#endif
|
||||
|
||||
/* This a common path for GLUT and other apps, so special case it. */
|
||||
if (ac && ac->drawable && ac->drawable->drawable == drawable) {
|
||||
same_drawable = true;
|
||||
|
||||
if (ac->is_current)
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Reset the is_current state of the old context, if non-NULL. */
|
||||
if (oldac && (ac != oldac))
|
||||
oldac->is_current = false;
|
||||
|
||||
if (NULL == ac) {
|
||||
/*Clear the current context for this thread. */
|
||||
apple_cgl.set_current_context(NULL);
|
||||
|
||||
if (oldac) {
|
||||
oldac->is_current = false;
|
||||
|
||||
if (oldac->drawable) {
|
||||
oldac->drawable->destroy(oldac->drawable);
|
||||
oldac->drawable = NULL;
|
||||
}
|
||||
|
||||
/* Invalidate this to prevent surface recreation. */
|
||||
oldac->last_surface_window = None;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (None == drawable) {
|
||||
bool error = false;
|
||||
|
||||
/* Clear the current drawable for this context_obj. */
|
||||
|
||||
if (apple_cgl.set_current_context(ac->context_obj))
|
||||
error = true;
|
||||
|
||||
if (apple_cgl.clear_drawable(ac->context_obj))
|
||||
error = true;
|
||||
|
||||
if (ac->drawable) {
|
||||
ac->drawable->destroy(ac->drawable);
|
||||
ac->drawable = NULL;
|
||||
}
|
||||
|
||||
/* Invalidate this to prevent surface recreation. */
|
||||
ac->last_surface_window = None;
|
||||
|
||||
apple_glx_diagnostic("%s: drawable is None, error is: %d\n",
|
||||
__func__, error);
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
/* This is an optimisation to avoid searching for the current drawable. */
|
||||
if (ac->drawable && ac->drawable->drawable == drawable) {
|
||||
newagd = ac->drawable;
|
||||
}
|
||||
else {
|
||||
/* Find the drawable if possible, and retain a reference to it. */
|
||||
newagd =
|
||||
apple_glx_drawable_find(drawable, APPLE_GLX_DRAWABLE_REFERENCE);
|
||||
}
|
||||
|
||||
/*
|
||||
* Try to destroy the old drawable, so long as the new one
|
||||
* isn't the old.
|
||||
*/
|
||||
if (ac->drawable && !same_drawable) {
|
||||
ac->drawable->destroy(ac->drawable);
|
||||
ac->drawable = NULL;
|
||||
}
|
||||
|
||||
if (NULL == newagd) {
|
||||
if (apple_glx_surface_create(dpy, ac->screen, drawable, &newagd))
|
||||
return true;
|
||||
|
||||
/* The drawable is referenced once by apple_glx_surface_create. */
|
||||
|
||||
/*
|
||||
* FIXME: We actually need 2 references to prevent premature surface
|
||||
* destruction. The problem is that the surface gets destroyed in
|
||||
* the case of the context being reused for another window, and
|
||||
* we then lose the surface contents. Wait for destruction of a
|
||||
* window to destroy a surface.
|
||||
*
|
||||
* Note: this may leave around surfaces we don't want around, if
|
||||
* say we are using X for raster drawing after OpenGL rendering,
|
||||
* but it will be compatible with the old libGL's behavior.
|
||||
*
|
||||
* Someday the X11 and OpenGL rendering must be unified at some
|
||||
* layer. I suspect we can do that via shared memory and
|
||||
* multiple threads in the X server (1 for each context created
|
||||
* by a client). This would also allow users to render from
|
||||
* multiple clients to the same OpenGL surface. In fact it could
|
||||
* all be OpenGL.
|
||||
*
|
||||
*/
|
||||
newagd->reference(newagd);
|
||||
|
||||
/* Save the new drawable with the context structure. */
|
||||
ac->drawable = newagd;
|
||||
}
|
||||
else {
|
||||
/* We are reusing an existing drawable structure. */
|
||||
|
||||
if (same_drawable) {
|
||||
assert(ac->drawable == newagd);
|
||||
/* The drawable_find above retained a reference for us. */
|
||||
}
|
||||
else {
|
||||
ac->drawable = newagd;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Avoid this costly path if this is the same drawable and the
|
||||
* context is already current.
|
||||
*/
|
||||
|
||||
if (same_drawable && ac->is_current) {
|
||||
apple_glx_diagnostic("%s: same_drawable and ac->is_current\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
cglerr = apple_cgl.set_current_context(ac->context_obj);
|
||||
|
||||
if (kCGLNoError != cglerr) {
|
||||
fprintf(stderr, "set current error: %s\n",
|
||||
apple_cgl.error_string(cglerr));
|
||||
return true;
|
||||
}
|
||||
|
||||
ac->is_current = true;
|
||||
|
||||
assert(NULL != ac->context_obj);
|
||||
assert(NULL != ac->drawable);
|
||||
|
||||
ac->thread_id = pthread_self();
|
||||
|
||||
/* This will be set if the pending_destroy code indicates it should be: */
|
||||
ac->last_surface_window = None;
|
||||
|
||||
switch (ac->drawable->type) {
|
||||
case APPLE_GLX_DRAWABLE_PBUFFER:
|
||||
case APPLE_GLX_DRAWABLE_SURFACE:
|
||||
case APPLE_GLX_DRAWABLE_PIXMAP:
|
||||
if (ac->drawable->callbacks.make_current) {
|
||||
if (ac->drawable->callbacks.make_current(ac, ac->drawable))
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
fprintf(stderr, "internal error: invalid drawable type: %d\n",
|
||||
ac->drawable->type);
|
||||
abort();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
apple_glx_is_current_drawable(Display * dpy, void *ptr, GLXDrawable drawable)
|
||||
{
|
||||
struct apple_glx_context *ac = ptr;
|
||||
|
||||
if (ac->drawable && ac->drawable->drawable == drawable) {
|
||||
return true;
|
||||
}
|
||||
else if (NULL == ac->drawable && None != ac->last_surface_window) {
|
||||
apple_glx_context_update(dpy, ac);
|
||||
|
||||
return (ac->drawable && ac->drawable->drawable == drawable);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
apple_glx_copy_context(void *currentptr, void *srcptr, void *destptr,
|
||||
unsigned long mask, int *errorptr, bool * x11errorptr)
|
||||
{
|
||||
struct apple_glx_context *src, *dest;
|
||||
CGLError err;
|
||||
|
||||
src = srcptr;
|
||||
dest = destptr;
|
||||
|
||||
if (src->screen != dest->screen) {
|
||||
*errorptr = BadMatch;
|
||||
*x11errorptr = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (dest == currentptr || dest->is_current) {
|
||||
*errorptr = BadAccess;
|
||||
*x11errorptr = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* If srcptr is the current context then we should do an implicit glFlush.
|
||||
*/
|
||||
if (currentptr == srcptr)
|
||||
glFlush();
|
||||
|
||||
err = apple_cgl.copy_context(src->context_obj, dest->context_obj,
|
||||
(GLbitfield) mask);
|
||||
|
||||
if (kCGLNoError != err) {
|
||||
*errorptr = GLXBadContext;
|
||||
*x11errorptr = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* The value returned is the total number of contexts set to update.
|
||||
* It's meant for debugging/introspection.
|
||||
*/
|
||||
int
|
||||
apple_glx_context_surface_changed(unsigned int uid, pthread_t caller)
|
||||
{
|
||||
struct apple_glx_context *ac;
|
||||
int updated = 0;
|
||||
|
||||
lock_context_list();
|
||||
|
||||
for (ac = context_list; ac; ac = ac->next) {
|
||||
if (ac->drawable && APPLE_GLX_DRAWABLE_SURFACE == ac->drawable->type
|
||||
&& ac->drawable->types.surface.uid == uid) {
|
||||
|
||||
if (caller == ac->thread_id) {
|
||||
apple_glx_diagnostic("caller is the same thread for uid %u\n",
|
||||
uid);
|
||||
|
||||
xp_update_gl_context(ac->context_obj);
|
||||
}
|
||||
else {
|
||||
ac->need_update = true;
|
||||
++updated;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unlock_context_list();
|
||||
|
||||
return updated;
|
||||
}
|
||||
|
||||
void
|
||||
apple_glx_context_update(Display * dpy, void *ptr)
|
||||
{
|
||||
struct apple_glx_context *ac = ptr;
|
||||
|
||||
if (NULL == ac->drawable && None != ac->last_surface_window) {
|
||||
bool failed;
|
||||
|
||||
/* Attempt to recreate the surface for a destroyed drawable. */
|
||||
failed =
|
||||
apple_glx_make_current_context(dpy, ac, ac, ac->last_surface_window);
|
||||
|
||||
apple_glx_diagnostic("%s: surface recreation failed? %s\n", __func__,
|
||||
failed ? "YES" : "NO");
|
||||
}
|
||||
|
||||
if (ac->need_update) {
|
||||
xp_update_gl_context(ac->context_obj);
|
||||
ac->need_update = false;
|
||||
|
||||
apple_glx_diagnostic("%s: updating context %p\n", __func__, ptr);
|
||||
}
|
||||
|
||||
if (ac->drawable && APPLE_GLX_DRAWABLE_SURFACE == ac->drawable->type
|
||||
&& ac->drawable->types.surface.pending_destroy) {
|
||||
apple_glx_diagnostic("%s: clearing drawable %p\n", __func__, ptr);
|
||||
apple_cgl.clear_drawable(ac->context_obj);
|
||||
|
||||
if (ac->drawable) {
|
||||
struct apple_glx_drawable *d;
|
||||
|
||||
apple_glx_diagnostic("%s: attempting to destroy drawable %p\n",
|
||||
__func__, ptr);
|
||||
apple_glx_diagnostic("%s: ac->drawable->drawable is 0x%lx\n",
|
||||
__func__, ac->drawable->drawable);
|
||||
|
||||
d = ac->drawable;
|
||||
|
||||
ac->last_surface_window = d->drawable;
|
||||
|
||||
ac->drawable = NULL;
|
||||
|
||||
/*
|
||||
* This will destroy the surface drawable if there are
|
||||
* no references to it.
|
||||
* It also subtracts 1 from the reference_count.
|
||||
* If there are references to it, then it's probably made
|
||||
* current in another context.
|
||||
*/
|
||||
d->destroy(d);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
apple_glx_context_uses_stereo(void *ptr)
|
||||
{
|
||||
struct apple_glx_context *ac = ptr;
|
||||
|
||||
return ac->uses_stereo;
|
||||
}
|
|
@ -0,0 +1,85 @@
|
|||
/*
|
||||
Copyright (c) 2008, 2009 Apple Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation files
|
||||
(the "Software"), to deal in the Software without restriction,
|
||||
including without limitation the rights to use, copy, modify, merge,
|
||||
publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT
|
||||
HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name(s) of the above
|
||||
copyright holders shall not be used in advertising or otherwise to
|
||||
promote the sale, use or other dealings in this Software without
|
||||
prior written authorization.
|
||||
*/
|
||||
#ifndef APPLE_GLX_CONTEXT_H
|
||||
#define APPLE_GLX_CONTEXT_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <GL/glx.h>
|
||||
#include <OpenGL/CGLTypes.h>
|
||||
#include <OpenGL/CGLContext.h>
|
||||
#define XP_NO_X_HEADERS
|
||||
#include <Xplugin.h>
|
||||
#undef XP_NO_X_HEADERS
|
||||
|
||||
#include "apple_glx_drawable.h"
|
||||
|
||||
struct apple_glx_context
|
||||
{
|
||||
CGLContextObj context_obj;
|
||||
CGLPixelFormatObj pixel_format_obj;
|
||||
struct apple_glx_drawable *drawable;
|
||||
pthread_t thread_id;
|
||||
int screen;
|
||||
bool double_buffered;
|
||||
bool uses_stereo;
|
||||
bool need_update;
|
||||
bool is_current; /* True if the context is current in some thread. */
|
||||
bool made_current; /* True if the context has ever been made current. */
|
||||
|
||||
/*
|
||||
* last_surface is set by the pending_destroy code handler for a drawable.
|
||||
* Due to a CG difference, we have to recreate a surface if the window
|
||||
* is unmapped and mapped again.
|
||||
*/
|
||||
Window last_surface_window;
|
||||
struct apple_glx_context *previous, *next;
|
||||
};
|
||||
|
||||
bool apple_glx_create_context(void **ptr, Display * dpy, int screen,
|
||||
const void *mode, void *sharedContext,
|
||||
int *errorptr, bool * x11errorptr);
|
||||
void apple_glx_destroy_context(void **ptr, Display * dpy);
|
||||
|
||||
bool apple_glx_make_current_context(Display * dpy, void *oldptr, void *ptr,
|
||||
GLXDrawable drawable);
|
||||
bool apple_glx_is_current_drawable(Display * dpy, void *ptr,
|
||||
GLXDrawable drawable);
|
||||
|
||||
bool apple_glx_copy_context(void *currentptr, void *srcptr, void *destptr,
|
||||
unsigned long mask, int *errorptr,
|
||||
bool * x11errorptr);
|
||||
|
||||
int apple_glx_context_surface_changed(unsigned int uid, pthread_t caller);
|
||||
|
||||
void apple_glx_context_update(Display * dpy, void *ptr);
|
||||
|
||||
bool apple_glx_context_uses_stereo(void *ptr);
|
||||
|
||||
#endif /*APPLE_GLX_CONTEXT_H */
|
|
@ -0,0 +1,542 @@
|
|||
/*
|
||||
Copyright (c) 2008, 2009 Apple Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation files
|
||||
(the "Software"), to deal in the Software without restriction,
|
||||
including without limitation the rights to use, copy, modify, merge,
|
||||
publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT
|
||||
HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name(s) of the above
|
||||
copyright holders shall not be used in advertising or otherwise to
|
||||
promote the sale, use or other dealings in this Software without
|
||||
prior written authorization.
|
||||
*/
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
#include <pthread.h>
|
||||
#include "apple_glx.h"
|
||||
#include "apple_glx_context.h"
|
||||
#include "apple_glx_drawable.h"
|
||||
#include "appledri.h"
|
||||
|
||||
static pthread_mutex_t drawables_lock = PTHREAD_MUTEX_INITIALIZER;
|
||||
static struct apple_glx_drawable *drawables_list = NULL;
|
||||
|
||||
static void
|
||||
lock_drawables_list(void)
|
||||
{
|
||||
int err;
|
||||
|
||||
err = pthread_mutex_lock(&drawables_lock);
|
||||
|
||||
if (err) {
|
||||
fprintf(stderr, "pthread_mutex_lock failure in %s: %d\n",
|
||||
__func__, err);
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
unlock_drawables_list(void)
|
||||
{
|
||||
int err;
|
||||
|
||||
err = pthread_mutex_unlock(&drawables_lock);
|
||||
|
||||
if (err) {
|
||||
fprintf(stderr, "pthread_mutex_unlock failure in %s: %d\n",
|
||||
__func__, err);
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
struct apple_glx_drawable *
|
||||
apple_glx_find_drawable(Display * dpy, GLXDrawable drawable)
|
||||
{
|
||||
struct apple_glx_drawable *i, *agd = NULL;
|
||||
|
||||
lock_drawables_list();
|
||||
|
||||
for (i = drawables_list; i; i = i->next) {
|
||||
if (i->drawable == drawable) {
|
||||
agd = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
unlock_drawables_list();
|
||||
|
||||
return agd;
|
||||
}
|
||||
|
||||
static void
|
||||
drawable_lock(struct apple_glx_drawable *agd)
|
||||
{
|
||||
int err;
|
||||
|
||||
err = pthread_mutex_lock(&agd->mutex);
|
||||
|
||||
if (err) {
|
||||
fprintf(stderr, "pthread_mutex_lock error: %d\n", err);
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
drawable_unlock(struct apple_glx_drawable *d)
|
||||
{
|
||||
int err;
|
||||
|
||||
err = pthread_mutex_unlock(&d->mutex);
|
||||
|
||||
if (err) {
|
||||
fprintf(stderr, "pthread_mutex_unlock error: %d\n", err);
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
reference_drawable(struct apple_glx_drawable *d)
|
||||
{
|
||||
d->lock(d);
|
||||
d->reference_count++;
|
||||
d->unlock(d);
|
||||
}
|
||||
|
||||
static void
|
||||
release_drawable(struct apple_glx_drawable *d)
|
||||
{
|
||||
d->lock(d);
|
||||
d->reference_count--;
|
||||
d->unlock(d);
|
||||
}
|
||||
|
||||
/* The drawables list must be locked prior to calling this. */
|
||||
/* Return true if the drawable was destroyed. */
|
||||
static bool
|
||||
destroy_drawable(struct apple_glx_drawable *d)
|
||||
{
|
||||
|
||||
d->lock(d);
|
||||
|
||||
if (d->reference_count > 0) {
|
||||
d->unlock(d);
|
||||
return false;
|
||||
}
|
||||
|
||||
d->unlock(d);
|
||||
|
||||
if (d->previous) {
|
||||
d->previous->next = d->next;
|
||||
}
|
||||
else {
|
||||
/*
|
||||
* The item must be at the head of the list, if it
|
||||
* has no previous pointer.
|
||||
*/
|
||||
drawables_list = d->next;
|
||||
}
|
||||
|
||||
if (d->next)
|
||||
d->next->previous = d->previous;
|
||||
|
||||
unlock_drawables_list();
|
||||
|
||||
if (d->callbacks.destroy) {
|
||||
/*
|
||||
* Warning: this causes other routines to be called (potentially)
|
||||
* from surface_notify_handler. It's probably best to not have
|
||||
* any locks at this point locked.
|
||||
*/
|
||||
d->callbacks.destroy(d->display, d);
|
||||
}
|
||||
|
||||
apple_glx_diagnostic("%s: freeing %p\n", __func__, (void *) d);
|
||||
|
||||
free(d);
|
||||
|
||||
/* So that the locks are balanced and the caller correctly unlocks. */
|
||||
lock_drawables_list();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* This is typically called when a context is destroyed or the current
|
||||
* drawable is made None.
|
||||
*/
|
||||
static bool
|
||||
destroy_drawable_callback(struct apple_glx_drawable *d)
|
||||
{
|
||||
bool result;
|
||||
|
||||
d->lock(d);
|
||||
|
||||
apple_glx_diagnostic("%s: %p ->reference_count before -- %d\n", __func__,
|
||||
(void *) d, d->reference_count);
|
||||
|
||||
d->reference_count--;
|
||||
|
||||
if (d->reference_count > 0) {
|
||||
d->unlock(d);
|
||||
return false;
|
||||
}
|
||||
|
||||
d->unlock(d);
|
||||
|
||||
lock_drawables_list();
|
||||
|
||||
result = destroy_drawable(d);
|
||||
|
||||
unlock_drawables_list();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static bool
|
||||
is_pbuffer(struct apple_glx_drawable *d)
|
||||
{
|
||||
return APPLE_GLX_DRAWABLE_PBUFFER == d->type;
|
||||
}
|
||||
|
||||
static bool
|
||||
is_pixmap(struct apple_glx_drawable *d)
|
||||
{
|
||||
return APPLE_GLX_DRAWABLE_PIXMAP == d->type;
|
||||
}
|
||||
|
||||
static void
|
||||
common_init(Display * dpy, GLXDrawable drawable, struct apple_glx_drawable *d)
|
||||
{
|
||||
int err;
|
||||
pthread_mutexattr_t attr;
|
||||
|
||||
d->display = dpy;
|
||||
d->reference_count = 0;
|
||||
d->drawable = drawable;
|
||||
d->type = -1;
|
||||
|
||||
err = pthread_mutexattr_init(&attr);
|
||||
|
||||
if (err) {
|
||||
fprintf(stderr, "pthread_mutexattr_init error: %d\n", err);
|
||||
abort();
|
||||
}
|
||||
|
||||
/*
|
||||
* There are some patterns that require a recursive mutex,
|
||||
* when working with locks that protect the apple_glx_drawable,
|
||||
* and reference functions like ->reference, and ->release.
|
||||
*/
|
||||
err = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
|
||||
|
||||
if (err) {
|
||||
fprintf(stderr, "error: setting pthread mutex type: %d\n", err);
|
||||
abort();
|
||||
}
|
||||
|
||||
err = pthread_mutex_init(&d->mutex, &attr);
|
||||
|
||||
if (err) {
|
||||
fprintf(stderr, "pthread_mutex_init error: %d\n", err);
|
||||
abort();
|
||||
}
|
||||
|
||||
(void) pthread_mutexattr_destroy(&attr);
|
||||
|
||||
d->lock = drawable_lock;
|
||||
d->unlock = drawable_unlock;
|
||||
|
||||
d->reference = reference_drawable;
|
||||
d->release = release_drawable;
|
||||
|
||||
d->destroy = destroy_drawable_callback;
|
||||
|
||||
d->is_pbuffer = is_pbuffer;
|
||||
d->is_pixmap = is_pixmap;
|
||||
|
||||
d->width = -1;
|
||||
d->height = -1;
|
||||
d->row_bytes = 0;
|
||||
d->path[0] = '\0';
|
||||
d->fd = -1;
|
||||
d->buffer = NULL;
|
||||
d->buffer_length = 0;
|
||||
|
||||
d->previous = NULL;
|
||||
d->next = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
link_tail(struct apple_glx_drawable *agd)
|
||||
{
|
||||
lock_drawables_list();
|
||||
|
||||
/* Link the new drawable into the global list. */
|
||||
agd->next = drawables_list;
|
||||
|
||||
if (drawables_list)
|
||||
drawables_list->previous = agd;
|
||||
|
||||
drawables_list = agd;
|
||||
|
||||
unlock_drawables_list();
|
||||
}
|
||||
|
||||
/*WARNING: this returns a locked and referenced object. */
|
||||
bool
|
||||
apple_glx_drawable_create(Display * dpy,
|
||||
int screen,
|
||||
GLXDrawable drawable,
|
||||
struct apple_glx_drawable **agdResult,
|
||||
struct apple_glx_drawable_callbacks *callbacks)
|
||||
{
|
||||
struct apple_glx_drawable *d;
|
||||
|
||||
d = calloc(1, sizeof *d);
|
||||
|
||||
if (NULL == d) {
|
||||
perror("malloc");
|
||||
return true;
|
||||
}
|
||||
|
||||
common_init(dpy, drawable, d);
|
||||
d->type = callbacks->type;
|
||||
d->callbacks = *callbacks;
|
||||
|
||||
d->reference(d);
|
||||
d->lock(d);
|
||||
|
||||
link_tail(d);
|
||||
|
||||
apple_glx_diagnostic("%s: new drawable %p\n", __func__, (void *) d);
|
||||
|
||||
*agdResult = d;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static int error_count = 0;
|
||||
|
||||
static int
|
||||
error_handler(Display * dpy, XErrorEvent * err)
|
||||
{
|
||||
if (err->error_code == BadWindow) {
|
||||
++error_count;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
apple_glx_garbage_collect_drawables(Display * dpy)
|
||||
{
|
||||
struct apple_glx_drawable *d, *dnext;
|
||||
Window root;
|
||||
int x, y;
|
||||
unsigned int width, height, bd, depth;
|
||||
int (*old_handler) (Display *, XErrorEvent *);
|
||||
|
||||
|
||||
if (NULL == drawables_list)
|
||||
return;
|
||||
|
||||
old_handler = XSetErrorHandler(error_handler);
|
||||
|
||||
XSync(dpy, False);
|
||||
|
||||
lock_drawables_list();
|
||||
|
||||
for (d = drawables_list; d;) {
|
||||
dnext = d->next;
|
||||
|
||||
d->lock(d);
|
||||
|
||||
if (d->reference_count > 0) {
|
||||
/*
|
||||
* Skip this, because some context still retains a reference
|
||||
* to the drawable.
|
||||
*/
|
||||
d->unlock(d);
|
||||
d = dnext;
|
||||
continue;
|
||||
}
|
||||
|
||||
d->unlock(d);
|
||||
|
||||
error_count = 0;
|
||||
|
||||
/*
|
||||
* Mesa uses XGetWindowAttributes, but some of these things are
|
||||
* most definitely not Windows, and that's against the rules.
|
||||
* XGetGeometry on the other hand is legal with a Pixmap and Window.
|
||||
*/
|
||||
XGetGeometry(dpy, d->drawable, &root, &x, &y, &width, &height, &bd,
|
||||
&depth);
|
||||
|
||||
if (error_count > 0) {
|
||||
/*
|
||||
* Note: this may not actually destroy the drawable.
|
||||
* If another context retains a reference to the drawable
|
||||
* after the reference count test above.
|
||||
*/
|
||||
(void) destroy_drawable(d);
|
||||
error_count = 0;
|
||||
}
|
||||
|
||||
d = dnext;
|
||||
}
|
||||
|
||||
XSetErrorHandler(old_handler);
|
||||
|
||||
unlock_drawables_list();
|
||||
}
|
||||
|
||||
unsigned int
|
||||
apple_glx_get_drawable_count(void)
|
||||
{
|
||||
unsigned int result = 0;
|
||||
struct apple_glx_drawable *d;
|
||||
|
||||
lock_drawables_list();
|
||||
|
||||
for (d = drawables_list; d; d = d->next)
|
||||
++result;
|
||||
|
||||
unlock_drawables_list();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
struct apple_glx_drawable *
|
||||
apple_glx_drawable_find_by_type(GLXDrawable drawable, int type, int flags)
|
||||
{
|
||||
struct apple_glx_drawable *d;
|
||||
|
||||
lock_drawables_list();
|
||||
|
||||
for (d = drawables_list; d; d = d->next) {
|
||||
if (d->type == type && d->drawable == drawable) {
|
||||
if (flags & APPLE_GLX_DRAWABLE_REFERENCE)
|
||||
d->reference(d);
|
||||
|
||||
if (flags & APPLE_GLX_DRAWABLE_LOCK)
|
||||
d->lock(d);
|
||||
|
||||
unlock_drawables_list();
|
||||
|
||||
return d;
|
||||
}
|
||||
}
|
||||
|
||||
unlock_drawables_list();
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct apple_glx_drawable *
|
||||
apple_glx_drawable_find(GLXDrawable drawable, int flags)
|
||||
{
|
||||
struct apple_glx_drawable *d;
|
||||
|
||||
lock_drawables_list();
|
||||
|
||||
for (d = drawables_list; d; d = d->next) {
|
||||
if (d->drawable == drawable) {
|
||||
if (flags & APPLE_GLX_DRAWABLE_REFERENCE)
|
||||
d->reference(d);
|
||||
|
||||
if (flags & APPLE_GLX_DRAWABLE_LOCK)
|
||||
d->lock(d);
|
||||
|
||||
unlock_drawables_list();
|
||||
|
||||
return d;
|
||||
}
|
||||
}
|
||||
|
||||
unlock_drawables_list();
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Return true if the type is valid for the drawable. */
|
||||
bool
|
||||
apple_glx_drawable_destroy_by_type(Display * dpy,
|
||||
GLXDrawable drawable, int type)
|
||||
{
|
||||
struct apple_glx_drawable *d;
|
||||
|
||||
lock_drawables_list();
|
||||
|
||||
for (d = drawables_list; d; d = d->next) {
|
||||
if (drawable == d->drawable && type == d->type) {
|
||||
/*
|
||||
* The user has requested that we destroy this resource.
|
||||
* However, there may be references in the contexts to it, so
|
||||
* release it, and call destroy_drawable which doesn't destroy
|
||||
* if the reference_count is > 0.
|
||||
*/
|
||||
d->release(d);
|
||||
|
||||
apple_glx_diagnostic("%s d->reference_count %d\n",
|
||||
__func__, d->reference_count);
|
||||
|
||||
destroy_drawable(d);
|
||||
unlock_drawables_list();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
unlock_drawables_list();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
struct apple_glx_drawable *
|
||||
apple_glx_drawable_find_by_uid(unsigned int uid, int flags)
|
||||
{
|
||||
struct apple_glx_drawable *d;
|
||||
|
||||
lock_drawables_list();
|
||||
|
||||
for (d = drawables_list; d; d = d->next) {
|
||||
/* Only surfaces have a uid. */
|
||||
if (APPLE_GLX_DRAWABLE_SURFACE == d->type) {
|
||||
if (d->types.surface.uid == uid) {
|
||||
if (flags & APPLE_GLX_DRAWABLE_REFERENCE)
|
||||
d->reference(d);
|
||||
|
||||
if (flags & APPLE_GLX_DRAWABLE_LOCK)
|
||||
d->lock(d);
|
||||
|
||||
unlock_drawables_list();
|
||||
|
||||
return d;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unlock_drawables_list();
|
||||
|
||||
return NULL;
|
||||
}
|
|
@ -0,0 +1,223 @@
|
|||
/*
|
||||
Copyright (c) 2008, 2009 Apple Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation files
|
||||
(the "Software"), to deal in the Software without restriction,
|
||||
including without limitation the rights to use, copy, modify, merge,
|
||||
publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT
|
||||
HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name(s) of the above
|
||||
copyright holders shall not be used in advertising or otherwise to
|
||||
promote the sale, use or other dealings in this Software without
|
||||
prior written authorization.
|
||||
*/
|
||||
#ifndef APPLE_GLX_DRAWABLE_H
|
||||
#define APPLE_GLX_DRAWABLE_H
|
||||
|
||||
#include <pthread.h>
|
||||
#include <stdbool.h>
|
||||
#include <limits.h>
|
||||
#include <GL/glx.h>
|
||||
#define XP_NO_X_HEADERS
|
||||
#include <Xplugin.h>
|
||||
#undef XP_NO_X_HEADERS
|
||||
#include "apple_glx_context.h"
|
||||
|
||||
enum
|
||||
{
|
||||
APPLE_GLX_DRAWABLE_SURFACE = 1,
|
||||
APPLE_GLX_DRAWABLE_PBUFFER,
|
||||
APPLE_GLX_DRAWABLE_PIXMAP
|
||||
};
|
||||
|
||||
/* The flag for the find routine. */
|
||||
enum
|
||||
{
|
||||
APPLE_GLX_DRAWABLE_LOCK = 2,
|
||||
APPLE_GLX_DRAWABLE_REFERENCE = 4
|
||||
};
|
||||
|
||||
struct apple_glx_context;
|
||||
struct apple_glx_drawable;
|
||||
|
||||
struct apple_glx_surface
|
||||
{
|
||||
xp_surface_id surface_id;
|
||||
unsigned int uid;
|
||||
bool pending_destroy;
|
||||
};
|
||||
|
||||
struct apple_glx_pbuffer
|
||||
{
|
||||
GLXPbuffer xid; /* our pixmap */
|
||||
int width, height;
|
||||
GLint fbconfigID;
|
||||
CGLPBufferObj buffer_obj;
|
||||
unsigned long event_mask;
|
||||
};
|
||||
|
||||
struct apple_glx_pixmap
|
||||
{
|
||||
GLXPixmap xpixmap;
|
||||
void *buffer;
|
||||
int width, height, pitch, /*bytes per pixel */ bpp;
|
||||
size_t size;
|
||||
char path[PATH_MAX];
|
||||
int fd;
|
||||
CGLPixelFormatObj pixel_format_obj;
|
||||
CGLContextObj context_obj;
|
||||
GLint fbconfigID;
|
||||
};
|
||||
|
||||
struct apple_glx_drawable_callbacks
|
||||
{
|
||||
int type;
|
||||
bool(*make_current) (struct apple_glx_context * ac,
|
||||
struct apple_glx_drawable * d);
|
||||
void (*destroy) (Display * dpy, struct apple_glx_drawable * d);
|
||||
};
|
||||
|
||||
struct apple_glx_drawable
|
||||
{
|
||||
Display *display;
|
||||
int reference_count;
|
||||
GLXDrawable drawable;
|
||||
int type; /* APPLE_GLX_DRAWABLE_* */
|
||||
|
||||
union
|
||||
{
|
||||
struct apple_glx_pixmap pixmap;
|
||||
struct apple_glx_pbuffer pbuffer;
|
||||
struct apple_glx_surface surface;
|
||||
} types;
|
||||
|
||||
struct apple_glx_drawable_callbacks callbacks;
|
||||
|
||||
/*
|
||||
* This mutex protects the reference count and any other drawable data.
|
||||
* It's used to prevent an early release of a drawable.
|
||||
*/
|
||||
pthread_mutex_t mutex;
|
||||
void (*lock) (struct apple_glx_drawable * agd);
|
||||
void (*unlock) (struct apple_glx_drawable * agd);
|
||||
|
||||
void (*reference) (struct apple_glx_drawable * agd);
|
||||
void (*release) (struct apple_glx_drawable * agd);
|
||||
|
||||
bool(*destroy) (struct apple_glx_drawable * agd);
|
||||
|
||||
bool(*is_pbuffer) (struct apple_glx_drawable * agd);
|
||||
|
||||
bool(*is_pixmap) (struct apple_glx_drawable * agd);
|
||||
|
||||
/*BEGIN These are used for the mixed mode drawing... */
|
||||
int width, height;
|
||||
int row_bytes;
|
||||
char path[PATH_MAX];
|
||||
int fd; /* The file descriptor for this drawable's shared memory. */
|
||||
void *buffer; /* The memory for the drawable. Typically shared memory. */
|
||||
size_t buffer_length;
|
||||
/*END*/ struct apple_glx_drawable *previous, *next;
|
||||
};
|
||||
|
||||
struct apple_glx_context;
|
||||
|
||||
/* May return NULL if not found */
|
||||
struct apple_glx_drawable *apple_glx_find_drawable(Display * dpy,
|
||||
GLXDrawable drawable);
|
||||
|
||||
/* Returns true on error and locks the agd result with a reference. */
|
||||
bool apple_glx_drawable_create(Display * dpy,
|
||||
int screen,
|
||||
GLXDrawable drawable,
|
||||
struct apple_glx_drawable **agd,
|
||||
struct apple_glx_drawable_callbacks
|
||||
*callbacks);
|
||||
|
||||
/* Returns true on error */
|
||||
bool apple_glx_create_drawable(Display * dpy,
|
||||
struct apple_glx_context *ac,
|
||||
GLXDrawable drawable,
|
||||
struct apple_glx_drawable **agd);
|
||||
|
||||
void apple_glx_garbage_collect_drawables(Display * dpy);
|
||||
|
||||
/*
|
||||
* This returns the total number of drawables.
|
||||
* It's mostly intended for debugging and introspection.
|
||||
*/
|
||||
unsigned int apple_glx_get_drawable_count(void);
|
||||
|
||||
struct apple_glx_drawable *apple_glx_drawable_find_by_type(GLXDrawable
|
||||
drawable, int type,
|
||||
int flags);
|
||||
|
||||
struct apple_glx_drawable *apple_glx_drawable_find(GLXDrawable drawable,
|
||||
int flags);
|
||||
|
||||
|
||||
bool apple_glx_drawable_destroy_by_type(Display * dpy, GLXDrawable drawable,
|
||||
int type);
|
||||
|
||||
struct apple_glx_drawable *apple_glx_drawable_find_by_uid(unsigned int uid,
|
||||
int flags);
|
||||
|
||||
/* Surfaces */
|
||||
|
||||
bool apple_glx_surface_create(Display * dpy, int screen, GLXDrawable drawable,
|
||||
struct apple_glx_drawable **resultptr);
|
||||
|
||||
void apple_glx_surface_destroy(unsigned int uid);
|
||||
|
||||
/* Pbuffers */
|
||||
|
||||
/* Returns true if an error occurred. */
|
||||
bool apple_glx_pbuffer_create(Display * dpy, GLXFBConfig config,
|
||||
int width, int height, int *errorcode,
|
||||
GLXPbuffer * pbuf);
|
||||
|
||||
/* Returns true if the pbuffer was invalid. */
|
||||
bool apple_glx_pbuffer_destroy(Display * dpy, GLXPbuffer pbuf);
|
||||
|
||||
/* Returns true if the pbuffer was valid and the attribute. */
|
||||
bool apple_glx_pbuffer_query(GLXDrawable d, int attribute,
|
||||
unsigned int *value);
|
||||
|
||||
/* Returns true if the GLXDrawable is a valid GLXPbuffer, and the mask is set. */
|
||||
bool apple_glx_pbuffer_set_event_mask(GLXDrawable d, unsigned long mask);
|
||||
|
||||
/* Returns true if the GLXDrawable is a valid GLXPbuffer, and the *mask is set. */
|
||||
bool apple_glx_pbuffer_get_event_mask(GLXDrawable d, unsigned long *mask);
|
||||
|
||||
|
||||
/* Pixmaps */
|
||||
|
||||
/* mode is a __GLcontextModes * */
|
||||
/* Returns true if an error occurred. */
|
||||
bool apple_glx_pixmap_create(Display * dpy, int screen, Pixmap pixmap,
|
||||
const void *mode);
|
||||
|
||||
/* Returns true if an error occurred. */
|
||||
bool apple_glx_pixmap_destroy(Display * dpy, Pixmap pixmap);
|
||||
|
||||
bool apple_glx_pixmap_query(GLXPixmap pixmap, int attribute,
|
||||
unsigned int *value);
|
||||
|
||||
|
||||
|
||||
#endif
|
|
@ -0,0 +1,330 @@
|
|||
/*
|
||||
Copyright (c) 2009 Apple Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation files
|
||||
(the "Software"), to deal in the Software without restriction,
|
||||
including without limitation the rights to use, copy, modify, merge,
|
||||
publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT
|
||||
HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name(s) of the above
|
||||
copyright holders shall not be used in advertising or otherwise to
|
||||
promote the sale, use or other dealings in this Software without
|
||||
prior written authorization.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <pthread.h>
|
||||
#include <assert.h>
|
||||
#include "apple_glx.h"
|
||||
#include "glcontextmodes.h"
|
||||
#include "apple_glx_context.h"
|
||||
#include "apple_glx_drawable.h"
|
||||
#include "apple_cgl.h"
|
||||
|
||||
static bool pbuffer_make_current(struct apple_glx_context *ac,
|
||||
struct apple_glx_drawable *d);
|
||||
|
||||
static void pbuffer_destroy(Display * dpy, struct apple_glx_drawable *d);
|
||||
|
||||
static struct apple_glx_drawable_callbacks callbacks = {
|
||||
.type = APPLE_GLX_DRAWABLE_PBUFFER,
|
||||
.make_current = pbuffer_make_current,
|
||||
.destroy = pbuffer_destroy
|
||||
};
|
||||
|
||||
|
||||
/* Return true if an error occurred. */
|
||||
bool
|
||||
pbuffer_make_current(struct apple_glx_context *ac,
|
||||
struct apple_glx_drawable *d)
|
||||
{
|
||||
struct apple_glx_pbuffer *pbuf = &d->types.pbuffer;
|
||||
CGLError cglerr;
|
||||
|
||||
assert(APPLE_GLX_DRAWABLE_PBUFFER == d->type);
|
||||
|
||||
cglerr = apple_cgl.set_pbuffer(ac->context_obj, pbuf->buffer_obj, 0, 0, 0);
|
||||
|
||||
if (kCGLNoError != cglerr) {
|
||||
fprintf(stderr, "set_pbuffer: %s\n", apple_cgl.error_string(cglerr));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!ac->made_current) {
|
||||
glViewport(0, 0, pbuf->width, pbuf->height);
|
||||
glScissor(0, 0, pbuf->width, pbuf->height);
|
||||
ac->made_current = true;
|
||||
}
|
||||
|
||||
apple_glx_diagnostic("made pbuffer drawable 0x%lx current\n", d->drawable);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
pbuffer_destroy(Display * dpy, struct apple_glx_drawable *d)
|
||||
{
|
||||
struct apple_glx_pbuffer *pbuf = &d->types.pbuffer;
|
||||
|
||||
assert(APPLE_GLX_DRAWABLE_PBUFFER == d->type);
|
||||
|
||||
apple_glx_diagnostic("destroying pbuffer for drawable 0x%lx\n",
|
||||
d->drawable);
|
||||
|
||||
apple_cgl.destroy_pbuffer(pbuf->buffer_obj);
|
||||
XFreePixmap(dpy, pbuf->xid);
|
||||
}
|
||||
|
||||
/* Return true if an error occurred. */
|
||||
bool
|
||||
apple_glx_pbuffer_destroy(Display * dpy, GLXPbuffer pbuf)
|
||||
{
|
||||
return !apple_glx_drawable_destroy_by_type(dpy, pbuf,
|
||||
APPLE_GLX_DRAWABLE_PBUFFER);
|
||||
}
|
||||
|
||||
/* Return true if an error occurred. */
|
||||
bool
|
||||
apple_glx_pbuffer_create(Display * dpy, GLXFBConfig config,
|
||||
int width, int height, int *errorcode,
|
||||
GLXPbuffer * result)
|
||||
{
|
||||
struct apple_glx_drawable *d;
|
||||
struct apple_glx_pbuffer *pbuf = NULL;
|
||||
CGLError err;
|
||||
Window root;
|
||||
int screen;
|
||||
Pixmap xid;
|
||||
__GLcontextModes *modes = (__GLcontextModes *) config;
|
||||
|
||||
root = DefaultRootWindow(dpy);
|
||||
screen = DefaultScreen(dpy);
|
||||
|
||||
/*
|
||||
* This pixmap is only used for a persistent XID.
|
||||
* The XC-MISC extension cleans up XIDs and reuses them transparently,
|
||||
* so we need to retain a server-side reference.
|
||||
*/
|
||||
xid = XCreatePixmap(dpy, root, (unsigned int) 1,
|
||||
(unsigned int) 1, DefaultDepth(dpy, screen));
|
||||
|
||||
if (None == xid) {
|
||||
*errorcode = BadAlloc;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (apple_glx_drawable_create(dpy, screen, xid, &d, &callbacks)) {
|
||||
*errorcode = BadAlloc;
|
||||
return true;
|
||||
}
|
||||
|
||||
/* The lock is held in d from create onward. */
|
||||
pbuf = &d->types.pbuffer;
|
||||
|
||||
pbuf->xid = xid;
|
||||
pbuf->width = width;
|
||||
pbuf->height = height;
|
||||
|
||||
err = apple_cgl.create_pbuffer(width, height, GL_TEXTURE_RECTANGLE_EXT,
|
||||
(modes->alphaBits > 0) ? GL_RGBA : GL_RGB,
|
||||
0, &pbuf->buffer_obj);
|
||||
|
||||
if (kCGLNoError != err) {
|
||||
d->unlock(d);
|
||||
d->destroy(d);
|
||||
*errorcode = BadMatch;
|
||||
return true;
|
||||
}
|
||||
|
||||
pbuf->fbconfigID = modes->fbconfigID;
|
||||
|
||||
pbuf->event_mask = 0;
|
||||
|
||||
*result = pbuf->xid;
|
||||
|
||||
d->unlock(d);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Return true if an error occurred. */
|
||||
static bool
|
||||
get_max_size(int *widthresult, int *heightresult)
|
||||
{
|
||||
CGLContextObj oldcontext;
|
||||
GLint ar[2];
|
||||
|
||||
oldcontext = apple_cgl.get_current_context();
|
||||
|
||||
if (!oldcontext) {
|
||||
/*
|
||||
* There is no current context, so we need to make one in order
|
||||
* to call glGetInteger.
|
||||
*/
|
||||
CGLPixelFormatObj pfobj;
|
||||
CGLError err;
|
||||
CGLPixelFormatAttribute attr[10];
|
||||
int c = 0;
|
||||
GLint vsref = 0;
|
||||
CGLContextObj newcontext;
|
||||
|
||||
attr[c++] = kCGLPFAColorSize;
|
||||
attr[c++] = 32;
|
||||
attr[c++] = 0;
|
||||
|
||||
err = apple_cgl.choose_pixel_format(attr, &pfobj, &vsref);
|
||||
if (kCGLNoError != err) {
|
||||
if (getenv("LIBGL_DIAGNOSTIC")) {
|
||||
printf("choose_pixel_format error in %s: %s\n", __func__,
|
||||
apple_cgl.error_string(err));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
err = apple_cgl.create_context(pfobj, NULL, &newcontext);
|
||||
|
||||
if (kCGLNoError != err) {
|
||||
if (getenv("LIBGL_DIAGNOSTIC")) {
|
||||
printf("create_context error in %s: %s\n", __func__,
|
||||
apple_cgl.error_string(err));
|
||||
}
|
||||
|
||||
apple_cgl.destroy_pixel_format(pfobj);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
err = apple_cgl.set_current_context(newcontext);
|
||||
|
||||
if (kCGLNoError != err) {
|
||||
printf("set_current_context error in %s: %s\n", __func__,
|
||||
apple_cgl.error_string(err));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
glGetIntegerv(GL_MAX_VIEWPORT_DIMS, ar);
|
||||
|
||||
apple_cgl.set_current_context(oldcontext);
|
||||
apple_cgl.destroy_context(newcontext);
|
||||
apple_cgl.destroy_pixel_format(pfobj);
|
||||
}
|
||||
else {
|
||||
/* We have a valid context. */
|
||||
|
||||
glGetIntegerv(GL_MAX_VIEWPORT_DIMS, ar);
|
||||
}
|
||||
|
||||
*widthresult = ar[0];
|
||||
*heightresult = ar[1];
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
apple_glx_pbuffer_query(GLXPbuffer p, int attr, unsigned int *value)
|
||||
{
|
||||
bool result = false;
|
||||
struct apple_glx_drawable *d;
|
||||
struct apple_glx_pbuffer *pbuf;
|
||||
|
||||
d = apple_glx_drawable_find_by_type(p, APPLE_GLX_DRAWABLE_PBUFFER,
|
||||
APPLE_GLX_DRAWABLE_LOCK);
|
||||
|
||||
if (d) {
|
||||
pbuf = &d->types.pbuffer;
|
||||
|
||||
switch (attr) {
|
||||
case GLX_WIDTH:
|
||||
*value = pbuf->width;
|
||||
result = true;
|
||||
break;
|
||||
|
||||
case GLX_HEIGHT:
|
||||
*value = pbuf->height;
|
||||
result = true;
|
||||
break;
|
||||
|
||||
case GLX_PRESERVED_CONTENTS:
|
||||
*value = true;
|
||||
result = true;
|
||||
break;
|
||||
|
||||
case GLX_LARGEST_PBUFFER:{
|
||||
int width, height;
|
||||
if (get_max_size(&width, &height)) {
|
||||
fprintf(stderr, "internal error: "
|
||||
"unable to find the largest pbuffer!\n");
|
||||
}
|
||||
else {
|
||||
*value = width;
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case GLX_FBCONFIG_ID:
|
||||
*value = pbuf->fbconfigID;
|
||||
result = true;
|
||||
break;
|
||||
}
|
||||
|
||||
d->unlock(d);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
bool
|
||||
apple_glx_pbuffer_set_event_mask(GLXDrawable drawable, unsigned long mask)
|
||||
{
|
||||
struct apple_glx_drawable *d;
|
||||
bool result = false;
|
||||
|
||||
d = apple_glx_drawable_find_by_type(drawable, APPLE_GLX_DRAWABLE_PBUFFER,
|
||||
APPLE_GLX_DRAWABLE_LOCK);
|
||||
|
||||
if (d) {
|
||||
d->types.pbuffer.event_mask = mask;
|
||||
result = true;
|
||||
d->unlock(d);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
bool
|
||||
apple_glx_pbuffer_get_event_mask(GLXDrawable drawable, unsigned long *mask)
|
||||
{
|
||||
struct apple_glx_drawable *d;
|
||||
bool result = false;
|
||||
|
||||
d = apple_glx_drawable_find_by_type(drawable, APPLE_GLX_DRAWABLE_PBUFFER,
|
||||
APPLE_GLX_DRAWABLE_LOCK);
|
||||
if (d) {
|
||||
*mask = d->types.pbuffer.event_mask;
|
||||
result = true;
|
||||
d->unlock(d);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
|
@ -0,0 +1,230 @@
|
|||
/*
|
||||
Copyright (c) 2009 Apple Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation files
|
||||
(the "Software"), to deal in the Software without restriction,
|
||||
including without limitation the rights to use, copy, modify, merge,
|
||||
publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT
|
||||
HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name(s) of the above
|
||||
copyright holders shall not be used in advertising or otherwise to
|
||||
promote the sale, use or other dealings in this Software without
|
||||
prior written authorization.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <pthread.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/mman.h>
|
||||
#include <unistd.h>
|
||||
#include <assert.h>
|
||||
#include "apple_glx.h"
|
||||
#include "apple_cgl.h"
|
||||
#include "apple_visual.h"
|
||||
#include "apple_glx_drawable.h"
|
||||
#include "appledri.h"
|
||||
#include "glcontextmodes.h"
|
||||
|
||||
static bool pixmap_make_current(struct apple_glx_context *ac,
|
||||
struct apple_glx_drawable *d);
|
||||
|
||||
static void pixmap_destroy(Display * dpy, struct apple_glx_drawable *d);
|
||||
|
||||
static struct apple_glx_drawable_callbacks callbacks = {
|
||||
.type = APPLE_GLX_DRAWABLE_PIXMAP,
|
||||
.make_current = pixmap_make_current,
|
||||
.destroy = pixmap_destroy
|
||||
};
|
||||
|
||||
static bool
|
||||
pixmap_make_current(struct apple_glx_context *ac,
|
||||
struct apple_glx_drawable *d)
|
||||
{
|
||||
CGLError cglerr;
|
||||
struct apple_glx_pixmap *p = &d->types.pixmap;
|
||||
|
||||
assert(APPLE_GLX_DRAWABLE_PIXMAP == d->type);
|
||||
|
||||
cglerr = apple_cgl.set_current_context(p->context_obj);
|
||||
|
||||
if (kCGLNoError != cglerr) {
|
||||
fprintf(stderr, "set current context: %s\n",
|
||||
apple_cgl.error_string(cglerr));
|
||||
return true;
|
||||
}
|
||||
|
||||
cglerr = apple_cgl.set_off_screen(p->context_obj, p->width, p->height,
|
||||
p->pitch, p->buffer);
|
||||
|
||||
if (kCGLNoError != cglerr) {
|
||||
fprintf(stderr, "set off screen: %s\n", apple_cgl.error_string(cglerr));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!ac->made_current) {
|
||||
glViewport(0, 0, p->width, p->height);
|
||||
glScissor(0, 0, p->width, p->height);
|
||||
ac->made_current = true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static void
|
||||
pixmap_destroy(Display * dpy, struct apple_glx_drawable *d)
|
||||
{
|
||||
struct apple_glx_pixmap *p = &d->types.pixmap;
|
||||
|
||||
if (p->pixel_format_obj)
|
||||
(void) apple_cgl.destroy_pixel_format(p->pixel_format_obj);
|
||||
|
||||
if (p->context_obj)
|
||||
(void) apple_cgl.destroy_context(p->context_obj);
|
||||
|
||||
XAppleDRIDestroyPixmap(dpy, p->xpixmap);
|
||||
|
||||
if (p->buffer) {
|
||||
if (munmap(p->buffer, p->size))
|
||||
perror("munmap");
|
||||
|
||||
if (-1 == close(p->fd))
|
||||
perror("close");
|
||||
|
||||
if (shm_unlink(p->path))
|
||||
perror("shm_unlink");
|
||||
}
|
||||
|
||||
apple_glx_diagnostic("destroyed pixmap buffer for: 0x%lx\n", d->drawable);
|
||||
}
|
||||
|
||||
/* Return true if an error occurred. */
|
||||
bool
|
||||
apple_glx_pixmap_create(Display * dpy, int screen, Pixmap pixmap,
|
||||
const void *mode)
|
||||
{
|
||||
struct apple_glx_drawable *d;
|
||||
struct apple_glx_pixmap *p;
|
||||
bool double_buffered;
|
||||
bool uses_stereo;
|
||||
CGLError error;
|
||||
const __GLcontextModes *cmodes = mode;
|
||||
|
||||
if (apple_glx_drawable_create(dpy, screen, pixmap, &d, &callbacks))
|
||||
return true;
|
||||
|
||||
/* d is locked and referenced at this point. */
|
||||
|
||||
p = &d->types.pixmap;
|
||||
|
||||
p->xpixmap = pixmap;
|
||||
p->buffer = NULL;
|
||||
|
||||
if (!XAppleDRICreatePixmap(dpy, screen, pixmap,
|
||||
&p->width, &p->height, &p->pitch, &p->bpp,
|
||||
&p->size, p->path, PATH_MAX)) {
|
||||
d->unlock(d);
|
||||
d->destroy(d);
|
||||
return true;
|
||||
}
|
||||
|
||||
p->fd = shm_open(p->path, O_RDWR, 0);
|
||||
|
||||
if (p->fd < 0) {
|
||||
perror("shm_open");
|
||||
d->unlock(d);
|
||||
d->destroy(d);
|
||||
return true;
|
||||
}
|
||||
|
||||
p->buffer = mmap(NULL, p->size, PROT_READ | PROT_WRITE,
|
||||
MAP_FILE | MAP_SHARED, p->fd, 0);
|
||||
|
||||
if (MAP_FAILED == p->buffer) {
|
||||
perror("mmap");
|
||||
d->unlock(d);
|
||||
d->destroy(d);
|
||||
return true;
|
||||
}
|
||||
|
||||
apple_visual_create_pfobj(&p->pixel_format_obj, mode, &double_buffered,
|
||||
&uses_stereo, /*offscreen */ true);
|
||||
|
||||
error = apple_cgl.create_context(p->pixel_format_obj, NULL,
|
||||
&p->context_obj);
|
||||
|
||||
if (kCGLNoError != error) {
|
||||
d->unlock(d);
|
||||
d->destroy(d);
|
||||
return true;
|
||||
}
|
||||
|
||||
p->fbconfigID = cmodes->fbconfigID;
|
||||
|
||||
d->unlock(d);
|
||||
|
||||
apple_glx_diagnostic("created: pixmap buffer for 0x%lx\n", d->drawable);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
apple_glx_pixmap_query(GLXPixmap pixmap, int attr, unsigned int *value)
|
||||
{
|
||||
struct apple_glx_drawable *d;
|
||||
struct apple_glx_pixmap *p;
|
||||
bool result = false;
|
||||
|
||||
d = apple_glx_drawable_find_by_type(pixmap, APPLE_GLX_DRAWABLE_PIXMAP,
|
||||
APPLE_GLX_DRAWABLE_LOCK);
|
||||
|
||||
if (d) {
|
||||
p = &d->types.pixmap;
|
||||
|
||||
switch (attr) {
|
||||
case GLX_WIDTH:
|
||||
*value = p->width;
|
||||
result = true;
|
||||
break;
|
||||
|
||||
case GLX_HEIGHT:
|
||||
*value = p->height;
|
||||
result = true;
|
||||
break;
|
||||
|
||||
case GLX_FBCONFIG_ID:
|
||||
*value = p->fbconfigID;
|
||||
result = true;
|
||||
break;
|
||||
}
|
||||
|
||||
d->unlock(d);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/* Return true if the type is valid for pixmap. */
|
||||
bool
|
||||
apple_glx_pixmap_destroy(Display * dpy, GLXPixmap pixmap)
|
||||
{
|
||||
return !apple_glx_drawable_destroy_by_type(dpy, pixmap,
|
||||
APPLE_GLX_DRAWABLE_PIXMAP);
|
||||
}
|
|
@ -0,0 +1,224 @@
|
|||
/*
|
||||
Copyright (c) 2009 Apple Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation files
|
||||
(the "Software"), to deal in the Software without restriction,
|
||||
including without limitation the rights to use, copy, modify, merge,
|
||||
publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT
|
||||
HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name(s) of the above
|
||||
copyright holders shall not be used in advertising or otherwise to
|
||||
promote the sale, use or other dealings in this Software without
|
||||
prior written authorization.
|
||||
*/
|
||||
#include <assert.h>
|
||||
#include "glxclient.h"
|
||||
#include "apple_glx.h"
|
||||
#include "appledri.h"
|
||||
#include "apple_glx_drawable.h"
|
||||
|
||||
static bool surface_make_current(struct apple_glx_context *ac,
|
||||
struct apple_glx_drawable *d);
|
||||
|
||||
static void surface_destroy(Display * dpy, struct apple_glx_drawable *d);
|
||||
|
||||
|
||||
static struct apple_glx_drawable_callbacks callbacks = {
|
||||
.type = APPLE_GLX_DRAWABLE_SURFACE,
|
||||
.make_current = surface_make_current,
|
||||
.destroy = surface_destroy
|
||||
};
|
||||
|
||||
static void
|
||||
update_viewport_and_scissor(Display * dpy, GLXDrawable drawable)
|
||||
{
|
||||
Window root;
|
||||
int x, y;
|
||||
unsigned int width = 0, height = 0, bd, depth;
|
||||
|
||||
XGetGeometry(dpy, drawable, &root, &x, &y, &width, &height, &bd, &depth);
|
||||
|
||||
glViewport(0, 0, width, height);
|
||||
glScissor(0, 0, width, height);
|
||||
}
|
||||
|
||||
static bool
|
||||
surface_make_current(struct apple_glx_context *ac,
|
||||
struct apple_glx_drawable *d)
|
||||
{
|
||||
struct apple_glx_surface *s = &d->types.surface;
|
||||
xp_error error;
|
||||
|
||||
assert(APPLE_GLX_DRAWABLE_SURFACE == d->type);
|
||||
|
||||
apple_glx_diagnostic("%s: ac->context_obj %p s->surface_id %u\n",
|
||||
__func__, (void *) ac->context_obj, s->surface_id);
|
||||
|
||||
error = xp_attach_gl_context(ac->context_obj, s->surface_id);
|
||||
|
||||
if (error) {
|
||||
fprintf(stderr, "error: xp_attach_gl_context returned: %d\n", error);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
if (!ac->made_current) {
|
||||
/*
|
||||
* The first time a new context is made current the glViewport
|
||||
* and glScissor should be updated.
|
||||
*/
|
||||
update_viewport_and_scissor(ac->drawable->display,
|
||||
ac->drawable->drawable);
|
||||
ac->made_current = true;
|
||||
}
|
||||
|
||||
apple_glx_diagnostic("%s: drawable 0x%lx\n", __func__, d->drawable);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static void
|
||||
surface_destroy(Display * dpy, struct apple_glx_drawable *d)
|
||||
{
|
||||
struct apple_glx_surface *s = &d->types.surface;
|
||||
|
||||
apple_glx_diagnostic("%s: s->surface_id %u\n", __func__, s->surface_id);
|
||||
|
||||
xp_error error = xp_destroy_surface(s->surface_id);
|
||||
|
||||
if (error) {
|
||||
fprintf(stderr, "xp_destroy_surface error: %d\n", (int) error);
|
||||
}
|
||||
|
||||
/*
|
||||
* Check if this surface destroy came from the surface being destroyed
|
||||
* on the server. If s->pending_destroy is true, then it did, and
|
||||
* we don't want to try to destroy the surface on the server.
|
||||
*/
|
||||
if (!s->pending_destroy) {
|
||||
/*
|
||||
* Warning: this causes other routines to be called (potentially)
|
||||
* from surface_notify_handler. It's probably best to not have
|
||||
* any locks at this point locked.
|
||||
*/
|
||||
XAppleDRIDestroySurface(d->display, DefaultScreen(d->display),
|
||||
d->drawable);
|
||||
|
||||
apple_glx_diagnostic
|
||||
("%s: destroyed a surface for drawable 0x%lx uid %u\n", __func__,
|
||||
d->drawable, s->uid);
|
||||
}
|
||||
}
|
||||
|
||||
/* Return true if an error occured. */
|
||||
static bool
|
||||
create_surface(Display * dpy, int screen, struct apple_glx_drawable *d)
|
||||
{
|
||||
struct apple_glx_surface *s = &d->types.surface;
|
||||
unsigned int key[2];
|
||||
xp_client_id id;
|
||||
|
||||
id = apple_glx_get_client_id();
|
||||
if (0 == id)
|
||||
return true;
|
||||
|
||||
assert(None != d->drawable);
|
||||
|
||||
s->pending_destroy = false;
|
||||
|
||||
if (XAppleDRICreateSurface(dpy, screen, d->drawable, id, key, &s->uid)) {
|
||||
xp_error error;
|
||||
|
||||
error = xp_import_surface(key, &s->surface_id);
|
||||
|
||||
if (error) {
|
||||
fprintf(stderr, "error: xp_import_surface returned: %d\n", error);
|
||||
return true;
|
||||
}
|
||||
|
||||
apple_glx_diagnostic("%s: created a surface for drawable 0x%lx"
|
||||
" with uid %u\n", __func__, d->drawable, s->uid);
|
||||
return false; /*success */
|
||||
}
|
||||
|
||||
return true; /* unable to create a surface. */
|
||||
}
|
||||
|
||||
/* Return true if an error occured. */
|
||||
/* This returns a referenced object via resultptr. */
|
||||
bool
|
||||
apple_glx_surface_create(Display * dpy, int screen,
|
||||
GLXDrawable drawable,
|
||||
struct apple_glx_drawable ** resultptr)
|
||||
{
|
||||
struct apple_glx_drawable *d;
|
||||
|
||||
if (apple_glx_drawable_create(dpy, screen, drawable, &d, &callbacks))
|
||||
return true;
|
||||
|
||||
/* apple_glx_drawable_create creates a locked and referenced object. */
|
||||
|
||||
if (create_surface(dpy, screen, d)) {
|
||||
d->unlock(d);
|
||||
d->destroy(d);
|
||||
return true;
|
||||
}
|
||||
|
||||
*resultptr = d;
|
||||
|
||||
d->unlock(d);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* All surfaces are reference counted, and surfaces are only created
|
||||
* when the window is made current. When all contexts no longer reference
|
||||
* a surface drawable the apple_glx_drawable gets destroyed, and thus
|
||||
* its surface is destroyed.
|
||||
*
|
||||
* However we can make the destruction occur a bit sooner by setting
|
||||
* pending_destroy, which is then checked for in glViewport by
|
||||
* apple_glx_context_update.
|
||||
*/
|
||||
void
|
||||
apple_glx_surface_destroy(unsigned int uid)
|
||||
{
|
||||
struct apple_glx_drawable *d;
|
||||
|
||||
d = apple_glx_drawable_find_by_uid(uid, APPLE_GLX_DRAWABLE_REFERENCE
|
||||
| APPLE_GLX_DRAWABLE_LOCK);
|
||||
|
||||
if (d) {
|
||||
d->types.surface.pending_destroy = true;
|
||||
d->release(d);
|
||||
/*
|
||||
* We release 2 references to the surface. One was acquired by
|
||||
* the find, and the other was leftover from a context, or
|
||||
* the surface being displayed, so the destroy() will decrease it
|
||||
* once more.
|
||||
*
|
||||
* If the surface is in a context, it will take one d->destroy(d);
|
||||
* to actually destroy it when the pending_destroy is processed
|
||||
* by a glViewport callback (see apple_glx_context_update()).
|
||||
*/
|
||||
d->destroy(d);
|
||||
|
||||
d->unlock(d);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,144 @@
|
|||
/*
|
||||
Copyright (c) 2008, 2009 Apple Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation files
|
||||
(the "Software"), to deal in the Software without restriction,
|
||||
including without limitation the rights to use, copy, modify, merge,
|
||||
publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT
|
||||
HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name(s) of the above
|
||||
copyright holders shall not be used in advertising or otherwise to
|
||||
promote the sale, use or other dealings in this Software without
|
||||
prior written authorization.
|
||||
*/
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
#include <GL/gl.h>
|
||||
#include <OpenGL/OpenGL.h>
|
||||
#include <OpenGL/CGLContext.h>
|
||||
#include <OpenGL/CGLRenderers.h>
|
||||
#include "apple_cgl.h"
|
||||
#include "apple_visual.h"
|
||||
#include "apple_glx.h"
|
||||
#include "glcontextmodes.h"
|
||||
|
||||
enum
|
||||
{
|
||||
MAX_ATTR = 60
|
||||
};
|
||||
|
||||
/*mode is a __GlcontextModes*/
|
||||
void
|
||||
apple_visual_create_pfobj(CGLPixelFormatObj * pfobj, const void *mode,
|
||||
bool * double_buffered, bool * uses_stereo,
|
||||
bool offscreen)
|
||||
{
|
||||
CGLPixelFormatAttribute attr[MAX_ATTR];
|
||||
const __GLcontextModes *c = mode;
|
||||
int numattr = 0;
|
||||
GLint vsref = 0;
|
||||
CGLError error = 0;
|
||||
|
||||
if (offscreen) {
|
||||
apple_glx_diagnostic
|
||||
("offscreen rendering enabled. Using kCGLPFAOffScreen\n");
|
||||
|
||||
attr[numattr++] = kCGLPFAOffScreen;
|
||||
attr[numattr++] = kCGLPFAColorSize;
|
||||
attr[numattr++] = 32;
|
||||
}
|
||||
else if (getenv("LIBGL_ALWAYS_SOFTWARE") != NULL) {
|
||||
apple_glx_diagnostic
|
||||
("Software rendering requested. Using kCGLRendererGenericFloatID.\n");
|
||||
attr[numattr++] = kCGLPFARendererID;
|
||||
attr[numattr++] = kCGLRendererGenericFloatID;
|
||||
}
|
||||
else if (getenv("LIBGL_ALLOW_SOFTWARE") != NULL) {
|
||||
apple_glx_diagnostic
|
||||
("Software rendering is not being excluded. Not using kCGLPFAAccelerated.\n");
|
||||
}
|
||||
else {
|
||||
attr[numattr++] = kCGLPFAAccelerated;
|
||||
}
|
||||
|
||||
/*
|
||||
* The program chose a config based on the fbconfigs or visuals.
|
||||
* Those are based on the attributes from CGL, so we probably
|
||||
* do want the closest match for the color, depth, and accum.
|
||||
*/
|
||||
attr[numattr++] = kCGLPFAClosestPolicy;
|
||||
|
||||
if (c->stereoMode) {
|
||||
attr[numattr++] = kCGLPFAStereo;
|
||||
*uses_stereo = true;
|
||||
}
|
||||
else {
|
||||
*uses_stereo = false;
|
||||
}
|
||||
|
||||
if (c->doubleBufferMode) {
|
||||
attr[numattr++] = kCGLPFADoubleBuffer;
|
||||
*double_buffered = true;
|
||||
}
|
||||
else {
|
||||
*double_buffered = false;
|
||||
}
|
||||
|
||||
attr[numattr++] = kCGLPFAColorSize;
|
||||
attr[numattr++] = c->redBits + c->greenBits + c->blueBits;
|
||||
attr[numattr++] = kCGLPFAAlphaSize;
|
||||
attr[numattr++] = c->alphaBits;
|
||||
|
||||
if ((c->accumRedBits + c->accumGreenBits + c->accumBlueBits) > 0) {
|
||||
attr[numattr++] = kCGLPFAAccumSize;
|
||||
attr[numattr++] = c->accumRedBits + c->accumGreenBits +
|
||||
c->accumBlueBits + c->accumAlphaBits;
|
||||
}
|
||||
|
||||
if (c->depthBits > 0) {
|
||||
attr[numattr++] = kCGLPFADepthSize;
|
||||
attr[numattr++] = c->depthBits;
|
||||
}
|
||||
|
||||
if (c->stencilBits > 0) {
|
||||
attr[numattr++] = kCGLPFAStencilSize;
|
||||
attr[numattr++] = c->stencilBits;
|
||||
}
|
||||
|
||||
if (c->sampleBuffers > 0) {
|
||||
attr[numattr++] = kCGLPFAMultisample;
|
||||
attr[numattr++] = kCGLPFASampleBuffers;
|
||||
attr[numattr++] = c->sampleBuffers;
|
||||
attr[numattr++] = kCGLPFASamples;
|
||||
attr[numattr++] = c->samples;
|
||||
}
|
||||
|
||||
attr[numattr++] = 0;
|
||||
|
||||
assert(numattr < MAX_ATTR);
|
||||
|
||||
error = apple_cgl.choose_pixel_format(attr, pfobj, &vsref);
|
||||
|
||||
if (error) {
|
||||
fprintf(stderr, "error: %s\n", apple_cgl.error_string(error));
|
||||
abort();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
Copyright (c) 2008 Apple Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation files
|
||||
(the "Software"), to deal in the Software without restriction,
|
||||
including without limitation the rights to use, copy, modify, merge,
|
||||
publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT
|
||||
HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name(s) of the above
|
||||
copyright holders shall not be used in advertising or otherwise to
|
||||
promote the sale, use or other dealings in this Software without
|
||||
prior written authorization.
|
||||
*/
|
||||
|
||||
#ifndef APPLE_VISUAL_H
|
||||
#define APPLE_VISUAL_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <OpenGL/CGLTypes.h>
|
||||
|
||||
/* mode is expected to be of type __GLcontextModes. */
|
||||
void apple_visual_create_pfobj(CGLPixelFormatObj * pfobj, const void *mode,
|
||||
bool * double_buffered, bool * uses_stereo,
|
||||
bool offscreen);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,134 @@
|
|||
/*
|
||||
Copyright (c) 2008, 2009 Apple Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation files
|
||||
(the "Software"), to deal in the Software without restriction,
|
||||
including without limitation the rights to use, copy, modify, merge,
|
||||
publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT
|
||||
HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name(s) of the above
|
||||
copyright holders shall not be used in advertising or otherwise to
|
||||
promote the sale, use or other dealings in this Software without
|
||||
prior written authorization.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file works with the glXMakeContextCurrent readable drawable.
|
||||
*
|
||||
* The way it works is by swapping the currentDrawable for the currentReadable
|
||||
* drawable if they are different.
|
||||
*/
|
||||
#include <stdbool.h>
|
||||
#include "apple_xgl_api_read.h"
|
||||
#include "apple_xgl_api.h"
|
||||
#include "apple_cgl.h"
|
||||
#include "apple_glx_context.h"
|
||||
|
||||
extern struct apple_xgl_api __gl_api;
|
||||
|
||||
struct apple_xgl_saved_state
|
||||
{
|
||||
bool swapped;
|
||||
};
|
||||
|
||||
static void
|
||||
SetRead(struct apple_xgl_saved_state *saved)
|
||||
{
|
||||
GLXContext gc = __glXGetCurrentContext();
|
||||
|
||||
/*
|
||||
* By default indicate that the state was not swapped, so that UnsetRead
|
||||
* functions correctly.
|
||||
*/
|
||||
saved->swapped = false;
|
||||
|
||||
/*
|
||||
* If the readable drawable isn't the same as the drawable then
|
||||
* the user has requested a readable drawable with glXMakeContextCurrent().
|
||||
* We emulate this behavior by switching the current drawable.
|
||||
*/
|
||||
if (None != gc->currentReadable
|
||||
&& gc->currentReadable != gc->currentDrawable) {
|
||||
Display *dpy = glXGetCurrentDisplay();
|
||||
|
||||
saved->swapped = true;
|
||||
|
||||
if (apple_glx_make_current_context(dpy, gc->apple, gc->apple,
|
||||
gc->currentReadable)) {
|
||||
/* An error occurred, so try to restore the old context state. */
|
||||
(void) apple_glx_make_current_context(dpy, gc->apple, gc->apple,
|
||||
gc->currentDrawable);
|
||||
saved->swapped = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
UnsetRead(struct apple_xgl_saved_state *saved)
|
||||
{
|
||||
if (saved->swapped) {
|
||||
GLXContext gc = __glXGetCurrentContext();
|
||||
Display *dpy = glXGetCurrentDisplay();
|
||||
|
||||
if (apple_glx_make_current_context(dpy, gc->apple, gc->apple,
|
||||
gc->currentDrawable)) {
|
||||
/*
|
||||
* An error occurred restoring the drawable.
|
||||
* It's unclear what to do about that.
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height,
|
||||
GLenum format, GLenum type, void *pixels)
|
||||
{
|
||||
struct apple_xgl_saved_state saved;
|
||||
|
||||
SetRead(&saved);
|
||||
|
||||
__gl_api.ReadPixels(x, y, width, height, format, type, pixels);
|
||||
|
||||
UnsetRead(&saved);
|
||||
}
|
||||
|
||||
void
|
||||
glCopyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type)
|
||||
{
|
||||
struct apple_xgl_saved_state saved;
|
||||
|
||||
SetRead(&saved);
|
||||
|
||||
__gl_api.CopyPixels(x, y, width, height, type);
|
||||
|
||||
UnsetRead(&saved);
|
||||
}
|
||||
|
||||
void
|
||||
glCopyColorTable(GLenum target, GLenum internalformat, GLint x, GLint y,
|
||||
GLsizei width)
|
||||
{
|
||||
struct apple_xgl_saved_state saved;
|
||||
|
||||
SetRead(&saved);
|
||||
|
||||
__gl_api.CopyColorTable(target, internalformat, x, y, width);
|
||||
|
||||
UnsetRead(&saved);
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
Copyright (c) 2008, 2009 Apple Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation files
|
||||
(the "Software"), to deal in the Software without restriction,
|
||||
including without limitation the rights to use, copy, modify, merge,
|
||||
publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT
|
||||
HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name(s) of the above
|
||||
copyright holders shall not be used in advertising or otherwise to
|
||||
promote the sale, use or other dealings in this Software without
|
||||
prior written authorization.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file works with the glXMakeContextCurrent readable drawable.
|
||||
*/
|
||||
#ifndef APPLE_XGL_API_READ_H
|
||||
#define APPLE_XGL_API_READ_H
|
||||
|
||||
#include "glxclient.h"
|
||||
|
||||
extern void glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height,
|
||||
GLenum format, GLenum type, void *pixels);
|
||||
|
||||
extern void glCopyPixels(GLint x, GLint y, GLsizei width, GLsizei height,
|
||||
GLenum type);
|
||||
|
||||
extern void glCopyColorTable(GLenum target, GLenum internalformat, GLint x,
|
||||
GLint y, GLsizei width);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,119 @@
|
|||
/*
|
||||
Copyright (c) 2009 Apple Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation files
|
||||
(the "Software"), to deal in the Software without restriction,
|
||||
including without limitation the rights to use, copy, modify, merge,
|
||||
publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT
|
||||
HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name(s) of the above
|
||||
copyright holders shall not be used in advertising or otherwise to
|
||||
promote the sale, use or other dealings in this Software without
|
||||
prior written authorization.
|
||||
*/
|
||||
|
||||
#include <stdbool.h>
|
||||
#include "apple_xgl_api_stereo.h"
|
||||
#include "apple_xgl_api.h"
|
||||
#include "apple_glx_context.h"
|
||||
|
||||
extern struct apple_xgl_api __gl_api;
|
||||
/*
|
||||
* These are special functions for stereoscopic support
|
||||
* differences in MacOS X.
|
||||
*/
|
||||
void
|
||||
glDrawBuffer(GLenum mode)
|
||||
{
|
||||
GLXContext gc = glXGetCurrentContext();
|
||||
|
||||
if (gc && apple_glx_context_uses_stereo(gc->apple)) {
|
||||
GLenum buf[2];
|
||||
GLsizei n = 0;
|
||||
|
||||
switch (mode) {
|
||||
case GL_BACK:
|
||||
buf[0] = GL_BACK_LEFT;
|
||||
buf[1] = GL_BACK_RIGHT;
|
||||
n = 2;
|
||||
break;
|
||||
case GL_FRONT:
|
||||
buf[0] = GL_FRONT_LEFT;
|
||||
buf[1] = GL_FRONT_RIGHT;
|
||||
n = 2;
|
||||
break;
|
||||
|
||||
default:
|
||||
buf[0] = mode;
|
||||
n = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
__gl_api.DrawBuffers(n, buf);
|
||||
}
|
||||
else {
|
||||
__gl_api.DrawBuffer(mode);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
glDrawBuffers(GLsizei n, const GLenum * bufs)
|
||||
{
|
||||
GLXContext gc = glXGetCurrentContext();
|
||||
|
||||
if (gc && apple_glx_context_uses_stereo(gc->apple)) {
|
||||
GLenum newbuf[n + 2];
|
||||
GLsizei i, outi = 0;
|
||||
bool have_back = false;
|
||||
bool have_front = false;
|
||||
|
||||
for (i = 0; i < n; ++i) {
|
||||
if (GL_BACK == bufs[i]) {
|
||||
have_back = true;
|
||||
}
|
||||
else if (GL_FRONT == bufs[i]) {
|
||||
have_back = true;
|
||||
}
|
||||
else {
|
||||
newbuf[outi++] = bufs[i];
|
||||
}
|
||||
}
|
||||
|
||||
if (have_back) {
|
||||
newbuf[outi++] = GL_BACK_LEFT;
|
||||
newbuf[outi++] = GL_BACK_RIGHT;
|
||||
}
|
||||
|
||||
if (have_front) {
|
||||
newbuf[outi++] = GL_FRONT_LEFT;
|
||||
newbuf[outi++] = GL_FRONT_RIGHT;
|
||||
}
|
||||
|
||||
__gl_api.DrawBuffers(outi, newbuf);
|
||||
}
|
||||
else {
|
||||
__gl_api.DrawBuffers(n, bufs);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
glDrawBuffersARB(GLsizei n, const GLenum * bufs)
|
||||
{
|
||||
glDrawBuffers(n, bufs);
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
Copyright (c) 2009 Apple Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation files
|
||||
(the "Software"), to deal in the Software without restriction,
|
||||
including without limitation the rights to use, copy, modify, merge,
|
||||
publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT
|
||||
HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name(s) of the above
|
||||
copyright holders shall not be used in advertising or otherwise to
|
||||
promote the sale, use or other dealings in this Software without
|
||||
prior written authorization.
|
||||
*/
|
||||
|
||||
#include "glxclient.h"
|
||||
|
||||
#ifndef APPLE_XGL_API_STEREO_H
|
||||
#define APPLE_XGL_API_STEREO_H
|
||||
|
||||
extern void glDrawBuffer(GLenum mode);
|
||||
extern void glDrawBuffers(GLsizei n, const GLenum * bufs);
|
||||
extern void glDrawBuffersARB(GLsizei n, const GLenum * bufs);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
Copyright (c) 2009 Apple Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation files
|
||||
(the "Software"), to deal in the Software without restriction,
|
||||
including without limitation the rights to use, copy, modify, merge,
|
||||
publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT
|
||||
HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name(s) of the above
|
||||
copyright holders shall not be used in advertising or otherwise to
|
||||
promote the sale, use or other dealings in this Software without
|
||||
prior written authorization.
|
||||
*/
|
||||
#include "apple_glx_context.h"
|
||||
#include "apple_xgl_api.h"
|
||||
#include "apple_xgl_api_viewport.h"
|
||||
|
||||
extern struct apple_xgl_api __gl_api;
|
||||
|
||||
void
|
||||
glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
|
||||
{
|
||||
GLXContext gc = __glXGetCurrentContext();
|
||||
Display *dpy = glXGetCurrentDisplay();
|
||||
|
||||
if (gc && gc->apple)
|
||||
apple_glx_context_update(dpy, gc->apple);
|
||||
|
||||
__gl_api.Viewport(x, y, width, height);
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
Copyright (c) 2009 Apple Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation files
|
||||
(the "Software"), to deal in the Software without restriction,
|
||||
including without limitation the rights to use, copy, modify, merge,
|
||||
publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT
|
||||
HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name(s) of the above
|
||||
copyright holders shall not be used in advertising or otherwise to
|
||||
promote the sale, use or other dealings in this Software without
|
||||
prior written authorization.
|
||||
*/
|
||||
#ifndef APPLE_XGL_API_VIEWPORT_H
|
||||
#define APPLE_XGL_API_VIEWPORT_H
|
||||
|
||||
#include "glxclient.h"
|
||||
|
||||
void glViewport(GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,452 @@
|
|||
/* $XFree86: xc/lib/GL/dri/XF86dri.c,v 1.12 2001/08/27 17:40:57 dawes Exp $ */
|
||||
/**************************************************************************
|
||||
|
||||
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
|
||||
Copyright 2000 VA Linux Systems, Inc.
|
||||
Copyright (c) 2002, 2008 Apple Computer, Inc.
|
||||
All Rights Reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sub license, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice (including the
|
||||
next paragraph) shall be included in all copies or substantial portions
|
||||
of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
|
||||
IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
|
||||
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
**************************************************************************/
|
||||
|
||||
/*
|
||||
* Authors:
|
||||
* Kevin E. Martin <martin@valinux.com>
|
||||
* Jens Owen <jens@valinux.com>
|
||||
* Rickard E. (Rik) Faith <faith@valinux.com>
|
||||
*
|
||||
*/
|
||||
|
||||
/* THIS IS NOT AN X CONSORTIUM STANDARD */
|
||||
|
||||
#define NEED_EVENTS
|
||||
#define NEED_REPLIES
|
||||
#include <X11/Xlibint.h>
|
||||
#include "appledristr.h"
|
||||
#include <X11/extensions/Xext.h>
|
||||
#include <X11/extensions/extutil.h>
|
||||
#include <stdio.h>
|
||||
|
||||
static XExtensionInfo _appledri_info_data;
|
||||
static XExtensionInfo *appledri_info = &_appledri_info_data;
|
||||
static char *appledri_extension_name = APPLEDRINAME;
|
||||
|
||||
#define AppleDRICheckExtension(dpy,i,val) \
|
||||
XextCheckExtension (dpy, i, appledri_extension_name, val)
|
||||
|
||||
/*****************************************************************************
|
||||
* *
|
||||
* private utility routines *
|
||||
* *
|
||||
*****************************************************************************/
|
||||
|
||||
static int close_display(Display * dpy, XExtCodes * extCodes);
|
||||
static Bool wire_to_event(Display * dpy, XEvent * re, xEvent * event);
|
||||
|
||||
static /* const */ XExtensionHooks appledri_extension_hooks = {
|
||||
NULL, /* create_gc */
|
||||
NULL, /* copy_gc */
|
||||
NULL, /* flush_gc */
|
||||
NULL, /* free_gc */
|
||||
NULL, /* create_font */
|
||||
NULL, /* free_font */
|
||||
close_display, /* close_display */
|
||||
wire_to_event, /* wire_to_event */
|
||||
NULL, /* event_to_wire */
|
||||
NULL, /* error */
|
||||
NULL, /* error_string */
|
||||
};
|
||||
|
||||
static
|
||||
XEXT_GENERATE_FIND_DISPLAY(find_display, appledri_info,
|
||||
appledri_extension_name,
|
||||
&appledri_extension_hooks,
|
||||
AppleDRINumberEvents, NULL)
|
||||
|
||||
static XEXT_GENERATE_CLOSE_DISPLAY(close_display, appledri_info)
|
||||
|
||||
static void (*surface_notify_handler) ();
|
||||
|
||||
void *XAppleDRISetSurfaceNotifyHandler(void (*fun) ())
|
||||
{
|
||||
void *old = surface_notify_handler;
|
||||
surface_notify_handler = fun;
|
||||
return old;
|
||||
}
|
||||
|
||||
static Bool
|
||||
wire_to_event(Display *dpy, XEvent *re, xEvent *event)
|
||||
{
|
||||
XExtDisplayInfo *info = find_display(dpy);
|
||||
xAppleDRINotifyEvent *sevent;
|
||||
|
||||
AppleDRICheckExtension(dpy, info, False);
|
||||
|
||||
switch ((event->u.u.type & 0x7f) - info->codes->first_event) {
|
||||
case AppleDRISurfaceNotify:
|
||||
sevent = (xAppleDRINotifyEvent *) event;
|
||||
if (surface_notify_handler != NULL) {
|
||||
(*surface_notify_handler) (dpy, (unsigned int) sevent->arg,
|
||||
(int) sevent->kind);
|
||||
}
|
||||
return False;
|
||||
}
|
||||
return False;
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* *
|
||||
* public Apple-DRI Extension routines *
|
||||
* *
|
||||
*****************************************************************************/
|
||||
|
||||
#if 0
|
||||
#include <stdio.h>
|
||||
#define TRACE(msg) fprintf(stderr, "AppleDRI%s\n", msg);
|
||||
#else
|
||||
#define TRACE(msg)
|
||||
#endif
|
||||
|
||||
|
||||
Bool
|
||||
XAppleDRIQueryExtension(dpy, event_basep, error_basep)
|
||||
Display *dpy;
|
||||
int *event_basep, *error_basep;
|
||||
{
|
||||
XExtDisplayInfo *info = find_display(dpy);
|
||||
|
||||
TRACE("QueryExtension...");
|
||||
if (XextHasExtension(info)) {
|
||||
*event_basep = info->codes->first_event;
|
||||
*error_basep = info->codes->first_error;
|
||||
TRACE("QueryExtension... return True");
|
||||
return True;
|
||||
}
|
||||
else {
|
||||
TRACE("QueryExtension... return False");
|
||||
return False;
|
||||
}
|
||||
}
|
||||
|
||||
Bool
|
||||
XAppleDRIQueryVersion(dpy, majorVersion, minorVersion, patchVersion)
|
||||
Display *dpy;
|
||||
int *majorVersion;
|
||||
int *minorVersion;
|
||||
int *patchVersion;
|
||||
{
|
||||
XExtDisplayInfo *info = find_display(dpy);
|
||||
xAppleDRIQueryVersionReply rep;
|
||||
xAppleDRIQueryVersionReq *req;
|
||||
|
||||
TRACE("QueryVersion...");
|
||||
AppleDRICheckExtension(dpy, info, False);
|
||||
|
||||
LockDisplay(dpy);
|
||||
GetReq(AppleDRIQueryVersion, req);
|
||||
req->reqType = info->codes->major_opcode;
|
||||
req->driReqType = X_AppleDRIQueryVersion;
|
||||
if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
TRACE("QueryVersion... return False");
|
||||
return False;
|
||||
}
|
||||
*majorVersion = rep.majorVersion;
|
||||
*minorVersion = rep.minorVersion;
|
||||
*patchVersion = rep.patchVersion;
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
TRACE("QueryVersion... return True");
|
||||
return True;
|
||||
}
|
||||
|
||||
Bool
|
||||
XAppleDRIQueryDirectRenderingCapable(dpy, screen, isCapable)
|
||||
Display *dpy;
|
||||
int screen;
|
||||
Bool *isCapable;
|
||||
{
|
||||
XExtDisplayInfo *info = find_display(dpy);
|
||||
xAppleDRIQueryDirectRenderingCapableReply rep;
|
||||
xAppleDRIQueryDirectRenderingCapableReq *req;
|
||||
|
||||
TRACE("QueryDirectRenderingCapable...");
|
||||
AppleDRICheckExtension(dpy, info, False);
|
||||
|
||||
LockDisplay(dpy);
|
||||
GetReq(AppleDRIQueryDirectRenderingCapable, req);
|
||||
req->reqType = info->codes->major_opcode;
|
||||
req->driReqType = X_AppleDRIQueryDirectRenderingCapable;
|
||||
req->screen = screen;
|
||||
if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
TRACE("QueryDirectRenderingCapable... return False");
|
||||
return False;
|
||||
}
|
||||
*isCapable = rep.isCapable;
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
TRACE("QueryDirectRenderingCapable... return True");
|
||||
return True;
|
||||
}
|
||||
|
||||
Bool
|
||||
XAppleDRIAuthConnection(dpy, screen, magic)
|
||||
Display *dpy;
|
||||
int screen;
|
||||
unsigned int magic;
|
||||
{
|
||||
XExtDisplayInfo *info = find_display(dpy);
|
||||
xAppleDRIAuthConnectionReq *req;
|
||||
xAppleDRIAuthConnectionReply rep;
|
||||
|
||||
TRACE("AuthConnection...");
|
||||
AppleDRICheckExtension(dpy, info, False);
|
||||
|
||||
LockDisplay(dpy);
|
||||
GetReq(AppleDRIAuthConnection, req);
|
||||
req->reqType = info->codes->major_opcode;
|
||||
req->driReqType = X_AppleDRIAuthConnection;
|
||||
req->screen = screen;
|
||||
req->magic = magic;
|
||||
rep.authenticated = 0;
|
||||
if (!_XReply(dpy, (xReply *) & rep, 0, xFalse) || !rep.authenticated) {
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
TRACE("AuthConnection... return False");
|
||||
return False;
|
||||
}
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
TRACE("AuthConnection... return True");
|
||||
return True;
|
||||
}
|
||||
|
||||
Bool
|
||||
XAppleDRICreateSurface(dpy, screen, drawable, client_id, key, uid)
|
||||
Display *dpy;
|
||||
int screen;
|
||||
Drawable drawable;
|
||||
unsigned int client_id;
|
||||
unsigned int *key;
|
||||
unsigned int *uid;
|
||||
{
|
||||
XExtDisplayInfo *info = find_display(dpy);
|
||||
xAppleDRICreateSurfaceReply rep;
|
||||
xAppleDRICreateSurfaceReq *req;
|
||||
|
||||
TRACE("CreateSurface...");
|
||||
AppleDRICheckExtension(dpy, info, False);
|
||||
|
||||
LockDisplay(dpy);
|
||||
GetReq(AppleDRICreateSurface, req);
|
||||
req->reqType = info->codes->major_opcode;
|
||||
req->driReqType = X_AppleDRICreateSurface;
|
||||
req->screen = screen;
|
||||
req->drawable = drawable;
|
||||
req->client_id = client_id;
|
||||
rep.key_0 = rep.key_1 = rep.uid = 0;
|
||||
if (!_XReply(dpy, (xReply *) & rep, 0, xFalse) || !rep.key_0) {
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
TRACE("CreateSurface... return False");
|
||||
return False;
|
||||
}
|
||||
key[0] = rep.key_0;
|
||||
key[1] = rep.key_1;
|
||||
*uid = rep.uid;
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
TRACE("CreateSurface... return True");
|
||||
return True;
|
||||
}
|
||||
|
||||
Bool
|
||||
XAppleDRIDestroySurface(dpy, screen, drawable)
|
||||
Display *dpy;
|
||||
int screen;
|
||||
Drawable drawable;
|
||||
{
|
||||
XExtDisplayInfo *info = find_display(dpy);
|
||||
xAppleDRIDestroySurfaceReq *req;
|
||||
|
||||
TRACE("DestroySurface...");
|
||||
AppleDRICheckExtension(dpy, info, False);
|
||||
|
||||
LockDisplay(dpy);
|
||||
GetReq(AppleDRIDestroySurface, req);
|
||||
req->reqType = info->codes->major_opcode;
|
||||
req->driReqType = X_AppleDRIDestroySurface;
|
||||
req->screen = screen;
|
||||
req->drawable = drawable;
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
TRACE("DestroySurface... return True");
|
||||
return True;
|
||||
}
|
||||
|
||||
Bool
|
||||
XAppleDRICreateSharedBuffer(Display * dpy, int screen, Drawable drawable,
|
||||
Bool doubleSwap, char *path, size_t pathlen,
|
||||
int *width, int *height)
|
||||
{
|
||||
XExtDisplayInfo *info = find_display(dpy);
|
||||
xAppleDRICreateSharedBufferReq *req;
|
||||
xAppleDRICreateSharedBufferReply rep;
|
||||
|
||||
AppleDRICheckExtension(dpy, info, False);
|
||||
|
||||
LockDisplay(dpy);
|
||||
GetReq(AppleDRICreateSharedBuffer, req);
|
||||
req->reqType = info->codes->major_opcode;
|
||||
req->driReqType = X_AppleDRICreateSharedBuffer;
|
||||
req->screen = screen;
|
||||
req->drawable = drawable;
|
||||
req->doubleSwap = doubleSwap;
|
||||
|
||||
|
||||
if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
|
||||
puts("REPLY ERROR");
|
||||
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
return False;
|
||||
}
|
||||
|
||||
printf("rep.stringLength %d\n", (int) rep.stringLength);
|
||||
|
||||
if (rep.stringLength > 0 && rep.stringLength <= pathlen) {
|
||||
_XReadPad(dpy, path, rep.stringLength);
|
||||
|
||||
printf("path: %s\n", path);
|
||||
|
||||
*width = rep.width;
|
||||
*height = rep.height;
|
||||
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
return True;
|
||||
}
|
||||
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
|
||||
return False;
|
||||
}
|
||||
|
||||
Bool
|
||||
XAppleDRISwapBuffers(Display * dpy, int screen, Drawable drawable)
|
||||
{
|
||||
XExtDisplayInfo *info = find_display(dpy);
|
||||
xAppleDRISwapBuffersReq *req;
|
||||
|
||||
AppleDRICheckExtension(dpy, info, False);
|
||||
|
||||
LockDisplay(dpy);
|
||||
GetReq(AppleDRISwapBuffers, req);
|
||||
req->reqType = info->codes->major_opcode;
|
||||
req->driReqType = X_AppleDRISwapBuffers;
|
||||
req->screen = screen;
|
||||
req->drawable = drawable;
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
Bool
|
||||
XAppleDRICreatePixmap(Display * dpy, int screen, Drawable drawable,
|
||||
int *width, int *height, int *pitch, int *bpp,
|
||||
size_t * size, char *bufname, size_t bufnamesize)
|
||||
{
|
||||
XExtDisplayInfo *info = find_display(dpy);
|
||||
xAppleDRICreatePixmapReq *req;
|
||||
xAppleDRICreatePixmapReply rep;
|
||||
|
||||
AppleDRICheckExtension(dpy, info, False);
|
||||
|
||||
LockDisplay(dpy);
|
||||
GetReq(AppleDRICreatePixmap, req);
|
||||
req->reqType = info->codes->major_opcode;
|
||||
req->driReqType = X_AppleDRICreatePixmap;
|
||||
req->screen = screen;
|
||||
req->drawable = drawable;
|
||||
|
||||
if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
return False;
|
||||
}
|
||||
|
||||
/*
|
||||
printf("rep.stringLength %d\n", (int) rep.stringLength);
|
||||
*/
|
||||
|
||||
if (rep.stringLength > 0 && rep.stringLength <= bufnamesize) {
|
||||
_XReadPad(dpy, bufname, rep.stringLength);
|
||||
|
||||
printf("path: %s\n", bufname);
|
||||
|
||||
*width = rep.width;
|
||||
*height = rep.height;
|
||||
*pitch = rep.pitch;
|
||||
*bpp = rep.bpp;
|
||||
*size = rep.size;
|
||||
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
return True;
|
||||
}
|
||||
else if (rep.stringLength > 0) {
|
||||
_XEatData(dpy, rep.stringLength);
|
||||
}
|
||||
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
/*
|
||||
* Call it a drawable, because we really don't know what it is
|
||||
* until it reaches the server, and we should keep that in mind.
|
||||
*/
|
||||
Bool
|
||||
XAppleDRIDestroyPixmap(Display * dpy, Pixmap drawable)
|
||||
{
|
||||
XExtDisplayInfo *info = find_display(dpy);
|
||||
xAppleDRIDestroyPixmapReq *req;
|
||||
|
||||
AppleDRICheckExtension(dpy, info, False);
|
||||
|
||||
LockDisplay(dpy);
|
||||
GetReq(AppleDRIDestroyPixmap, req);
|
||||
req->reqType = info->codes->major_opcode;
|
||||
req->driReqType = X_AppleDRIDestroyPixmap;
|
||||
req->drawable = drawable;
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
|
||||
return True;
|
||||
}
|
|
@ -0,0 +1,124 @@
|
|||
/* $XFree86: xc/lib/GL/dri/xf86dri.h,v 1.7 2000/12/07 20:26:02 dawes Exp $ */
|
||||
/**************************************************************************
|
||||
|
||||
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
|
||||
Copyright 2000 VA Linux Systems, Inc.
|
||||
Copyright (c) 2002, 2008, 2009 Apple Computer, Inc.
|
||||
All Rights Reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sub license, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice (including the
|
||||
next paragraph) shall be included in all copies or substantial portions
|
||||
of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
|
||||
IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
|
||||
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
**************************************************************************/
|
||||
|
||||
/*
|
||||
* Authors:
|
||||
* Kevin E. Martin <martin@valinux.com>
|
||||
* Jens Owen <jens@valinux.com>
|
||||
* Rickard E. (Rik) Faith <faith@valinux.com>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _APPLEDRI_H_
|
||||
#define _APPLEDRI_H_
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xfuncproto.h>
|
||||
|
||||
#define X_AppleDRIQueryVersion 0
|
||||
#define X_AppleDRIQueryDirectRenderingCapable 1
|
||||
#define X_AppleDRICreateSurface 2
|
||||
#define X_AppleDRIDestroySurface 3
|
||||
#define X_AppleDRIAuthConnection 4
|
||||
#define X_AppleDRICreateSharedBuffer 5
|
||||
#define X_AppleDRISwapBuffers 6
|
||||
#define X_AppleDRICreatePixmap 7
|
||||
#define X_AppleDRIDestroyPixmap 8
|
||||
|
||||
/* Requests up to and including 18 were used in a previous version */
|
||||
|
||||
/* Events */
|
||||
#define AppleDRIObsoleteEvent1 0
|
||||
#define AppleDRIObsoleteEvent2 1
|
||||
#define AppleDRIObsoleteEvent3 2
|
||||
#define AppleDRISurfaceNotify 3
|
||||
#define AppleDRINumberEvents 4
|
||||
|
||||
/* Errors */
|
||||
#define AppleDRIClientNotLocal 0
|
||||
#define AppleDRIOperationNotSupported 1
|
||||
#define AppleDRINumberErrors (AppleDRIOperationNotSupported + 1)
|
||||
|
||||
/* Kinds of SurfaceNotify events: */
|
||||
#define AppleDRISurfaceNotifyChanged 0
|
||||
#define AppleDRISurfaceNotifyDestroyed 1
|
||||
|
||||
#ifndef _APPLEDRI_SERVER_
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int type; /* of event */
|
||||
unsigned long serial; /* # of last request processed by server */
|
||||
Bool send_event; /* true if this came frome a SendEvent request */
|
||||
Display *display; /* Display the event was read from */
|
||||
Window window; /* window of event */
|
||||
Time time; /* server timestamp when event happened */
|
||||
int kind; /* subtype of event */
|
||||
int arg;
|
||||
} XAppleDRINotifyEvent;
|
||||
|
||||
_XFUNCPROTOBEGIN
|
||||
Bool XAppleDRIQueryExtension(Display * dpy, int *event_base,
|
||||
int *error_base);
|
||||
|
||||
Bool XAppleDRIQueryVersion(Display * dpy, int *majorVersion,
|
||||
int *minorVersion, int *patchVersion);
|
||||
|
||||
Bool XAppleDRIQueryDirectRenderingCapable(Display * dpy, int screen,
|
||||
Bool * isCapable);
|
||||
|
||||
void *XAppleDRISetSurfaceNotifyHandler(void (*fun) (Display * dpy,
|
||||
unsigned uid, int kind));
|
||||
|
||||
Bool XAppleDRIAuthConnection(Display * dpy, int screen, unsigned int magic);
|
||||
|
||||
Bool XAppleDRICreateSurface(Display * dpy, int screen, Drawable drawable,
|
||||
unsigned int client_id, unsigned int key[2],
|
||||
unsigned int *uid);
|
||||
|
||||
Bool XAppleDRIDestroySurface(Display * dpy, int screen, Drawable drawable);
|
||||
|
||||
Bool XAppleDRISynchronizeSurfaces(Display * dpy);
|
||||
|
||||
Bool XAppleDRICreateSharedBuffer(Display * dpy, int screen, Drawable drawable,
|
||||
Bool doubleSwap, char *path, size_t pathlen,
|
||||
int *width, int *height);
|
||||
|
||||
Bool XAppleDRISwapBuffers(Display * dpy, int screen, Drawable drawable);
|
||||
|
||||
Bool XAppleDRICreatePixmap(Display * dpy, int screen, Drawable drawable,
|
||||
int *width, int *height, int *pitch, int *bpp,
|
||||
size_t * size, char *bufname, size_t bufnamesize);
|
||||
|
||||
Bool XAppleDRIDestroyPixmap(Display * dpy, Pixmap pixmap);
|
||||
|
||||
_XFUNCPROTOEND
|
||||
#endif /* _APPLEDRI_SERVER_ */
|
||||
#endif /* _APPLEDRI_H_ */
|
|
@ -0,0 +1,266 @@
|
|||
/**************************************************************************
|
||||
|
||||
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
|
||||
Copyright 2000 VA Linux Systems, Inc.
|
||||
Copyright (c) 2002, 2008, 2009 Apple Computer, Inc.
|
||||
All Rights Reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sub license, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice (including the
|
||||
next paragraph) shall be included in all copies or substantial portions
|
||||
of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
|
||||
IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
|
||||
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
**************************************************************************/
|
||||
|
||||
/*
|
||||
* Authors:
|
||||
* Kevin E. Martin <martin@valinux.com>
|
||||
* Jens Owen <jens@valinux.com>
|
||||
* Rickard E. (Rik) Fiath <faith@valinux.com>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _APPLEDRISTR_H_
|
||||
#define _APPLEDRISTR_H_
|
||||
|
||||
#include "appledri.h"
|
||||
|
||||
#define APPLEDRINAME "Apple-DRI"
|
||||
|
||||
#define APPLE_DRI_MAJOR_VERSION 1 /* current version numbers */
|
||||
#define APPLE_DRI_MINOR_VERSION 0
|
||||
#define APPLE_DRI_PATCH_VERSION 0
|
||||
|
||||
typedef struct _AppleDRIQueryVersion
|
||||
{
|
||||
CARD8 reqType; /* always DRIReqCode */
|
||||
CARD8 driReqType; /* always X_DRIQueryVersion */
|
||||
CARD16 length B16;
|
||||
} xAppleDRIQueryVersionReq;
|
||||
#define sz_xAppleDRIQueryVersionReq 4
|
||||
|
||||
typedef struct
|
||||
{
|
||||
BYTE type; /* X_Reply */
|
||||
BOOL pad1;
|
||||
CARD16 sequenceNumber B16;
|
||||
CARD32 length B32;
|
||||
CARD16 majorVersion B16; /* major version of DRI protocol */
|
||||
CARD16 minorVersion B16; /* minor version of DRI protocol */
|
||||
CARD32 patchVersion B32; /* patch version of DRI protocol */
|
||||
CARD32 pad3 B32;
|
||||
CARD32 pad4 B32;
|
||||
CARD32 pad5 B32;
|
||||
CARD32 pad6 B32;
|
||||
} xAppleDRIQueryVersionReply;
|
||||
#define sz_xAppleDRIQueryVersionReply 32
|
||||
|
||||
typedef struct _AppleDRIQueryDirectRenderingCapable
|
||||
{
|
||||
CARD8 reqType; /* always DRIReqCode */
|
||||
CARD8 driReqType; /* X_DRIQueryDirectRenderingCapable */
|
||||
CARD16 length B16;
|
||||
CARD32 screen B32;
|
||||
} xAppleDRIQueryDirectRenderingCapableReq;
|
||||
#define sz_xAppleDRIQueryDirectRenderingCapableReq 8
|
||||
|
||||
typedef struct
|
||||
{
|
||||
BYTE type; /* X_Reply */
|
||||
BOOL pad1;
|
||||
CARD16 sequenceNumber B16;
|
||||
CARD32 length B32;
|
||||
BOOL isCapable;
|
||||
BOOL pad2;
|
||||
BOOL pad3;
|
||||
BOOL pad4;
|
||||
CARD32 pad5 B32;
|
||||
CARD32 pad6 B32;
|
||||
CARD32 pad7 B32;
|
||||
CARD32 pad8 B32;
|
||||
CARD32 pad9 B32;
|
||||
} xAppleDRIQueryDirectRenderingCapableReply;
|
||||
#define sz_xAppleDRIQueryDirectRenderingCapableReply 32
|
||||
|
||||
typedef struct _AppleDRIAuthConnection
|
||||
{
|
||||
CARD8 reqType; /* always DRIReqCode */
|
||||
CARD8 driReqType; /* always X_DRICloseConnection */
|
||||
CARD16 length B16;
|
||||
CARD32 screen B32;
|
||||
CARD32 magic B32;
|
||||
} xAppleDRIAuthConnectionReq;
|
||||
#define sz_xAppleDRIAuthConnectionReq 12
|
||||
|
||||
typedef struct
|
||||
{
|
||||
BYTE type;
|
||||
BOOL pad1;
|
||||
CARD16 sequenceNumber B16;
|
||||
CARD32 length B32;
|
||||
CARD32 authenticated B32;
|
||||
CARD32 pad2 B32;
|
||||
CARD32 pad3 B32;
|
||||
CARD32 pad4 B32;
|
||||
CARD32 pad5 B32;
|
||||
CARD32 pad6 B32;
|
||||
} xAppleDRIAuthConnectionReply;
|
||||
#define zx_xAppleDRIAuthConnectionReply 32
|
||||
|
||||
typedef struct _AppleDRICreateSurface
|
||||
{
|
||||
CARD8 reqType; /* always DRIReqCode */
|
||||
CARD8 driReqType; /* always X_DRICreateSurface */
|
||||
CARD16 length B16;
|
||||
CARD32 screen B32;
|
||||
CARD32 drawable B32;
|
||||
CARD32 client_id B32;
|
||||
} xAppleDRICreateSurfaceReq;
|
||||
#define sz_xAppleDRICreateSurfaceReq 16
|
||||
|
||||
typedef struct
|
||||
{
|
||||
BYTE type; /* X_Reply */
|
||||
BOOL pad1;
|
||||
CARD16 sequenceNumber B16;
|
||||
CARD32 length B32;
|
||||
CARD32 key_0 B32;
|
||||
CARD32 key_1 B32;
|
||||
CARD32 uid B32;
|
||||
CARD32 pad4 B32;
|
||||
CARD32 pad5 B32;
|
||||
CARD32 pad6 B32;
|
||||
} xAppleDRICreateSurfaceReply;
|
||||
#define sz_xAppleDRICreateSurfaceReply 32
|
||||
|
||||
typedef struct _AppleDRIDestroySurface
|
||||
{
|
||||
CARD8 reqType; /* always DRIReqCode */
|
||||
CARD8 driReqType; /* always X_DRIDestroySurface */
|
||||
CARD16 length B16;
|
||||
CARD32 screen B32;
|
||||
CARD32 drawable B32;
|
||||
} xAppleDRIDestroySurfaceReq;
|
||||
#define sz_xAppleDRIDestroySurfaceReq 12
|
||||
|
||||
typedef struct _AppleDRINotify
|
||||
{
|
||||
BYTE type; /* always eventBase + event type */
|
||||
BYTE kind;
|
||||
CARD16 sequenceNumber B16;
|
||||
CARD32 time B32; /* time of change */
|
||||
CARD32 pad1 B32;
|
||||
CARD32 arg B32;
|
||||
CARD32 pad3 B32;
|
||||
CARD32 pad4 B32;
|
||||
CARD32 pad5 B32;
|
||||
CARD32 pad6 B32;
|
||||
} xAppleDRINotifyEvent;
|
||||
#define sz_xAppleDRINotifyEvent 32
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
CARD8 reqType;
|
||||
CARD8 driReqType;
|
||||
CARD16 length B16;
|
||||
CARD32 screen B32;
|
||||
CARD32 drawable B32;
|
||||
BOOL doubleSwap;
|
||||
CARD8 pad1, pad2, pad3;
|
||||
} xAppleDRICreateSharedBufferReq;
|
||||
|
||||
#define sz_xAppleDRICreateSharedBufferReq 16
|
||||
|
||||
typedef struct
|
||||
{
|
||||
BYTE type;
|
||||
BYTE data1;
|
||||
CARD16 sequenceNumber B16;
|
||||
CARD32 length B32;
|
||||
CARD32 stringLength B32; /* 0 on error */
|
||||
CARD32 width B32;
|
||||
CARD32 height B32;
|
||||
CARD32 pad1 B32;
|
||||
CARD32 pad2 B32;
|
||||
CARD32 pad3 B32;
|
||||
} xAppleDRICreateSharedBufferReply;
|
||||
|
||||
#define sz_xAppleDRICreateSharedBufferReply 32
|
||||
|
||||
typedef struct
|
||||
{
|
||||
CARD8 reqType;
|
||||
CARD8 driReqType;
|
||||
CARD16 length B16;
|
||||
CARD32 screen B32;
|
||||
CARD32 drawable B32;
|
||||
} xAppleDRISwapBuffersReq;
|
||||
|
||||
#define sz_xAppleDRISwapBuffersReq 12
|
||||
|
||||
typedef struct
|
||||
{
|
||||
CARD8 reqType; /*1 */
|
||||
CARD8 driReqType; /*2 */
|
||||
CARD16 length B16; /*4 */
|
||||
CARD32 screen B32; /*8 */
|
||||
CARD32 drawable B32; /*12 */
|
||||
} xAppleDRICreatePixmapReq;
|
||||
|
||||
#define sz_xAppleDRICreatePixmapReq 12
|
||||
|
||||
typedef struct
|
||||
{
|
||||
BYTE type; /*1 */
|
||||
BOOL pad1; /*2 */
|
||||
CARD16 sequenceNumber B16; /*4 */
|
||||
CARD32 length B32; /*8 */
|
||||
CARD32 width B32; /*12 */
|
||||
CARD32 height B32; /*16 */
|
||||
CARD32 pitch B32; /*20 */
|
||||
CARD32 bpp B32; /*24 */
|
||||
CARD32 size B32; /*28 */
|
||||
CARD32 stringLength B32; /*32 */
|
||||
} xAppleDRICreatePixmapReply;
|
||||
|
||||
#define sz_xAppleDRICreatePixmapReply 32
|
||||
|
||||
typedef struct
|
||||
{
|
||||
CARD8 reqType; /*1 */
|
||||
CARD8 driReqType; /*2 */
|
||||
CARD16 length B16; /*4 */
|
||||
CARD32 drawable B32; /*8 */
|
||||
} xAppleDRIDestroyPixmapReq;
|
||||
|
||||
#define sz_xAppleDRIDestroyPixmapReq 8
|
||||
|
||||
#ifdef _APPLEDRI_SERVER_
|
||||
|
||||
void AppleDRISendEvent(
|
||||
#if NeedFunctionPrototypes
|
||||
int /* type */ ,
|
||||
unsigned int /* mask */ ,
|
||||
int /* which */ ,
|
||||
int /* arg */
|
||||
#endif
|
||||
);
|
||||
|
||||
#endif /* _APPLEDRI_SERVER_ */
|
||||
#endif /* _APPLEDRISTR_H_ */
|
|
@ -0,0 +1,86 @@
|
|||
|
||||
package require Tcl 8.5
|
||||
|
||||
set license {
|
||||
/*
|
||||
Copyright (c) 2008, 2009 Apple Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation files
|
||||
(the "Software"), to deal in the Software without restriction,
|
||||
including without limitation the rights to use, copy, modify, merge,
|
||||
publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT
|
||||
HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name(s) of the above
|
||||
copyright holders shall not be used in advertising or otherwise to
|
||||
promote the sale, use or other dealings in this Software without
|
||||
prior written authorization.
|
||||
*/
|
||||
}
|
||||
|
||||
set this_script [info script]
|
||||
|
||||
proc main {argc argv} {
|
||||
if {2 != $argc} {
|
||||
puts stderr "syntax is: [set ::this_script] serialized-array-file output.h"
|
||||
return 1
|
||||
}
|
||||
|
||||
set fd [open [lindex $argv 0] r]
|
||||
array set api [read $fd]
|
||||
close $fd
|
||||
|
||||
set fd [open [lindex $argv 1] w]
|
||||
|
||||
puts $fd "/* This file was automatically generated by [set ::this_script]. */"
|
||||
puts $fd $::license
|
||||
|
||||
puts $fd "
|
||||
#ifndef APPLE_XGL_API_H
|
||||
#define APPLE_XGL_API_H
|
||||
"
|
||||
|
||||
puts $fd "struct apple_xgl_api \{"
|
||||
|
||||
set sorted [lsort -dictionary [array names api]]
|
||||
|
||||
foreach f $sorted {
|
||||
set attr $api($f)
|
||||
set pstr ""
|
||||
|
||||
if {[dict exists $attr alias_for] || [dict exists $attr noop]} {
|
||||
#Skip this function.
|
||||
continue
|
||||
}
|
||||
|
||||
foreach p [dict get $attr parameters] {
|
||||
append pstr "[lindex $p 0] [lindex $p 1], "
|
||||
}
|
||||
|
||||
set pstr [string trimright $pstr ", "]
|
||||
puts $fd "\t[dict get $attr return] (*[set f])([set pstr]);"
|
||||
}
|
||||
|
||||
puts $fd "\};"
|
||||
puts $fd "void apple_xgl_init_direct(void);
|
||||
|
||||
#endif /*APPLE_XGL_API_H*/
|
||||
"
|
||||
|
||||
return 0
|
||||
}
|
||||
exit [main $::argc $::argv]
|
|
@ -0,0 +1,212 @@
|
|||
package require Tcl 8.5
|
||||
|
||||
set license {
|
||||
/*
|
||||
Copyright (c) 2008, 2009 Apple Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation files
|
||||
(the "Software"), to deal in the Software without restriction,
|
||||
including without limitation the rights to use, copy, modify, merge,
|
||||
publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT
|
||||
HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name(s) of the above
|
||||
copyright holders shall not be used in advertising or otherwise to
|
||||
promote the sale, use or other dealings in this Software without
|
||||
prior written authorization.
|
||||
*/
|
||||
}
|
||||
|
||||
set gl_license {
|
||||
/*
|
||||
** License Applicability. Except to the extent portions of this file are
|
||||
** made subject to an alternative license as permitted in the SGI Free
|
||||
** Software License B, Version 1.1 (the "License"), the contents of this
|
||||
** file are subject only to the provisions of the License. You may not use
|
||||
** this file except in compliance with the License. You may obtain a copy
|
||||
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
|
||||
** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
|
||||
**
|
||||
** http://oss.sgi.com/projects/FreeB
|
||||
**
|
||||
** Note that, as provided in the License, the Software is distributed on an
|
||||
** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
|
||||
** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
|
||||
** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
|
||||
** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
|
||||
**
|
||||
** Original Code. The Original Code is: OpenGL Sample Implementation,
|
||||
** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
|
||||
** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
|
||||
** Copyright in any portions created by third parties is as indicated
|
||||
** elsewhere herein. All Rights Reserved.
|
||||
**
|
||||
** Additional Notice Provisions: This software was created using the
|
||||
** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has
|
||||
** not been independently verified as being compliant with the OpenGL(R)
|
||||
** version 1.2.1 Specification.
|
||||
*/
|
||||
}
|
||||
|
||||
set init_code {
|
||||
static void *glsym(void *handle, const char *name) {
|
||||
void *sym = dlsym(handle, name);
|
||||
|
||||
if(NULL == sym) {
|
||||
fprintf(stderr, "Error: symbol not found: '%s'. "
|
||||
"Error information: %s\n",
|
||||
name, dlerror());
|
||||
abort();
|
||||
}
|
||||
|
||||
return sym;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
set dlopen_code {
|
||||
#ifndef LIBGLNAME
|
||||
#define LIBGLNAME "/System/Library/Frameworks/OpenGL.framework/Libraries/libGL.dylib"
|
||||
#endif LIBGLNAME
|
||||
|
||||
(void)dlerror(); /*drain dlerror()*/
|
||||
|
||||
handle = dlopen(LIBGLNAME, RTLD_LAZY);
|
||||
|
||||
if(NULL == handle) {
|
||||
fprintf(stderr, "error: unable to dlopen "
|
||||
LIBGLNAME " :" "%s\n", dlerror());
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
set this_script [info script]
|
||||
|
||||
proc main {argc argv} {
|
||||
if {2 != $argc} {
|
||||
puts stderr "syntax is: [set ::this_script] serialized-array-file output.c"
|
||||
return 1
|
||||
}
|
||||
|
||||
|
||||
set fd [open [lindex $argv 0] r]
|
||||
array set api [read $fd]
|
||||
close $fd
|
||||
|
||||
set fd [open [lindex $argv 1] w]
|
||||
|
||||
puts $fd "/* This file was automatically generated by [set ::this_script]. */"
|
||||
puts $fd $::license
|
||||
|
||||
puts $fd {
|
||||
#define GL_GLEXT_PROTOTYPES
|
||||
#include <GL/gl.h>
|
||||
#include <dlfcn.h>
|
||||
#include "glxclient.h"
|
||||
#include "apple_xgl_api.h"
|
||||
#include "apple_glx_context.h"
|
||||
}
|
||||
|
||||
puts $fd "struct apple_xgl_api __gl_api;"
|
||||
|
||||
set sorted [lsort -dictionary [array names api]]
|
||||
|
||||
set exclude [list DrawBuffer DrawBuffers DrawBuffersARB]
|
||||
|
||||
#These are special to glXMakeContextCurrent.
|
||||
#See also: apple_xgl_api_read.c.
|
||||
lappend exclude ReadPixels CopyPixels CopyColorTable
|
||||
|
||||
#This is excluded to work with surface updates.
|
||||
lappend exclude Viewport
|
||||
|
||||
foreach f $sorted {
|
||||
if {$f in $exclude} {
|
||||
continue
|
||||
}
|
||||
|
||||
set attr $api($f)
|
||||
|
||||
set pstr ""
|
||||
|
||||
foreach p [dict get $attr parameters] {
|
||||
append pstr "[lindex $p 0] [lindex $p 1], "
|
||||
}
|
||||
|
||||
set pstr [string trimright $pstr ", "]
|
||||
|
||||
if {![string length $pstr]} {
|
||||
set pstr void
|
||||
}
|
||||
|
||||
set callvars ""
|
||||
|
||||
foreach p [dict get $attr parameters] {
|
||||
append callvars "[lindex $p end], "
|
||||
}
|
||||
|
||||
set callvars [string trimright $callvars ", "]
|
||||
|
||||
set return ""
|
||||
if {"void" ne [dict get $attr return]} {
|
||||
set return "return "
|
||||
}
|
||||
|
||||
if {[dict exists $attr noop]} {
|
||||
if {"void" eq [dict get $attr return]} {
|
||||
set body "/*noop*/"
|
||||
} else {
|
||||
set body "return 0; /*noop*/"
|
||||
}
|
||||
} elseif {[dict exists $attr alias_for]} {
|
||||
set alias [dict get $attr alias_for]
|
||||
set body "[set return] gl[set alias]([set callvars]);"
|
||||
} else {
|
||||
set body "[set return]__gl_api.[set f]([set callvars]);"
|
||||
}
|
||||
|
||||
puts $fd "GLAPI [dict get $attr return] APIENTRY gl[set f]([set pstr]) \{\n\t$body\n\}"
|
||||
}
|
||||
|
||||
puts $fd $::init_code
|
||||
|
||||
puts $fd "void apple_xgl_init_direct(void) \{"
|
||||
puts $fd "\tvoid *handle;"
|
||||
|
||||
puts $fd $::dlopen_code
|
||||
|
||||
foreach f $sorted {
|
||||
set attr $api($f)
|
||||
|
||||
puts $attr
|
||||
puts $f
|
||||
|
||||
if {[dict exists $attr alias_for] || [dict exists $attr noop]} {
|
||||
#Function f is an alias_for another, so we shouldn't try
|
||||
#to load it.
|
||||
continue
|
||||
}
|
||||
|
||||
puts $fd "\t__gl_api.$f = glsym(handle, \"gl$f\");"
|
||||
}
|
||||
|
||||
puts $fd "\}\n"
|
||||
close $fd
|
||||
|
||||
return 0
|
||||
}
|
||||
exit [main $::argc $::argv]
|
|
@ -0,0 +1,50 @@
|
|||
if 0 {
|
||||
Copyright (c) 2008 Apple Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation files
|
||||
(the "Software"), to deal in the Software without restriction,
|
||||
including without limitation the rights to use, copy, modify, merge,
|
||||
publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT
|
||||
HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name(s) of the above
|
||||
copyright holders shall not be used in advertising or otherwise to
|
||||
promote the sale, use or other dealings in this Software without
|
||||
prior written authorization.
|
||||
}
|
||||
|
||||
package require Tcl 8.5
|
||||
|
||||
proc main {} {
|
||||
set tclsh [info nameofexecutable]
|
||||
|
||||
puts TYPES
|
||||
exec $tclsh ./gen_types.tcl stage.1
|
||||
puts DEFS
|
||||
exec $tclsh ./gen_defs.tcl specs/enum.spec stage.2
|
||||
puts FUNCS
|
||||
exec $tclsh ./gen_funcs.tcl specs/gl.spec stage.3 stage.4
|
||||
puts HEADER
|
||||
exec $tclsh ./gen_api_header.tcl stage.4 apple_xgl_api.h
|
||||
puts "C API"
|
||||
exec $tclsh ./gen_api_library.tcl stage.4 apple_xgl_api.c
|
||||
puts "EXPORTS"
|
||||
exec $tclsh ./gen_exports.tcl stage.4 exports.list
|
||||
|
||||
return 0
|
||||
}
|
||||
exit [main]
|
|
@ -0,0 +1,67 @@
|
|||
#This parses and generates #defines from an enum.spec type of file.
|
||||
|
||||
proc main {argc argv} {
|
||||
if {2 != $argc} {
|
||||
puts stderr "syntax is: [info script] input.spec output.h"
|
||||
exit 1
|
||||
}
|
||||
|
||||
set fd [open [lindex $argv 0] r]
|
||||
set data [read $fd]
|
||||
close $fd
|
||||
|
||||
set fd [open [lindex $argv 1] w]
|
||||
|
||||
set state ""
|
||||
|
||||
puts $fd "#define GL_VERSION_1_1 1"
|
||||
puts $fd "#define GL_VERSION_1_2 1"
|
||||
puts $fd "#define GL_VERSION_1_3 1"
|
||||
puts $fd "#define GL_VERSION_1_4 1"
|
||||
puts $fd "#define GL_VERSION_1_5 1"
|
||||
puts $fd "#define GL_VERSION_2_0 1"
|
||||
#puts $fd "#define GL_VERSION_3_0 1"
|
||||
|
||||
set mask ""
|
||||
array set ar {}
|
||||
|
||||
foreach line [split $data \n] {
|
||||
if {[regexp {^\S*#.*} $line] > 0} {
|
||||
#puts COMMENT:$line
|
||||
set state ""
|
||||
} elseif {"enum" eq $state} {
|
||||
if {[string match "\t*" $line]} {
|
||||
if {[regexp {^\tuse.*} $line] > 0} {
|
||||
lassign [split [string trim $line]] use usemask def
|
||||
set usemask [string trim $usemask]
|
||||
set def [string trim $def]
|
||||
puts $fd "/* GL_$def */"
|
||||
} else {
|
||||
lassign [split [string trim $line] =] def value
|
||||
set def [string trim $def]
|
||||
set value [string trim $value]
|
||||
|
||||
#Trim out the data like: 0x0B00 # 4 F
|
||||
set value [lindex [split $value] 0]
|
||||
|
||||
puts $fd "#define GL_$def $value"
|
||||
|
||||
#Save this association with the value.
|
||||
set d $ar($mask)
|
||||
dict set d $def $value
|
||||
set ar($mask) $d
|
||||
}
|
||||
} else {
|
||||
set state ""
|
||||
}
|
||||
} elseif {[string match "* enum:*" $line]} {
|
||||
lassign [split $line] mask _
|
||||
puts $fd "\n/*[string trim $mask]*/"
|
||||
set ar($mask) [dict create]
|
||||
set state enum
|
||||
}
|
||||
}
|
||||
|
||||
close $fd
|
||||
}
|
||||
main $::argc $::argv
|
|
@ -0,0 +1,132 @@
|
|||
if 0 {
|
||||
Copyright (c) 2008, 2009 Apple Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation files
|
||||
(the "Software"), to deal in the Software without restriction,
|
||||
including without limitation the rights to use, copy, modify, merge,
|
||||
publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT
|
||||
HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name(s) of the above
|
||||
copyright holders shall not be used in advertising or otherwise to
|
||||
promote the sale, use or other dealings in this Software without
|
||||
prior written authorization.
|
||||
}
|
||||
|
||||
package require Tcl 8.5
|
||||
|
||||
proc main {argc argv} {
|
||||
if {2 != $argc} {
|
||||
puts stderr "syntax is: [info script] serialized-array-file export.list"
|
||||
return 1
|
||||
}
|
||||
|
||||
set fd [open [lindex $argv 0] r]
|
||||
array set api [read $fd]
|
||||
close $fd
|
||||
|
||||
#Start with 1.0
|
||||
set glxlist [list \
|
||||
glXChooseVisual glXCreateContext glXDestroyContext \
|
||||
glXMakeCurrent glXCopyContext glXSwapBuffers \
|
||||
glXCreateGLXPixmap glXDestroyGLXPixmap \
|
||||
glXQueryExtension glXQueryVersion \
|
||||
glXIsDirect glXGetConfig \
|
||||
glXGetCurrentContext glXGetCurrentDrawable \
|
||||
glXWaitGL glXWaitX glXUseXFont]
|
||||
|
||||
#GLX 1.1 and later
|
||||
lappend glxlist glXQueryExtensionsString glXQueryServerString \
|
||||
glXGetClientString
|
||||
|
||||
#GLX 1.2 and later
|
||||
lappend glxlist glXGetCurrentDisplay
|
||||
|
||||
#GLX 1.3 and later
|
||||
lappend glxlist glXChooseFBConfig glXGetFBConfigAttrib \
|
||||
glXGetFBConfigs glXGetVisualFromFBConfig \
|
||||
glXCreateWindow glXDestroyWindow \
|
||||
glXCreatePixmap glXDestroyPixmap \
|
||||
glXCreatePbuffer glXDestroyPbuffer \
|
||||
glXQueryDrawable glXCreateNewContext \
|
||||
glXMakeContextCurrent glXGetCurrentReadDrawable \
|
||||
glXQueryContext glXSelectEvent glXGetSelectedEvent
|
||||
|
||||
#GLX 1.4 and later
|
||||
lappend glxlist glXGetProcAddress
|
||||
|
||||
#Extensions
|
||||
lappend glxlist glXGetProcAddressARB
|
||||
|
||||
#Old extensions we don't support and never really have, but need for
|
||||
#symbol compatibility. See also: glx_empty.c
|
||||
lappend glxlist glXSwapIntervalSGI glXSwapIntervalMESA \
|
||||
glXGetSwapIntervalMESA glXBeginFrameTrackingMESA \
|
||||
glXEndFrameTrackingMESA glXGetFrameUsageMESA \
|
||||
glXQueryFrameTrackingMESA glXGetVideoSyncSGI \
|
||||
glXWaitVideoSyncSGI glXJoinSwapGroupSGIX \
|
||||
glXBindSwapBarrierSGIX glXQueryMaxSwapBarriersSGIX \
|
||||
glXGetSyncValuesOML glXSwapBuffersMscOML \
|
||||
glXWaitForMscOML glXWaitForSbcOML \
|
||||
glXAllocateMemoryMESA glXFreeMemoryMESA \
|
||||
glXGetMemoryOffsetMESA glXReleaseBuffersMESA \
|
||||
glXCreateGLXPixmapMESA glXCopySubBufferMESA \
|
||||
glXQueryGLXPbufferSGIX glXCreateGLXPbufferSGIX \
|
||||
glXDestroyGLXPbufferSGIX glXSelectEventSGIX \
|
||||
glXGetSelectedEventSGIX
|
||||
|
||||
#These are for GLX_SGIX_fbconfig, which isn't implemented, because
|
||||
#we have the GLX 1.3 GLXFBConfig functions which are in the standard spec.
|
||||
#It should be possible to support these to some extent.
|
||||
#The old libGL somewhat supported the GLXFBConfigSGIX code, but lacked
|
||||
#pbuffer, and pixmap support.
|
||||
#We mainly just need these stubs for linking with apps, because for
|
||||
#some reason the OpenGL site suggests using the latest glxext.h,
|
||||
#and glxext.h defines all GLX extensions, which doesn't seem right for
|
||||
#compile-time capability detection.
|
||||
#See also: http://www.mesa3d.org/brianp/sig97/exten.htm#Compile
|
||||
#which conflicts with: the ABI registry from what I saw on opengl.org.
|
||||
#By disabling some of the #defines in glxext.h we break some software,
|
||||
#and by enabling them without the symbols we break others (in Mesa).
|
||||
#I think a lot of OpenGL-based programs have issues one way or another.
|
||||
#It seems that even Mesa developers are confused on this issue, because
|
||||
#Mesa-7.3/progs/xdemos/glxgears_fbconfig.c has comments about breakage
|
||||
#in some comments.
|
||||
lappend glxlist glXGetFBConfigAttribSGIX \
|
||||
glXChooseFBConfigSGIX \
|
||||
glXGetVisualFromFBConfigSGIX \
|
||||
glXCreateGLXPixmapWithConfigSGIX \
|
||||
glXCreateContextWithConfigSGIX \
|
||||
glXGetFBConfigFromVisualSGIX
|
||||
|
||||
|
||||
set fd [open [lindex $argv 1] w]
|
||||
|
||||
foreach f [lsort -dictionary [array names api]] {
|
||||
puts $fd _gl$f
|
||||
}
|
||||
|
||||
foreach f [lsort -dictionary $glxlist] {
|
||||
puts $fd _$f
|
||||
}
|
||||
|
||||
close $fd
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
exit [main $::argc $::argv]
|
|
@ -0,0 +1,635 @@
|
|||
package require Tcl 8.5
|
||||
|
||||
#input is specs/gl.spec
|
||||
|
||||
set license {
|
||||
/*
|
||||
Copyright (c) 2008, 2009 Apple Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation files
|
||||
(the "Software"), to deal in the Software without restriction,
|
||||
including without limitation the rights to use, copy, modify, merge,
|
||||
publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT
|
||||
HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name(s) of the above
|
||||
copyright holders shall not be used in advertising or otherwise to
|
||||
promote the sale, use or other dealings in this Software without
|
||||
prior written authorization.
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
proc extension name {
|
||||
global extensions
|
||||
|
||||
set extensions($name) 1
|
||||
}
|
||||
|
||||
proc alias {from to} {
|
||||
global aliases
|
||||
|
||||
set aliases($from) $to
|
||||
}
|
||||
|
||||
proc promoted name {
|
||||
global promoted
|
||||
|
||||
set promoted($name) 1
|
||||
}
|
||||
|
||||
proc noop name {
|
||||
global noop
|
||||
|
||||
set noop($name) 1
|
||||
}
|
||||
|
||||
set dir [file dirname [info script]]
|
||||
|
||||
source [file join $dir GL_extensions]
|
||||
source [file join $dir GL_aliases]
|
||||
source [file join $dir GL_promoted]
|
||||
source [file join $dir GL_noop]
|
||||
|
||||
proc is-extension-supported? name {
|
||||
global extensions
|
||||
|
||||
return [info exists extensions($name)]
|
||||
}
|
||||
|
||||
#This is going to need to be updated for OpenGL >= 2.1 in SnowLeopard.
|
||||
array set typemap {
|
||||
void void
|
||||
List GLuint
|
||||
Mode GLenum
|
||||
CheckedFloat32 GLfloat
|
||||
CheckedInt32 GLint
|
||||
Float32 GLfloat
|
||||
Int32 GLint
|
||||
Int64 GLint64EXT
|
||||
UInt64 GLuint64EXT
|
||||
Float64 GLdouble
|
||||
ListMode GLuint
|
||||
SizeI GLsizei
|
||||
ListNameType GLenum
|
||||
Void void
|
||||
BeginMode GLenum
|
||||
CoordF GLfloat
|
||||
UInt8 GLubyte
|
||||
Boolean GLboolean
|
||||
ColorIndexValueD GLdouble
|
||||
ColorB GLbyte
|
||||
ColorD GLdouble
|
||||
ColorF GLfloat
|
||||
ColorI GLint
|
||||
ColorS GLshort
|
||||
ColorUB GLubyte
|
||||
ColorUI GLuint
|
||||
ColorUS GLushort
|
||||
ColorIndexValueF GLfloat
|
||||
ColorIndexValueI GLint
|
||||
ColorIndexValueS GLshort
|
||||
Int8 GLbyte
|
||||
CoordD GLdouble
|
||||
Int16 GLshort
|
||||
CoordI GLint
|
||||
CoordS GLshort
|
||||
ClipPlaneName GLenum
|
||||
MaterialFace GLenum
|
||||
ColorMaterialParameter GLenum
|
||||
CullFaceMode GLenum
|
||||
FogParameter GLenum
|
||||
FrontFaceDirection GLenum
|
||||
HintTarget GLenum
|
||||
HintMode GLenum
|
||||
LightName GLenum
|
||||
LightParameter GLenum
|
||||
LightModelParameter GLenum
|
||||
LineStipple GLushort
|
||||
MaterialParameter GLenum
|
||||
PolygonMode GLenum
|
||||
WinCoord GLint
|
||||
ShadingModel GLenum
|
||||
TextureTarget GLenum
|
||||
TextureParameterName GLenum
|
||||
TextureComponentCount GLenum
|
||||
PixelFormat GLenum
|
||||
PixelType GLenum
|
||||
TextureEnvTarget GLenum
|
||||
TextureEnvParameter GLenum
|
||||
TextureCoordName GLenum
|
||||
TextureGenParameter GLenum
|
||||
FeedbackType GLenum
|
||||
FeedbackElement GLfloat
|
||||
SelectName GLuint
|
||||
RenderingMode GLenum
|
||||
DrawBufferMode GLenum
|
||||
ClearBufferMask GLbitfield
|
||||
MaskedColorIndexValueF GLfloat
|
||||
ClampedColorF GLclampf
|
||||
StencilValue GLint
|
||||
ClampedFloat64 GLclampd
|
||||
MaskedStencilValue GLuint
|
||||
MaskedColorIndexValueI GLuint
|
||||
AccumOp GLenum
|
||||
EnableCap GLenum
|
||||
AttribMask GLbitfield
|
||||
MapTarget GLenum
|
||||
MeshMode1 GLenum
|
||||
MeshMode2 GLenum
|
||||
AlphaFunction GLenum
|
||||
ClampedFloat32 GLclampf
|
||||
BlendingFactorSrc GLenum
|
||||
BlendingFactorDest GLenum
|
||||
LogicOp GLenum
|
||||
StencilFunction GLenum
|
||||
ClampedStencilValue GLint
|
||||
MaskedStencilValue GLuint
|
||||
StencilOp GLenum
|
||||
DepthFunction GLenum
|
||||
PixelTransferParameter GLenum
|
||||
PixelStoreParameter GLenum
|
||||
PixelMap GLenum
|
||||
UInt32 GLuint
|
||||
UInt16 GLushort
|
||||
ReadBufferMode GLenum
|
||||
PixelCopyType GLenum
|
||||
GetPName GLenum
|
||||
ErrorCode GLenum
|
||||
GetMapQuery GLenum
|
||||
String "const GLubyte *"
|
||||
StringName GLenum
|
||||
GetTextureParameter GLenum
|
||||
MatrixMode GLenum
|
||||
ColorPointerType GLenum
|
||||
DrawElementsType GLenum
|
||||
GetPointervPName GLenum
|
||||
VoidPointer "void *"
|
||||
IndexPointerType GLenum
|
||||
InterleavedArrayFormat GLenum
|
||||
NormalPointerType GLenum
|
||||
TexCoordPointerType GLenum
|
||||
VertexPointerType GLenum
|
||||
PixelInternalFormat GLenum
|
||||
Texture GLuint
|
||||
ColorIndexValueUB GLubyte
|
||||
ClientAttribMask GLbitfield
|
||||
BlendEquationMode GLenum
|
||||
ColorTableTarget GLenum
|
||||
ColorTableParameterPName GLenum
|
||||
GetColorTableParameterPName GLenum
|
||||
ConvolutionTarget GLenum
|
||||
ConvolutionParameter GLenum
|
||||
GetConvolutionParameterPName GLenum
|
||||
SeparableTarget GLenum
|
||||
HistogramTarget GLenum
|
||||
GetHistogramParameterPName GLenum
|
||||
MinmaxTarget GLenum
|
||||
GetMinmaxParameterPName GLenum
|
||||
TextureTarget GLenum
|
||||
TextureUnit GLenum
|
||||
CompressedTextureARB "void"
|
||||
BlendFuncSeparateParameterEXT GLenum
|
||||
FogPointerTypeEXT GLenum
|
||||
PointParameterNameARB GLenum
|
||||
GLenum GLenum
|
||||
BufferTargetARB GLenum
|
||||
ConstUInt32 "const GLuint"
|
||||
BufferSize GLsizeiptr
|
||||
ConstVoid "const GLvoid"
|
||||
BufferUsageARB GLenum
|
||||
BufferOffset GLintptr
|
||||
BufferAccessARB GLenum
|
||||
BufferPNameARB GLenum
|
||||
BufferPointerNameARB GLenum
|
||||
BlendEquationModeEXT GLenum
|
||||
DrawBufferModeATI GLenum
|
||||
StencilFaceDirection GLenum
|
||||
Char GLchar
|
||||
VertexAttribPropertyARB GLenum
|
||||
VertexAttribPointerPropertyARB GLenum
|
||||
CharPointer "GLchar *"
|
||||
VertexAttribPointerTypeARB GLenum
|
||||
ClampColorTargetARB unknown3.0
|
||||
ClampColorModeARB unknown3.0
|
||||
VertexAttribEnum GLenum
|
||||
VertexAttribEnumNV GLenum
|
||||
DrawBufferName unknown3.0
|
||||
WeightPointerTypeARB GLenum
|
||||
ProgramTargetARB GLenum
|
||||
ProgramFormatARB GLenum
|
||||
ProgramStringPropertyARB GLenum
|
||||
BufferSizeARB GLsizeiptrARB
|
||||
BufferOffsetARB GLintptrARB
|
||||
handleARB GLhandleARB
|
||||
charPointerARB "GLcharARB *"
|
||||
charARB GLcharARB
|
||||
RenderbufferTarget GLenum
|
||||
FramebufferTarget GLenum
|
||||
FramebufferAttachment GLenum
|
||||
BinormalPointerTypeEXT GLenum
|
||||
HintTargetPGI GLenum
|
||||
ProgramParameterPName GLenum
|
||||
ProgramPropertyARB GLenum
|
||||
ElementPointerTypeATI GLenum
|
||||
FenceNV GLuint
|
||||
FenceConditionNV GLenum
|
||||
ObjectTypeAPPLE GLenum
|
||||
VertexArrayPNameAPPLE GLenum
|
||||
SeparableTargetEXT GLenum
|
||||
ColorTableTargetSGI GLenum
|
||||
ColorTableParameterPNameSGI GLenum
|
||||
CombinerOutputNV GLenum
|
||||
CombinerStageNV GLenum
|
||||
CombinerPortionNV GLenum
|
||||
CombinerRegisterNV GLenum
|
||||
CombinerScaleNV GLenum
|
||||
CombinerBiasNV GLenum
|
||||
CombinerComponentUsageNV GLenum
|
||||
CombinerMappingNV GLenum
|
||||
CombinerParameterNV GLenum
|
||||
CombinerVariableNV GLenum
|
||||
ConvolutionParameterEXT GLenum
|
||||
ConvolutionTargetEXT GLenum
|
||||
CullParameterEXT GLenum
|
||||
FenceParameterNameNV GLenum
|
||||
FragmentLightModelParameterSGIX GLenum
|
||||
FragmentLightNameSGIX GLenum
|
||||
FragmentLightParameterSGIX GLenum
|
||||
GetColorTableParameterPNameSGI GLenum
|
||||
GetHistogramParameterPNameEXT GLenum
|
||||
GetMinmaxParameterPNameEXT GLenum
|
||||
HistogramTargetEXT GLenum
|
||||
LightEnvParameterSGIX GLenum
|
||||
MinmaxTargetEXT GLenum
|
||||
PNTrianglesPNameATI GLenum
|
||||
ProgramCharacterNV GLubyte
|
||||
SamplePatternEXT GLenum
|
||||
SamplePatternSGIS GLenum
|
||||
TypeEnum GLenum
|
||||
}
|
||||
|
||||
proc psplit s {
|
||||
set r [list]
|
||||
set token ""
|
||||
|
||||
foreach c [split $s ""] {
|
||||
if {[string is space -strict $c]} {
|
||||
if {[string length $token]} {
|
||||
lappend r $token
|
||||
}
|
||||
set token ""
|
||||
} else {
|
||||
append token $c
|
||||
}
|
||||
}
|
||||
|
||||
if {[string length $token]} {
|
||||
lappend r $token
|
||||
}
|
||||
|
||||
return $r
|
||||
}
|
||||
|
||||
proc is-extension? str {
|
||||
#Check if the trailing name of the function is NV, or EXT, and so on.
|
||||
|
||||
if {[string is upper [string index $str end]]
|
||||
&& [string is upper [string index $str end-1]]} {
|
||||
return 1
|
||||
}
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
proc parse {data arvar} {
|
||||
upvar 1 $arvar ar
|
||||
|
||||
set state ""
|
||||
set name ""
|
||||
|
||||
foreach line [split $data \n] {
|
||||
if {"attr" eq $state} {
|
||||
if {[string match "\t*" $line]} {
|
||||
set plist [psplit [lindex [split $line "#"] 0]]
|
||||
#puts PLIST:$plist
|
||||
set master $ar($name)
|
||||
set param [dict get $master parameters]
|
||||
|
||||
switch -- [llength $plist] {
|
||||
1 {
|
||||
dict set master [lindex $plist 0] ""
|
||||
}
|
||||
|
||||
2 {
|
||||
#standard key, value pair
|
||||
set key [lindex $plist 0]
|
||||
set value [lindex $plist 1]
|
||||
|
||||
dict set master $key $value
|
||||
}
|
||||
|
||||
default {
|
||||
set key [lindex $plist 0]
|
||||
|
||||
#puts PLIST:$plist
|
||||
|
||||
if {"param" eq $key} {
|
||||
lappend param [list [lindex $plist 1] [lindex $plist 2] [lindex $plist 3] [lindex $plist 4]]
|
||||
} else {
|
||||
dict set master $key [lrange $plist 1 end]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dict set master parameters $param
|
||||
|
||||
set ar($name) $master
|
||||
} else {
|
||||
set state ""
|
||||
}
|
||||
} elseif {[regexp {^([A-Z_a-z0-9]+)\((.*)\)\S*} $line all name argv] > 0} {
|
||||
#puts "MATCH:$name ARGV:$argv"
|
||||
|
||||
#Trim the spaces in the elements.
|
||||
set newargv [list]
|
||||
foreach a [split $argv ,] {
|
||||
lappend newargv [string trim $a]
|
||||
}
|
||||
|
||||
|
||||
set d [dict create name $name arguments $newargv \
|
||||
parameters [dict create]]
|
||||
set ar($name) $d
|
||||
set state attr
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#This returns true if the category is valid for an extension.
|
||||
proc is-valid-category? c {
|
||||
set clist [list display-list drawing drawing-control feedback framebuf misc modeling pixel-op pixel-rw state-req xform VERSION_1_0 VERSION_1_0_DEPRECATED VERSION_1_1 VERSION_1_1_DEPRECATED VERSION_1_2 VERSION_1_2_DEPRECATED VERSION_1_3 VERSION_1_3_DEPRECATED VERSION_1_4 VERSION_1_4_DEPRECATED VERSION_1_5 VERSION_2_0 VERSION_2_1 VERSION_3_0 VERSION_3_0_DEPRECATED VERSION_3_1 VERSION_3_2]
|
||||
|
||||
set result [expr {$c in $clist}]
|
||||
|
||||
|
||||
if {!$result} {
|
||||
set result [is-extension-supported? $c]
|
||||
}
|
||||
|
||||
return $result
|
||||
}
|
||||
|
||||
proc translate-parameters {func parameters} {
|
||||
global typemap
|
||||
|
||||
set newparams [list]
|
||||
|
||||
foreach p $parameters {
|
||||
set var [lindex $p 0]
|
||||
|
||||
set ptype [lindex $p 1]
|
||||
|
||||
if {![info exists typemap($ptype)]} {
|
||||
set ::missingTypes($ptype) $func
|
||||
continue
|
||||
}
|
||||
|
||||
set type $typemap($ptype)
|
||||
|
||||
#In the gl.spec file is MultiDrawArrays first and count
|
||||
#are really 'in' so we make them const.
|
||||
#The gl.spec notes this problem.
|
||||
if {("MultiDrawArrays" eq $func) && ("first" eq $var)} {
|
||||
set final_type "const $type *"
|
||||
} elseif {("MultiDrawArrays" eq $func) && ("count" eq $var)} {
|
||||
set final_type "const $type *"
|
||||
} elseif {"array" eq [lindex $p 3]} {
|
||||
if {"in" eq [lindex $p 2]} {
|
||||
set final_type "const $type *"
|
||||
} else {
|
||||
set final_type "$type *"
|
||||
}
|
||||
} else {
|
||||
set final_type $type
|
||||
}
|
||||
|
||||
lappend newparams [list $final_type $var]
|
||||
}
|
||||
|
||||
return $newparams
|
||||
}
|
||||
|
||||
proc api-new-entry {info func} {
|
||||
global typemap
|
||||
|
||||
set master [dict create]
|
||||
set rettype [dict get $info return]
|
||||
|
||||
if {![info exists typemap($rettype)]} {
|
||||
set ::missingTypes($rettype) $func
|
||||
} else {
|
||||
dict set master return $typemap($rettype)
|
||||
}
|
||||
|
||||
dict set master parameters [translate-parameters $func \
|
||||
[dict get $info parameters]]
|
||||
|
||||
return $master
|
||||
}
|
||||
|
||||
proc main {argc argv} {
|
||||
global extensions typemap aliases promoted noop
|
||||
|
||||
set fd [open [lindex $argv 0] r]
|
||||
set data [read $fd]
|
||||
close $fd
|
||||
|
||||
array set ar {}
|
||||
|
||||
parse $data ar
|
||||
|
||||
array set newapi {}
|
||||
array set missingTypes {}
|
||||
|
||||
foreach {key value} [array get ar] {
|
||||
puts "KEY:$key VALUE:$value"
|
||||
|
||||
set category [dict get $value category]
|
||||
|
||||
#Invalidate any of the extensions and things not in the spec we support.
|
||||
set valid [is-valid-category? $category]
|
||||
puts VALID:$valid
|
||||
|
||||
if {!$valid} {
|
||||
continue
|
||||
}
|
||||
|
||||
puts "VALID:$key"
|
||||
|
||||
if {"BlitFramebuffer" eq $key} {
|
||||
#This was promoted to an ARB extension after Leopard it seems.
|
||||
set key BlitFramebufferEXT
|
||||
}
|
||||
|
||||
if {"ARB_framebuffer_object" eq $category} {
|
||||
#This wasn't an ARB extension in Leopard either.
|
||||
if {![string match *EXT $key]} {
|
||||
append key EXT
|
||||
}
|
||||
}
|
||||
|
||||
set newapi($key) [api-new-entry $value $key]
|
||||
}
|
||||
|
||||
#Now iterate and support as many aliases as we can for promoted functions
|
||||
#based on if the newapi contains the function.
|
||||
foreach {func value} [array get ar] {
|
||||
if {![info exists promoted([dict get $value category])]} {
|
||||
continue
|
||||
}
|
||||
|
||||
if {[dict exists $value alias]} {
|
||||
#We have an alias. Let's see if we have the implementation.
|
||||
set alias [dict get $value alias]
|
||||
|
||||
if {[info exists newapi($alias)] && ![info exists newapi($func)]} {
|
||||
#We have an implementing function available.
|
||||
puts "HAVE:$key ALIAS:$alias"
|
||||
|
||||
set master [api-new-entry $value $func]
|
||||
dict set master alias_for $alias
|
||||
set newapi($func) $master
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
parray noop
|
||||
|
||||
#Now handle the no-op compatibility categories.
|
||||
foreach {func value} [array get ar] {
|
||||
if {[info exists noop([dict get $value category])]} {
|
||||
if {[info exists newapi($func)]} {
|
||||
puts stderr "$func shouldn't be a noop"
|
||||
exit 1
|
||||
}
|
||||
|
||||
set master [api-new-entry $value $func]
|
||||
dict set master noop 1
|
||||
set newapi($func) $master
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
parray newapi
|
||||
|
||||
if {[array size ::missingTypes]} {
|
||||
parray ::missingTypes
|
||||
return 1
|
||||
}
|
||||
|
||||
foreach {from to} [array get aliases] {
|
||||
set d $newapi($to)
|
||||
dict set d alias_for $to
|
||||
set newapi($from) $d
|
||||
}
|
||||
|
||||
#Iterate the nm output and set each symbol in an associative array.
|
||||
array set validapi {}
|
||||
|
||||
foreach line [split [exec nm -j -g /System/Library/Frameworks/OpenGL.framework/Libraries/libGL.dylib] \n] {
|
||||
set fn [string trim $line]
|
||||
|
||||
#Only match the _gl functions.
|
||||
if {[string match _gl* $fn]} {
|
||||
set finalfn [string range $fn 3 end]
|
||||
puts FINALFN:$finalfn
|
||||
set validapi($finalfn) $finalfn
|
||||
}
|
||||
}
|
||||
|
||||
puts "Correcting the API functions to match the OpenGL framework."
|
||||
#parray validapi
|
||||
|
||||
#Iterate the newapi and unset any members that the
|
||||
#libGL.dylib doesn't support, assuming they aren't no-ops.
|
||||
foreach fn [array names newapi] {
|
||||
if {![info exists validapi($fn)]} {
|
||||
puts "WARNING: libGL.dylib lacks support for: $fn"
|
||||
|
||||
if {[dict exists $newapi($fn) noop]
|
||||
&& [dict get $newapi($fn) noop]} {
|
||||
#This is no-op, so we should skip it.
|
||||
continue
|
||||
}
|
||||
|
||||
#Is the function an alias for another in libGL?
|
||||
if {[dict exists $newapi($fn) alias_for]} {
|
||||
set alias [dict get $newapi($fn) alias_for]
|
||||
|
||||
if {![info exists validapi($alias)]} {
|
||||
puts "WARNING: alias function doesn't exist for $fn."
|
||||
puts "The alias is $alias."
|
||||
puts "unsetting $fn"
|
||||
unset newapi($fn)
|
||||
}
|
||||
} else {
|
||||
puts "unsetting $fn"
|
||||
unset newapi($fn)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#Now print a warning about any symbols that libGL supports that we don't.
|
||||
foreach fn [array names validapi] {
|
||||
if {![info exists newapi($fn)]} {
|
||||
puts "AppleSGLX is missing $fn"
|
||||
}
|
||||
}
|
||||
|
||||
puts "NOW GENERATING:[lindex $::argv 1]"
|
||||
set fd [open [lindex $::argv 1] w]
|
||||
|
||||
set sorted [lsort -dictionary [array names newapi]]
|
||||
|
||||
foreach f $sorted {
|
||||
set attr $newapi($f)
|
||||
set pstr ""
|
||||
foreach p [dict get $attr parameters] {
|
||||
append pstr "[lindex $p 0] [lindex $p 1], "
|
||||
}
|
||||
set pstr [string trimright $pstr ", "]
|
||||
puts $fd "[dict get $attr return] gl[set f]($pstr); "
|
||||
}
|
||||
|
||||
close $fd
|
||||
|
||||
if {$::argc == 3} {
|
||||
puts "NOW GENERATING:[lindex $::argv 2]"
|
||||
#Dump the array as a serialized list.
|
||||
set fd [open [lindex $::argv 2] w]
|
||||
puts $fd [array get newapi]
|
||||
close $fd
|
||||
}
|
||||
|
||||
return 0
|
||||
}
|
||||
exit [main $::argc $::argv]
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
#!/bin/bash
|
||||
|
||||
INFILE=$1
|
||||
OUTFILE=$2
|
||||
|
||||
generate_macros() {
|
||||
grep gl.*ProcPtr /System/Library/Frameworks/OpenGL.framework/Headers/gl{,ext}.h | sed 's:^.*\(gl.*Ptr\).*$:\1:' | sort -u | perl -ne 'chomp($_); $s = "PFN".uc($_); $s =~ s/PROCPTR/PROC/; print "#define ".$_." ".$s."\n"'
|
||||
}
|
||||
|
||||
generate_function_pointers() {
|
||||
{
|
||||
echo "#define GL_GLEXT_FUNCTION_POINTERS 1"
|
||||
echo "#define GL_GLEXT_LEGACY 1"
|
||||
generate_macros
|
||||
echo '#include "/System/Library/Frameworks/OpenGL.framework/Headers/gl.h"'
|
||||
} | ${CC:-gcc} -E - | grep typedef.*PFN
|
||||
}
|
||||
|
||||
cat ${INFILE} | while IFS= read LINE ; do
|
||||
case $LINE in
|
||||
"@CGL_MESA_COMPAT_MACROS@")
|
||||
generate_macros
|
||||
;;
|
||||
"@CGL_MESA_FUNCTION_POINTERS@")
|
||||
if ! grep -q GL_GLEXT_PROTOTYPES /System/Library/Frameworks/OpenGL.framework/Headers/gl.h ; then
|
||||
generate_function_pointers
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
printf "${LINE}\n"
|
||||
;;
|
||||
esac
|
||||
done > ${OUTFILE}
|
|
@ -0,0 +1,32 @@
|
|||
|
||||
proc main {argc argv} {
|
||||
if {1 != $argc} {
|
||||
puts stderr "syntax is: [info script] output.h"
|
||||
exit 1
|
||||
}
|
||||
|
||||
set fd [open [lindex $argv 0] w]
|
||||
puts $fd "
|
||||
/*OpenGL primitive typedefs*/
|
||||
typedef unsigned int GLenum;
|
||||
typedef unsigned char GLboolean;
|
||||
typedef unsigned int GLbitfield;
|
||||
typedef signed char GLbyte;
|
||||
typedef short GLshort;
|
||||
typedef int GLint;
|
||||
typedef int GLsizei;
|
||||
typedef unsigned char GLubyte;
|
||||
typedef unsigned short GLushort;
|
||||
typedef unsigned int GLuint;
|
||||
typedef float GLfloat;
|
||||
typedef float GLclampf;
|
||||
typedef double GLdouble;
|
||||
typedef double GLclampd;
|
||||
typedef void GLvoid;
|
||||
|
||||
typedef long GLintptr;
|
||||
typedef long GLsizeiptr;
|
||||
"
|
||||
|
||||
}
|
||||
main $::argc $::argv
|
|
@ -0,0 +1,375 @@
|
|||
#include "glxclient.h"
|
||||
#include "glxextensions.h"
|
||||
#include "glcontextmodes.h"
|
||||
|
||||
/*
|
||||
** GLX_SGI_swap_control
|
||||
*/
|
||||
int
|
||||
glXSwapIntervalSGI(int interval)
|
||||
{
|
||||
(void) interval;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** GLX_MESA_swap_control
|
||||
*/
|
||||
int
|
||||
glXSwapIntervalMESA(unsigned int interval)
|
||||
{
|
||||
(void) interval;
|
||||
return GLX_BAD_CONTEXT;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
glXGetSwapIntervalMESA(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** GLX_MESA_swap_frame_usage
|
||||
*/
|
||||
|
||||
int
|
||||
glXBeginFrameTrackingMESA(Display * dpy, GLXDrawable drawable)
|
||||
{
|
||||
int status = GLX_BAD_CONTEXT;
|
||||
(void) dpy;
|
||||
(void) drawable;
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
glXEndFrameTrackingMESA(Display * dpy, GLXDrawable drawable)
|
||||
{
|
||||
int status = GLX_BAD_CONTEXT;
|
||||
(void) dpy;
|
||||
(void) drawable;
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
glXGetFrameUsageMESA(Display * dpy, GLXDrawable drawable, GLfloat * usage)
|
||||
{
|
||||
int status = GLX_BAD_CONTEXT;
|
||||
(void) dpy;
|
||||
(void) drawable;
|
||||
(void) usage;
|
||||
return status;
|
||||
}
|
||||
|
||||
int
|
||||
glXQueryFrameTrackingMESA(Display * dpy, GLXDrawable drawable,
|
||||
int64_t * sbc, int64_t * missedFrames,
|
||||
GLfloat * lastMissedUsage)
|
||||
{
|
||||
int status = GLX_BAD_CONTEXT;
|
||||
(void) dpy;
|
||||
(void) drawable;
|
||||
(void) sbc;
|
||||
(void) missedFrames;
|
||||
(void) lastMissedUsage;
|
||||
return status;
|
||||
}
|
||||
|
||||
/*
|
||||
** GLX_SGI_video_sync
|
||||
*/
|
||||
int
|
||||
glXGetVideoSyncSGI(unsigned int *count)
|
||||
{
|
||||
(void) count;
|
||||
return GLX_BAD_CONTEXT;
|
||||
}
|
||||
|
||||
int
|
||||
glXWaitVideoSyncSGI(int divisor, int remainder, unsigned int *count)
|
||||
{
|
||||
(void) count;
|
||||
return GLX_BAD_CONTEXT;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** GLX_SGIX_swap_group
|
||||
*/
|
||||
void
|
||||
glXJoinSwapGroupSGIX(Display * dpy, GLXDrawable drawable, GLXDrawable member)
|
||||
{
|
||||
(void) dpy;
|
||||
(void) drawable;
|
||||
(void) member;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** GLX_SGIX_swap_barrier
|
||||
*/
|
||||
void
|
||||
glXBindSwapBarrierSGIX(Display * dpy, GLXDrawable drawable, int barrier)
|
||||
{
|
||||
(void) dpy;
|
||||
(void) drawable;
|
||||
(void) barrier;
|
||||
}
|
||||
|
||||
Bool
|
||||
glXQueryMaxSwapBarriersSGIX(Display * dpy, int screen, int *max)
|
||||
{
|
||||
(void) dpy;
|
||||
(void) screen;
|
||||
(void) max;
|
||||
return False;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** GLX_OML_sync_control
|
||||
*/
|
||||
Bool
|
||||
glXGetSyncValuesOML(Display * dpy, GLXDrawable drawable,
|
||||
int64_t * ust, int64_t * msc, int64_t * sbc)
|
||||
{
|
||||
(void) dpy;
|
||||
(void) drawable;
|
||||
(void) ust;
|
||||
(void) msc;
|
||||
(void) sbc;
|
||||
return False;
|
||||
}
|
||||
|
||||
int64_t
|
||||
glXSwapBuffersMscOML(Display * dpy, GLXDrawable drawable,
|
||||
int64_t target_msc, int64_t divisor, int64_t remainder)
|
||||
{
|
||||
(void) dpy;
|
||||
(void) drawable;
|
||||
(void) target_msc;
|
||||
(void) divisor;
|
||||
(void) remainder;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Bool
|
||||
glXWaitForMscOML(Display * dpy, GLXDrawable drawable,
|
||||
int64_t target_msc, int64_t divisor,
|
||||
int64_t remainder, int64_t * ust,
|
||||
int64_t * msc, int64_t * sbc)
|
||||
{
|
||||
(void) dpy;
|
||||
(void) drawable;
|
||||
(void) target_msc;
|
||||
(void) divisor;
|
||||
(void) remainder;
|
||||
(void) ust;
|
||||
(void) msc;
|
||||
(void) sbc;
|
||||
return False;
|
||||
}
|
||||
|
||||
|
||||
Bool
|
||||
glXWaitForSbcOML(Display * dpy, GLXDrawable drawable,
|
||||
int64_t target_sbc, int64_t * ust,
|
||||
int64_t * msc, int64_t * sbc)
|
||||
{
|
||||
(void) dpy;
|
||||
(void) drawable;
|
||||
(void) target_sbc;
|
||||
(void) ust;
|
||||
(void) msc;
|
||||
(void) sbc;
|
||||
return False;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* GLX_MESA_allocate_memory
|
||||
*/
|
||||
/*@{*/
|
||||
|
||||
PUBLIC void *
|
||||
glXAllocateMemoryMESA(Display * dpy, int scrn,
|
||||
size_t size, float readFreq,
|
||||
float writeFreq, float priority)
|
||||
{
|
||||
(void) dpy;
|
||||
(void) scrn;
|
||||
(void) size;
|
||||
(void) readFreq;
|
||||
(void) writeFreq;
|
||||
(void) priority;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
PUBLIC void
|
||||
glXFreeMemoryMESA(Display * dpy, int scrn, void *pointer)
|
||||
{
|
||||
#ifdef __DRI_ALLOCATE
|
||||
__GLXscreenConfigs *const psc = GetGLXScreenConfigs(dpy, scrn);
|
||||
|
||||
if (psc && psc->allocate)
|
||||
(*psc->allocate->freeMemory) (psc->__driScreen, pointer);
|
||||
|
||||
#else
|
||||
(void) dpy;
|
||||
(void) scrn;
|
||||
(void) pointer;
|
||||
#endif /* __DRI_ALLOCATE */
|
||||
}
|
||||
|
||||
|
||||
PUBLIC GLuint
|
||||
glXGetMemoryOffsetMESA(Display * dpy, int scrn, const void *pointer)
|
||||
{
|
||||
(void) dpy;
|
||||
(void) scrn;
|
||||
(void) pointer;
|
||||
return ~0L;
|
||||
}
|
||||
|
||||
Bool
|
||||
glXReleaseBuffersMESA(Display * dpy, GLXDrawable d)
|
||||
{
|
||||
(void) dpy;
|
||||
(void) d;
|
||||
return False;
|
||||
}
|
||||
|
||||
|
||||
PUBLIC GLXPixmap
|
||||
glXCreateGLXPixmapMESA(Display * dpy, XVisualInfo * visual,
|
||||
Pixmap pixmap, Colormap cmap)
|
||||
{
|
||||
(void) dpy;
|
||||
(void) visual;
|
||||
(void) pixmap;
|
||||
(void) cmap;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* GLX_MESA_copy_sub_buffer
|
||||
*/
|
||||
void
|
||||
glXCopySubBufferMESA(Display * dpy, GLXDrawable drawable,
|
||||
int x, int y, int width, int height)
|
||||
{
|
||||
(void) dpy;
|
||||
(void) drawable;
|
||||
(void) x;
|
||||
(void) y;
|
||||
(void) width;
|
||||
(void) height;
|
||||
}
|
||||
|
||||
|
||||
PUBLIC int
|
||||
glXQueryGLXPbufferSGIX(Display * dpy, GLXDrawable drawable,
|
||||
int attribute, unsigned int *value)
|
||||
{
|
||||
(void) dpy;
|
||||
(void) drawable;
|
||||
(void) attribute;
|
||||
(void) value;
|
||||
return 0;
|
||||
}
|
||||
|
||||
PUBLIC GLXDrawable
|
||||
glXCreateGLXPbufferSGIX(Display * dpy, GLXFBConfig config,
|
||||
unsigned int width, unsigned int height,
|
||||
int *attrib_list)
|
||||
{
|
||||
(void) dpy;
|
||||
(void) config;
|
||||
(void) width;
|
||||
(void) height;
|
||||
(void) attrib_list;
|
||||
return None;
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* GLX_SGIX_fbconfig */
|
||||
PUBLIC int
|
||||
glXGetFBConfigAttribSGIX(Display * dpy, void *config, int a, int *b)
|
||||
{
|
||||
(void) dpy;
|
||||
(void) config;
|
||||
(void) a;
|
||||
(void) b;
|
||||
return 0;
|
||||
}
|
||||
|
||||
PUBLIC void *
|
||||
glXChooseFBConfigSGIX(Display * dpy, int a, int *b, int *c)
|
||||
{
|
||||
(void) dpy;
|
||||
(void) a;
|
||||
(void) b;
|
||||
(void) c;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
PUBLIC GLXPixmap
|
||||
glXCreateGLXPixmapWithConfigSGIX(Display * dpy, void *config, Pixmap p)
|
||||
{
|
||||
(void) dpy;
|
||||
(void) config;
|
||||
(void) p;
|
||||
return None;
|
||||
}
|
||||
|
||||
PUBLIC GLXContext
|
||||
glXCreateContextWithConfigSGIX(Display * dpy, void *config, int a,
|
||||
GLXContext b, Bool c)
|
||||
{
|
||||
(void) dpy;
|
||||
(void) config;
|
||||
(void) a;
|
||||
(void) b;
|
||||
(void) c;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
PUBLIC XVisualInfo *
|
||||
glXGetVisualFromFBConfigSGIX(Display * dpy, void *config)
|
||||
{
|
||||
(void) dpy;
|
||||
(void) config;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
PUBLIC void *
|
||||
glXGetFBConfigFromVisualSGIX(Display * dpy, XVisualInfo * visinfo)
|
||||
{
|
||||
(void) dpy;
|
||||
(void) visinfo;
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
PUBLIC
|
||||
GLX_ALIAS_VOID(glXDestroyGLXPbufferSGIX,
|
||||
(Display * dpy, GLXDrawable pbuf),
|
||||
(dpy, pbuf), glXDestroyPbuffer)
|
||||
|
||||
PUBLIC GLX_ALIAS_VOID(glXSelectEventSGIX,
|
||||
(Display * dpy, GLXDrawable drawable,
|
||||
unsigned long mask), (dpy, drawable, mask),
|
||||
glXSelectEvent)
|
||||
|
||||
PUBLIC GLX_ALIAS_VOID(glXGetSelectedEventSGIX,
|
||||
(Display * dpy, GLXDrawable drawable,
|
||||
unsigned long *mask), (dpy, drawable, mask),
|
||||
glXGetSelectedEvent)
|
|
@ -0,0 +1,65 @@
|
|||
/*
|
||||
Copyright (c) 2009 Apple Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation files
|
||||
(the "Software"), to deal in the Software without restriction,
|
||||
including without limitation the rights to use, copy, modify, merge,
|
||||
publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT
|
||||
HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name(s) of the above
|
||||
copyright holders shall not be used in advertising or otherwise to
|
||||
promote the sale, use or other dealings in this Software without
|
||||
prior written authorization.
|
||||
*/
|
||||
#include <stdbool.h>
|
||||
#include <X11/Xlibint.h>
|
||||
#include <X11/extensions/extutil.h>
|
||||
#include <X11/extensions/Xext.h>
|
||||
#include "glxclient.h"
|
||||
#include "glx_error.h"
|
||||
|
||||
extern XExtDisplayInfo *__glXFindDisplay(Display * dpy);
|
||||
|
||||
void
|
||||
__glXSendError(Display * dpy, int errorCode, unsigned long resourceID,
|
||||
unsigned long minorCode, bool coreX11error)
|
||||
{
|
||||
XExtDisplayInfo *info = __glXFindDisplay(dpy);
|
||||
GLXContext gc = __glXGetCurrentContext();
|
||||
xError error;
|
||||
|
||||
LockDisplay(dpy);
|
||||
|
||||
error.type = X_Error;
|
||||
|
||||
if (coreX11error) {
|
||||
error.errorCode = errorCode;
|
||||
}
|
||||
else {
|
||||
error.errorCode = info->codes->first_error + errorCode;
|
||||
}
|
||||
|
||||
error.sequenceNumber = dpy->request;
|
||||
error.resourceID = resourceID;
|
||||
error.minorCode = minorCode;
|
||||
error.majorCode = gc ? gc->majorOpcode : 0;
|
||||
|
||||
_XError(dpy, &error);
|
||||
|
||||
UnlockDisplay(dpy);
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
Copyright (c) 2009 Apple Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation files
|
||||
(the "Software"), to deal in the Software without restriction,
|
||||
including without limitation the rights to use, copy, modify, merge,
|
||||
publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT
|
||||
HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name(s) of the above
|
||||
copyright holders shall not be used in advertising or otherwise to
|
||||
promote the sale, use or other dealings in this Software without
|
||||
prior written authorization.
|
||||
*/
|
||||
#include <stdbool.h>
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
void __glXSendError(Display * dpy, int errorCode, unsigned long resourceID,
|
||||
unsigned long minorCode, bool coreX11error);
|
|
@ -0,0 +1,134 @@
|
|||
/*
|
||||
* (C) Copyright Apple Inc. 2008
|
||||
* (C) Copyright IBM Corporation 2004, 2005
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sub license,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
|
||||
* IBM,
|
||||
* AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
||||
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <GL/gl.h>
|
||||
#include "glxclient.h"
|
||||
#include <GL/glxproto.h>
|
||||
|
||||
CARD32
|
||||
__glXReadReply(Display * dpy, size_t size, void *dest,
|
||||
GLboolean reply_is_always_array)
|
||||
{
|
||||
xGLXSingleReply reply;
|
||||
|
||||
(void) _XReply(dpy, (xReply *) & reply, 0, False);
|
||||
if (size != 0) {
|
||||
if ((reply.length > 0) || reply_is_always_array) {
|
||||
const GLint bytes = (reply_is_always_array)
|
||||
? (4 * reply.length) : (reply.size * size);
|
||||
const GLint extra = 4 - (bytes & 3);
|
||||
|
||||
_XRead(dpy, dest, bytes);
|
||||
if (extra < 4) {
|
||||
_XEatData(dpy, extra);
|
||||
}
|
||||
}
|
||||
else {
|
||||
(void) memcpy(dest, &(reply.pad3), size);
|
||||
}
|
||||
}
|
||||
|
||||
return reply.retval;
|
||||
}
|
||||
|
||||
void
|
||||
__glXReadPixelReply(Display * dpy, __GLXcontext * gc, unsigned max_dim,
|
||||
GLint width, GLint height, GLint depth, GLenum format,
|
||||
GLenum type, void *dest, GLboolean dimensions_in_reply)
|
||||
{
|
||||
xGLXSingleReply reply;
|
||||
GLint size;
|
||||
|
||||
(void) _XReply(dpy, (xReply *) & reply, 0, False);
|
||||
|
||||
if (dimensions_in_reply) {
|
||||
width = reply.pad3;
|
||||
height = reply.pad4;
|
||||
depth = reply.pad5;
|
||||
|
||||
if ((height == 0) || (max_dim < 2)) {
|
||||
height = 1;
|
||||
}
|
||||
if ((depth == 0) || (max_dim < 3)) {
|
||||
depth = 1;
|
||||
}
|
||||
}
|
||||
|
||||
size = reply.length * 4;
|
||||
if (size != 0) {
|
||||
void *buf = Xmalloc(size);
|
||||
|
||||
if (buf == NULL) {
|
||||
_XEatData(dpy, size);
|
||||
__glXSetError(gc, GL_OUT_OF_MEMORY);
|
||||
}
|
||||
else {
|
||||
const GLint extra = 4 - (size & 3);
|
||||
|
||||
_XRead(dpy, buf, size);
|
||||
if (extra < 4) {
|
||||
_XEatData(dpy, extra);
|
||||
}
|
||||
|
||||
__glEmptyImage(gc, 3, width, height, depth, format, type, buf, dest);
|
||||
Xfree(buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
GLubyte *
|
||||
__glXSetupSingleRequest(__GLXcontext * gc, GLint sop, GLint cmdlen)
|
||||
{
|
||||
xGLXSingleReq *req;
|
||||
Display *const dpy = gc->currentDpy;
|
||||
|
||||
(void) __glXFlushRenderBuffer(gc, gc->pc);
|
||||
LockDisplay(dpy);
|
||||
GetReqExtra(GLXSingle, cmdlen, req);
|
||||
req->reqType = gc->majorOpcode;
|
||||
req->contextTag = gc->currentContextTag;
|
||||
req->glxCode = sop;
|
||||
return (GLubyte *) (req) + sz_xGLXSingleReq;
|
||||
}
|
||||
#endif
|
||||
|
||||
GLubyte *
|
||||
__glXSetupVendorRequest(__GLXcontext * gc, GLint code, GLint vop,
|
||||
GLint cmdlen)
|
||||
{
|
||||
xGLXVendorPrivateReq *req;
|
||||
Display *const dpy = gc->currentDpy;
|
||||
|
||||
(void) __glXFlushRenderBuffer(gc, gc->pc);
|
||||
LockDisplay(dpy);
|
||||
GetReqExtra(GLXVendorPrivate, cmdlen, req);
|
||||
req->reqType = gc->majorOpcode;
|
||||
req->glxCode = code;
|
||||
req->vendorCode = vop;
|
||||
req->contextTag = gc->currentContextTag;
|
||||
return (GLubyte *) (req) + sz_xGLXVendorPrivateReq;
|
||||
}
|
|
@ -0,0 +1,130 @@
|
|||
/*
|
||||
* Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
|
||||
* Copyright (C) 2009 Apple Inc. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef __X_GL_H
|
||||
#define __X_GL_H
|
||||
|
||||
/* The following macros exist to address conflicts between the names given to
|
||||
* function pointers by the MESA API and OpenGL.framework's API.
|
||||
*/
|
||||
@CGL_MESA_COMPAT_MACROS@
|
||||
|
||||
/* On SL, we want to use OpelGL.framework's headers to get both prototypes and
|
||||
* function pointers (like Mesa's API), but on Leo and before, OpenGL.framework
|
||||
* can't give us both.
|
||||
*/
|
||||
|
||||
#ifdef GL_GLEXT_FUNCTION_POINTERS
|
||||
#define _GL_GLEXT_FUNCTION_POINTERS GL_GLEXT_FUNCTION_POINTERS
|
||||
#undef GL_GLEXT_FUNCTION_POINTERS
|
||||
#endif
|
||||
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
#define _GL_GLEXT_PROTOTYPES GL_GLEXT_PROTOTYPES
|
||||
#else
|
||||
#define GL_GLEXT_PROTOTYPES 1
|
||||
#endif
|
||||
|
||||
/* Our glext.h is based on a version from the registry that is newer. */
|
||||
#ifdef GL_GLEXT_LEGACY
|
||||
#define _GL_GLEXT_LEGACY GL_GLEXT_LEGACY
|
||||
#else
|
||||
#define GL_GLEXT_LEGACY 1
|
||||
#endif
|
||||
|
||||
#include "/System/Library/Frameworks/OpenGL.framework/Headers/gl.h"
|
||||
|
||||
/* These are not set by the system gl.h */
|
||||
#define GL_VERSION_1_2_DEPRECATED 1
|
||||
#define GL_VERSION_1_3_DEPRECATED 1
|
||||
#define GL_VERSION_1_4_DEPRECATED 1
|
||||
|
||||
/* Restore our GLEXT-fu */
|
||||
#ifdef _GL_GLEXT_FUNCTION_POINTERS
|
||||
#define GL_GLEXT_FUNCTION_POINTERS _GL_GLEXT_FUNCTION_POINTERS
|
||||
#undef _GL_GLEXT_FUNCTION_POINTERS
|
||||
#endif
|
||||
|
||||
#ifdef _GL_GLEXT_PROTOTYPES
|
||||
#undef _GL_GLEXT_PROTOTYPES
|
||||
#else
|
||||
#undef GL_GLEXT_PROTOTYPES
|
||||
#endif
|
||||
|
||||
#ifdef _GL_GLEXT_LEGACY
|
||||
#undef _GL_GLEXT_LEGACY
|
||||
#else
|
||||
#undef GL_GLEXT_LEGACY
|
||||
#endif
|
||||
|
||||
@CGL_MESA_FUNCTION_POINTERS@
|
||||
|
||||
#ifndef GL_GLEXT_LEGACY
|
||||
#include <GL/glext.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* This is needed for building apple_glx_pbuffer.c, the latest
|
||||
* glext.h from the registry lacks it, so it's from the Leopard glext.h:
|
||||
*/
|
||||
#ifndef GL_TEXTURE_RECTANGLE_EXT
|
||||
#define GL_TEXTURE_RECTANGLE_EXT 0x84F5
|
||||
#endif
|
||||
|
||||
/* This is needed for building the X server: */
|
||||
/*
|
||||
* GL_MESA_packed_depth_stencil
|
||||
*/
|
||||
#ifndef GL_MESA_packed_depth_stencil
|
||||
#define GL_MESA_packed_depth_stencil 1
|
||||
|
||||
#define GL_DEPTH_STENCIL_MESA 0x8750
|
||||
#define GL_UNSIGNED_INT_24_8_MESA 0x8751
|
||||
#define GL_UNSIGNED_INT_8_24_REV_MESA 0x8752
|
||||
#define GL_UNSIGNED_SHORT_15_1_MESA 0x8753
|
||||
#define GL_UNSIGNED_SHORT_1_15_REV_MESA 0x8754
|
||||
|
||||
#endif /* GL_MESA_packed_depth_stencil */
|
||||
|
||||
/* Various other OS projects expect to get these macros from Mesa's gl.h */
|
||||
#ifndef GLAPI
|
||||
#define GLAPI extern
|
||||
#endif
|
||||
|
||||
#ifndef GLAPIENTRY
|
||||
#define GLAPIENTRY
|
||||
#endif
|
||||
|
||||
#ifndef APIENTRY
|
||||
#define APIENTRY GLAPIENTRY
|
||||
#endif
|
||||
|
||||
/* "P" suffix to be used for a pointer to a function */
|
||||
#ifndef APIENTRYP
|
||||
#define APIENTRYP APIENTRY *
|
||||
#endif
|
||||
|
||||
#ifndef GLAPIENTRYP
|
||||
#define GLAPIENTRYP GLAPIENTRY *
|
||||
#endif
|
||||
|
||||
#endif /*__X_GL_H*/
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,519 @@
|
|||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 6.5
|
||||
*
|
||||
* Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef GLX_H
|
||||
#define GLX_H
|
||||
|
||||
|
||||
#ifdef __VMS
|
||||
#include <GL/vms_x_fix.h>
|
||||
# ifdef __cplusplus
|
||||
/* VMS Xlib.h gives problems with C++.
|
||||
* this avoids a bunch of trivial warnings */
|
||||
#pragma message disable nosimpint
|
||||
#endif
|
||||
#endif
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#ifdef __VMS
|
||||
# ifdef __cplusplus
|
||||
#pragma message enable nosimpint
|
||||
#endif
|
||||
#endif
|
||||
#include <GL/gl.h>
|
||||
|
||||
|
||||
#if defined(USE_MGL_NAMESPACE)
|
||||
#include "glx_mangle.h"
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
#define GLX_VERSION_1_1 1
|
||||
#define GLX_VERSION_1_2 1
|
||||
#define GLX_VERSION_1_3 1
|
||||
#define GLX_VERSION_1_4 1
|
||||
|
||||
#define GLX_EXTENSION_NAME "GLX"
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Tokens for glXChooseVisual and glXGetConfig:
|
||||
*/
|
||||
#define GLX_USE_GL 1
|
||||
#define GLX_BUFFER_SIZE 2
|
||||
#define GLX_LEVEL 3
|
||||
#define GLX_RGBA 4
|
||||
#define GLX_DOUBLEBUFFER 5
|
||||
#define GLX_STEREO 6
|
||||
#define GLX_AUX_BUFFERS 7
|
||||
#define GLX_RED_SIZE 8
|
||||
#define GLX_GREEN_SIZE 9
|
||||
#define GLX_BLUE_SIZE 10
|
||||
#define GLX_ALPHA_SIZE 11
|
||||
#define GLX_DEPTH_SIZE 12
|
||||
#define GLX_STENCIL_SIZE 13
|
||||
#define GLX_ACCUM_RED_SIZE 14
|
||||
#define GLX_ACCUM_GREEN_SIZE 15
|
||||
#define GLX_ACCUM_BLUE_SIZE 16
|
||||
#define GLX_ACCUM_ALPHA_SIZE 17
|
||||
|
||||
|
||||
/*
|
||||
* Error codes returned by glXGetConfig:
|
||||
*/
|
||||
#define GLX_BAD_SCREEN 1
|
||||
#define GLX_BAD_ATTRIBUTE 2
|
||||
#define GLX_NO_EXTENSION 3
|
||||
#define GLX_BAD_VISUAL 4
|
||||
#define GLX_BAD_CONTEXT 5
|
||||
#define GLX_BAD_VALUE 6
|
||||
#define GLX_BAD_ENUM 7
|
||||
|
||||
|
||||
/*
|
||||
* GLX 1.1 and later:
|
||||
*/
|
||||
#define GLX_VENDOR 1
|
||||
#define GLX_VERSION 2
|
||||
#define GLX_EXTENSIONS 3
|
||||
|
||||
|
||||
/*
|
||||
* GLX 1.3 and later:
|
||||
*/
|
||||
#define GLX_CONFIG_CAVEAT 0x20
|
||||
#define GLX_DONT_CARE 0xFFFFFFFF
|
||||
#define GLX_X_VISUAL_TYPE 0x22
|
||||
#define GLX_TRANSPARENT_TYPE 0x23
|
||||
#define GLX_TRANSPARENT_INDEX_VALUE 0x24
|
||||
#define GLX_TRANSPARENT_RED_VALUE 0x25
|
||||
#define GLX_TRANSPARENT_GREEN_VALUE 0x26
|
||||
#define GLX_TRANSPARENT_BLUE_VALUE 0x27
|
||||
#define GLX_TRANSPARENT_ALPHA_VALUE 0x28
|
||||
#define GLX_WINDOW_BIT 0x00000001
|
||||
#define GLX_PIXMAP_BIT 0x00000002
|
||||
#define GLX_PBUFFER_BIT 0x00000004
|
||||
#define GLX_AUX_BUFFERS_BIT 0x00000010
|
||||
#define GLX_FRONT_LEFT_BUFFER_BIT 0x00000001
|
||||
#define GLX_FRONT_RIGHT_BUFFER_BIT 0x00000002
|
||||
#define GLX_BACK_LEFT_BUFFER_BIT 0x00000004
|
||||
#define GLX_BACK_RIGHT_BUFFER_BIT 0x00000008
|
||||
#define GLX_DEPTH_BUFFER_BIT 0x00000020
|
||||
#define GLX_STENCIL_BUFFER_BIT 0x00000040
|
||||
#define GLX_ACCUM_BUFFER_BIT 0x00000080
|
||||
#define GLX_NONE 0x8000
|
||||
#define GLX_SLOW_CONFIG 0x8001
|
||||
#define GLX_TRUE_COLOR 0x8002
|
||||
#define GLX_DIRECT_COLOR 0x8003
|
||||
#define GLX_PSEUDO_COLOR 0x8004
|
||||
#define GLX_STATIC_COLOR 0x8005
|
||||
#define GLX_GRAY_SCALE 0x8006
|
||||
#define GLX_STATIC_GRAY 0x8007
|
||||
#define GLX_TRANSPARENT_RGB 0x8008
|
||||
#define GLX_TRANSPARENT_INDEX 0x8009
|
||||
#define GLX_VISUAL_ID 0x800B
|
||||
#define GLX_SCREEN 0x800C
|
||||
#define GLX_NON_CONFORMANT_CONFIG 0x800D
|
||||
#define GLX_DRAWABLE_TYPE 0x8010
|
||||
#define GLX_RENDER_TYPE 0x8011
|
||||
#define GLX_X_RENDERABLE 0x8012
|
||||
#define GLX_FBCONFIG_ID 0x8013
|
||||
#define GLX_RGBA_TYPE 0x8014
|
||||
#define GLX_COLOR_INDEX_TYPE 0x8015
|
||||
#define GLX_MAX_PBUFFER_WIDTH 0x8016
|
||||
#define GLX_MAX_PBUFFER_HEIGHT 0x8017
|
||||
#define GLX_MAX_PBUFFER_PIXELS 0x8018
|
||||
#define GLX_PRESERVED_CONTENTS 0x801B
|
||||
#define GLX_LARGEST_PBUFFER 0x801C
|
||||
#define GLX_WIDTH 0x801D
|
||||
#define GLX_HEIGHT 0x801E
|
||||
#define GLX_EVENT_MASK 0x801F
|
||||
#define GLX_DAMAGED 0x8020
|
||||
#define GLX_SAVED 0x8021
|
||||
#define GLX_WINDOW 0x8022
|
||||
#define GLX_PBUFFER 0x8023
|
||||
#define GLX_PBUFFER_HEIGHT 0x8040
|
||||
#define GLX_PBUFFER_WIDTH 0x8041
|
||||
#define GLX_RGBA_BIT 0x00000001
|
||||
#define GLX_COLOR_INDEX_BIT 0x00000002
|
||||
#define GLX_PBUFFER_CLOBBER_MASK 0x08000000
|
||||
|
||||
|
||||
/*
|
||||
* GLX 1.4 and later:
|
||||
*/
|
||||
#define GLX_SAMPLE_BUFFERS 0x186a0 /*100000*/
|
||||
#define GLX_SAMPLES 0x186a1 /*100001*/
|
||||
|
||||
|
||||
|
||||
typedef struct __GLXcontextRec *GLXContext;
|
||||
typedef XID GLXPixmap;
|
||||
typedef XID GLXDrawable;
|
||||
/* GLX 1.3 and later */
|
||||
typedef struct __GLXFBConfigRec *GLXFBConfig;
|
||||
typedef XID GLXFBConfigID;
|
||||
typedef XID GLXContextID;
|
||||
typedef XID GLXWindow;
|
||||
typedef XID GLXPbuffer;
|
||||
|
||||
|
||||
|
||||
extern XVisualInfo* glXChooseVisual( Display *dpy, int screen,
|
||||
int *attribList );
|
||||
|
||||
extern GLXContext glXCreateContext( Display *dpy, XVisualInfo *vis,
|
||||
GLXContext shareList, Bool direct );
|
||||
|
||||
extern void glXDestroyContext( Display *dpy, GLXContext ctx );
|
||||
|
||||
extern Bool glXMakeCurrent( Display *dpy, GLXDrawable drawable,
|
||||
GLXContext ctx);
|
||||
|
||||
extern void glXCopyContext( Display *dpy, GLXContext src, GLXContext dst,
|
||||
unsigned long mask );
|
||||
|
||||
extern void glXSwapBuffers( Display *dpy, GLXDrawable drawable );
|
||||
|
||||
extern GLXPixmap glXCreateGLXPixmap( Display *dpy, XVisualInfo *visual,
|
||||
Pixmap pixmap );
|
||||
|
||||
extern void glXDestroyGLXPixmap( Display *dpy, GLXPixmap pixmap );
|
||||
|
||||
extern Bool glXQueryExtension( Display *dpy, int *errorb, int *event );
|
||||
|
||||
extern Bool glXQueryVersion( Display *dpy, int *maj, int *min );
|
||||
|
||||
extern Bool glXIsDirect( Display *dpy, GLXContext ctx );
|
||||
|
||||
extern int glXGetConfig( Display *dpy, XVisualInfo *visual,
|
||||
int attrib, int *value );
|
||||
|
||||
extern GLXContext glXGetCurrentContext( void );
|
||||
|
||||
extern GLXDrawable glXGetCurrentDrawable( void );
|
||||
|
||||
extern void glXWaitGL( void );
|
||||
|
||||
extern void glXWaitX( void );
|
||||
|
||||
extern void glXUseXFont( Font font, int first, int count, int list );
|
||||
|
||||
|
||||
|
||||
/* GLX 1.1 and later */
|
||||
extern const char *glXQueryExtensionsString( Display *dpy, int screen );
|
||||
|
||||
extern const char *glXQueryServerString( Display *dpy, int screen, int name );
|
||||
|
||||
extern const char *glXGetClientString( Display *dpy, int name );
|
||||
|
||||
|
||||
/* GLX 1.2 and later */
|
||||
extern Display *glXGetCurrentDisplay( void );
|
||||
|
||||
|
||||
/* GLX 1.3 and later */
|
||||
extern GLXFBConfig *glXChooseFBConfig( Display *dpy, int screen,
|
||||
const int *attribList, int *nitems );
|
||||
|
||||
extern int glXGetFBConfigAttrib( Display *dpy, GLXFBConfig config,
|
||||
int attribute, int *value );
|
||||
|
||||
extern GLXFBConfig *glXGetFBConfigs( Display *dpy, int screen,
|
||||
int *nelements );
|
||||
|
||||
extern XVisualInfo *glXGetVisualFromFBConfig( Display *dpy,
|
||||
GLXFBConfig config );
|
||||
|
||||
extern GLXWindow glXCreateWindow( Display *dpy, GLXFBConfig config,
|
||||
Window win, const int *attribList );
|
||||
|
||||
extern void glXDestroyWindow( Display *dpy, GLXWindow window );
|
||||
|
||||
extern GLXPixmap glXCreatePixmap( Display *dpy, GLXFBConfig config,
|
||||
Pixmap pixmap, const int *attribList );
|
||||
|
||||
extern void glXDestroyPixmap( Display *dpy, GLXPixmap pixmap );
|
||||
|
||||
extern GLXPbuffer glXCreatePbuffer( Display *dpy, GLXFBConfig config,
|
||||
const int *attribList );
|
||||
|
||||
extern void glXDestroyPbuffer( Display *dpy, GLXPbuffer pbuf );
|
||||
|
||||
extern void glXQueryDrawable( Display *dpy, GLXDrawable draw, int attribute,
|
||||
unsigned int *value );
|
||||
|
||||
extern GLXContext glXCreateNewContext( Display *dpy, GLXFBConfig config,
|
||||
int renderType, GLXContext shareList,
|
||||
Bool direct );
|
||||
|
||||
extern Bool glXMakeContextCurrent( Display *dpy, GLXDrawable draw,
|
||||
GLXDrawable read, GLXContext ctx );
|
||||
|
||||
extern GLXDrawable glXGetCurrentReadDrawable( void );
|
||||
|
||||
extern int glXQueryContext( Display *dpy, GLXContext ctx, int attribute,
|
||||
int *value );
|
||||
|
||||
extern void glXSelectEvent( Display *dpy, GLXDrawable drawable,
|
||||
unsigned long mask );
|
||||
|
||||
extern void glXGetSelectedEvent( Display *dpy, GLXDrawable drawable,
|
||||
unsigned long *mask );
|
||||
|
||||
/* GLX 1.3 function pointer typedefs */
|
||||
typedef GLXFBConfig * (* PFNGLXGETFBCONFIGSPROC) (Display *dpy, int screen, int *nelements);
|
||||
typedef GLXFBConfig * (* PFNGLXCHOOSEFBCONFIGPROC) (Display *dpy, int screen, const int *attrib_list, int *nelements);
|
||||
typedef int (* PFNGLXGETFBCONFIGATTRIBPROC) (Display *dpy, GLXFBConfig config, int attribute, int *value);
|
||||
typedef XVisualInfo * (* PFNGLXGETVISUALFROMFBCONFIGPROC) (Display *dpy, GLXFBConfig config);
|
||||
typedef GLXWindow (* PFNGLXCREATEWINDOWPROC) (Display *dpy, GLXFBConfig config, Window win, const int *attrib_list);
|
||||
typedef void (* PFNGLXDESTROYWINDOWPROC) (Display *dpy, GLXWindow win);
|
||||
typedef GLXPixmap (* PFNGLXCREATEPIXMAPPROC) (Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attrib_list);
|
||||
typedef void (* PFNGLXDESTROYPIXMAPPROC) (Display *dpy, GLXPixmap pixmap);
|
||||
typedef GLXPbuffer (* PFNGLXCREATEPBUFFERPROC) (Display *dpy, GLXFBConfig config, const int *attrib_list);
|
||||
typedef void (* PFNGLXDESTROYPBUFFERPROC) (Display *dpy, GLXPbuffer pbuf);
|
||||
typedef void (* PFNGLXQUERYDRAWABLEPROC) (Display *dpy, GLXDrawable draw, int attribute, unsigned int *value);
|
||||
typedef GLXContext (* PFNGLXCREATENEWCONTEXTPROC) (Display *dpy, GLXFBConfig config, int render_type, GLXContext share_list, Bool direct);
|
||||
typedef Bool (* PFNGLXMAKECONTEXTCURRENTPROC) (Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx);
|
||||
typedef GLXDrawable (* PFNGLXGETCURRENTREADDRAWABLEPROC) (void);
|
||||
typedef Display * (* PFNGLXGETCURRENTDISPLAYPROC) (void);
|
||||
typedef int (* PFNGLXQUERYCONTEXTPROC) (Display *dpy, GLXContext ctx, int attribute, int *value);
|
||||
typedef void (* PFNGLXSELECTEVENTPROC) (Display *dpy, GLXDrawable draw, unsigned long event_mask);
|
||||
typedef void (* PFNGLXGETSELECTEDEVENTPROC) (Display *dpy, GLXDrawable draw, unsigned long *event_mask);
|
||||
|
||||
|
||||
/*
|
||||
* ARB 2. GLX_ARB_get_proc_address
|
||||
*/
|
||||
#ifndef GLX_ARB_get_proc_address
|
||||
#define GLX_ARB_get_proc_address 1
|
||||
|
||||
typedef void (*__GLXextFuncPtr)(void);
|
||||
extern __GLXextFuncPtr glXGetProcAddressARB (const GLubyte *);
|
||||
|
||||
#endif /* GLX_ARB_get_proc_address */
|
||||
|
||||
|
||||
|
||||
/* GLX 1.4 and later */
|
||||
extern void (*glXGetProcAddress(const GLubyte *procname))( void );
|
||||
|
||||
/* GLX 1.4 function pointer typedefs */
|
||||
typedef __GLXextFuncPtr (* PFNGLXGETPROCADDRESSPROC) (const GLubyte *procName);
|
||||
|
||||
|
||||
#ifndef GLX_GLXEXT_LEGACY
|
||||
|
||||
#include <GL/glxext.h>
|
||||
|
||||
#endif /* GLX_GLXEXT_LEGACY */
|
||||
|
||||
|
||||
/**
|
||||
** The following aren't in glxext.h yet.
|
||||
**/
|
||||
|
||||
|
||||
/*
|
||||
* ???. GLX_NV_vertex_array_range
|
||||
*/
|
||||
#ifndef GLX_NV_vertex_array_range
|
||||
#define GLX_NV_vertex_array_range
|
||||
|
||||
extern void *glXAllocateMemoryNV(GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority);
|
||||
extern void glXFreeMemoryNV(GLvoid *pointer);
|
||||
typedef void * ( * PFNGLXALLOCATEMEMORYNVPROC) (GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority);
|
||||
typedef void ( * PFNGLXFREEMEMORYNVPROC) (GLvoid *pointer);
|
||||
|
||||
#endif /* GLX_NV_vertex_array_range */
|
||||
|
||||
|
||||
/*
|
||||
* ???. GLX_MESA_allocate_memory
|
||||
*/
|
||||
#ifndef GLX_MESA_allocate_memory
|
||||
#define GLX_MESA_allocate_memory 1
|
||||
|
||||
extern void *glXAllocateMemoryMESA(Display *dpy, int scrn, size_t size, float readfreq, float writefreq, float priority);
|
||||
extern void glXFreeMemoryMESA(Display *dpy, int scrn, void *pointer);
|
||||
extern GLuint glXGetMemoryOffsetMESA(Display *dpy, int scrn, const void *pointer);
|
||||
typedef void * ( * PFNGLXALLOCATEMEMORYMESAPROC) (Display *dpy, int scrn, size_t size, float readfreq, float writefreq, float priority);
|
||||
typedef void ( * PFNGLXFREEMEMORYMESAPROC) (Display *dpy, int scrn, void *pointer);
|
||||
typedef GLuint (* PFNGLXGETMEMORYOFFSETMESAPROC) (Display *dpy, int scrn, const void *pointer);
|
||||
|
||||
#endif /* GLX_MESA_allocate_memory */
|
||||
|
||||
|
||||
/*
|
||||
* ARB ?. GLX_ARB_render_texture
|
||||
* XXX This was never finalized!
|
||||
*/
|
||||
#ifndef GLX_ARB_render_texture
|
||||
#define GLX_ARB_render_texture 1
|
||||
|
||||
extern Bool glXBindTexImageARB(Display *dpy, GLXPbuffer pbuffer, int buffer);
|
||||
extern Bool glXReleaseTexImageARB(Display *dpy, GLXPbuffer pbuffer, int buffer);
|
||||
extern Bool glXDrawableAttribARB(Display *dpy, GLXDrawable draw, const int *attribList);
|
||||
|
||||
#endif /* GLX_ARB_render_texture */
|
||||
|
||||
|
||||
/*
|
||||
* Remove this when glxext.h is updated.
|
||||
*/
|
||||
#ifndef GLX_NV_float_buffer
|
||||
#define GLX_NV_float_buffer 1
|
||||
|
||||
#define GLX_FLOAT_COMPONENTS_NV 0x20B0
|
||||
|
||||
#endif /* GLX_NV_float_buffer */
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* #?. GLX_MESA_swap_frame_usage
|
||||
*/
|
||||
#ifndef GLX_MESA_swap_frame_usage
|
||||
#define GLX_MESA_swap_frame_usage 1
|
||||
|
||||
extern int glXGetFrameUsageMESA(Display *dpy, GLXDrawable drawable, float *usage);
|
||||
extern int glXBeginFrameTrackingMESA(Display *dpy, GLXDrawable drawable);
|
||||
extern int glXEndFrameTrackingMESA(Display *dpy, GLXDrawable drawable);
|
||||
extern int glXQueryFrameTrackingMESA(Display *dpy, GLXDrawable drawable, int64_t *swapCount, int64_t *missedFrames, float *lastMissedUsage);
|
||||
|
||||
typedef int (*PFNGLXGETFRAMEUSAGEMESAPROC) (Display *dpy, GLXDrawable drawable, float *usage);
|
||||
typedef int (*PFNGLXBEGINFRAMETRACKINGMESAPROC)(Display *dpy, GLXDrawable drawable);
|
||||
typedef int (*PFNGLXENDFRAMETRACKINGMESAPROC)(Display *dpy, GLXDrawable drawable);
|
||||
typedef int (*PFNGLXQUERYFRAMETRACKINGMESAPROC)(Display *dpy, GLXDrawable drawable, int64_t *swapCount, int64_t *missedFrames, float *lastMissedUsage);
|
||||
|
||||
#endif /* GLX_MESA_swap_frame_usage */
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* #?. GLX_MESA_swap_control
|
||||
*/
|
||||
#ifndef GLX_MESA_swap_control
|
||||
#define GLX_MESA_swap_control 1
|
||||
|
||||
extern int glXSwapIntervalMESA(unsigned int interval);
|
||||
extern int glXGetSwapIntervalMESA(void);
|
||||
|
||||
typedef int (*PFNGLXSWAPINTERVALMESAPROC)(unsigned int interval);
|
||||
typedef int (*PFNGLXGETSWAPINTERVALMESAPROC)(void);
|
||||
|
||||
#endif /* GLX_MESA_swap_control */
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* #?. GLX_EXT_texture_from_pixmap
|
||||
* XXX not finished?
|
||||
*/
|
||||
#ifndef GLX_EXT_texture_from_pixmap
|
||||
#define GLX_EXT_texture_from_pixmap 1
|
||||
|
||||
#define GLX_BIND_TO_TEXTURE_RGB_EXT 0x20D0
|
||||
#define GLX_BIND_TO_TEXTURE_RGBA_EXT 0x20D1
|
||||
#define GLX_BIND_TO_MIPMAP_TEXTURE_EXT 0x20D2
|
||||
#define GLX_BIND_TO_TEXTURE_TARGETS_EXT 0x20D3
|
||||
#define GLX_Y_INVERTED_EXT 0x20D4
|
||||
|
||||
#define GLX_TEXTURE_FORMAT_EXT 0x20D5
|
||||
#define GLX_TEXTURE_TARGET_EXT 0x20D6
|
||||
#define GLX_MIPMAP_TEXTURE_EXT 0x20D7
|
||||
|
||||
#define GLX_TEXTURE_FORMAT_NONE_EXT 0x20D8
|
||||
#define GLX_TEXTURE_FORMAT_RGB_EXT 0x20D9
|
||||
#define GLX_TEXTURE_FORMAT_RGBA_EXT 0x20DA
|
||||
|
||||
#define GLX_TEXTURE_1D_BIT_EXT 0x00000001
|
||||
#define GLX_TEXTURE_2D_BIT_EXT 0x00000002
|
||||
#define GLX_TEXTURE_RECTANGLE_BIT_EXT 0x00000004
|
||||
|
||||
#define GLX_TEXTURE_1D_EXT 0x20DB
|
||||
#define GLX_TEXTURE_2D_EXT 0x20DC
|
||||
#define GLX_TEXTURE_RECTANGLE_EXT 0x20DD
|
||||
|
||||
#define GLX_FRONT_LEFT_EXT 0x20DE
|
||||
#define GLX_FRONT_RIGHT_EXT 0x20DF
|
||||
#define GLX_BACK_LEFT_EXT 0x20E0
|
||||
#define GLX_BACK_RIGHT_EXT 0x20E1
|
||||
#define GLX_FRONT_EXT GLX_FRONT_LEFT_EXT
|
||||
#define GLX_BACK_EXT GLX_BACK_LEFT_EXT
|
||||
#define GLX_AUX0_EXT 0x20E2
|
||||
#define GLX_AUX1_EXT 0x20E3
|
||||
#define GLX_AUX2_EXT 0x20E4
|
||||
#define GLX_AUX3_EXT 0x20E5
|
||||
#define GLX_AUX4_EXT 0x20E6
|
||||
#define GLX_AUX5_EXT 0x20E7
|
||||
#define GLX_AUX6_EXT 0x20E8
|
||||
#define GLX_AUX7_EXT 0x20E9
|
||||
#define GLX_AUX8_EXT 0x20EA
|
||||
#define GLX_AUX9_EXT 0x20EB
|
||||
|
||||
extern void glXBindTexImageEXT(Display *dpy, GLXDrawable drawable, int buffer, const int *attrib_list);
|
||||
extern void glXReleaseTexImageEXT(Display *dpy, GLXDrawable drawable, int buffer);
|
||||
|
||||
#endif /* GLX_EXT_texture_from_pixmap */
|
||||
|
||||
|
||||
|
||||
|
||||
/*** Should these go here, or in another header? */
|
||||
/*
|
||||
** GLX Events
|
||||
*/
|
||||
typedef struct {
|
||||
int event_type; /* GLX_DAMAGED or GLX_SAVED */
|
||||
int draw_type; /* GLX_WINDOW or GLX_PBUFFER */
|
||||
unsigned long serial; /* # of last request processed by server */
|
||||
Bool send_event; /* true if this came for SendEvent request */
|
||||
Display *display; /* display the event was read from */
|
||||
GLXDrawable drawable; /* XID of Drawable */
|
||||
unsigned int buffer_mask; /* mask indicating which buffers are affected */
|
||||
unsigned int aux_buffer; /* which aux buffer was affected */
|
||||
int x, y;
|
||||
int width, height;
|
||||
int count; /* if nonzero, at least this many more */
|
||||
} GLXPbufferClobberEvent;
|
||||
|
||||
typedef union __GLXEvent {
|
||||
GLXPbufferClobberEvent glxpbufferclobber;
|
||||
long pad[24];
|
||||
} GLXEvent;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -0,0 +1,933 @@
|
|||
#ifndef __glxext_h_
|
||||
#define __glxext_h_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Copyright (c) 2007-2009 The Khronos Group Inc.
|
||||
**
|
||||
** Permission is hereby granted, free of charge, to any person obtaining a
|
||||
** copy of this software and/or associated documentation files (the
|
||||
** "Materials"), to deal in the Materials without restriction, including
|
||||
** without limitation the rights to use, copy, modify, merge, publish,
|
||||
** distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
** permit persons to whom the Materials are furnished to do so, subject to
|
||||
** the following conditions:
|
||||
**
|
||||
** The above copyright notice and this permission notice shall be included
|
||||
** in all copies or substantial portions of the Materials.
|
||||
**
|
||||
** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
*/
|
||||
|
||||
/* Function declaration macros - to move into glplatform.h */
|
||||
|
||||
#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)
|
||||
#define WIN32_LEAN_AND_MEAN 1
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#ifndef APIENTRY
|
||||
#define APIENTRY
|
||||
#endif
|
||||
#ifndef APIENTRYP
|
||||
#define APIENTRYP APIENTRY *
|
||||
#endif
|
||||
#ifndef GLAPI
|
||||
#define GLAPI extern
|
||||
#endif
|
||||
|
||||
/*************************************************************/
|
||||
|
||||
/* Header file version number, required by OpenGL ABI for Linux */
|
||||
/* glxext.h last updated 2009/10/08 */
|
||||
/* Current version at http://www.opengl.org/registry/ */
|
||||
#define GLX_GLXEXT_VERSION 25
|
||||
|
||||
#ifndef GLX_VERSION_1_3
|
||||
#define GLX_WINDOW_BIT 0x00000001
|
||||
#define GLX_PIXMAP_BIT 0x00000002
|
||||
#define GLX_PBUFFER_BIT 0x00000004
|
||||
#define GLX_RGBA_BIT 0x00000001
|
||||
#define GLX_COLOR_INDEX_BIT 0x00000002
|
||||
#define GLX_PBUFFER_CLOBBER_MASK 0x08000000
|
||||
#define GLX_FRONT_LEFT_BUFFER_BIT 0x00000001
|
||||
#define GLX_FRONT_RIGHT_BUFFER_BIT 0x00000002
|
||||
#define GLX_BACK_LEFT_BUFFER_BIT 0x00000004
|
||||
#define GLX_BACK_RIGHT_BUFFER_BIT 0x00000008
|
||||
#define GLX_AUX_BUFFERS_BIT 0x00000010
|
||||
#define GLX_DEPTH_BUFFER_BIT 0x00000020
|
||||
#define GLX_STENCIL_BUFFER_BIT 0x00000040
|
||||
#define GLX_ACCUM_BUFFER_BIT 0x00000080
|
||||
#define GLX_CONFIG_CAVEAT 0x20
|
||||
#define GLX_X_VISUAL_TYPE 0x22
|
||||
#define GLX_TRANSPARENT_TYPE 0x23
|
||||
#define GLX_TRANSPARENT_INDEX_VALUE 0x24
|
||||
#define GLX_TRANSPARENT_RED_VALUE 0x25
|
||||
#define GLX_TRANSPARENT_GREEN_VALUE 0x26
|
||||
#define GLX_TRANSPARENT_BLUE_VALUE 0x27
|
||||
#define GLX_TRANSPARENT_ALPHA_VALUE 0x28
|
||||
#define GLX_DONT_CARE 0xFFFFFFFF
|
||||
#define GLX_NONE 0x8000
|
||||
#define GLX_SLOW_CONFIG 0x8001
|
||||
#define GLX_TRUE_COLOR 0x8002
|
||||
#define GLX_DIRECT_COLOR 0x8003
|
||||
#define GLX_PSEUDO_COLOR 0x8004
|
||||
#define GLX_STATIC_COLOR 0x8005
|
||||
#define GLX_GRAY_SCALE 0x8006
|
||||
#define GLX_STATIC_GRAY 0x8007
|
||||
#define GLX_TRANSPARENT_RGB 0x8008
|
||||
#define GLX_TRANSPARENT_INDEX 0x8009
|
||||
#define GLX_VISUAL_ID 0x800B
|
||||
#define GLX_SCREEN 0x800C
|
||||
#define GLX_NON_CONFORMANT_CONFIG 0x800D
|
||||
#define GLX_DRAWABLE_TYPE 0x8010
|
||||
#define GLX_RENDER_TYPE 0x8011
|
||||
#define GLX_X_RENDERABLE 0x8012
|
||||
#define GLX_FBCONFIG_ID 0x8013
|
||||
#define GLX_RGBA_TYPE 0x8014
|
||||
#define GLX_COLOR_INDEX_TYPE 0x8015
|
||||
#define GLX_MAX_PBUFFER_WIDTH 0x8016
|
||||
#define GLX_MAX_PBUFFER_HEIGHT 0x8017
|
||||
#define GLX_MAX_PBUFFER_PIXELS 0x8018
|
||||
#define GLX_PRESERVED_CONTENTS 0x801B
|
||||
#define GLX_LARGEST_PBUFFER 0x801C
|
||||
#define GLX_WIDTH 0x801D
|
||||
#define GLX_HEIGHT 0x801E
|
||||
#define GLX_EVENT_MASK 0x801F
|
||||
#define GLX_DAMAGED 0x8020
|
||||
#define GLX_SAVED 0x8021
|
||||
#define GLX_WINDOW 0x8022
|
||||
#define GLX_PBUFFER 0x8023
|
||||
#define GLX_PBUFFER_HEIGHT 0x8040
|
||||
#define GLX_PBUFFER_WIDTH 0x8041
|
||||
#endif
|
||||
|
||||
#ifndef GLX_VERSION_1_4
|
||||
#define GLX_SAMPLE_BUFFERS 100000
|
||||
#define GLX_SAMPLES 100001
|
||||
#endif
|
||||
|
||||
#ifndef GLX_ARB_get_proc_address
|
||||
#endif
|
||||
|
||||
#ifndef GLX_ARB_multisample
|
||||
#define GLX_SAMPLE_BUFFERS_ARB 100000
|
||||
#define GLX_SAMPLES_ARB 100001
|
||||
#endif
|
||||
|
||||
#ifndef GLX_ARB_fbconfig_float
|
||||
#define GLX_RGBA_FLOAT_TYPE_ARB 0x20B9
|
||||
#define GLX_RGBA_FLOAT_BIT_ARB 0x00000004
|
||||
#endif
|
||||
|
||||
#ifndef GLX_ARB_create_context
|
||||
#define GLX_CONTEXT_DEBUG_BIT_ARB 0x00000001
|
||||
#define GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x00000002
|
||||
#define GLX_CONTEXT_MAJOR_VERSION_ARB 0x2091
|
||||
#define GLX_CONTEXT_MINOR_VERSION_ARB 0x2092
|
||||
#define GLX_CONTEXT_FLAGS_ARB 0x2094
|
||||
#endif
|
||||
|
||||
#ifndef GLX_ARB_create_context_profile
|
||||
#define GLX_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001
|
||||
#define GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002
|
||||
#define GLX_CONTEXT_PROFILE_MASK_ARB 0x9126
|
||||
#endif
|
||||
|
||||
#ifndef GLX_SGIS_multisample
|
||||
#define GLX_SAMPLE_BUFFERS_SGIS 100000
|
||||
#define GLX_SAMPLES_SGIS 100001
|
||||
#endif
|
||||
|
||||
#ifndef GLX_EXT_visual_info
|
||||
#define GLX_X_VISUAL_TYPE_EXT 0x22
|
||||
#define GLX_TRANSPARENT_TYPE_EXT 0x23
|
||||
#define GLX_TRANSPARENT_INDEX_VALUE_EXT 0x24
|
||||
#define GLX_TRANSPARENT_RED_VALUE_EXT 0x25
|
||||
#define GLX_TRANSPARENT_GREEN_VALUE_EXT 0x26
|
||||
#define GLX_TRANSPARENT_BLUE_VALUE_EXT 0x27
|
||||
#define GLX_TRANSPARENT_ALPHA_VALUE_EXT 0x28
|
||||
#define GLX_NONE_EXT 0x8000
|
||||
#define GLX_TRUE_COLOR_EXT 0x8002
|
||||
#define GLX_DIRECT_COLOR_EXT 0x8003
|
||||
#define GLX_PSEUDO_COLOR_EXT 0x8004
|
||||
#define GLX_STATIC_COLOR_EXT 0x8005
|
||||
#define GLX_GRAY_SCALE_EXT 0x8006
|
||||
#define GLX_STATIC_GRAY_EXT 0x8007
|
||||
#define GLX_TRANSPARENT_RGB_EXT 0x8008
|
||||
#define GLX_TRANSPARENT_INDEX_EXT 0x8009
|
||||
#endif
|
||||
|
||||
#ifndef GLX_SGI_swap_control
|
||||
#endif
|
||||
|
||||
#ifndef GLX_SGI_video_sync
|
||||
#endif
|
||||
|
||||
#ifndef GLX_SGI_make_current_read
|
||||
#endif
|
||||
|
||||
#ifndef GLX_SGIX_video_source
|
||||
#endif
|
||||
|
||||
#ifndef GLX_EXT_visual_rating
|
||||
#define GLX_VISUAL_CAVEAT_EXT 0x20
|
||||
#define GLX_SLOW_VISUAL_EXT 0x8001
|
||||
#define GLX_NON_CONFORMANT_VISUAL_EXT 0x800D
|
||||
/* reuse GLX_NONE_EXT */
|
||||
#endif
|
||||
|
||||
#ifndef GLX_EXT_import_context
|
||||
#define GLX_SHARE_CONTEXT_EXT 0x800A
|
||||
#define GLX_VISUAL_ID_EXT 0x800B
|
||||
#define GLX_SCREEN_EXT 0x800C
|
||||
#endif
|
||||
|
||||
#ifndef GLX_SGIX_fbconfig
|
||||
#define GLX_WINDOW_BIT_SGIX 0x00000001
|
||||
#define GLX_PIXMAP_BIT_SGIX 0x00000002
|
||||
#define GLX_RGBA_BIT_SGIX 0x00000001
|
||||
#define GLX_COLOR_INDEX_BIT_SGIX 0x00000002
|
||||
#define GLX_DRAWABLE_TYPE_SGIX 0x8010
|
||||
#define GLX_RENDER_TYPE_SGIX 0x8011
|
||||
#define GLX_X_RENDERABLE_SGIX 0x8012
|
||||
#define GLX_FBCONFIG_ID_SGIX 0x8013
|
||||
#define GLX_RGBA_TYPE_SGIX 0x8014
|
||||
#define GLX_COLOR_INDEX_TYPE_SGIX 0x8015
|
||||
/* reuse GLX_SCREEN_EXT */
|
||||
#endif
|
||||
|
||||
#ifndef GLX_SGIX_pbuffer
|
||||
#define GLX_PBUFFER_BIT_SGIX 0x00000004
|
||||
#define GLX_BUFFER_CLOBBER_MASK_SGIX 0x08000000
|
||||
#define GLX_FRONT_LEFT_BUFFER_BIT_SGIX 0x00000001
|
||||
#define GLX_FRONT_RIGHT_BUFFER_BIT_SGIX 0x00000002
|
||||
#define GLX_BACK_LEFT_BUFFER_BIT_SGIX 0x00000004
|
||||
#define GLX_BACK_RIGHT_BUFFER_BIT_SGIX 0x00000008
|
||||
#define GLX_AUX_BUFFERS_BIT_SGIX 0x00000010
|
||||
#define GLX_DEPTH_BUFFER_BIT_SGIX 0x00000020
|
||||
#define GLX_STENCIL_BUFFER_BIT_SGIX 0x00000040
|
||||
#define GLX_ACCUM_BUFFER_BIT_SGIX 0x00000080
|
||||
#define GLX_SAMPLE_BUFFERS_BIT_SGIX 0x00000100
|
||||
#define GLX_MAX_PBUFFER_WIDTH_SGIX 0x8016
|
||||
#define GLX_MAX_PBUFFER_HEIGHT_SGIX 0x8017
|
||||
#define GLX_MAX_PBUFFER_PIXELS_SGIX 0x8018
|
||||
#define GLX_OPTIMAL_PBUFFER_WIDTH_SGIX 0x8019
|
||||
#define GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX 0x801A
|
||||
#define GLX_PRESERVED_CONTENTS_SGIX 0x801B
|
||||
#define GLX_LARGEST_PBUFFER_SGIX 0x801C
|
||||
#define GLX_WIDTH_SGIX 0x801D
|
||||
#define GLX_HEIGHT_SGIX 0x801E
|
||||
#define GLX_EVENT_MASK_SGIX 0x801F
|
||||
#define GLX_DAMAGED_SGIX 0x8020
|
||||
#define GLX_SAVED_SGIX 0x8021
|
||||
#define GLX_WINDOW_SGIX 0x8022
|
||||
#define GLX_PBUFFER_SGIX 0x8023
|
||||
#endif
|
||||
|
||||
#ifndef GLX_SGI_cushion
|
||||
#endif
|
||||
|
||||
#ifndef GLX_SGIX_video_resize
|
||||
#define GLX_SYNC_FRAME_SGIX 0x00000000
|
||||
#define GLX_SYNC_SWAP_SGIX 0x00000001
|
||||
#endif
|
||||
|
||||
#ifndef GLX_SGIX_dmbuffer
|
||||
#define GLX_DIGITAL_MEDIA_PBUFFER_SGIX 0x8024
|
||||
#endif
|
||||
|
||||
#ifndef GLX_SGIX_swap_group
|
||||
#endif
|
||||
|
||||
#ifndef GLX_SGIX_swap_barrier
|
||||
#endif
|
||||
|
||||
#ifndef GLX_SGIS_blended_overlay
|
||||
#define GLX_BLENDED_RGBA_SGIS 0x8025
|
||||
#endif
|
||||
|
||||
#ifndef GLX_SGIS_shared_multisample
|
||||
#define GLX_MULTISAMPLE_SUB_RECT_WIDTH_SGIS 0x8026
|
||||
#define GLX_MULTISAMPLE_SUB_RECT_HEIGHT_SGIS 0x8027
|
||||
#endif
|
||||
|
||||
#ifndef GLX_SUN_get_transparent_index
|
||||
#endif
|
||||
|
||||
#ifndef GLX_3DFX_multisample
|
||||
#define GLX_SAMPLE_BUFFERS_3DFX 0x8050
|
||||
#define GLX_SAMPLES_3DFX 0x8051
|
||||
#endif
|
||||
|
||||
#ifndef GLX_MESA_copy_sub_buffer
|
||||
#endif
|
||||
|
||||
#ifndef GLX_MESA_pixmap_colormap
|
||||
#endif
|
||||
|
||||
#ifndef GLX_MESA_release_buffers
|
||||
#endif
|
||||
|
||||
#ifndef GLX_MESA_set_3dfx_mode
|
||||
#define GLX_3DFX_WINDOW_MODE_MESA 0x1
|
||||
#define GLX_3DFX_FULLSCREEN_MODE_MESA 0x2
|
||||
#endif
|
||||
|
||||
#ifndef GLX_SGIX_visual_select_group
|
||||
#define GLX_VISUAL_SELECT_GROUP_SGIX 0x8028
|
||||
#endif
|
||||
|
||||
#ifndef GLX_OML_swap_method
|
||||
#define GLX_SWAP_METHOD_OML 0x8060
|
||||
#define GLX_SWAP_EXCHANGE_OML 0x8061
|
||||
#define GLX_SWAP_COPY_OML 0x8062
|
||||
#define GLX_SWAP_UNDEFINED_OML 0x8063
|
||||
#endif
|
||||
|
||||
#ifndef GLX_OML_sync_control
|
||||
#endif
|
||||
|
||||
#ifndef GLX_NV_float_buffer
|
||||
#define GLX_FLOAT_COMPONENTS_NV 0x20B0
|
||||
#endif
|
||||
|
||||
#ifndef GLX_SGIX_hyperpipe
|
||||
#define GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX 80
|
||||
#define GLX_BAD_HYPERPIPE_CONFIG_SGIX 91
|
||||
#define GLX_BAD_HYPERPIPE_SGIX 92
|
||||
#define GLX_HYPERPIPE_DISPLAY_PIPE_SGIX 0x00000001
|
||||
#define GLX_HYPERPIPE_RENDER_PIPE_SGIX 0x00000002
|
||||
#define GLX_PIPE_RECT_SGIX 0x00000001
|
||||
#define GLX_PIPE_RECT_LIMITS_SGIX 0x00000002
|
||||
#define GLX_HYPERPIPE_STEREO_SGIX 0x00000003
|
||||
#define GLX_HYPERPIPE_PIXEL_AVERAGE_SGIX 0x00000004
|
||||
#define GLX_HYPERPIPE_ID_SGIX 0x8030
|
||||
#endif
|
||||
|
||||
#ifndef GLX_MESA_agp_offset
|
||||
#endif
|
||||
|
||||
#ifndef GLX_EXT_fbconfig_packed_float
|
||||
#define GLX_RGBA_UNSIGNED_FLOAT_TYPE_EXT 0x20B1
|
||||
#define GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT 0x00000008
|
||||
#endif
|
||||
|
||||
#ifndef GLX_EXT_framebuffer_sRGB
|
||||
#define GLX_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x20B2
|
||||
#endif
|
||||
|
||||
#ifndef GLX_EXT_texture_from_pixmap
|
||||
#define GLX_TEXTURE_1D_BIT_EXT 0x00000001
|
||||
#define GLX_TEXTURE_2D_BIT_EXT 0x00000002
|
||||
#define GLX_TEXTURE_RECTANGLE_BIT_EXT 0x00000004
|
||||
#define GLX_BIND_TO_TEXTURE_RGB_EXT 0x20D0
|
||||
#define GLX_BIND_TO_TEXTURE_RGBA_EXT 0x20D1
|
||||
#define GLX_BIND_TO_MIPMAP_TEXTURE_EXT 0x20D2
|
||||
#define GLX_BIND_TO_TEXTURE_TARGETS_EXT 0x20D3
|
||||
#define GLX_Y_INVERTED_EXT 0x20D4
|
||||
#define GLX_TEXTURE_FORMAT_EXT 0x20D5
|
||||
#define GLX_TEXTURE_TARGET_EXT 0x20D6
|
||||
#define GLX_MIPMAP_TEXTURE_EXT 0x20D7
|
||||
#define GLX_TEXTURE_FORMAT_NONE_EXT 0x20D8
|
||||
#define GLX_TEXTURE_FORMAT_RGB_EXT 0x20D9
|
||||
#define GLX_TEXTURE_FORMAT_RGBA_EXT 0x20DA
|
||||
#define GLX_TEXTURE_1D_EXT 0x20DB
|
||||
#define GLX_TEXTURE_2D_EXT 0x20DC
|
||||
#define GLX_TEXTURE_RECTANGLE_EXT 0x20DD
|
||||
#define GLX_FRONT_LEFT_EXT 0x20DE
|
||||
#define GLX_FRONT_RIGHT_EXT 0x20DF
|
||||
#define GLX_BACK_LEFT_EXT 0x20E0
|
||||
#define GLX_BACK_RIGHT_EXT 0x20E1
|
||||
#define GLX_FRONT_EXT GLX_FRONT_LEFT_EXT
|
||||
#define GLX_BACK_EXT GLX_BACK_LEFT_EXT
|
||||
#define GLX_AUX0_EXT 0x20E2
|
||||
#define GLX_AUX1_EXT 0x20E3
|
||||
#define GLX_AUX2_EXT 0x20E4
|
||||
#define GLX_AUX3_EXT 0x20E5
|
||||
#define GLX_AUX4_EXT 0x20E6
|
||||
#define GLX_AUX5_EXT 0x20E7
|
||||
#define GLX_AUX6_EXT 0x20E8
|
||||
#define GLX_AUX7_EXT 0x20E9
|
||||
#define GLX_AUX8_EXT 0x20EA
|
||||
#define GLX_AUX9_EXT 0x20EB
|
||||
#endif
|
||||
|
||||
#ifndef GLX_NV_present_video
|
||||
#define GLX_NUM_VIDEO_SLOTS_NV 0x20F0
|
||||
#endif
|
||||
|
||||
#ifndef GLX_NV_video_out
|
||||
#define GLX_VIDEO_OUT_COLOR_NV 0x20C3
|
||||
#define GLX_VIDEO_OUT_ALPHA_NV 0x20C4
|
||||
#define GLX_VIDEO_OUT_DEPTH_NV 0x20C5
|
||||
#define GLX_VIDEO_OUT_COLOR_AND_ALPHA_NV 0x20C6
|
||||
#define GLX_VIDEO_OUT_COLOR_AND_DEPTH_NV 0x20C7
|
||||
#define GLX_VIDEO_OUT_FRAME_NV 0x20C8
|
||||
#define GLX_VIDEO_OUT_FIELD_1_NV 0x20C9
|
||||
#define GLX_VIDEO_OUT_FIELD_2_NV 0x20CA
|
||||
#define GLX_VIDEO_OUT_STACKED_FIELDS_1_2_NV 0x20CB
|
||||
#define GLX_VIDEO_OUT_STACKED_FIELDS_2_1_NV 0x20CC
|
||||
#endif
|
||||
|
||||
#ifndef GLX_NV_swap_group
|
||||
#endif
|
||||
|
||||
#ifndef GLX_NV_video_capture
|
||||
#define GLX_DEVICE_ID_NV 0x20CD
|
||||
#define GLX_UNIQUE_ID_NV 0x20CE
|
||||
#define GLX_NUM_VIDEO_CAPTURE_SLOTS_NV 0x20CF
|
||||
#endif
|
||||
|
||||
#ifndef GLX_EXT_swap_control
|
||||
#define GLX_SWAP_INTERVAL_EXT 0x20F1
|
||||
#define GLX_MAX_SWAP_INTERVAL_EXT 0x20F2
|
||||
#endif
|
||||
|
||||
#ifndef GLX_NV_copy_image
|
||||
#endif
|
||||
|
||||
|
||||
/*************************************************************/
|
||||
|
||||
#ifndef GLX_ARB_get_proc_address
|
||||
typedef void (*__GLXextFuncPtr)(void);
|
||||
#endif
|
||||
|
||||
#ifndef GLX_SGIX_video_source
|
||||
typedef XID GLXVideoSourceSGIX;
|
||||
#endif
|
||||
|
||||
#ifndef GLX_SGIX_fbconfig
|
||||
typedef XID GLXFBConfigIDSGIX;
|
||||
typedef struct __GLXFBConfigRec *GLXFBConfigSGIX;
|
||||
#endif
|
||||
|
||||
#ifndef GLX_SGIX_pbuffer
|
||||
typedef XID GLXPbufferSGIX;
|
||||
typedef struct {
|
||||
int type;
|
||||
unsigned long serial; /* # of last request processed by server */
|
||||
Bool send_event; /* true if this came for SendEvent request */
|
||||
Display *display; /* display the event was read from */
|
||||
GLXDrawable drawable; /* i.d. of Drawable */
|
||||
int event_type; /* GLX_DAMAGED_SGIX or GLX_SAVED_SGIX */
|
||||
int draw_type; /* GLX_WINDOW_SGIX or GLX_PBUFFER_SGIX */
|
||||
unsigned int mask; /* mask indicating which buffers are affected*/
|
||||
int x, y;
|
||||
int width, height;
|
||||
int count; /* if nonzero, at least this many more */
|
||||
} GLXBufferClobberEventSGIX;
|
||||
#endif
|
||||
|
||||
#ifndef GLX_NV_video_output
|
||||
typedef unsigned int GLXVideoDeviceNV;
|
||||
#endif
|
||||
|
||||
#ifndef GLX_NV_video_capture
|
||||
typedef XID GLXVideoCaptureDeviceNV;
|
||||
#endif
|
||||
|
||||
#ifndef GLEXT_64_TYPES_DEFINED
|
||||
/* This code block is duplicated in glext.h, so must be protected */
|
||||
#define GLEXT_64_TYPES_DEFINED
|
||||
/* Define int32_t, int64_t, and uint64_t types for UST/MSC */
|
||||
/* (as used in the GLX_OML_sync_control extension). */
|
||||
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
|
||||
#include <inttypes.h>
|
||||
#elif defined(__sun__) || defined(__digital__)
|
||||
#include <inttypes.h>
|
||||
#if defined(__STDC__)
|
||||
#if defined(__arch64__) || defined(_LP64)
|
||||
typedef long int int64_t;
|
||||
typedef unsigned long int uint64_t;
|
||||
#else
|
||||
typedef long long int int64_t;
|
||||
typedef unsigned long long int uint64_t;
|
||||
#endif /* __arch64__ */
|
||||
#endif /* __STDC__ */
|
||||
#elif defined( __VMS ) || defined(__sgi)
|
||||
#include <inttypes.h>
|
||||
#elif defined(__SCO__) || defined(__USLC__)
|
||||
#include <stdint.h>
|
||||
#elif defined(__UNIXOS2__) || defined(__SOL64__)
|
||||
typedef long int int32_t;
|
||||
typedef long long int int64_t;
|
||||
typedef unsigned long long int uint64_t;
|
||||
#elif defined(_WIN32) && defined(__GNUC__)
|
||||
#include <stdint.h>
|
||||
#elif defined(_WIN32)
|
||||
typedef __int32 int32_t;
|
||||
typedef __int64 int64_t;
|
||||
typedef unsigned __int64 uint64_t;
|
||||
#else
|
||||
#include <inttypes.h> /* Fallback option */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef GLX_VERSION_1_3
|
||||
#define GLX_VERSION_1_3 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern GLXFBConfig * glXGetFBConfigs (Display *, int, int *);
|
||||
extern GLXFBConfig * glXChooseFBConfig (Display *, int, const int *, int *);
|
||||
extern int glXGetFBConfigAttrib (Display *, GLXFBConfig, int, int *);
|
||||
extern XVisualInfo * glXGetVisualFromFBConfig (Display *, GLXFBConfig);
|
||||
extern GLXWindow glXCreateWindow (Display *, GLXFBConfig, Window, const int *);
|
||||
extern void glXDestroyWindow (Display *, GLXWindow);
|
||||
extern GLXPixmap glXCreatePixmap (Display *, GLXFBConfig, Pixmap, const int *);
|
||||
extern void glXDestroyPixmap (Display *, GLXPixmap);
|
||||
extern GLXPbuffer glXCreatePbuffer (Display *, GLXFBConfig, const int *);
|
||||
extern void glXDestroyPbuffer (Display *, GLXPbuffer);
|
||||
extern void glXQueryDrawable (Display *, GLXDrawable, int, unsigned int *);
|
||||
extern GLXContext glXCreateNewContext (Display *, GLXFBConfig, int, GLXContext, Bool);
|
||||
extern Bool glXMakeContextCurrent (Display *, GLXDrawable, GLXDrawable, GLXContext);
|
||||
extern GLXDrawable glXGetCurrentReadDrawable (void);
|
||||
extern Display * glXGetCurrentDisplay (void);
|
||||
extern int glXQueryContext (Display *, GLXContext, int, int *);
|
||||
extern void glXSelectEvent (Display *, GLXDrawable, unsigned long);
|
||||
extern void glXGetSelectedEvent (Display *, GLXDrawable, unsigned long *);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef GLXFBConfig * ( * PFNGLXGETFBCONFIGSPROC) (Display *dpy, int screen, int *nelements);
|
||||
typedef GLXFBConfig * ( * PFNGLXCHOOSEFBCONFIGPROC) (Display *dpy, int screen, const int *attrib_list, int *nelements);
|
||||
typedef int ( * PFNGLXGETFBCONFIGATTRIBPROC) (Display *dpy, GLXFBConfig config, int attribute, int *value);
|
||||
typedef XVisualInfo * ( * PFNGLXGETVISUALFROMFBCONFIGPROC) (Display *dpy, GLXFBConfig config);
|
||||
typedef GLXWindow ( * PFNGLXCREATEWINDOWPROC) (Display *dpy, GLXFBConfig config, Window win, const int *attrib_list);
|
||||
typedef void ( * PFNGLXDESTROYWINDOWPROC) (Display *dpy, GLXWindow win);
|
||||
typedef GLXPixmap ( * PFNGLXCREATEPIXMAPPROC) (Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attrib_list);
|
||||
typedef void ( * PFNGLXDESTROYPIXMAPPROC) (Display *dpy, GLXPixmap pixmap);
|
||||
typedef GLXPbuffer ( * PFNGLXCREATEPBUFFERPROC) (Display *dpy, GLXFBConfig config, const int *attrib_list);
|
||||
typedef void ( * PFNGLXDESTROYPBUFFERPROC) (Display *dpy, GLXPbuffer pbuf);
|
||||
typedef void ( * PFNGLXQUERYDRAWABLEPROC) (Display *dpy, GLXDrawable draw, int attribute, unsigned int *value);
|
||||
typedef GLXContext ( * PFNGLXCREATENEWCONTEXTPROC) (Display *dpy, GLXFBConfig config, int render_type, GLXContext share_list, Bool direct);
|
||||
typedef Bool ( * PFNGLXMAKECONTEXTCURRENTPROC) (Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx);
|
||||
typedef GLXDrawable ( * PFNGLXGETCURRENTREADDRAWABLEPROC) (void);
|
||||
typedef Display * ( * PFNGLXGETCURRENTDISPLAYPROC) (void);
|
||||
typedef int ( * PFNGLXQUERYCONTEXTPROC) (Display *dpy, GLXContext ctx, int attribute, int *value);
|
||||
typedef void ( * PFNGLXSELECTEVENTPROC) (Display *dpy, GLXDrawable draw, unsigned long event_mask);
|
||||
typedef void ( * PFNGLXGETSELECTEDEVENTPROC) (Display *dpy, GLXDrawable draw, unsigned long *event_mask);
|
||||
#endif
|
||||
|
||||
#ifndef GLX_VERSION_1_4
|
||||
#define GLX_VERSION_1_4 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern __GLXextFuncPtr glXGetProcAddress (const GLubyte *);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef __GLXextFuncPtr ( * PFNGLXGETPROCADDRESSPROC) (const GLubyte *procName);
|
||||
#endif
|
||||
|
||||
#ifndef GLX_ARB_get_proc_address
|
||||
#define GLX_ARB_get_proc_address 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern __GLXextFuncPtr glXGetProcAddressARB (const GLubyte *);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef __GLXextFuncPtr ( * PFNGLXGETPROCADDRESSARBPROC) (const GLubyte *procName);
|
||||
#endif
|
||||
|
||||
#ifndef GLX_ARB_multisample
|
||||
#define GLX_ARB_multisample 1
|
||||
#endif
|
||||
|
||||
#ifndef GLX_ARB_fbconfig_float
|
||||
#define GLX_ARB_fbconfig_float 1
|
||||
#endif
|
||||
|
||||
#ifndef GLX_ARB_create_context
|
||||
#define GLX_ARB_create_context 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern GLXContext glXCreateContextAttribsARB (Display *, GLXFBConfig, GLXContext, Bool, const int *);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef GLXContext ( * PFNGLXCREATECONTEXTATTRIBSARBPROC) (Display *dpy, GLXFBConfig config, GLXContext share_context, Bool direct, const int *attrib_list);
|
||||
#endif
|
||||
|
||||
#ifndef GLX_ARB_create_context_profile
|
||||
#define GLX_ARB_create_context_profile 1
|
||||
#endif
|
||||
|
||||
#ifndef GLX_SGIS_multisample
|
||||
#define GLX_SGIS_multisample 1
|
||||
#endif
|
||||
|
||||
#ifndef GLX_EXT_visual_info
|
||||
#define GLX_EXT_visual_info 1
|
||||
#endif
|
||||
|
||||
#ifndef GLX_SGI_swap_control
|
||||
#define GLX_SGI_swap_control 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern int glXSwapIntervalSGI (int);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef int ( * PFNGLXSWAPINTERVALSGIPROC) (int interval);
|
||||
#endif
|
||||
|
||||
#ifndef GLX_SGI_video_sync
|
||||
#define GLX_SGI_video_sync 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern int glXGetVideoSyncSGI (unsigned int *);
|
||||
extern int glXWaitVideoSyncSGI (int, int, unsigned int *);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef int ( * PFNGLXGETVIDEOSYNCSGIPROC) (unsigned int *count);
|
||||
typedef int ( * PFNGLXWAITVIDEOSYNCSGIPROC) (int divisor, int remainder, unsigned int *count);
|
||||
#endif
|
||||
|
||||
#ifndef GLX_SGI_make_current_read
|
||||
#define GLX_SGI_make_current_read 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern Bool glXMakeCurrentReadSGI (Display *, GLXDrawable, GLXDrawable, GLXContext);
|
||||
extern GLXDrawable glXGetCurrentReadDrawableSGI (void);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef Bool ( * PFNGLXMAKECURRENTREADSGIPROC) (Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx);
|
||||
typedef GLXDrawable ( * PFNGLXGETCURRENTREADDRAWABLESGIPROC) (void);
|
||||
#endif
|
||||
|
||||
#ifndef GLX_SGIX_video_source
|
||||
#define GLX_SGIX_video_source 1
|
||||
#ifdef _VL_H
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern GLXVideoSourceSGIX glXCreateGLXVideoSourceSGIX (Display *, int, VLServer, VLPath, int, VLNode);
|
||||
extern void glXDestroyGLXVideoSourceSGIX (Display *, GLXVideoSourceSGIX);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef GLXVideoSourceSGIX ( * PFNGLXCREATEGLXVIDEOSOURCESGIXPROC) (Display *display, int screen, VLServer server, VLPath path, int nodeClass, VLNode drainNode);
|
||||
typedef void ( * PFNGLXDESTROYGLXVIDEOSOURCESGIXPROC) (Display *dpy, GLXVideoSourceSGIX glxvideosource);
|
||||
#endif /* _VL_H */
|
||||
#endif
|
||||
|
||||
#ifndef GLX_EXT_visual_rating
|
||||
#define GLX_EXT_visual_rating 1
|
||||
#endif
|
||||
|
||||
#ifndef GLX_EXT_import_context
|
||||
#define GLX_EXT_import_context 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern Display * glXGetCurrentDisplayEXT (void);
|
||||
extern int glXQueryContextInfoEXT (Display *, GLXContext, int, int *);
|
||||
extern GLXContextID glXGetContextIDEXT (const GLXContext);
|
||||
extern GLXContext glXImportContextEXT (Display *, GLXContextID);
|
||||
extern void glXFreeContextEXT (Display *, GLXContext);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef Display * ( * PFNGLXGETCURRENTDISPLAYEXTPROC) (void);
|
||||
typedef int ( * PFNGLXQUERYCONTEXTINFOEXTPROC) (Display *dpy, GLXContext context, int attribute, int *value);
|
||||
typedef GLXContextID ( * PFNGLXGETCONTEXTIDEXTPROC) (const GLXContext context);
|
||||
typedef GLXContext ( * PFNGLXIMPORTCONTEXTEXTPROC) (Display *dpy, GLXContextID contextID);
|
||||
typedef void ( * PFNGLXFREECONTEXTEXTPROC) (Display *dpy, GLXContext context);
|
||||
#endif
|
||||
|
||||
#ifndef GLX_SGIX_fbconfig
|
||||
#define GLX_SGIX_fbconfig 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern int glXGetFBConfigAttribSGIX (Display *, GLXFBConfigSGIX, int, int *);
|
||||
extern GLXFBConfigSGIX * glXChooseFBConfigSGIX (Display *, int, int *, int *);
|
||||
extern GLXPixmap glXCreateGLXPixmapWithConfigSGIX (Display *, GLXFBConfigSGIX, Pixmap);
|
||||
extern GLXContext glXCreateContextWithConfigSGIX (Display *, GLXFBConfigSGIX, int, GLXContext, Bool);
|
||||
extern XVisualInfo * glXGetVisualFromFBConfigSGIX (Display *, GLXFBConfigSGIX);
|
||||
extern GLXFBConfigSGIX glXGetFBConfigFromVisualSGIX (Display *, XVisualInfo *);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef int ( * PFNGLXGETFBCONFIGATTRIBSGIXPROC) (Display *dpy, GLXFBConfigSGIX config, int attribute, int *value);
|
||||
typedef GLXFBConfigSGIX * ( * PFNGLXCHOOSEFBCONFIGSGIXPROC) (Display *dpy, int screen, int *attrib_list, int *nelements);
|
||||
typedef GLXPixmap ( * PFNGLXCREATEGLXPIXMAPWITHCONFIGSGIXPROC) (Display *dpy, GLXFBConfigSGIX config, Pixmap pixmap);
|
||||
typedef GLXContext ( * PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC) (Display *dpy, GLXFBConfigSGIX config, int render_type, GLXContext share_list, Bool direct);
|
||||
typedef XVisualInfo * ( * PFNGLXGETVISUALFROMFBCONFIGSGIXPROC) (Display *dpy, GLXFBConfigSGIX config);
|
||||
typedef GLXFBConfigSGIX ( * PFNGLXGETFBCONFIGFROMVISUALSGIXPROC) (Display *dpy, XVisualInfo *vis);
|
||||
#endif
|
||||
|
||||
#ifndef GLX_SGIX_pbuffer
|
||||
#define GLX_SGIX_pbuffer 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern GLXPbufferSGIX glXCreateGLXPbufferSGIX (Display *, GLXFBConfigSGIX, unsigned int, unsigned int, int *);
|
||||
extern void glXDestroyGLXPbufferSGIX (Display *, GLXPbufferSGIX);
|
||||
extern int glXQueryGLXPbufferSGIX (Display *, GLXPbufferSGIX, int, unsigned int *);
|
||||
extern void glXSelectEventSGIX (Display *, GLXDrawable, unsigned long);
|
||||
extern void glXGetSelectedEventSGIX (Display *, GLXDrawable, unsigned long *);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef GLXPbufferSGIX ( * PFNGLXCREATEGLXPBUFFERSGIXPROC) (Display *dpy, GLXFBConfigSGIX config, unsigned int width, unsigned int height, int *attrib_list);
|
||||
typedef void ( * PFNGLXDESTROYGLXPBUFFERSGIXPROC) (Display *dpy, GLXPbufferSGIX pbuf);
|
||||
typedef int ( * PFNGLXQUERYGLXPBUFFERSGIXPROC) (Display *dpy, GLXPbufferSGIX pbuf, int attribute, unsigned int *value);
|
||||
typedef void ( * PFNGLXSELECTEVENTSGIXPROC) (Display *dpy, GLXDrawable drawable, unsigned long mask);
|
||||
typedef void ( * PFNGLXGETSELECTEDEVENTSGIXPROC) (Display *dpy, GLXDrawable drawable, unsigned long *mask);
|
||||
#endif
|
||||
|
||||
#ifndef GLX_SGI_cushion
|
||||
#define GLX_SGI_cushion 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern void glXCushionSGI (Display *, Window, float);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef void ( * PFNGLXCUSHIONSGIPROC) (Display *dpy, Window window, float cushion);
|
||||
#endif
|
||||
|
||||
#ifndef GLX_SGIX_video_resize
|
||||
#define GLX_SGIX_video_resize 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern int glXBindChannelToWindowSGIX (Display *, int, int, Window);
|
||||
extern int glXChannelRectSGIX (Display *, int, int, int, int, int, int);
|
||||
extern int glXQueryChannelRectSGIX (Display *, int, int, int *, int *, int *, int *);
|
||||
extern int glXQueryChannelDeltasSGIX (Display *, int, int, int *, int *, int *, int *);
|
||||
extern int glXChannelRectSyncSGIX (Display *, int, int, GLenum);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef int ( * PFNGLXBINDCHANNELTOWINDOWSGIXPROC) (Display *display, int screen, int channel, Window window);
|
||||
typedef int ( * PFNGLXCHANNELRECTSGIXPROC) (Display *display, int screen, int channel, int x, int y, int w, int h);
|
||||
typedef int ( * PFNGLXQUERYCHANNELRECTSGIXPROC) (Display *display, int screen, int channel, int *dx, int *dy, int *dw, int *dh);
|
||||
typedef int ( * PFNGLXQUERYCHANNELDELTASSGIXPROC) (Display *display, int screen, int channel, int *x, int *y, int *w, int *h);
|
||||
typedef int ( * PFNGLXCHANNELRECTSYNCSGIXPROC) (Display *display, int screen, int channel, GLenum synctype);
|
||||
#endif
|
||||
|
||||
#ifndef GLX_SGIX_dmbuffer
|
||||
#define GLX_SGIX_dmbuffer 1
|
||||
#ifdef _DM_BUFFER_H_
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern Bool glXAssociateDMPbufferSGIX (Display *, GLXPbufferSGIX, DMparams *, DMbuffer);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef Bool ( * PFNGLXASSOCIATEDMPBUFFERSGIXPROC) (Display *dpy, GLXPbufferSGIX pbuffer, DMparams *params, DMbuffer dmbuffer);
|
||||
#endif /* _DM_BUFFER_H_ */
|
||||
#endif
|
||||
|
||||
#ifndef GLX_SGIX_swap_group
|
||||
#define GLX_SGIX_swap_group 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern void glXJoinSwapGroupSGIX (Display *, GLXDrawable, GLXDrawable);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef void ( * PFNGLXJOINSWAPGROUPSGIXPROC) (Display *dpy, GLXDrawable drawable, GLXDrawable member);
|
||||
#endif
|
||||
|
||||
#ifndef GLX_SGIX_swap_barrier
|
||||
#define GLX_SGIX_swap_barrier 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern void glXBindSwapBarrierSGIX (Display *, GLXDrawable, int);
|
||||
extern Bool glXQueryMaxSwapBarriersSGIX (Display *, int, int *);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef void ( * PFNGLXBINDSWAPBARRIERSGIXPROC) (Display *dpy, GLXDrawable drawable, int barrier);
|
||||
typedef Bool ( * PFNGLXQUERYMAXSWAPBARRIERSSGIXPROC) (Display *dpy, int screen, int *max);
|
||||
#endif
|
||||
|
||||
#ifndef GLX_SUN_get_transparent_index
|
||||
#define GLX_SUN_get_transparent_index 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern Status glXGetTransparentIndexSUN (Display *, Window, Window, long *);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef Status ( * PFNGLXGETTRANSPARENTINDEXSUNPROC) (Display *dpy, Window overlay, Window underlay, long *pTransparentIndex);
|
||||
#endif
|
||||
|
||||
#ifndef GLX_MESA_copy_sub_buffer
|
||||
#define GLX_MESA_copy_sub_buffer 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern void glXCopySubBufferMESA (Display *, GLXDrawable, int, int, int, int);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef void ( * PFNGLXCOPYSUBBUFFERMESAPROC) (Display *dpy, GLXDrawable drawable, int x, int y, int width, int height);
|
||||
#endif
|
||||
|
||||
#ifndef GLX_MESA_pixmap_colormap
|
||||
#define GLX_MESA_pixmap_colormap 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern GLXPixmap glXCreateGLXPixmapMESA (Display *, XVisualInfo *, Pixmap, Colormap);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef GLXPixmap ( * PFNGLXCREATEGLXPIXMAPMESAPROC) (Display *dpy, XVisualInfo *visual, Pixmap pixmap, Colormap cmap);
|
||||
#endif
|
||||
|
||||
#ifndef GLX_MESA_release_buffers
|
||||
#define GLX_MESA_release_buffers 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern Bool glXReleaseBuffersMESA (Display *, GLXDrawable);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef Bool ( * PFNGLXRELEASEBUFFERSMESAPROC) (Display *dpy, GLXDrawable drawable);
|
||||
#endif
|
||||
|
||||
#ifndef GLX_MESA_set_3dfx_mode
|
||||
#define GLX_MESA_set_3dfx_mode 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern Bool glXSet3DfxModeMESA (int);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef Bool ( * PFNGLXSET3DFXMODEMESAPROC) (int mode);
|
||||
#endif
|
||||
|
||||
#ifndef GLX_SGIX_visual_select_group
|
||||
#define GLX_SGIX_visual_select_group 1
|
||||
#endif
|
||||
|
||||
#ifndef GLX_OML_swap_method
|
||||
#define GLX_OML_swap_method 1
|
||||
#endif
|
||||
|
||||
#ifndef GLX_OML_sync_control
|
||||
#define GLX_OML_sync_control 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern Bool glXGetSyncValuesOML (Display *, GLXDrawable, int64_t *, int64_t *, int64_t *);
|
||||
extern Bool glXGetMscRateOML (Display *, GLXDrawable, int32_t *, int32_t *);
|
||||
extern int64_t glXSwapBuffersMscOML (Display *, GLXDrawable, int64_t, int64_t, int64_t);
|
||||
extern Bool glXWaitForMscOML (Display *, GLXDrawable, int64_t, int64_t, int64_t, int64_t *, int64_t *, int64_t *);
|
||||
extern Bool glXWaitForSbcOML (Display *, GLXDrawable, int64_t, int64_t *, int64_t *, int64_t *);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef Bool ( * PFNGLXGETSYNCVALUESOMLPROC) (Display *dpy, GLXDrawable drawable, int64_t *ust, int64_t *msc, int64_t *sbc);
|
||||
typedef Bool ( * PFNGLXGETMSCRATEOMLPROC) (Display *dpy, GLXDrawable drawable, int32_t *numerator, int32_t *denominator);
|
||||
typedef int64_t ( * PFNGLXSWAPBUFFERSMSCOMLPROC) (Display *dpy, GLXDrawable drawable, int64_t target_msc, int64_t divisor, int64_t remainder);
|
||||
typedef Bool ( * PFNGLXWAITFORMSCOMLPROC) (Display *dpy, GLXDrawable drawable, int64_t target_msc, int64_t divisor, int64_t remainder, int64_t *ust, int64_t *msc, int64_t *sbc);
|
||||
typedef Bool ( * PFNGLXWAITFORSBCOMLPROC) (Display *dpy, GLXDrawable drawable, int64_t target_sbc, int64_t *ust, int64_t *msc, int64_t *sbc);
|
||||
#endif
|
||||
|
||||
#ifndef GLX_NV_float_buffer
|
||||
#define GLX_NV_float_buffer 1
|
||||
#endif
|
||||
|
||||
#ifndef GLX_SGIX_hyperpipe
|
||||
#define GLX_SGIX_hyperpipe 1
|
||||
|
||||
typedef struct {
|
||||
char pipeName[GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX];
|
||||
int networkId;
|
||||
} GLXHyperpipeNetworkSGIX;
|
||||
|
||||
typedef struct {
|
||||
char pipeName[GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX];
|
||||
int channel;
|
||||
unsigned int
|
||||
participationType;
|
||||
int timeSlice;
|
||||
} GLXHyperpipeConfigSGIX;
|
||||
|
||||
typedef struct {
|
||||
char pipeName[GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX];
|
||||
int srcXOrigin, srcYOrigin, srcWidth, srcHeight;
|
||||
int destXOrigin, destYOrigin, destWidth, destHeight;
|
||||
} GLXPipeRect;
|
||||
|
||||
typedef struct {
|
||||
char pipeName[GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX];
|
||||
int XOrigin, YOrigin, maxHeight, maxWidth;
|
||||
} GLXPipeRectLimits;
|
||||
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern GLXHyperpipeNetworkSGIX * glXQueryHyperpipeNetworkSGIX (Display *, int *);
|
||||
extern int glXHyperpipeConfigSGIX (Display *, int, int, GLXHyperpipeConfigSGIX *, int *);
|
||||
extern GLXHyperpipeConfigSGIX * glXQueryHyperpipeConfigSGIX (Display *, int, int *);
|
||||
extern int glXDestroyHyperpipeConfigSGIX (Display *, int);
|
||||
extern int glXBindHyperpipeSGIX (Display *, int);
|
||||
extern int glXQueryHyperpipeBestAttribSGIX (Display *, int, int, int, void *, void *);
|
||||
extern int glXHyperpipeAttribSGIX (Display *, int, int, int, void *);
|
||||
extern int glXQueryHyperpipeAttribSGIX (Display *, int, int, int, void *);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef GLXHyperpipeNetworkSGIX * ( * PFNGLXQUERYHYPERPIPENETWORKSGIXPROC) (Display *dpy, int *npipes);
|
||||
typedef int ( * PFNGLXHYPERPIPECONFIGSGIXPROC) (Display *dpy, int networkId, int npipes, GLXHyperpipeConfigSGIX *cfg, int *hpId);
|
||||
typedef GLXHyperpipeConfigSGIX * ( * PFNGLXQUERYHYPERPIPECONFIGSGIXPROC) (Display *dpy, int hpId, int *npipes);
|
||||
typedef int ( * PFNGLXDESTROYHYPERPIPECONFIGSGIXPROC) (Display *dpy, int hpId);
|
||||
typedef int ( * PFNGLXBINDHYPERPIPESGIXPROC) (Display *dpy, int hpId);
|
||||
typedef int ( * PFNGLXQUERYHYPERPIPEBESTATTRIBSGIXPROC) (Display *dpy, int timeSlice, int attrib, int size, void *attribList, void *returnAttribList);
|
||||
typedef int ( * PFNGLXHYPERPIPEATTRIBSGIXPROC) (Display *dpy, int timeSlice, int attrib, int size, void *attribList);
|
||||
typedef int ( * PFNGLXQUERYHYPERPIPEATTRIBSGIXPROC) (Display *dpy, int timeSlice, int attrib, int size, void *returnAttribList);
|
||||
#endif
|
||||
|
||||
#ifndef GLX_MESA_agp_offset
|
||||
#define GLX_MESA_agp_offset 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern unsigned int glXGetAGPOffsetMESA (const void *);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef unsigned int ( * PFNGLXGETAGPOFFSETMESAPROC) (const void *pointer);
|
||||
#endif
|
||||
|
||||
#ifndef GLX_EXT_fbconfig_packed_float
|
||||
#define GLX_EXT_fbconfig_packed_float 1
|
||||
#endif
|
||||
|
||||
#ifndef GLX_EXT_framebuffer_sRGB
|
||||
#define GLX_EXT_framebuffer_sRGB 1
|
||||
#endif
|
||||
|
||||
#ifndef GLX_EXT_texture_from_pixmap
|
||||
#define GLX_EXT_texture_from_pixmap 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern void glXBindTexImageEXT (Display *, GLXDrawable, int, const int *);
|
||||
extern void glXReleaseTexImageEXT (Display *, GLXDrawable, int);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef void ( * PFNGLXBINDTEXIMAGEEXTPROC) (Display *dpy, GLXDrawable drawable, int buffer, const int *attrib_list);
|
||||
typedef void ( * PFNGLXRELEASETEXIMAGEEXTPROC) (Display *dpy, GLXDrawable drawable, int buffer);
|
||||
#endif
|
||||
|
||||
#ifndef GLX_NV_present_video
|
||||
#define GLX_NV_present_video 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern unsigned int * glXEnumerateVideoDevicesNV (Display *, int, int *);
|
||||
extern int glXBindVideoDeviceNV (Display *, unsigned int, unsigned int, const int *);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef unsigned int * ( * PFNGLXENUMERATEVIDEODEVICESNVPROC) (Display *dpy, int screen, int *nelements);
|
||||
typedef int ( * PFNGLXBINDVIDEODEVICENVPROC) (Display *dpy, unsigned int video_slot, unsigned int video_device, const int *attrib_list);
|
||||
#endif
|
||||
|
||||
#ifndef GLX_NV_video_output
|
||||
#define GLX_NV_video_output 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern int glXGetVideoDeviceNV (Display *, int, int, GLXVideoDeviceNV *);
|
||||
extern int glXReleaseVideoDeviceNV (Display *, int, GLXVideoDeviceNV);
|
||||
extern int glXBindVideoImageNV (Display *, GLXVideoDeviceNV, GLXPbuffer, int);
|
||||
extern int glXReleaseVideoImageNV (Display *, GLXPbuffer);
|
||||
extern int glXSendPbufferToVideoNV (Display *, GLXPbuffer, int, unsigned long *, GLboolean);
|
||||
extern int glXGetVideoInfoNV (Display *, int, GLXVideoDeviceNV, unsigned long *, unsigned long *);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef int ( * PFNGLXGETVIDEODEVICENVPROC) (Display *dpy, int screen, int numVideoDevices, GLXVideoDeviceNV *pVideoDevice);
|
||||
typedef int ( * PFNGLXRELEASEVIDEODEVICENVPROC) (Display *dpy, int screen, GLXVideoDeviceNV VideoDevice);
|
||||
typedef int ( * PFNGLXBINDVIDEOIMAGENVPROC) (Display *dpy, GLXVideoDeviceNV VideoDevice, GLXPbuffer pbuf, int iVideoBuffer);
|
||||
typedef int ( * PFNGLXRELEASEVIDEOIMAGENVPROC) (Display *dpy, GLXPbuffer pbuf);
|
||||
typedef int ( * PFNGLXSENDPBUFFERTOVIDEONVPROC) (Display *dpy, GLXPbuffer pbuf, int iBufferType, unsigned long *pulCounterPbuffer, GLboolean bBlock);
|
||||
typedef int ( * PFNGLXGETVIDEOINFONVPROC) (Display *dpy, int screen, GLXVideoDeviceNV VideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo);
|
||||
#endif
|
||||
|
||||
#ifndef GLX_NV_swap_group
|
||||
#define GLX_NV_swap_group 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern Bool glXJoinSwapGroupNV (Display *, GLXDrawable, GLuint);
|
||||
extern Bool glXBindSwapBarrierNV (Display *, GLuint, GLuint);
|
||||
extern Bool glXQuerySwapGroupNV (Display *, GLXDrawable, GLuint *, GLuint *);
|
||||
extern Bool glXQueryMaxSwapGroupsNV (Display *, int, GLuint *, GLuint *);
|
||||
extern Bool glXQueryFrameCountNV (Display *, int, GLuint *);
|
||||
extern Bool glXResetFrameCountNV (Display *, int);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef Bool ( * PFNGLXJOINSWAPGROUPNVPROC) (Display *dpy, GLXDrawable drawable, GLuint group);
|
||||
typedef Bool ( * PFNGLXBINDSWAPBARRIERNVPROC) (Display *dpy, GLuint group, GLuint barrier);
|
||||
typedef Bool ( * PFNGLXQUERYSWAPGROUPNVPROC) (Display *dpy, GLXDrawable drawable, GLuint *group, GLuint *barrier);
|
||||
typedef Bool ( * PFNGLXQUERYMAXSWAPGROUPSNVPROC) (Display *dpy, int screen, GLuint *maxGroups, GLuint *maxBarriers);
|
||||
typedef Bool ( * PFNGLXQUERYFRAMECOUNTNVPROC) (Display *dpy, int screen, GLuint *count);
|
||||
typedef Bool ( * PFNGLXRESETFRAMECOUNTNVPROC) (Display *dpy, int screen);
|
||||
#endif
|
||||
|
||||
#ifndef GLX_NV_video_capture
|
||||
#define GLX_NV_video_capture 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern int glXBindVideoCaptureDeviceNV (Display *, unsigned int, GLXVideoCaptureDeviceNV);
|
||||
extern GLXVideoCaptureDeviceNV * glXEnumerateVideoCaptureDevicesNV (Display *, int, int *);
|
||||
extern void glXLockVideoCaptureDeviceNV (Display *, GLXVideoCaptureDeviceNV);
|
||||
extern int glXQueryVideoCaptureDeviceNV (Display *, GLXVideoCaptureDeviceNV, int, int *);
|
||||
extern void glXReleaseVideoCaptureDeviceNV (Display *, GLXVideoCaptureDeviceNV);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef int ( * PFNGLXBINDVIDEOCAPTUREDEVICENVPROC) (Display *dpy, unsigned int video_capture_slot, GLXVideoCaptureDeviceNV device);
|
||||
typedef GLXVideoCaptureDeviceNV * ( * PFNGLXENUMERATEVIDEOCAPTUREDEVICESNVPROC) (Display *dpy, int screen, int *nelements);
|
||||
typedef void ( * PFNGLXLOCKVIDEOCAPTUREDEVICENVPROC) (Display *dpy, GLXVideoCaptureDeviceNV device);
|
||||
typedef int ( * PFNGLXQUERYVIDEOCAPTUREDEVICENVPROC) (Display *dpy, GLXVideoCaptureDeviceNV device, int attribute, int *value);
|
||||
typedef void ( * PFNGLXRELEASEVIDEOCAPTUREDEVICENVPROC) (Display *dpy, GLXVideoCaptureDeviceNV device);
|
||||
#endif
|
||||
|
||||
#ifndef GLX_EXT_swap_control
|
||||
#define GLX_EXT_swap_control 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern int glXSwapIntervalEXT (Display *, GLXDrawable, int);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef int ( * PFNGLXSWAPINTERVALEXTPROC) (Display *dpy, GLXDrawable drawable, int interval);
|
||||
#endif
|
||||
|
||||
#ifndef GLX_NV_copy_image
|
||||
#define GLX_NV_copy_image 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern void glXCopyImageSubDataNV (Display *, GLXContext, GLuint, GLenum, GLint, GLint, GLint, GLint, GLXContext, GLuint, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef void ( * PFNGLXCOPYIMAGESUBDATANVPROC) (Display *dpy, GLXContext srcCtx, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLXContext dstCtx, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -0,0 +1,189 @@
|
|||
#ifndef __gl_core_h_
|
||||
#define __gl_core_h_
|
||||
|
||||
/*
|
||||
* SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
|
||||
* Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice including the dates of first publication and
|
||||
* either this permission notice or a reference to
|
||||
* http://oss.sgi.com/projects/FreeB/
|
||||
* shall be included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
||||
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
* Except as contained in this notice, the name of Silicon Graphics, Inc.
|
||||
* shall not be used in advertising or otherwise to promote the sale, use or
|
||||
* other dealings in this Software without prior written authorization from
|
||||
* Silicon Graphics, Inc.
|
||||
*/
|
||||
|
||||
#if !defined(_WIN32_WCE)
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#define GL_CORE_SGI 1
|
||||
#define GL_CORE_MESA 2
|
||||
#define GL_CORE_APPLE 4
|
||||
#define GL_CORE_WINDOWS 8
|
||||
|
||||
typedef struct __GLcontextRec __GLcontext;
|
||||
|
||||
/*
|
||||
** This file defines the interface between the GL core and the surrounding
|
||||
** "operating system" that supports it (currently the GLX or WGL extensions).
|
||||
**
|
||||
** Members (data and function pointers) are documented as imported or
|
||||
** exported according to how they are used by the core rendering functions.
|
||||
** Imported members are initialized by the "operating system" and used by
|
||||
** the core functions. Exported members are initialized by the core functions
|
||||
** and used by the "operating system".
|
||||
*/
|
||||
|
||||
/**
|
||||
* Mode and limit information for a context. This information is
|
||||
* kept around in the context so that values can be used during
|
||||
* command execution, and for returning information about the
|
||||
* context to the application.
|
||||
*
|
||||
* Instances of this structure are shared by the driver and the loader. To
|
||||
* maintain binary compatability, new fields \b must be added only to the
|
||||
* end of the structure.
|
||||
*
|
||||
* \sa _gl_context_modes_create
|
||||
*/
|
||||
typedef struct __GLcontextModesRec {
|
||||
struct __GLcontextModesRec * next;
|
||||
|
||||
GLboolean rgbMode;
|
||||
GLboolean floatMode;
|
||||
GLboolean colorIndexMode;
|
||||
GLuint doubleBufferMode;
|
||||
GLuint stereoMode;
|
||||
|
||||
GLboolean haveAccumBuffer;
|
||||
GLboolean haveDepthBuffer;
|
||||
GLboolean haveStencilBuffer;
|
||||
|
||||
GLint redBits, greenBits, blueBits, alphaBits; /* bits per comp */
|
||||
GLuint redMask, greenMask, blueMask, alphaMask;
|
||||
GLint rgbBits; /* total bits for rgb */
|
||||
GLint indexBits; /* total bits for colorindex */
|
||||
|
||||
GLint accumRedBits, accumGreenBits, accumBlueBits, accumAlphaBits;
|
||||
GLint depthBits;
|
||||
GLint stencilBits;
|
||||
|
||||
GLint numAuxBuffers;
|
||||
|
||||
GLint level;
|
||||
|
||||
GLint pixmapMode;
|
||||
|
||||
/* GLX */
|
||||
GLint visualID;
|
||||
GLint visualType; /**< One of the GLX X visual types. (i.e.,
|
||||
* \c GLX_TRUE_COLOR, etc.)
|
||||
*/
|
||||
|
||||
/* EXT_visual_rating / GLX 1.2 */
|
||||
GLint visualRating;
|
||||
|
||||
/* EXT_visual_info / GLX 1.2 */
|
||||
GLint transparentPixel;
|
||||
/* colors are floats scaled to ints */
|
||||
GLint transparentRed, transparentGreen, transparentBlue, transparentAlpha;
|
||||
GLint transparentIndex;
|
||||
|
||||
/* ARB_multisample / SGIS_multisample */
|
||||
GLint sampleBuffers;
|
||||
GLint samples;
|
||||
|
||||
/* SGIX_fbconfig / GLX 1.3 */
|
||||
GLint drawableType;
|
||||
GLint renderType;
|
||||
GLint xRenderable;
|
||||
GLint fbconfigID;
|
||||
|
||||
/* SGIX_pbuffer / GLX 1.3 */
|
||||
GLint maxPbufferWidth;
|
||||
GLint maxPbufferHeight;
|
||||
GLint maxPbufferPixels;
|
||||
GLint optimalPbufferWidth; /* Only for SGIX_pbuffer. */
|
||||
GLint optimalPbufferHeight; /* Only for SGIX_pbuffer. */
|
||||
|
||||
/* SGIX_visual_select_group */
|
||||
GLint visualSelectGroup;
|
||||
|
||||
/* OML_swap_method */
|
||||
GLint swapMethod;
|
||||
|
||||
GLint screen;
|
||||
|
||||
/* EXT_texture_from_pixmap */
|
||||
GLint bindToTextureRgb;
|
||||
GLint bindToTextureRgba;
|
||||
GLint bindToMipmapTexture;
|
||||
GLint bindToTextureTargets;
|
||||
GLint yInverted;
|
||||
|
||||
#ifdef __APPLE__
|
||||
void *apple;
|
||||
#endif
|
||||
} __GLcontextModes;
|
||||
|
||||
/* Several fields of __GLcontextModes can take these as values. Since
|
||||
* GLX header files may not be available everywhere they need to be used,
|
||||
* redefine them here.
|
||||
*/
|
||||
#define GLX_NONE 0x8000
|
||||
#define GLX_SLOW_CONFIG 0x8001
|
||||
#define GLX_TRUE_COLOR 0x8002
|
||||
#define GLX_DIRECT_COLOR 0x8003
|
||||
#define GLX_PSEUDO_COLOR 0x8004
|
||||
#define GLX_STATIC_COLOR 0x8005
|
||||
#define GLX_GRAY_SCALE 0x8006
|
||||
#define GLX_STATIC_GRAY 0x8007
|
||||
#define GLX_TRANSPARENT_RGB 0x8008
|
||||
#define GLX_TRANSPARENT_INDEX 0x8009
|
||||
#define GLX_NON_CONFORMANT_CONFIG 0x800D
|
||||
#define GLX_SWAP_EXCHANGE_OML 0x8061
|
||||
#define GLX_SWAP_COPY_OML 0x8062
|
||||
#define GLX_SWAP_UNDEFINED_OML 0x8063
|
||||
|
||||
#define GLX_DONT_CARE 0xFFFFFFFF
|
||||
|
||||
#define GLX_RGBA_BIT 0x00000001
|
||||
#define GLX_COLOR_INDEX_BIT 0x00000002
|
||||
#define GLX_WINDOW_BIT 0x00000001
|
||||
#define GLX_PIXMAP_BIT 0x00000002
|
||||
#define GLX_PBUFFER_BIT 0x00000004
|
||||
|
||||
#define GLX_BIND_TO_TEXTURE_RGB_EXT 0x20D0
|
||||
#define GLX_BIND_TO_TEXTURE_RGBA_EXT 0x20D1
|
||||
#define GLX_BIND_TO_MIPMAP_TEXTURE_EXT 0x20D2
|
||||
#define GLX_BIND_TO_TEXTURE_TARGETS_EXT 0x20D3
|
||||
#define GLX_Y_INVERTED_EXT 0x20D4
|
||||
|
||||
#define GLX_TEXTURE_1D_BIT_EXT 0x00000001
|
||||
#define GLX_TEXTURE_2D_BIT_EXT 0x00000002
|
||||
#define GLX_TEXTURE_RECTANGLE_BIT_EXT 0x00000004
|
||||
|
||||
#define GLX_TEXTURE_FORMAT_NONE_EXT 0x20D8
|
||||
#define GLX_TEXTURE_FORMAT_RGB_EXT 0x20D9
|
||||
#define GLX_TEXTURE_FORMAT_RGBA_EXT 0x20DA
|
||||
|
||||
#endif /* __gl_core_h_ */
|
|
@ -0,0 +1,197 @@
|
|||
/**
|
||||
* \file simple_list.h
|
||||
* Simple macros for type-safe, intrusive lists.
|
||||
*
|
||||
* Intended to work with a list sentinal which is created as an empty
|
||||
* list. Insert & delete are O(1).
|
||||
*
|
||||
* \author
|
||||
* (C) 1997, Keith Whitwell
|
||||
*/
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.5
|
||||
*
|
||||
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _SIMPLE_LIST_H
|
||||
#define _SIMPLE_LIST_H
|
||||
|
||||
/**
|
||||
* Remove an element from list.
|
||||
*
|
||||
* \param elem element to remove.
|
||||
*/
|
||||
#define remove_from_list(elem) \
|
||||
do { \
|
||||
(elem)->next->prev = (elem)->prev; \
|
||||
(elem)->prev->next = (elem)->next; \
|
||||
} while (0)
|
||||
|
||||
/**
|
||||
* Insert an element to the list head.
|
||||
*
|
||||
* \param list list.
|
||||
* \param elem element to insert.
|
||||
*/
|
||||
#define insert_at_head(list, elem) \
|
||||
do { \
|
||||
(elem)->prev = list; \
|
||||
(elem)->next = (list)->next; \
|
||||
(list)->next->prev = elem; \
|
||||
(list)->next = elem; \
|
||||
} while(0)
|
||||
|
||||
/**
|
||||
* Insert an element to the list tail.
|
||||
*
|
||||
* \param list list.
|
||||
* \param elem element to insert.
|
||||
*/
|
||||
#define insert_at_tail(list, elem) \
|
||||
do { \
|
||||
(elem)->next = list; \
|
||||
(elem)->prev = (list)->prev; \
|
||||
(list)->prev->next = elem; \
|
||||
(list)->prev = elem; \
|
||||
} while(0)
|
||||
|
||||
/**
|
||||
* Move an element to the list head.
|
||||
*
|
||||
* \param list list.
|
||||
* \param elem element to move.
|
||||
*/
|
||||
#define move_to_head(list, elem) \
|
||||
do { \
|
||||
remove_from_list(elem); \
|
||||
insert_at_head(list, elem); \
|
||||
} while (0)
|
||||
|
||||
/**
|
||||
* Move an element to the list tail.
|
||||
*
|
||||
* \param list list.
|
||||
* \param elem element to move.
|
||||
*/
|
||||
#define move_to_tail(list, elem) \
|
||||
do { \
|
||||
remove_from_list(elem); \
|
||||
insert_at_tail(list, elem); \
|
||||
} while (0)
|
||||
|
||||
/**
|
||||
* Make a empty list empty.
|
||||
*
|
||||
* \param sentinal list (sentinal element).
|
||||
*/
|
||||
#define make_empty_list(sentinal) \
|
||||
do { \
|
||||
(sentinal)->next = sentinal; \
|
||||
(sentinal)->prev = sentinal; \
|
||||
} while (0)
|
||||
|
||||
/**
|
||||
* Get list first element.
|
||||
*
|
||||
* \param list list.
|
||||
*
|
||||
* \return pointer to first element.
|
||||
*/
|
||||
#define first_elem(list) ((list)->next)
|
||||
|
||||
/**
|
||||
* Get list last element.
|
||||
*
|
||||
* \param list list.
|
||||
*
|
||||
* \return pointer to last element.
|
||||
*/
|
||||
#define last_elem(list) ((list)->prev)
|
||||
|
||||
/**
|
||||
* Get next element.
|
||||
*
|
||||
* \param elem element.
|
||||
*
|
||||
* \return pointer to next element.
|
||||
*/
|
||||
#define next_elem(elem) ((elem)->next)
|
||||
|
||||
/**
|
||||
* Get previous element.
|
||||
*
|
||||
* \param elem element.
|
||||
*
|
||||
* \return pointer to previous element.
|
||||
*/
|
||||
#define prev_elem(elem) ((elem)->prev)
|
||||
|
||||
/**
|
||||
* Test whether element is at end of the list.
|
||||
*
|
||||
* \param list list.
|
||||
* \param elem element.
|
||||
*
|
||||
* \return non-zero if element is at end of list, or zero otherwise.
|
||||
*/
|
||||
#define at_end(list, elem) ((elem) == (list))
|
||||
|
||||
/**
|
||||
* Test if a list is empty.
|
||||
*
|
||||
* \param list list.
|
||||
*
|
||||
* \return non-zero if list empty, or zero otherwise.
|
||||
*/
|
||||
#define is_empty_list(list) ((list)->next == (list))
|
||||
|
||||
/**
|
||||
* Walk through the elements of a list.
|
||||
*
|
||||
* \param ptr pointer to the current element.
|
||||
* \param list list.
|
||||
*
|
||||
* \note It should be followed by a { } block or a single statement, as in a \c
|
||||
* for loop.
|
||||
*/
|
||||
#define foreach(ptr, list) \
|
||||
for( ptr=(list)->next ; ptr!=list ; ptr=(ptr)->next )
|
||||
|
||||
/**
|
||||
* Walk through the elements of a list.
|
||||
*
|
||||
* Same as #foreach but lets you unlink the current value during a list
|
||||
* traversal. Useful for freeing a list, element by element.
|
||||
*
|
||||
* \param ptr pointer to the current element.
|
||||
* \param t temporary pointer.
|
||||
* \param list list.
|
||||
*
|
||||
* \note It should be followed by a { } block or a single statement, as in a \c
|
||||
* for loop.
|
||||
*/
|
||||
#define foreach_s(ptr, t, list) \
|
||||
for(ptr=(list)->next,t=(ptr)->next; list != ptr; ptr=t, t=(t)->next)
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,317 @@
|
|||
AccumOp,*,*, GLenum,*,*
|
||||
AlphaFunction,*,*, GLenum,*,*
|
||||
AttribMask,*,*, GLbitfield,*,*
|
||||
BeginMode,*,*, GLenum,*,*
|
||||
BinormalPointerTypeEXT,*,*, GLenum,*,*
|
||||
BlendEquationMode,*,*, GLenum,*,*
|
||||
BlendEquationModeEXT,*,*, GLenum,*,*
|
||||
BlendFuncSeparateParameterEXT,*,*, GLenum,*,*
|
||||
BlendingFactorDest,*,*, GLenum,*,*
|
||||
BlendingFactorSrc,*,*, GLenum,*,*
|
||||
Boolean,*,*, GLboolean,*,*
|
||||
BooleanPointer,*,*, GLboolean*,*,*
|
||||
Char,*,*, GLchar,*,*
|
||||
CharPointer,*,*, GLchar*,*,*
|
||||
CheckedFloat32,*,*, GLfloat,*,*
|
||||
CheckedInt32,*,*, GLint,*,*
|
||||
ClampColorTargetARB,*,*, GLenum,*,*
|
||||
ClampColorModeARB,*,*, GLenum,*,*
|
||||
ClampedColorF,*,*, GLclampf,*,*
|
||||
ClampedFloat32,*,*, GLclampf,*,*
|
||||
ClampedFloat64,*,*, GLclampd,*,*
|
||||
ClampedStencilValue,*,*, GLint,*,*
|
||||
ClearBufferMask,*,*, GLbitfield,*,*
|
||||
ClientAttribMask,*,*, GLbitfield,*,*
|
||||
ClipPlaneName,*,*, GLenum,*,*
|
||||
ColorB,*,*, GLbyte,*,*
|
||||
ColorD,*,*, GLdouble,*,*
|
||||
ColorF,*,*, GLfloat,*,*
|
||||
ColorI,*,*, GLint,*,*
|
||||
ColorIndexValueD,*,*, GLdouble,*,*
|
||||
ColorIndexValueF,*,*, GLfloat,*,*
|
||||
ColorIndexValueI,*,*, GLint,*,*
|
||||
ColorIndexValueS,*,*, GLshort,*,*
|
||||
ColorIndexValueUB,*,*, GLubyte,*,*
|
||||
ColorMaterialParameter,*,*, GLenum,*,*
|
||||
ColorPointerType,*,*, GLenum,*,*
|
||||
ColorS,*,*, GLshort,*,*
|
||||
ColorTableParameterPName,*,*, GLenum,*,*
|
||||
ColorTableParameterPNameSGI,*,*, GLenum,*,*
|
||||
ColorTableTarget,*,*, GLenum,*,*
|
||||
ColorTableTargetSGI,*,*, GLenum,*,*
|
||||
ColorUB,*,*, GLubyte,*,*
|
||||
ColorUI,*,*, GLuint,*,*
|
||||
ColorUS,*,*, GLushort,*,*
|
||||
CombinerBiasNV,*,*, GLenum,*,*
|
||||
CombinerComponentUsageNV,*,*, GLenum,*,*
|
||||
CombinerMappingNV,*,*, GLenum,*,*
|
||||
CombinerParameterNV,*,*, GLenum,*,*
|
||||
CombinerPortionNV,*,*, GLenum,*,*
|
||||
CombinerRegisterNV,*,*, GLenum,*,*
|
||||
CombinerScaleNV,*,*, GLenum,*,*
|
||||
CombinerStageNV,*,*, GLenum,*,*
|
||||
CombinerVariableNV,*,*, GLenum,*,*
|
||||
CompressedTextureARB,*,*, GLvoid,*,*
|
||||
ControlPointNV,*,*, GLvoid,*,*
|
||||
ControlPointTypeNV,*,*, GLenum,*,*
|
||||
ConvolutionParameter,*,*, GLenum,*,*
|
||||
ConvolutionParameterEXT,*,*, GLenum,*,*
|
||||
ConvolutionTarget,*,*, GLenum,*,*
|
||||
ConvolutionTargetEXT,*,*, GLenum,*,*
|
||||
CoordD,*,*, GLdouble,*,*
|
||||
CoordF,*,*, GLfloat,*,*
|
||||
CoordI,*,*, GLint,*,*
|
||||
CoordS,*,*, GLshort,*,*
|
||||
CullFaceMode,*,*, GLenum,*,*
|
||||
CullParameterEXT,*,*, GLenum,*,*
|
||||
DepthFunction,*,*, GLenum,*,*
|
||||
DrawBufferMode,*,*, GLenum,*,*
|
||||
DrawBufferName,*,*, GLint,*,*
|
||||
DrawElementsType,*,*, GLenum,*,*
|
||||
ElementPointerTypeATI,*,*, GLenum,*,*
|
||||
EnableCap,*,*, GLenum,*,*
|
||||
ErrorCode,*,*, GLenum,*,*
|
||||
EvalMapsModeNV,*,*, GLenum,*,*
|
||||
EvalTargetNV,*,*, GLenum,*,*
|
||||
FeedbackElement,*,*, GLfloat,*,*
|
||||
FeedbackType,*,*, GLenum,*,*
|
||||
FenceNV,*,*, GLuint,*,*
|
||||
FenceConditionNV,*,*, GLenum,*,*
|
||||
FenceParameterNameNV,*,*, GLenum,*,*
|
||||
FfdMaskSGIX,*,*, GLbitfield,*,*
|
||||
FfdTargetSGIX,*,*, GLenum,*,*
|
||||
Float32,*,*, GLfloat,*,*
|
||||
Float32Pointer,*,*, GLfloat*,*,*
|
||||
Float64,*,*, GLdouble,*,*
|
||||
Float64Pointer,*,*, GLdouble*,*,*
|
||||
FogParameter,*,*, GLenum,*,*
|
||||
FogPointerTypeEXT,*,*, GLenum,*,*
|
||||
FogPointerTypeIBM,*,*, GLenum,*,*
|
||||
FragmentLightModelParameterSGIX,*,*,GLenum,*,*
|
||||
FragmentLightNameSGIX,*,*, GLenum,*,*
|
||||
FragmentLightParameterSGIX,*,*, GLenum,*,*
|
||||
FramebufferAttachment,*,*, GLenum,*,*
|
||||
FramebufferTarget,*,*, GLenum,*,*
|
||||
FrontFaceDirection,*,*, GLenum,*,*
|
||||
FunctionPointer,*,*, _GLfuncptr,*,*
|
||||
GetColorTableParameterPName,*,*, GLenum,*,*
|
||||
GetColorTableParameterPNameSGI,*,*, GLenum,*,*
|
||||
GetConvolutionParameterPName,*,*, GLenum,*,*
|
||||
GetHistogramParameterPName,*,*, GLenum,*,*
|
||||
GetHistogramParameterPNameEXT,*,*, GLenum,*,*
|
||||
GetMapQuery,*,*, GLenum,*,*
|
||||
GetMinmaxParameterPName,*,*, GLenum,*,*
|
||||
GetMinmaxParameterPNameEXT,*,*, GLenum,*,*
|
||||
GetPName,*,*, GLenum,*,*
|
||||
GetPointervPName,*,*, GLenum,*,*
|
||||
GetTextureParameter,*,*, GLenum,*,*
|
||||
HintMode,*,*, GLenum,*,*
|
||||
HintTarget,*,*, GLenum,*,*
|
||||
HintTargetPGI,*,*, GLenum,*,*
|
||||
HistogramTarget,*,*, GLenum,*,*
|
||||
HistogramTargetEXT,*,*, GLenum,*,*
|
||||
IglooFunctionSelectSGIX,*,*, GLenum,*,*
|
||||
IglooParameterSGIX,*,*, GLvoid,*,*
|
||||
ImageTransformPNameHP,*,*, GLenum,*,*
|
||||
ImageTransformTargetHP,*,*, GLenum,*,*
|
||||
IndexFunctionEXT,*,*, GLenum,*,*
|
||||
IndexMaterialParameterEXT,*,*, GLenum,*,*
|
||||
IndexPointerType,*,*, GLenum,*,*
|
||||
Int16,*,*, GLshort,*,*
|
||||
Int32,*,*, GLint,*,*
|
||||
Int8,*,*, GLbyte,*,*
|
||||
InterleavedArrayFormat,*,*, GLenum,*,*
|
||||
LightEnvParameterSGIX,*,*, GLenum,*,*
|
||||
LightModelParameter,*,*, GLenum,*,*
|
||||
LightName,*,*, GLenum,*,*
|
||||
LightParameter,*,*, GLenum,*,*
|
||||
LightTextureModeEXT,*,*, GLenum,*,*
|
||||
LightTexturePNameEXT,*,*, GLenum,*,*
|
||||
LineStipple,*,*, GLushort,*,*
|
||||
List,*,*, GLuint,*,*
|
||||
ListMode,*,*, GLenum,*,*
|
||||
ListNameType,*,*, GLenum,*,*
|
||||
ListParameterName,*,*, GLenum,*,*
|
||||
LogicOp,*,*, GLenum,*,*
|
||||
MapAttribParameterNV,*,*, GLenum,*,*
|
||||
MapParameterNV,*,*, GLenum,*,*
|
||||
MapTarget,*,*, GLenum,*,*
|
||||
MapTargetNV,*,*, GLenum,*,*
|
||||
MapTypeNV,*,*, GLenum,*,*
|
||||
MaskedColorIndexValueF,*,*, GLfloat,*,*
|
||||
MaskedColorIndexValueI,*,*, GLuint,*,*
|
||||
MaskedStencilValue,*,*, GLuint,*,*
|
||||
MaterialFace,*,*, GLenum,*,*
|
||||
MaterialParameter,*,*, GLenum,*,*
|
||||
MatrixIndexPointerTypeARB,*,*, GLenum,*,*
|
||||
MatrixMode,*,*, GLenum,*,*
|
||||
MatrixTransformNV,*,*, GLenum,*,*
|
||||
MeshMode1,*,*, GLenum,*,*
|
||||
MeshMode2,*,*, GLenum,*,*
|
||||
MinmaxTarget,*,*, GLenum,*,*
|
||||
MinmaxTargetEXT,*,*, GLenum,*,*
|
||||
NormalPointerType,*,*, GLenum,*,*
|
||||
NurbsCallback,*,*, GLenum,*,*
|
||||
NurbsObj,*,*, GLUnurbs*,*,*
|
||||
NurbsProperty,*,*, GLenum,*,*
|
||||
NurbsTrim,*,*, GLenum,*,*
|
||||
OcclusionQueryParameterNameNV,*,*, GLenum,*,*
|
||||
PixelCopyType,*,*, GLenum,*,*
|
||||
PixelFormat,*,*, GLenum,*,*
|
||||
PixelInternalFormat,*,*, GLenum,*,*
|
||||
PixelMap,*,*, GLenum,*,*
|
||||
PixelStoreParameter,*,*, GLenum,*,*
|
||||
PixelTexGenModeSGIX,*,*, GLenum,*,*
|
||||
PixelTexGenParameterNameSGIS,*,*, GLenum,*,*
|
||||
PixelTransferParameter,*,*, GLenum,*,*
|
||||
PixelTransformPNameEXT,*,*, GLenum,*,*
|
||||
PixelTransformTargetEXT,*,*, GLenum,*,*
|
||||
PixelType,*,*, GLenum,*,*
|
||||
PointParameterNameARB,*,*, GLenum,*,*
|
||||
PolygonMode,*,*, GLenum,*,*
|
||||
ProgramNV,*,*, GLuint,*,*
|
||||
ProgramCharacterNV,*,*, GLubyte,*,*
|
||||
ProgramParameterNV,*,*, GLenum,*,*
|
||||
ProgramParameterPName,*,*, GLenum,*,*
|
||||
QuadricCallback,*,*, GLenum,*,*
|
||||
QuadricDrawStyle,*,*, GLenum,*,*
|
||||
QuadricNormal,*,*, GLenum,*,*
|
||||
QuadricObj,*,*, GLUquadric*,*,*
|
||||
QuadricOrientation,*,*, GLenum,*,*
|
||||
ReadBufferMode,*,*, GLenum,*,*
|
||||
RenderbufferTarget,*,*, GLenum,*,*
|
||||
RenderingMode,*,*, GLenum,*,*
|
||||
ReplacementCodeSUN,*,*, GLuint,*,*
|
||||
ReplacementCodeTypeSUN,*,*, GLenum,*,*
|
||||
SamplePassARB,*,*, GLenum,*,*
|
||||
SamplePatternEXT,*,*, GLenum,*,*
|
||||
SamplePatternSGIS,*,*, GLenum,*,*
|
||||
SecondaryColorPointerTypeIBM,*,*, GLenum,*,*
|
||||
SelectName,*,*, GLuint,*,*
|
||||
SeparableTarget,*,*, GLenum,*,*
|
||||
SeparableTargetEXT,*,*, GLenum,*,*
|
||||
ShadingModel,*,*, GLenum,*,*
|
||||
SizeI,*,*, GLsizei,*,*
|
||||
SpriteParameterNameSGIX,*,*, GLenum,*,*
|
||||
StencilFunction,*,*, GLenum,*,*
|
||||
StencilFaceDirection,*,*, GLenum,*,*
|
||||
StencilOp,*,*, GLenum,*,*
|
||||
StencilValue,*,*, GLint,*,*
|
||||
String,*,*, const GLubyte *,*,*
|
||||
StringName,*,*, GLenum,*,*
|
||||
TangentPointerTypeEXT,*,*, GLenum,*,*
|
||||
TessCallback,*,*, GLenum,*,*
|
||||
TessContour,*,*, GLenum,*,*
|
||||
TessProperty,*,*, GLenum,*,*
|
||||
TesselatorObj,*,*, GLUtesselator*,*,*
|
||||
TexCoordPointerType,*,*, GLenum,*,*
|
||||
Texture,*,*, GLuint,*,*
|
||||
TextureComponentCount,*,*, GLint,*,*
|
||||
TextureCoordName,*,*, GLenum,*,*
|
||||
TextureEnvParameter,*,*, GLenum,*,*
|
||||
TextureEnvTarget,*,*, GLenum,*,*
|
||||
TextureFilterSGIS,*,*, GLenum,*,*
|
||||
TextureGenParameter,*,*, GLenum,*,*
|
||||
TextureNormalModeEXT,*,*, GLenum,*,*
|
||||
TextureParameterName,*,*, GLenum,*,*
|
||||
TextureTarget,*,*, GLenum,*,*
|
||||
TextureUnit,*,*, GLenum,*,*
|
||||
UInt16,*,*, GLushort,*,*
|
||||
UInt32,*,*, GLuint,*,*
|
||||
UInt8,*,*, GLubyte,*,*
|
||||
VertexAttribEnum,*,*, GLenum,*,*
|
||||
VertexAttribEnumNV,*,*, GLenum,*,*
|
||||
VertexAttribPointerTypeNV,*,*, GLenum,*,*
|
||||
VertexPointerType,*,*, GLenum,*,*
|
||||
VertexWeightPointerTypeEXT,*,*, GLenum,*,*
|
||||
Void,*,*, GLvoid,*,*
|
||||
VoidPointer,*,*, GLvoid*,*,*
|
||||
ConstVoidPointer,*,*, GLvoid* const,*,*
|
||||
WeightPointerTypeARB,*,*, GLenum,*,*
|
||||
WinCoord,*,*, GLint,*,*
|
||||
void,*,*, *,*,*
|
||||
ArrayObjectPNameATI,*,*, GLenum,*,*
|
||||
ArrayObjectUsageATI,*,*, GLenum,*,*,
|
||||
ConstFloat32,*,*, GLfloat,*,*
|
||||
ConstInt32,*,*, GLint,*,*
|
||||
ConstUInt32,*,*, GLuint,*,*
|
||||
ConstVoid,*,*, GLvoid,*,*
|
||||
DataTypeEXT,*,*, GLenum,*,*
|
||||
FragmentOpATI,*,*, GLenum,*,*
|
||||
GetTexBumpParameterATI,*,*, GLenum,*,*
|
||||
GetVariantValueEXT,*,*, GLenum,*,*
|
||||
ParameterRangeEXT,*,*, GLenum,*,*
|
||||
PreserveModeATI,*,*, GLenum,*,*
|
||||
ProgramFormatARB,*,*, GLenum,*,*
|
||||
ProgramTargetARB,*,*, GLenum,*,*
|
||||
ProgramTarget,*,*, GLenum,*,*
|
||||
ProgramPropertyARB,*,*, GLenum,*,*
|
||||
ProgramStringPropertyARB,*,*, GLenum,*,*
|
||||
ScalarType,*,*, GLenum,*,*
|
||||
SwizzleOpATI,*,*, GLenum,*,*
|
||||
TexBumpParameterATI,*,*, GLenum,*,*
|
||||
VariantCapEXT,*,*, GLenum,*,*
|
||||
VertexAttribPointerPropertyARB,*,*, GLenum,*,*
|
||||
VertexAttribPointerTypeARB,*,*, GLenum,*,*
|
||||
VertexAttribPropertyARB,*,*, GLenum,*,*
|
||||
VertexShaderCoordOutEXT,*,*, GLenum,*,*
|
||||
VertexShaderOpEXT,*,*, GLenum,*,*
|
||||
VertexShaderParameterEXT,*,*, GLenum,*,*
|
||||
VertexShaderStorageTypeEXT,*,*, GLenum,*,*
|
||||
VertexShaderTextureUnitParameter,*,*, GLenum,*,*
|
||||
VertexShaderWriteMaskEXT,*,*, GLenum,*,*
|
||||
VertexStreamATI,*,*, GLenum,*,*
|
||||
PNTrianglesPNameATI,*,*, GLenum,*,*
|
||||
# ARB_vertex_buffer_object types and core equivalents for new types
|
||||
BufferOffset,*,*, GLintptr,*,*
|
||||
BufferSize,*,*, GLsizeiptr,*,*
|
||||
BufferAccessARB,*,*, GLenum,*,*
|
||||
BufferOffsetARB,*,*, GLintptrARB,*,*
|
||||
BufferPNameARB,*,*, GLenum,*,*
|
||||
BufferPointerNameARB,*,*, GLenum,*,*
|
||||
BufferSizeARB,*,*, GLsizeiptrARB,*,*
|
||||
BufferTargetARB,*,*, GLenum,*,*
|
||||
BufferUsageARB,*,*, GLenum,*,*
|
||||
# APPLE_fence
|
||||
ObjectTypeAPPLE,*,*, GLenum,*,*
|
||||
# APPLE_vertex_array_range
|
||||
VertexArrayPNameAPPLE,*,*, GLenum,*,*
|
||||
# ATI_draw_buffers
|
||||
DrawBufferModeATI,*,*, GLenum,*,*
|
||||
# NV_half
|
||||
Half16NV,*,*, GLhalfNV,*,*
|
||||
# NV_pixel_data_range
|
||||
PixelDataRangeTargetNV,*,*, GLenum,*,*
|
||||
# Generic types for as-yet-unspecified enums
|
||||
TypeEnum,*,*, GLenum,*,*
|
||||
GLenum,*,*, GLenum,*,*
|
||||
handleARB,*,*, GLhandleARB,*,*
|
||||
charARB,*,*, GLcharARB,*,*
|
||||
charPointerARB,*,*, GLcharARB*,*,*
|
||||
# EXT_timer_query
|
||||
Int64EXT,*,*, GLint64EXT,*,*
|
||||
UInt64EXT,*,*, GLuint64EXT,*,*
|
||||
# EXT_direct_state_access
|
||||
FramebufferAttachment,*,*, GLenum,*,*
|
||||
FramebufferAttachmentParameterName,*,*, GLenum,*,*
|
||||
Framebuffer,*,*, GLuint,*,*
|
||||
FramebufferStatus,*,*, GLenum,*,*
|
||||
FramebufferTarget,*,*, GLenum,*,*
|
||||
GetFramebufferParameter,*,*, GLenum,*,*
|
||||
Intptr,*,*, GLintptr,*,*
|
||||
ProgramFormat,*,*, GLenum,*,*
|
||||
ProgramProperty,*,*, GLenum,*,*
|
||||
ProgramStringProperty,*,*, GLenum,*,*
|
||||
ProgramTarget,*,*, GLenum,*,*
|
||||
Renderbuffer,*,*, GLuint,*,*
|
||||
RenderbufferParameterName,*,*, GLenum,*,*
|
||||
Sizeiptr,*,*, GLsizeiptr,*,*
|
||||
TextureInternalFormat,*,*, GLenum,*,*
|
||||
VertexBufferObjectAccess,*,*, GLenum,*,*
|
||||
VertexBufferObjectParameter,*,*, GLenum,*,*
|
||||
VertexBufferObjectUsage,*,*, GLenum,*,*
|
||||
# ARB_map_buffer_range
|
||||
BufferAccessMask,*,*, GLbitfield,*,*
|
||||
# NV_explicit_multisample
|
||||
GetMultisamplePNameNV,*,*, GLenum,*,*
|
||||
SampleMaskNV,*,*, GLbitfield,*,*
|
|
@ -0,0 +1,599 @@
|
|||
# Copyright (C) 1991-2005 Silicon Graphics, Inc. All Rights Reserved.
|
||||
#
|
||||
# This document is licensed under the SGI Free Software B License Version
|
||||
# 2.0. For details, see http://oss.sgi.com/projects/FreeB/ .
|
||||
|
||||
required-props:
|
||||
param: retval retained
|
||||
dlflags: notlistable handcode nop
|
||||
glxflags: client-handcode server-handcode
|
||||
glxvendorglx: *
|
||||
vectorequiv: *
|
||||
category: pixel-rw bgn-end display-list drawing drawing-control feedback framebuf misc modeling pixel-op pixel-rw state-req xform glx glxopcode
|
||||
glxopcode: *
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# GLX1.0 commands
|
||||
#
|
||||
###############################################################################
|
||||
Render()
|
||||
return void
|
||||
category glx
|
||||
dlflags notlistable
|
||||
glxflags client-handcode server-handcode
|
||||
glxopcode 1
|
||||
|
||||
|
||||
RenderLarge()
|
||||
return void
|
||||
category glx
|
||||
dlflags notlistable
|
||||
glxflags client-handcode server-handcode
|
||||
glxopcode 2
|
||||
|
||||
|
||||
CreateContext(gc_id, screen, visual, share_list)
|
||||
return void
|
||||
param gc_id Int32 in value
|
||||
param screen Int32 in value
|
||||
param visual Int32 in value
|
||||
param share_list Int32 in value
|
||||
glxflags client-handcode server-handcode
|
||||
category glx
|
||||
dlflags notlistable
|
||||
glxopcode 3
|
||||
|
||||
|
||||
DestroyContext(context)
|
||||
return void
|
||||
param context Int32 in value
|
||||
glxflags client-handcode server-handcode
|
||||
category glx
|
||||
dlflags notlistable
|
||||
glxopcode 4
|
||||
|
||||
|
||||
MakeCurrent(drawable, context)
|
||||
return void
|
||||
param drawable Int32 in value
|
||||
param context Int32 in value
|
||||
glxflags client-handcode server-handcode
|
||||
category glx
|
||||
dlflags notlistable
|
||||
glxopcode 5
|
||||
|
||||
|
||||
IsDirect(dpy, context)
|
||||
return void
|
||||
param dpy Int32 in value
|
||||
param context Int32 in value
|
||||
glxflags client-handcode server-handcode
|
||||
category glx
|
||||
dlflags notlistable
|
||||
glxopcode 6
|
||||
|
||||
|
||||
QueryVersion(major, minor)
|
||||
return void
|
||||
param major Int32 out reference
|
||||
param minor Int32 out reference
|
||||
category glx
|
||||
dlflags notlistable
|
||||
glxflags client-handcode server-handcode
|
||||
glxopcode 7
|
||||
|
||||
|
||||
WaitGL(context)
|
||||
return void
|
||||
param context Int32 in value
|
||||
category glx
|
||||
dlflags notlistable
|
||||
glxflags client-handcode server-handcode
|
||||
glxopcode 8
|
||||
|
||||
|
||||
WaitX()
|
||||
return void
|
||||
category glx
|
||||
dlflags notlistable
|
||||
glxflags client-handcode server-handcode
|
||||
glxopcode 9
|
||||
|
||||
|
||||
CopyContext(source, dest, mask)
|
||||
return void
|
||||
param source Int32 in value
|
||||
param dest Int32 in value
|
||||
param mask Int32 in value
|
||||
category glx
|
||||
dlflags notlistable
|
||||
glxflags client-handcode server-handcode
|
||||
glxopcode 10
|
||||
|
||||
|
||||
SwapBuffers(drawable)
|
||||
return void
|
||||
param drawable Int32 in value
|
||||
category glx
|
||||
dlflags notlistable
|
||||
glxflags client-handcode server-handcode
|
||||
glxopcode 11
|
||||
|
||||
|
||||
UseXFont(font, first, count, list_base)
|
||||
return void
|
||||
param font Int32 in value
|
||||
param first Int32 in value
|
||||
param count Int32 in value
|
||||
param list_base Int32 in value
|
||||
category glx
|
||||
dlflags notlistable
|
||||
glxflags client-handcode server-handcode
|
||||
glxopcode 12
|
||||
|
||||
|
||||
CreateGLXPixmap(visual, pixmap, glxpixmap)
|
||||
return void
|
||||
param visual Int32 in value
|
||||
param pixmap Int32 in value
|
||||
param glxpixmap Int32 in value
|
||||
category glx
|
||||
dlflags notlistable
|
||||
glxflags client-handcode server-handcode
|
||||
glxopcode 13
|
||||
|
||||
GetVisualConfigs()
|
||||
return void
|
||||
category glx
|
||||
dlflags notlistable
|
||||
glxflags client-handcode server-handcode
|
||||
glxopcode 14
|
||||
|
||||
|
||||
DestroyGLXPixmap(pixmap)
|
||||
return void
|
||||
param pixmap Int32 in value
|
||||
glxflags client-handcode
|
||||
category glx
|
||||
dlflags notlistable
|
||||
glxopcode 15
|
||||
|
||||
|
||||
VendorPrivate()
|
||||
return void
|
||||
glxflags client-handcode server-handcode
|
||||
category glx
|
||||
dlflags notlistable
|
||||
glxopcode 16
|
||||
|
||||
|
||||
VendorPrivateWithReply()
|
||||
return void
|
||||
glxflags client-handcode server-handcode
|
||||
category glx
|
||||
dlflags notlistable
|
||||
glxopcode 17
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# GLX1.1 commands
|
||||
#
|
||||
###############################################################################
|
||||
QueryExtensionsString(screen)
|
||||
return void
|
||||
param screen Int32 in value
|
||||
glxflags client-handcode server-handcode
|
||||
category glx
|
||||
dlflags notlistable
|
||||
glxopcode 18
|
||||
|
||||
QueryServerString(screen, name)
|
||||
return void
|
||||
param screen Int32 in value
|
||||
param name Int32 in value
|
||||
glxflags client-handcode server-handcode
|
||||
category glx
|
||||
dlflags notlistable
|
||||
glxopcode 19
|
||||
|
||||
ClientInfo()
|
||||
return void
|
||||
glxflags client-handcode server-handcode
|
||||
category glx
|
||||
dlflags notlistable
|
||||
glxopcode 20
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# GLX1.3 commands
|
||||
#
|
||||
###############################################################################
|
||||
GetFBConfigs()
|
||||
return void
|
||||
category glx
|
||||
dlflags notlistable
|
||||
glxflags client-handcode server-handcode
|
||||
glxopcode 21
|
||||
|
||||
CreatePixmap(config, pixmap, glxpixmap)
|
||||
return void
|
||||
param config Int32 in value
|
||||
param pixmap Int32 in value
|
||||
param glxpixmap Int32 in value
|
||||
dlflags notlistable
|
||||
glxflags client-handcode server-handcode
|
||||
category glx
|
||||
glxopcode 22
|
||||
|
||||
DestroyPixmap(glxpixmap)
|
||||
return void
|
||||
param glxpixmap Int32 in value
|
||||
dlflags notlistable
|
||||
glxflags client-handcode server-handcode
|
||||
category glx
|
||||
glxopcode 23
|
||||
|
||||
CreateNewContext(config, render_type, share_list, direct)
|
||||
return void
|
||||
param config Int32 in value
|
||||
param render_type Int32 in value
|
||||
param share_list Int32 in value
|
||||
param direct Int32 in value
|
||||
dlflags notlistable
|
||||
glxflags client-handcode server-handcode
|
||||
category glx
|
||||
glxopcode 24
|
||||
|
||||
QueryContext()
|
||||
return void
|
||||
dlflags notlistable
|
||||
glxflags client-handcode server-handcode
|
||||
category glx
|
||||
glxopcode 25
|
||||
|
||||
MakeContextCurrent(drawable, readdrawable, context)
|
||||
return void
|
||||
param drawable Int32 in value
|
||||
param readdrawable Int32 in value
|
||||
param context Int32 in value
|
||||
dlflags notlistable
|
||||
glxflags client-handcode server-handcode
|
||||
category glx
|
||||
glxopcode 26
|
||||
|
||||
CreatePbuffer(config, pbuffer)
|
||||
return void
|
||||
param config Int32 in value
|
||||
param pbuffer Int32 in value
|
||||
dlflags notlistable
|
||||
glxflags client-handcode server-handcode
|
||||
category glx
|
||||
glxopcode 27
|
||||
|
||||
DestroyPbuffer(pbuffer)
|
||||
return void
|
||||
param pbuffer Int32 in value
|
||||
dlflags notlistable
|
||||
glxflags client-handcode
|
||||
category glx
|
||||
glxopcode 28
|
||||
|
||||
GetDrawableAttributes(drawable)
|
||||
return void
|
||||
param drawable Int32 in value
|
||||
dlflags notlistable
|
||||
glxflags client-handcode server-handcode
|
||||
category glx
|
||||
glxopcode 29
|
||||
|
||||
ChangeDrawableAttributes(drawable)
|
||||
return void
|
||||
param drawable Int32 in value
|
||||
dlflags notlistable
|
||||
glxflags client-handcode server-handcode
|
||||
category glx
|
||||
glxopcode 30
|
||||
|
||||
CreateWindow(config, window, glxwindow)
|
||||
return void
|
||||
param config Int32 in value
|
||||
param window Int32 in value
|
||||
param glxwindow Int32 in value
|
||||
dlflags notlistable
|
||||
glxflags client-handcode server-handcode
|
||||
category glx
|
||||
glxopcode 31
|
||||
|
||||
DestroyWindow(glxwindow)
|
||||
return void
|
||||
param glxwindow Int32 in value
|
||||
dlflags notlistable
|
||||
glxflags client-handcode server-handcode
|
||||
category glx
|
||||
glxopcode 32
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# IRIX5.3 extension commands
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# SGI_swap_control extension commands
|
||||
#
|
||||
###############################################################################
|
||||
SwapIntervalSGI()
|
||||
return void
|
||||
glxflags client-handcode server-handcode
|
||||
category glx
|
||||
dlflags notlistable
|
||||
glxvendorglx 65536
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# IRIX5.3-PATCH154 extension commands
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# SGI_make_current_read extension commands
|
||||
#
|
||||
###############################################################################
|
||||
MakeCurrentReadSGI(drawable, readdrawable, context)
|
||||
return void
|
||||
param drawable Int32 in value
|
||||
param readdrawable Int32 in value
|
||||
param context Int32 in value
|
||||
glxflags client-handcode server-handcode
|
||||
category glx
|
||||
dlflags notlistable
|
||||
glxvendorglx 65537
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# SGIX_video_source extension commands
|
||||
#
|
||||
###############################################################################
|
||||
CreateGLXVideoSourceSGIX(dpy, screen, server, path, class, node)
|
||||
return void
|
||||
param dpy Int32 in value
|
||||
param screen Int32 in value
|
||||
param server Int32 in value
|
||||
param path Int32 in value
|
||||
param class Int32 in value
|
||||
param node Int32 in value
|
||||
glxflags client-handcode server-handcode
|
||||
category glx
|
||||
dlflags notlistable
|
||||
glxvendorglx 65538
|
||||
|
||||
DestroyGLXVideoSourceSGIX(dpy, glxvideosource)
|
||||
return void
|
||||
param dpy Int32 in value
|
||||
param glxvideosource Int32 in value
|
||||
glxflags client-handcode server-handcode
|
||||
category glx
|
||||
dlflags notlistable
|
||||
glxvendorglx 65539
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# IRIX6.2 extension commands
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# EXT_import_context extension commands
|
||||
#
|
||||
###############################################################################
|
||||
QueryContextInfoEXT()
|
||||
return void
|
||||
category glx
|
||||
dlflags notlistable
|
||||
glxflags client-handcode server-handcode
|
||||
glxvendorglx 1024
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# SGIX_fbconfig extension commands
|
||||
#
|
||||
###############################################################################
|
||||
GetFBConfigsSGIX()
|
||||
return void
|
||||
category glx
|
||||
dlflags notlistable
|
||||
glxflags client-handcode server-handcode
|
||||
glxvendorglx 65540
|
||||
|
||||
CreateContextWithConfigSGIX(gc_id, screen, config, share_list)
|
||||
return void
|
||||
param gc_id Int32 in value
|
||||
param screen Int32 in value
|
||||
param config Int32 in value
|
||||
param share_list Int32 in value
|
||||
glxflags client-handcode server-handcode
|
||||
category glx
|
||||
dlflags notlistable
|
||||
glxvendorglx 65541
|
||||
|
||||
CreateGLXPixmapWithConfigSGIX(config, pixmap, glxpixmap)
|
||||
return void
|
||||
param config Int32 in value
|
||||
param pixmap Int32 in value
|
||||
param glxpixmap Int32 in value
|
||||
category glx
|
||||
dlflags notlistable
|
||||
glxflags client-handcode server-handcode
|
||||
glxvendorglx 65542
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# SGIX_pbuffer extension commands
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
CreateGLXPbufferSGIX(config, pbuffer)
|
||||
return void
|
||||
param config Int32 in value
|
||||
param pbuffer Int32 in value
|
||||
dlflags notlistable
|
||||
glxflags client-handcode server-handcode
|
||||
category glx
|
||||
glxvendorglx 65543
|
||||
|
||||
DestroyGLXPbufferSGIX(pbuffer)
|
||||
return void
|
||||
param pbuffer Int32 in value
|
||||
dlflags notlistable
|
||||
glxflags client-handcode
|
||||
category glx
|
||||
glxvendorglx 65544
|
||||
|
||||
ChangeDrawableAttributesSGIX(drawable)
|
||||
return void
|
||||
param drawable Int32 in value
|
||||
dlflags notlistable
|
||||
glxflags client-handcode server-handcode
|
||||
category glx
|
||||
glxvendorglx 65545
|
||||
|
||||
GetDrawableAttributesSGIX(drawable)
|
||||
return void
|
||||
param drawable Int32 in value
|
||||
dlflags notlistable
|
||||
glxflags client-handcode server-handcode
|
||||
category glx
|
||||
glxvendorglx 65546
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# SGIX_swap_group extension commands
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
JoinSwapGroupSGIX(window,group)
|
||||
return void
|
||||
param window Int32 in value
|
||||
param group Int32 in value
|
||||
glxflags client-handcode server-handcode
|
||||
category glx
|
||||
dlflags notlistable
|
||||
glxvendorglx 65547
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# SGIX_swap_barrier extension commands
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
BindSwapBarrierSGIX(window,barrier)
|
||||
return void
|
||||
param window Int32 in value
|
||||
param barrier Int32 in value
|
||||
glxflags client-handcode server-handcode
|
||||
category glx
|
||||
dlflags notlistable
|
||||
glxvendorglx 65548
|
||||
|
||||
QueryMaxSwapBarriersSGIX()
|
||||
return void
|
||||
glxflags client-handcode server-handcode
|
||||
category glx
|
||||
dlflags notlistable
|
||||
glxvendorglx 65549
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# SGIX_hyperpipe extension commands
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
QueryHyperpipeNetworkSGIX(dpy, npipes)
|
||||
return GLXHyperpipeNetworkPointer
|
||||
param dpy Display out reference
|
||||
param npipes int out reference
|
||||
glxflags client-handcode server-handcode
|
||||
category glx
|
||||
dlflags notlistable
|
||||
glxvendorglx 65550
|
||||
|
||||
HyperpipeConfigSGIX(dpy, networkId, npipes, cfg, hpId)
|
||||
return int
|
||||
param dpy Display out reference
|
||||
param networkId int in value
|
||||
param npipes int in value
|
||||
param cfg GLXHyperpipeConfig in array[npipes]
|
||||
param hpId int out reference
|
||||
glxflags client-handcode server-handcode
|
||||
category glx
|
||||
dlflags notlistable
|
||||
glxvendorglx 65552
|
||||
|
||||
QueryHyperpipeConfigSGIX(dpy, hpId, npipes)
|
||||
return GLXHyperpipeConfigPointer
|
||||
param dpy Display out reference
|
||||
param hpId int in value
|
||||
param npipes int out reference
|
||||
glxflags client-handcode server-handcode
|
||||
category glx
|
||||
dlflags notlistable
|
||||
glxvendorglx 65551
|
||||
|
||||
DestroyHyperpipeConfigSGIX(dpy, hpId)
|
||||
return int
|
||||
param dpy Display out reference
|
||||
param hpId int in value
|
||||
glxflags client-handcode server-handcode
|
||||
category glx
|
||||
dlflags notlistable
|
||||
glxvendorglx 65553
|
||||
|
||||
BindHyperpipeSGIX(dpy, hpId)
|
||||
return int
|
||||
param dpy Display out reference
|
||||
param hpId int in value
|
||||
glxflags client-handcode server-handcode
|
||||
category glx
|
||||
dlflags notlistable
|
||||
glxvendorglx ???
|
||||
|
||||
QueryHyperpipeBestAttribSGIX(dpy, timeSlice, attrib, size, attribList, returnAttribList)
|
||||
return int
|
||||
param dpy Display out reference
|
||||
param timeSlice int in value
|
||||
param attrib int in value
|
||||
param size int in value
|
||||
param attribList Void in array[size]
|
||||
param returnAttribList Void out array[size]
|
||||
glxflags client-handcode server-handcode
|
||||
category glx
|
||||
dlflags notlistable
|
||||
glxvendorglx ???
|
||||
|
||||
HyperpipeAttribSGIX(dpy, timeSlice, attrib, size, attribList)
|
||||
return int
|
||||
param dpy Display out reference
|
||||
param timeSlice int in value
|
||||
param attrib int in value
|
||||
param size int in value
|
||||
param attribList void in array[size]
|
||||
glxflags client-handcode server-handcode
|
||||
category glx
|
||||
dlflags notlistable
|
||||
glxvendorglx ???
|
||||
|
||||
QueryHyperpipeAttribSGIX(dpy, timeSlice, attrib, size, returnAttribList)
|
||||
return int
|
||||
param dpy Display out reference
|
||||
param timeSlice int in value
|
||||
param attrib int in value
|
||||
param size int in value
|
||||
param returnAttribList void in array[size]
|
||||
glxflags client-handcode server-handcode
|
||||
category glx
|
||||
dlflags notlistable
|
||||
glxvendorglx ???
|
|
@ -0,0 +1,414 @@
|
|||
# Copyright (C) 1991-2005 Silicon Graphics, Inc. All Rights Reserved.
|
||||
#
|
||||
# This document is licensed under the SGI Free Software B License Version
|
||||
# 2.0. For details, see http://oss.sgi.com/projects/FreeB/ .
|
||||
|
||||
# This is the GLX enumerant registry.
|
||||
#
|
||||
# It is an extremely important file. Do not mess with it unless
|
||||
# you know what you're doing and have permission to do so.
|
||||
#
|
||||
# Rules for modification are the same as the rules for the OpenGL
|
||||
# enumerant registry (gl.spec). Basically, don't modify this
|
||||
# file unless you're the Khronos API Registrar.
|
||||
|
||||
Extensions define:
|
||||
VERSION_1_1 = 1
|
||||
VERSION_1_2 = 1
|
||||
VERSION_1_3 = 1
|
||||
VERSION_1_4 = 1
|
||||
SGIS_multisample = 1
|
||||
EXT_visual_info = 1
|
||||
SGI_swap_control = 1
|
||||
SGI_video_sync = 1
|
||||
SGI_make_current_read = 1
|
||||
SGIX_video_source = 1
|
||||
EXT_visual_rating = 1
|
||||
EXT_import_context = 1
|
||||
SGIX_fbconfig = 1
|
||||
SGIX_pbuffer = 1
|
||||
SGI_cushion = 1
|
||||
SGIX_video_resize = 1
|
||||
SGIX_dmbuffer = 1
|
||||
SGIX_swap_group = 1
|
||||
SGIX_swap_barrier = 1
|
||||
SGIS_blended_overlay = 1
|
||||
SGIS_shared_multisample = 1
|
||||
SUN_get_transparent_index = 1
|
||||
3DFX_multisample = 1
|
||||
MESA_copy_sub_buffer = 1
|
||||
MESA_pixmap_colormap = 1
|
||||
MESA_release_buffers = 1
|
||||
MESA_set_3dfx_mode = 1
|
||||
SGIX_visual_select_group = 1
|
||||
SGIX_hyperpipe = 1
|
||||
|
||||
GLXStringName enum:
|
||||
VENDOR = 0x1
|
||||
VERSION = 0x2
|
||||
EXTENSIONS = 0x3
|
||||
|
||||
GLXErrorCode enum:
|
||||
BAD_SCREEN = 1
|
||||
BAD_ATTRIBUTE = 2
|
||||
NO_EXTENSION = 3
|
||||
BAD_VISUAL = 4
|
||||
BAD_CONTEXT = 5
|
||||
BAD_VALUE = 6
|
||||
BAD_ENUM = 7
|
||||
BAD_HYPERPIPE_CONFIG_SGIX = 91 # SGIX_hyperpipe
|
||||
BAD_HYPERPIPE_SGIX = 92 # "
|
||||
|
||||
# Reserved bits in bitfields of various purposes
|
||||
|
||||
GLXDrawableTypeMask enum:
|
||||
WINDOW_BIT = 0x00000001 # DRAWABLE_TYPE value
|
||||
PIXMAP_BIT = 0x00000002 # "
|
||||
PBUFFER_BIT = 0x00000004 # "
|
||||
WINDOW_BIT_SGIX = 0x00000001 # DRAWABLE_TYPE_SGIX value
|
||||
PIXMAP_BIT_SGIX = 0x00000002 # "
|
||||
PBUFFER_BIT_SGIX = 0x00000004 # "
|
||||
|
||||
GLXRenderTypeMask enum:
|
||||
RGBA_BIT = 0x00000001 # RENDER_TYPE value
|
||||
COLOR_INDEX_BIT = 0x00000002 # "
|
||||
RGBA_BIT_SGIX = 0x00000001 # RENDER_TYPE_SGIX value
|
||||
COLOR_INDEX_BIT_SGIX = 0x00000002 # "
|
||||
RGBA_FLOAT_BIT_ARB = 0x00000004 # RENDER_TYPE value (from ARB_fbconfig_float)
|
||||
RGBA_UNSIGNED_FLOAT_BIT_EXT = 0x00000008 # RENDER_TYPE value (from EXT_fbconfig_packed_float)
|
||||
|
||||
GLXSyncType enum:
|
||||
SYNC_FRAME_SGIX = 0x00000000 # ChannelRectSyncSGIX synctype
|
||||
SYNC_SWAP_SGIX = 0x00000001 # "
|
||||
|
||||
GLXEventMask enum:
|
||||
PBUFFER_CLOBBER_MASK = 0x08000000 # SelectEvent mask
|
||||
BUFFER_CLOBBER_MASK_SGIX = 0x08000000 # SelectEventSGIX mask
|
||||
# INTEL_future_use = 0x04000000 # SelectEvent mask (for GLX_INTEL_swap_event)
|
||||
|
||||
GLXPbufferClobberMask enum:
|
||||
FRONT_LEFT_BUFFER_BIT = 0x00000001 # PbufferClobberEvent mask
|
||||
FRONT_RIGHT_BUFFER_BIT = 0x00000002 # "
|
||||
BACK_LEFT_BUFFER_BIT = 0x00000004 # "
|
||||
BACK_RIGHT_BUFFER_BIT = 0x00000008 # "
|
||||
AUX_BUFFERS_BIT = 0x00000010 # "
|
||||
DEPTH_BUFFER_BIT = 0x00000020 # "
|
||||
STENCIL_BUFFER_BIT = 0x00000040 # "
|
||||
ACCUM_BUFFER_BIT = 0x00000080 # "
|
||||
FRONT_LEFT_BUFFER_BIT_SGIX = 0x00000001 # BufferClobberEventSGIX mask
|
||||
FRONT_RIGHT_BUFFER_BIT_SGIX = 0x00000002 # "
|
||||
BACK_LEFT_BUFFER_BIT_SGIX = 0x00000004 # "
|
||||
BACK_RIGHT_BUFFER_BIT_SGIX = 0x00000008 # "
|
||||
AUX_BUFFERS_BIT_SGIX = 0x00000010 # "
|
||||
DEPTH_BUFFER_BIT_SGIX = 0x00000020 # "
|
||||
STENCIL_BUFFER_BIT_SGIX = 0x00000040 # "
|
||||
ACCUM_BUFFER_BIT_SGIX = 0x00000080 # "
|
||||
SAMPLE_BUFFERS_BIT_SGIX = 0x00000100 # "
|
||||
|
||||
GLXHyperpipeTypeMask enum:
|
||||
HYPERPIPE_DISPLAY_PIPE_SGIX = 0x00000001 # SGIX_hyperpipe
|
||||
HYPERPIPE_RENDER_PIPE_SGIX = 0x00000002 # "
|
||||
|
||||
GLXHyperpipeAttrib enum:
|
||||
PIPE_RECT_SGIX = 0x00000001 # SGIX_hyperpipe
|
||||
PIPE_RECT_LIMITS_SGIX = 0x00000002 # "
|
||||
HYPERPIPE_STEREO_SGIX = 0x00000003 # "
|
||||
HYPERPIPE_PIXEL_AVERAGE_SGIX = 0x00000004 # "
|
||||
|
||||
GLXHyperpipeMisc enum:
|
||||
HYPERPIPE_PIPE_NAME_LENGTH_SGIX = 80 # SGIX_hyperpipe
|
||||
|
||||
GLXBindToTextureTargetMask enum:
|
||||
TEXTURE_1D_BIT_EXT = 0x00000001 # EXT_texture_from_pixmap
|
||||
TEXTURE_2D_BIT_EXT = 0x00000002
|
||||
TEXTURE_RECTANGLE_BIT_EXT = 0x00000004
|
||||
|
||||
# CONTEXT_FLAGS_ARB bits
|
||||
GLXContextFlags enum:
|
||||
CONTEXT_DEBUG_BIT_ARB = 0x00000001 # ARB_create_context
|
||||
CONTEXT_FORWARD_COMPATIBLE_BIT_ARB = 0x00000002 # ARB_create_context
|
||||
|
||||
# CONTEXT_PROFILE_MASK_ARB bits
|
||||
GLXContextProfileMask enum:
|
||||
CONTEXT_CORE_PROFILE_BIT_ARB = 0x00000001 # ARB_create_context_profile
|
||||
CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB = 0x00000002 # ARB_create_context_profile
|
||||
|
||||
GLXAttribute enum:
|
||||
USE_GL = 1 # Visual attributes
|
||||
BUFFER_SIZE = 2 # "
|
||||
LEVEL = 3 # "
|
||||
RGBA = 4 # "
|
||||
DOUBLEBUFFER = 5 # "
|
||||
STEREO = 6 # "
|
||||
AUX_BUFFERS = 7 # "
|
||||
RED_SIZE = 8 # "
|
||||
GREEN_SIZE = 9 # "
|
||||
BLUE_SIZE = 10 # "
|
||||
ALPHA_SIZE = 11 # "
|
||||
DEPTH_SIZE = 12 # "
|
||||
STENCIL_SIZE = 13 # "
|
||||
ACCUM_RED_SIZE = 14 # "
|
||||
ACCUM_GREEN_SIZE = 15 # "
|
||||
ACCUM_BLUE_SIZE = 16 # "
|
||||
ACCUM_ALPHA_SIZE = 17 # "
|
||||
CONFIG_CAVEAT = 0x20 # "
|
||||
X_VISUAL_TYPE = 0x22 # "
|
||||
TRANSPARENT_TYPE = 0x23 # "
|
||||
TRANSPARENT_INDEX_VALUE = 0x24 # "
|
||||
TRANSPARENT_RED_VALUE = 0x25 # "
|
||||
TRANSPARENT_GREEN_VALUE = 0x26 # "
|
||||
TRANSPARENT_BLUE_VALUE = 0x27 # "
|
||||
TRANSPARENT_ALPHA_VALUE = 0x28 # "
|
||||
DONT_CARE = 0xFFFFFFFF # may be specified for ChooseFBConfig attributes
|
||||
NONE = 0x8000 # several attribute values
|
||||
SLOW_CONFIG = 0x8001 # CONFIG_CAVEAT attribute value
|
||||
TRUE_COLOR = 0x8002 # X_VISUAL_TYPE attribute value
|
||||
DIRECT_COLOR = 0x8003 # "
|
||||
PSEUDO_COLOR = 0x8004 # "
|
||||
STATIC_COLOR = 0x8005 # "
|
||||
GRAY_SCALE = 0x8006 # "
|
||||
STATIC_GRAY = 0x8007 # "
|
||||
TRANSPARENT_RGB = 0x8008 # TRANSPARENT_TYPE attribute value
|
||||
TRANSPARENT_INDEX = 0x8009 # "
|
||||
VISUAL_ID = 0x800B # Context attribute
|
||||
SCREEN = 0x800C # "
|
||||
NON_CONFORMANT_CONFIG = 0x800D # CONFIG_CAVEAT attribute value
|
||||
DRAWABLE_TYPE = 0x8010 # FBConfig attribute
|
||||
RENDER_TYPE = 0x8011 # "
|
||||
X_RENDERABLE = 0x8012 # "
|
||||
FBCONFIG_ID = 0x8013 # "
|
||||
RGBA_TYPE = 0x8014 # CreateNewContext render_type value
|
||||
COLOR_INDEX_TYPE = 0x8015 # "
|
||||
MAX_PBUFFER_WIDTH = 0x8016 # FBConfig attribute
|
||||
MAX_PBUFFER_HEIGHT = 0x8017 # "
|
||||
MAX_PBUFFER_PIXELS = 0x8018 # "
|
||||
PRESERVED_CONTENTS = 0x801B # CreateGLXPbuffer attribute
|
||||
LARGEST_PBUFFER = 0x801C # "
|
||||
WIDTH = 0x801D # Drawable attribute
|
||||
HEIGHT = 0x801E # "
|
||||
EVENT_MASK = 0x801F # "
|
||||
DAMAGED = 0x8020 # PbufferClobber event_type value
|
||||
SAVED = 0x8021 # "
|
||||
WINDOW = 0x8022 # PbufferClobber draw_type value
|
||||
PBUFFER = 0x8023 # "
|
||||
PBUFFER_HEIGHT = 0x8040 # CreateGLXPbuffer attribute
|
||||
PBUFFER_WIDTH = 0x8041 # "
|
||||
VISUAL_CAVEAT_EXT = 0x20 # Visual attribute
|
||||
X_VISUAL_TYPE_EXT = 0x22 # "
|
||||
TRANSPARENT_TYPE_EXT = 0x23 # "
|
||||
TRANSPARENT_INDEX_VALUE_EXT = 0x24 # "
|
||||
TRANSPARENT_RED_VALUE_EXT = 0x25 # "
|
||||
TRANSPARENT_GREEN_VALUE_EXT = 0x26 # "
|
||||
TRANSPARENT_BLUE_VALUE_EXT = 0x27 # "
|
||||
TRANSPARENT_ALPHA_VALUE_EXT = 0x28 # "
|
||||
NONE_EXT = 0x8000 # several EXT attribute values
|
||||
SLOW_VISUAL_EXT = 0x8001 # VISUAL_CAVEAT_EXT attribute value
|
||||
TRUE_COLOR_EXT = 0x8002 # X_VISUAL_TYPE_EXT attribute value
|
||||
DIRECT_COLOR_EXT = 0x8003 # "
|
||||
PSEUDO_COLOR_EXT = 0x8004 # "
|
||||
STATIC_COLOR_EXT = 0x8005 # "
|
||||
GRAY_SCALE_EXT = 0x8006 # "
|
||||
STATIC_GRAY_EXT = 0x8007 # "
|
||||
TRANSPARENT_RGB_EXT = 0x8008 # TRANSPARENT_TYPE_EXT attribute value
|
||||
TRANSPARENT_INDEX_EXT = 0x8009 # "
|
||||
SHARE_CONTEXT_EXT = 0x800A # QueryContextInfoEXT attribute
|
||||
VISUAL_ID_EXT = 0x800B # "
|
||||
SCREEN_EXT = 0x800C # "
|
||||
NON_CONFORMANT_VISUAL_EXT = 0x800D # VISUAL_CAVEAT_EXT attribute value
|
||||
DRAWABLE_TYPE_SGIX = 0x8010 # FBConfigSGIX attribute
|
||||
RENDER_TYPE_SGIX = 0x8011 # "
|
||||
X_RENDERABLE_SGIX = 0x8012 # "
|
||||
FBCONFIG_ID_SGIX = 0x8013 # "
|
||||
RGBA_TYPE_SGIX = 0x8014 # CreateContextWithConfigSGIX render_type value
|
||||
COLOR_INDEX_TYPE_SGIX = 0x8015 # "
|
||||
MAX_PBUFFER_WIDTH_SGIX = 0x8016 # FBConfigSGIX attribute
|
||||
MAX_PBUFFER_HEIGHT_SGIX = 0x8017 # "
|
||||
MAX_PBUFFER_PIXELS_SGIX = 0x8018 # "
|
||||
OPTIMAL_PBUFFER_WIDTH_SGIX = 0x8019 # "
|
||||
OPTIMAL_PBUFFER_HEIGHT_SGIX = 0x801A # "
|
||||
PRESERVED_CONTENTS_SGIX = 0x801B # PbufferSGIX attribute
|
||||
LARGEST_PBUFFER_SGIX = 0x801C # "
|
||||
WIDTH_SGIX = 0x801D # "
|
||||
HEIGHT_SGIX = 0x801E # "
|
||||
EVENT_MASK_SGIX = 0x801F # "
|
||||
DAMAGED_SGIX = 0x8020 # BufferClobberSGIX event_type value
|
||||
SAVED_SGIX = 0x8021 # "
|
||||
WINDOW_SGIX = 0x8022 # BufferClobberSGIX draw_type value
|
||||
PBUFFER_SGIX = 0x8023 # "
|
||||
DIGITAL_MEDIA_PBUFFER_SGIX = 0x8024 # PbufferSGIX attribute
|
||||
BLENDED_RGBA_SGIS = 0x8025 # TRANSPARENT_TYPE_EXT attribute value
|
||||
MULTISAMPLE_SUB_RECT_WIDTH_SGIS = 0x8026 # Visual attribute (shared_multisample)
|
||||
MULTISAMPLE_SUB_RECT_HEIGHT_SGIS = 0x8027 # "
|
||||
VISUAL_SELECT_GROUP_SGIX = 0x8028 # Visual attribute (visual_select_group)
|
||||
HYPERPIPE_ID_SGIX = 0x8030 # Associated hyperpipe ID (SGIX_hyperpipe)
|
||||
SAMPLE_BUFFERS_SGIS = 100000 # Visual attribute (SGIS_multisample)
|
||||
SAMPLES_SGIS = 100001 # "
|
||||
SAMPLE_BUFFERS_ARB = 100000 # Visual attribute (ARB_multisample - alias of SGIS_multisample)
|
||||
SAMPLES_ARB = 100001 # "
|
||||
SAMPLE_BUFFERS = 100000 # Visual attribute (GLX 1.4 core - alias of SGIS_multisample)
|
||||
SAMPLES = 100001 # "
|
||||
|
||||
###############################################################################
|
||||
|
||||
# ARB: 0x2070-0x209F (shared with WGL)
|
||||
|
||||
# Also includes a bitmask - see ContextFlags above
|
||||
# ARB_create_context enum:
|
||||
CONTEXT_MAJOR_VERSION_ARB = 0x2091
|
||||
CONTEXT_MINOR_VERSION_ARB = 0x2092
|
||||
CONTEXT_FLAGS_ARB = 0x2094
|
||||
|
||||
###############################################################################
|
||||
|
||||
# NVIDIA: 0x20A0 - 0x219F (shared with WGL)
|
||||
|
||||
# NV_float_buffer enum:
|
||||
FLOAT_COMPONENTS_NV = 0x20B0
|
||||
# EXT_fbconfig_packed_float enum:
|
||||
RGBA_UNSIGNED_FLOAT_TYPE_EXT = 0x20B1
|
||||
# EXT_framebuffer_sRGB enum:
|
||||
FRAMEBUFFER_SRGB_CAPABLE_EXT = 0x20B2
|
||||
|
||||
# NV_future_use: 0x20B3-0x20B8
|
||||
|
||||
# ARB_fbconfig_float enum:
|
||||
RGBA_FLOAT_TYPE_ARB = 0x20B9
|
||||
|
||||
# NV_future_use: 0x20BA-0x20C2
|
||||
|
||||
# NV_video_out enum:
|
||||
VIDEO_OUT_COLOR_NV = 0x20C3
|
||||
VIDEO_OUT_ALPHA_NV = 0x20C4
|
||||
VIDEO_OUT_DEPTH_NV = 0x20C5
|
||||
VIDEO_OUT_COLOR_AND_ALPHA_NV = 0x20C6
|
||||
VIDEO_OUT_COLOR_AND_DEPTH_NV = 0x20C7
|
||||
VIDEO_OUT_FRAME_NV = 0x20C8
|
||||
VIDEO_OUT_FIELD_1_NV = 0x20C9
|
||||
VIDEO_OUT_FIELD_2_NV = 0x20CA
|
||||
VIDEO_OUT_STACKED_FIELDS_1_2_NV = 0x20CB
|
||||
VIDEO_OUT_STACKED_FIELDS_2_1_NV = 0x20CC
|
||||
|
||||
# NV_video_capture enum:
|
||||
DEVICE_ID_NV = 0x20CD
|
||||
UNIQUE_ID_NV = 0x20CE
|
||||
NUM_VIDEO_CAPTURE_SLOTS_NV = 0x20CF
|
||||
|
||||
# EXT_texture_from_pixmap enum:
|
||||
BIND_TO_TEXTURE_RGB_EXT = 0x20D0
|
||||
BIND_TO_TEXTURE_RGBA_EXT = 0x20D1
|
||||
BIND_TO_MIPMAP_TEXTURE_EXT = 0x20D2
|
||||
BIND_TO_TEXTURE_TARGETS_EXT = 0x20D3
|
||||
Y_INVERTED_EXT = 0x20D4
|
||||
TEXTURE_FORMAT_EXT = 0x20D5
|
||||
TEXTURE_TARGET_EXT = 0x20D6
|
||||
MIPMAP_TEXTURE_EXT = 0x20D7
|
||||
TEXTURE_FORMAT_NONE_EXT = 0x20D8
|
||||
TEXTURE_FORMAT_RGB_EXT = 0x20D9
|
||||
TEXTURE_FORMAT_RGBA_EXT = 0x20DA
|
||||
TEXTURE_1D_EXT = 0x20DB
|
||||
TEXTURE_2D_EXT = 0x20DC
|
||||
TEXTURE_RECTANGLE_EXT = 0x20DD
|
||||
FRONT_LEFT_EXT = 0x20DE
|
||||
FRONT_RIGHT_EXT = 0x20DF
|
||||
BACK_LEFT_EXT = 0x20E0
|
||||
BACK_RIGHT_EXT = 0x20E1
|
||||
FRONT_EXT = GLX_FRONT_LEFT_EXT
|
||||
BACK_EXT = GLX_BACK_LEFT_EXT
|
||||
AUX0_EXT = 0x20E2
|
||||
AUX1_EXT = 0x20E3
|
||||
AUX2_EXT = 0x20E4
|
||||
AUX3_EXT = 0x20E5
|
||||
AUX4_EXT = 0x20E6
|
||||
AUX5_EXT = 0x20E7
|
||||
AUX6_EXT = 0x20E8
|
||||
AUX7_EXT = 0x20E9
|
||||
AUX8_EXT = 0x20EA
|
||||
AUX9_EXT = 0x20EB
|
||||
|
||||
# NV_future_use: 0x20EC-0x20EF
|
||||
|
||||
NV_present_video enum:
|
||||
NUM_VIDEO_SLOTS_NV = 0x20F0
|
||||
|
||||
EXT_swap_control enum:
|
||||
SWAP_INTERVAL_EXT = 0x20F1
|
||||
MAX_SWAP_INTERVAL_EXT = 0x20F2
|
||||
|
||||
# NV_future_use: 0x20F3-0x219F
|
||||
|
||||
###############################################################################
|
||||
|
||||
# MESA (not in a reserved block)
|
||||
|
||||
# MESA_set_3dfx_mode enum:
|
||||
# 3DFX_WINDOW_MODE_MESA = 0x1
|
||||
# 3DFX_FULLSCREEN_MODE_MESA = 0x2
|
||||
|
||||
###############################################################################
|
||||
|
||||
# SGI_future_use: 0x8029-0x802F
|
||||
# SGIX_hyperpipe adds attribute name HYPERPIPE_ID_SGIX = 0x8030
|
||||
# SGI_future_use: 0x8031-0x803F
|
||||
|
||||
###############################################################################
|
||||
|
||||
# ARB_future_use: 0x8042-0x804F
|
||||
|
||||
###############################################################################
|
||||
|
||||
# 3DFX: 0x8050-0x805F
|
||||
|
||||
# 3DFX_multisample enum:
|
||||
# SAMPLE_BUFFERS_3DFX = 0x8050
|
||||
# SAMPLES_3DFX = 0x8051
|
||||
|
||||
###############################################################################
|
||||
|
||||
# OML: 0x8060-0x806F
|
||||
|
||||
# OML_swap_method enum:
|
||||
# SWAP_METHOD_OML = 0x8060
|
||||
# SWAP_EXCHANGE_OML = 0x8061
|
||||
# SWAP_COPY_OML = 0x8062
|
||||
# SWAP_UNDEFINED_OML = 0x8063
|
||||
|
||||
# OML_future_use: 0x8064-0x806F
|
||||
|
||||
###############################################################################
|
||||
|
||||
# NVIDIA: 0x8070 - 0x816F
|
||||
|
||||
NVIDIA_future_use: 0x8070-0x816F
|
||||
|
||||
###############################################################################
|
||||
|
||||
# SUN: 0x8170 - 0x817F
|
||||
|
||||
SUN_future_use: 0x8170-0x817F
|
||||
|
||||
###############################################################################
|
||||
|
||||
# INTEL: 0x8180 - 0x818F
|
||||
|
||||
# INTEL_swap_event: 0x8180-??? (in process, see Khronos bug 5752)
|
||||
|
||||
INTEL_future_use: 0x8180-0x818F
|
||||
|
||||
###############################################################################
|
||||
### Please remember that new GLX enum allocations must be obtained by request
|
||||
### to the Khronos API Registrar (see comments at the top of this file)
|
||||
### File requests in the Khronos Bugzilla, OpenGL project, Registry component.
|
||||
###############################################################################
|
||||
|
||||
# Any_vendor_future_use: 0x8180-0x9125
|
||||
|
||||
# Also includes a bitmask - see ContextProfileMask above
|
||||
# ARB_create_context_profile enum: (equivalent to corresponding GL token)
|
||||
CONTEXT_PROFILE_MASK_ARB = 0x9126
|
||||
|
||||
# Any_vendor_future_use: 0x9127-0xFFFF
|
||||
#
|
||||
# This range must be the last range in the file. To generate a new
|
||||
# range, allocate multiples of 16 from the beginning of the
|
||||
# Any_vendor_future_use range and update glxenum.spec, glxenumext.spec,
|
||||
# and extensions.reserved.
|
|
@ -0,0 +1,503 @@
|
|||
# Copyright (C) 1991-2005 Silicon Graphics, Inc. All Rights Reserved.
|
||||
#
|
||||
# This document is licensed under the SGI Free Software B License Version
|
||||
# 2.0. For details, see http://oss.sgi.com/projects/FreeB/ .
|
||||
|
||||
# List of GLX enumerants for glxext.h header
|
||||
#
|
||||
# This is NOT the master GLX enumerant registry (glxenum.spec).
|
||||
#
|
||||
# Unlike glxenum.spec, glxenumext.spec is
|
||||
# (1) In order by extension number.
|
||||
# (2) Includes only GLX extensions and GLX 1.3/1.4 core enumerants,
|
||||
# since it's assumed all <glx.h> today support at least GLX 1.2.
|
||||
# (3) Has no 'Extensions' section, since enums are always
|
||||
# conditionally protected against multiple definition
|
||||
# by glextenum.pl.
|
||||
# (4) Is processed by glextenum.pl, which has evolved
|
||||
# from enum.pl - should merge back into one script.
|
||||
|
||||
# glxext.h version number - this should be automatically updated,
|
||||
# when changing either enum or template spec files.
|
||||
|
||||
passthru:
|
||||
passthru: /* Header file version number, required by OpenGL ABI for Linux */
|
||||
passthru: /* glxext.h last updated 2009/10/08 */
|
||||
passthru: /* Current version at http://www.opengl.org/registry/ */
|
||||
passthru: #define GLX_GLXEXT_VERSION 25
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# GLX 1.3 enums
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
VERSION_1_3 enum:
|
||||
WINDOW_BIT = 0x00000001 # DRAWABLE_TYPE value
|
||||
PIXMAP_BIT = 0x00000002 # "
|
||||
PBUFFER_BIT = 0x00000004 # "
|
||||
RGBA_BIT = 0x00000001 # RENDER_TYPE value
|
||||
COLOR_INDEX_BIT = 0x00000002 # "
|
||||
PBUFFER_CLOBBER_MASK = 0x08000000 # SelectEvent mask
|
||||
FRONT_LEFT_BUFFER_BIT = 0x00000001 # PbufferClobberEvent mask
|
||||
FRONT_RIGHT_BUFFER_BIT = 0x00000002 # "
|
||||
BACK_LEFT_BUFFER_BIT = 0x00000004 # "
|
||||
BACK_RIGHT_BUFFER_BIT = 0x00000008 # "
|
||||
AUX_BUFFERS_BIT = 0x00000010 # "
|
||||
DEPTH_BUFFER_BIT = 0x00000020 # "
|
||||
STENCIL_BUFFER_BIT = 0x00000040 # "
|
||||
ACCUM_BUFFER_BIT = 0x00000080 # "
|
||||
CONFIG_CAVEAT = 0x20 # "
|
||||
X_VISUAL_TYPE = 0x22 # "
|
||||
TRANSPARENT_TYPE = 0x23 # "
|
||||
TRANSPARENT_INDEX_VALUE = 0x24 # "
|
||||
TRANSPARENT_RED_VALUE = 0x25 # "
|
||||
TRANSPARENT_GREEN_VALUE = 0x26 # "
|
||||
TRANSPARENT_BLUE_VALUE = 0x27 # "
|
||||
TRANSPARENT_ALPHA_VALUE = 0x28 # "
|
||||
DONT_CARE = 0xFFFFFFFF # may be specified for ChooseFBConfig attributes
|
||||
NONE = 0x8000 # several attribute values
|
||||
SLOW_CONFIG = 0x8001 # CONFIG_CAVEAT attribute value
|
||||
TRUE_COLOR = 0x8002 # X_VISUAL_TYPE attribute value
|
||||
DIRECT_COLOR = 0x8003 # "
|
||||
PSEUDO_COLOR = 0x8004 # "
|
||||
STATIC_COLOR = 0x8005 # "
|
||||
GRAY_SCALE = 0x8006 # "
|
||||
STATIC_GRAY = 0x8007 # "
|
||||
TRANSPARENT_RGB = 0x8008 # TRANSPARENT_TYPE attribute value
|
||||
TRANSPARENT_INDEX = 0x8009 # "
|
||||
VISUAL_ID = 0x800B # Context attribute
|
||||
SCREEN = 0x800C # "
|
||||
NON_CONFORMANT_CONFIG = 0x800D # CONFIG_CAVEAT attribute value
|
||||
DRAWABLE_TYPE = 0x8010 # FBConfig attribute
|
||||
RENDER_TYPE = 0x8011 # "
|
||||
X_RENDERABLE = 0x8012 # "
|
||||
FBCONFIG_ID = 0x8013 # "
|
||||
RGBA_TYPE = 0x8014 # CreateNewContext render_type value
|
||||
COLOR_INDEX_TYPE = 0x8015 # "
|
||||
MAX_PBUFFER_WIDTH = 0x8016 # FBConfig attribute
|
||||
MAX_PBUFFER_HEIGHT = 0x8017 # "
|
||||
MAX_PBUFFER_PIXELS = 0x8018 # "
|
||||
PRESERVED_CONTENTS = 0x801B # CreateGLXPbuffer attribute
|
||||
LARGEST_PBUFFER = 0x801C # "
|
||||
WIDTH = 0x801D # Drawable attribute
|
||||
HEIGHT = 0x801E # "
|
||||
EVENT_MASK = 0x801F # "
|
||||
DAMAGED = 0x8020 # PbufferClobber event_type value
|
||||
SAVED = 0x8021 # "
|
||||
WINDOW = 0x8022 # PbufferClobber draw_type value
|
||||
PBUFFER = 0x8023 # "
|
||||
PBUFFER_HEIGHT = 0x8040 # CreateGLXPbuffer attribute
|
||||
PBUFFER_WIDTH = 0x8041 # "
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# GLX 1.4 enums
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
VERSION_1_4 enum:
|
||||
SAMPLE_BUFFERS = 100000
|
||||
SAMPLES = 100001
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# ARB GLX extensions, in ARB extension order
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
###############################################################################
|
||||
|
||||
# No new tokens
|
||||
# ARB Extension #2
|
||||
ARB_get_proc_address enum:
|
||||
|
||||
###############################################################################
|
||||
|
||||
# ARB Extension #5
|
||||
ARB_multisample enum:
|
||||
SAMPLE_BUFFERS_ARB = 100000
|
||||
SAMPLES_ARB = 100001
|
||||
|
||||
###############################################################################
|
||||
|
||||
# ARB Extension #39
|
||||
ARB_fbconfig_float enum:
|
||||
RGBA_FLOAT_TYPE_ARB = 0x20B9
|
||||
RGBA_FLOAT_BIT_ARB = 0x00000004
|
||||
|
||||
###############################################################################
|
||||
|
||||
# ARB Extension #56
|
||||
ARB_create_context enum:
|
||||
CONTEXT_DEBUG_BIT_ARB = 0x00000001
|
||||
CONTEXT_FORWARD_COMPATIBLE_BIT_ARB = 0x00000002
|
||||
CONTEXT_MAJOR_VERSION_ARB = 0x2091
|
||||
CONTEXT_MINOR_VERSION_ARB = 0x2092
|
||||
CONTEXT_FLAGS_ARB = 0x2094
|
||||
|
||||
###############################################################################
|
||||
|
||||
# ARB Extension #75
|
||||
ARB_create_context_profile enum:
|
||||
CONTEXT_CORE_PROFILE_BIT_ARB = 0x00000001
|
||||
CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB = 0x00000002
|
||||
CONTEXT_PROFILE_MASK_ARB = 0x9126
|
||||
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# non-ARB GLX extensions, in registry order
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
###############################################################################
|
||||
|
||||
# Unfortunately, the SGIS_multisample specification and the IRIX
|
||||
# implementation are inconsistent; the spec assigns enums as follows.
|
||||
# ARB_multisample reuses these enums with ARB suffixes, and it can't
|
||||
# be changed at this point. So in the interest of supporting both
|
||||
# extensions on non-IRIX platforms, the SGIS enums will be defined
|
||||
# here as originally specified.
|
||||
|
||||
# Extension #25
|
||||
SGIS_multisample enum:
|
||||
SAMPLE_BUFFERS_SGIS = 100000
|
||||
SAMPLES_SGIS = 100001
|
||||
|
||||
###############################################################################
|
||||
|
||||
# Extension #28
|
||||
EXT_visual_info enum:
|
||||
X_VISUAL_TYPE_EXT = 0x22
|
||||
TRANSPARENT_TYPE_EXT = 0x23
|
||||
TRANSPARENT_INDEX_VALUE_EXT = 0x24
|
||||
TRANSPARENT_RED_VALUE_EXT = 0x25
|
||||
TRANSPARENT_GREEN_VALUE_EXT = 0x26
|
||||
TRANSPARENT_BLUE_VALUE_EXT = 0x27
|
||||
TRANSPARENT_ALPHA_VALUE_EXT = 0x28
|
||||
NONE_EXT = 0x8000
|
||||
TRUE_COLOR_EXT = 0x8002
|
||||
DIRECT_COLOR_EXT = 0x8003
|
||||
PSEUDO_COLOR_EXT = 0x8004
|
||||
STATIC_COLOR_EXT = 0x8005
|
||||
GRAY_SCALE_EXT = 0x8006
|
||||
STATIC_GRAY_EXT = 0x8007
|
||||
TRANSPARENT_RGB_EXT = 0x8008
|
||||
TRANSPARENT_INDEX_EXT = 0x8009
|
||||
|
||||
###############################################################################
|
||||
|
||||
# No new tokens
|
||||
# Extension #40
|
||||
SGI_swap_control enum:
|
||||
|
||||
###############################################################################
|
||||
|
||||
# No new tokens
|
||||
# Extension #41
|
||||
SGI_video_sync enum:
|
||||
|
||||
###############################################################################
|
||||
|
||||
# No new tokens
|
||||
# Extension #42
|
||||
SGI_make_current_read enum:
|
||||
|
||||
###############################################################################
|
||||
|
||||
# No new tokens
|
||||
# Extension #43
|
||||
SGIX_video_source enum:
|
||||
|
||||
###############################################################################
|
||||
|
||||
# Extension #44
|
||||
EXT_visual_rating enum:
|
||||
VISUAL_CAVEAT_EXT = 0x20
|
||||
SLOW_VISUAL_EXT = 0x8001
|
||||
NON_CONFORMANT_VISUAL_EXT = 0x800D
|
||||
use EXT_visual_info NONE_EXT
|
||||
|
||||
###############################################################################
|
||||
|
||||
# Extension #47
|
||||
EXT_import_context enum:
|
||||
SHARE_CONTEXT_EXT = 0x800A
|
||||
VISUAL_ID_EXT = 0x800B
|
||||
SCREEN_EXT = 0x800C
|
||||
|
||||
###############################################################################
|
||||
|
||||
# Extension #49
|
||||
SGIX_fbconfig enum:
|
||||
WINDOW_BIT_SGIX = 0x00000001
|
||||
PIXMAP_BIT_SGIX = 0x00000002
|
||||
RGBA_BIT_SGIX = 0x00000001
|
||||
COLOR_INDEX_BIT_SGIX = 0x00000002
|
||||
DRAWABLE_TYPE_SGIX = 0x8010
|
||||
RENDER_TYPE_SGIX = 0x8011
|
||||
X_RENDERABLE_SGIX = 0x8012
|
||||
FBCONFIG_ID_SGIX = 0x8013
|
||||
RGBA_TYPE_SGIX = 0x8014
|
||||
COLOR_INDEX_TYPE_SGIX = 0x8015
|
||||
use EXT_import_context SCREEN_EXT
|
||||
|
||||
###############################################################################
|
||||
|
||||
# Extension #50
|
||||
SGIX_pbuffer enum:
|
||||
PBUFFER_BIT_SGIX = 0x00000004
|
||||
BUFFER_CLOBBER_MASK_SGIX = 0x08000000
|
||||
FRONT_LEFT_BUFFER_BIT_SGIX = 0x00000001
|
||||
FRONT_RIGHT_BUFFER_BIT_SGIX = 0x00000002
|
||||
BACK_LEFT_BUFFER_BIT_SGIX = 0x00000004
|
||||
BACK_RIGHT_BUFFER_BIT_SGIX = 0x00000008
|
||||
AUX_BUFFERS_BIT_SGIX = 0x00000010
|
||||
DEPTH_BUFFER_BIT_SGIX = 0x00000020
|
||||
STENCIL_BUFFER_BIT_SGIX = 0x00000040
|
||||
ACCUM_BUFFER_BIT_SGIX = 0x00000080
|
||||
SAMPLE_BUFFERS_BIT_SGIX = 0x00000100
|
||||
MAX_PBUFFER_WIDTH_SGIX = 0x8016
|
||||
MAX_PBUFFER_HEIGHT_SGIX = 0x8017
|
||||
MAX_PBUFFER_PIXELS_SGIX = 0x8018
|
||||
OPTIMAL_PBUFFER_WIDTH_SGIX = 0x8019
|
||||
OPTIMAL_PBUFFER_HEIGHT_SGIX = 0x801A
|
||||
PRESERVED_CONTENTS_SGIX = 0x801B
|
||||
LARGEST_PBUFFER_SGIX = 0x801C
|
||||
WIDTH_SGIX = 0x801D
|
||||
HEIGHT_SGIX = 0x801E
|
||||
EVENT_MASK_SGIX = 0x801F
|
||||
DAMAGED_SGIX = 0x8020
|
||||
SAVED_SGIX = 0x8021
|
||||
WINDOW_SGIX = 0x8022
|
||||
PBUFFER_SGIX = 0x8023
|
||||
|
||||
###############################################################################
|
||||
|
||||
# Extension #62
|
||||
SGI_cushion enum:
|
||||
# CUSHION_BUFFERS_SGI ????
|
||||
|
||||
###############################################################################
|
||||
|
||||
# Extension #83
|
||||
SGIX_video_resize enum:
|
||||
SYNC_FRAME_SGIX = 0x00000000
|
||||
SYNC_SWAP_SGIX = 0x00000001
|
||||
|
||||
###############################################################################
|
||||
|
||||
# Extension #86
|
||||
SGIX_dmbuffer enum:
|
||||
DIGITAL_MEDIA_PBUFFER_SGIX = 0x8024
|
||||
|
||||
###############################################################################
|
||||
|
||||
# No new tokens
|
||||
# Extension #91
|
||||
SGIX_swap_group enum:
|
||||
|
||||
###############################################################################
|
||||
|
||||
# No new tokens
|
||||
# Extension #92
|
||||
SGIX_swap_barrier enum:
|
||||
|
||||
###############################################################################
|
||||
|
||||
# Extension #142
|
||||
SGIS_blended_overlay enum:
|
||||
BLENDED_RGBA_SGIS = 0x8025
|
||||
|
||||
###############################################################################
|
||||
|
||||
# Extension #143
|
||||
SGIS_shared_multisample enum:
|
||||
MULTISAMPLE_SUB_RECT_WIDTH_SGIS = 0x8026
|
||||
MULTISAMPLE_SUB_RECT_HEIGHT_SGIS = 0x8027
|
||||
|
||||
###############################################################################
|
||||
|
||||
# No new tokens
|
||||
# Extension #183
|
||||
SUN_get_transparent_index enum:
|
||||
|
||||
###############################################################################
|
||||
|
||||
# Extension #207
|
||||
3DFX_multisample enum:
|
||||
SAMPLE_BUFFERS_3DFX = 0x8050
|
||||
SAMPLES_3DFX = 0x8051
|
||||
|
||||
###############################################################################
|
||||
|
||||
# No new tokens
|
||||
# Extension #215
|
||||
MESA_copy_sub_buffer enum:
|
||||
|
||||
###############################################################################
|
||||
|
||||
# No new tokens
|
||||
# Extension #216
|
||||
MESA_pixmap_colormap enum:
|
||||
|
||||
###############################################################################
|
||||
|
||||
# No new tokens
|
||||
# Extension #217
|
||||
MESA_release_buffers enum:
|
||||
|
||||
###############################################################################
|
||||
|
||||
# Extension #218
|
||||
MESA_set_3dfx_mode enum:
|
||||
3DFX_WINDOW_MODE_MESA = 0x1
|
||||
3DFX_FULLSCREEN_MODE_MESA = 0x2
|
||||
|
||||
###############################################################################
|
||||
|
||||
# Extension #234
|
||||
SGIX_visual_select_group enum:
|
||||
VISUAL_SELECT_GROUP_SGIX = 0x8028
|
||||
|
||||
###############################################################################
|
||||
|
||||
# Extension #237
|
||||
OML_swap_method enum:
|
||||
SWAP_METHOD_OML = 0x8060
|
||||
SWAP_EXCHANGE_OML = 0x8061
|
||||
SWAP_COPY_OML = 0x8062
|
||||
SWAP_UNDEFINED_OML = 0x8063
|
||||
|
||||
###############################################################################
|
||||
|
||||
# No new tokens
|
||||
# Extension #238
|
||||
OML_sync_control enum:
|
||||
|
||||
###############################################################################
|
||||
|
||||
# Extension #281
|
||||
NV_float_buffer enum:
|
||||
FLOAT_COMPONENTS_NV = 0x20B0
|
||||
|
||||
###############################################################################
|
||||
|
||||
# Extension #307
|
||||
SGIX_hyperpipe enum:
|
||||
HYPERPIPE_PIPE_NAME_LENGTH_SGIX = 80
|
||||
BAD_HYPERPIPE_CONFIG_SGIX = 91
|
||||
BAD_HYPERPIPE_SGIX = 92
|
||||
HYPERPIPE_DISPLAY_PIPE_SGIX = 0x00000001
|
||||
HYPERPIPE_RENDER_PIPE_SGIX = 0x00000002
|
||||
PIPE_RECT_SGIX = 0x00000001
|
||||
PIPE_RECT_LIMITS_SGIX = 0x00000002
|
||||
HYPERPIPE_STEREO_SGIX = 0x00000003
|
||||
HYPERPIPE_PIXEL_AVERAGE_SGIX = 0x00000004
|
||||
HYPERPIPE_ID_SGIX = 0x8030
|
||||
|
||||
###############################################################################
|
||||
|
||||
# No new tokens
|
||||
# Extension #308
|
||||
MESA_agp_offset enum:
|
||||
|
||||
###############################################################################
|
||||
|
||||
# Extension #328
|
||||
EXT_fbconfig_packed_float enum:
|
||||
RGBA_UNSIGNED_FLOAT_TYPE_EXT = 0x20B1
|
||||
RGBA_UNSIGNED_FLOAT_BIT_EXT = 0x00000008
|
||||
|
||||
###############################################################################
|
||||
|
||||
# Extension #337
|
||||
EXT_framebuffer_sRGB enum:
|
||||
FRAMEBUFFER_SRGB_CAPABLE_EXT = 0x20B2
|
||||
|
||||
###############################################################################
|
||||
|
||||
# Extension #344
|
||||
EXT_texture_from_pixmap enum:
|
||||
TEXTURE_1D_BIT_EXT = 0x00000001
|
||||
TEXTURE_2D_BIT_EXT = 0x00000002
|
||||
TEXTURE_RECTANGLE_BIT_EXT = 0x00000004
|
||||
BIND_TO_TEXTURE_RGB_EXT = 0x20D0
|
||||
BIND_TO_TEXTURE_RGBA_EXT = 0x20D1
|
||||
BIND_TO_MIPMAP_TEXTURE_EXT = 0x20D2
|
||||
BIND_TO_TEXTURE_TARGETS_EXT = 0x20D3
|
||||
Y_INVERTED_EXT = 0x20D4
|
||||
TEXTURE_FORMAT_EXT = 0x20D5
|
||||
TEXTURE_TARGET_EXT = 0x20D6
|
||||
MIPMAP_TEXTURE_EXT = 0x20D7
|
||||
TEXTURE_FORMAT_NONE_EXT = 0x20D8
|
||||
TEXTURE_FORMAT_RGB_EXT = 0x20D9
|
||||
TEXTURE_FORMAT_RGBA_EXT = 0x20DA
|
||||
TEXTURE_1D_EXT = 0x20DB
|
||||
TEXTURE_2D_EXT = 0x20DC
|
||||
TEXTURE_RECTANGLE_EXT = 0x20DD
|
||||
FRONT_LEFT_EXT = 0x20DE
|
||||
FRONT_RIGHT_EXT = 0x20DF
|
||||
BACK_LEFT_EXT = 0x20E0
|
||||
BACK_RIGHT_EXT = 0x20E1
|
||||
FRONT_EXT = GLX_FRONT_LEFT_EXT
|
||||
BACK_EXT = GLX_BACK_LEFT_EXT
|
||||
AUX0_EXT = 0x20E2
|
||||
AUX1_EXT = 0x20E3
|
||||
AUX2_EXT = 0x20E4
|
||||
AUX3_EXT = 0x20E5
|
||||
AUX4_EXT = 0x20E6
|
||||
AUX5_EXT = 0x20E7
|
||||
AUX6_EXT = 0x20E8
|
||||
AUX7_EXT = 0x20E9
|
||||
AUX8_EXT = 0x20EA
|
||||
AUX9_EXT = 0x20EB
|
||||
|
||||
###############################################################################
|
||||
|
||||
# Extension #347
|
||||
NV_present_video enum:
|
||||
NUM_VIDEO_SLOTS_NV = 0x20F0
|
||||
|
||||
###############################################################################
|
||||
|
||||
# Extension #348
|
||||
NV_video_out enum:
|
||||
VIDEO_OUT_COLOR_NV = 0x20C3
|
||||
VIDEO_OUT_ALPHA_NV = 0x20C4
|
||||
VIDEO_OUT_DEPTH_NV = 0x20C5
|
||||
VIDEO_OUT_COLOR_AND_ALPHA_NV = 0x20C6
|
||||
VIDEO_OUT_COLOR_AND_DEPTH_NV = 0x20C7
|
||||
VIDEO_OUT_FRAME_NV = 0x20C8
|
||||
VIDEO_OUT_FIELD_1_NV = 0x20C9
|
||||
VIDEO_OUT_FIELD_2_NV = 0x20CA
|
||||
VIDEO_OUT_STACKED_FIELDS_1_2_NV = 0x20CB
|
||||
VIDEO_OUT_STACKED_FIELDS_2_1_NV = 0x20CC
|
||||
|
||||
###############################################################################
|
||||
|
||||
# No new tokens
|
||||
# Extension #350
|
||||
NV_swap_group enum:
|
||||
|
||||
###############################################################################
|
||||
|
||||
# Extension #374
|
||||
NV_video_capture enum:
|
||||
DEVICE_ID_NV = 0x20CD
|
||||
UNIQUE_ID_NV = 0x20CE
|
||||
NUM_VIDEO_CAPTURE_SLOTS_NV = 0x20CF
|
||||
|
||||
###############################################################################
|
||||
|
||||
# Extension #375
|
||||
EXT_swap_control enum:
|
||||
SWAP_INTERVAL_EXT = 0x20F1
|
||||
MAX_SWAP_INTERVAL_EXT = 0x20F2
|
||||
|
||||
###############################################################################
|
||||
|
||||
# No new tokens
|
||||
# Extension #376
|
||||
NV_copy_image enum:
|
File diff suppressed because it is too large
Load Diff
|
@ -237,9 +237,11 @@ _gl_get_context_mode_data(const __GLcontextModes * mode, int attribute,
|
|||
case GLX_LEVEL:
|
||||
*value_return = mode->level;
|
||||
return 0;
|
||||
#ifndef GLX_USE_APPLEGL /* This isn't supported by CGL. */
|
||||
case GLX_TRANSPARENT_TYPE_EXT:
|
||||
*value_return = mode->transparentPixel;
|
||||
return 0;
|
||||
#endif
|
||||
case GLX_TRANSPARENT_RED_VALUE:
|
||||
*value_return = mode->transparentRed;
|
||||
return 0;
|
||||
|
@ -285,6 +287,7 @@ _gl_get_context_mode_data(const __GLcontextModes * mode, int attribute,
|
|||
case GLX_MAX_PBUFFER_PIXELS:
|
||||
*value_return = mode->maxPbufferPixels;
|
||||
return 0;
|
||||
#ifndef GLX_USE_APPLEGL /* These aren't supported by CGL. */
|
||||
case GLX_OPTIMAL_PBUFFER_WIDTH_SGIX:
|
||||
*value_return = mode->optimalPbufferWidth;
|
||||
return 0;
|
||||
|
@ -294,6 +297,7 @@ _gl_get_context_mode_data(const __GLcontextModes * mode, int attribute,
|
|||
case GLX_SWAP_METHOD_OML:
|
||||
*value_return = mode->swapMethod;
|
||||
return 0;
|
||||
#endif
|
||||
case GLX_SAMPLE_BUFFERS_SGIS:
|
||||
*value_return = mode->sampleBuffers;
|
||||
return 0;
|
||||
|
|
|
@ -37,6 +37,12 @@
|
|||
#include <string.h>
|
||||
#include "glxextensions.h"
|
||||
|
||||
#ifdef GLX_USE_APPLEGL
|
||||
#include <pthread.h>
|
||||
#include "apple_glx_drawable.h"
|
||||
#include "glx_error.h"
|
||||
#endif
|
||||
|
||||
#define WARN_ONCE_GLX_1_3(a, b) { \
|
||||
static int warned=1; \
|
||||
if(warned) { \
|
||||
|
@ -49,19 +55,19 @@
|
|||
* Emit a warning when clients use GLX 1.3 functions on pre-1.3 systems.
|
||||
*/
|
||||
static void
|
||||
warn_GLX_1_3(Display *dpy, const char *function_name)
|
||||
warn_GLX_1_3(Display * dpy, const char *function_name)
|
||||
{
|
||||
__GLXdisplayPrivate *priv = __glXInitialize(dpy);
|
||||
|
||||
if (priv->minorVersion < 3) {
|
||||
fprintf(stderr,
|
||||
"WARNING: Application calling GLX 1.3 function \"%s\" "
|
||||
"when GLX 1.3 is not supported! This is an application bug!\n",
|
||||
function_name);
|
||||
fprintf(stderr,
|
||||
"WARNING: Application calling GLX 1.3 function \"%s\" "
|
||||
"when GLX 1.3 is not supported! This is an application bug!\n",
|
||||
function_name);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifndef GLX_USE_APPLEGL
|
||||
/**
|
||||
* Change a drawable's attribute.
|
||||
*
|
||||
|
@ -552,7 +558,6 @@ CreatePbuffer(Display * dpy, const __GLcontextModes * fbconfig,
|
|||
return id;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create a new pbuffer.
|
||||
*/
|
||||
|
@ -566,6 +571,7 @@ glXCreateGLXPbufferSGIX(Display * dpy, GLXFBConfigSGIX config,
|
|||
attrib_list, GL_FALSE);
|
||||
}
|
||||
|
||||
#endif /* GLX_USE_APPLEGL */
|
||||
|
||||
/**
|
||||
* Create a new pbuffer.
|
||||
|
@ -574,12 +580,57 @@ PUBLIC GLXPbuffer
|
|||
glXCreatePbuffer(Display * dpy, GLXFBConfig config, const int *attrib_list)
|
||||
{
|
||||
int i, width, height;
|
||||
#ifdef GLX_USE_APPLEGL
|
||||
GLXPbuffer result;
|
||||
int errorcode;
|
||||
#endif
|
||||
|
||||
width = 0;
|
||||
height = 0;
|
||||
|
||||
WARN_ONCE_GLX_1_3(dpy, __func__);
|
||||
|
||||
#ifdef GLX_USE_APPLEGL
|
||||
for (i = 0; attrib_list[i]; ++i) {
|
||||
switch (attrib_list[i]) {
|
||||
case GLX_PBUFFER_WIDTH:
|
||||
width = attrib_list[i + 1];
|
||||
++i;
|
||||
break;
|
||||
|
||||
case GLX_PBUFFER_HEIGHT:
|
||||
height = attrib_list[i + 1];
|
||||
++i;
|
||||
break;
|
||||
|
||||
case GLX_LARGEST_PBUFFER:
|
||||
/* This is a hint we should probably handle, but how? */
|
||||
++i;
|
||||
break;
|
||||
|
||||
case GLX_PRESERVED_CONTENTS:
|
||||
/* The contents are always preserved with AppleSGLX with CGL. */
|
||||
++i;
|
||||
break;
|
||||
|
||||
default:
|
||||
return None;
|
||||
}
|
||||
}
|
||||
|
||||
if (apple_glx_pbuffer_create(dpy, config, width, height, &errorcode,
|
||||
&result)) {
|
||||
/*
|
||||
* apple_glx_pbuffer_create only sets the errorcode to core X11
|
||||
* errors.
|
||||
*/
|
||||
__glXSendError(dpy, errorcode, 0, X_GLXCreatePbuffer, true);
|
||||
|
||||
return None;
|
||||
}
|
||||
|
||||
return result;
|
||||
#else
|
||||
for (i = 0; attrib_list[i * 2]; i++) {
|
||||
switch (attrib_list[i * 2]) {
|
||||
case GLX_PBUFFER_WIDTH:
|
||||
|
@ -593,6 +644,7 @@ glXCreatePbuffer(Display * dpy, GLXFBConfig config, const int *attrib_list)
|
|||
|
||||
return (GLXPbuffer) CreatePbuffer(dpy, (__GLcontextModes *) config,
|
||||
width, height, attrib_list, GL_TRUE);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -602,7 +654,13 @@ glXCreatePbuffer(Display * dpy, GLXFBConfig config, const int *attrib_list)
|
|||
PUBLIC void
|
||||
glXDestroyPbuffer(Display * dpy, GLXPbuffer pbuf)
|
||||
{
|
||||
#ifdef GLX_USE_APPLEGL
|
||||
if (apple_glx_pbuffer_destroy(dpy, pbuf)) {
|
||||
__glXSendError(dpy, GLXBadPbuffer, pbuf, X_GLXDestroyPbuffer, false);
|
||||
}
|
||||
#else
|
||||
DestroyPbuffer(dpy, pbuf);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -614,10 +672,47 @@ glXQueryDrawable(Display * dpy, GLXDrawable drawable,
|
|||
int attribute, unsigned int *value)
|
||||
{
|
||||
WARN_ONCE_GLX_1_3(dpy, __func__);
|
||||
#ifdef GLX_USE_APPLEGL
|
||||
Window root;
|
||||
int x, y;
|
||||
unsigned int width, height, bd, depth;
|
||||
|
||||
if (apple_glx_pixmap_query(drawable, attribute, value))
|
||||
return; /*done */
|
||||
|
||||
if (apple_glx_pbuffer_query(drawable, attribute, value))
|
||||
return; /*done */
|
||||
|
||||
/*
|
||||
* The OpenGL spec states that we should report GLXBadDrawable if
|
||||
* the drawable is invalid, however doing so would require that we
|
||||
* use XSetErrorHandler(), which is known to not be thread safe.
|
||||
* If we use a round-trip call to validate the drawable, there could
|
||||
* be a race, so instead we just opt in favor of letting the
|
||||
* XGetGeometry request fail with a GetGeometry request X error
|
||||
* rather than GLXBadDrawable, in what is hoped to be a rare
|
||||
* case of an invalid drawable. In practice most and possibly all
|
||||
* X11 apps using GLX shouldn't notice a difference.
|
||||
*/
|
||||
if (XGetGeometry
|
||||
(dpy, drawable, &root, &x, &y, &width, &height, &bd, &depth)) {
|
||||
switch (attribute) {
|
||||
case GLX_WIDTH:
|
||||
*value = width;
|
||||
break;
|
||||
|
||||
case GLX_HEIGHT:
|
||||
*value = height;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#else
|
||||
GetDrawableAttribute(dpy, drawable, attribute, value);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#ifndef GLX_USE_APPLEGL
|
||||
/**
|
||||
* Query an attribute of a pbuffer.
|
||||
*/
|
||||
|
@ -627,7 +722,7 @@ glXQueryGLXPbufferSGIX(Display * dpy, GLXPbufferSGIX drawable,
|
|||
{
|
||||
return GetDrawableAttribute(dpy, drawable, attribute, value);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Select the event mask for a drawable.
|
||||
|
@ -635,12 +730,30 @@ glXQueryGLXPbufferSGIX(Display * dpy, GLXPbufferSGIX drawable,
|
|||
PUBLIC void
|
||||
glXSelectEvent(Display * dpy, GLXDrawable drawable, unsigned long mask)
|
||||
{
|
||||
#ifdef GLX_USE_APPLEGL
|
||||
XWindowAttributes xwattr;
|
||||
|
||||
if (apple_glx_pbuffer_set_event_mask(drawable, mask))
|
||||
return; /*done */
|
||||
|
||||
/*
|
||||
* The spec allows a window, but currently there are no valid
|
||||
* events for a window, so do nothing.
|
||||
*/
|
||||
if (XGetWindowAttributes(dpy, drawable, &xwattr))
|
||||
return; /*done */
|
||||
/* The drawable seems to be invalid. Report an error. */
|
||||
|
||||
__glXSendError(dpy, GLXBadDrawable, drawable,
|
||||
X_GLXChangeDrawableAttributes, false);
|
||||
#else
|
||||
CARD32 attribs[2];
|
||||
|
||||
attribs[0] = (CARD32) GLX_EVENT_MASK;
|
||||
attribs[1] = (CARD32) mask;
|
||||
|
||||
ChangeDrawableAttribute(dpy, drawable, attribs, 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -650,6 +763,26 @@ glXSelectEvent(Display * dpy, GLXDrawable drawable, unsigned long mask)
|
|||
PUBLIC void
|
||||
glXGetSelectedEvent(Display * dpy, GLXDrawable drawable, unsigned long *mask)
|
||||
{
|
||||
#ifdef GLX_USE_APPLEGL
|
||||
XWindowAttributes xwattr;
|
||||
|
||||
if (apple_glx_pbuffer_get_event_mask(drawable, mask))
|
||||
return; /*done */
|
||||
|
||||
/*
|
||||
* The spec allows a window, but currently there are no valid
|
||||
* events for a window, so do nothing, but set the mask to 0.
|
||||
*/
|
||||
if (XGetWindowAttributes(dpy, drawable, &xwattr)) {
|
||||
/* The window is valid, so set the mask to 0. */
|
||||
*mask = 0;
|
||||
return; /*done */
|
||||
}
|
||||
/* The drawable seems to be invalid. Report an error. */
|
||||
|
||||
__glXSendError(dpy, GLXBadDrawable, drawable, X_GLXGetDrawableAttributes,
|
||||
true);
|
||||
#else
|
||||
unsigned int value;
|
||||
|
||||
|
||||
|
@ -660,6 +793,7 @@ glXGetSelectedEvent(Display * dpy, GLXDrawable drawable, unsigned long *mask)
|
|||
|
||||
GetDrawableAttribute(dpy, drawable, GLX_EVENT_MASK_SGIX, &value);
|
||||
*mask = value;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -669,8 +803,17 @@ glXCreatePixmap(Display * dpy, GLXFBConfig config, Pixmap pixmap,
|
|||
{
|
||||
WARN_ONCE_GLX_1_3(dpy, __func__);
|
||||
|
||||
#ifdef GLX_USE_APPLEGL
|
||||
const __GLcontextModes *modes = (const __GLcontextModes *) config;
|
||||
|
||||
if (apple_glx_pixmap_create(dpy, modes->screen, pixmap, modes))
|
||||
return None;
|
||||
|
||||
return pixmap;
|
||||
#else
|
||||
return CreateDrawable(dpy, (__GLcontextModes *) config,
|
||||
(Drawable) pixmap, attrib_list, X_GLXCreatePixmap);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -679,9 +822,33 @@ glXCreateWindow(Display * dpy, GLXFBConfig config, Window win,
|
|||
const int *attrib_list)
|
||||
{
|
||||
WARN_ONCE_GLX_1_3(dpy, __func__);
|
||||
#ifdef GLX_USE_APPLEGL
|
||||
XWindowAttributes xwattr;
|
||||
XVisualInfo *visinfo;
|
||||
|
||||
(void) attrib_list; /*unused according to GLX 1.4 */
|
||||
|
||||
XGetWindowAttributes(dpy, win, &xwattr);
|
||||
|
||||
visinfo = glXGetVisualFromFBConfig(dpy, config);
|
||||
|
||||
if (NULL == visinfo) {
|
||||
__glXSendError(dpy, GLXBadFBConfig, 0, X_GLXCreateWindow, false);
|
||||
return None;
|
||||
}
|
||||
|
||||
if (visinfo->visualid != XVisualIDFromVisual(xwattr.visual)) {
|
||||
__glXSendError(dpy, BadMatch, 0, X_GLXCreateWindow, true);
|
||||
return None;
|
||||
}
|
||||
|
||||
XFree(visinfo);
|
||||
|
||||
return win;
|
||||
#else
|
||||
return CreateDrawable(dpy, (__GLcontextModes *) config,
|
||||
(Drawable) win, attrib_list, X_GLXCreateWindow);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -689,8 +856,12 @@ PUBLIC void
|
|||
glXDestroyPixmap(Display * dpy, GLXPixmap pixmap)
|
||||
{
|
||||
WARN_ONCE_GLX_1_3(dpy, __func__);
|
||||
|
||||
#ifdef GLX_USE_APPLEGL
|
||||
if (apple_glx_pixmap_destroy(dpy, pixmap))
|
||||
__glXSendError(dpy, GLXBadPixmap, pixmap, X_GLXDestroyPixmap, false);
|
||||
#else
|
||||
DestroyDrawable(dpy, (GLXDrawable) pixmap, X_GLXDestroyPixmap);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -698,11 +869,12 @@ PUBLIC void
|
|||
glXDestroyWindow(Display * dpy, GLXWindow win)
|
||||
{
|
||||
WARN_ONCE_GLX_1_3(dpy, __func__);
|
||||
|
||||
#ifndef GLX_USE_APPLEGL
|
||||
DestroyDrawable(dpy, (GLXDrawable) win, X_GLXDestroyWindow);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#ifndef GLX_USE_APPLEGL
|
||||
PUBLIC
|
||||
GLX_ALIAS_VOID(glXDestroyGLXPbufferSGIX,
|
||||
(Display * dpy, GLXPbufferSGIX pbuf),
|
||||
|
@ -718,4 +890,4 @@ GLX_ALIAS_VOID(glXGetSelectedEventSGIX,
|
|||
(Display * dpy, GLXDrawable drawable,
|
||||
unsigned long *mask), (dpy, drawable, mask),
|
||||
glXGetSelectedEvent)
|
||||
|
||||
#endif
|
||||
|
|
|
@ -54,7 +54,9 @@
|
|||
#include "GL/glxint.h"
|
||||
#include "GL/glxproto.h"
|
||||
#include "GL/internal/glcore.h"
|
||||
#ifndef GLX_USE_APPLEGL
|
||||
#include "glapi/glapitable.h"
|
||||
#endif
|
||||
#include "glxhash.h"
|
||||
#if defined( PTHREADS )
|
||||
# include <pthread.h>
|
||||
|
@ -197,6 +199,10 @@ extern const char *glXGetDriverConfig(const char *driverName);
|
|||
|
||||
#endif
|
||||
|
||||
#ifdef GLX_USE_APPLEGL
|
||||
extern void DRI_glXUseXFont( Font font, int first, int count, int listbase );
|
||||
#endif
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
#define __GL_CLIENT_ATTRIB_STACK_DEPTH 16
|
||||
|
@ -449,6 +455,11 @@ struct __GLXcontextRec
|
|||
unsigned long thread_id;
|
||||
|
||||
char gl_extension_bits[__GL_EXT_BYTES];
|
||||
|
||||
#ifdef GLX_USE_APPLEGL
|
||||
void *apple;
|
||||
Bool do_destroy;
|
||||
#endif
|
||||
};
|
||||
|
||||
#define __glXSetError(gc,code) \
|
||||
|
@ -627,12 +638,14 @@ struct __GLXdisplayPrivateRec
|
|||
|
||||
extern GLubyte *__glXFlushRenderBuffer(__GLXcontext *, GLubyte *);
|
||||
|
||||
#ifndef GLX_USE_APPLEGL
|
||||
extern void __glXSendLargeChunk(__GLXcontext * gc, GLint requestNumber,
|
||||
GLint totalRequests,
|
||||
const GLvoid * data, GLint dataLen);
|
||||
|
||||
extern void __glXSendLargeCommand(__GLXcontext *, const GLvoid *, GLint,
|
||||
const GLvoid *, GLint);
|
||||
#endif
|
||||
|
||||
/* Initialize the GLX extension for dpy */
|
||||
extern __GLXdisplayPrivate *__glXInitialize(Display *);
|
||||
|
|
|
@ -34,11 +34,17 @@
|
|||
*/
|
||||
|
||||
#include "glxclient.h"
|
||||
#ifdef GLX_USE_APPLEGL
|
||||
#include "apple_glx_context.h"
|
||||
#include "apple_glx.h"
|
||||
#include "glx_error.h"
|
||||
#else
|
||||
#include "glapi.h"
|
||||
#endif
|
||||
#include "glxextensions.h"
|
||||
#include "glcontextmodes.h"
|
||||
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
|
||||
#include <sys/time.h>
|
||||
#include <X11/extensions/xf86vmode.h>
|
||||
#include "xf86dri.h"
|
||||
|
@ -344,6 +350,12 @@ AllocateGLXContext(Display * dpy)
|
|||
bufSize = __GLX_MAX_RENDER_CMD_SIZE;
|
||||
}
|
||||
gc->maxSmallRenderCommandSize = bufSize;
|
||||
|
||||
#ifdef GLX_USE_APPLEGL
|
||||
gc->apple = NULL;
|
||||
gc->do_destroy = False;
|
||||
#endif
|
||||
|
||||
return gc;
|
||||
}
|
||||
|
||||
|
@ -368,7 +380,11 @@ CreateContext(Display * dpy, int generic_id,
|
|||
#ifdef GLX_DIRECT_RENDERING
|
||||
__GLXscreenConfigs *const psc = GetGLXScreenConfigs(dpy, screen);
|
||||
#endif
|
||||
|
||||
#ifdef GLX_USE_APPLEGL
|
||||
int errorcode;
|
||||
bool x11error;
|
||||
#endif
|
||||
|
||||
if (dpy == NULL)
|
||||
return NULL;
|
||||
|
||||
|
@ -379,6 +395,7 @@ CreateContext(Display * dpy, int generic_id,
|
|||
if (!gc)
|
||||
return NULL;
|
||||
|
||||
#ifndef GLX_USE_APPLEGL
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
if (allowDirect && psc->driScreen) {
|
||||
gc->driContext = psc->driScreen->createContext(psc, fbconfig, gc,
|
||||
|
@ -455,9 +472,24 @@ CreateContext(Display * dpy, int generic_id,
|
|||
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
#endif
|
||||
|
||||
gc->imported = GL_FALSE;
|
||||
#ifdef GLX_USE_APPLEGL
|
||||
if(apple_glx_create_context(&gc->apple, dpy, screen, fbconfig,
|
||||
shareList ? shareList->apple : NULL,
|
||||
&errorcode, &x11error)) {
|
||||
__glXSendError(dpy, errorcode, 0, X_GLXCreateContext, x11error);
|
||||
__glXFreeContext(gc);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
gc->currentContextTag = -1;
|
||||
gc->mode = fbconfig;
|
||||
gc->isDirect = allowDirect;
|
||||
#else
|
||||
gc->renderType = renderType;
|
||||
#endif
|
||||
|
||||
return gc;
|
||||
}
|
||||
|
@ -469,7 +501,7 @@ glXCreateContext(Display * dpy, XVisualInfo * vis,
|
|||
const __GLcontextModes *mode = NULL;
|
||||
int renderType = 0;
|
||||
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
#if defined(GLX_DIRECT_RENDERING) || defined(GLX_USE_APPLEGL)
|
||||
__GLXscreenConfigs *const psc = GetGLXScreenConfigs(dpy, vis->screen);
|
||||
|
||||
mode = _gl_context_modes_find_visual(psc->visuals, vis->visualid);
|
||||
|
@ -504,7 +536,9 @@ __glXFreeContext(__GLXcontext * gc)
|
|||
XFree((char *) gc->version);
|
||||
if (gc->extensions)
|
||||
XFree((char *) gc->extensions);
|
||||
#ifndef GLX_USE_APPLEGL
|
||||
__glFreeAttributeState(gc);
|
||||
#endif
|
||||
XFree((char *) gc->buf);
|
||||
Xfree((char *) gc->client_state_private);
|
||||
XFree((char *) gc);
|
||||
|
@ -517,6 +551,7 @@ __glXFreeContext(__GLXcontext * gc)
|
|||
static void
|
||||
DestroyContext(Display * dpy, GLXContext gc)
|
||||
{
|
||||
#ifndef GLX_USE_APPLEGL
|
||||
xGLXDestroyContextReq *req;
|
||||
GLXContextID xid;
|
||||
CARD8 opcode;
|
||||
|
@ -552,17 +587,31 @@ DestroyContext(Display * dpy, GLXContext gc)
|
|||
#endif
|
||||
|
||||
__glXFreeVertexArrayState(gc);
|
||||
#else
|
||||
__glXLock();
|
||||
#endif /* GLX_USE_APPLEGL */
|
||||
|
||||
if (gc->currentDpy) {
|
||||
#ifdef GLX_USE_APPLEGL
|
||||
/*
|
||||
* Set the Bool that indicates that we should destroy this GLX context
|
||||
* when the context is no longer current.
|
||||
*/
|
||||
gc->do_destroy = True;
|
||||
#endif
|
||||
/* Have to free later cuz it's in use now */
|
||||
__glXUnlock();
|
||||
}
|
||||
else {
|
||||
/* Destroy the handle if not current to anybody */
|
||||
__glXUnlock();
|
||||
#ifdef GLX_USE_APPLEGL
|
||||
if(gc->apple)
|
||||
apple_glx_destroy_context(&gc->apple, dpy);
|
||||
#endif
|
||||
__glXFreeContext(gc);
|
||||
}
|
||||
|
||||
#ifndef GLX_USE_APPLEGL
|
||||
if (!imported) {
|
||||
/*
|
||||
** This dpy also created the server side part of the context.
|
||||
|
@ -576,6 +625,7 @@ DestroyContext(Display * dpy, GLXContext gc)
|
|||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
PUBLIC void
|
||||
|
@ -630,7 +680,9 @@ glXQueryExtension(Display * dpy, int *errorBase, int *eventBase)
|
|||
PUBLIC void
|
||||
glXWaitGL(void)
|
||||
{
|
||||
#ifndef GLX_USE_APPLEGL
|
||||
xGLXWaitGLReq *req;
|
||||
#endif
|
||||
GLXContext gc = __glXGetCurrentContext();
|
||||
Display *dpy = gc->currentDpy;
|
||||
|
||||
|
@ -639,7 +691,9 @@ glXWaitGL(void)
|
|||
|
||||
/* Flush any pending commands out */
|
||||
__glXFlushRenderBuffer(gc, gc->pc);
|
||||
|
||||
#ifdef GLX_USE_APPLEGL
|
||||
glFinish();
|
||||
#else
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
if (gc->driContext) {
|
||||
int screen;
|
||||
|
@ -664,6 +718,7 @@ glXWaitGL(void)
|
|||
req->contextTag = gc->currentContextTag;
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
#endif /* GLX_USE_APPLEGL */
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -673,7 +728,9 @@ glXWaitGL(void)
|
|||
PUBLIC void
|
||||
glXWaitX(void)
|
||||
{
|
||||
#ifndef GLX_USE_APPLEGL
|
||||
xGLXWaitXReq *req;
|
||||
#endif
|
||||
GLXContext gc = __glXGetCurrentContext();
|
||||
Display *dpy = gc->currentDpy;
|
||||
|
||||
|
@ -683,6 +740,9 @@ glXWaitX(void)
|
|||
/* Flush any pending commands out */
|
||||
__glXFlushRenderBuffer(gc, gc->pc);
|
||||
|
||||
#ifdef GLX_USE_APPLEGL
|
||||
apple_glx_waitx(dpy, gc->apple);
|
||||
#else
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
if (gc->driContext) {
|
||||
int screen;
|
||||
|
@ -710,12 +770,15 @@ glXWaitX(void)
|
|||
req->contextTag = gc->currentContextTag;
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
#endif /* GLX_USE_APPLEGL */
|
||||
}
|
||||
|
||||
PUBLIC void
|
||||
glXUseXFont(Font font, int first, int count, int listBase)
|
||||
{
|
||||
#ifndef GLX_USE_APPLEGL
|
||||
xGLXUseXFontReq *req;
|
||||
#endif
|
||||
GLXContext gc = __glXGetCurrentContext();
|
||||
Display *dpy = gc->currentDpy;
|
||||
|
||||
|
@ -724,7 +787,9 @@ glXUseXFont(Font font, int first, int count, int listBase)
|
|||
|
||||
/* Flush any pending commands out */
|
||||
(void) __glXFlushRenderBuffer(gc, gc->pc);
|
||||
|
||||
#ifdef GLX_USE_APPLEGL
|
||||
DRI_glXUseXFont(font, first, count, listBase);
|
||||
#else
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
if (gc->driContext) {
|
||||
DRI_glXUseXFont(font, first, count, listBase);
|
||||
|
@ -744,6 +809,7 @@ glXUseXFont(Font font, int first, int count, int listBase)
|
|||
req->listBase = listBase;
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
#endif /* GLX_USE_APPLEGL */
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
|
@ -756,6 +822,17 @@ PUBLIC void
|
|||
glXCopyContext(Display * dpy, GLXContext source,
|
||||
GLXContext dest, unsigned long mask)
|
||||
{
|
||||
#ifdef GLX_USE_APPLEGL
|
||||
GLXContext gc = __glXGetCurrentContext();
|
||||
int errorcode;
|
||||
bool x11error;
|
||||
|
||||
if(apple_glx_copy_context(gc->apple, source->apple, dest->apple,
|
||||
mask, &errorcode, &x11error)) {
|
||||
__glXSendError(dpy, errorcode, 0, X_GLXCopyContext, x11error);
|
||||
}
|
||||
|
||||
#else
|
||||
xGLXCopyContextReq *req;
|
||||
GLXContext gc = __glXGetCurrentContext();
|
||||
GLXContextTag tag;
|
||||
|
@ -794,9 +871,11 @@ glXCopyContext(Display * dpy, GLXContext source,
|
|||
req->contextTag = tag;
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
#endif /* GLX_USE_APPLEGL */
|
||||
}
|
||||
|
||||
|
||||
#ifndef GLX_USE_APPLEGL
|
||||
/**
|
||||
* Determine if a context uses direct rendering.
|
||||
*
|
||||
|
@ -844,6 +923,7 @@ __glXIsDirect(Display * dpy, GLXContextID contextID)
|
|||
return reply.isDirect;
|
||||
#endif /* USE_XCB */
|
||||
}
|
||||
#endif /* GLX_USE_APPLEGL */
|
||||
|
||||
/**
|
||||
* \todo
|
||||
|
@ -854,6 +934,17 @@ __glXIsDirect(Display * dpy, GLXContextID contextID)
|
|||
PUBLIC Bool
|
||||
glXIsDirect(Display * dpy, GLXContext gc)
|
||||
{
|
||||
#ifdef GLX_USE_APPLEGL
|
||||
/*
|
||||
* This isn't an ideal test.
|
||||
* glXIsDirect should probably search a list of contexts.
|
||||
*/
|
||||
if(NULL == gc) {
|
||||
__glXSendError(dpy, GLXBadContext, 0, X_GLXIsDirect, false);
|
||||
return False;
|
||||
}
|
||||
return gc->isDirect;
|
||||
#else
|
||||
if (!gc) {
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
@ -861,11 +952,24 @@ glXIsDirect(Display * dpy, GLXContext gc)
|
|||
return GL_TRUE;
|
||||
}
|
||||
return __glXIsDirect(dpy, gc->xid);
|
||||
#endif /* GLX_USE_APPLEGL */
|
||||
}
|
||||
|
||||
PUBLIC GLXPixmap
|
||||
glXCreateGLXPixmap(Display * dpy, XVisualInfo * vis, Pixmap pixmap)
|
||||
{
|
||||
#ifdef GLX_USE_APPLEGL
|
||||
int screen = vis->screen;
|
||||
__GLXscreenConfigs *const psc = GetGLXScreenConfigs(dpy, screen);
|
||||
const __GLcontextModes *modes;
|
||||
|
||||
modes = _gl_context_modes_find_visual(psc->visuals, vis->visualid);
|
||||
|
||||
if(apple_glx_pixmap_create(dpy, vis->screen, pixmap, modes))
|
||||
return None;
|
||||
|
||||
return pixmap;
|
||||
#else
|
||||
xGLXCreateGLXPixmapReq *req;
|
||||
GLXPixmap xid;
|
||||
CARD8 opcode;
|
||||
|
@ -915,6 +1019,7 @@ glXCreateGLXPixmap(Display * dpy, XVisualInfo * vis, Pixmap pixmap)
|
|||
#endif
|
||||
|
||||
return xid;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -923,6 +1028,10 @@ glXCreateGLXPixmap(Display * dpy, XVisualInfo * vis, Pixmap pixmap)
|
|||
PUBLIC void
|
||||
glXDestroyGLXPixmap(Display * dpy, GLXPixmap glxpixmap)
|
||||
{
|
||||
#ifdef GLX_USE_APPLEGL
|
||||
if(apple_glx_pixmap_destroy(dpy, glxpixmap))
|
||||
__glXSendError(dpy, GLXBadPixmap, glxpixmap, X_GLXDestroyPixmap, false);
|
||||
#else
|
||||
xGLXDestroyGLXPixmapReq *req;
|
||||
CARD8 opcode;
|
||||
|
||||
|
@ -953,11 +1062,20 @@ glXDestroyGLXPixmap(Display * dpy, GLXPixmap glxpixmap)
|
|||
}
|
||||
}
|
||||
#endif
|
||||
#endif /* GLX_USE_APPLEGL */
|
||||
}
|
||||
|
||||
PUBLIC void
|
||||
glXSwapBuffers(Display * dpy, GLXDrawable drawable)
|
||||
{
|
||||
#ifdef GLX_USE_APPLEGL
|
||||
GLXContext gc = glXGetCurrentContext();
|
||||
if(gc && apple_glx_is_current_drawable(dpy, gc->apple, drawable)) {
|
||||
apple_glx_swap_buffers(gc->apple);
|
||||
} else {
|
||||
__glXSendError(dpy, GLXBadCurrentWindow, 0, X_GLXSwapBuffers, false);
|
||||
}
|
||||
#else
|
||||
GLXContext gc;
|
||||
GLXContextTag tag;
|
||||
CARD8 opcode;
|
||||
|
@ -1012,6 +1130,7 @@ glXSwapBuffers(Display * dpy, GLXDrawable drawable)
|
|||
SyncHandle();
|
||||
XFlush(dpy);
|
||||
#endif /* USE_XCB */
|
||||
#endif /* GLX_USE_APPLEGL */
|
||||
}
|
||||
|
||||
|
||||
|
@ -1440,6 +1559,12 @@ glXChooseVisual(Display * dpy, int screen, int *attribList)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef GLX_USE_APPLEGL
|
||||
if(visualList && getenv("LIBGL_DUMP_VISUALID")) {
|
||||
printf("visualid 0x%lx\n", visualList[0].visualid);
|
||||
}
|
||||
#endif
|
||||
|
||||
return visualList;
|
||||
}
|
||||
|
||||
|
@ -1573,6 +1698,7 @@ PUBLIC
|
|||
GLX_ALIAS(Display *, glXGetCurrentDisplayEXT, (void), (),
|
||||
glXGetCurrentDisplay)
|
||||
|
||||
#ifndef GLX_USE_APPLEGL
|
||||
/**
|
||||
* Used internally by libGL to send \c xGLXQueryContextinfoExtReq requests
|
||||
* to the X-server.
|
||||
|
@ -1684,9 +1810,12 @@ static int __glXQueryContextInfo(Display * dpy, GLXContext ctx)
|
|||
return retval;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
PUBLIC int
|
||||
glXQueryContext(Display * dpy, GLXContext ctx, int attribute, int *value)
|
||||
{
|
||||
#ifndef GLX_USE_APPLEGL
|
||||
int retVal;
|
||||
|
||||
/* get the information from the server if we don't have it already */
|
||||
|
@ -1699,13 +1828,17 @@ glXQueryContext(Display * dpy, GLXContext ctx, int attribute, int *value)
|
|||
if (Success != retVal)
|
||||
return retVal;
|
||||
}
|
||||
#endif
|
||||
|
||||
switch (attribute) {
|
||||
case GLX_SHARE_CONTEXT_EXT:
|
||||
#ifndef GLX_USE_APPLEGL
|
||||
case GLX_SHARE_CONTEXT_EXT:
|
||||
*value = (int) (ctx->share_xid);
|
||||
break;
|
||||
case GLX_VISUAL_ID_EXT:
|
||||
*value = ctx->mode ? ctx->mode->visualID : None;
|
||||
break;
|
||||
#endif
|
||||
case GLX_SCREEN:
|
||||
*value = (int) (ctx->screen);
|
||||
break;
|
||||
|
@ -1734,6 +1867,9 @@ PUBLIC GLXContextID glXGetContextIDEXT(const GLXContext ctx)
|
|||
PUBLIC GLXContext
|
||||
glXImportContextEXT(Display * dpy, GLXContextID contextID)
|
||||
{
|
||||
#ifdef GLX_USE_APPLEGL
|
||||
return NULL;
|
||||
#else
|
||||
GLXContext ctx;
|
||||
|
||||
if (contextID == None) {
|
||||
|
@ -1754,6 +1890,7 @@ glXImportContextEXT(Display * dpy, GLXContextID contextID)
|
|||
}
|
||||
}
|
||||
return ctx;
|
||||
#endif
|
||||
}
|
||||
|
||||
PUBLIC void
|
||||
|
@ -1881,7 +2018,7 @@ glXGetVisualFromFBConfig(Display * dpy, GLXFBConfig config)
|
|||
return XGetVisualInfo(dpy, VisualIDMask, &visualTemplate, &count);
|
||||
}
|
||||
|
||||
|
||||
#ifndef GLX_USE_APPLEGL
|
||||
/*
|
||||
** GLX_SGI_swap_control
|
||||
*/
|
||||
|
@ -2236,6 +2373,7 @@ __glXWaitVideoSyncSGI(int divisor, int remainder, unsigned int *count)
|
|||
return GLX_BAD_CONTEXT;
|
||||
}
|
||||
|
||||
#endif /* GLX_USE_APPLEGL */
|
||||
|
||||
/*
|
||||
** GLX_SGIX_fbconfig
|
||||
|
@ -2262,17 +2400,24 @@ glXCreateGLXPixmapWithConfigSGIX(Display * dpy,
|
|||
GLXFBConfigSGIX config,
|
||||
Pixmap pixmap)
|
||||
{
|
||||
#ifndef GLX_USE_APPLEGL
|
||||
xGLXVendorPrivateWithReplyReq *vpreq;
|
||||
xGLXCreateGLXPixmapWithConfigSGIXReq *req;
|
||||
GLXPixmap xid = None;
|
||||
CARD8 opcode;
|
||||
const __GLcontextModes *const fbconfig = (__GLcontextModes *) config;
|
||||
__GLXscreenConfigs *psc;
|
||||
#endif
|
||||
const __GLcontextModes *const fbconfig = (__GLcontextModes *) config;
|
||||
|
||||
|
||||
if ((dpy == NULL) || (config == NULL)) {
|
||||
return None;
|
||||
}
|
||||
#ifdef GLX_USE_APPLEGL
|
||||
if(apple_glx_pixmap_create(dpy, fbconfig->screen, pixmap, fbconfig))
|
||||
return None;
|
||||
return pixmap;
|
||||
#else
|
||||
|
||||
psc = GetGLXScreenConfigs(dpy, fbconfig->screen);
|
||||
if ((psc != NULL)
|
||||
|
@ -2300,6 +2445,7 @@ glXCreateGLXPixmapWithConfigSGIX(Display * dpy,
|
|||
}
|
||||
|
||||
return xid;
|
||||
#endif
|
||||
}
|
||||
|
||||
PUBLIC GLXContext
|
||||
|
@ -2345,7 +2491,7 @@ glXGetFBConfigFromVisualSGIX(Display * dpy, XVisualInfo * vis)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
#ifndef GLX_USE_APPLEGL
|
||||
/*
|
||||
** GLX_SGIX_swap_group
|
||||
*/
|
||||
|
@ -2963,6 +3109,8 @@ __glXReleaseTexImageEXT(Display * dpy, GLXDrawable drawable, int buffer)
|
|||
|
||||
/*@}*/
|
||||
|
||||
#endif /* GLX_USE_APPLEGL */
|
||||
|
||||
/**
|
||||
* \c strdup is actually not a standard ANSI C or POSIX routine.
|
||||
* Irix will not define it if ANSI mode is in effect.
|
||||
|
@ -3040,6 +3188,7 @@ static const struct name_address_pair GLX_functions[] = {
|
|||
GLX_FUNCTION(glXQueryDrawable),
|
||||
GLX_FUNCTION(glXSelectEvent),
|
||||
|
||||
#ifndef GLX_USE_APPLEGL
|
||||
/*** GLX_SGI_swap_control ***/
|
||||
GLX_FUNCTION2(glXSwapIntervalSGI, __glXSwapIntervalSGI),
|
||||
|
||||
|
@ -3057,6 +3206,7 @@ static const struct name_address_pair GLX_functions[] = {
|
|||
GLX_FUNCTION2(glXGetCurrentDisplayEXT, glXGetCurrentDisplay),
|
||||
GLX_FUNCTION(glXImportContextEXT),
|
||||
GLX_FUNCTION2(glXQueryContextInfoEXT, glXQueryContext),
|
||||
#endif
|
||||
|
||||
/*** GLX_SGIX_fbconfig ***/
|
||||
GLX_FUNCTION2(glXGetFBConfigAttribSGIX, glXGetFBConfigAttrib),
|
||||
|
@ -3066,6 +3216,7 @@ static const struct name_address_pair GLX_functions[] = {
|
|||
GLX_FUNCTION2(glXGetVisualFromFBConfigSGIX, glXGetVisualFromFBConfig),
|
||||
GLX_FUNCTION(glXGetFBConfigFromVisualSGIX),
|
||||
|
||||
#ifndef GLX_USE_APPLEGL
|
||||
/*** GLX_SGIX_pbuffer ***/
|
||||
GLX_FUNCTION(glXCreateGLXPbufferSGIX),
|
||||
GLX_FUNCTION(glXDestroyGLXPbufferSGIX),
|
||||
|
@ -3103,6 +3254,7 @@ static const struct name_address_pair GLX_functions[] = {
|
|||
GLX_FUNCTION2(glXEndFrameTrackingMESA, __glXEndFrameTrackingMESA),
|
||||
GLX_FUNCTION2(glXGetFrameUsageMESA, __glXGetFrameUsageMESA),
|
||||
GLX_FUNCTION2(glXQueryFrameTrackingMESA, __glXQueryFrameTrackingMESA),
|
||||
#endif
|
||||
|
||||
/*** GLX_ARB_get_proc_address ***/
|
||||
GLX_FUNCTION(glXGetProcAddressARB),
|
||||
|
@ -3110,6 +3262,7 @@ static const struct name_address_pair GLX_functions[] = {
|
|||
/*** GLX 1.4 ***/
|
||||
GLX_FUNCTION2(glXGetProcAddress, glXGetProcAddressARB),
|
||||
|
||||
#ifndef GLX_USE_APPLEGL
|
||||
/*** GLX_OML_sync_control ***/
|
||||
GLX_FUNCTION2(glXWaitForSbcOML, __glXWaitForSbcOML),
|
||||
GLX_FUNCTION2(glXWaitForMscOML, __glXWaitForMscOML),
|
||||
|
@ -3120,6 +3273,7 @@ static const struct name_address_pair GLX_functions[] = {
|
|||
/*** GLX_EXT_texture_from_pixmap ***/
|
||||
GLX_FUNCTION2(glXBindTexImageEXT, __glXBindTexImageEXT),
|
||||
GLX_FUNCTION2(glXReleaseTexImageEXT, __glXReleaseTexImageEXT),
|
||||
#endif
|
||||
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
/*** DRI configuration ***/
|
||||
|
@ -3130,7 +3284,7 @@ static const struct name_address_pair GLX_functions[] = {
|
|||
{NULL, NULL} /* end of list */
|
||||
};
|
||||
|
||||
|
||||
#ifndef GLX_USE_APPLEGL
|
||||
static const GLvoid *
|
||||
get_glx_proc_address(const char *funcName)
|
||||
{
|
||||
|
@ -3144,7 +3298,7 @@ get_glx_proc_address(const char *funcName)
|
|||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Get the address of a named GL function. This is the pre-GLX 1.4 name for
|
||||
|
@ -3167,13 +3321,15 @@ PUBLIC void (*glXGetProcAddressARB(const GLubyte * procName)) (void)
|
|||
* DRI based drivers from searching the core GL function table for
|
||||
* internal API functions.
|
||||
*/
|
||||
|
||||
#ifdef GLX_USE_APPLEGL
|
||||
f = (gl_function) apple_glx_get_proc_address(procName);
|
||||
#else
|
||||
f = (gl_function) get_glx_proc_address((const char *) procName);
|
||||
if ((f == NULL) && (procName[0] == 'g') && (procName[1] == 'l')
|
||||
&& (procName[2] != 'X')) {
|
||||
f = (gl_function) _glapi_get_proc_address((const char *) procName);
|
||||
}
|
||||
|
||||
#endif
|
||||
return f;
|
||||
}
|
||||
|
||||
|
|
|
@ -33,9 +33,20 @@
|
|||
* Client-side GLX interface for current context management.
|
||||
*/
|
||||
|
||||
#ifdef PTHREADS
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
|
||||
#include "glxclient.h"
|
||||
#ifdef GLX_USE_APPLEGL
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "apple_glx.h"
|
||||
#include "apple_glx_context.h"
|
||||
#else
|
||||
#include "glapi.h"
|
||||
#include "indirect_init.h"
|
||||
#endif
|
||||
|
||||
/*
|
||||
** We setup some dummy structures here so that the API can be used
|
||||
|
@ -59,11 +70,12 @@ static __GLXcontext dummyContext = {
|
|||
};
|
||||
|
||||
|
||||
#ifndef GLX_USE_APPLEGL
|
||||
/*
|
||||
** All indirect rendering contexts will share the same indirect dispatch table.
|
||||
*/
|
||||
static __GLapi *IndirectAPI = NULL;
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Current context management and locking
|
||||
|
@ -156,10 +168,12 @@ _X_HIDDEN void
|
|||
__glXSetCurrentContextNull(void)
|
||||
{
|
||||
__glXSetCurrentContext(&dummyContext);
|
||||
#ifndef GLX_USE_APPLEGL
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
_glapi_set_dispatch(NULL); /* no-op functions */
|
||||
_glapi_set_context(NULL);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -186,6 +200,7 @@ glXGetCurrentDrawable(void)
|
|||
}
|
||||
|
||||
|
||||
#ifndef GLX_USE_APPLEGL
|
||||
/************************************************************************/
|
||||
|
||||
/**
|
||||
|
@ -313,6 +328,8 @@ __glXGenerateError(Display * dpy, GLXContext gc, XID resource,
|
|||
_XError(dpy, &error);
|
||||
}
|
||||
|
||||
#endif /* GLX_USE_APPLEGL */
|
||||
|
||||
/**
|
||||
* Make a particular context current.
|
||||
*
|
||||
|
@ -322,8 +339,17 @@ static Bool
|
|||
MakeContextCurrent(Display * dpy, GLXDrawable draw,
|
||||
GLXDrawable read, GLXContext gc)
|
||||
{
|
||||
xGLXMakeCurrentReply reply;
|
||||
const GLXContext oldGC = __glXGetCurrentContext();
|
||||
#ifdef GLX_USE_APPLEGL
|
||||
bool error = apple_glx_make_current_context(dpy,
|
||||
(oldGC && oldGC != &dummyContext) ? oldGC->apple : NULL,
|
||||
gc ? gc->apple : NULL, draw);
|
||||
|
||||
apple_glx_diagnostic("%s: error %s\n", __func__, error ? "YES" : "NO");
|
||||
if(error)
|
||||
return GL_FALSE;
|
||||
#else
|
||||
xGLXMakeCurrentReply reply;
|
||||
const CARD8 opcode = __glXSetupForCommand(dpy);
|
||||
const CARD8 oldOpcode = ((gc == oldGC) || (oldGC == &dummyContext))
|
||||
? opcode : __glXSetupForCommand(oldGC->currentDpy);
|
||||
|
@ -419,6 +445,7 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw,
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif /* GLX_USE_APPLEGL */
|
||||
|
||||
/* Update our notion of what is current */
|
||||
__glXLock();
|
||||
|
@ -428,8 +455,10 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw,
|
|||
* cannot be NULL, therefore if they are the same, gc is not
|
||||
* NULL and not the dummy.
|
||||
*/
|
||||
gc->currentDrawable = draw;
|
||||
gc->currentReadable = read;
|
||||
if(gc) {
|
||||
gc->currentDrawable = draw;
|
||||
gc->currentReadable = read;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (oldGC != &dummyContext) {
|
||||
|
@ -439,7 +468,18 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw,
|
|||
oldGC->currentReadable = None;
|
||||
oldGC->currentContextTag = 0;
|
||||
oldGC->thread_id = 0;
|
||||
|
||||
#ifdef GLX_USE_APPLEGL
|
||||
|
||||
/*
|
||||
* At this point we should check if the context has been
|
||||
* through glXDestroyContext, and redestroy it if so.
|
||||
*/
|
||||
if(oldGC->do_destroy) {
|
||||
__glXUnlock();
|
||||
/* glXDestroyContext uses the same global lock. */
|
||||
glXDestroyContext(dpy, oldGC);
|
||||
__glXLock();
|
||||
#else
|
||||
if (oldGC->xid == None) {
|
||||
/* We are switching away from a context that was
|
||||
* previously destroyed, so we need to free the memory
|
||||
|
@ -455,6 +495,7 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw,
|
|||
}
|
||||
#endif
|
||||
__glXFreeContext(oldGC);
|
||||
#endif /* GLX_USE_APPLEGL */
|
||||
}
|
||||
}
|
||||
if (gc) {
|
||||
|
@ -463,6 +504,7 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw,
|
|||
gc->currentDpy = dpy;
|
||||
gc->currentDrawable = draw;
|
||||
gc->currentReadable = read;
|
||||
#ifndef GLX_USE_APPLEGL
|
||||
gc->thread_id = _glthread_GetID();
|
||||
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
|
@ -486,6 +528,7 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw,
|
|||
gc->currentContextTag = -1;
|
||||
}
|
||||
#endif
|
||||
#endif /* GLX_USE_APPLEGL */
|
||||
}
|
||||
else {
|
||||
__glXSetCurrentContextNull();
|
||||
|
|
|
@ -42,6 +42,10 @@
|
|||
#include <X11/extensions/Xext.h>
|
||||
#include <X11/extensions/extutil.h>
|
||||
#include <X11/extensions/dri2proto.h>
|
||||
#ifdef GLX_USE_APPLEGL
|
||||
#include "apple_glx.h"
|
||||
#include "apple_visual.h"
|
||||
#endif
|
||||
#include "glxextensions.h"
|
||||
#include "glcontextmodes.h"
|
||||
|
||||
|
@ -65,7 +69,12 @@ _X_HIDDEN int __glXDebug = 0;
|
|||
/* Extension required boiler plate */
|
||||
|
||||
static char *__glXExtensionName = GLX_EXTENSION_NAME;
|
||||
#ifdef GLX_USE_APPLEGL
|
||||
static XExtensionInfo __glXExtensionInfo_data;
|
||||
XExtensionInfo *__glXExtensionInfo = &__glXExtensionInfo_data;
|
||||
#else
|
||||
XExtensionInfo *__glXExtensionInfo = NULL;
|
||||
#endif
|
||||
|
||||
static /* const */ char *error_list[] = {
|
||||
"GLXBadContext",
|
||||
|
@ -98,6 +107,11 @@ __glXCloseDisplay(Display * dpy, XExtCodes * codes)
|
|||
}
|
||||
|
||||
|
||||
#ifdef GLX_USE_APPLEGL
|
||||
static char *__glXErrorString(Display *dpy, int code, XExtCodes *codes,
|
||||
char *buf, int n);
|
||||
#endif
|
||||
|
||||
static
|
||||
XEXT_GENERATE_ERROR_STRING(__glXErrorString, __glXExtensionName,
|
||||
__GLX_NUMBER_ERRORS, error_list)
|
||||
|
@ -358,7 +372,20 @@ QueryVersion(Display * dpy, int opcode, int *major, int *minor)
|
|||
#endif /* USE_XCB */
|
||||
}
|
||||
|
||||
/*
|
||||
* We don't want to enable this GLX_OML_swap_method in glxext.h,
|
||||
* because we can't support it. The X server writes it out though,
|
||||
* so we should handle it somehow, to avoid false warnings.
|
||||
*/
|
||||
enum {
|
||||
IGNORE_GLX_SWAP_METHOD_OML = 0x8060
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* getVisualConfigs uses the !tagged_only path.
|
||||
* getFBConfigs uses the tagged_only path.
|
||||
*/
|
||||
_X_HIDDEN void
|
||||
__glXInitializeVisualConfigFromTags(__GLcontextModes * config, int count,
|
||||
const INT32 * bp, Bool tagged_only,
|
||||
|
@ -392,7 +419,14 @@ __glXInitializeVisualConfigFromTags(__GLcontextModes * config, int count,
|
|||
config->numAuxBuffers = *bp++;
|
||||
config->level = *bp++;
|
||||
|
||||
#ifdef GLX_USE_APPLEGL
|
||||
/* AppleSGLX supports pixmap and pbuffers with all config. */
|
||||
config->drawableType = GLX_WINDOW_BIT | GLX_PIXMAP_BIT | GLX_PBUFFER_BIT;
|
||||
/* Unfortunately this can create an ABI compatibility problem. */
|
||||
count -= 18;
|
||||
#else
|
||||
count -= __GLX_MIN_CONFIG_PROPS;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -405,7 +439,9 @@ __glXInitializeVisualConfigFromTags(__GLcontextModes * config, int count,
|
|||
config-> tag = ( fbconfig_style_tags ) ? *bp++ : 1
|
||||
|
||||
for (i = 0; i < count; i += 2) {
|
||||
switch (*bp++) {
|
||||
long int tag = *bp++;
|
||||
|
||||
switch (tag) {
|
||||
case GLX_RGBA:
|
||||
FETCH_OR_SET(rgbMode);
|
||||
break;
|
||||
|
@ -483,6 +519,10 @@ __glXInitializeVisualConfigFromTags(__GLcontextModes * config, int count,
|
|||
break;
|
||||
case GLX_DRAWABLE_TYPE:
|
||||
config->drawableType = *bp++;
|
||||
#ifdef GLX_USE_APPLEGL
|
||||
/* AppleSGLX supports pixmap and pbuffers with all config. */
|
||||
config->drawableType |= GLX_WINDOW_BIT | GLX_PIXMAP_BIT | GLX_PBUFFER_BIT;
|
||||
#endif
|
||||
break;
|
||||
case GLX_RENDER_TYPE:
|
||||
config->renderType = *bp++;
|
||||
|
@ -502,6 +542,7 @@ __glXInitializeVisualConfigFromTags(__GLcontextModes * config, int count,
|
|||
case GLX_MAX_PBUFFER_PIXELS:
|
||||
config->maxPbufferPixels = *bp++;
|
||||
break;
|
||||
#ifndef GLX_USE_APPLEGL
|
||||
case GLX_OPTIMAL_PBUFFER_WIDTH_SGIX:
|
||||
config->optimalPbufferWidth = *bp++;
|
||||
break;
|
||||
|
@ -514,12 +555,19 @@ __glXInitializeVisualConfigFromTags(__GLcontextModes * config, int count,
|
|||
case GLX_SWAP_METHOD_OML:
|
||||
config->swapMethod = *bp++;
|
||||
break;
|
||||
#endif
|
||||
case GLX_SAMPLE_BUFFERS_SGIS:
|
||||
config->sampleBuffers = *bp++;
|
||||
break;
|
||||
case GLX_SAMPLES_SGIS:
|
||||
config->samples = *bp++;
|
||||
break;
|
||||
#ifdef GLX_USE_APPLEGL
|
||||
case IGNORE_GLX_SWAP_METHOD_OML:
|
||||
/* We ignore this tag. See the comment above this function. */
|
||||
++bp;
|
||||
break;
|
||||
#else
|
||||
case GLX_BIND_TO_TEXTURE_RGB_EXT:
|
||||
config->bindToTextureRgb = *bp++;
|
||||
break;
|
||||
|
@ -535,13 +583,21 @@ __glXInitializeVisualConfigFromTags(__GLcontextModes * config, int count,
|
|||
case GLX_Y_INVERTED_EXT:
|
||||
config->yInverted = *bp++;
|
||||
break;
|
||||
#endif
|
||||
case None:
|
||||
i = count;
|
||||
break;
|
||||
default:
|
||||
/* Ignore the unrecognized tag's value */
|
||||
bp++;
|
||||
break;
|
||||
if(getenv("LIBGL_DIAGNOSTIC")) {
|
||||
long int tagvalue = *bp++;
|
||||
fprintf(stderr, "WARNING: unknown GLX tag from server: "
|
||||
"tag 0x%lx value 0x%lx\n", tag, tagvalue);
|
||||
} else {
|
||||
/* Ignore the unrecognized tag's value */
|
||||
bp++;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -589,9 +645,18 @@ createConfigsFromProperties(Display * dpy, int nvisuals, int nprops,
|
|||
m = modes;
|
||||
for (i = 0; i < nvisuals; i++) {
|
||||
_XRead(dpy, (char *) props, prop_size);
|
||||
/* Older X servers don't send this so we default it here. */
|
||||
#ifdef GLX_USE_APPLEGL
|
||||
/* Older X servers don't send this so we default it here. */
|
||||
m->drawableType = GLX_WINDOW_BIT;
|
||||
__glXInitializeVisualConfigFromTags(m, nprops, props,
|
||||
#else
|
||||
/*
|
||||
* The XQuartz 2.3.2.1 X server doesn't set this properly, so
|
||||
* set the proper bits here.
|
||||
* AppleSGLX supports windows, pixmaps, and pbuffers with all config.
|
||||
*/
|
||||
m->drawableType = GLX_WINDOW_BIT | GLX_PIXMAP_BIT | GLX_PBUFFER_BIT;
|
||||
#endif
|
||||
__glXInitializeVisualConfigFromTags(m, nprops, props,
|
||||
tagged_only, GL_TRUE);
|
||||
m->screen = screen;
|
||||
m = m->next;
|
||||
|
@ -825,8 +890,11 @@ __glXInitialize(Display * dpy)
|
|||
if (glx_direct)
|
||||
dpyPriv->driswDisplay = driswCreateDisplay(dpy);
|
||||
#endif
|
||||
|
||||
#ifdef GLX_USE_APPLEGL
|
||||
if (apple_init_glx(dpy) || !AllocAndFetchScreenConfigs(dpy, dpyPriv)) {
|
||||
#else
|
||||
if (!AllocAndFetchScreenConfigs(dpy, dpyPriv)) {
|
||||
#endif
|
||||
__glXUnlock();
|
||||
Xfree((char *) dpyPriv);
|
||||
Xfree((char *) private);
|
||||
|
|
|
@ -75,34 +75,72 @@ static const struct extension_info known_glx_extensions[] = {
|
|||
{ GLX(ARB_multisample), VER(1,4), Y, Y, N, N },
|
||||
{ GLX(ARB_render_texture), VER(0,0), N, N, N, N },
|
||||
{ GLX(ATI_pixel_format_float), VER(0,0), N, N, N, N },
|
||||
#ifdef GLX_USE_APPLEGL
|
||||
{ GLX(EXT_import_context), VER(0,0), N, N, N, N },
|
||||
{ GLX(EXT_visual_info), VER(0,0), N, N, N, N },
|
||||
#else
|
||||
{ GLX(EXT_import_context), VER(0,0), Y, Y, N, N },
|
||||
{ GLX(EXT_visual_info), VER(0,0), Y, Y, N, N },
|
||||
#endif
|
||||
{ GLX(EXT_visual_rating), VER(0,0), Y, Y, N, N },
|
||||
#ifdef GLX_USE_APPLEGL
|
||||
{ GLX(MESA_agp_offset), VER(0,0), N, N, N, N }, /* Deprecated */
|
||||
{ GLX(MESA_allocate_memory), VER(0,0), N, N, N, N },
|
||||
{ GLX(MESA_copy_sub_buffer), VER(0,0), N, N, N, N },
|
||||
#else
|
||||
{ GLX(MESA_agp_offset), VER(0,0), N, N, N, Y }, /* Deprecated */
|
||||
{ GLX(MESA_allocate_memory), VER(0,0), Y, N, N, Y },
|
||||
{ GLX(MESA_copy_sub_buffer), VER(0,0), Y, N, N, N },
|
||||
#endif
|
||||
{ GLX(MESA_pixmap_colormap), VER(0,0), N, N, N, N }, /* Deprecated */
|
||||
{ GLX(MESA_release_buffers), VER(0,0), N, N, N, N }, /* Deprecated */
|
||||
#ifdef GLX_USE_APPLEGL
|
||||
{ GLX(MESA_swap_control), VER(0,0), N, N, N, N },
|
||||
{ GLX(MESA_swap_frame_usage), VER(0,0), N, N, N, N },
|
||||
#else
|
||||
{ GLX(MESA_swap_control), VER(0,0), Y, N, N, Y },
|
||||
{ GLX(MESA_swap_frame_usage), VER(0,0), Y, N, N, Y },
|
||||
#endif
|
||||
{ GLX(NV_float_buffer), VER(0,0), N, N, N, N },
|
||||
{ GLX(NV_render_depth_texture), VER(0,0), N, N, N, N },
|
||||
{ GLX(NV_render_texture_rectangle), VER(0,0), N, N, N, N },
|
||||
#ifdef GLX_USE_APPLEGL
|
||||
{ GLX(NV_vertex_array_range), VER(0,0), N, N, N, N }, /* Deprecated */
|
||||
{ GLX(OML_swap_method), VER(0,0), N, N, N, N },
|
||||
{ GLX(OML_sync_control), VER(0,0), N, N, N, N },
|
||||
{ GLX(SGI_make_current_read), VER(1,3), N, N, N, N },
|
||||
{ GLX(SGI_swap_control), VER(0,0), N, N, N, N },
|
||||
{ GLX(SGI_video_sync), VER(0,0), N, N, N, N },
|
||||
#else
|
||||
{ GLX(NV_vertex_array_range), VER(0,0), N, N, N, Y }, /* Deprecated */
|
||||
{ GLX(OML_swap_method), VER(0,0), Y, Y, N, N },
|
||||
{ GLX(OML_sync_control), VER(0,0), Y, N, N, Y },
|
||||
{ GLX(SGI_make_current_read), VER(1,3), Y, N, N, N },
|
||||
{ GLX(SGI_swap_control), VER(0,0), Y, N, N, N },
|
||||
{ GLX(SGI_video_sync), VER(0,0), Y, N, N, Y },
|
||||
#endif
|
||||
{ GLX(SGIS_blended_overlay), VER(0,0), N, N, N, N },
|
||||
{ GLX(SGIS_color_range), VER(0,0), N, N, N, N },
|
||||
#ifdef GLX_USE_APPLEGL
|
||||
{ GLX(SGIS_multisample), VER(0,0), N, N, N, N },
|
||||
#else
|
||||
{ GLX(SGIS_multisample), VER(0,0), Y, Y, N, N },
|
||||
#endif
|
||||
{ GLX(SGIX_fbconfig), VER(1,3), Y, Y, N, N },
|
||||
#ifdef GLX_USE_APPLEGL
|
||||
{ GLX(SGIX_pbuffer), VER(1,3), N, N, N, N },
|
||||
#else
|
||||
{ GLX(SGIX_pbuffer), VER(1,3), Y, Y, N, N },
|
||||
#endif
|
||||
{ GLX(SGIX_swap_barrier), VER(0,0), N, N, N, N },
|
||||
{ GLX(SGIX_swap_group), VER(0,0), N, N, N, N },
|
||||
#ifdef GLX_USE_APPLEGL
|
||||
{ GLX(SGIX_visual_select_group), VER(0,0), N, N, N, N },
|
||||
{ GLX(EXT_texture_from_pixmap), VER(0,0), N, N, N, N },
|
||||
#else
|
||||
{ GLX(SGIX_visual_select_group), VER(0,0), Y, Y, N, N },
|
||||
{ GLX(EXT_texture_from_pixmap), VER(0,0), Y, N, N, N },
|
||||
#endif
|
||||
{ GLX(INTEL_swap_event), VER(1,4), Y, Y, N, N },
|
||||
{ NULL }
|
||||
};
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
# endif
|
||||
|
||||
|
||||
#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__APPLE__)
|
||||
#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(GLX_USE_APPLEGL)
|
||||
# undef HAVE_ALIAS
|
||||
#endif
|
||||
#ifdef HAVE_ALIAS
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
called by that routine when direct rendering is enabled.
|
||||
*/
|
||||
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
#if defined(GLX_DIRECT_RENDERING) || defined(GLX_USE_APPLEGL)
|
||||
|
||||
#include "glxclient.h"
|
||||
|
||||
|
|
Loading…
Reference in New Issue