mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 21:50:12 +01:00
Merge branch '7.8'
Conflicts: src/glx/dri2_glx.c src/glx/glx_pbuffer.c
This commit is contained in:
commit
1fa7789e82
75 changed files with 53505 additions and 103 deletions
|
|
@ -13,7 +13,10 @@ CC = gcc
|
|||
CXX = g++
|
||||
PIC_FLAGS = -fPIC
|
||||
DEFINES = -D_DARWIN_C_SOURCE -DPTHREADS -D_GNU_SOURCE \
|
||||
-DGLX_ALIAS_UNSUPPORTED -DGLX_INDIRECT_RENDERING
|
||||
-DGLX_ALIAS_UNSUPPORTED \
|
||||
-DGLX_DIRECT_RENDERING -DGLX_USE_APPLEGL
|
||||
|
||||
# -DGLX_INDIRECT_RENDERING \
|
||||
|
||||
# -D_GNU_SOURCE - for src/mesa/main ...
|
||||
# -DGLX_DIRECT_RENDERING - pulls in libdrm stuff in glx
|
||||
|
|
@ -49,7 +52,7 @@ GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -L$(INSTALL_DIR)/$(LIB_DIR) -L$(X
|
|||
APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -L$(INSTALL_DIR)/$(LIB_DIR) -L$(X11_DIR)/$(LIB_DIR) -lX11 -lXmu -lXt -lXi -lm
|
||||
|
||||
# omit glw lib for now:
|
||||
SRC_DIRS = glsl glx mesa gallium glu glut/glx glew
|
||||
SRC_DIRS = glsl glx/apple mesa gallium glu glut/glx glew
|
||||
GLU_DIRS = sgi
|
||||
DRIVER_DIRS = osmesa
|
||||
#DRIVER_DIRS = dri
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ CONFIG_NAME = linux-osmesa
|
|||
# Compiler and flags
|
||||
CC = gcc
|
||||
CXX = g++
|
||||
CFLAGS = -O3 -ansi -pedantic -fPIC -ffast-math -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -DPTHREADS
|
||||
CFLAGS = -g -ansi -pedantic -fPIC -ffast-math -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -D_GNU_SOURCE -DPTHREADS
|
||||
CXXFLAGS = -O3 -ansi -pedantic -fPIC -ffast-math -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE
|
||||
|
||||
# Work around aliasing bugs - developers should comment this out
|
||||
|
|
@ -17,12 +17,12 @@ CFLAGS += -fno-strict-aliasing
|
|||
CXXFLAGS += -fno-strict-aliasing
|
||||
|
||||
# Directories
|
||||
SRC_DIRS = gallium mesa glu
|
||||
SRC_DIRS = glsl mesa glu
|
||||
DRIVER_DIRS = osmesa
|
||||
PROGRAM_DIRS = osdemos
|
||||
|
||||
|
||||
# Dependencies
|
||||
OSMESA_LIB_DEPS = -lm -lpthread
|
||||
OSMESA_LIB_DEPS = -lm -lpthread -ldl
|
||||
GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(OSMESA_LIB)
|
||||
APP_LIB_DEPS = -lm -lpthread
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ OSMESA_LIB_NAME = libOSMesa16.so
|
|||
|
||||
|
||||
# Directories
|
||||
SRC_DIRS = gallium mesa glu
|
||||
SRC_DIRS = glsl mesa glu
|
||||
DRIVER_DIRS = osmesa
|
||||
PROGRAM_DIRS =
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ OSMESA_LIB_NAME = libOSMesa32.so
|
|||
|
||||
|
||||
# Directories
|
||||
SRC_DIRS = gallium mesa glu
|
||||
SRC_DIRS = glsl mesa glu
|
||||
DRIVER_DIRS = osmesa
|
||||
PROGRAM_DIRS =
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ include $(TOP)/configs/current
|
|||
|
||||
INCDIR = $(TOP)/include
|
||||
|
||||
OSMESA_LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -l$(OSMESA_LIB) $(APP_LIB_DEPS)
|
||||
OSMESA_LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(OSMESA_LIB) $(APP_LIB_DEPS)
|
||||
|
||||
OSMESA16_LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -lOSMesa16 -l$(GLU_LIB) \
|
||||
-l$(GL_LIB) $(APP_LIB_DEPS)
|
||||
|
|
|
|||
|
|
@ -399,7 +399,11 @@ test(GLenum type, GLint bits, const char *filename)
|
|||
|
||||
/* sanity checks */
|
||||
glGetIntegerv(GL_RED_BITS, &cBits);
|
||||
assert(cBits == bits);
|
||||
if (cBits != bits) {
|
||||
fprintf(stderr, "Unable to create %d-bit/channel renderbuffer.\n", bits);
|
||||
fprintf(stderr, "May need to recompile Mesa with CHAN_BITS=16 or 32.\n");
|
||||
return 0;
|
||||
}
|
||||
glGetIntegerv(GL_GREEN_BITS, &cBits);
|
||||
assert(cBits == bits);
|
||||
glGetIntegerv(GL_BLUE_BITS, &cBits);
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ install: $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME)
|
|||
|
||||
# Remove .o and backup files
|
||||
clean:
|
||||
-rm -f $(TOP)/$(LIB_DIR)/libGL.so*
|
||||
-rm -f $(TOP)/$(LIB_DIR)/$(GL_LIB_GLOB)
|
||||
-rm -f *.o *~
|
||||
-rm -f depend depend.bak
|
||||
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
|
||||
/* THIS IS NOT AN X CONSORTIUM STANDARD */
|
||||
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
|
||||
|
||||
#define NEED_REPLIES
|
||||
#include <X11/Xlibint.h>
|
||||
|
|
|
|||
4
src/glx/apple/.gitignore
vendored
Normal file
4
src/glx/apple/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
apple_xgl_api.[hc]
|
||||
exports.list
|
||||
stage.[1234]
|
||||
|
||||
10
src/glx/apple/GL_aliases
Normal file
10
src/glx/apple/GL_aliases
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
#GL_EXT_texture_object
|
||||
alias AreTexturesResidentEXT AreTexturesResident
|
||||
alias BindTextureEXT BindTexture
|
||||
alias DeleteTexturesEXT DeleteTextures
|
||||
alias GenTexturesEXT GenTextures
|
||||
alias IsTextureEXT IsTexture
|
||||
alias PrioritizeTexturesEXT PrioritizeTextures
|
||||
|
||||
# Due to type conflicts, we handle this differently
|
||||
#alias TexImage3DEXT TexImage3D
|
||||
106
src/glx/apple/GL_extensions
Normal file
106
src/glx/apple/GL_extensions
Normal file
|
|
@ -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
|
||||
|
||||
15
src/glx/apple/GL_noop
Normal file
15
src/glx/apple/GL_noop
Normal file
|
|
@ -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
|
||||
4
src/glx/apple/GL_promoted
Normal file
4
src/glx/apple/GL_promoted
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
promoted MESA_window_pos
|
||||
promoted ARB_window_pos
|
||||
promoted EXT_copy_texture
|
||||
promoted ARB_vertex_program
|
||||
129
src/glx/apple/Makefile
Normal file
129
src/glx/apple/Makefile
Normal file
|
|
@ -0,0 +1,129 @@
|
|||
TOP = ../../..
|
||||
|
||||
include $(TOP)/configs/current
|
||||
|
||||
#CC=gcc
|
||||
#GL_CFLAGS=-Wall -ggdb3 -Os -DPTHREADS -D_REENTRANT $(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 -I.. -DGLX_ALIAS_UNSUPPORTED -I$(INSTALL_DIR)/include -I$(X11_DIR)/include
|
||||
|
||||
#COMPILE=$(CC) $(INCLUDE) $(GL_CFLAGS) -c
|
||||
|
||||
#The directory with the final binaries.
|
||||
BUILD_DIR=builds
|
||||
|
||||
all: $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME)
|
||||
|
||||
SOURCES = \
|
||||
apple_cgl.c \
|
||||
apple_glx.c \
|
||||
apple_glx_context.c \
|
||||
apple_glx_drawable.c \
|
||||
apple_glx_pbuffer.c \
|
||||
apple_glx_pixmap.c \
|
||||
apple_glx_surface.c \
|
||||
apple_visual.c \
|
||||
apple_xgl_api.c \
|
||||
apple_xgl_api_additional.c \
|
||||
apple_xgl_api_read.c \
|
||||
apple_xgl_api_stereo.c \
|
||||
apple_xgl_api_viewport.c \
|
||||
appledri.c \
|
||||
../clientattrib.c \
|
||||
../compsize.c \
|
||||
../glcontextmodes.c \
|
||||
glx_empty.c \
|
||||
glx_error.c \
|
||||
../glx_pbuffer.c \
|
||||
../glx_query.c \
|
||||
../glxcmds.c \
|
||||
../glxcurrent.c \
|
||||
../glxext.c \
|
||||
../glxextensions.c \
|
||||
glxreply.c \
|
||||
../pixel.c \
|
||||
../xfont.c
|
||||
|
||||
include $(TOP)/src/mesa/sources.mak
|
||||
|
||||
LDFLAGS += -lXplugin -framework ApplicationServices -framework CoreFoundation
|
||||
|
||||
MESA_GLAPI_ASM_SOURCES = $(addprefix $(TOP)/src/mesa/, $(GLAPI_ASM_SOURCES))
|
||||
MESA_GLAPI_SOURCES = $(addprefix $(TOP)/src/mesa/, $(GLAPI_SOURCES))
|
||||
MESA_GLAPI_OBJECTS = $(addprefix $(TOP)/src/mesa/, $(GLAPI_OBJECTS))
|
||||
|
||||
OBJECTS = $(SOURCES:.c=.o) # $(MESA_GLAPI_OBJECTS)
|
||||
|
||||
INCLUDES = -I. -Iinclude -I..\
|
||||
-I$(TOP)/include \
|
||||
-I$(TOP)/include/GL/internal \
|
||||
-I$(TOP)/src/mesa \
|
||||
-I$(TOP)/src/mesa/glapi \
|
||||
$(LIBDRM_CFLAGS) \
|
||||
$(DRI2PROTO_CFLAGS) \
|
||||
$(X11_INCLUDES)
|
||||
|
||||
##### RULES #####
|
||||
|
||||
$(OBJECTS) : apple_xgl_api.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
|
||||
|
||||
.c.o:
|
||||
$(CC) -c $(INCLUDES) $(CFLAGS) $(EXTRA_DEFINES) $< -o $@
|
||||
|
||||
.S.o:
|
||||
$(CC) -c $(INCLUDES) $(CFLAGS) $(EXTRA_DEFINES) $< -o $@
|
||||
|
||||
##### TARGETS #####
|
||||
|
||||
default: depend $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME)
|
||||
|
||||
# Make libGL
|
||||
$(TOP)/$(LIB_DIR)/$(GL_LIB_NAME): $(OBJECTS) Makefile
|
||||
$(MKLIB) -o $(GL_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
|
||||
-major 1 -minor 2 $(MKLIB_OPTIONS) \
|
||||
-install $(TOP)/$(LIB_DIR) -id $(INSTALL_LIB_DIR)/lib$(GL_LIB).1.dylib \
|
||||
$(GL_LIB_DEPS) $(OBJECTS)
|
||||
|
||||
depend: $(SOURCES) $(MESA_GLAPI_SOURCES) $(MESA_GLAPI_ASM_SOURCES) Makefile
|
||||
rm -f depend
|
||||
touch depend
|
||||
$(MKDEP) $(MKDEP_OPTIONS) $(INCLUDES) $(SOURCES) \
|
||||
$(MESA_GLAPI_SOURCES) $(MESA_GLAPI_ASM_SOURCES)
|
||||
|
||||
# Emacs tags
|
||||
tags:
|
||||
etags `find . -name \*.[ch]` `find $(TOP)/include`
|
||||
|
||||
install_headers: include/GL/gl.h
|
||||
$(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/include/GL
|
||||
$(INSTALL) -m 644 include/GL/gl.h $(DESTDIR)$(INSTALL_DIR)/include/GL
|
||||
|
||||
install_libraries: $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME)
|
||||
$(MAKE) -C $(TOP)/src/mesa install-libgl
|
||||
|
||||
install: install_libraries
|
||||
|
||||
# Remove .o and backup files
|
||||
clean:
|
||||
-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
|
||||
-rm -f $(TOP)/$(LIB_DIR)/$(GL_LIB_GLOB)
|
||||
-rm -f *.o *~
|
||||
-rm -f depend depend.bak
|
||||
|
||||
-include depend
|
||||
18
src/glx/apple/OVERALL_DESIGN
Normal file
18
src/glx/apple/OVERALL_DESIGN
Normal file
|
|
@ -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.
|
||||
|
||||
8
src/glx/apple/README_UPDATING
Normal file
8
src/glx/apple/README_UPDATING
Normal file
|
|
@ -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.
|
||||
71
src/glx/apple/RELEASE_NOTES
Normal file
71
src/glx/apple/RELEASE_NOTES
Normal file
|
|
@ -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).
|
||||
26
src/glx/apple/TODO
Normal file
26
src/glx/apple/TODO
Normal file
|
|
@ -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.
|
||||
|
||||
128
src/glx/apple/apple_cgl.c
Normal file
128
src/glx/apple/apple_cgl.c
Normal file
|
|
@ -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;
|
||||
}
|
||||
86
src/glx/apple/apple_cgl.h
Normal file
86
src/glx/apple/apple_cgl.h
Normal file
|
|
@ -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
|
||||
623
src/glx/apple/apple_exports.list
Normal file
623
src/glx/apple/apple_exports.list
Normal file
|
|
@ -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
|
||||
214
src/glx/apple/apple_glx.c
Normal file
214
src/glx/apple/apple_glx.c
Normal file
|
|
@ -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);
|
||||
}
|
||||
49
src/glx/apple/apple_glx.h
Normal file
49
src/glx/apple/apple_glx.h
Normal file
|
|
@ -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 <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
|
||||
616
src/glx/apple/apple_glx_context.c
Normal file
616
src/glx/apple/apple_glx_context.c
Normal file
|
|
@ -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;
|
||||
}
|
||||
93
src/glx/apple/apple_glx_context.h
Normal file
93
src/glx/apple/apple_glx_context.h
Normal file
|
|
@ -0,0 +1,93 @@
|
|||
/*
|
||||
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
|
||||
|
||||
/* <rdar://problem/6953344> */
|
||||
#define glTexImage1D glTexImage1D_OSX
|
||||
#define glTexImage2D glTexImage2D_OSX
|
||||
#define glTexImage3D glTexImage3D_OSX
|
||||
#include <OpenGL/CGLTypes.h>
|
||||
#include <OpenGL/CGLContext.h>
|
||||
#undef glTexImage1D
|
||||
#undef glTexImage2D
|
||||
#undef glTexImage3D
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <GL/glx.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 */
|
||||
542
src/glx/apple/apple_glx_drawable.c
Normal file
542
src/glx/apple/apple_glx_drawable.c
Normal file
|
|
@ -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;
|
||||
}
|
||||
227
src/glx/apple/apple_glx_drawable.h
Normal file
227
src/glx/apple/apple_glx_drawable.h
Normal file
|
|
@ -0,0 +1,227 @@
|
|||
/*
|
||||
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
|
||||
|
||||
/* Must be first for:
|
||||
* <rdar://problem/6953344>
|
||||
*/
|
||||
#include "apple_glx_context.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
|
||||
|
||||
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
|
||||
348
src/glx/apple/apple_glx_pbuffer.c
Normal file
348
src/glx/apple/apple_glx_pbuffer.c
Normal file
|
|
@ -0,0 +1,348 @@
|
|||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
/* Must be before OpenGL.framework is included. Remove once fixed:
|
||||
* <rdar://problem/7872773>
|
||||
*/
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glext.h>
|
||||
#define __gltypes_h_ 1
|
||||
|
||||
/* Must be first for:
|
||||
* <rdar://problem/6953344>
|
||||
*/
|
||||
#include "apple_glx_context.h"
|
||||
#include "apple_glx_drawable.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <pthread.h>
|
||||
#include <assert.h>
|
||||
#include "apple_glx.h"
|
||||
#include "glcontextmodes.h"
|
||||
#include "apple_cgl.h"
|
||||
|
||||
/* mesa defines in glew.h, Apple in glext.h.
|
||||
* Due to namespace nightmares, just do it here.
|
||||
*/
|
||||
#ifndef GL_TEXTURE_RECTANGLE_EXT
|
||||
#define GL_TEXTURE_RECTANGLE_EXT 0x84F5
|
||||
#endif
|
||||
|
||||
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;
|
||||
}
|
||||
230
src/glx/apple/apple_glx_pixmap.c
Normal file
230
src/glx/apple/apple_glx_pixmap.c
Normal file
|
|
@ -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);
|
||||
}
|
||||
224
src/glx/apple/apple_glx_surface.c
Normal file
224
src/glx/apple/apple_glx_surface.c
Normal file
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
153
src/glx/apple/apple_visual.c
Normal file
153
src/glx/apple/apple_visual.c
Normal file
|
|
@ -0,0 +1,153 @@
|
|||
/*
|
||||
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>
|
||||
|
||||
/* <rdar://problem/6953344> */
|
||||
#define glTexImage1D glTexImage1D_OSX
|
||||
#define glTexImage2D glTexImage2D_OSX
|
||||
#define glTexImage3D glTexImage3D_OSX
|
||||
#include <OpenGL/OpenGL.h>
|
||||
#include <OpenGL/CGLContext.h>
|
||||
#include <OpenGL/CGLRenderers.h>
|
||||
#undef glTexImage1D
|
||||
#undef glTexImage2D
|
||||
#undef glTexImage3D
|
||||
|
||||
#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();
|
||||
}
|
||||
}
|
||||
41
src/glx/apple/apple_visual.h
Normal file
41
src/glx/apple/apple_visual.h
Normal file
|
|
@ -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
|
||||
37
src/glx/apple/apple_xgl_api_additional.c
Normal file
37
src/glx/apple/apple_xgl_api_additional.c
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
#define GL_GLEXT_PROTOTYPES
|
||||
#include <GL/gl.h>
|
||||
|
||||
GLAPI void APIENTRY glTexImage3DEXT(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei
|
||||
depth, GLint border, GLenum format, GLenum type, const void * pixels) {
|
||||
glTexImage3D(target, level, (GLint)internalformat, width, height, depth, border, format, type, pixels);
|
||||
}
|
||||
|
||||
133
src/glx/apple/apple_xgl_api_read.c
Normal file
133
src/glx/apple/apple_xgl_api_read.c
Normal file
|
|
@ -0,0 +1,133 @@
|
|||
/*
|
||||
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 "glxclient.h"
|
||||
#include "apple_glx_context.h"
|
||||
#include "apple_xgl_api.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->driContext, gc->driContext,
|
||||
gc->currentReadable)) {
|
||||
/* An error occurred, so try to restore the old context state. */
|
||||
(void) apple_glx_make_current_context(dpy, gc->driContext, gc->driContext,
|
||||
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->driContext, gc->driContext,
|
||||
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);
|
||||
}
|
||||
128
src/glx/apple/apple_xgl_api_stereo.c
Normal file
128
src/glx/apple/apple_xgl_api_stereo.c
Normal file
|
|
@ -0,0 +1,128 @@
|
|||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
/* This should be removed once stereo hardware bugs are fixed
|
||||
* <rdar://problem/6729006>
|
||||
*/
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#define GL_GLEXT_PROTOTYPES
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glext.h>
|
||||
|
||||
#include "glxclient.h"
|
||||
#include "apple_glx_context.h"
|
||||
#include "apple_xgl_api.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->driContext)) {
|
||||
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->driContext)) {
|
||||
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);
|
||||
}
|
||||
46
src/glx/apple/apple_xgl_api_viewport.c
Normal file
46
src/glx/apple/apple_xgl_api_viewport.c
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
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"
|
||||
#include "apple_glx_context.h"
|
||||
#include "apple_xgl_api.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->driContext)
|
||||
apple_glx_context_update(dpy, gc->driContext);
|
||||
|
||||
__gl_api.Viewport(x, y, width, height);
|
||||
}
|
||||
452
src/glx/apple/appledri.c
Normal file
452
src/glx/apple/appledri.c
Normal file
|
|
@ -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;
|
||||
}
|
||||
124
src/glx/apple/appledri.h
Normal file
124
src/glx/apple/appledri.h
Normal file
|
|
@ -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_ */
|
||||
266
src/glx/apple/appledristr.h
Normal file
266
src/glx/apple/appledristr.h
Normal file
|
|
@ -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_ */
|
||||
86
src/glx/apple/gen_api_header.tcl
Normal file
86
src/glx/apple/gen_api_header.tcl
Normal file
|
|
@ -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]
|
||||
212
src/glx/apple/gen_api_library.tcl
Normal file
212
src/glx/apple/gen_api_library.tcl
Normal file
|
|
@ -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]
|
||||
50
src/glx/apple/gen_code.tcl
Normal file
50
src/glx/apple/gen_code.tcl
Normal file
|
|
@ -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]
|
||||
67
src/glx/apple/gen_defs.tcl
Normal file
67
src/glx/apple/gen_defs.tcl
Normal file
|
|
@ -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
|
||||
132
src/glx/apple/gen_exports.tcl
Normal file
132
src/glx/apple/gen_exports.tcl
Normal file
|
|
@ -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]
|
||||
735
src/glx/apple/gen_funcs.tcl
Normal file
735
src/glx/apple/gen_funcs.tcl
Normal file
|
|
@ -0,0 +1,735 @@
|
|||
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 future OpenGL versions:
|
||||
# cat specs/gl.tm | grep -v '^#' | awk -F, '{sub(/[ \t]+/, ""); print " "$1 " \"" $4 "\""}'
|
||||
# then change void from "*" to "void"
|
||||
#
|
||||
# TextureComponentCount is GLenum in SL for everything
|
||||
# It is GLint in mesa, but is GLenum for glTexImage3DEXT
|
||||
array set typemap {
|
||||
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 "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"
|
||||
BufferOffset "GLintptr"
|
||||
BufferSize "GLsizeiptr"
|
||||
BufferAccessARB "GLenum"
|
||||
BufferOffsetARB "GLintptrARB"
|
||||
BufferPNameARB "GLenum"
|
||||
BufferPointerNameARB "GLenum"
|
||||
BufferSizeARB "GLsizeiptrARB"
|
||||
BufferTargetARB "GLenum"
|
||||
BufferUsageARB "GLenum"
|
||||
ObjectTypeAPPLE "GLenum"
|
||||
VertexArrayPNameAPPLE "GLenum"
|
||||
DrawBufferModeATI "GLenum"
|
||||
Half16NV "GLhalfNV"
|
||||
PixelDataRangeTargetNV "GLenum"
|
||||
TypeEnum "GLenum"
|
||||
GLbitfield "GLbitfield"
|
||||
GLenum "GLenum"
|
||||
Int64 "GLint64"
|
||||
UInt64 "GLuint64"
|
||||
handleARB "GLhandleARB"
|
||||
charARB "GLcharARB"
|
||||
charPointerARB "GLcharARB*"
|
||||
sync "GLsync"
|
||||
Int64EXT "GLint64EXT"
|
||||
UInt64EXT "GLuint64EXT"
|
||||
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"
|
||||
BufferAccessMask "GLbitfield"
|
||||
GetMultisamplePNameNV "GLenum"
|
||||
SampleMaskNV "GLbitfield"
|
||||
}
|
||||
|
||||
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)
|
||||
|
||||
if {"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]
|
||||
|
||||
32
src/glx/apple/gen_types.tcl
Normal file
32
src/glx/apple/gen_types.tcl
Normal file
|
|
@ -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
|
||||
375
src/glx/apple/glx_empty.c
Normal file
375
src/glx/apple/glx_empty.c
Normal file
|
|
@ -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)
|
||||
65
src/glx/apple/glx_error.c
Normal file
65
src/glx/apple/glx_error.c
Normal file
|
|
@ -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);
|
||||
}
|
||||
33
src/glx/apple/glx_error.h
Normal file
33
src/glx/apple/glx_error.h
Normal file
|
|
@ -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);
|
||||
134
src/glx/apple/glxreply.c
Normal file
134
src/glx/apple/glxreply.c
Normal file
|
|
@ -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;
|
||||
}
|
||||
7522
src/glx/apple/specs/enum.spec
Normal file
7522
src/glx/apple/specs/enum.spec
Normal file
File diff suppressed because it is too large
Load diff
6542
src/glx/apple/specs/enumext.spec
Normal file
6542
src/glx/apple/specs/enumext.spec
Normal file
File diff suppressed because it is too large
Load diff
28563
src/glx/apple/specs/gl.spec
Normal file
28563
src/glx/apple/specs/gl.spec
Normal file
File diff suppressed because it is too large
Load diff
322
src/glx/apple/specs/gl.tm
Normal file
322
src/glx/apple/specs/gl.tm
Normal file
|
|
@ -0,0 +1,322 @@
|
|||
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,*,*
|
||||
GLbitfield,*,*, GLbitfield,*,*
|
||||
GLenum,*,*, GLenum,*,*
|
||||
Int64,*,*, GLint64,*,*
|
||||
UInt64,*,*, GLuint64,*,*
|
||||
# Object handle & data pointers
|
||||
handleARB,*,*, GLhandleARB,*,*
|
||||
charARB,*,*, GLcharARB,*,*
|
||||
charPointerARB,*,*, GLcharARB*,*,*
|
||||
sync,*,*, GLsync,*,*,
|
||||
# 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,*,*
|
||||
602
src/glx/apple/specs/glx.spec
Normal file
602
src/glx/apple/specs/glx.spec
Normal file
|
|
@ -0,0 +1,602 @@
|
|||
# Copyright (c) 1991-2005 Silicon Graphics, Inc. All Rights Reserved.
|
||||
# Copyright (c) 2006-2010 The Khronos Group, Inc.
|
||||
#
|
||||
# This document is licensed under the SGI Free Software B License Version
|
||||
# 2.0. For details, see http://oss.sgi.com/projects/FreeB/ .
|
||||
#
|
||||
# $Revision: 10796 $ on $Date: 2010-03-19 17:31:10 -0700 (Fri, 19 Mar 2010) $
|
||||
|
||||
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 ???
|
||||
420
src/glx/apple/specs/glxenum.spec
Normal file
420
src/glx/apple/specs/glxenum.spec
Normal file
|
|
@ -0,0 +1,420 @@
|
|||
# Copyright (c) 1991-2005 Silicon Graphics, Inc. All Rights Reserved.
|
||||
# Copyright (c) 2006-2010 The Khronos Group, Inc.
|
||||
#
|
||||
# This document is licensed under the SGI Free Software B License Version
|
||||
# 2.0. For details, see http://oss.sgi.com/projects/FreeB/ .
|
||||
#
|
||||
# $Revision: 10796 $ on $Date: 2010-03-19 17:31:10 -0700 (Fri, 19 Mar 2010) $
|
||||
|
||||
# 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
|
||||
BUFFER_SWAP_COMPLETE_INTEL_MASK = 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-0x8182
|
||||
# EXCHANGE_COMPLETE_INTEL = 0x8180
|
||||
# COPY_COMPLETE_INTEL = 0x8181
|
||||
# FLIP_COMPLETE_INTEL = 0x8182
|
||||
|
||||
INTEL_future_use: 0x8183-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.
|
||||
515
src/glx/apple/specs/glxenumext.spec
Normal file
515
src/glx/apple/specs/glxenumext.spec
Normal file
|
|
@ -0,0 +1,515 @@
|
|||
# Copyright (c) 1991-2005 Silicon Graphics, Inc. All Rights Reserved.
|
||||
# Copyright (c) 2006-2010 The Khronos Group, Inc.
|
||||
#
|
||||
# This document is licensed under the SGI Free Software B License Version
|
||||
# 2.0. For details, see http://oss.sgi.com/projects/FreeB/ .
|
||||
#
|
||||
# $Revision: 10796 $ on $Date: 2010-03-19 17:31:10 -0700 (Fri, 19 Mar 2010) $
|
||||
|
||||
# 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 2010/02/10 */
|
||||
passthru: /* Current version at http://www.opengl.org/registry/ */
|
||||
passthru: #define GLX_GLXEXT_VERSION 27
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# 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:
|
||||
|
||||
###############################################################################
|
||||
|
||||
# Extension #384
|
||||
INTEL_swap_event enum:
|
||||
BUFFER_SWAP_COMPLETE_INTEL_MASK = 0x04000000
|
||||
EXCHANGE_COMPLETE_INTEL = 0x8180
|
||||
COPY_COMPLETE_INTEL = 0x8181
|
||||
FLIP_COMPLETE_INTEL = 0x8182
|
||||
1330
src/glx/apple/specs/glxext.spec
Normal file
1330
src/glx/apple/specs/glxext.spec
Normal file
File diff suppressed because it is too large
Load diff
4
src/glx/apple/specs/update.sh
Executable file
4
src/glx/apple/specs/update.sh
Executable file
|
|
@ -0,0 +1,4 @@
|
|||
for f in enum.spec enumext.spec gl.spec gl.tm glx.spec glxenum.spec glxenumext.spec glxext.spec ; do
|
||||
curl -LO http://www.opengl.org/registry/api/$f
|
||||
done
|
||||
|
||||
|
|
@ -35,6 +35,7 @@
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
#ifndef GLX_USE_APPLEGL
|
||||
static void
|
||||
do_enable_disable(GLenum array, GLboolean val)
|
||||
{
|
||||
|
|
@ -123,6 +124,7 @@ __indirect_glPopClientAttrib(void)
|
|||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
__glFreeAttributeState(__GLXcontext * gc)
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
* Kristian Høgsberg (krh@redhat.com)
|
||||
*/
|
||||
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/extensions/Xfixes.h>
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@
|
|||
* Kristian Høgsberg (krh@redhat.com)
|
||||
*/
|
||||
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
|
||||
|
||||
#include <unistd.h>
|
||||
#include <dlfcn.h>
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
*
|
||||
*/
|
||||
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/extensions/Xfixes.h>
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include "glxclient.h"
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
*
|
||||
|
|
@ -320,7 +326,7 @@ GetDrawableAttribute(Display * dpy, GLXDrawable drawable,
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
|
||||
{
|
||||
__GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable, NULL);
|
||||
|
||||
|
|
@ -586,6 +592,7 @@ glXCreateGLXPbufferSGIX(Display * dpy, GLXFBConfigSGIX config,
|
|||
attrib_list, GL_FALSE);
|
||||
}
|
||||
|
||||
#endif /* GLX_USE_APPLEGL */
|
||||
|
||||
/**
|
||||
* Create a new pbuffer.
|
||||
|
|
@ -594,12 +601,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:
|
||||
|
|
@ -613,6 +665,7 @@ glXCreatePbuffer(Display * dpy, GLXFBConfig config, const int *attrib_list)
|
|||
|
||||
return (GLXPbuffer) CreatePbuffer(dpy, (__GLcontextModes *) config,
|
||||
width, height, attrib_list, GL_TRUE);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -622,7 +675,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
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -634,10 +693,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.
|
||||
*/
|
||||
|
|
@ -647,7 +743,7 @@ glXQueryGLXPbufferSGIX(Display * dpy, GLXPbufferSGIX drawable,
|
|||
{
|
||||
return GetDrawableAttribute(dpy, drawable, attribute, value);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Select the event mask for a drawable.
|
||||
|
|
@ -655,12 +751,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
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -670,6 +784,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;
|
||||
|
||||
|
||||
|
|
@ -680,6 +814,7 @@ glXGetSelectedEvent(Display * dpy, GLXDrawable drawable, unsigned long *mask)
|
|||
|
||||
GetDrawableAttribute(dpy, drawable, GLX_EVENT_MASK_SGIX, &value);
|
||||
*mask = value;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -689,8 +824,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
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -699,9 +843,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
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -709,8 +877,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
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -718,11 +890,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),
|
||||
|
|
@ -738,4 +911,4 @@ GLX_ALIAS_VOID(glXGetSelectedEventSGIX,
|
|||
(Display * dpy, GLXDrawable drawable,
|
||||
unsigned long *mask), (dpy, drawable, mask),
|
||||
glXGetSelectedEvent)
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -97,8 +97,13 @@ typedef struct _glapi_table __GLapi;
|
|||
#define containerOf(ptr, type, member) \
|
||||
(type *)( (char *)ptr - offsetof(type,member) )
|
||||
|
||||
#include <GL/internal/dri_interface.h>
|
||||
extern void DRI_glXUseXFont(Font font, int first, int count, int listbase);
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
|
||||
|
||||
#include <GL/internal/dri_interface.h>
|
||||
|
||||
/**
|
||||
* Display dependent methods. This structure is initialized during the
|
||||
|
|
@ -185,8 +190,6 @@ extern __GLXDRIdisplay *dri2CreateDisplay(Display * dpy);
|
|||
extern void dri2InvalidateBuffers(Display *dpy, XID drawable);
|
||||
|
||||
|
||||
extern void DRI_glXUseXFont(Font font, int first, int count, int listbase);
|
||||
|
||||
/*
|
||||
** Functions to obtain driver configuration information from a direct
|
||||
** rendering client application
|
||||
|
|
@ -405,8 +408,13 @@ struct __GLXcontextRec
|
|||
const __GLcontextModes *mode;
|
||||
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
#ifdef GLX_USE_APPLEGL
|
||||
void *driContext;
|
||||
Bool do_destroy;
|
||||
#else
|
||||
__GLXDRIcontext *driContext;
|
||||
__DRIcontext *__driContext;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
|
@ -503,7 +511,7 @@ struct __GLXscreenConfigsRec
|
|||
*/
|
||||
char *effectiveGLXexts;
|
||||
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
|
||||
/**
|
||||
* Per screen direct rendering interface functions and data.
|
||||
*/
|
||||
|
|
@ -618,7 +626,7 @@ struct __GLXdisplayPrivateRec
|
|||
*/
|
||||
__GLXscreenConfigs *screenConfigs;
|
||||
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
|
||||
/**
|
||||
* Per display direct rendering interface functions and data.
|
||||
*/
|
||||
|
|
@ -796,7 +804,7 @@ extern GLboolean __glXGetMscRateOML(Display * dpy, GLXDrawable drawable,
|
|||
int32_t * numerator,
|
||||
int32_t * denominator);
|
||||
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
|
||||
GLboolean
|
||||
__driGetMscRateOML(__DRIdrawable * draw,
|
||||
int32_t * numerator, int32_t * denominator, void *private);
|
||||
|
|
|
|||
|
|
@ -39,10 +39,17 @@
|
|||
#include "glcontextmodes.h"
|
||||
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
#ifdef GLX_USE_APPLEGL
|
||||
#include "apple_glx_context.h"
|
||||
#include "apple_glx.h"
|
||||
#include "glx_error.h"
|
||||
#define GC_IS_DIRECT(gc) ((gc)->isDirect)
|
||||
#else
|
||||
#include <sys/time.h>
|
||||
#include <X11/extensions/xf86vmode.h>
|
||||
#include "xf86dri.h"
|
||||
#define GC_IS_DIRECT(gc) ((gc)->driContext != NULL)
|
||||
#endif
|
||||
#else
|
||||
#define GC_IS_DIRECT(gc) (0)
|
||||
#endif
|
||||
|
|
@ -59,7 +66,7 @@ static const char __glXGLXClientVersion[] = "1.4";
|
|||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
|
||||
|
||||
static Bool windowExistsFlag;
|
||||
static int
|
||||
|
|
@ -344,6 +351,12 @@ AllocateGLXContext(Display * dpy)
|
|||
bufSize = __GLX_MAX_RENDER_CMD_SIZE;
|
||||
}
|
||||
gc->maxSmallRenderCommandSize = bufSize;
|
||||
|
||||
#ifdef GLX_USE_APPLEGL
|
||||
gc->driContext = NULL;
|
||||
gc->do_destroy = False;
|
||||
#endif
|
||||
|
||||
return gc;
|
||||
}
|
||||
|
||||
|
|
@ -366,9 +379,14 @@ CreateContext(Display * dpy, int generic_id,
|
|||
{
|
||||
GLXContext gc;
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
#ifdef GLX_USE_APPLEGL
|
||||
int errorcode;
|
||||
bool x11error;
|
||||
#else
|
||||
__GLXscreenConfigs *const psc = GetGLXScreenConfigs(dpy, screen);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
if (dpy == NULL)
|
||||
return NULL;
|
||||
|
||||
|
|
@ -379,6 +397,7 @@ CreateContext(Display * dpy, int generic_id,
|
|||
if (!gc)
|
||||
return NULL;
|
||||
|
||||
#ifndef GLX_USE_APPLEGL /* TODO: darwin indirect */
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
if (allowDirect && psc->driScreen) {
|
||||
gc->driContext = psc->driScreen->createContext(psc, fbconfig, gc,
|
||||
|
|
@ -455,10 +474,26 @@ CreateContext(Display * dpy, int generic_id,
|
|||
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
#endif
|
||||
|
||||
gc->imported = GL_FALSE;
|
||||
gc->renderType = renderType;
|
||||
|
||||
/* TODO: darwin: Integrate with above to do indirect */
|
||||
#ifdef GLX_USE_APPLEGL
|
||||
if(apple_glx_create_context(&gc->driContext, dpy, screen, fbconfig,
|
||||
shareList ? shareList->driContext : NULL,
|
||||
&errorcode, &x11error)) {
|
||||
__glXSendError(dpy, errorcode, 0, X_GLXCreateContext, x11error);
|
||||
__glXFreeContext(gc);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
gc->currentContextTag = -1;
|
||||
gc->mode = fbconfig;
|
||||
gc->isDirect = allowDirect;
|
||||
#endif
|
||||
|
||||
return gc;
|
||||
}
|
||||
|
||||
|
|
@ -469,7 +504,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);
|
||||
|
|
@ -517,6 +552,7 @@ __glXFreeContext(__GLXcontext * gc)
|
|||
static void
|
||||
DestroyContext(Display * dpy, GLXContext gc)
|
||||
{
|
||||
#ifndef GLX_USE_APPLEGL /* TODO: darwin: indirect */
|
||||
xGLXDestroyContextReq *req;
|
||||
GLXContextID xid;
|
||||
CARD8 opcode;
|
||||
|
|
@ -542,7 +578,7 @@ DestroyContext(Display * dpy, GLXContext gc)
|
|||
return;
|
||||
}
|
||||
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
|
||||
/* Destroy the direct rendering context */
|
||||
if (gc->driContext) {
|
||||
(*gc->driContext->destroyContext) (gc->driContext, gc->psc, dpy);
|
||||
|
|
@ -552,17 +588,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->driContext)
|
||||
apple_glx_destroy_context(&gc->driContext, dpy);
|
||||
#endif
|
||||
__glXFreeContext(gc);
|
||||
}
|
||||
|
||||
#ifndef GLX_USE_APPLEGL
|
||||
if (!imported) {
|
||||
/*
|
||||
** This dpy also created the server side part of the context.
|
||||
|
|
@ -576,6 +626,7 @@ DestroyContext(Display * dpy, GLXContext gc)
|
|||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
PUBLIC void
|
||||
|
|
@ -630,7 +681,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,8 +692,10 @@ glXWaitGL(void)
|
|||
|
||||
/* Flush any pending commands out */
|
||||
__glXFlushRenderBuffer(gc, gc->pc);
|
||||
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
#ifdef GLX_USE_APPLEGL
|
||||
glFinish();
|
||||
#else
|
||||
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
|
||||
if (gc->driContext) {
|
||||
int screen;
|
||||
__GLXDRIdrawable *pdraw =
|
||||
|
|
@ -664,6 +719,7 @@ glXWaitGL(void)
|
|||
req->contextTag = gc->currentContextTag;
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
#endif /* GLX_USE_APPLEGL */
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -673,7 +729,9 @@ glXWaitGL(void)
|
|||
PUBLIC void
|
||||
glXWaitX(void)
|
||||
{
|
||||
#ifndef GLX_USE_APPLEGL
|
||||
xGLXWaitXReq *req;
|
||||
#endif
|
||||
GLXContext gc = __glXGetCurrentContext();
|
||||
Display *dpy = gc->currentDpy;
|
||||
|
||||
|
|
@ -683,7 +741,10 @@ glXWaitX(void)
|
|||
/* Flush any pending commands out */
|
||||
__glXFlushRenderBuffer(gc, gc->pc);
|
||||
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
#ifdef GLX_USE_APPLEGL
|
||||
apple_glx_waitx(dpy, gc->driContext);
|
||||
#else
|
||||
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
|
||||
if (gc->driContext) {
|
||||
int screen;
|
||||
__GLXDRIdrawable *pdraw =
|
||||
|
|
@ -710,12 +771,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,8 +788,10 @@ glXUseXFont(Font font, int first, int count, int listBase)
|
|||
|
||||
/* Flush any pending commands out */
|
||||
(void) __glXFlushRenderBuffer(gc, gc->pc);
|
||||
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
#ifdef GLX_USE_APPLEGL
|
||||
DRI_glXUseXFont(font, first, count, listBase);
|
||||
#else
|
||||
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
|
||||
if (gc->driContext) {
|
||||
DRI_glXUseXFont(font, first, count, listBase);
|
||||
return;
|
||||
|
|
@ -744,6 +810,7 @@ glXUseXFont(Font font, int first, int count, int listBase)
|
|||
req->listBase = listBase;
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
#endif /* GLX_USE_APPLEGL */
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
|
|
@ -756,6 +823,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->driContext, source->driContext, dest->driContext,
|
||||
mask, &errorcode, &x11error)) {
|
||||
__glXSendError(dpy, errorcode, 0, X_GLXCopyContext, x11error);
|
||||
}
|
||||
|
||||
#else
|
||||
xGLXCopyContextReq *req;
|
||||
GLXContext gc = __glXGetCurrentContext();
|
||||
GLXContextTag tag;
|
||||
|
|
@ -766,7 +844,7 @@ glXCopyContext(Display * dpy, GLXContext source,
|
|||
return;
|
||||
}
|
||||
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
|
||||
if (gc->driContext) {
|
||||
/* NOT_DONE: This does not work yet */
|
||||
}
|
||||
|
|
@ -794,6 +872,7 @@ glXCopyContext(Display * dpy, GLXContext source,
|
|||
req->contextTag = tag;
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
#endif /* GLX_USE_APPLEGL */
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -808,6 +887,9 @@ glXCopyContext(Display * dpy, GLXContext source,
|
|||
static Bool
|
||||
__glXIsDirect(Display * dpy, GLXContextID contextID)
|
||||
{
|
||||
#ifndef GLX_USE_APPLEGL /* TODO: apple indirect */
|
||||
return GC_IS_DIRECT(gc);
|
||||
#else
|
||||
#if !defined(USE_XCB)
|
||||
xGLXIsDirectReq *req;
|
||||
xGLXIsDirectReply reply;
|
||||
|
|
@ -843,6 +925,7 @@ __glXIsDirect(Display * dpy, GLXContextID contextID)
|
|||
|
||||
return reply.isDirect;
|
||||
#endif /* USE_XCB */
|
||||
#endif /* GLX_USE_APPLEGL */
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -866,6 +949,18 @@ glXIsDirect(Display * dpy, GLXContext gc)
|
|||
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;
|
||||
|
|
@ -887,7 +982,7 @@ glXCreateGLXPixmap(Display * dpy, XVisualInfo * vis, Pixmap pixmap)
|
|||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
|
||||
do {
|
||||
/* FIXME: Maybe delay __DRIdrawable creation until the drawable
|
||||
* is actually bound to a context... */
|
||||
|
|
@ -915,6 +1010,7 @@ glXCreateGLXPixmap(Display * dpy, XVisualInfo * vis, Pixmap pixmap)
|
|||
#endif
|
||||
|
||||
return xid;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -923,6 +1019,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;
|
||||
|
||||
|
|
@ -940,7 +1040,7 @@ glXDestroyGLXPixmap(Display * dpy, GLXPixmap glxpixmap)
|
|||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
|
||||
{
|
||||
int screen;
|
||||
__GLXdisplayPrivate *const priv = __glXInitialize(dpy);
|
||||
|
|
@ -953,11 +1053,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->driContext, drawable)) {
|
||||
apple_glx_swap_buffers(gc->driContext);
|
||||
} else {
|
||||
__glXSendError(dpy, GLXBadCurrentWindow, 0, X_GLXSwapBuffers, false);
|
||||
}
|
||||
#else
|
||||
GLXContext gc;
|
||||
GLXContextTag tag;
|
||||
CARD8 opcode;
|
||||
|
|
@ -967,7 +1076,7 @@ glXSwapBuffers(Display * dpy, GLXDrawable drawable)
|
|||
xGLXSwapBuffersReq *req;
|
||||
#endif
|
||||
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
|
||||
__GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable, NULL);
|
||||
|
||||
if (pdraw != NULL) {
|
||||
|
|
@ -1012,6 +1121,7 @@ glXSwapBuffers(Display * dpy, GLXDrawable drawable)
|
|||
SyncHandle();
|
||||
XFlush(dpy);
|
||||
#endif /* USE_XCB */
|
||||
#endif /* GLX_USE_APPLEGL */
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1440,6 +1550,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;
|
||||
}
|
||||
|
||||
|
|
@ -1462,7 +1578,7 @@ glXQueryExtensionsString(Display * dpy, int screen)
|
|||
}
|
||||
|
||||
__glXCalculateUsableExtensions(psc,
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
|
||||
(psc->driScreen != NULL),
|
||||
#else
|
||||
GL_FALSE,
|
||||
|
|
@ -1573,6 +1689,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,13 +1801,16 @@ 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 */
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
|
||||
if (!ctx->driContext && (ctx->mode == NULL)) {
|
||||
#else
|
||||
if (ctx->mode == NULL) {
|
||||
|
|
@ -1699,13 +1819,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 +1858,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 +1881,7 @@ glXImportContextEXT(Display * dpy, GLXContextID contextID)
|
|||
}
|
||||
}
|
||||
return ctx;
|
||||
#endif
|
||||
}
|
||||
|
||||
PUBLIC void
|
||||
|
|
@ -1881,7 +2009,7 @@ glXGetVisualFromFBConfig(Display * dpy, GLXFBConfig config)
|
|||
return XGetVisualInfo(dpy, VisualIDMask, &visualTemplate, &count);
|
||||
}
|
||||
|
||||
|
||||
#ifndef GLX_USE_APPLEGL
|
||||
/*
|
||||
** GLX_SGI_swap_control
|
||||
*/
|
||||
|
|
@ -2236,6 +2364,7 @@ __glXWaitVideoSyncSGI(int divisor, int remainder, unsigned int *count)
|
|||
return GLX_BAD_CONTEXT;
|
||||
}
|
||||
|
||||
#endif /* GLX_USE_APPLEGL */
|
||||
|
||||
/*
|
||||
** GLX_SGIX_fbconfig
|
||||
|
|
@ -2262,17 +2391,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 +2436,7 @@ glXCreateGLXPixmapWithConfigSGIX(Display * dpy,
|
|||
}
|
||||
|
||||
return xid;
|
||||
#endif
|
||||
}
|
||||
|
||||
PUBLIC GLXContext
|
||||
|
|
@ -2345,7 +2482,7 @@ glXGetFBConfigFromVisualSGIX(Display * dpy, XVisualInfo * vis)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
#ifndef GLX_USE_APPLEGL
|
||||
/*
|
||||
** GLX_SGIX_swap_group
|
||||
*/
|
||||
|
|
@ -2420,7 +2557,7 @@ __glXGetSyncValuesOML(Display * dpy, GLXDrawable drawable,
|
|||
return False;
|
||||
}
|
||||
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
|
||||
_X_HIDDEN GLboolean
|
||||
__driGetMscRateOML(__DRIdrawable * draw,
|
||||
int32_t * numerator, int32_t * denominator, void *private)
|
||||
|
|
@ -2876,7 +3013,7 @@ __glXBindTexImageEXT(Display * dpy,
|
|||
i++;
|
||||
}
|
||||
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
|
||||
if (gc->driContext) {
|
||||
__GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable, NULL);
|
||||
|
||||
|
|
@ -2966,6 +3103,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.
|
||||
|
|
@ -3043,6 +3182,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),
|
||||
|
||||
|
|
@ -3060,6 +3200,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),
|
||||
|
|
@ -3069,6 +3210,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),
|
||||
|
|
@ -3106,6 +3248,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),
|
||||
|
|
@ -3113,6 +3256,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),
|
||||
|
|
@ -3123,8 +3267,9 @@ 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
|
||||
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
|
||||
/*** DRI configuration ***/
|
||||
GLX_FUNCTION(glXGetScreenDriver),
|
||||
GLX_FUNCTION(glXGetDriverConfig),
|
||||
|
|
@ -3133,7 +3278,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)
|
||||
{
|
||||
|
|
@ -3147,7 +3292,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
|
||||
|
|
@ -3170,13 +3315,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;
|
||||
}
|
||||
|
||||
|
|
@ -3199,7 +3346,7 @@ PUBLIC void (*glXGetProcAddress(const GLubyte * procName)) (void)
|
|||
#endif /* __GNUC__ */
|
||||
|
||||
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
|
||||
/**
|
||||
* Get the unadjusted system time (UST). Currently, the UST is measured in
|
||||
* microseconds since Epoc. The actual resolution of the UST may vary from
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
#ifndef GLX_USE_APPLEGL
|
||||
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
|
||||
_glapi_set_dispatch(NULL); /* no-op functions */
|
||||
_glapi_set_context(NULL);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -186,6 +200,7 @@ glXGetCurrentDrawable(void)
|
|||
}
|
||||
|
||||
|
||||
#ifndef GLX_USE_APPLEGL
|
||||
/************************************************************************/
|
||||
|
||||
/**
|
||||
|
|
@ -269,7 +284,7 @@ SendMakeCurrentRequest(Display * dpy, CARD8 opcode,
|
|||
}
|
||||
|
||||
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
|
||||
static __GLXDRIdrawable *
|
||||
FetchDRIDrawable(Display * dpy, GLXDrawable glxDrawable, GLXContext gc)
|
||||
{
|
||||
|
|
@ -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->driContext : NULL,
|
||||
gc ? gc->driContext : 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);
|
||||
|
|
@ -360,7 +386,7 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw,
|
|||
return False;
|
||||
}
|
||||
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
|
||||
/* Bind the direct rendering context to the drawable */
|
||||
if (gc && gc->driContext) {
|
||||
__GLXDRIdrawable *pdraw = FetchDRIDrawable(dpy, draw, gc);
|
||||
|
|
@ -395,7 +421,7 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw,
|
|||
return False;
|
||||
}
|
||||
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
|
||||
if ((dpy != oldGC->currentDpy || (gc && gc->driContext)) &&
|
||||
!oldGC->isDirect && oldGC != &dummyContext) {
|
||||
#else
|
||||
|
|
@ -413,12 +439,13 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw,
|
|||
oldGC->currentContextTag, None, None,
|
||||
&dummy_reply);
|
||||
}
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
|
||||
else if (oldGC->driContext && oldGC != gc) {
|
||||
oldGC->driContext->unbindContext(oldGC->driContext);
|
||||
}
|
||||
#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,13 +468,24 @@ 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
|
||||
* for the old handle.
|
||||
*/
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
|
||||
/* Destroy the old direct rendering context */
|
||||
if (oldGC->driContext) {
|
||||
oldGC->driContext->destroyContext(oldGC->driContext,
|
||||
|
|
@ -455,6 +495,7 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw,
|
|||
}
|
||||
#endif
|
||||
__glXFreeContext(oldGC);
|
||||
#endif /* GLX_USE_APPLEGL */
|
||||
}
|
||||
}
|
||||
if (gc) {
|
||||
|
|
@ -463,9 +504,10 @@ 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
|
||||
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
|
||||
if (!gc->driContext) {
|
||||
#endif
|
||||
if (!IndirectAPI)
|
||||
|
|
@ -480,12 +522,13 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw,
|
|||
(void) glGetString(GL_VERSION);
|
||||
__glXInitVertexArrayState(gc);
|
||||
}
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
|
||||
}
|
||||
else {
|
||||
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)
|
||||
|
|
@ -245,7 +259,7 @@ FreeScreenConfigs(__GLXdisplayPrivate * priv)
|
|||
}
|
||||
Xfree((char *) psc->serverGLXexts);
|
||||
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
|
||||
if (psc->driver_configs) {
|
||||
unsigned int j;
|
||||
for (j = 0; psc->driver_configs[j]; j++)
|
||||
|
|
@ -285,7 +299,7 @@ __glXFreeDisplayPrivate(XExtData * extension)
|
|||
priv->serverGLXversion = 0x0; /* to protect against double free's */
|
||||
}
|
||||
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
|
||||
/* Free the direct rendering per display data */
|
||||
if (priv->driswDisplay)
|
||||
(*priv->driswDisplay->destroyDisplay) (priv->driswDisplay);
|
||||
|
|
@ -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;
|
||||
|
|
@ -712,7 +777,7 @@ AllocAndFetchScreenConfigs(Display * dpy, __GLXdisplayPrivate * priv)
|
|||
getVisualConfigs(dpy, priv, i);
|
||||
getFBConfigs(dpy, priv, i);
|
||||
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
|
||||
psc->scr = i;
|
||||
psc->dpy = dpy;
|
||||
psc->drawHash = __glxHashCreate();
|
||||
|
|
@ -752,7 +817,7 @@ __glXInitialize(Display * dpy)
|
|||
__GLXdisplayPrivate *dpyPriv;
|
||||
XEDataObject dataObj;
|
||||
int major, minor;
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
|
||||
Bool glx_direct, glx_accel;
|
||||
#endif
|
||||
|
||||
|
|
@ -809,7 +874,7 @@ __glXInitialize(Display * dpy)
|
|||
dpyPriv->serverGLXvendor = 0x0;
|
||||
dpyPriv->serverGLXversion = 0x0;
|
||||
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
|
||||
glx_direct = (getenv("LIBGL_ALWAYS_INDIRECT") == NULL);
|
||||
glx_accel = (getenv("LIBGL_ALWAYS_SOFTWARE") == NULL);
|
||||
|
||||
|
|
@ -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 }
|
||||
};
|
||||
|
|
|
|||
|
|
@ -5198,7 +5198,7 @@ glDeleteTexturesEXT(GLsizei n, const GLuint * textures)
|
|||
{
|
||||
__GLXcontext *const gc = __glXGetCurrentContext();
|
||||
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
|
||||
if (gc->driContext) {
|
||||
CALL_DeleteTextures(GET_DISPATCH(), (n, textures));
|
||||
} else
|
||||
|
|
@ -5269,7 +5269,7 @@ glGenTexturesEXT(GLsizei n, GLuint * textures)
|
|||
{
|
||||
__GLXcontext *const gc = __glXGetCurrentContext();
|
||||
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
|
||||
if (gc->driContext) {
|
||||
CALL_GenTextures(GET_DISPATCH(), (n, textures));
|
||||
} else
|
||||
|
|
@ -5334,7 +5334,7 @@ glIsTextureEXT(GLuint texture)
|
|||
{
|
||||
__GLXcontext *const gc = __glXGetCurrentContext();
|
||||
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
|
||||
if (gc->driContext) {
|
||||
return CALL_IsTexture(GET_DISPATCH(), (texture));
|
||||
} else
|
||||
|
|
@ -5650,7 +5650,7 @@ glGetColorTableEXT(GLenum target, GLenum format, GLenum type, GLvoid * table)
|
|||
{
|
||||
__GLXcontext *const gc = __glXGetCurrentContext();
|
||||
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
|
||||
if (gc->driContext) {
|
||||
CALL_GetColorTable(GET_DISPATCH(), (target, format, type, table));
|
||||
} else
|
||||
|
|
@ -5726,7 +5726,7 @@ glGetColorTableParameterfvEXT(GLenum target, GLenum pname, GLfloat * params)
|
|||
{
|
||||
__GLXcontext *const gc = __glXGetCurrentContext();
|
||||
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
|
||||
if (gc->driContext) {
|
||||
CALL_GetColorTableParameterfv(GET_DISPATCH(),
|
||||
(target, pname, params));
|
||||
|
|
@ -5799,7 +5799,7 @@ glGetColorTableParameterivEXT(GLenum target, GLenum pname, GLint * params)
|
|||
{
|
||||
__GLXcontext *const gc = __glXGetCurrentContext();
|
||||
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
|
||||
if (gc->driContext) {
|
||||
CALL_GetColorTableParameteriv(GET_DISPATCH(),
|
||||
(target, pname, params));
|
||||
|
|
@ -6125,7 +6125,7 @@ gl_dispatch_stub_356(GLenum target, GLenum format, GLenum type,
|
|||
{
|
||||
__GLXcontext *const gc = __glXGetCurrentContext();
|
||||
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
|
||||
if (gc->driContext) {
|
||||
CALL_GetConvolutionFilter(GET_DISPATCH(),
|
||||
(target, format, type, image));
|
||||
|
|
@ -6203,7 +6203,7 @@ gl_dispatch_stub_357(GLenum target, GLenum pname, GLfloat * params)
|
|||
{
|
||||
__GLXcontext *const gc = __glXGetCurrentContext();
|
||||
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
|
||||
if (gc->driContext) {
|
||||
CALL_GetConvolutionParameterfv(GET_DISPATCH(),
|
||||
(target, pname, params));
|
||||
|
|
@ -6276,7 +6276,7 @@ gl_dispatch_stub_358(GLenum target, GLenum pname, GLint * params)
|
|||
{
|
||||
__GLXcontext *const gc = __glXGetCurrentContext();
|
||||
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
|
||||
if (gc->driContext) {
|
||||
CALL_GetConvolutionParameteriv(GET_DISPATCH(),
|
||||
(target, pname, params));
|
||||
|
|
@ -6356,7 +6356,7 @@ gl_dispatch_stub_361(GLenum target, GLboolean reset, GLenum format,
|
|||
{
|
||||
__GLXcontext *const gc = __glXGetCurrentContext();
|
||||
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
|
||||
if (gc->driContext) {
|
||||
CALL_GetHistogram(GET_DISPATCH(),
|
||||
(target, reset, format, type, values));
|
||||
|
|
@ -6433,7 +6433,7 @@ gl_dispatch_stub_362(GLenum target, GLenum pname, GLfloat * params)
|
|||
{
|
||||
__GLXcontext *const gc = __glXGetCurrentContext();
|
||||
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
|
||||
if (gc->driContext) {
|
||||
CALL_GetHistogramParameterfv(GET_DISPATCH(), (target, pname, params));
|
||||
} else
|
||||
|
|
@ -6504,7 +6504,7 @@ gl_dispatch_stub_363(GLenum target, GLenum pname, GLint * params)
|
|||
{
|
||||
__GLXcontext *const gc = __glXGetCurrentContext();
|
||||
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
|
||||
if (gc->driContext) {
|
||||
CALL_GetHistogramParameteriv(GET_DISPATCH(), (target, pname, params));
|
||||
} else
|
||||
|
|
@ -6579,7 +6579,7 @@ gl_dispatch_stub_364(GLenum target, GLboolean reset, GLenum format,
|
|||
{
|
||||
__GLXcontext *const gc = __glXGetCurrentContext();
|
||||
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
|
||||
if (gc->driContext) {
|
||||
CALL_GetMinmax(GET_DISPATCH(), (target, reset, format, type, values));
|
||||
} else
|
||||
|
|
@ -6653,7 +6653,7 @@ gl_dispatch_stub_365(GLenum target, GLenum pname, GLfloat * params)
|
|||
{
|
||||
__GLXcontext *const gc = __glXGetCurrentContext();
|
||||
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
|
||||
if (gc->driContext) {
|
||||
CALL_GetMinmaxParameterfv(GET_DISPATCH(), (target, pname, params));
|
||||
} else
|
||||
|
|
@ -6721,7 +6721,7 @@ gl_dispatch_stub_366(GLenum target, GLenum pname, GLint * params)
|
|||
{
|
||||
__GLXcontext *const gc = __glXGetCurrentContext();
|
||||
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
|
||||
if (gc->driContext) {
|
||||
CALL_GetMinmaxParameteriv(GET_DISPATCH(), (target, pname, params));
|
||||
} else
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ void NAME(_gloffset_GetSeparableFilter) (GLenum target, GLenum format,
|
|||
{
|
||||
__GLXcontext *const gc = __glXGetCurrentContext();
|
||||
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
|
||||
if (gc->driContext) {
|
||||
CALL_GetSeparableFilter(GET_DISPATCH(),
|
||||
(target, format, type, row, column, span));
|
||||
|
|
|
|||
|
|
@ -48,6 +48,26 @@
|
|||
|
||||
#include "glapi/glapi.h"
|
||||
|
||||
|
||||
/*
|
||||
* These stubs are kept so that the old DRI drivers still load.
|
||||
*/
|
||||
PUBLIC void
|
||||
_glapi_noop_enable_warnings(GLboolean enable);
|
||||
|
||||
PUBLIC void
|
||||
_glapi_set_warning_func(_glapi_proc func);
|
||||
|
||||
void
|
||||
_glapi_noop_enable_warnings(GLboolean enable)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
_glapi_set_warning_func(_glapi_proc func)
|
||||
{
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue