diff options
author | marha <marha@users.sourceforge.net> | 2011-01-21 12:52:35 +0000 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2011-01-21 12:52:35 +0000 |
commit | 7719409ebcf17c5288114dee8f60cc9ff889fd3e (patch) | |
tree | e86379743c048712c638bed954264fccea7798c4 /mesalib/src/mapi/glapi/gen | |
parent | 26ee05a8febfe1ed6da852777a8c1c2a37e4cf9b (diff) | |
parent | b0be6a88c8fecdf15176f642c0799bff99930e0d (diff) | |
download | vcxsrv-7719409ebcf17c5288114dee8f60cc9ff889fd3e.tar.gz vcxsrv-7719409ebcf17c5288114dee8f60cc9ff889fd3e.tar.bz2 vcxsrv-7719409ebcf17c5288114dee8f60cc9ff889fd3e.zip |
svn merge ^/branches/released .
Diffstat (limited to 'mesalib/src/mapi/glapi/gen')
-rw-r--r-- | mesalib/src/mapi/glapi/gen/ARB_get_program_binary.xml | 36 | ||||
-rw-r--r-- | mesalib/src/mapi/glapi/gen/Makefile | 441 | ||||
-rw-r--r-- | mesalib/src/mapi/glapi/gen/OES_fixed_point.xml | 259 | ||||
-rw-r--r-- | mesalib/src/mapi/glapi/gen/OES_single_precision.xml | 47 | ||||
-rw-r--r-- | mesalib/src/mapi/glapi/gen/es_EXT.xml | 618 | ||||
-rw-r--r-- | mesalib/src/mapi/glapi/gen/glX_proto_send.py | 2141 | ||||
-rw-r--r-- | mesalib/src/mapi/glapi/gen/gl_and_es_API.xml | 286 | ||||
-rw-r--r-- | mesalib/src/mapi/glapi/gen/gl_enums.py | 43 |
8 files changed, 2598 insertions, 1273 deletions
diff --git a/mesalib/src/mapi/glapi/gen/ARB_get_program_binary.xml b/mesalib/src/mapi/glapi/gen/ARB_get_program_binary.xml new file mode 100644 index 000000000..a3665e540 --- /dev/null +++ b/mesalib/src/mapi/glapi/gen/ARB_get_program_binary.xml @@ -0,0 +1,36 @@ +<?xml version="1.0"?> +<!DOCTYPE OpenGLAPI SYSTEM "gl_API.dtd"> + +<!-- This is included by gl_and_es_API.xml. Could be moved to gl_API.xml. --> + +<OpenGLAPI> + +<category name="GL_ARB_get_program_binary " number="96"> + <enum name="PROGRAM_BINARY_RETRIEVABLE_HINT" value="0x8257"/> + <enum name="PROGRAM_BINARY_LENGTH" value="0x8741"/> + <enum name="NUM_PROGRAM_BINARY_FORMATS" value="0x87FE"/> + <enum name="PROGRAM_BINARY_FORMATS" value="0x87FF"/> + + <function name="GetProgramBinary" offset="assign" static_dispatch="false"> + <param name="program" type="GLuint"/> + <param name="bufSize" type="GLsizei"/> + <param name="length" type="GLsizei *"/> + <param name="binaryFormat" type="GLenum *"/> + <param name="binary" type="GLvoid *"/> + </function> + + <function name="ProgramBinary" offset="assign" static_dispatch="false"> + <param name="program" type="GLuint"/> + <param name="binaryFormat" type="GLenum"/> + <param name="binary" type="const GLvoid *"/> + <param name="length" type="GLsizei"/> + </function> + + <function name="ProgramParameteri" offset="assign" static_dispatch="false"> + <param name="program" type="GLuint"/> + <param name="pname" type="GLenum"/> + <param name="value" type="GLint"/> + </function> +</category> + +</OpenGLAPI> diff --git a/mesalib/src/mapi/glapi/gen/Makefile b/mesalib/src/mapi/glapi/gen/Makefile index 570cc8547..51eaf7e93 100644 --- a/mesalib/src/mapi/glapi/gen/Makefile +++ b/mesalib/src/mapi/glapi/gen/Makefile @@ -1,213 +1,228 @@ -# This file isn't used during a normal compilation since we don't want to
-# require Python in order to compile Mesa.
-# Instead, when the Mesa developers update/change the API interface it's
-# up to him/her to re-run this makefile and check in the newly generated files.
-
-
-TOP = ../../../..
-include $(TOP)/configs/current
-
-MESA_DIR = $(TOP)/src/mesa
-MESA_GLAPI_DIR = $(TOP)/src/mapi/glapi
-MESA_GLX_DIR = $(TOP)/src/glx
-
-MESA_GLAPI_OUTPUTS = \
- $(MESA_GLAPI_DIR)/glprocs.h \
- $(MESA_GLAPI_DIR)/glapitemp.h \
- $(MESA_GLAPI_DIR)/glapitable.h
-
-MESA_GLAPI_ASM_OUTPUTS = \
- $(MESA_GLAPI_DIR)/glapi_x86.S \
- $(MESA_GLAPI_DIR)/glapi_x86-64.S \
- $(MESA_GLAPI_DIR)/glapi_sparc.S
-
-MESA_OUTPUTS = \
- $(MESA_GLAPI_OUTPUTS) \
- $(MESA_GLAPI_ASM_OUTPUTS) \
- $(MESA_DIR)/main/enums.c \
- $(MESA_DIR)/main/glapidispatch.h \
- $(MESA_DIR)/main/remap_helper.h \
- $(MESA_GLX_DIR)/indirect.c \
- $(MESA_GLX_DIR)/indirect.h \
- $(MESA_GLX_DIR)/indirect_init.c \
- $(MESA_GLX_DIR)/indirect_size.h \
- $(MESA_GLX_DIR)/indirect_size.c
-
-######################################################################
-
-XORG_GLX_DIR = $(XORG_BASE)/glx
-XORG_GLAPI_DIR = $(XORG_BASE)/glx
-
-XORG_GLAPI_FILES = \
- $(XORG_GLAPI_DIR)/glapi.h \
- $(XORG_GLAPI_DIR)/glapi.c \
- $(XORG_GLAPI_DIR)/glapi_getproc.c \
- $(XORG_GLAPI_DIR)/glapi_nop.c \
- $(XORG_GLAPI_DIR)/glthread.c \
- $(XORG_GLAPI_DIR)/glthread.h
-
-XORG_GLAPI_OUTPUTS = \
- $(XORG_GLAPI_DIR)/glprocs.h \
- $(XORG_GLAPI_DIR)/glapitemp.h \
- $(XORG_GLAPI_DIR)/glapioffsets.h \
- $(XORG_GLAPI_DIR)/glapitable.h \
- $(XORG_GLAPI_DIR)/glapidispatch.h
-
-XORG_OUTPUTS = \
- $(XORG_GLAPI_FILES) \
- $(XORG_GLAPI_OUTPUTS) \
- $(XORG_GLX_DIR)/indirect_dispatch.c \
- $(XORG_GLX_DIR)/indirect_dispatch_swap.c \
- $(XORG_GLX_DIR)/indirect_dispatch.h \
- $(XORG_GLX_DIR)/indirect_reqsize.c \
- $(XORG_GLX_DIR)/indirect_reqsize.h \
- $(XORG_GLX_DIR)/indirect_size.h \
- $(XORG_GLX_DIR)/indirect_size_get.c \
- $(XORG_GLX_DIR)/indirect_size_get.h \
- $(XORG_GLX_DIR)/indirect_table.c
-
-######################################################################
-
-API_XML = \
- gl_API.xml \
- ARB_copy_buffer.xml \
- ARB_depth_clamp.xml \
- ARB_draw_buffers_blend.xml \
- ARB_draw_elements_base_vertex.xml \
- ARB_draw_instanced.xml \
- ARB_ES2_compatibility.xml \
- ARB_framebuffer_object.xml \
- ARB_geometry_shader4.xml \
- ARB_instanced_arrays.xml \
- ARB_map_buffer_range.xml \
- ARB_seamless_cube_map.xml \
- ARB_sync.xml \
- ARB_vertex_array_object.xml \
- APPLE_object_purgeable.xml \
- APPLE_vertex_array_object.xml \
- EXT_draw_buffers2.xml \
- EXT_framebuffer_object.xml \
- EXT_gpu_shader4.xml \
- EXT_packed_depth_stencil.xml \
- EXT_provoking_vertex.xml \
- EXT_separate_shader_objects.xml \
- EXT_texture_array.xml \
- EXT_texture_integer.xml \
- EXT_transform_feedback.xml \
- NV_conditional_render.xml \
- NV_primitive_restart.xml \
- OES_EGL_image.xml \
- GL3x.xml
-
-
-COMMON = $(API_XML) gl_XML.py glX_XML.py license.py typeexpr.py
-
-COMMON_GLX = $(COMMON) glX_API.xml glX_XML.py glX_proto_common.py
-
-######################################################################
-
-all: mesa xorg
-
-mesa: $(MESA_OUTPUTS)
-
-xorg: check-xorg-source $(XORG_OUTPUTS)
-
-check-xorg-source:
- @if ! test -d $(XORG_GLX_DIR); then \
- echo "ERROR: Must specify path to xserver/GL/ checkout; set XORG_BASE env var."; \
- exit 1; \
- fi
-
-clean:
- -rm -f *~ *.pyo
- -rm -f $(MESA_OUTPUTS)
-
-######################################################################
-
-$(XORG_GLAPI_DIR)/%.c: $(MESA_GLAPI_DIR)/%.c
- cp $< $@
-
-$(XORG_GLAPI_DIR)/%.h: $(MESA_GLAPI_DIR)/%.h
- cp $< $@
-
-######################################################################
-
-$(MESA_GLAPI_DIR)/glprocs.h: gl_procs.py $(COMMON)
- $(PYTHON2) $(PYTHON_FLAGS) $< > $@
-
-$(MESA_GLAPI_DIR)/glapitemp.h: gl_apitemp.py $(COMMON)
- $(PYTHON2) $(PYTHON_FLAGS) $< > $@
-
-$(MESA_GLAPI_DIR)/glapitable.h: gl_table.py $(COMMON)
- $(PYTHON2) $(PYTHON_FLAGS) $< > $@
-
-######################################################################
-
-$(MESA_GLAPI_DIR)/glapi_x86.S: gl_x86_asm.py $(COMMON)
- $(PYTHON2) $(PYTHON_FLAGS) $< > $@
-
-$(MESA_GLAPI_DIR)/glapi_x86-64.S: gl_x86-64_asm.py $(COMMON)
- $(PYTHON2) $(PYTHON_FLAGS) $< > $@
-
-$(MESA_GLAPI_DIR)/glapi_sparc.S: gl_SPARC_asm.py $(COMMON)
- $(PYTHON2) $(PYTHON_FLAGS) $< > $@
-
-######################################################################
-
-$(MESA_DIR)/main/enums.c: gl_enums.py $(COMMON) $(ES_API)
- $(PYTHON2) $(PYTHON_FLAGS) $< -f gl_API.xml \
- -f $(MESA_GLAPI_DIR)/gen-es/es1_API.xml \
- -f $(MESA_GLAPI_DIR)/gen-es/es2_API.xml > $@
-
-$(MESA_DIR)/main/glapidispatch.h: gl_table.py $(COMMON)
- $(PYTHON2) $(PYTHON_FLAGS) $< -m remap_table > $@
-
-$(MESA_DIR)/main/remap_helper.h: remap_helper.py $(COMMON)
- $(PYTHON2) $(PYTHON_FLAGS) $< > $@
-
-######################################################################
-
-$(MESA_GLX_DIR)/indirect.c: glX_proto_send.py $(COMMON_GLX)
- $(PYTHON2) $(PYTHON_FLAGS) $< -m proto | $(INDENT) $(INDENT_FLAGS) > $@
-
-$(MESA_GLX_DIR)/indirect.h: glX_proto_send.py $(COMMON_GLX)
- $(PYTHON2) $(PYTHON_FLAGS) $< -m init_h > $@
-
-$(MESA_GLX_DIR)/indirect_init.c: glX_proto_send.py $(COMMON_GLX)
- $(PYTHON2) $(PYTHON_FLAGS) $< -m init_c > $@
-
-$(MESA_GLX_DIR)/indirect_size.h $(XORG_GLX_DIR)/indirect_size.h: glX_proto_size.py $(COMMON_GLX)
- $(PYTHON2) $(PYTHON_FLAGS) $< -m size_h --only-set -h _INDIRECT_SIZE_H_ \
- | $(INDENT) $(INDENT_FLAGS) > $@
-
-$(MESA_GLX_DIR)/indirect_size.c: glX_proto_size.py $(COMMON_GLX)
- $(PYTHON2) $(PYTHON_FLAGS) $< -m size_c --only-set \
- | $(INDENT) $(INDENT_FLAGS) > $@
-
-######################################################################
-
-$(XORG_GLX_DIR)/indirect_dispatch.c: glX_proto_recv.py $(COMMON_GLX)
- $(PYTHON2) $(PYTHON_FLAGS) $< -m dispatch_c > $@
-
-$(XORG_GLX_DIR)/indirect_dispatch_swap.c: glX_proto_recv.py $(COMMON_GLX)
- $(PYTHON2) $(PYTHON_FLAGS) $< -m dispatch_c -s > $@
-
-$(XORG_GLX_DIR)/indirect_dispatch.h: glX_proto_recv.py gl_and_glX_API.xml $(COMMON_GLX)
- $(PYTHON2) $(PYTHON_FLAGS) $< -m dispatch_h -f gl_and_glX_API.xml -s > $@
-
-$(XORG_GLX_DIR)/indirect_size_get.h: glX_proto_size.py $(COMMON_GLX)
- $(PYTHON2) $(PYTHON_FLAGS) $< -m size_h --only-get -h '_INDIRECT_SIZE_GET_H_' \
- | $(INDENT) $(INDENT_FLAGS) > $@
-
-$(XORG_GLX_DIR)/indirect_size_get.c: glX_proto_size.py $(COMMON_GLX)
- $(PYTHON2) $(PYTHON_FLAGS) $< -m size_c | $(INDENT) $(INDENT_FLAGS) > $@
-
-$(XORG_GLX_DIR)/indirect_reqsize.h: glX_proto_size.py $(COMMON_GLX)
- $(PYTHON2) $(PYTHON_FLAGS) $< -m reqsize_h --only-get -h '_INDIRECT_SIZE_GET_H_' \
- | $(INDENT) $(INDENT_FLAGS) -l200 > $@
-
-$(XORG_GLX_DIR)/indirect_reqsize.c: glX_proto_size.py $(COMMON_GLX)
- $(PYTHON2) $(PYTHON_FLAGS) $< -m reqsize_c | $(INDENT) $(INDENT_FLAGS) > $@
-
-$(XORG_GLX_DIR)/indirect_table.c: glX_server_table.py gl_and_glX_API.xml $(COMMON_GLX)
- $(PYTHON2) $(PYTHON_FLAGS) $< -f gl_and_glX_API.xml > $@
+# This file isn't used during a normal compilation since we don't want to +# require Python in order to compile Mesa. +# Instead, when the Mesa developers update/change the API interface it's +# up to him/her to re-run this makefile and check in the newly generated files. + + +TOP = ../../../.. +include $(TOP)/configs/current + +MESA_DIR = $(TOP)/src/mesa +MESA_GLAPI_DIR = $(TOP)/src/mapi/glapi +MESA_MAPI_DIR = $(TOP)/src/mapi/mapi +MESA_GLX_DIR = $(TOP)/src/glx + +MESA_GLAPI_OUTPUTS = \ + $(MESA_GLAPI_DIR)/glapi_mapi_tmp.h \ + $(MESA_GLAPI_DIR)/glprocs.h \ + $(MESA_GLAPI_DIR)/glapitemp.h \ + $(MESA_GLAPI_DIR)/glapitable.h + +MESA_GLAPI_ASM_OUTPUTS = \ + $(MESA_GLAPI_DIR)/glapi_x86.S \ + $(MESA_GLAPI_DIR)/glapi_x86-64.S \ + $(MESA_GLAPI_DIR)/glapi_sparc.S + +MESA_OUTPUTS = \ + $(MESA_GLAPI_OUTPUTS) \ + $(MESA_GLAPI_ASM_OUTPUTS) \ + $(MESA_DIR)/main/enums.c \ + $(MESA_DIR)/main/glapidispatch.h \ + $(MESA_DIR)/main/remap_helper.h \ + $(MESA_GLX_DIR)/indirect.c \ + $(MESA_GLX_DIR)/indirect.h \ + $(MESA_GLX_DIR)/indirect_init.c \ + $(MESA_GLX_DIR)/indirect_size.h \ + $(MESA_GLX_DIR)/indirect_size.c + +###################################################################### + +XORG_GLX_DIR = $(XORG_BASE)/glx +XORG_GLAPI_DIR = $(XORG_BASE)/glx + +XORG_GLAPI_FILES = \ + $(XORG_GLAPI_DIR)/glapi.h \ + $(XORG_GLAPI_DIR)/glapi.c \ + $(XORG_GLAPI_DIR)/glapi_getproc.c \ + $(XORG_GLAPI_DIR)/glapi_nop.c \ + $(XORG_GLAPI_DIR)/glthread.c \ + $(XORG_GLAPI_DIR)/glthread.h + +XORG_GLAPI_OUTPUTS = \ + $(XORG_GLAPI_DIR)/glprocs.h \ + $(XORG_GLAPI_DIR)/glapitemp.h \ + $(XORG_GLAPI_DIR)/glapioffsets.h \ + $(XORG_GLAPI_DIR)/glapitable.h \ + $(XORG_GLAPI_DIR)/glapidispatch.h + +XORG_OUTPUTS = \ + $(XORG_GLAPI_FILES) \ + $(XORG_GLAPI_OUTPUTS) \ + $(XORG_GLX_DIR)/indirect_dispatch.c \ + $(XORG_GLX_DIR)/indirect_dispatch_swap.c \ + $(XORG_GLX_DIR)/indirect_dispatch.h \ + $(XORG_GLX_DIR)/indirect_reqsize.c \ + $(XORG_GLX_DIR)/indirect_reqsize.h \ + $(XORG_GLX_DIR)/indirect_size.h \ + $(XORG_GLX_DIR)/indirect_size_get.c \ + $(XORG_GLX_DIR)/indirect_size_get.h \ + $(XORG_GLX_DIR)/indirect_table.c + +###################################################################### + +API_XML = \ + gl_API.xml \ + ARB_copy_buffer.xml \ + ARB_depth_clamp.xml \ + ARB_draw_buffers_blend.xml \ + ARB_draw_elements_base_vertex.xml \ + ARB_draw_instanced.xml \ + ARB_ES2_compatibility.xml \ + ARB_framebuffer_object.xml \ + ARB_geometry_shader4.xml \ + ARB_instanced_arrays.xml \ + ARB_map_buffer_range.xml \ + ARB_seamless_cube_map.xml \ + ARB_sync.xml \ + ARB_vertex_array_object.xml \ + APPLE_object_purgeable.xml \ + APPLE_vertex_array_object.xml \ + EXT_draw_buffers2.xml \ + EXT_framebuffer_object.xml \ + EXT_gpu_shader4.xml \ + EXT_packed_depth_stencil.xml \ + EXT_provoking_vertex.xml \ + EXT_separate_shader_objects.xml \ + EXT_texture_array.xml \ + EXT_texture_integer.xml \ + EXT_transform_feedback.xml \ + NV_conditional_render.xml \ + NV_primitive_restart.xml \ + OES_EGL_image.xml \ + GL3x.xml + + +COMMON = $(API_XML) gl_XML.py glX_XML.py license.py typeexpr.py + +COMMON_ES = \ + $(COMMON) \ + gl_and_es_API.xml \ + es_EXT.xml \ + ARB_ES2_compatibility.xml \ + ARB_get_program_binary.xml \ + OES_fixed_point.xml \ + OES_single_precision.xml + +COMMON_GLX = $(COMMON) glX_API.xml glX_XML.py glX_proto_common.py + +###################################################################### + +all: mesa xorg + +mesa: $(MESA_OUTPUTS) + +xorg: check-xorg-source $(XORG_OUTPUTS) + +check-xorg-source: + @if ! test -d $(XORG_GLX_DIR); then \ + echo "ERROR: Must specify path to xserver/GL/ checkout; set XORG_BASE env var."; \ + exit 1; \ + fi + +clean: + -rm -f *~ *.pyo + -rm -f $(MESA_OUTPUTS) + +###################################################################### + +$(XORG_GLAPI_DIR)/%.c: $(MESA_GLAPI_DIR)/%.c + cp $< $@ + +$(XORG_GLAPI_DIR)/%.h: $(MESA_GLAPI_DIR)/%.h + cp $< $@ + +###################################################################### + +$(MESA_GLAPI_DIR)/glapi_mapi_tmp.h: $(MESA_MAPI_DIR)/mapi_abi.py $(COMMON_ES) + $(PYTHON2) $(PYTHON_FLAGS) $< \ + --printer glapi --mode lib gl_and_es_API.xml > $@ + +$(MESA_GLAPI_DIR)/glprocs.h: gl_procs.py $(COMMON) + $(PYTHON2) $(PYTHON_FLAGS) $< > $@ + +$(MESA_GLAPI_DIR)/glapitemp.h: gl_apitemp.py $(COMMON) + $(PYTHON2) $(PYTHON_FLAGS) $< > $@ + +$(MESA_GLAPI_DIR)/glapitable.h: gl_table.py $(COMMON) + $(PYTHON2) $(PYTHON_FLAGS) $< > $@ + +###################################################################### + +$(MESA_GLAPI_DIR)/glapi_x86.S: gl_x86_asm.py $(COMMON) + $(PYTHON2) $(PYTHON_FLAGS) $< > $@ + +$(MESA_GLAPI_DIR)/glapi_x86-64.S: gl_x86-64_asm.py $(COMMON) + $(PYTHON2) $(PYTHON_FLAGS) $< > $@ + +$(MESA_GLAPI_DIR)/glapi_sparc.S: gl_SPARC_asm.py $(COMMON) + $(PYTHON2) $(PYTHON_FLAGS) $< > $@ + +###################################################################### + +$(MESA_DIR)/main/enums.c: gl_enums.py $(COMMON) $(ES_API) + $(PYTHON2) $(PYTHON_FLAGS) $< -f gl_API.xml \ + -f $(MESA_GLAPI_DIR)/gen-es/es1_API.xml \ + -f $(MESA_GLAPI_DIR)/gen-es/es2_API.xml > $@ + +$(MESA_DIR)/main/glapidispatch.h: gl_table.py $(COMMON) + $(PYTHON2) $(PYTHON_FLAGS) $< -m remap_table > $@ + +$(MESA_DIR)/main/remap_helper.h: remap_helper.py $(COMMON) + $(PYTHON2) $(PYTHON_FLAGS) $< > $@ + +###################################################################### + +$(MESA_GLX_DIR)/indirect.c: glX_proto_send.py $(COMMON_GLX) + $(PYTHON2) $(PYTHON_FLAGS) $< -m proto | $(INDENT) $(INDENT_FLAGS) > $@ + +$(MESA_GLX_DIR)/indirect.h: glX_proto_send.py $(COMMON_GLX) + $(PYTHON2) $(PYTHON_FLAGS) $< -m init_h > $@ + +$(MESA_GLX_DIR)/indirect_init.c: glX_proto_send.py $(COMMON_GLX) + $(PYTHON2) $(PYTHON_FLAGS) $< -m init_c > $@ + +$(MESA_GLX_DIR)/indirect_size.h $(XORG_GLX_DIR)/indirect_size.h: glX_proto_size.py $(COMMON_GLX) + $(PYTHON2) $(PYTHON_FLAGS) $< -m size_h --only-set -h _INDIRECT_SIZE_H_ \ + | $(INDENT) $(INDENT_FLAGS) > $@ + +$(MESA_GLX_DIR)/indirect_size.c: glX_proto_size.py $(COMMON_GLX) + $(PYTHON2) $(PYTHON_FLAGS) $< -m size_c --only-set \ + | $(INDENT) $(INDENT_FLAGS) > $@ + +###################################################################### + +$(XORG_GLX_DIR)/indirect_dispatch.c: glX_proto_recv.py $(COMMON_GLX) + $(PYTHON2) $(PYTHON_FLAGS) $< -m dispatch_c > $@ + +$(XORG_GLX_DIR)/indirect_dispatch_swap.c: glX_proto_recv.py $(COMMON_GLX) + $(PYTHON2) $(PYTHON_FLAGS) $< -m dispatch_c -s > $@ + +$(XORG_GLX_DIR)/indirect_dispatch.h: glX_proto_recv.py gl_and_glX_API.xml $(COMMON_GLX) + $(PYTHON2) $(PYTHON_FLAGS) $< -m dispatch_h -f gl_and_glX_API.xml -s > $@ + +$(XORG_GLX_DIR)/indirect_size_get.h: glX_proto_size.py $(COMMON_GLX) + $(PYTHON2) $(PYTHON_FLAGS) $< -m size_h --only-get -h '_INDIRECT_SIZE_GET_H_' \ + | $(INDENT) $(INDENT_FLAGS) > $@ + +$(XORG_GLX_DIR)/indirect_size_get.c: glX_proto_size.py $(COMMON_GLX) + $(PYTHON2) $(PYTHON_FLAGS) $< -m size_c | $(INDENT) $(INDENT_FLAGS) > $@ + +$(XORG_GLX_DIR)/indirect_reqsize.h: glX_proto_size.py $(COMMON_GLX) + $(PYTHON2) $(PYTHON_FLAGS) $< -m reqsize_h --only-get -h '_INDIRECT_SIZE_GET_H_' \ + | $(INDENT) $(INDENT_FLAGS) -l200 > $@ + +$(XORG_GLX_DIR)/indirect_reqsize.c: glX_proto_size.py $(COMMON_GLX) + $(PYTHON2) $(PYTHON_FLAGS) $< -m reqsize_c | $(INDENT) $(INDENT_FLAGS) > $@ + +$(XORG_GLX_DIR)/indirect_table.c: glX_server_table.py gl_and_glX_API.xml $(COMMON_GLX) + $(PYTHON2) $(PYTHON_FLAGS) $< -f gl_and_glX_API.xml > $@ diff --git a/mesalib/src/mapi/glapi/gen/OES_fixed_point.xml b/mesalib/src/mapi/glapi/gen/OES_fixed_point.xml new file mode 100644 index 000000000..ee408f4f1 --- /dev/null +++ b/mesalib/src/mapi/glapi/gen/OES_fixed_point.xml @@ -0,0 +1,259 @@ +<?xml version="1.0"?> +<!DOCTYPE OpenGLAPI SYSTEM "gl_API.dtd"> + +<!-- This is included by gl_and_es_API.xml. Could be moved to gl_API.xml. --> +<!-- this extension is incomplete --> + +<OpenGLAPI> + +<category name="GL_OES_fixed_point" number="292"> + <enum name="FIXED_OES" value="0x140C"/> + + <type name="fixed" size="4" /> + <type name="clampx" size="4" /> + + <!-- OpenGL ES 1.0 --> + <function name="AlphaFuncxOES" offset="assign" static_dispatch="false"> + <param name="func" type="GLenum"/> + <param name="ref" type="GLclampx"/> + </function> + + <function name="ClearColorxOES" offset="assign" static_dispatch="false"> + <param name="red" type="GLclampx"/> + <param name="green" type="GLclampx"/> + <param name="blue" type="GLclampx"/> + <param name="alpha" type="GLclampx"/> + </function> + + <function name="ClearDepthxOES" offset="assign" static_dispatch="false"> + <param name="depth" type="GLclampx"/> + </function> + + <function name="Color4xOES" offset="assign" static_dispatch="false"> + <param name="red" type="GLfixed"/> + <param name="green" type="GLfixed"/> + <param name="blue" type="GLfixed"/> + <param name="alpha" type="GLfixed"/> + </function> + + <function name="DepthRangexOES" offset="assign" static_dispatch="false"> + <param name="zNear" type="GLclampx"/> + <param name="zFar" type="GLclampx"/> + </function> + + <function name="FogxOES" offset="assign" static_dispatch="false"> + <param name="pname" type="GLenum"/> + <param name="param" type="GLfixed"/> + </function> + + <function name="FogxvOES" offset="assign" static_dispatch="false"> + <param name="pname" type="GLenum"/> + <param name="params" type="const GLfixed *" variable_param="pname"/> + </function> + + <function name="FrustumxOES" offset="assign" static_dispatch="false"> + <param name="left" type="GLfixed"/> + <param name="right" type="GLfixed"/> + <param name="bottom" type="GLfixed"/> + <param name="top" type="GLfixed"/> + <param name="zNear" type="GLfixed"/> + <param name="zFar" type="GLfixed"/> + </function> + + <function name="LightModelxOES" offset="assign" static_dispatch="false"> + <param name="pname" type="GLenum"/> + <param name="param" type="GLfixed"/> + </function> + + <function name="LightModelxvOES" offset="assign" static_dispatch="false"> + <param name="pname" type="GLenum"/> + <param name="params" type="const GLfixed *" variable_param="pname"/> + </function> + + <function name="LightxOES" offset="assign" static_dispatch="false"> + <param name="light" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="param" type="GLfixed"/> + </function> + + <function name="LightxvOES" offset="assign" static_dispatch="false"> + <param name="light" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="const GLfixed *" variable_param="pname"/> + </function> + + <function name="LineWidthxOES" offset="assign" static_dispatch="false"> + <param name="width" type="GLfixed"/> + </function> + + <function name="LoadMatrixxOES" offset="assign" static_dispatch="false"> + <param name="m" type="const GLfixed *" count="16"/> + </function> + + <function name="MaterialxOES" offset="assign" static_dispatch="false"> + <param name="face" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="param" type="GLfixed"/> + </function> + + <function name="MaterialxvOES" offset="assign" static_dispatch="false"> + <param name="face" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="const GLfixed *" variable_param="pname"/> + </function> + + <function name="MultMatrixxOES" offset="assign" static_dispatch="false"> + <param name="m" type="const GLfixed *" count="16"/> + </function> + + <function name="MultiTexCoord4xOES" offset="assign" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="s" type="GLfixed"/> + <param name="t" type="GLfixed"/> + <param name="r" type="GLfixed"/> + <param name="q" type="GLfixed"/> + </function> + + <function name="Normal3xOES" offset="assign" static_dispatch="false"> + <param name="nx" type="GLfixed"/> + <param name="ny" type="GLfixed"/> + <param name="nz" type="GLfixed"/> + </function> + + <function name="OrthoxOES" offset="assign" static_dispatch="false"> + <param name="left" type="GLfixed"/> + <param name="right" type="GLfixed"/> + <param name="bottom" type="GLfixed"/> + <param name="top" type="GLfixed"/> + <param name="zNear" type="GLfixed"/> + <param name="zFar" type="GLfixed"/> + </function> + + <function name="PointSizexOES" offset="assign" static_dispatch="false"> + <param name="size" type="GLfixed"/> + </function> + + <function name="PolygonOffsetxOES" offset="assign" static_dispatch="false"> + <param name="factor" type="GLfixed"/> + <param name="units" type="GLfixed"/> + </function> + + <function name="RotatexOES" offset="assign" static_dispatch="false"> + <param name="angle" type="GLfixed"/> + <param name="x" type="GLfixed"/> + <param name="y" type="GLfixed"/> + <param name="z" type="GLfixed"/> + </function> + + <function name="SampleCoveragexOES" offset="assign" static_dispatch="false"> + <param name="value" type="GLclampx"/> + <param name="invert" type="GLboolean"/> + </function> + + <function name="ScalexOES" offset="assign" static_dispatch="false"> + <param name="x" type="GLfixed"/> + <param name="y" type="GLfixed"/> + <param name="z" type="GLfixed"/> + </function> + + <function name="TexEnvxOES" offset="assign" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="param" type="GLfixed"/> + </function> + + <function name="TexEnvxvOES" offset="assign" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="const GLfixed *" variable_param="pname"/> + </function> + + <function name="TexParameterxOES" offset="assign" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="param" type="GLfixed"/> + </function> + + <function name="TranslatexOES" offset="assign" static_dispatch="false"> + <param name="x" type="GLfixed"/> + <param name="y" type="GLfixed"/> + <param name="z" type="GLfixed"/> + </function> + + <!-- OpenGL ES 1.1 --> + <function name="ClipPlanexOES" offset="assign" static_dispatch="false"> + <param name="plane" type="GLenum"/> + <param name="equation" type="const GLfixed *" count="4"/> + </function> + + <function name="GetClipPlanexOES" offset="assign" static_dispatch="false"> + <param name="plane" type="GLenum"/> + <param name="equation" type="GLfixed *" output="true" count="4"/> + </function> + + <function name="GetFixedvOES" offset="assign" static_dispatch="false"> + <param name="pname" type="GLenum"/> + <param name="params" type="GLfixed *" output="true" variable_param="pname"/> + </function> + + <function name="GetLightxvOES" offset="assign" static_dispatch="false"> + <param name="light" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="GLfixed *" output="true" variable_param="pname"/> + </function> + + <function name="GetMaterialxvOES" offset="assign" static_dispatch="false"> + <param name="face" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="GLfixed *" output="true" variable_param="pname"/> + </function> + + <function name="GetTexEnvxvOES" offset="assign" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="GLfixed *" output="true" variable_param="pname"/> + </function> + + <function name="GetTexParameterxvOES" offset="assign" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="GLfixed *" output="true" variable_param="pname"/> + </function> + + <function name="PointParameterxOES" offset="assign" static_dispatch="false"> + <param name="pname" type="GLenum"/> + <param name="param" type="GLfixed"/> + </function> + + <function name="PointParameterxvOES" offset="assign" static_dispatch="false"> + <param name="pname" type="GLenum"/> + <param name="params" type="const GLfixed *"/> + </function> + + <function name="TexParameterxvOES" offset="assign" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="const GLfixed *" variable_param="pname"/> + </function> + + <!-- texgen --> + <function name="GetTexGenxvOES" offset="assign" static_dispatch="false"> + <param name="coord" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="GLfixed *" output="true" variable_param="pname"/> + </function> + + <function name="TexGenxOES" offset="assign" static_dispatch="false"> + <param name="coord" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="param" type="GLint"/> + </function> + + <function name="TexGenxvOES" offset="assign" static_dispatch="false"> + <param name="coord" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="const GLfixed *" variable_param="pname"/> + </function> +</category> + +</OpenGLAPI> diff --git a/mesalib/src/mapi/glapi/gen/OES_single_precision.xml b/mesalib/src/mapi/glapi/gen/OES_single_precision.xml new file mode 100644 index 000000000..df8efc8f8 --- /dev/null +++ b/mesalib/src/mapi/glapi/gen/OES_single_precision.xml @@ -0,0 +1,47 @@ +<?xml version="1.0"?> +<!DOCTYPE OpenGLAPI SYSTEM "gl_API.dtd"> + +<!-- This is included by gl_and_es_API.xml. Could be moved to gl_API.xml. --> + +<OpenGLAPI> + +<category name="GL_OES_single_precision" number="293"> + <function name="ClearDepthfOES" alias="ClearDepthf" static_dispatch="false"> + <param name="depth" type="GLclampf"/> + </function> + + <function name="ClipPlanefOES" offset="assign" static_dispatch="false"> + <param name="plane" type="GLenum"/> + <param name="equation" type="const GLfloat *" count="4"/> + </function> + + <function name="DepthRangefOES" alias="DepthRangef" static_dispatch="false"> + <param name="zNear" type="GLclampf"/> + <param name="zFar" type="GLclampf"/> + </function> + + <function name="GetClipPlanefOES" offset="assign" static_dispatch="false"> + <param name="plane" type="GLenum"/> + <param name="equation" type="GLfloat *" output="true" count="4"/> + </function> + + <function name="FrustumfOES" offset="assign" static_dispatch="false"> + <param name="left" type="GLfloat"/> + <param name="right" type="GLfloat"/> + <param name="bottom" type="GLfloat"/> + <param name="top" type="GLfloat"/> + <param name="zNear" type="GLfloat"/> + <param name="zFar" type="GLfloat"/> + </function> + + <function name="OrthofOES" offset="assign" static_dispatch="false"> + <param name="left" type="GLfloat"/> + <param name="right" type="GLfloat"/> + <param name="bottom" type="GLfloat"/> + <param name="top" type="GLfloat"/> + <param name="zNear" type="GLfloat"/> + <param name="zFar" type="GLfloat"/> + </function> +</category> + +</OpenGLAPI> diff --git a/mesalib/src/mapi/glapi/gen/es_EXT.xml b/mesalib/src/mapi/glapi/gen/es_EXT.xml new file mode 100644 index 000000000..1327bb602 --- /dev/null +++ b/mesalib/src/mapi/glapi/gen/es_EXT.xml @@ -0,0 +1,618 @@ +<?xml version="1.0"?> +<!DOCTYPE OpenGLAPI SYSTEM "../gen/gl_API.dtd"> + +<!-- OpenGL ES specific extensions --> + +<OpenGLAPI> + +<!-- part of es1.1 extension pack --> +<category name="GL_OES_blend_equation_separate" number="1"> + <enum name="BLEND_EQUATION_RGB_OES" value="0x8009"/> + <enum name="BLEND_EQUATION_ALPHA_OES" value="0x883D"/> + + <function name="BlendEquationSeparateOES" alias="BlendEquationSeparateEXT" static_dispatch="false"> + <param name="modeRGB" type="GLenum"/> + <param name="modeA" type="GLenum"/> + </function> +</category> + +<!-- part of es1.1 extension pack --> +<category name="GL_OES_blend_func_separate" number="2"> + <enum name="BLEND_DST_RGB_OES" value="0x80C8"/> + <enum name="BLEND_SRC_RGB_OES" value="0x80C9"/> + <enum name="BLEND_DST_ALPHA_OES" value="0x80CA"/> + <enum name="BLEND_SRC_ALPHA_OES" value="0x80CB"/> + + <function name="BlendFuncSeparateOES" alias="BlendFuncSeparateEXT" static_dispatch="false"> + <param name="sfactorRGB" type="GLenum"/> + <param name="dfactorRGB" type="GLenum"/> + <param name="sfactorAlpha" type="GLenum"/> + <param name="dfactorAlpha" type="GLenum"/> + </function> +</category> + +<!-- part of es1.1 extension pack --> +<category name="GL_OES_blend_subtract" number="3"> + <enum name="FUNC_ADD_OES" value="0x8006"/> + <enum name="BLEND_EQUATION_OES" value="0x8009"/> + <enum name="FUNC_SUBTRACT_OES" value="0x800A"/> + <enum name="FUNC_REVERSE_SUBTRACT_OES" value="0x800B"/> + + <function name="BlendEquationOES" alias="BlendEquation" static_dispatch="false"> + <param name="mode" type="GLenum"/> + </function> +</category> + +<!-- core addition to es1.0 and later --> +<category name="GL_OES_byte_coordinates" number="4"> + <enum name="BYTE" value="0x1400"/> +</category> + +<category name="GL_OES_compressed_paletted_texture" number="6"> + <enum name="PALETTE4_RGB8_OES" value="0x8B90"/> + <enum name="PALETTE4_RGBA8_OES" value="0x8B91"/> + <enum name="PALETTE4_R5_G6_B5_OES" value="0x8B92"/> + <enum name="PALETTE4_RGBA4_OES" value="0x8B93"/> + <enum name="PALETTE4_RGB5_A1_OES" value="0x8B94"/> + <enum name="PALETTE8_RGB8_OES" value="0x8B95"/> + <enum name="PALETTE8_RGBA8_OES" value="0x8B96"/> + <enum name="PALETTE8_R5_G6_B5_OES" value="0x8B97"/> + <enum name="PALETTE8_RGBA4_OES" value="0x8B98"/> + <enum name="PALETTE8_RGB5_A1_OES" value="0x8B99"/> +</category> + +<!-- optional for es1.1 --> +<category name="GL_OES_draw_texture" number="7"> + <enum name="TEXTURE_CROP_RECT_OES" value="0x8B9D"/> + + <function name="DrawTexiOES" offset="assign" static_dispatch="false"> + <param name="x" type="GLint"/> + <param name="y" type="GLint"/> + <param name="z" type="GLint"/> + <param name="width" type="GLint"/> + <param name="height" type="GLint"/> + </function> + + <function name="DrawTexivOES" offset="assign" static_dispatch="false"> + <param name="coords" type="const GLint *" count="5"/> + </function> + + <function name="DrawTexfOES" offset="assign" static_dispatch="false"> + <param name="x" type="GLfloat"/> + <param name="y" type="GLfloat"/> + <param name="z" type="GLfloat"/> + <param name="width" type="GLfloat"/> + <param name="height" type="GLfloat"/> + </function> + + <function name="DrawTexfvOES" offset="assign" static_dispatch="false"> + <param name="coords" type="const GLfloat *" count="5"/> + </function> + + <function name="DrawTexsOES" offset="assign" static_dispatch="false"> + <param name="x" type="GLshort"/> + <param name="y" type="GLshort"/> + <param name="z" type="GLshort"/> + <param name="width" type="GLshort"/> + <param name="height" type="GLshort"/> + </function> + + <function name="DrawTexsvOES" offset="assign" static_dispatch="false"> + <param name="coords" type="const GLshort *" count="5"/> + </function> + + <function name="DrawTexxOES" offset="assign" static_dispatch="false"> + <param name="x" type="GLfixed"/> + <param name="y" type="GLfixed"/> + <param name="z" type="GLfixed"/> + <param name="width" type="GLfixed"/> + <param name="height" type="GLfixed"/> + </function> + + <function name="DrawTexxvOES" offset="assign" static_dispatch="false"> + <param name="coords" type="const GLfixed *" count="5"/> + </function> + + <!-- TexParameter{ifx}v is skipped here --> +</category> + +<!-- core addition to es1.0 and later --> +<!-- 9. GL_OES_fixed_point --> + +<!-- part of es1.1 extension pack --> +<category name="GL_OES_framebuffer_object" number="10"> + <enum name="NONE_OES" value="0"/> + <enum name="INVALID_FRAMEBUFFER_OPERATION_OES" value="0x0506"/> + <enum name="RGBA4_OES" value="0x8056"/> + <enum name="RGB5_A1_OES" value="0x8057"/> + <enum name="DEPTH_COMPONENT16_OES" value="0x81A5"/> + + <enum name="MAX_RENDERBUFFER_SIZE_OES" value="0x84E8"/> + <enum name="FRAMEBUFFER_BINDING_OES" value="0x8CA6"/> + <enum name="RENDERBUFFER_BINDING_OES" value="0x8CA7"/> + <enum name="FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_OES" value="0x8CD0"/> + <enum name="FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_OES" value="0x8CD1"/> + <enum name="FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_OES" value="0x8CD2"/> + <enum name="FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_OES" value="0x8CD3"/> + <enum name="FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_OES" value="0x8CD4"/> + <enum name="FRAMEBUFFER_COMPLETE_OES" value="0x8CD5"/> + <enum name="FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES" value="0x8CD6"/> + <enum name="FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_OES" value="0x8CD7"/> + <enum name="FRAMEBUFFER_INCOMPLETE_DIMENSIONS_OES" value="0x8CD9"/> + <enum name="FRAMEBUFFER_INCOMPLETE_FORMATS_OES" value="0x8CDA"/> + <enum name="FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_OES" value="0x8CDB"/> + <enum name="FRAMEBUFFER_INCOMPLETE_READ_BUFFER_OES" value="0x8CDC"/> + <enum name="FRAMEBUFFER_UNSUPPORTED_OES" value="0x8CDD"/> + <enum name="COLOR_ATTACHMENT0_OES" value="0x8CE0"/> + <enum name="DEPTH_ATTACHMENT_OES" value="0x8D00"/> + <enum name="STENCIL_ATTACHMENT_OES" value="0x8D20"/> + <enum name="FRAMEBUFFER_OES" value="0x8D40"/> + <enum name="RENDERBUFFER_OES" value="0x8D41"/> + <enum name="RENDERBUFFER_WIDTH_OES" value="0x8D42"/> + <enum name="RENDERBUFFER_HEIGHT_OES" value="0x8D43"/> + <enum name="RENDERBUFFER_INTERNAL_FORMAT_OES" value="0x8D44"/> + <enum name="STENCIL_INDEX1_OES" value="0x8D46"/> + <enum name="STENCIL_INDEX4_OES" value="0x8D47"/> + <enum name="STENCIL_INDEX8_OES" value="0x8D48"/> + <enum name="RENDERBUFFER_RED_SIZE_OES" value="0x8D50"/> + <enum name="RENDERBUFFER_GREEN_SIZE_OES" value="0x8D51"/> + <enum name="RENDERBUFFER_BLUE_SIZE_OES" value="0x8D52"/> + <enum name="RENDERBUFFER_ALPHA_SIZE_OES" value="0x8D53"/> + <enum name="RENDERBUFFER_DEPTH_SIZE_OES" value="0x8D54"/> + <enum name="RENDERBUFFER_STENCIL_SIZE_OES" value="0x8D55"/> + <enum name="RGB565_OES" value="0x8D62"/> + + <function name="BindFramebufferOES" alias="BindFramebufferEXT" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="framebuffer" type="GLuint"/> + </function> + + <function name="BindRenderbufferOES" alias="BindRenderbufferEXT" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="renderbuffer" type="GLuint"/> + </function> + + <function name="CheckFramebufferStatusOES" alias="CheckFramebufferStatusEXT" static_dispatch="false"> + <param name="target" type="GLenum"/> + <return type="GLenum"/> + </function> + + <function name="DeleteFramebuffersOES" alias="DeleteFramebuffersEXT" static_dispatch="false"> + <param name="n" type="GLsizei" counter="true"/> + <param name="framebuffers" type="const GLuint *" count="n"/> + </function> + + <function name="DeleteRenderbuffersOES" alias="DeleteRenderbuffersEXT" static_dispatch="false"> + <param name="n" type="GLsizei" counter="true"/> + <param name="renderbuffers" type="const GLuint *" count="n"/> + </function> + + <function name="FramebufferRenderbufferOES" alias="FramebufferRenderbufferEXT" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="attachment" type="GLenum"/> + <param name="renderbuffertarget" type="GLenum"/> + <param name="renderbuffer" type="GLuint"/> + </function> + + <function name="FramebufferTexture2DOES" alias="FramebufferTexture2DEXT" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="attachment" type="GLenum"/> + <param name="textarget" type="GLenum"/> + <param name="texture" type="GLuint"/> + <param name="level" type="GLint"/> + </function> + + <function name="GenerateMipmapOES" alias="GenerateMipmapEXT" static_dispatch="false"> + <param name="target" type="GLenum"/> + </function> + + <function name="GenFramebuffersOES" alias="GenFramebuffersEXT" static_dispatch="false"> + <param name="n" type="GLsizei" counter="true"/> + <param name="framebuffers" type="GLuint *" count="n" output="true"/> + </function> + + <function name="GenRenderbuffersOES" alias="GenRenderbuffersEXT" static_dispatch="false"> + <param name="n" type="GLsizei" counter="true"/> + <param name="renderbuffers" type="GLuint *" count="n" output="true"/> + </function> + + <function name="GetFramebufferAttachmentParameterivOES" alias="GetFramebufferAttachmentParameterivEXT" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="attachment" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="GLint *" output="true"/> + </function> + + <function name="GetRenderbufferParameterivOES" alias="GetRenderbufferParameterivEXT" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="GLint *" output="true"/> + </function> + + <function name="IsFramebufferOES" alias="IsFramebufferEXT" static_dispatch="false"> + <param name="framebuffer" type="GLuint"/> + <return type="GLboolean"/> + </function> + + <function name="IsRenderbufferOES" alias="IsRenderbufferEXT" static_dispatch="false"> + <param name="renderbuffer" type="GLuint"/> + <return type="GLboolean"/> + </function> + + <function name="RenderbufferStorageOES" alias="RenderbufferStorageEXT" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="internalformat" type="GLenum"/> + <param name="width" type="GLsizei"/> + <param name="height" type="GLsizei"/> + </function> +</category> + +<!-- core addition to es1.1 --> +<category name="GL_OES_matrix_get" number="11"> + <enum name="MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES" value="0x898D"/> + <enum name="PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES" value="0x898E"/> + <enum name="TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES" value="0x898F"/> +</category> + +<!-- optional for es1.1 --> +<category name="GL_OES_matrix_palette" number="12"> + <enum name="MAX_VERTEX_UNITS_OES" value="0x86A4"/> + <enum name="WEIGHT_ARRAY_TYPE_OES" value="0x86A9"/> + <enum name="WEIGHT_ARRAY_STRIDE_OES" value="0x86AA"/> + <enum name="WEIGHT_ARRAY_SIZE_OES" value="0x86AB"/> + <enum name="WEIGHT_ARRAY_POINTER_OES" value="0x86AC"/> + <enum name="WEIGHT_ARRAY_OES" value="0x86AD"/> + <enum name="MATRIX_PALETTE_OES" value="0x8840"/> + <enum name="MAX_PALETTE_MATRICES_OES" value="0x8842"/> + <enum name="CURRENT_PALETTE_MATRIX_OES" value="0x8843"/> + <enum name="MATRIX_INDEX_ARRAY_OES" value="0x8844"/> + <enum name="MATRIX_INDEX_ARRAY_SIZE_OES" value="0x8846"/> + <enum name="MATRIX_INDEX_ARRAY_TYPE_OES" value="0x8847"/> + <enum name="MATRIX_INDEX_ARRAY_STRIDE_OES" value="0x8848"/> + <enum name="MATRIX_INDEX_ARRAY_POINTER_OES" value="0x8849"/> + <enum name="WEIGHT_ARRAY_BUFFER_BINDING_OES" value="0x889E"/> + <enum name="MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES" value="0x8B9E"/> + + <function name="CurrentPaletteMatrixOES" alias="CurrentPaletteMatrixARB" static_dispatch="false"> + <param name="matrixpaletteindex" type="GLuint"/> + </function> + + <!-- no offset --> + <function name="LoadPaletteFromModelViewMatrixOES" static_dispatch="false"> + </function> + + <function name="MatrixIndexPointerOES" alias="MatrixIndexPointerARB" static_dispatch="false"> + <param name="size" type="GLint"/> + <param name="type" type="GLenum"/> + <param name="stride" type="GLsizei"/> + <param name="pointer" type="const GLvoid *"/> + </function> + + <function name="WeightPointerOES" alias="WeightPointerARB" static_dispatch="false"> + <param name="size" type="GLint"/> + <param name="type" type="GLenum"/> + <param name="stride" type="GLsizei"/> + <param name="pointer" type="const GLvoid *"/> + </function> +</category> + +<!-- required for es1.1 --> +<category name="GL_OES_point_size_array" number="14"> + <enum name="POINT_SIZE_ARRAY_TYPE_OES" value="0x898A"/> + <enum name="POINT_SIZE_ARRAY_STRIDE_OES" value="0x898B"/> + <enum name="POINT_SIZE_ARRAY_POINTER_OES" value="0x898C"/> + <enum name="POINT_SIZE_ARRAY_OES" value="0x8B9C"/> + <enum name="POINT_SIZE_ARRAY_BUFFER_BINDING_OES" value="0x8B9F"/> + + <function name="PointSizePointerOES" offset="assign" static_dispatch="false"> + <param name="type" type="GLenum"/> + <param name="stride" type="GLsizei"/> + <param name="pointer" type="const GLvoid *"/> + </function> +</category> + +<!-- required for es1.1 --> +<category name="GL_OES_point_sprite" number="15"> + <enum name="POINT_SPRITE_OES" value="0x8861"/> + <enum name="COORD_REPLACE_OES" value="0x8862"/> +</category> + +<!-- optional for es1.0 --> +<category name="GL_OES_query_matrix" number="16"> + <function name="QueryMatrixxOES" offset="assign" static_dispatch="false"> + <param name="mantissa" type="GLfixed *" count="16" /> + <param name="exponent" type="GLint *" count="16" /> + <return type="GLbitfield"/> + </function> +</category> + +<!-- required for es1.0 and later --> +<!-- 17. GL_OES_read_format --> + +<!-- core addition to es1.0 and later --> +<!-- 18. GL_OES_single_precision --> + +<!-- part of es1.1 extension pack --> +<category name="GL_OES_texture_cube_map" number="20"> + <enum name="TEXTURE_GEN_MODE_OES" value="0x2500"/> + <enum name="NORMAL_MAP_OES" value="0x8511"/> + <enum name="REFLECTION_MAP_OES" value="0x8512"/> + <enum name="TEXTURE_CUBE_MAP_OES" value="0x8513"/> + <enum name="TEXTURE_BINDING_CUBE_MAP_OES" value="0x8514"/> + <enum name="TEXTURE_CUBE_MAP_POSITIVE_X_OES" value="0x8515"/> + <enum name="TEXTURE_CUBE_MAP_NEGATIVE_X_OES" value="0x8516"/> + <enum name="TEXTURE_CUBE_MAP_POSITIVE_Y_OES" value="0x8517"/> + <enum name="TEXTURE_CUBE_MAP_NEGATIVE_Y_OES" value="0x8518"/> + <enum name="TEXTURE_CUBE_MAP_POSITIVE_Z_OES" value="0x8519"/> + <enum name="TEXTURE_CUBE_MAP_NEGATIVE_Z_OES" value="0x851A"/> + <enum name="MAX_CUBE_MAP_TEXTURE_SIZE_OES" value="0x851C"/> + <enum name="TEXTURE_GEN_STR_OES" value="0x8D60"/> + + <function name="GetTexGenfvOES" alias="GetTexGenfv" static_dispatch="false"> + <param name="coord" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="GLfloat *" output="true" variable_param="pname"/> + </function> + + <function name="GetTexGenivOES" alias="GetTexGeniv" static_dispatch="false"> + <param name="coord" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="GLint *" output="true" variable_param="pname"/> + </function> + + <function name="TexGenfOES" alias="TexGenf" static_dispatch="false"> + <param name="coord" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="param" type="GLfloat"/> + </function> + + <function name="TexGenfvOES" alias="TexGenfv" static_dispatch="false"> + <param name="coord" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="const GLfloat *" variable_param="pname"/> + </function> + + <function name="TexGeniOES" alias="TexGeni" static_dispatch="false"> + <param name="coord" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="param" type="GLint"/> + </function> + + <function name="TexGenivOES" alias="TexGeniv" static_dispatch="false"> + <param name="coord" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="const GLint *" variable_param="pname"/> + </function> +</category> + +<category name="GL_OES_texture_env_crossbar" number="21"> + <!-- No new functions, types, enums. --> +</category> + +<category name="GL_OES_texture_mirrored_repeat" number="22"> + <!-- No new functions, types, enums. --> +</category> + +<!-- 23. GL_OES_EGL_image --> + +<category name="GL_OES_depth24" number="24"> + <enum name="DEPTH_COMPONENT24_OES" value="0x81A6"/> +</category> + +<category name="GL_OES_depth32" number="25"> + <enum name="DEPTH_COMPONENT32_OES" value="0x81A7"/> +</category> + +<!-- 26. GL_OES_element_index_uint --> + +<!-- 27. GL_OES_fbo_render_mipmap --> + +<category name="GL_OES_mapbuffer" number="29"> + <enum name="WRITE_ONLY_OES" value="0x88B9"/> + <enum name="BUFFER_ACCESS_OES" value="0x88BB"/> + <enum name="BUFFER_MAPPED_OES" value="0x88BC"/> + <enum name="BUFFER_MAP_POINTER_OES" value="0x88BD"/> + + <function name="GetBufferPointervOES" alias="GetBufferPointervARB" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="GLvoid **"/> + </function> + + <function name="MapBufferOES" alias="MapBufferARB" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="access" type="GLenum"/> + <return type="GLvoid *"/> + </function> + + <function name="UnmapBufferOES" alias="UnmapBufferARB" static_dispatch="false"> + <param name="target" type="GLenum"/> + <return type="GLboolean"/> + </function> +</category> + +<category name="GL_OES_rgb8_rgba8" number="30"> + <enum name="RGB8_OES" value="0x8051"/> + <enum name="RGBA8_OES" value="0x8058"/> +</category> + +<category name="GL_OES_stencil1" number="31"> + <enum name="STENCIL_INDEX1_OES" value="0x8D46"/> +</category> + +<category name="GL_OES_stencil4" number="32"> + <enum name="STENCIL_INDEX4_OES" value="0x8D47"/> +</category> + +<category name="GL_OES_stencil8" number="33"> + <enum name="STENCIL_INDEX8_OES" value="0x8D48"/> +</category> + +<category name="GL_OES_texture_3D" number="34"> + <enum name="TEXTURE_BINDING_3D_OES" value="0x806A"/> + <enum name="TEXTURE_3D_OES" value="0x806F"/> + <enum name="TEXTURE_WRAP_R_OES" value="0x8072"/> + <enum name="MAX_3D_TEXTURE_SIZE_OES" value="0x8073"/> + <enum name="SAMPLER_3D_OES" value="0x8B5F"/> + <enum name="FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_OES" value="0x8CD4"/> + + <function name="CompressedTexImage3DOES" alias="CompressedTexImage3DARB" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="level" type="GLint"/> + <param name="internalformat" type="GLenum"/> + <param name="width" type="GLsizei"/> + <param name="height" type="GLsizei"/> + <param name="depth" type="GLsizei"/> + <param name="border" type="GLint"/> + <param name="imageSize" type="GLsizei" counter="true"/> + <param name="data" type="const GLvoid *" count="imageSize"/> + </function> + + <function name="CompressedTexSubImage3DOES" alias="CompressedTexSubImage3DARB" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="level" type="GLint"/> + <param name="xoffset" type="GLint"/> + <param name="yoffset" type="GLint"/> + <param name="zoffset" type="GLint"/> + <param name="width" type="GLsizei"/> + <param name="height" type="GLsizei"/> + <param name="depth" type="GLsizei"/> + <param name="format" type="GLenum"/> + <param name="imageSize" type="GLsizei" counter="true"/> + <param name="data" type="const GLvoid *" count="imageSize"/> + </function> + + <function name="CopyTexSubImage3DOES" alias="CopyTexSubImage3D" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="level" type="GLint"/> + <param name="xoffset" type="GLint"/> + <param name="yoffset" type="GLint"/> + <param name="zoffset" type="GLint"/> + <param name="x" type="GLint"/> + <param name="y" type="GLint"/> + <param name="width" type="GLsizei"/> + <param name="height" type="GLsizei"/> + </function> + + <function name="FramebufferTexture3DOES" alias="FramebufferTexture3DEXT" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="attachment" type="GLenum"/> + <param name="textarget" type="GLenum"/> + <param name="texture" type="GLuint"/> + <param name="level" type="GLint"/> + <param name="zoffset" type="GLint"/> + </function> + + <function name="TexImage3DOES" alias="TexImage3D" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="level" type="GLint"/> + <param name="internalformat" type="GLenum"/> + <param name="width" type="GLsizei"/> + <param name="height" type="GLsizei"/> + <param name="depth" type="GLsizei"/> + <param name="border" type="GLint"/> + <param name="format" type="GLenum"/> + <param name="type" type="GLenum"/> + <param name="pixels" type="const GLvoid *" img_width="width" img_height="height" img_depth="depth" img_format="format" img_type="type" img_target="target" img_null_flag="true" img_pad_dimensions="true"/> + </function> + + <function name="TexSubImage3DOES" alias="TexSubImage3D" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="level" type="GLint"/> + <param name="xoffset" type="GLint"/> + <param name="yoffset" type="GLint"/> + <param name="zoffset" type="GLint"/> + <param name="width" type="GLsizei"/> + <param name="height" type="GLsizei"/> + <param name="depth" type="GLsizei"/> + <param name="format" type="GLenum"/> + <param name="type" type="GLenum"/> + <param name="UNUSED" type="GLuint" padding="true"/> + <param name="pixels" type="const GLvoid *" img_width="width" img_height="height" img_depth="depth" img_xoff="xoffset" img_yoff="yoffset" img_zoff="zoffset" img_format="format" img_type="type" img_target="target" img_pad_dimensions="true"/> + </function> +</category> + +<!-- the other name is OES_texture_float_linear --> +<!-- 35. GL_OES_texture_half_float_linear --> + +<!-- the other name is OES_texture_float --> +<category name="GL_OES_texture_half_float" number="36"> + <enum name="HALF_FLOAT_OES" value="0x8D61"/> +</category> + +<!-- 37. GL_OES_texture_npot --> + +<category name="GL_OES_vertex_half_float" number="38"> + <enum name="HALF_FLOAT_OES" value="0x8D61"/> +</category> + +<!-- 41. GL_EXT_texture_filter_anisotropic --> + +<category name="GL_EXT_texture_type_2_10_10_10_REV" number="42"> + <enum name="UNSIGNED_INT_2_10_10_10_REV_EXT" value="0x8368"/> +</category> + +<category name="GL_OES_packed_depth_stencil" number="43"> + <enum name="DEPTH_STENCIL_OES" value="0x84F9"/> + <enum name="UNSIGNED_INT_24_8_OES" value="0x84FA"/> + <enum name="DEPTH24_STENCIL8_OES" value="0x88F0"/> +</category> + +<!-- 44. GL_OES_depth_texture --> + +<category name="GL_OES_standard_derivatives" number="45"> + <enum name="FRAGMENT_SHADER_DERIVATIVE_HINT_OES" value="0x8B8B"/> +</category> + +<category name="GL_OES_vertex_type_10_10_10_2" number="46"> + <enum name="UNSIGNED_INT_10_10_10_2_OES" value="0x8DF6"/> + <enum name="INT_10_10_10_2_OES" value="0x8DF7"/> +</category> + +<category name="GL_OES_get_program_binary" number="47"> + <enum name="PROGRAM_BINARY_LENGTH_OES" value="0x8741"/> + <enum name="NUM_PROGRAM_BINARY_FORMATS_OES" value="0x87FE"/> + <enum name="PROGRAM_BINARY_FORMATS_OES" value="0x87FF"/> + + <function name="GetProgramBinaryOES" alias="GetProgramBinary" static_dispatch="false"> + <param name="program" type="GLuint"/> + <param name="bufSize" type="GLsizei"/> + <param name="length" type="GLsizei *"/> + <param name="binaryFormat" type="GLenum *"/> + <param name="binary" type="GLvoid *"/> + </function> + + <function name="ProgramBinaryOES" alias="ProgramBinary" static_dispatch="false"> + <param name="program" type="GLuint"/> + <param name="binaryFormat" type="GLenum"/> + <param name="binary" type="const GLvoid *"/> + <param name="length" type="GLint"/> + </function> +</category> + +<category name="GL_EXT_texture_compression_dxt1" number="49"> + <enum name="COMPRESSED_RGB_S3TC_DXT1_EXT" value="0x83F0"/> + <enum name="COMPRESSED_RGBA_S3TC_DXT1_EXT" value="0x83F1"/> +</category> + +<category name="GL_EXT_texture_format_BGRA8888" number="51"> + <enum name="BGRA_EXT" value="0x80E1"/> +</category> + +<category name="GL_EXT_texture_lod_bias" number="60"> + <enum name="TEXTURE_FILTER_CONTROL_EXT" value="0x8500"/> + <enum name="TEXTURE_LOD_BIAS_EXT" value="0x8501"/> + <enum name="MAX_TEXTURE_LOD_BIAS_EXT" value="0x84FD"/> +</category> + +<!-- 65. GL_EXT_blend_minmax --> + +<category name="GL_EXT_read_format_bgra" number="66"> + <enum name="BGRA_EXT" value="0x80E1"/> + <enum name="UNSIGNED_SHORT_4_4_4_4_REV_EXT" value="0x8365"/> + <enum name="UNSIGNED_SHORT_1_5_5_5_REV_EXT" value="0x8366"/> +</category> + +<!-- 69. GL_EXT_multi_draw_arrays --> + +</OpenGLAPI> diff --git a/mesalib/src/mapi/glapi/gen/glX_proto_send.py b/mesalib/src/mapi/glapi/gen/glX_proto_send.py index 9c4f45481..6330d91f7 100644 --- a/mesalib/src/mapi/glapi/gen/glX_proto_send.py +++ b/mesalib/src/mapi/glapi/gen/glX_proto_send.py @@ -1,1044 +1,1097 @@ -#!/usr/bin/env python
-
-# (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
-# on 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 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:
-# Ian Romanick <idr@us.ibm.com>
-# Jeremy Kolb <jkolb@brandeis.edu>
-
-import gl_XML, glX_XML, glX_proto_common, license
-import sys, getopt, copy, string
-
-def convertStringForXCB(str):
- tmp = ""
- special = [ "ARB" ]
- i = 0
- while i < len(str):
- if str[i:i+3] in special:
- tmp = '%s_%s' % (tmp, string.lower(str[i:i+3]))
- i = i + 2;
- elif str[i].isupper():
- tmp = '%s_%s' % (tmp, string.lower(str[i]))
- else:
- tmp = '%s%s' % (tmp, str[i])
- i += 1
- return tmp
-
-def hash_pixel_function(func):
- """Generate a 'unique' key for a pixel function. The key is based on
- the parameters written in the command packet. This includes any
- padding that might be added for the original function and the 'NULL
- image' flag."""
-
-
- h = ""
- hash_pre = ""
- hash_suf = ""
- for param in func.parameterIterateGlxSend():
- if param.is_image():
- [dim, junk, junk, junk, junk] = param.get_dimensions()
-
- d = (dim + 1) & ~1
- hash_pre = "%uD%uD_" % (d - 1, d)
-
- if param.img_null_flag:
- hash_suf = "_NF"
-
- h += "%u" % (param.size())
-
- if func.pad_after(param):
- h += "4"
-
-
- n = func.name.replace("%uD" % (dim), "")
- n = "__glx_%s_%uD%uD" % (n, d - 1, d)
-
- h = hash_pre + h + hash_suf
- return [h, n]
-
-
-class glx_pixel_function_stub(glX_XML.glx_function):
- """Dummy class used to generate pixel "utility" functions that are
- shared by multiple dimension image functions. For example, these
- objects are used to generate shared functions used to send GLX
- protocol for TexImage1D and TexImage2D, TexSubImage1D and
- TexSubImage2D, etc."""
-
- def __init__(self, func, name):
- # The parameters to the utility function are the same as the
- # parameters to the real function except for the added "pad"
- # parameters.
-
- self.name = name
- self.images = []
- self.parameters = []
- self.parameters_by_name = {}
- for _p in func.parameterIterator():
- p = copy.copy(_p)
- self.parameters.append(p)
- self.parameters_by_name[ p.name ] = p
-
-
- if p.is_image():
- self.images.append(p)
- p.height = "height"
-
- if p.img_yoff == None:
- p.img_yoff = "yoffset"
-
- if p.depth:
- if p.extent == None:
- p.extent = "extent"
-
- if p.img_woff == None:
- p.img_woff = "woffset"
-
-
- pad_name = func.pad_after(p)
- if pad_name:
- pad = copy.copy(p)
- pad.name = pad_name
- self.parameters.append(pad)
- self.parameters_by_name[ pad.name ] = pad
-
-
- self.return_type = func.return_type
-
- self.glx_rop = ~0
- self.glx_sop = 0
- self.glx_vendorpriv = 0
-
- self.glx_doubles_in_order = func.glx_doubles_in_order
-
- self.vectorequiv = None
- self.output = None
- self.can_be_large = func.can_be_large
- self.reply_always_array = func.reply_always_array
- self.dimensions_in_reply = func.dimensions_in_reply
- self.img_reset = None
-
- self.server_handcode = 0
- self.client_handcode = 0
- self.ignore = 0
-
- self.count_parameter_list = func.count_parameter_list
- self.counter_list = func.counter_list
- self.offsets_calculated = 0
- return
-
-
-class PrintGlxProtoStubs(glX_proto_common.glx_print_proto):
- def __init__(self):
- glX_proto_common.glx_print_proto.__init__(self)
- self.name = "glX_proto_send.py (from Mesa)"
- self.license = license.bsd_license_template % ( "(C) Copyright IBM Corporation 2004, 2005", "IBM")
-
-
- self.last_category = ""
- self.generic_sizes = [3, 4, 6, 8, 12, 16, 24, 32]
- self.pixel_stubs = {}
- self.debug = 0
- return
-
- def printRealHeader(self):
- print ''
- print '#include <GL/gl.h>'
- print '#include "indirect.h"'
- print '#include "glxclient.h"'
- print '#include "indirect_size.h"'
- print '#include "glapi.h"'
- print '#include "glthread.h"'
- print '#include <GL/glxproto.h>'
- print '#ifdef USE_XCB'
- print '#include <X11/Xlib-xcb.h>'
- print '#include <xcb/xcb.h>'
- print '#include <xcb/glx.h>'
- print '#endif /* USE_XCB */'
-
- print ''
- print '#define __GLX_PAD(n) (((n) + 3) & ~3)'
- print ''
- self.printFastcall()
- self.printNoinline()
- print ''
- print '#ifndef __GNUC__'
- print '# define __builtin_expect(x, y) x'
- print '#endif'
- print ''
- print '/* If the size and opcode values are known at compile-time, this will, on'
- print ' * x86 at least, emit them with a single instruction.'
- print ' */'
- print '#define emit_header(dest, op, size) \\'
- print ' do { union { short s[2]; int i; } temp; \\'
- print ' temp.s[0] = (size); temp.s[1] = (op); \\'
- print ' *((int *)(dest)) = temp.i; } while(0)'
- print ''
- print """NOINLINE 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;
-}
-
-NOINLINE void
-__glXReadPixelReply( Display *dpy, struct glx_context * 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);
- }
- }
-}
-
-#define X_GLXSingle 0
-
-NOINLINE FASTCALL GLubyte *
-__glXSetupSingleRequest( struct glx_context * 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;
-}
-
-NOINLINE FASTCALL GLubyte *
-__glXSetupVendorRequest( struct glx_context * 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;
-}
-
-const GLuint __glXDefaultPixelStore[9] = { 0, 0, 0, 0, 0, 0, 0, 0, 1 };
-
-#define zero (__glXDefaultPixelStore+0)
-#define one (__glXDefaultPixelStore+8)
-#define default_pixel_store_1D (__glXDefaultPixelStore+4)
-#define default_pixel_store_1D_size 20
-#define default_pixel_store_2D (__glXDefaultPixelStore+4)
-#define default_pixel_store_2D_size 20
-#define default_pixel_store_3D (__glXDefaultPixelStore+0)
-#define default_pixel_store_3D_size 36
-#define default_pixel_store_4D (__glXDefaultPixelStore+0)
-#define default_pixel_store_4D_size 36
-"""
-
- for size in self.generic_sizes:
- self.print_generic_function(size)
- return
-
-
- def printBody(self, api):
-
- self.pixel_stubs = {}
- generated_stubs = []
-
- for func in api.functionIterateGlx():
- if func.client_handcode: continue
-
- # If the function is a pixel function with a certain
- # GLX protocol signature, create a fake stub function
- # for it. For example, create a single stub function
- # that is used to implement both glTexImage1D and
- # glTexImage2D.
-
- if func.glx_rop != 0:
- do_it = 0
- for image in func.get_images():
- if image.img_pad_dimensions:
- do_it = 1
- break
-
-
- if do_it:
- [h, n] = hash_pixel_function(func)
-
-
- self.pixel_stubs[ func.name ] = n
- if h not in generated_stubs:
- generated_stubs.append(h)
-
- fake_func = glx_pixel_function_stub( func, n )
- self.printFunction(fake_func, fake_func.name)
-
-
- self.printFunction(func, func.name)
- if func.glx_sop and func.glx_vendorpriv:
- self.printFunction(func, func.glx_vendorpriv_names[0])
-
- return
-
-
- def printFunction(self, func, name):
- footer = '}\n'
- if func.glx_rop == ~0:
- print 'static %s' % (func.return_type)
- print '%s( unsigned opcode, unsigned dim, %s )' % (func.name, func.get_parameter_string())
- print '{'
- else:
- if func.has_different_protocol(name):
- if func.return_type == "void":
- ret_string = ''
- else:
- ret_string = "return "
-
- func_name = func.static_glx_name(name)
- print '#define %s %d' % (func.opcode_vendor_name(name), func.glx_vendorpriv)
- print '%s gl%s(%s)' % (func.return_type, func_name, func.get_parameter_string())
- print '{'
- print ' struct glx_context * const gc = __glXGetCurrentContext();'
- print ''
- print '#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)'
- print ' if (gc->isDirect) {'
- print ' %sGET_DISPATCH()->%s(%s);' % (ret_string, func.name, func.get_called_parameter_string())
- print ' } else'
- print '#endif'
- print ' {'
-
- footer = '}\n}\n'
- else:
- print '#define %s %d' % (func.opcode_name(), func.opcode_value())
-
- print '%s __indirect_gl%s(%s)' % (func.return_type, name, func.get_parameter_string())
- print '{'
-
-
- if func.glx_rop != 0 or func.vectorequiv != None:
- if len(func.images):
- self.printPixelFunction(func)
- else:
- self.printRenderFunction(func)
- elif func.glx_sop != 0 or func.glx_vendorpriv != 0:
- self.printSingleFunction(func, name)
- pass
- else:
- print "/* Missing GLX protocol for %s. */" % (name)
-
- print footer
- return
-
-
- def print_generic_function(self, n):
- size = (n + 3) & ~3
- print """static FASTCALL NOINLINE void
-generic_%u_byte( GLint rop, const void * ptr )
-{
- struct glx_context * const gc = __glXGetCurrentContext();
- const GLuint cmdlen = %u;
-
- emit_header(gc->pc, rop, cmdlen);
- (void) memcpy((void *)(gc->pc + 4), ptr, %u);
- gc->pc += cmdlen;
- if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
-}
-""" % (n, size + 4, size)
- return
-
-
- def common_emit_one_arg(self, p, pc, adjust, extra_offset):
- if p.is_array():
- src_ptr = p.name
- else:
- src_ptr = "&" + p.name
-
- if p.is_padding:
- print '(void) memset((void *)(%s + %u), 0, %s);' \
- % (pc, p.offset + adjust, p.size_string() )
- elif not extra_offset:
- print '(void) memcpy((void *)(%s + %u), (void *)(%s), %s);' \
- % (pc, p.offset + adjust, src_ptr, p.size_string() )
- else:
- print '(void) memcpy((void *)(%s + %u + %s), (void *)(%s), %s);' \
- % (pc, p.offset + adjust, extra_offset, src_ptr, p.size_string() )
-
- def common_emit_args(self, f, pc, adjust, skip_vla):
- extra_offset = None
-
- for p in f.parameterIterateGlxSend( not skip_vla ):
- if p.name != f.img_reset:
- self.common_emit_one_arg(p, pc, adjust, extra_offset)
-
- if p.is_variable_length():
- temp = p.size_string()
- if extra_offset:
- extra_offset += " + %s" % (temp)
- else:
- extra_offset = temp
-
- return
-
-
- def pixel_emit_args(self, f, pc, large):
- """Emit the arguments for a pixel function. This differs from
- common_emit_args in that pixel functions may require padding
- be inserted (i.e., for the missing width field for
- TexImage1D), and they may also require a 'NULL image' flag
- be inserted before the image data."""
-
- if large:
- adjust = 8
- else:
- adjust = 4
-
- for param in f.parameterIterateGlxSend():
- if not param.is_image():
- self.common_emit_one_arg(param, pc, adjust, None)
-
- if f.pad_after(param):
- print '(void) memcpy((void *)(%s + %u), zero, 4);' % (pc, (param.offset + param.size()) + adjust)
-
- else:
- [dim, width, height, depth, extent] = param.get_dimensions()
- if f.glx_rop == ~0:
- dim_str = "dim"
- else:
- dim_str = str(dim)
-
- if param.is_padding:
- print '(void) memset((void *)(%s + %u), 0, %s);' \
- % (pc, (param.offset - 4) + adjust, param.size_string() )
-
- if param.img_null_flag:
- if large:
- print '(void) memcpy((void *)(%s + %u), zero, 4);' % (pc, (param.offset - 4) + adjust)
- else:
- print '(void) memcpy((void *)(%s + %u), (void *)((%s == NULL) ? one : zero), 4);' % (pc, (param.offset - 4) + adjust, param.name)
-
-
- pixHeaderPtr = "%s + %u" % (pc, adjust)
- pcPtr = "%s + %u" % (pc, param.offset + adjust)
-
- if not large:
- if param.img_send_null:
- condition = '(compsize > 0) && (%s != NULL)' % (param.name)
- else:
- condition = 'compsize > 0'
-
- print 'if (%s) {' % (condition)
- print ' (*gc->fillImage)(gc, %s, %s, %s, %s, %s, %s, %s, %s, %s);' % (dim_str, width, height, depth, param.img_format, param.img_type, param.name, pcPtr, pixHeaderPtr)
- print '} else {'
- print ' (void) memcpy( %s, default_pixel_store_%uD, default_pixel_store_%uD_size );' % (pixHeaderPtr, dim, dim)
- print '}'
- else:
- print '__glXSendLargeImage(gc, compsize, %s, %s, %s, %s, %s, %s, %s, %s, %s);' % (dim_str, width, height, depth, param.img_format, param.img_type, param.name, pcPtr, pixHeaderPtr)
-
- return
-
-
- def large_emit_begin(self, f, op_name = None):
- if not op_name:
- op_name = f.opcode_real_name()
-
- print 'const GLint op = %s;' % (op_name)
- print 'const GLuint cmdlenLarge = cmdlen + 4;'
- print 'GLubyte * const pc = __glXFlushRenderBuffer(gc, gc->pc);'
- print '(void) memcpy((void *)(pc + 0), (void *)(&cmdlenLarge), 4);'
- print '(void) memcpy((void *)(pc + 4), (void *)(&op), 4);'
- return
-
-
- def common_func_print_just_start(self, f, name):
- print ' struct glx_context * const gc = __glXGetCurrentContext();'
-
- # The only reason that single and vendor private commands need
- # a variable called 'dpy' is becuase they use the SyncHandle
- # macro. For whatever brain-dead reason, that macro is hard-
- # coded to use a variable called 'dpy' instead of taking a
- # parameter.
-
- # FIXME Simplify the logic related to skip_condition and
- # FIXME condition_list in this function. Basically, remove
- # FIXME skip_condition, and just append the "dpy != NULL" type
- # FIXME condition to condition_list from the start. The only
- # FIXME reason it's done in this confusing way now is to
- # FIXME minimize the diffs in the generated code.
-
- if not f.glx_rop:
- for p in f.parameterIterateOutputs():
- if p.is_image() and (p.img_format != "GL_COLOR_INDEX" or p.img_type != "GL_BITMAP"):
- print ' const __GLXattribute * const state = gc->client_state_private;'
- break
-
- print ' Display * const dpy = gc->currentDpy;'
- skip_condition = "dpy != NULL"
- elif f.can_be_large:
- skip_condition = "gc->currentDpy != NULL"
- else:
- skip_condition = None
-
-
- if f.return_type != 'void':
- print ' %s retval = (%s) 0;' % (f.return_type, f.return_type)
-
-
- if name != None and name not in f.glx_vendorpriv_names:
- print '#ifndef USE_XCB'
- self.emit_packet_size_calculation(f, 0)
- if name != None and name not in f.glx_vendorpriv_names:
- print '#endif'
-
- condition_list = []
- for p in f.parameterIterateCounters():
- condition_list.append( "%s >= 0" % (p.name) )
- # 'counter' parameters cannot be negative
- print " if (%s < 0) {" % p.name
- print " __glXSetError(gc, GL_INVALID_VALUE);"
- if f.return_type != 'void':
- print " return 0;"
- else:
- print " return;"
- print " }"
-
- if skip_condition:
- condition_list.append( skip_condition )
-
- if len( condition_list ) > 0:
- if len( condition_list ) > 1:
- skip_condition = "(%s)" % (string.join( condition_list, ") && (" ))
- else:
- skip_condition = "%s" % (condition_list.pop(0))
-
- print ' if (__builtin_expect(%s, 1)) {' % (skip_condition)
- return 1
- else:
- return 0
-
-
- def printSingleFunction(self, f, name):
- self.common_func_print_just_start(f, name)
-
- if self.debug:
- print ' printf( "Enter %%s...\\n", "gl%s" );' % (f.name)
-
- if name not in f.glx_vendorpriv_names:
-
- # XCB specific:
- print '#ifdef USE_XCB'
- if self.debug:
- print ' printf("\\tUsing XCB.\\n");'
- print ' xcb_connection_t *c = XGetXCBConnection(dpy);'
- print ' (void) __glXFlushRenderBuffer(gc, gc->pc);'
- xcb_name = 'xcb_glx%s' % convertStringForXCB(name)
-
- iparams=[]
- extra_iparams = []
- output = None
- for p in f.parameterIterator():
- if p.is_output:
- output = p
-
- if p.is_image():
- if p.img_format != "GL_COLOR_INDEX" or p.img_type != "GL_BITMAP":
- extra_iparams.append("state->storePack.swapEndian")
- else:
- extra_iparams.append("0")
-
- # Hardcode this in. lsb_first param (apparently always GL_FALSE)
- # also present in GetPolygonStipple, but taken care of above.
- if xcb_name == "xcb_glx_read_pixels":
- extra_iparams.append("0")
- else:
- iparams.append(p.name)
-
-
- xcb_request = '%s(%s)' % (xcb_name, ", ".join(["c", "gc->currentContextTag"] + iparams + extra_iparams))
-
- if f.needs_reply():
- print ' %s_reply_t *reply = %s_reply(c, %s, NULL);' % (xcb_name, xcb_name, xcb_request)
- if output and f.reply_always_array:
- print ' (void)memcpy(%s, %s_data(reply), %s_data_length(reply) * sizeof(%s));' % (output.name, xcb_name, xcb_name, output.get_base_type_string())
-
- elif output and not f.reply_always_array:
- if not output.is_image():
- print ' if (%s_data_length(reply) == 0)' % (xcb_name)
- print ' (void)memcpy(%s, &reply->datum, sizeof(reply->datum));' % (output.name)
- print ' else'
- print ' (void)memcpy(%s, %s_data(reply), %s_data_length(reply) * sizeof(%s));' % (output.name, xcb_name, xcb_name, output.get_base_type_string())
-
-
- if f.return_type != 'void':
- print ' retval = reply->ret_val;'
- print ' free(reply);'
- else:
- print ' ' + xcb_request + ';'
- print '#else'
- # End of XCB specific.
-
-
- if f.parameters != []:
- pc_decl = "GLubyte const * pc ="
- else:
- pc_decl = "(void)"
-
- if name in f.glx_vendorpriv_names:
- print ' %s __glXSetupVendorRequest(gc, %s, %s, cmdlen);' % (pc_decl, f.opcode_real_name(), f.opcode_vendor_name(name))
- else:
- print ' %s __glXSetupSingleRequest(gc, %s, cmdlen);' % (pc_decl, f.opcode_name())
-
- self.common_emit_args(f, "pc", 0, 0)
-
- images = f.get_images()
-
- for img in images:
- if img.is_output:
- o = f.command_fixed_length() - 4
- print ' *(int32_t *)(pc + %u) = 0;' % (o)
- if img.img_format != "GL_COLOR_INDEX" or img.img_type != "GL_BITMAP":
- print ' * (int8_t *)(pc + %u) = state->storePack.swapEndian;' % (o)
-
- if f.img_reset:
- print ' * (int8_t *)(pc + %u) = %s;' % (o + 1, f.img_reset)
-
-
- return_name = ''
- if f.needs_reply():
- if f.return_type != 'void':
- return_name = " retval"
- return_str = " retval = (%s)" % (f.return_type)
- else:
- return_str = " (void)"
-
- got_reply = 0
-
- for p in f.parameterIterateOutputs():
- if p.is_image():
- [dim, w, h, d, junk] = p.get_dimensions()
- if f.dimensions_in_reply:
- print " __glXReadPixelReply(dpy, gc, %u, 0, 0, 0, %s, %s, %s, GL_TRUE);" % (dim, p.img_format, p.img_type, p.name)
- else:
- print " __glXReadPixelReply(dpy, gc, %u, %s, %s, %s, %s, %s, %s, GL_FALSE);" % (dim, w, h, d, p.img_format, p.img_type, p.name)
-
- got_reply = 1
- else:
- if f.reply_always_array:
- aa = "GL_TRUE"
- else:
- aa = "GL_FALSE"
-
- # gl_parameter.size() returns the size
- # of the entire data item. If the
- # item is a fixed-size array, this is
- # the size of the whole array. This
- # is not what __glXReadReply wants. It
- # wants the size of a single data
- # element in the reply packet.
- # Dividing by the array size (1 for
- # non-arrays) gives us this.
-
- s = p.size() / p.get_element_count()
- print " %s __glXReadReply(dpy, %s, %s, %s);" % (return_str, s, p.name, aa)
- got_reply = 1
-
-
- # If a reply wasn't read to fill an output parameter,
- # read a NULL reply to get the return value.
-
- if not got_reply:
- print " %s __glXReadReply(dpy, 0, NULL, GL_FALSE);" % (return_str)
-
-
- elif self.debug:
- # Only emit the extra glFinish call for functions
- # that don't already require a reply from the server.
- print ' __indirect_glFinish();'
-
- if self.debug:
- print ' printf( "Exit %%s.\\n", "gl%s" );' % (name)
-
-
- print ' UnlockDisplay(dpy); SyncHandle();'
-
- if name not in f.glx_vendorpriv_names:
- print '#endif /* USE_XCB */'
-
- print ' }'
- print ' return%s;' % (return_name)
- return
-
-
- def printPixelFunction(self, f):
- if self.pixel_stubs.has_key( f.name ):
- # Normally gl_function::get_parameter_string could be
- # used. However, this call needs to have the missing
- # dimensions (e.g., a fake height value for
- # glTexImage1D) added in.
-
- p_string = ""
- for param in f.parameterIterateGlxSend():
- if param.is_padding:
- continue
-
- p_string += ", " + param.name
-
- if param.is_image():
- [dim, junk, junk, junk, junk] = param.get_dimensions()
-
- if f.pad_after(param):
- p_string += ", 1"
-
- print ' %s(%s, %u%s );' % (self.pixel_stubs[f.name] , f.opcode_name(), dim, p_string)
- return
-
-
- if self.common_func_print_just_start(f, None):
- trailer = " }"
- else:
- trailer = None
-
-
- if f.can_be_large:
- print 'if (cmdlen <= gc->maxSmallRenderCommandSize) {'
- print ' if ( (gc->pc + cmdlen) > gc->bufEnd ) {'
- print ' (void) __glXFlushRenderBuffer(gc, gc->pc);'
- print ' }'
-
- if f.glx_rop == ~0:
- opcode = "opcode"
- else:
- opcode = f.opcode_real_name()
-
- print 'emit_header(gc->pc, %s, cmdlen);' % (opcode)
-
- self.pixel_emit_args( f, "gc->pc", 0 )
- print 'gc->pc += cmdlen;'
- print 'if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }'
-
- if f.can_be_large:
- print '}'
- print 'else {'
-
- self.large_emit_begin(f, opcode)
- self.pixel_emit_args(f, "pc", 1)
-
- print '}'
-
- if trailer: print trailer
- return
-
-
- def printRenderFunction(self, f):
- # There is a class of GL functions that take a single pointer
- # as a parameter. This pointer points to a fixed-size chunk
- # of data, and the protocol for this functions is very
- # regular. Since they are so regular and there are so many
- # of them, special case them with generic functions. On
- # x86, this saves about 26KB in the libGL.so binary.
-
- if f.variable_length_parameter() == None and len(f.parameters) == 1:
- p = f.parameters[0]
- if p.is_pointer():
- cmdlen = f.command_fixed_length()
- if cmdlen in self.generic_sizes:
- print ' generic_%u_byte( %s, %s );' % (cmdlen, f.opcode_real_name(), p.name)
- return
-
- if self.common_func_print_just_start(f, None):
- trailer = " }"
- else:
- trailer = None
-
- if self.debug:
- print 'printf( "Enter %%s...\\n", "gl%s" );' % (f.name)
-
- if f.can_be_large:
- print 'if (cmdlen <= gc->maxSmallRenderCommandSize) {'
- print ' if ( (gc->pc + cmdlen) > gc->bufEnd ) {'
- print ' (void) __glXFlushRenderBuffer(gc, gc->pc);'
- print ' }'
-
- print 'emit_header(gc->pc, %s, cmdlen);' % (f.opcode_real_name())
-
- self.common_emit_args(f, "gc->pc", 4, 0)
- print 'gc->pc += cmdlen;'
- print 'if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }'
-
- if f.can_be_large:
- print '}'
- print 'else {'
-
- self.large_emit_begin(f)
- self.common_emit_args(f, "pc", 8, 1)
-
- p = f.variable_length_parameter()
- print ' __glXSendLargeCommand(gc, pc, %u, %s, %s);' % (p.offset + 8, p.name, p.size_string())
- print '}'
-
- if self.debug:
- print '__indirect_glFinish();'
- print 'printf( "Exit %%s.\\n", "gl%s" );' % (f.name)
-
- if trailer: print trailer
- return
-
-
-class PrintGlxProtoInit_c(gl_XML.gl_print_base):
- def __init__(self):
- gl_XML.gl_print_base.__init__(self)
-
- self.name = "glX_proto_send.py (from Mesa)"
- self.license = license.bsd_license_template % ( \
-"""Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
-(C) Copyright IBM Corporation 2004""", "PRECISION INSIGHT, IBM")
- return
-
-
- def printRealHeader(self):
- print """/**
- * \\file indirect_init.c
- * Initialize indirect rendering dispatch table.
- *
- * \\author Kevin E. Martin <kevin@precisioninsight.com>
- * \\author Brian Paul <brian@precisioninsight.com>
- * \\author Ian Romanick <idr@us.ibm.com>
- */
-
-#include "indirect_init.h"
-#include "indirect.h"
-#include "glapi.h"
-
-
-/**
- * No-op function used to initialize functions that have no GLX protocol
- * support.
- */
-static int NoOp(void)
-{
- return 0;
-}
-
-/**
- * Create and initialize a new GL dispatch table. The table is initialized
- * with GLX indirect rendering protocol functions.
- */
-struct _glapi_table * __glXNewIndirectAPI( void )
-{
- struct _glapi_table *glAPI;
- GLuint entries;
-
- entries = _glapi_get_dispatch_table_size();
- glAPI = (struct _glapi_table *) Xmalloc(entries * sizeof(void *));
-
- /* first, set all entries to point to no-op functions */
- {
- int i;
- void **dispatch = (void **) glAPI;
- for (i = 0; i < entries; i++) {
- dispatch[i] = (void *) NoOp;
- }
- }
-
- /* now, initialize the entries we understand */"""
-
- def printRealFooter(self):
- print """
- return glAPI;
-}
-"""
- return
-
-
- def printBody(self, api):
- for [name, number] in api.categoryIterate():
- if number != None:
- preamble = '\n /* %3u. %s */\n\n' % (int(number), name)
- else:
- preamble = '\n /* %s */\n\n' % (name)
-
- for func in api.functionIterateByCategory(name):
- if func.client_supported_for_indirect():
- print '%s glAPI->%s = __indirect_gl%s;' % (preamble, func.name, func.name)
- preamble = ''
-
- return
-
-
-class PrintGlxProtoInit_h(gl_XML.gl_print_base):
- def __init__(self):
- gl_XML.gl_print_base.__init__(self)
-
- self.name = "glX_proto_send.py (from Mesa)"
- self.license = license.bsd_license_template % ( \
-"""Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
-(C) Copyright IBM Corporation 2004""", "PRECISION INSIGHT, IBM")
- self.header_tag = "_INDIRECT_H_"
-
- self.last_category = ""
- return
-
-
- def printRealHeader(self):
- print """/**
- * \\file
- * Prototypes for indirect rendering functions.
- *
- * \\author Kevin E. Martin <kevin@precisioninsight.com>
- * \\author Ian Romanick <idr@us.ibm.com>
- */
-"""
- self.printVisibility( "HIDDEN", "hidden" )
- self.printFastcall()
- self.printNoinline()
-
- print """
-#include "glxclient.h"
-
-extern HIDDEN NOINLINE CARD32 __glXReadReply( Display *dpy, size_t size,
- void * dest, GLboolean reply_is_always_array );
-
-extern HIDDEN NOINLINE void __glXReadPixelReply( Display *dpy,
- struct glx_context * gc, unsigned max_dim, GLint width, GLint height,
- GLint depth, GLenum format, GLenum type, void * dest,
- GLboolean dimensions_in_reply );
-
-extern HIDDEN NOINLINE FASTCALL GLubyte * __glXSetupSingleRequest(
- struct glx_context * gc, GLint sop, GLint cmdlen );
-
-extern HIDDEN NOINLINE FASTCALL GLubyte * __glXSetupVendorRequest(
- struct glx_context * gc, GLint code, GLint vop, GLint cmdlen );
-"""
-
-
- def printBody(self, api):
- for func in api.functionIterateGlx():
- params = func.get_parameter_string()
-
- print 'extern HIDDEN %s __indirect_gl%s(%s);' % (func.return_type, func.name, params)
-
- for n in func.entry_points:
- if func.has_different_protocol(n):
- asdf = func.static_glx_name(n)
- if asdf not in func.static_entry_points:
- print 'extern HIDDEN %s gl%s(%s);' % (func.return_type, asdf, params)
- # give it a easy-to-remember name
- if func.client_handcode:
- print '#define gl_dispatch_stub_%s gl%s' % (n, asdf)
- else:
- print 'GLAPI %s GLAPIENTRY gl%s(%s);' % (func.return_type, asdf, params)
-
- break
-
-
-
-def show_usage():
- print "Usage: %s [-f input_file_name] [-m output_mode] [-d]" % sys.argv[0]
- print " -m output_mode Output mode can be one of 'proto', 'init_c' or 'init_h'."
- print " -d Enable extra debug information in the generated code."
- sys.exit(1)
-
-
-if __name__ == '__main__':
- file_name = "gl_API.xml"
-
- try:
- (args, trail) = getopt.getopt(sys.argv[1:], "f:m:d")
- except Exception,e:
- show_usage()
-
- debug = 0
- mode = "proto"
- for (arg,val) in args:
- if arg == "-f":
- file_name = val
- elif arg == "-m":
- mode = val
- elif arg == "-d":
- debug = 1
-
- if mode == "proto":
- printer = PrintGlxProtoStubs()
- elif mode == "init_c":
- printer = PrintGlxProtoInit_c()
- elif mode == "init_h":
- printer = PrintGlxProtoInit_h()
- else:
- show_usage()
-
-
- printer.debug = debug
- api = gl_XML.parse_GL_API( file_name, glX_XML.glx_item_factory() )
-
- printer.Print( api )
+#!/usr/bin/env python + +# (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 +# on 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 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: +# Ian Romanick <idr@us.ibm.com> +# Jeremy Kolb <jkolb@brandeis.edu> + +import gl_XML, glX_XML, glX_proto_common, license +import sys, getopt, copy, string + +def convertStringForXCB(str): + tmp = "" + special = [ "ARB" ] + i = 0 + while i < len(str): + if str[i:i+3] in special: + tmp = '%s_%s' % (tmp, string.lower(str[i:i+3])) + i = i + 2; + elif str[i].isupper(): + tmp = '%s_%s' % (tmp, string.lower(str[i])) + else: + tmp = '%s%s' % (tmp, str[i]) + i += 1 + return tmp + +def hash_pixel_function(func): + """Generate a 'unique' key for a pixel function. The key is based on + the parameters written in the command packet. This includes any + padding that might be added for the original function and the 'NULL + image' flag.""" + + + h = "" + hash_pre = "" + hash_suf = "" + for param in func.parameterIterateGlxSend(): + if param.is_image(): + [dim, junk, junk, junk, junk] = param.get_dimensions() + + d = (dim + 1) & ~1 + hash_pre = "%uD%uD_" % (d - 1, d) + + if param.img_null_flag: + hash_suf = "_NF" + + h += "%u" % (param.size()) + + if func.pad_after(param): + h += "4" + + + n = func.name.replace("%uD" % (dim), "") + n = "__glx_%s_%uD%uD" % (n, d - 1, d) + + h = hash_pre + h + hash_suf + return [h, n] + + +class glx_pixel_function_stub(glX_XML.glx_function): + """Dummy class used to generate pixel "utility" functions that are + shared by multiple dimension image functions. For example, these + objects are used to generate shared functions used to send GLX + protocol for TexImage1D and TexImage2D, TexSubImage1D and + TexSubImage2D, etc.""" + + def __init__(self, func, name): + # The parameters to the utility function are the same as the + # parameters to the real function except for the added "pad" + # parameters. + + self.name = name + self.images = [] + self.parameters = [] + self.parameters_by_name = {} + for _p in func.parameterIterator(): + p = copy.copy(_p) + self.parameters.append(p) + self.parameters_by_name[ p.name ] = p + + + if p.is_image(): + self.images.append(p) + p.height = "height" + + if p.img_yoff == None: + p.img_yoff = "yoffset" + + if p.depth: + if p.extent == None: + p.extent = "extent" + + if p.img_woff == None: + p.img_woff = "woffset" + + + pad_name = func.pad_after(p) + if pad_name: + pad = copy.copy(p) + pad.name = pad_name + self.parameters.append(pad) + self.parameters_by_name[ pad.name ] = pad + + + self.return_type = func.return_type + + self.glx_rop = ~0 + self.glx_sop = 0 + self.glx_vendorpriv = 0 + + self.glx_doubles_in_order = func.glx_doubles_in_order + + self.vectorequiv = None + self.output = None + self.can_be_large = func.can_be_large + self.reply_always_array = func.reply_always_array + self.dimensions_in_reply = func.dimensions_in_reply + self.img_reset = None + + self.server_handcode = 0 + self.client_handcode = 0 + self.ignore = 0 + + self.count_parameter_list = func.count_parameter_list + self.counter_list = func.counter_list + self.offsets_calculated = 0 + return + + +class PrintGlxProtoStubs(glX_proto_common.glx_print_proto): + def __init__(self): + glX_proto_common.glx_print_proto.__init__(self) + self.name = "glX_proto_send.py (from Mesa)" + self.license = license.bsd_license_template % ( "(C) Copyright IBM Corporation 2004, 2005", "IBM") + + + self.last_category = "" + self.generic_sizes = [3, 4, 6, 8, 12, 16, 24, 32] + self.pixel_stubs = {} + self.debug = 0 + return + + def printRealHeader(self): + print '' + print '#include <GL/gl.h>' + print '#include "indirect.h"' + print '#include "glxclient.h"' + print '#include "indirect_size.h"' + print '#include "glapi.h"' + print '#include "glthread.h"' + print '#include <GL/glxproto.h>' + print '#ifdef USE_XCB' + print '#include <X11/Xlib-xcb.h>' + print '#include <xcb/xcb.h>' + print '#include <xcb/glx.h>' + print '#endif /* USE_XCB */' + + print '' + print '#define __GLX_PAD(n) (((n) + 3) & ~3)' + print '' + self.printFastcall() + self.printNoinline() + print '' + print '#ifndef __GNUC__' + print '# define __builtin_expect(x, y) x' + print '#endif' + print '' + print '/* If the size and opcode values are known at compile-time, this will, on' + print ' * x86 at least, emit them with a single instruction.' + print ' */' + print '#define emit_header(dest, op, size) \\' + print ' do { union { short s[2]; int i; } temp; \\' + print ' temp.s[0] = (size); temp.s[1] = (op); \\' + print ' *((int *)(dest)) = temp.i; } while(0)' + print '' + print """NOINLINE 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; +} + +NOINLINE void +__glXReadPixelReply( Display *dpy, struct glx_context * 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); + } + } +} + +#define X_GLXSingle 0 + +NOINLINE FASTCALL GLubyte * +__glXSetupSingleRequest( struct glx_context * 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; +} + +NOINLINE FASTCALL GLubyte * +__glXSetupVendorRequest( struct glx_context * 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; +} + +const GLuint __glXDefaultPixelStore[9] = { 0, 0, 0, 0, 0, 0, 0, 0, 1 }; + +#define zero (__glXDefaultPixelStore+0) +#define one (__glXDefaultPixelStore+8) +#define default_pixel_store_1D (__glXDefaultPixelStore+4) +#define default_pixel_store_1D_size 20 +#define default_pixel_store_2D (__glXDefaultPixelStore+4) +#define default_pixel_store_2D_size 20 +#define default_pixel_store_3D (__glXDefaultPixelStore+0) +#define default_pixel_store_3D_size 36 +#define default_pixel_store_4D (__glXDefaultPixelStore+0) +#define default_pixel_store_4D_size 36 +""" + + for size in self.generic_sizes: + self.print_generic_function(size) + return + + + def printBody(self, api): + + self.pixel_stubs = {} + generated_stubs = [] + + for func in api.functionIterateGlx(): + if func.client_handcode: continue + + # If the function is a pixel function with a certain + # GLX protocol signature, create a fake stub function + # for it. For example, create a single stub function + # that is used to implement both glTexImage1D and + # glTexImage2D. + + if func.glx_rop != 0: + do_it = 0 + for image in func.get_images(): + if image.img_pad_dimensions: + do_it = 1 + break + + + if do_it: + [h, n] = hash_pixel_function(func) + + + self.pixel_stubs[ func.name ] = n + if h not in generated_stubs: + generated_stubs.append(h) + + fake_func = glx_pixel_function_stub( func, n ) + self.printFunction(fake_func, fake_func.name) + + + self.printFunction(func, func.name) + if func.glx_sop and func.glx_vendorpriv: + self.printFunction(func, func.glx_vendorpriv_names[0]) + + self.printGetProcAddress(api) + return + + def printGetProcAddress(self, api): + procs = {} + for func in api.functionIterateGlx(): + for n in func.entry_points: + if func.has_different_protocol(n): + procs[n] = func.static_glx_name(n) + + print """ +#ifdef GLX_SHARED_GLAPI + +static const struct proc_pair +{ + const char *name; + _glapi_proc proc; +} proc_pairs[%d] = {""" % len(procs) + names = procs.keys() + names.sort() + for i in xrange(len(names)): + comma = ',' if i < len(names) - 1 else '' + print ' { "%s", (_glapi_proc) gl%s }%s' % (names[i], procs[names[i]], comma) + print """}; + +static int +__indirect_get_proc_compare(const void *key, const void *memb) +{ + const struct proc_pair *pair = (const struct proc_pair *) memb; + return strcmp((const char *) key, pair->name); +} + +_glapi_proc +__indirect_get_proc_address(const char *name) +{ + const struct proc_pair *pair; + + /* skip "gl" */ + name += 2; + + pair = (const struct proc_pair *) bsearch((const void *) name, + (const void *) proc_pairs, ARRAY_SIZE(proc_pairs), sizeof(proc_pairs[0]), + __indirect_get_proc_compare); + + return (pair) ? pair->proc : NULL; +} + +#endif /* GLX_SHARED_GLAPI */ +""" + return + + + def printFunction(self, func, name): + footer = '}\n' + if func.glx_rop == ~0: + print 'static %s' % (func.return_type) + print '%s( unsigned opcode, unsigned dim, %s )' % (func.name, func.get_parameter_string()) + print '{' + else: + if func.has_different_protocol(name): + if func.return_type == "void": + ret_string = '' + else: + ret_string = "return " + + func_name = func.static_glx_name(name) + print '#define %s %d' % (func.opcode_vendor_name(name), func.glx_vendorpriv) + print '%s gl%s(%s)' % (func.return_type, func_name, func.get_parameter_string()) + print '{' + print ' struct glx_context * const gc = __glXGetCurrentContext();' + print '' + print '#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)' + print ' if (gc->isDirect) {' + print ' %sGET_DISPATCH()->%s(%s);' % (ret_string, func.name, func.get_called_parameter_string()) + print ' } else' + print '#endif' + print ' {' + + footer = '}\n}\n' + else: + print '#define %s %d' % (func.opcode_name(), func.opcode_value()) + + print '%s __indirect_gl%s(%s)' % (func.return_type, name, func.get_parameter_string()) + print '{' + + + if func.glx_rop != 0 or func.vectorequiv != None: + if len(func.images): + self.printPixelFunction(func) + else: + self.printRenderFunction(func) + elif func.glx_sop != 0 or func.glx_vendorpriv != 0: + self.printSingleFunction(func, name) + pass + else: + print "/* Missing GLX protocol for %s. */" % (name) + + print footer + return + + + def print_generic_function(self, n): + size = (n + 3) & ~3 + print """static FASTCALL NOINLINE void +generic_%u_byte( GLint rop, const void * ptr ) +{ + struct glx_context * const gc = __glXGetCurrentContext(); + const GLuint cmdlen = %u; + + emit_header(gc->pc, rop, cmdlen); + (void) memcpy((void *)(gc->pc + 4), ptr, %u); + gc->pc += cmdlen; + if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); } +} +""" % (n, size + 4, size) + return + + + def common_emit_one_arg(self, p, pc, adjust, extra_offset): + if p.is_array(): + src_ptr = p.name + else: + src_ptr = "&" + p.name + + if p.is_padding: + print '(void) memset((void *)(%s + %u), 0, %s);' \ + % (pc, p.offset + adjust, p.size_string() ) + elif not extra_offset: + print '(void) memcpy((void *)(%s + %u), (void *)(%s), %s);' \ + % (pc, p.offset + adjust, src_ptr, p.size_string() ) + else: + print '(void) memcpy((void *)(%s + %u + %s), (void *)(%s), %s);' \ + % (pc, p.offset + adjust, extra_offset, src_ptr, p.size_string() ) + + def common_emit_args(self, f, pc, adjust, skip_vla): + extra_offset = None + + for p in f.parameterIterateGlxSend( not skip_vla ): + if p.name != f.img_reset: + self.common_emit_one_arg(p, pc, adjust, extra_offset) + + if p.is_variable_length(): + temp = p.size_string() + if extra_offset: + extra_offset += " + %s" % (temp) + else: + extra_offset = temp + + return + + + def pixel_emit_args(self, f, pc, large): + """Emit the arguments for a pixel function. This differs from + common_emit_args in that pixel functions may require padding + be inserted (i.e., for the missing width field for + TexImage1D), and they may also require a 'NULL image' flag + be inserted before the image data.""" + + if large: + adjust = 8 + else: + adjust = 4 + + for param in f.parameterIterateGlxSend(): + if not param.is_image(): + self.common_emit_one_arg(param, pc, adjust, None) + + if f.pad_after(param): + print '(void) memcpy((void *)(%s + %u), zero, 4);' % (pc, (param.offset + param.size()) + adjust) + + else: + [dim, width, height, depth, extent] = param.get_dimensions() + if f.glx_rop == ~0: + dim_str = "dim" + else: + dim_str = str(dim) + + if param.is_padding: + print '(void) memset((void *)(%s + %u), 0, %s);' \ + % (pc, (param.offset - 4) + adjust, param.size_string() ) + + if param.img_null_flag: + if large: + print '(void) memcpy((void *)(%s + %u), zero, 4);' % (pc, (param.offset - 4) + adjust) + else: + print '(void) memcpy((void *)(%s + %u), (void *)((%s == NULL) ? one : zero), 4);' % (pc, (param.offset - 4) + adjust, param.name) + + + pixHeaderPtr = "%s + %u" % (pc, adjust) + pcPtr = "%s + %u" % (pc, param.offset + adjust) + + if not large: + if param.img_send_null: + condition = '(compsize > 0) && (%s != NULL)' % (param.name) + else: + condition = 'compsize > 0' + + print 'if (%s) {' % (condition) + print ' (*gc->fillImage)(gc, %s, %s, %s, %s, %s, %s, %s, %s, %s);' % (dim_str, width, height, depth, param.img_format, param.img_type, param.name, pcPtr, pixHeaderPtr) + print '} else {' + print ' (void) memcpy( %s, default_pixel_store_%uD, default_pixel_store_%uD_size );' % (pixHeaderPtr, dim, dim) + print '}' + else: + print '__glXSendLargeImage(gc, compsize, %s, %s, %s, %s, %s, %s, %s, %s, %s);' % (dim_str, width, height, depth, param.img_format, param.img_type, param.name, pcPtr, pixHeaderPtr) + + return + + + def large_emit_begin(self, f, op_name = None): + if not op_name: + op_name = f.opcode_real_name() + + print 'const GLint op = %s;' % (op_name) + print 'const GLuint cmdlenLarge = cmdlen + 4;' + print 'GLubyte * const pc = __glXFlushRenderBuffer(gc, gc->pc);' + print '(void) memcpy((void *)(pc + 0), (void *)(&cmdlenLarge), 4);' + print '(void) memcpy((void *)(pc + 4), (void *)(&op), 4);' + return + + + def common_func_print_just_start(self, f, name): + print ' struct glx_context * const gc = __glXGetCurrentContext();' + + # The only reason that single and vendor private commands need + # a variable called 'dpy' is becuase they use the SyncHandle + # macro. For whatever brain-dead reason, that macro is hard- + # coded to use a variable called 'dpy' instead of taking a + # parameter. + + # FIXME Simplify the logic related to skip_condition and + # FIXME condition_list in this function. Basically, remove + # FIXME skip_condition, and just append the "dpy != NULL" type + # FIXME condition to condition_list from the start. The only + # FIXME reason it's done in this confusing way now is to + # FIXME minimize the diffs in the generated code. + + if not f.glx_rop: + for p in f.parameterIterateOutputs(): + if p.is_image() and (p.img_format != "GL_COLOR_INDEX" or p.img_type != "GL_BITMAP"): + print ' const __GLXattribute * const state = gc->client_state_private;' + break + + print ' Display * const dpy = gc->currentDpy;' + skip_condition = "dpy != NULL" + elif f.can_be_large: + skip_condition = "gc->currentDpy != NULL" + else: + skip_condition = None + + + if f.return_type != 'void': + print ' %s retval = (%s) 0;' % (f.return_type, f.return_type) + + + if name != None and name not in f.glx_vendorpriv_names: + print '#ifndef USE_XCB' + self.emit_packet_size_calculation(f, 0) + if name != None and name not in f.glx_vendorpriv_names: + print '#endif' + + condition_list = [] + for p in f.parameterIterateCounters(): + condition_list.append( "%s >= 0" % (p.name) ) + # 'counter' parameters cannot be negative + print " if (%s < 0) {" % p.name + print " __glXSetError(gc, GL_INVALID_VALUE);" + if f.return_type != 'void': + print " return 0;" + else: + print " return;" + print " }" + + if skip_condition: + condition_list.append( skip_condition ) + + if len( condition_list ) > 0: + if len( condition_list ) > 1: + skip_condition = "(%s)" % (string.join( condition_list, ") && (" )) + else: + skip_condition = "%s" % (condition_list.pop(0)) + + print ' if (__builtin_expect(%s, 1)) {' % (skip_condition) + return 1 + else: + return 0 + + + def printSingleFunction(self, f, name): + self.common_func_print_just_start(f, name) + + if self.debug: + print ' printf( "Enter %%s...\\n", "gl%s" );' % (f.name) + + if name not in f.glx_vendorpriv_names: + + # XCB specific: + print '#ifdef USE_XCB' + if self.debug: + print ' printf("\\tUsing XCB.\\n");' + print ' xcb_connection_t *c = XGetXCBConnection(dpy);' + print ' (void) __glXFlushRenderBuffer(gc, gc->pc);' + xcb_name = 'xcb_glx%s' % convertStringForXCB(name) + + iparams=[] + extra_iparams = [] + output = None + for p in f.parameterIterator(): + if p.is_output: + output = p + + if p.is_image(): + if p.img_format != "GL_COLOR_INDEX" or p.img_type != "GL_BITMAP": + extra_iparams.append("state->storePack.swapEndian") + else: + extra_iparams.append("0") + + # Hardcode this in. lsb_first param (apparently always GL_FALSE) + # also present in GetPolygonStipple, but taken care of above. + if xcb_name == "xcb_glx_read_pixels": + extra_iparams.append("0") + else: + iparams.append(p.name) + + + xcb_request = '%s(%s)' % (xcb_name, ", ".join(["c", "gc->currentContextTag"] + iparams + extra_iparams)) + + if f.needs_reply(): + print ' %s_reply_t *reply = %s_reply(c, %s, NULL);' % (xcb_name, xcb_name, xcb_request) + if output and f.reply_always_array: + print ' (void)memcpy(%s, %s_data(reply), %s_data_length(reply) * sizeof(%s));' % (output.name, xcb_name, xcb_name, output.get_base_type_string()) + + elif output and not f.reply_always_array: + if not output.is_image(): + print ' if (%s_data_length(reply) == 0)' % (xcb_name) + print ' (void)memcpy(%s, &reply->datum, sizeof(reply->datum));' % (output.name) + print ' else' + print ' (void)memcpy(%s, %s_data(reply), %s_data_length(reply) * sizeof(%s));' % (output.name, xcb_name, xcb_name, output.get_base_type_string()) + + + if f.return_type != 'void': + print ' retval = reply->ret_val;' + print ' free(reply);' + else: + print ' ' + xcb_request + ';' + print '#else' + # End of XCB specific. + + + if f.parameters != []: + pc_decl = "GLubyte const * pc =" + else: + pc_decl = "(void)" + + if name in f.glx_vendorpriv_names: + print ' %s __glXSetupVendorRequest(gc, %s, %s, cmdlen);' % (pc_decl, f.opcode_real_name(), f.opcode_vendor_name(name)) + else: + print ' %s __glXSetupSingleRequest(gc, %s, cmdlen);' % (pc_decl, f.opcode_name()) + + self.common_emit_args(f, "pc", 0, 0) + + images = f.get_images() + + for img in images: + if img.is_output: + o = f.command_fixed_length() - 4 + print ' *(int32_t *)(pc + %u) = 0;' % (o) + if img.img_format != "GL_COLOR_INDEX" or img.img_type != "GL_BITMAP": + print ' * (int8_t *)(pc + %u) = state->storePack.swapEndian;' % (o) + + if f.img_reset: + print ' * (int8_t *)(pc + %u) = %s;' % (o + 1, f.img_reset) + + + return_name = '' + if f.needs_reply(): + if f.return_type != 'void': + return_name = " retval" + return_str = " retval = (%s)" % (f.return_type) + else: + return_str = " (void)" + + got_reply = 0 + + for p in f.parameterIterateOutputs(): + if p.is_image(): + [dim, w, h, d, junk] = p.get_dimensions() + if f.dimensions_in_reply: + print " __glXReadPixelReply(dpy, gc, %u, 0, 0, 0, %s, %s, %s, GL_TRUE);" % (dim, p.img_format, p.img_type, p.name) + else: + print " __glXReadPixelReply(dpy, gc, %u, %s, %s, %s, %s, %s, %s, GL_FALSE);" % (dim, w, h, d, p.img_format, p.img_type, p.name) + + got_reply = 1 + else: + if f.reply_always_array: + aa = "GL_TRUE" + else: + aa = "GL_FALSE" + + # gl_parameter.size() returns the size + # of the entire data item. If the + # item is a fixed-size array, this is + # the size of the whole array. This + # is not what __glXReadReply wants. It + # wants the size of a single data + # element in the reply packet. + # Dividing by the array size (1 for + # non-arrays) gives us this. + + s = p.size() / p.get_element_count() + print " %s __glXReadReply(dpy, %s, %s, %s);" % (return_str, s, p.name, aa) + got_reply = 1 + + + # If a reply wasn't read to fill an output parameter, + # read a NULL reply to get the return value. + + if not got_reply: + print " %s __glXReadReply(dpy, 0, NULL, GL_FALSE);" % (return_str) + + + elif self.debug: + # Only emit the extra glFinish call for functions + # that don't already require a reply from the server. + print ' __indirect_glFinish();' + + if self.debug: + print ' printf( "Exit %%s.\\n", "gl%s" );' % (name) + + + print ' UnlockDisplay(dpy); SyncHandle();' + + if name not in f.glx_vendorpriv_names: + print '#endif /* USE_XCB */' + + print ' }' + print ' return%s;' % (return_name) + return + + + def printPixelFunction(self, f): + if self.pixel_stubs.has_key( f.name ): + # Normally gl_function::get_parameter_string could be + # used. However, this call needs to have the missing + # dimensions (e.g., a fake height value for + # glTexImage1D) added in. + + p_string = "" + for param in f.parameterIterateGlxSend(): + if param.is_padding: + continue + + p_string += ", " + param.name + + if param.is_image(): + [dim, junk, junk, junk, junk] = param.get_dimensions() + + if f.pad_after(param): + p_string += ", 1" + + print ' %s(%s, %u%s );' % (self.pixel_stubs[f.name] , f.opcode_name(), dim, p_string) + return + + + if self.common_func_print_just_start(f, None): + trailer = " }" + else: + trailer = None + + + if f.can_be_large: + print 'if (cmdlen <= gc->maxSmallRenderCommandSize) {' + print ' if ( (gc->pc + cmdlen) > gc->bufEnd ) {' + print ' (void) __glXFlushRenderBuffer(gc, gc->pc);' + print ' }' + + if f.glx_rop == ~0: + opcode = "opcode" + else: + opcode = f.opcode_real_name() + + print 'emit_header(gc->pc, %s, cmdlen);' % (opcode) + + self.pixel_emit_args( f, "gc->pc", 0 ) + print 'gc->pc += cmdlen;' + print 'if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }' + + if f.can_be_large: + print '}' + print 'else {' + + self.large_emit_begin(f, opcode) + self.pixel_emit_args(f, "pc", 1) + + print '}' + + if trailer: print trailer + return + + + def printRenderFunction(self, f): + # There is a class of GL functions that take a single pointer + # as a parameter. This pointer points to a fixed-size chunk + # of data, and the protocol for this functions is very + # regular. Since they are so regular and there are so many + # of them, special case them with generic functions. On + # x86, this saves about 26KB in the libGL.so binary. + + if f.variable_length_parameter() == None and len(f.parameters) == 1: + p = f.parameters[0] + if p.is_pointer(): + cmdlen = f.command_fixed_length() + if cmdlen in self.generic_sizes: + print ' generic_%u_byte( %s, %s );' % (cmdlen, f.opcode_real_name(), p.name) + return + + if self.common_func_print_just_start(f, None): + trailer = " }" + else: + trailer = None + + if self.debug: + print 'printf( "Enter %%s...\\n", "gl%s" );' % (f.name) + + if f.can_be_large: + print 'if (cmdlen <= gc->maxSmallRenderCommandSize) {' + print ' if ( (gc->pc + cmdlen) > gc->bufEnd ) {' + print ' (void) __glXFlushRenderBuffer(gc, gc->pc);' + print ' }' + + print 'emit_header(gc->pc, %s, cmdlen);' % (f.opcode_real_name()) + + self.common_emit_args(f, "gc->pc", 4, 0) + print 'gc->pc += cmdlen;' + print 'if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }' + + if f.can_be_large: + print '}' + print 'else {' + + self.large_emit_begin(f) + self.common_emit_args(f, "pc", 8, 1) + + p = f.variable_length_parameter() + print ' __glXSendLargeCommand(gc, pc, %u, %s, %s);' % (p.offset + 8, p.name, p.size_string()) + print '}' + + if self.debug: + print '__indirect_glFinish();' + print 'printf( "Exit %%s.\\n", "gl%s" );' % (f.name) + + if trailer: print trailer + return + + +class PrintGlxProtoInit_c(gl_XML.gl_print_base): + def __init__(self): + gl_XML.gl_print_base.__init__(self) + + self.name = "glX_proto_send.py (from Mesa)" + self.license = license.bsd_license_template % ( \ +"""Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. +(C) Copyright IBM Corporation 2004""", "PRECISION INSIGHT, IBM") + return + + + def printRealHeader(self): + print """/** + * \\file indirect_init.c + * Initialize indirect rendering dispatch table. + * + * \\author Kevin E. Martin <kevin@precisioninsight.com> + * \\author Brian Paul <brian@precisioninsight.com> + * \\author Ian Romanick <idr@us.ibm.com> + */ + +#include "indirect_init.h" +#include "indirect.h" +#include "glapi.h" + + +/** + * No-op function used to initialize functions that have no GLX protocol + * support. + */ +static int NoOp(void) +{ + return 0; +} + +/** + * Create and initialize a new GL dispatch table. The table is initialized + * with GLX indirect rendering protocol functions. + */ +struct _glapi_table * __glXNewIndirectAPI( void ) +{ + struct _glapi_table *glAPI; + GLuint entries; + + entries = _glapi_get_dispatch_table_size(); + glAPI = (struct _glapi_table *) Xmalloc(entries * sizeof(void *)); + + /* first, set all entries to point to no-op functions */ + { + int i; + void **dispatch = (void **) glAPI; + for (i = 0; i < entries; i++) { + dispatch[i] = (void *) NoOp; + } + } + + /* now, initialize the entries we understand */""" + + def printRealFooter(self): + print """ + return glAPI; +} +""" + return + + + def printBody(self, api): + for [name, number] in api.categoryIterate(): + if number != None: + preamble = '\n /* %3u. %s */\n\n' % (int(number), name) + else: + preamble = '\n /* %s */\n\n' % (name) + + for func in api.functionIterateByCategory(name): + if func.client_supported_for_indirect(): + print '%s glAPI->%s = __indirect_gl%s;' % (preamble, func.name, func.name) + preamble = '' + + return + + +class PrintGlxProtoInit_h(gl_XML.gl_print_base): + def __init__(self): + gl_XML.gl_print_base.__init__(self) + + self.name = "glX_proto_send.py (from Mesa)" + self.license = license.bsd_license_template % ( \ +"""Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. +(C) Copyright IBM Corporation 2004""", "PRECISION INSIGHT, IBM") + self.header_tag = "_INDIRECT_H_" + + self.last_category = "" + return + + + def printRealHeader(self): + print """/** + * \\file + * Prototypes for indirect rendering functions. + * + * \\author Kevin E. Martin <kevin@precisioninsight.com> + * \\author Ian Romanick <idr@us.ibm.com> + */ +""" + self.printVisibility( "HIDDEN", "hidden" ) + self.printFastcall() + self.printNoinline() + + print """ +#include "glxclient.h" + +extern HIDDEN NOINLINE CARD32 __glXReadReply( Display *dpy, size_t size, + void * dest, GLboolean reply_is_always_array ); + +extern HIDDEN NOINLINE void __glXReadPixelReply( Display *dpy, + struct glx_context * gc, unsigned max_dim, GLint width, GLint height, + GLint depth, GLenum format, GLenum type, void * dest, + GLboolean dimensions_in_reply ); + +extern HIDDEN NOINLINE FASTCALL GLubyte * __glXSetupSingleRequest( + struct glx_context * gc, GLint sop, GLint cmdlen ); + +extern HIDDEN NOINLINE FASTCALL GLubyte * __glXSetupVendorRequest( + struct glx_context * gc, GLint code, GLint vop, GLint cmdlen ); +""" + + + def printBody(self, api): + for func in api.functionIterateGlx(): + params = func.get_parameter_string() + + print 'extern HIDDEN %s __indirect_gl%s(%s);' % (func.return_type, func.name, params) + + for n in func.entry_points: + if func.has_different_protocol(n): + asdf = func.static_glx_name(n) + if asdf not in func.static_entry_points: + print 'extern HIDDEN %s gl%s(%s);' % (func.return_type, asdf, params) + # give it a easy-to-remember name + if func.client_handcode: + print '#define gl_dispatch_stub_%s gl%s' % (n, asdf) + else: + print 'GLAPI %s GLAPIENTRY gl%s(%s);' % (func.return_type, asdf, params) + + break + + print '' + print '#ifdef GLX_SHARED_GLAPI' + print 'extern HIDDEN void (*__indirect_get_proc_address(const char *name))(void);' + print '#endif' + + +def show_usage(): + print "Usage: %s [-f input_file_name] [-m output_mode] [-d]" % sys.argv[0] + print " -m output_mode Output mode can be one of 'proto', 'init_c' or 'init_h'." + print " -d Enable extra debug information in the generated code." + sys.exit(1) + + +if __name__ == '__main__': + file_name = "gl_API.xml" + + try: + (args, trail) = getopt.getopt(sys.argv[1:], "f:m:d") + except Exception,e: + show_usage() + + debug = 0 + mode = "proto" + for (arg,val) in args: + if arg == "-f": + file_name = val + elif arg == "-m": + mode = val + elif arg == "-d": + debug = 1 + + if mode == "proto": + printer = PrintGlxProtoStubs() + elif mode == "init_c": + printer = PrintGlxProtoInit_c() + elif mode == "init_h": + printer = PrintGlxProtoInit_h() + else: + show_usage() + + + printer.debug = debug + api = gl_XML.parse_GL_API( file_name, glX_XML.glx_item_factory() ) + + printer.Print( api ) diff --git a/mesalib/src/mapi/glapi/gen/gl_and_es_API.xml b/mesalib/src/mapi/glapi/gen/gl_and_es_API.xml new file mode 100644 index 000000000..ac7d43ced --- /dev/null +++ b/mesalib/src/mapi/glapi/gen/gl_and_es_API.xml @@ -0,0 +1,286 @@ +<?xml version="1.0"?> +<!DOCTYPE OpenGLAPI SYSTEM "gl_API.dtd"> + +<!-- OpenGL + OpenGL ES --> + +<OpenGLAPI> + +<xi:include href="gl_API.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> + +<!-- these can be moved to gl_API.xml --> +<xi:include href="ARB_get_program_binary.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> +<xi:include href="OES_fixed_point.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> +<xi:include href="OES_single_precision.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> + +<category name="es1.0"> + <!-- from GL_OES_fixed_point --> + <enum name="FIXED" value="0x140C"/> + + <type name="fixed" size="4" /> + <type name="clampx" size="4" /> + + <function name="AlphaFuncx" alias="AlphaFuncxOES" static_dispatch="false"> + <param name="func" type="GLenum"/> + <param name="ref" type="GLclampx"/> + </function> + + <function name="ClearColorx" alias="ClearColorxOES" static_dispatch="false"> + <param name="red" type="GLclampx"/> + <param name="green" type="GLclampx"/> + <param name="blue" type="GLclampx"/> + <param name="alpha" type="GLclampx"/> + </function> + + <function name="ClearDepthx" alias="ClearDepthxOES" static_dispatch="false"> + <param name="depth" type="GLclampx"/> + </function> + + <function name="Color4x" alias="Color4xOES" static_dispatch="false"> + <param name="red" type="GLfixed"/> + <param name="green" type="GLfixed"/> + <param name="blue" type="GLfixed"/> + <param name="alpha" type="GLfixed"/> + </function> + + <function name="DepthRangex" alias="DepthRangexOES" static_dispatch="false"> + <param name="zNear" type="GLclampx"/> + <param name="zFar" type="GLclampx"/> + </function> + + <function name="Fogx" alias="FogxOES" static_dispatch="false"> + <param name="pname" type="GLenum"/> + <param name="param" type="GLfixed"/> + </function> + + <function name="Fogxv" alias="FogxvOES" static_dispatch="false"> + <param name="pname" type="GLenum"/> + <param name="params" type="const GLfixed *" variable_param="pname"/> + </function> + + <function name="Frustumx" alias="FrustumxOES" static_dispatch="false"> + <param name="left" type="GLfixed"/> + <param name="right" type="GLfixed"/> + <param name="bottom" type="GLfixed"/> + <param name="top" type="GLfixed"/> + <param name="zNear" type="GLfixed"/> + <param name="zFar" type="GLfixed"/> + </function> + + <function name="LightModelx" alias="LightModelxOES" static_dispatch="false"> + <param name="pname" type="GLenum"/> + <param name="param" type="GLfixed"/> + </function> + + <function name="LightModelxv" alias="LightModelxvOES" static_dispatch="false"> + <param name="pname" type="GLenum"/> + <param name="params" type="const GLfixed *" variable_param="pname"/> + </function> + + <function name="Lightx" alias="LightxOES" static_dispatch="false"> + <param name="light" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="param" type="GLfixed"/> + </function> + + <function name="Lightxv" alias="LightxvOES" static_dispatch="false"> + <param name="light" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="const GLfixed *" variable_param="pname"/> + </function> + + <function name="LineWidthx" alias="LineWidthxOES" static_dispatch="false"> + <param name="width" type="GLfixed"/> + </function> + + <function name="LoadMatrixx" alias="LoadMatrixxOES" static_dispatch="false"> + <param name="m" type="const GLfixed *" count="16"/> + </function> + + <function name="Materialx" alias="MaterialxOES" static_dispatch="false"> + <param name="face" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="param" type="GLfixed"/> + </function> + + <function name="Materialxv" alias="MaterialxvOES" static_dispatch="false"> + <param name="face" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="const GLfixed *" variable_param="pname"/> + </function> + + <function name="MultMatrixx" alias="MultMatrixxOES" static_dispatch="false"> + <param name="m" type="const GLfixed *" count="16"/> + </function> + + <function name="MultiTexCoord4x" alias="MultiTexCoord4xOES" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="s" type="GLfixed"/> + <param name="t" type="GLfixed"/> + <param name="r" type="GLfixed"/> + <param name="q" type="GLfixed"/> + </function> + + <function name="Normal3x" alias="Normal3xOES" static_dispatch="false"> + <param name="nx" type="GLfixed"/> + <param name="ny" type="GLfixed"/> + <param name="nz" type="GLfixed"/> + </function> + + <function name="Orthox" alias="OrthoxOES" static_dispatch="false"> + <param name="left" type="GLfixed"/> + <param name="right" type="GLfixed"/> + <param name="bottom" type="GLfixed"/> + <param name="top" type="GLfixed"/> + <param name="zNear" type="GLfixed"/> + <param name="zFar" type="GLfixed"/> + </function> + + <function name="PointSizex" alias="PointSizexOES" static_dispatch="false"> + <param name="size" type="GLfixed"/> + </function> + + <function name="PolygonOffsetx" alias="PolygonOffsetxOES" static_dispatch="false"> + <param name="factor" type="GLfixed"/> + <param name="units" type="GLfixed"/> + </function> + + <function name="Rotatex" alias="RotatexOES" static_dispatch="false"> + <param name="angle" type="GLfixed"/> + <param name="x" type="GLfixed"/> + <param name="y" type="GLfixed"/> + <param name="z" type="GLfixed"/> + </function> + + <function name="SampleCoveragex" alias="SampleCoveragexOES" static_dispatch="false"> + <param name="value" type="GLclampx"/> + <param name="invert" type="GLboolean"/> + </function> + + <function name="Scalex" alias="ScalexOES" static_dispatch="false"> + <param name="x" type="GLfixed"/> + <param name="y" type="GLfixed"/> + <param name="z" type="GLfixed"/> + </function> + + <function name="TexEnvx" alias="TexEnvxOES" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="param" type="GLfixed"/> + </function> + + <function name="TexEnvxv" alias="TexEnvxvOES" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="const GLfixed *" variable_param="pname"/> + </function> + + <function name="TexParameterx" alias="TexParameterxOES" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="param" type="GLfixed"/> + </function> + + <function name="Translatex" alias="TranslatexOES" static_dispatch="false"> + <param name="x" type="GLfixed"/> + <param name="y" type="GLfixed"/> + <param name="z" type="GLfixed"/> + </function> + + <!-- from GL_OES_single_precision --> + <function name="Frustumf" alias="FrustumfOES" static_dispatch="false"> + <param name="left" type="GLfloat"/> + <param name="right" type="GLfloat"/> + <param name="bottom" type="GLfloat"/> + <param name="top" type="GLfloat"/> + <param name="zNear" type="GLfloat"/> + <param name="zFar" type="GLfloat"/> + </function> + + <function name="Orthof" alias="OrthofOES" static_dispatch="false"> + <param name="left" type="GLfloat"/> + <param name="right" type="GLfloat"/> + <param name="bottom" type="GLfloat"/> + <param name="top" type="GLfloat"/> + <param name="zNear" type="GLfloat"/> + <param name="zFar" type="GLfloat"/> + </function> +</category> + +<category name="es1.1"> + <!-- from GL_OES_fixed_point --> + <function name="ClipPlanex" alias="ClipPlanexOES" static_dispatch="false"> + <param name="plane" type="GLenum"/> + <param name="equation" type="const GLfixed *" count="4"/> + </function> + + <function name="GetClipPlanex" alias="GetClipPlanexOES" static_dispatch="false"> + <param name="plane" type="GLenum"/> + <param name="equation" type="GLfixed *" output="true" count="4"/> + </function> + + <function name="GetFixedv" alias="GetFixedvOES" static_dispatch="false"> + <param name="pname" type="GLenum"/> + <param name="params" type="GLfixed *" output="true" variable_param="pname"/> + </function> + + <function name="GetLightxv" alias="GetLightxvOES" static_dispatch="false"> + <param name="light" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="GLfixed *" output="true" variable_param="pname"/> + </function> + + <function name="GetMaterialxv" alias="GetMaterialxvOES" static_dispatch="false"> + <param name="face" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="GLfixed *" output="true" variable_param="pname"/> + </function> + + <function name="GetTexEnvxv" alias="GetTexEnvxvOES" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="GLfixed *" output="true" variable_param="pname"/> + </function> + + <function name="GetTexParameterxv" alias="GetTexParameterxvOES" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="GLfixed *" output="true" variable_param="pname"/> + </function> + + <function name="PointParameterx" alias="PointParameterxOES" static_dispatch="false"> + <param name="pname" type="GLenum"/> + <param name="param" type="GLfixed"/> + </function> + + <function name="PointParameterxv" alias="PointParameterxvOES" static_dispatch="false"> + <param name="pname" type="GLenum"/> + <param name="params" type="const GLfixed *"/> + </function> + + <function name="TexParameterxv" alias="TexParameterxvOES" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="const GLfixed *" variable_param="pname"/> + </function> + + <!-- from GL_OES_single_precision --> + <function name="ClipPlanef" alias="ClipPlanefOES" static_dispatch="false"> + <param name="plane" type="GLenum"/> + <param name="equation" type="const GLfloat *" count="4"/> + </function> + + <function name="GetClipPlanef" alias="GetClipPlanefOES" static_dispatch="false"> + <param name="plane" type="GLenum"/> + <param name="equation" type="GLfloat *" output="true" count="4"/> + </function> +</category> + +<category name="es2.0"> + <!-- enums missing from GL_ARB_framebuffer_object and GL_EXT_framebuffer_object --> + <enum name="FRAMEBUFFER_INCOMPLETE_DIMENSIONS" value="0x8CD9"/> + <enum name="RGB565" value="0x8D62"/> +</category> + +<xi:include href="es_EXT.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> + +</OpenGLAPI> diff --git a/mesalib/src/mapi/glapi/gen/gl_enums.py b/mesalib/src/mapi/glapi/gen/gl_enums.py index 0caa01030..d51b74a4a 100644 --- a/mesalib/src/mapi/glapi/gen/gl_enums.py +++ b/mesalib/src/mapi/glapi/gen/gl_enums.py @@ -46,6 +46,7 @@ class PrintGlEnums(gl_XML.gl_print_base): print '#include "main/mfeatures.h"' print '#include "main/enums.h"' print '#include "main/imports.h"' + print '#include "main/mtypes.h"' print '' print 'typedef struct {' print ' size_t offset;' @@ -111,29 +112,39 @@ const char *_mesa_lookup_enum_by_nr( int nr ) } } +/** + * Primitive names + */ +static const char *prim_names[PRIM_UNKNOWN + 1] = { + "GL_POINTS", + "GL_LINES", + "GL_LINE_LOOP", + "GL_LINE_STRIP", + "GL_TRIANGLES", + "GL_TRIANGLE_STRIP", + "GL_TRIANGLE_FAN", + "GL_QUADS", + "GL_QUAD_STRIP", + "GL_POLYGON", + "outside begin/end", + "inside unknown primitive", + "unknown state" +}; + + /* Get the name of an enum given that it is a primitive type. Avoids * GL_FALSE/GL_POINTS ambiguity and others. */ -const char *_mesa_lookup_prim_by_nr( int nr ) +const char * +_mesa_lookup_prim_by_nr(GLuint nr) { - switch (nr) { - case GL_POINTS: return "GL_POINTS"; - case GL_LINES: return "GL_LINES"; - case GL_LINE_STRIP: return "GL_LINE_STRIP"; - case GL_LINE_LOOP: return "GL_LINE_LOOP"; - case GL_TRIANGLES: return "GL_TRIANGLES"; - case GL_TRIANGLE_STRIP: return "GL_TRIANGLE_STRIP"; - case GL_TRIANGLE_FAN: return "GL_TRIANGLE_FAN"; - case GL_QUADS: return "GL_QUADS"; - case GL_QUAD_STRIP: return "GL_QUAD_STRIP"; - case GL_POLYGON: return "GL_POLYGON"; - case GL_POLYGON+1: return "OUTSIDE_BEGIN_END"; - default: return "<invalid>"; - } + if (nr < Elements(prim_names)) + return prim_names[nr]; + else + return "invalid mode"; } - int _mesa_lookup_enum_by_name( const char *symbol ) { enum_elt * f = NULL; |