diff options
author | marha <marha@users.sourceforge.net> | 2011-12-14 14:08:20 +0100 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2011-12-14 14:08:20 +0100 |
commit | 7c06219c5953076ef3236b6a8959b99329c77ee9 (patch) | |
tree | c4b00bb9d592afcdffdb3e98c7c7320e29488adb /mesalib/src/mapi/glapi/gen | |
parent | 2b5652fc7742c5ac57aca701214b046626a729e9 (diff) | |
parent | 53d28537755790ee4625dc16f560cad5aa93f56b (diff) | |
download | vcxsrv-7c06219c5953076ef3236b6a8959b99329c77ee9.tar.gz vcxsrv-7c06219c5953076ef3236b6a8959b99329c77ee9.tar.bz2 vcxsrv-7c06219c5953076ef3236b6a8959b99329c77ee9.zip |
Merge remote-tracking branch 'origin/released'
Conflicts:
mesalib/src/mapi/glapi/gen/EXT_gpu_shader4.xml
mesalib/src/mapi/glapi/gen/glX_proto_recv.py
mesalib/src/mapi/glapi/gen/glX_proto_size.py
mesalib/src/mapi/glapi/gen/gl_gentable.py
mesalib/src/mapi/glapi/gen/gl_table.py
Diffstat (limited to 'mesalib/src/mapi/glapi/gen')
-rw-r--r-- | mesalib/src/mapi/glapi/gen/EXT_gpu_shader4.xml | 493 | ||||
-rw-r--r-- | mesalib/src/mapi/glapi/gen/Makefile | 13 | ||||
-rw-r--r-- | mesalib/src/mapi/glapi/gen/glX_proto_recv.py | 1133 | ||||
-rw-r--r-- | mesalib/src/mapi/glapi/gen/glX_proto_send.py | 16 | ||||
-rw-r--r-- | mesalib/src/mapi/glapi/gen/glX_proto_size.py | 18 | ||||
-rw-r--r-- | mesalib/src/mapi/glapi/gen/gl_gentable.py | 37 | ||||
-rw-r--r-- | mesalib/src/mapi/glapi/gen/gl_table.py | 4 |
7 files changed, 868 insertions, 846 deletions
diff --git a/mesalib/src/mapi/glapi/gen/EXT_gpu_shader4.xml b/mesalib/src/mapi/glapi/gen/EXT_gpu_shader4.xml index 1d5d9d8bd..bf2f6a3ed 100644 --- a/mesalib/src/mapi/glapi/gen/EXT_gpu_shader4.xml +++ b/mesalib/src/mapi/glapi/gen/EXT_gpu_shader4.xml @@ -1,244 +1,249 @@ -<?xml version="1.0"?>
-<!DOCTYPE OpenGLAPI SYSTEM "gl_API.dtd">
-
-<OpenGLAPI>
-
-<category name="GL_EXT_gpu_shader4" number="326">
-
- <enum name="VERTEX_ATTRIB_ARRAY_INTEGER_EXT" value="0x88FD"/>
- <enum name="SAMPLER_1D_ARRAY_EXT" value="0x8DC0"/>
- <enum name="SAMPLER_2D_ARRAY_EXT" value="0x8DC1"/>
- <enum name="SAMPLER_BUFFER_EXT" value="0x8DC2"/>
- <enum name="SAMPLER_1D_ARRAY_SHADOW_EXT" value="0x8DC3"/>
- <enum name="SAMPLER_2D_ARRAY_SHADOW_EXT" value="0x8DC4"/>
- <enum name="SAMPLER_CUBE_SHADOW_EXT" value="0x8DC5"/>
- <enum name="UNSIGNED_INT_VEC2_EXT" value="0x8DC6"/>
- <enum name="UNSIGNED_INT_VEC3_EXT" value="0x8DC7"/>
- <enum name="UNSIGNED_INT_VEC4_EXT" value="0x8DC8"/>
- <enum name="INT_SAMPLER_1D_EXT" value="0x8DC9"/>
- <enum name="INT_SAMPLER_2D_EXT" value="0x8DCA"/>
- <enum name="INT_SAMPLER_3D_EXT" value="0x8DCB"/>
- <enum name="INT_SAMPLER_CUBE_EXT" value="0x8DCC"/>
- <enum name="INT_SAMPLER_2D_RECT_EXT" value="0x8DCD"/>
- <enum name="INT_SAMPLER_1D_ARRAY_EXT" value="0x8DCE"/>
- <enum name="INT_SAMPLER_2D_ARRAY_EXT" value="0x8DCF"/>
- <enum name="INT_SAMPLER_BUFFER_EXT" value="0x8DD0"/>
- <enum name="UNSIGNED_INT_SAMPLER_1D_EXT" value="0x8DD1"/>
- <enum name="UNSIGNED_INT_SAMPLER_2D_EXT" value="0x8DD2"/>
- <enum name="UNSIGNED_INT_SAMPLER_3D_EXT" value="0x8DD3"/>
- <enum name="UNSIGNED_INT_SAMPLER_CUBE_EXT" value="0x8DD4"/>
- <enum name="UNSIGNED_INT_SAMPLER_2D_RECT_EXT" value="0x8DD5"/>
- <enum name="UNSIGNED_INT_SAMPLER_1D_ARRAY_EXT" value="0x8DD6"/>
- <enum name="UNSIGNED_INT_SAMPLER_2D_ARRAY_EXT" value="0x8DD7"/>
- <enum name="UNSIGNED_INT_SAMPLER_BUFFER_EXT" value="0x8DD8"/>
- <enum name="MIN_PROGRAM_TEXEL_OFFSET" value="0x8904">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="MAX_PROGRAM_TEXEL_OFFSET" value="0x8905">
- <size name="Get" mode="get"/>
- </enum>
-
-
- <function name="VertexAttribI1iEXT" offset="assign">
- <param name="index" type="GLuint"/>
- <param name="x" type="GLint"/>
- </function>
-
- <function name="VertexAttribI2iEXT" offset="assign">
- <param name="index" type="GLuint"/>
- <param name="x" type="GLint"/>
- <param name="y" type="GLint"/>
- </function>
-
- <function name="VertexAttribI3iEXT" offset="assign">
- <param name="index" type="GLuint"/>
- <param name="x" type="GLint"/>
- <param name="y" type="GLint"/>
- <param name="z" type="GLint"/>
- </function>
-
- <function name="VertexAttribI4iEXT" offset="assign">
- <param name="index" type="GLuint"/>
- <param name="x" type="GLint"/>
- <param name="y" type="GLint"/>
- <param name="z" type="GLint"/>
- <param name="w" type="GLint"/>
- </function>
-
- <function name="VertexAttribI1uiEXT" offset="assign">
- <param name="index" type="GLuint"/>
- <param name="x" type="GLuint"/>
- </function>
-
- <function name="VertexAttribI2uiEXT" offset="assign">
- <param name="index" type="GLuint"/>
- <param name="x" type="GLuint"/>
- <param name="y" type="GLuint"/>
- </function>
-
- <function name="VertexAttribI3uiEXT" offset="assign">
- <param name="index" type="GLuint"/>
- <param name="x" type="GLuint"/>
- <param name="y" type="GLuint"/>
- <param name="z" type="GLuint"/>
- </function>
-
- <function name="VertexAttribI4uiEXT" offset="assign">
- <param name="index" type="GLuint"/>
- <param name="x" type="GLuint"/>
- <param name="y" type="GLuint"/>
- <param name="z" type="GLuint"/>
- <param name="w" type="GLuint"/>
- </function>
-
- <function name="VertexAttribI1ivEXT" offset="assign">
- <param name="index" type="GLuint"/>
- <param name="v" type="const GLint *"/>
- </function>
-
- <function name="VertexAttribI2ivEXT" offset="assign">
- <param name="index" type="GLuint"/>
- <param name="v" type="const GLint *"/>
- </function>
-
- <function name="VertexAttribI3ivEXT" offset="assign">
- <param name="index" type="GLuint"/>
- <param name="v" type="const GLint *"/>
- </function>
-
- <function name="VertexAttribI4ivEXT" offset="assign">
- <param name="index" type="GLuint"/>
- <param name="v" type="const GLint *"/>
- </function>
-
- <function name="VertexAttribI1uivEXT" offset="assign">
- <param name="index" type="GLuint"/>
- <param name="v" type="const GLuint *"/>
- </function>
-
- <function name="VertexAttribI2uivEXT" offset="assign">
- <param name="index" type="GLuint"/>
- <param name="v" type="const GLuint *"/>
- </function>
-
- <function name="VertexAttribI3uivEXT" offset="assign">
- <param name="index" type="GLuint"/>
- <param name="v" type="const GLuint *"/>
- </function>
-
- <function name="VertexAttribI4uivEXT" offset="assign">
- <param name="index" type="GLuint"/>
- <param name="v" type="const GLuint *"/>
- </function>
-
- <function name="VertexAttribI4bvEXT" offset="assign">
- <param name="index" type="GLuint"/>
- <param name="v" type="const GLbyte *"/>
- </function>
-
- <function name="VertexAttribI4svEXT" offset="assign">
- <param name="index" type="GLuint"/>
- <param name="v" type="const GLshort *"/>
- </function>
-
- <function name="VertexAttribI4ubvEXT" offset="assign">
- <param name="index" type="GLuint"/>
- <param name="v" type="const GLubyte *"/>
- </function>
-
- <function name="VertexAttribI4usvEXT" offset="assign">
- <param name="index" type="GLuint"/>
- <param name="v" type="const GLushort *"/>
- </function>
-
- <function name="VertexAttribIPointerEXT" offset="assign">
- <param name="index" type="GLuint"/>
- <param name="size" type="GLint"/>
- <param name="type" type="GLenum"/>
- <param name="stride" type="GLsizei"/>
- <param name="pointer" type="const GLvoid *"/>
- </function>
-
- <function name="GetVertexAttribIivEXT" offset="assign">
- <param name="index" type="GLuint"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLint *"/>
- </function>
-
- <function name="GetVertexAttribIuivEXT" offset="assign">
- <param name="index" type="GLuint"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLuint *"/>
- </function>
-
- <function name="Uniform1uiEXT" offset="assign">
- <param name="location" type="GLint"/>
- <param name="x" type="GLuint"/>
- </function>
-
- <function name="Uniform2uiEXT" offset="assign">
- <param name="location" type="GLint"/>
- <param name="x" type="GLuint"/>
- <param name="y" type="GLuint"/>
- </function>
-
- <function name="Uniform3uiEXT" offset="assign">
- <param name="location" type="GLint"/>
- <param name="x" type="GLuint"/>
- <param name="y" type="GLuint"/>
- <param name="z" type="GLuint"/>
- </function>
-
- <function name="Uniform4uiEXT" offset="assign">
- <param name="location" type="GLint"/>
- <param name="x" type="GLuint"/>
- <param name="y" type="GLuint"/>
- <param name="z" type="GLuint"/>
- <param name="w" type="GLuint"/>
- </function>
-
- <function name="Uniform1uivEXT" offset="assign">
- <param name="location" type="GLint"/>
- <param name="count" type="GLsizei"/>
- <param name="value" type="const GLuint *"/>
- </function>
-
- <function name="Uniform2uivEXT" offset="assign">
- <param name="location" type="GLint"/>
- <param name="count" type="GLsizei"/>
- <param name="value" type="const GLuint *"/>
- </function>
-
- <function name="Uniform3uivEXT" offset="assign">
- <param name="location" type="GLint"/>
- <param name="count" type="GLsizei"/>
- <param name="value" type="const GLuint *"/>
- </function>
-
- <function name="Uniform4uivEXT" offset="assign">
- <param name="location" type="GLint"/>
- <param name="count" type="GLsizei"/>
- <param name="value" type="const GLuint *"/>
- </function>
-
- <function name="GetUniformuivEXT" offset="assign">
- <param name="program" type="GLuint"/>
- <param name="location" type="GLint"/>
- <param name="params" type="GLuint *"/>
- </function>
-
- <function name="BindFragDataLocationEXT" offset="assign">
- <param name="program" type="GLuint"/>
- <param name="colorNumber" type="GLuint"/>
- <param name="name" type="const GLchar *"/>
- </function>
-
- <function name="GetFragDataLocationEXT" offset="assign">
- <return type="GLint"/>
- <param name="program" type="GLuint"/>
- <param name="name" type="const GLchar *"/>
- </function>
-
-</category>
-
-</OpenGLAPI>
+<?xml version="1.0"?> +<!DOCTYPE OpenGLAPI SYSTEM "gl_API.dtd"> + +<OpenGLAPI> + +<category name="GL_EXT_gpu_shader4" number="326"> + + <enum name="VERTEX_ATTRIB_ARRAY_INTEGER_EXT" value="0x88FD"/> + <enum name="SAMPLER_1D_ARRAY_EXT" value="0x8DC0"/> + <enum name="SAMPLER_2D_ARRAY_EXT" value="0x8DC1"/> + <enum name="SAMPLER_BUFFER_EXT" value="0x8DC2"/> + <enum name="SAMPLER_1D_ARRAY_SHADOW_EXT" value="0x8DC3"/> + <enum name="SAMPLER_2D_ARRAY_SHADOW_EXT" value="0x8DC4"/> + <enum name="SAMPLER_CUBE_SHADOW_EXT" value="0x8DC5"/> + <enum name="UNSIGNED_INT_VEC2_EXT" value="0x8DC6"/> + <enum name="UNSIGNED_INT_VEC3_EXT" value="0x8DC7"/> + <enum name="UNSIGNED_INT_VEC4_EXT" value="0x8DC8"/> + <enum name="INT_SAMPLER_1D_EXT" value="0x8DC9"/> + <enum name="INT_SAMPLER_2D_EXT" value="0x8DCA"/> + <enum name="INT_SAMPLER_3D_EXT" value="0x8DCB"/> + <enum name="INT_SAMPLER_CUBE_EXT" value="0x8DCC"/> + <enum name="INT_SAMPLER_2D_RECT_EXT" value="0x8DCD"/> + <enum name="INT_SAMPLER_1D_ARRAY_EXT" value="0x8DCE"/> + <enum name="INT_SAMPLER_2D_ARRAY_EXT" value="0x8DCF"/> + <enum name="INT_SAMPLER_BUFFER_EXT" value="0x8DD0"/> + <enum name="UNSIGNED_INT_SAMPLER_1D_EXT" value="0x8DD1"/> + <enum name="UNSIGNED_INT_SAMPLER_2D_EXT" value="0x8DD2"/> + <enum name="UNSIGNED_INT_SAMPLER_3D_EXT" value="0x8DD3"/> + <enum name="UNSIGNED_INT_SAMPLER_CUBE_EXT" value="0x8DD4"/> + <enum name="UNSIGNED_INT_SAMPLER_2D_RECT_EXT" value="0x8DD5"/> + <enum name="UNSIGNED_INT_SAMPLER_1D_ARRAY_EXT" value="0x8DD6"/> + <enum name="UNSIGNED_INT_SAMPLER_2D_ARRAY_EXT" value="0x8DD7"/> + <enum name="UNSIGNED_INT_SAMPLER_BUFFER_EXT" value="0x8DD8"/> + + <!-- There is no MIN_PROGRAM_TEXEL_OFFSET_EXT in glext.h. There is + MIN_PROGRAM_TEXEL_OFFSET_NV and MIN_PROGRAM_TEXEL_OFFSET (OpenGL + 3.0). Same goes for MAX_PROGRAM_TEXEL_OFFSET_EXT. + --> + <enum name="MIN_PROGRAM_TEXEL_OFFSET" value="0x8904"> + <size name="Get" mode="get"/> + </enum> + <enum name="MAX_PROGRAM_TEXEL_OFFSET" value="0x8905"> + <size name="Get" mode="get"/> + </enum> + + + <function name="VertexAttribI1iEXT" offset="assign"> + <param name="index" type="GLuint"/> + <param name="x" type="GLint"/> + </function> + + <function name="VertexAttribI2iEXT" offset="assign"> + <param name="index" type="GLuint"/> + <param name="x" type="GLint"/> + <param name="y" type="GLint"/> + </function> + + <function name="VertexAttribI3iEXT" offset="assign"> + <param name="index" type="GLuint"/> + <param name="x" type="GLint"/> + <param name="y" type="GLint"/> + <param name="z" type="GLint"/> + </function> + + <function name="VertexAttribI4iEXT" offset="assign"> + <param name="index" type="GLuint"/> + <param name="x" type="GLint"/> + <param name="y" type="GLint"/> + <param name="z" type="GLint"/> + <param name="w" type="GLint"/> + </function> + + <function name="VertexAttribI1uiEXT" offset="assign"> + <param name="index" type="GLuint"/> + <param name="x" type="GLuint"/> + </function> + + <function name="VertexAttribI2uiEXT" offset="assign"> + <param name="index" type="GLuint"/> + <param name="x" type="GLuint"/> + <param name="y" type="GLuint"/> + </function> + + <function name="VertexAttribI3uiEXT" offset="assign"> + <param name="index" type="GLuint"/> + <param name="x" type="GLuint"/> + <param name="y" type="GLuint"/> + <param name="z" type="GLuint"/> + </function> + + <function name="VertexAttribI4uiEXT" offset="assign"> + <param name="index" type="GLuint"/> + <param name="x" type="GLuint"/> + <param name="y" type="GLuint"/> + <param name="z" type="GLuint"/> + <param name="w" type="GLuint"/> + </function> + + <function name="VertexAttribI1ivEXT" offset="assign"> + <param name="index" type="GLuint"/> + <param name="v" type="const GLint *"/> + </function> + + <function name="VertexAttribI2ivEXT" offset="assign"> + <param name="index" type="GLuint"/> + <param name="v" type="const GLint *"/> + </function> + + <function name="VertexAttribI3ivEXT" offset="assign"> + <param name="index" type="GLuint"/> + <param name="v" type="const GLint *"/> + </function> + + <function name="VertexAttribI4ivEXT" offset="assign"> + <param name="index" type="GLuint"/> + <param name="v" type="const GLint *"/> + </function> + + <function name="VertexAttribI1uivEXT" offset="assign"> + <param name="index" type="GLuint"/> + <param name="v" type="const GLuint *"/> + </function> + + <function name="VertexAttribI2uivEXT" offset="assign"> + <param name="index" type="GLuint"/> + <param name="v" type="const GLuint *"/> + </function> + + <function name="VertexAttribI3uivEXT" offset="assign"> + <param name="index" type="GLuint"/> + <param name="v" type="const GLuint *"/> + </function> + + <function name="VertexAttribI4uivEXT" offset="assign"> + <param name="index" type="GLuint"/> + <param name="v" type="const GLuint *"/> + </function> + + <function name="VertexAttribI4bvEXT" offset="assign"> + <param name="index" type="GLuint"/> + <param name="v" type="const GLbyte *"/> + </function> + + <function name="VertexAttribI4svEXT" offset="assign"> + <param name="index" type="GLuint"/> + <param name="v" type="const GLshort *"/> + </function> + + <function name="VertexAttribI4ubvEXT" offset="assign"> + <param name="index" type="GLuint"/> + <param name="v" type="const GLubyte *"/> + </function> + + <function name="VertexAttribI4usvEXT" offset="assign"> + <param name="index" type="GLuint"/> + <param name="v" type="const GLushort *"/> + </function> + + <function name="VertexAttribIPointerEXT" offset="assign"> + <param name="index" type="GLuint"/> + <param name="size" type="GLint"/> + <param name="type" type="GLenum"/> + <param name="stride" type="GLsizei"/> + <param name="pointer" type="const GLvoid *"/> + </function> + + <function name="GetVertexAttribIivEXT" offset="assign"> + <param name="index" type="GLuint"/> + <param name="pname" type="GLenum"/> + <param name="params" type="GLint *"/> + </function> + + <function name="GetVertexAttribIuivEXT" offset="assign"> + <param name="index" type="GLuint"/> + <param name="pname" type="GLenum"/> + <param name="params" type="GLuint *"/> + </function> + + <function name="Uniform1uiEXT" offset="assign"> + <param name="location" type="GLint"/> + <param name="x" type="GLuint"/> + </function> + + <function name="Uniform2uiEXT" offset="assign"> + <param name="location" type="GLint"/> + <param name="x" type="GLuint"/> + <param name="y" type="GLuint"/> + </function> + + <function name="Uniform3uiEXT" offset="assign"> + <param name="location" type="GLint"/> + <param name="x" type="GLuint"/> + <param name="y" type="GLuint"/> + <param name="z" type="GLuint"/> + </function> + + <function name="Uniform4uiEXT" offset="assign"> + <param name="location" type="GLint"/> + <param name="x" type="GLuint"/> + <param name="y" type="GLuint"/> + <param name="z" type="GLuint"/> + <param name="w" type="GLuint"/> + </function> + + <function name="Uniform1uivEXT" offset="assign"> + <param name="location" type="GLint"/> + <param name="count" type="GLsizei"/> + <param name="value" type="const GLuint *"/> + </function> + + <function name="Uniform2uivEXT" offset="assign"> + <param name="location" type="GLint"/> + <param name="count" type="GLsizei"/> + <param name="value" type="const GLuint *"/> + </function> + + <function name="Uniform3uivEXT" offset="assign"> + <param name="location" type="GLint"/> + <param name="count" type="GLsizei"/> + <param name="value" type="const GLuint *"/> + </function> + + <function name="Uniform4uivEXT" offset="assign"> + <param name="location" type="GLint"/> + <param name="count" type="GLsizei"/> + <param name="value" type="const GLuint *"/> + </function> + + <function name="GetUniformuivEXT" offset="assign"> + <param name="program" type="GLuint"/> + <param name="location" type="GLint"/> + <param name="params" type="GLuint *"/> + </function> + + <function name="BindFragDataLocationEXT" offset="assign"> + <param name="program" type="GLuint"/> + <param name="colorNumber" type="GLuint"/> + <param name="name" type="const GLchar *"/> + </function> + + <function name="GetFragDataLocationEXT" offset="assign"> + <return type="GLint"/> + <param name="program" type="GLuint"/> + <param name="name" type="const GLchar *"/> + </function> + +</category> + +</OpenGLAPI> diff --git a/mesalib/src/mapi/glapi/gen/Makefile b/mesalib/src/mapi/glapi/gen/Makefile index 4110cda7b..c409285dd 100644 --- a/mesalib/src/mapi/glapi/gen/Makefile +++ b/mesalib/src/mapi/glapi/gen/Makefile @@ -41,21 +41,13 @@ MESA_OUTPUTS = \ XORG_GLX_DIR = $(XORG_BASE)/glx XORG_GLAPI_DIR = $(XORG_BASE)/glx -XORG_GLAPI_FILES = \ - $(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)/glapioffsets.h \ $(XORG_GLAPI_DIR)/glapitable.h \ - $(XORG_GLAPI_DIR)/glapidispatch.h \ + $(XORG_GLAPI_DIR)/dispatch.h \ $(XORG_GLAPI_DIR)/glapi_gentable.c XORG_OUTPUTS = \ - $(XORG_GLAPI_FILES) \ $(XORG_GLAPI_OUTPUTS) \ $(XORG_GLX_DIR)/indirect_dispatch.c \ $(XORG_GLX_DIR)/indirect_dispatch_swap.c \ @@ -148,6 +140,9 @@ clean: $(XORG_GLAPI_DIR)/%.c: $(MESA_GLAPI_DIR)/%.c cp $< $@ +$(XORG_GLAPI_DIR)/dispatch.h: $(MESA_DIR)/main/dispatch.h + cp $< $@ + $(XORG_GLAPI_DIR)/%.h: $(MESA_GLAPI_DIR)/%.h cp $< $@ diff --git a/mesalib/src/mapi/glapi/gen/glX_proto_recv.py b/mesalib/src/mapi/glapi/gen/glX_proto_recv.py index 190ba8132..65674dab7 100644 --- a/mesalib/src/mapi/glapi/gen/glX_proto_recv.py +++ b/mesalib/src/mapi/glapi/gen/glX_proto_recv.py @@ -1,566 +1,567 @@ -#!/usr/bin/env python
-
-# (C) Copyright IBM Corporation 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>
-
-import gl_XML, glX_XML, glX_proto_common, license
-import sys, getopt, string
-
-
-class PrintGlxDispatch_h(gl_XML.gl_print_base):
- def __init__(self):
- gl_XML.gl_print_base.__init__(self)
-
- self.name = "glX_proto_recv.py (from Mesa)"
- self.license = license.bsd_license_template % ( "(C) Copyright IBM Corporation 2005", "IBM")
-
- self.header_tag = "_INDIRECT_DISPATCH_H_"
- return
-
-
- def printRealHeader(self):
- self.printVisibility( "HIDDEN", "hidden" )
- print 'struct __GLXclientStateRec;'
- print ''
- return
-
-
- def printBody(self, api):
- for func in api.functionIterateAll():
- if not func.ignore and not func.vectorequiv:
- if func.glx_rop:
- print 'extern HIDDEN void __glXDisp_%s(GLbyte * pc);' % (func.name)
- print 'extern HIDDEN void __glXDispSwap_%s(GLbyte * pc);' % (func.name)
- elif func.glx_sop or func.glx_vendorpriv:
- print 'extern HIDDEN int __glXDisp_%s(struct __GLXclientStateRec *, GLbyte *);' % (func.name)
- print 'extern HIDDEN int __glXDispSwap_%s(struct __GLXclientStateRec *, GLbyte *);' % (func.name)
-
- if func.glx_sop and func.glx_vendorpriv:
- n = func.glx_vendorpriv_names[0]
- print 'extern HIDDEN int __glXDisp_%s(struct __GLXclientStateRec *, GLbyte *);' % (n)
- print 'extern HIDDEN int __glXDispSwap_%s(struct __GLXclientStateRec *, GLbyte *);' % (n)
-
- return
-
-
-class PrintGlxDispatchFunctions(glX_proto_common.glx_print_proto):
- def __init__(self, do_swap):
- gl_XML.gl_print_base.__init__(self)
- self.name = "glX_proto_recv.py (from Mesa)"
- self.license = license.bsd_license_template % ( "(C) Copyright IBM Corporation 2005", "IBM")
-
- self.real_types = [ '', '', 'uint16_t', '', 'uint32_t', '', '', '', 'uint64_t' ]
- self.do_swap = do_swap
- return
-
-
- def printRealHeader(self):
- print '#ifdef HAVE_DIX_CONFIG_H'
- print '#include <dix-config.h>'
- print '#else'
- print ''
- print '#include "glheader.h"'
- print ''
- print '#endif'
- print ''
- print '#include <X11/Xmd.h>'
- print '#include <GL/gl.h>'
- print '#include <GL/glxproto.h>'
-
- print '#include <inttypes.h>'
- print '#include "indirect_size.h"'
- print '#include "indirect_size_get.h"'
- print '#include "indirect_dispatch.h"'
- print '#include "glxserver.h"'
- print '#include "glxbyteorder.h"'
- print '#include "indirect_util.h"'
- print '#include "singlesize.h"'
- print '#include "glapi.h"'
- print '#include "glapitable.h"'
- print '#include "glthread.h"'
- print '#include "dispatch.h"'
- print ''
- print '#define __GLX_PAD(x) (((x) + 3) & ~3)'
- print ''
- print 'typedef struct {'
- print ' __GLX_PIXEL_3D_HDR;'
- print '} __GLXpixel3DHeader;'
- print ''
- print 'extern GLboolean __glXErrorOccured( void );'
- print 'extern void __glXClearErrorOccured( void );'
- print ''
- print 'static const unsigned dummy_answer[2] = {0, 0};'
- print ''
- return
-
-
- def printBody(self, api):
- if self.do_swap:
- self.emit_swap_wrappers(api)
-
-
- for func in api.functionIterateByOffset():
- if not func.ignore and not func.server_handcode and not func.vectorequiv and (func.glx_rop or func.glx_sop or func.glx_vendorpriv):
- 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, f, name):
- if (f.glx_sop or f.glx_vendorpriv) and (len(f.get_images()) != 0):
- return
-
- if not self.do_swap:
- base = '__glXDisp'
- else:
- base = '__glXDispSwap'
-
- if f.glx_rop:
- print 'void %s_%s(GLbyte * pc)' % (base, name)
- else:
- print 'int %s_%s(__GLXclientState *cl, GLbyte *pc)' % (base, name)
-
- print '{'
-
- if f.glx_rop or f.vectorequiv:
- self.printRenderFunction(f)
- elif f.glx_sop or f.glx_vendorpriv:
- if len(f.get_images()) == 0:
- self.printSingleFunction(f, name)
- else:
- print "/* Missing GLX protocol for %s. */" % (name)
-
- print '}'
- print ''
- return
-
-
- def swap_name(self, bytes):
- return 'bswap_%u_array' % (8 * bytes)
-
-
- def emit_swap_wrappers(self, api):
- self.type_map = {}
- already_done = [ ]
-
- for t in api.typeIterate():
- te = t.get_type_expression()
- t_size = te.get_element_size()
-
- if t_size > 1 and t.glx_name:
-
- t_name = "GL" + t.name
- self.type_map[ t_name ] = t.glx_name
-
- if t.glx_name not in already_done:
- real_name = self.real_types[t_size]
-
- print 'static %s' % (t_name)
- print 'bswap_%s( const void * src )' % (t.glx_name)
- print '{'
- print ' union { %s dst; %s ret; } x;' % (real_name, t_name)
- print ' x.dst = bswap_%u( *(%s *) src );' % (t_size * 8, real_name)
- print ' return x.ret;'
- print '}'
- print ''
- already_done.append( t.glx_name )
-
- for bits in [16, 32, 64]:
- print 'static void *'
- print 'bswap_%u_array( uint%u_t * src, unsigned count )' % (bits, bits)
- print '{'
- print ' unsigned i;'
- print ''
- print ' for ( i = 0 ; i < count ; i++ ) {'
- print ' uint%u_t temp = bswap_%u( src[i] );' % (bits, bits)
- print ' src[i] = temp;'
- print ' }'
- print ''
- print ' return src;'
- print '}'
- print ''
-
-
- def fetch_param(self, param):
- t = param.type_string()
- o = param.offset
- element_size = param.size() / param.get_element_count()
-
- if self.do_swap and (element_size != 1):
- if param.is_array():
- real_name = self.real_types[ element_size ]
-
- swap_func = self.swap_name( element_size )
- return ' (%-8s)%s( (%s *) (pc + %2s), %s )' % (t, swap_func, real_name, o, param.count)
- else:
- t_name = param.get_base_type_string()
- return ' (%-8s)bswap_%-7s( pc + %2s )' % (t, self.type_map[ t_name ], o)
- else:
- if param.is_array():
- return ' (%-8s)(pc + %2u)' % (t, o)
- else:
- return '*(%-8s *)(pc + %2u)' % (t, o)
-
- return None
-
-
- def emit_function_call(self, f, retval_assign, indent):
- list = []
-
- for param in f.parameterIterator():
- if param.is_padding:
- continue
-
- if param.is_counter or param.is_image() or param.is_output or param.name in f.count_parameter_list or len(param.count_parameter_list):
- location = param.name
- else:
- location = self.fetch_param(param)
-
- list.append( '%s %s' % (indent, location) )
-
-
- if len( list ):
- print '%s %sCALL_%s( GET_DISPATCH(), (' % (indent, retval_assign, f.name)
- print string.join( list, ",\n" )
- print '%s ) );' % (indent)
- else:
- print '%s %sCALL_%s( GET_DISPATCH(), () );' % (indent, retval_assign, f.name)
- return
-
-
- def common_func_print_just_start(self, f, indent):
- align64 = 0
- need_blank = 0
-
-
- f.calculate_offsets()
- for param in f.parameterIterateGlxSend():
- # If any parameter has a 64-bit base type, then we
- # have to do alignment magic for the while thing.
-
- if param.is_64_bit():
- align64 = 1
-
-
- # FIXME img_null_flag is over-loaded. In addition to
- # FIXME being used for images, it is used to signify
- # FIXME NULL data pointers for vertex buffer object
- # FIXME related functions. Re-name it to null_data
- # FIXME or something similar.
-
- if param.img_null_flag:
- print '%s const CARD32 ptr_is_null = *(CARD32 *)(pc + %s);' % (indent, param.offset - 4)
- cond = '(ptr_is_null != 0) ? NULL : '
- else:
- cond = ""
-
-
- type_string = param.type_string()
-
- if param.is_image():
- offset = f.offset_of( param.name )
-
- if cond:
- print '%s %s const %s = (%s) (%s(pc + %s));' % (indent, type_string, param.name, type_string, cond, offset)
- else:
- print '%s %s const %s = (%s) (pc + %s);' % (indent, type_string, param.name, type_string, offset)
-
- if param.depth:
- print '%s __GLXpixel3DHeader * const hdr = (__GLXpixel3DHeader *)(pc);' % (indent)
- else:
- print '%s __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc);' % (indent)
-
- need_blank = 1
- elif param.is_counter or param.name in f.count_parameter_list:
- location = self.fetch_param(param)
- print '%s const %s %s = %s;' % (indent, type_string, param.name, location)
- need_blank = 1
- elif len(param.count_parameter_list):
- if param.size() == 1 and not self.do_swap:
- location = self.fetch_param(param)
- print '%s %s %s = %s%s;' % (indent, type_string, param.name, cond, location)
- else:
- print '%s %s %s;' % (indent, type_string, param.name)
- need_blank = 1
-
-
-
- if need_blank:
- print ''
-
- if align64:
- print '#ifdef __GLX_ALIGN64'
-
- if f.has_variable_size_request():
- self.emit_packet_size_calculation(f, 4)
- s = "cmdlen"
- else:
- s = str((f.command_fixed_length() + 3) & ~3)
-
- print ' if ((unsigned long)(pc) & 7) {'
- print ' (void) memmove(pc-4, pc, %s);' % (s)
- print ' pc -= 4;'
- print ' }'
- print '#endif'
- print ''
-
-
- need_blank = 0
- if self.do_swap:
- for param in f.parameterIterateGlxSend():
- if param.count_parameter_list:
- o = param.offset
- count = param.get_element_count()
- type_size = param.size() / count
-
- if param.counter:
- count_name = param.counter
- else:
- count_name = str(count)
-
- # This is basically an ugly special-
- # case for glCallLists.
-
- if type_size == 1:
- x = []
- x.append( [1, ['BYTE', 'UNSIGNED_BYTE', '2_BYTES', '3_BYTES', '4_BYTES']] )
- x.append( [2, ['SHORT', 'UNSIGNED_SHORT']] )
- x.append( [4, ['INT', 'UNSIGNED_INT', 'FLOAT']] )
-
- print ' switch(%s) {' % (param.count_parameter_list[0])
- for sub in x:
- for t_name in sub[1]:
- print ' case GL_%s:' % (t_name)
-
- if sub[0] == 1:
- print ' %s = (%s) (pc + %s); break;' % (param.name, param.type_string(), o)
- else:
- swap_func = self.swap_name(sub[0])
- print ' %s = (%s) %s( (%s *) (pc + %s), %s ); break;' % (param.name, param.type_string(), swap_func, self.real_types[sub[0]], o, count_name)
- print ' default:'
- print ' return;'
- print ' }'
- else:
- swap_func = self.swap_name(type_size)
- compsize = self.size_call(f, 1)
- print ' %s = (%s) %s( (%s *) (pc + %s), %s );' % (param.name, param.type_string(), swap_func, self.real_types[type_size], o, compsize)
-
- need_blank = 1
-
- else:
- for param in f.parameterIterateGlxSend():
- if param.count_parameter_list:
- if param.size() != 1 or self.do_swap:
- print '%s %s = (%s) (pc + %s);' % (indent, param.name, param.type_string(), param.offset)
- need_blank = 1
-
-
- if need_blank:
- print ''
-
-
- return
-
-
- def printSingleFunction(self, f, name):
- if name not in f.glx_vendorpriv_names:
- print ' xGLXSingleReq * const req = (xGLXSingleReq *) pc;'
- else:
- print ' xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;'
-
- print ' int error;'
-
- if self.do_swap:
- print ' __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);'
- else:
- print ' __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);'
-
- print ''
- if name not in f.glx_vendorpriv_names:
- print ' pc += __GLX_SINGLE_HDR_SIZE;'
- else:
- print ' pc += __GLX_VENDPRIV_HDR_SIZE;'
-
- print ' if ( cx != NULL ) {'
- self.common_func_print_just_start(f, " ")
-
-
- if f.return_type != 'void':
- print ' %s retval;' % (f.return_type)
- retval_string = "retval"
- retval_assign = "retval = "
- else:
- retval_string = "0"
- retval_assign = ""
-
-
- type_size = 0
- answer_string = "dummy_answer"
- answer_count = "0"
- is_array_string = "GL_FALSE"
-
- for param in f.parameterIterateOutputs():
- answer_type = param.get_base_type_string()
- if answer_type == "GLvoid":
- answer_type = "GLubyte"
-
-
- c = param.get_element_count()
- type_size = (param.size() / c)
- if type_size == 1:
- size_scale = ""
- else:
- size_scale = " * %u" % (type_size)
-
-
- if param.count_parameter_list:
- print ' const GLuint compsize = %s;' % (self.size_call(f, 1))
- print ' %s answerBuffer[200];' % (answer_type)
- print ' %s %s = __glXGetAnswerBuffer(cl, compsize%s, answerBuffer, sizeof(answerBuffer), %u);' % (param.type_string(), param.name, size_scale, type_size )
- answer_string = param.name
- answer_count = "compsize"
-
- print ''
- print ' if (%s == NULL) return BadAlloc;' % (param.name)
- print ' __glXClearErrorOccured();'
- print ''
- elif param.counter:
- print ' %s answerBuffer[200];' % (answer_type)
- print ' %s %s = __glXGetAnswerBuffer(cl, %s%s, answerBuffer, sizeof(answerBuffer), %u);' % (param.type_string(), param.name, param.counter, size_scale, type_size)
- answer_string = param.name
- answer_count = param.counter
- elif c >= 1:
- print ' %s %s[%u];' % (answer_type, param.name, c)
- answer_string = param.name
- answer_count = "%u" % (c)
-
- if f.reply_always_array:
- is_array_string = "GL_TRUE"
-
-
- self.emit_function_call(f, retval_assign, " ")
-
-
- if f.needs_reply():
- if self.do_swap:
- for param in f.parameterIterateOutputs():
- c = param.get_element_count()
- type_size = (param.size() / c)
-
- if type_size > 1:
- swap_name = self.swap_name( type_size )
- print ' (void) %s( (uint%u_t *) %s, %s );' % (swap_name, 8 * type_size, param.name, answer_count)
-
-
- reply_func = '__glXSendReplySwap'
- else:
- reply_func = '__glXSendReply'
-
- print ' %s(cl->client, %s, %s, %u, %s, %s);' % (reply_func, answer_string, answer_count, type_size, is_array_string, retval_string)
- #elif f.note_unflushed:
- # print ' cx->hasUnflushedCommands = GL_TRUE;'
-
- print ' error = Success;'
- print ' }'
- print ''
- print ' return error;'
- return
-
-
- def printRenderFunction(self, f):
- # There are 4 distinct phases in a rendering dispatch function.
- # In the first phase we compute the sizes and offsets of each
- # element in the command. In the second phase we (optionally)
- # re-align 64-bit data elements. In the third phase we
- # (optionally) byte-swap array data. Finally, in the fourth
- # phase we actually dispatch the function.
-
- self.common_func_print_just_start(f, "")
-
- images = f.get_images()
- if len(images):
- if self.do_swap:
- pre = "bswap_CARD32( & "
- post = " )"
- else:
- pre = ""
- post = ""
-
- img = images[0]
-
- # swapBytes and lsbFirst are single byte fields, so
- # the must NEVER be byte-swapped.
-
- if not (img.img_type == "GL_BITMAP" and img.img_format == "GL_COLOR_INDEX"):
- print ' CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) );'
-
- print ' CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) );'
-
- print ' CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) %shdr->rowLength%s) );' % (pre, post)
- if img.depth:
- print ' CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_IMAGE_HEIGHT, (GLint) %shdr->imageHeight%s) );' % (pre, post)
- print ' CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) %shdr->skipRows%s) );' % (pre, post)
- if img.depth:
- print ' CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_IMAGES, (GLint) %shdr->skipImages%s) );' % (pre, post)
- print ' CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) %shdr->skipPixels%s) );' % (pre, post)
- print ' CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) %shdr->alignment%s) );' % (pre, post)
- print ''
-
-
- self.emit_function_call(f, "", "")
- return
-
-
-if __name__ == '__main__':
- file_name = "gl_API.xml"
-
- try:
- (args, trail) = getopt.getopt(sys.argv[1:], "f:m:s")
- except Exception,e:
- show_usage()
-
- mode = "dispatch_c"
- do_swap = 0
- for (arg,val) in args:
- if arg == "-f":
- file_name = val
- elif arg == "-m":
- mode = val
- elif arg == "-s":
- do_swap = 1
-
- if mode == "dispatch_c":
- printer = PrintGlxDispatchFunctions(do_swap)
- elif mode == "dispatch_h":
- printer = PrintGlxDispatch_h()
- else:
- show_usage()
-
- api = gl_XML.parse_GL_API( file_name, glX_proto_common.glx_proto_item_factory() )
-
- printer.Print( api )
+#!/usr/bin/env python + +# (C) Copyright IBM Corporation 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> + +import gl_XML, glX_XML, glX_proto_common, license +import sys, getopt, string + + +class PrintGlxDispatch_h(gl_XML.gl_print_base): + def __init__(self): + gl_XML.gl_print_base.__init__(self) + + self.name = "glX_proto_recv.py (from Mesa)" + self.license = license.bsd_license_template % ( "(C) Copyright IBM Corporation 2005", "IBM") + + self.header_tag = "_INDIRECT_DISPATCH_H_" + return + + + def printRealHeader(self): + print '# include <X11/Xfuncproto.h>' + print '' + print 'struct __GLXclientStateRec;' + print '' + return + + + def printBody(self, api): + for func in api.functionIterateAll(): + if not func.ignore and not func.vectorequiv: + if func.glx_rop: + print 'extern _X_HIDDEN void __glXDisp_%s(GLbyte * pc);' % (func.name) + print 'extern _X_HIDDEN void __glXDispSwap_%s(GLbyte * pc);' % (func.name) + elif func.glx_sop or func.glx_vendorpriv: + print 'extern _X_HIDDEN int __glXDisp_%s(struct __GLXclientStateRec *, GLbyte *);' % (func.name) + print 'extern _X_HIDDEN int __glXDispSwap_%s(struct __GLXclientStateRec *, GLbyte *);' % (func.name) + + if func.glx_sop and func.glx_vendorpriv: + n = func.glx_vendorpriv_names[0] + print 'extern _X_HIDDEN int __glXDisp_%s(struct __GLXclientStateRec *, GLbyte *);' % (n) + print 'extern _X_HIDDEN int __glXDispSwap_%s(struct __GLXclientStateRec *, GLbyte *);' % (n) + + return + + +class PrintGlxDispatchFunctions(glX_proto_common.glx_print_proto): + def __init__(self, do_swap): + gl_XML.gl_print_base.__init__(self) + self.name = "glX_proto_recv.py (from Mesa)" + self.license = license.bsd_license_template % ( "(C) Copyright IBM Corporation 2005", "IBM") + + self.real_types = [ '', '', 'uint16_t', '', 'uint32_t', '', '', '', 'uint64_t' ] + self.do_swap = do_swap + return + + + def printRealHeader(self): + print '#ifdef HAVE_DIX_CONFIG_H' + print '#include <dix-config.h>' + print '#else' + print '' + print '#include "glheader.h"' + print '' + print '#endif' + print '' + print '#include <X11/Xmd.h>' + print '#include <GL/gl.h>' + print '#include <GL/glxproto.h>' + + print '#include <inttypes.h>' + print '#include "indirect_size.h"' + print '#include "indirect_size_get.h"' + print '#include "indirect_dispatch.h"' + print '#include "glxserver.h"' + print '#include "glxbyteorder.h"' + print '#include "indirect_util.h"' + print '#include "singlesize.h"' + print '#include "glapi.h"' + print '#include "glapitable.h"' + print '#include "glthread.h"' + print '#include "dispatch.h"' + print '' + print '#define __GLX_PAD(x) (((x) + 3) & ~3)' + print '' + print 'typedef struct {' + print ' __GLX_PIXEL_3D_HDR;' + print '} __GLXpixel3DHeader;' + print '' + print 'extern GLboolean __glXErrorOccured( void );' + print 'extern void __glXClearErrorOccured( void );' + print '' + print 'static const unsigned dummy_answer[2] = {0, 0};' + print '' + return + + + def printBody(self, api): + if self.do_swap: + self.emit_swap_wrappers(api) + + + for func in api.functionIterateByOffset(): + if not func.ignore and not func.server_handcode and not func.vectorequiv and (func.glx_rop or func.glx_sop or func.glx_vendorpriv): + 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, f, name): + if (f.glx_sop or f.glx_vendorpriv) and (len(f.get_images()) != 0): + return + + if not self.do_swap: + base = '__glXDisp' + else: + base = '__glXDispSwap' + + if f.glx_rop: + print 'void %s_%s(GLbyte * pc)' % (base, name) + else: + print 'int %s_%s(__GLXclientState *cl, GLbyte *pc)' % (base, name) + + print '{' + + if f.glx_rop or f.vectorequiv: + self.printRenderFunction(f) + elif f.glx_sop or f.glx_vendorpriv: + if len(f.get_images()) == 0: + self.printSingleFunction(f, name) + else: + print "/* Missing GLX protocol for %s. */" % (name) + + print '}' + print '' + return + + + def swap_name(self, bytes): + return 'bswap_%u_array' % (8 * bytes) + + + def emit_swap_wrappers(self, api): + self.type_map = {} + already_done = [ ] + + for t in api.typeIterate(): + te = t.get_type_expression() + t_size = te.get_element_size() + + if t_size > 1 and t.glx_name: + + t_name = "GL" + t.name + self.type_map[ t_name ] = t.glx_name + + if t.glx_name not in already_done: + real_name = self.real_types[t_size] + + print 'static %s' % (t_name) + print 'bswap_%s( const void * src )' % (t.glx_name) + print '{' + print ' union { %s dst; %s ret; } x;' % (real_name, t_name) + print ' x.dst = bswap_%u( *(%s *) src );' % (t_size * 8, real_name) + print ' return x.ret;' + print '}' + print '' + already_done.append( t.glx_name ) + + for bits in [16, 32, 64]: + print 'static void *' + print 'bswap_%u_array( uint%u_t * src, unsigned count )' % (bits, bits) + print '{' + print ' unsigned i;' + print '' + print ' for ( i = 0 ; i < count ; i++ ) {' + print ' uint%u_t temp = bswap_%u( src[i] );' % (bits, bits) + print ' src[i] = temp;' + print ' }' + print '' + print ' return src;' + print '}' + print '' + + + def fetch_param(self, param): + t = param.type_string() + o = param.offset + element_size = param.size() / param.get_element_count() + + if self.do_swap and (element_size != 1): + if param.is_array(): + real_name = self.real_types[ element_size ] + + swap_func = self.swap_name( element_size ) + return ' (%-8s)%s( (%s *) (pc + %2s), %s )' % (t, swap_func, real_name, o, param.count) + else: + t_name = param.get_base_type_string() + return ' (%-8s)bswap_%-7s( pc + %2s )' % (t, self.type_map[ t_name ], o) + else: + if param.is_array(): + return ' (%-8s)(pc + %2u)' % (t, o) + else: + return '*(%-8s *)(pc + %2u)' % (t, o) + + return None + + + def emit_function_call(self, f, retval_assign, indent): + list = [] + + for param in f.parameterIterator(): + if param.is_padding: + continue + + if param.is_counter or param.is_image() or param.is_output or param.name in f.count_parameter_list or len(param.count_parameter_list): + location = param.name + else: + location = self.fetch_param(param) + + list.append( '%s %s' % (indent, location) ) + + + if len( list ): + print '%s %sCALL_%s( GET_DISPATCH(), (' % (indent, retval_assign, f.name) + print string.join( list, ",\n" ) + print '%s ) );' % (indent) + else: + print '%s %sCALL_%s( GET_DISPATCH(), () );' % (indent, retval_assign, f.name) + return + + + def common_func_print_just_start(self, f, indent): + align64 = 0 + need_blank = 0 + + + f.calculate_offsets() + for param in f.parameterIterateGlxSend(): + # If any parameter has a 64-bit base type, then we + # have to do alignment magic for the while thing. + + if param.is_64_bit(): + align64 = 1 + + + # FIXME img_null_flag is over-loaded. In addition to + # FIXME being used for images, it is used to signify + # FIXME NULL data pointers for vertex buffer object + # FIXME related functions. Re-name it to null_data + # FIXME or something similar. + + if param.img_null_flag: + print '%s const CARD32 ptr_is_null = *(CARD32 *)(pc + %s);' % (indent, param.offset - 4) + cond = '(ptr_is_null != 0) ? NULL : ' + else: + cond = "" + + + type_string = param.type_string() + + if param.is_image(): + offset = f.offset_of( param.name ) + + if cond: + print '%s %s const %s = (%s) (%s(pc + %s));' % (indent, type_string, param.name, type_string, cond, offset) + else: + print '%s %s const %s = (%s) (pc + %s);' % (indent, type_string, param.name, type_string, offset) + + if param.depth: + print '%s __GLXpixel3DHeader * const hdr = (__GLXpixel3DHeader *)(pc);' % (indent) + else: + print '%s __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc);' % (indent) + + need_blank = 1 + elif param.is_counter or param.name in f.count_parameter_list: + location = self.fetch_param(param) + print '%s const %s %s = %s;' % (indent, type_string, param.name, location) + need_blank = 1 + elif len(param.count_parameter_list): + if param.size() == 1 and not self.do_swap: + location = self.fetch_param(param) + print '%s %s %s = %s%s;' % (indent, type_string, param.name, cond, location) + else: + print '%s %s %s;' % (indent, type_string, param.name) + need_blank = 1 + + + + if need_blank: + print '' + + if align64: + print '#ifdef __GLX_ALIGN64' + + if f.has_variable_size_request(): + self.emit_packet_size_calculation(f, 4) + s = "cmdlen" + else: + s = str((f.command_fixed_length() + 3) & ~3) + + print ' if ((unsigned long)(pc) & 7) {' + print ' (void) memmove(pc-4, pc, %s);' % (s) + print ' pc -= 4;' + print ' }' + print '#endif' + print '' + + + need_blank = 0 + if self.do_swap: + for param in f.parameterIterateGlxSend(): + if param.count_parameter_list: + o = param.offset + count = param.get_element_count() + type_size = param.size() / count + + if param.counter: + count_name = param.counter + else: + count_name = str(count) + + # This is basically an ugly special- + # case for glCallLists. + + if type_size == 1: + x = [] + x.append( [1, ['BYTE', 'UNSIGNED_BYTE', '2_BYTES', '3_BYTES', '4_BYTES']] ) + x.append( [2, ['SHORT', 'UNSIGNED_SHORT']] ) + x.append( [4, ['INT', 'UNSIGNED_INT', 'FLOAT']] ) + + print ' switch(%s) {' % (param.count_parameter_list[0]) + for sub in x: + for t_name in sub[1]: + print ' case GL_%s:' % (t_name) + + if sub[0] == 1: + print ' %s = (%s) (pc + %s); break;' % (param.name, param.type_string(), o) + else: + swap_func = self.swap_name(sub[0]) + print ' %s = (%s) %s( (%s *) (pc + %s), %s ); break;' % (param.name, param.type_string(), swap_func, self.real_types[sub[0]], o, count_name) + print ' default:' + print ' return;' + print ' }' + else: + swap_func = self.swap_name(type_size) + compsize = self.size_call(f, 1) + print ' %s = (%s) %s( (%s *) (pc + %s), %s );' % (param.name, param.type_string(), swap_func, self.real_types[type_size], o, compsize) + + need_blank = 1 + + else: + for param in f.parameterIterateGlxSend(): + if param.count_parameter_list: + if param.size() != 1 or self.do_swap: + print '%s %s = (%s) (pc + %s);' % (indent, param.name, param.type_string(), param.offset) + need_blank = 1 + + + if need_blank: + print '' + + + return + + + def printSingleFunction(self, f, name): + if name not in f.glx_vendorpriv_names: + print ' xGLXSingleReq * const req = (xGLXSingleReq *) pc;' + else: + print ' xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;' + + print ' int error;' + + if self.do_swap: + print ' __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);' + else: + print ' __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);' + + print '' + if name not in f.glx_vendorpriv_names: + print ' pc += __GLX_SINGLE_HDR_SIZE;' + else: + print ' pc += __GLX_VENDPRIV_HDR_SIZE;' + + print ' if ( cx != NULL ) {' + self.common_func_print_just_start(f, " ") + + + if f.return_type != 'void': + print ' %s retval;' % (f.return_type) + retval_string = "retval" + retval_assign = "retval = " + else: + retval_string = "0" + retval_assign = "" + + + type_size = 0 + answer_string = "dummy_answer" + answer_count = "0" + is_array_string = "GL_FALSE" + + for param in f.parameterIterateOutputs(): + answer_type = param.get_base_type_string() + if answer_type == "GLvoid": + answer_type = "GLubyte" + + + c = param.get_element_count() + type_size = (param.size() / c) + if type_size == 1: + size_scale = "" + else: + size_scale = " * %u" % (type_size) + + + if param.count_parameter_list: + print ' const GLuint compsize = %s;' % (self.size_call(f, 1)) + print ' %s answerBuffer[200];' % (answer_type) + print ' %s %s = __glXGetAnswerBuffer(cl, compsize%s, answerBuffer, sizeof(answerBuffer), %u);' % (param.type_string(), param.name, size_scale, type_size ) + answer_string = param.name + answer_count = "compsize" + + print '' + print ' if (%s == NULL) return BadAlloc;' % (param.name) + print ' __glXClearErrorOccured();' + print '' + elif param.counter: + print ' %s answerBuffer[200];' % (answer_type) + print ' %s %s = __glXGetAnswerBuffer(cl, %s%s, answerBuffer, sizeof(answerBuffer), %u);' % (param.type_string(), param.name, param.counter, size_scale, type_size) + answer_string = param.name + answer_count = param.counter + elif c >= 1: + print ' %s %s[%u];' % (answer_type, param.name, c) + answer_string = param.name + answer_count = "%u" % (c) + + if f.reply_always_array: + is_array_string = "GL_TRUE" + + + self.emit_function_call(f, retval_assign, " ") + + + if f.needs_reply(): + if self.do_swap: + for param in f.parameterIterateOutputs(): + c = param.get_element_count() + type_size = (param.size() / c) + + if type_size > 1: + swap_name = self.swap_name( type_size ) + print ' (void) %s( (uint%u_t *) %s, %s );' % (swap_name, 8 * type_size, param.name, answer_count) + + + reply_func = '__glXSendReplySwap' + else: + reply_func = '__glXSendReply' + + print ' %s(cl->client, %s, %s, %u, %s, %s);' % (reply_func, answer_string, answer_count, type_size, is_array_string, retval_string) + #elif f.note_unflushed: + # print ' cx->hasUnflushedCommands = GL_TRUE;' + + print ' error = Success;' + print ' }' + print '' + print ' return error;' + return + + + def printRenderFunction(self, f): + # There are 4 distinct phases in a rendering dispatch function. + # In the first phase we compute the sizes and offsets of each + # element in the command. In the second phase we (optionally) + # re-align 64-bit data elements. In the third phase we + # (optionally) byte-swap array data. Finally, in the fourth + # phase we actually dispatch the function. + + self.common_func_print_just_start(f, "") + + images = f.get_images() + if len(images): + if self.do_swap: + pre = "bswap_CARD32( & " + post = " )" + else: + pre = "" + post = "" + + img = images[0] + + # swapBytes and lsbFirst are single byte fields, so + # the must NEVER be byte-swapped. + + if not (img.img_type == "GL_BITMAP" and img.img_format == "GL_COLOR_INDEX"): + print ' CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) );' + + print ' CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) );' + + print ' CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) %shdr->rowLength%s) );' % (pre, post) + if img.depth: + print ' CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_IMAGE_HEIGHT, (GLint) %shdr->imageHeight%s) );' % (pre, post) + print ' CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) %shdr->skipRows%s) );' % (pre, post) + if img.depth: + print ' CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_IMAGES, (GLint) %shdr->skipImages%s) );' % (pre, post) + print ' CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) %shdr->skipPixels%s) );' % (pre, post) + print ' CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) %shdr->alignment%s) );' % (pre, post) + print '' + + + self.emit_function_call(f, "", "") + return + + +if __name__ == '__main__': + file_name = "gl_API.xml" + + try: + (args, trail) = getopt.getopt(sys.argv[1:], "f:m:s") + except Exception,e: + show_usage() + + mode = "dispatch_c" + do_swap = 0 + for (arg,val) in args: + if arg == "-f": + file_name = val + elif arg == "-m": + mode = val + elif arg == "-s": + do_swap = 1 + + if mode == "dispatch_c": + printer = PrintGlxDispatchFunctions(do_swap) + elif mode == "dispatch_h": + printer = PrintGlxDispatch_h() + else: + show_usage() + + api = gl_XML.parse_GL_API( file_name, glX_proto_common.glx_proto_item_factory() ) + + printer.Print( api ) diff --git a/mesalib/src/mapi/glapi/gen/glX_proto_send.py b/mesalib/src/mapi/glapi/gen/glX_proto_send.py index 6330d91f7..bec022218 100644 --- a/mesalib/src/mapi/glapi/gen/glX_proto_send.py +++ b/mesalib/src/mapi/glapi/gen/glX_proto_send.py @@ -1008,25 +1008,25 @@ class PrintGlxProtoInit_h(gl_XML.gl_print_base): * \\author Ian Romanick <idr@us.ibm.com> */ """ - self.printVisibility( "HIDDEN", "hidden" ) self.printFastcall() self.printNoinline() print """ +#include <X11/Xfuncproto.h> #include "glxclient.h" -extern HIDDEN NOINLINE CARD32 __glXReadReply( Display *dpy, size_t size, +extern _X_HIDDEN NOINLINE CARD32 __glXReadReply( Display *dpy, size_t size, void * dest, GLboolean reply_is_always_array ); -extern HIDDEN NOINLINE void __glXReadPixelReply( Display *dpy, +extern _X_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( +extern _X_HIDDEN NOINLINE FASTCALL GLubyte * __glXSetupSingleRequest( struct glx_context * gc, GLint sop, GLint cmdlen ); -extern HIDDEN NOINLINE FASTCALL GLubyte * __glXSetupVendorRequest( +extern _X_HIDDEN NOINLINE FASTCALL GLubyte * __glXSetupVendorRequest( struct glx_context * gc, GLint code, GLint vop, GLint cmdlen ); """ @@ -1035,13 +1035,13 @@ extern HIDDEN NOINLINE FASTCALL GLubyte * __glXSetupVendorRequest( for func in api.functionIterateGlx(): params = func.get_parameter_string() - print 'extern HIDDEN %s __indirect_gl%s(%s);' % (func.return_type, func.name, params) + print 'extern _X_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) + print 'extern _X_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) @@ -1052,7 +1052,7 @@ extern HIDDEN NOINLINE FASTCALL GLubyte * __glXSetupVendorRequest( print '' print '#ifdef GLX_SHARED_GLAPI' - print 'extern HIDDEN void (*__indirect_get_proc_address(const char *name))(void);' + print 'extern _X_HIDDEN void (*__indirect_get_proc_address(const char *name))(void);' print '#endif' diff --git a/mesalib/src/mapi/glapi/gen/glX_proto_size.py b/mesalib/src/mapi/glapi/gen/glX_proto_size.py index c8c0ad82a..3b182daea 100644 --- a/mesalib/src/mapi/glapi/gen/glX_proto_size.py +++ b/mesalib/src/mapi/glapi/gen/glX_proto_size.py @@ -225,7 +225,7 @@ class glx_enum_function: def Print(self, name): - print 'INTERNAL PURE FASTCALL GLint' + print '_X_INTERNAL PURE FASTCALL GLint' print '__gl%s_size( GLenum e )' % (name) print '{' @@ -334,20 +334,18 @@ class PrintGlxSizeStubs_c(PrintGlxSizeStubs_common): print '' self.printFastcall() print '' - self.printVisibility( "INTERNAL", "internal" ) - print '' print '' print '#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(GLX_USE_APPLEGL)' print '# undef HAVE_ALIAS' print '#endif' print '#ifdef HAVE_ALIAS' print '# define ALIAS2(from,to) \\' - print ' INTERNAL PURE FASTCALL GLint __gl ## from ## _size( GLenum e ) \\' + print ' _X_INTERNAL PURE FASTCALL GLint __gl ## from ## _size( GLenum e ) \\' print ' __attribute__ ((alias( # to )));' print '# define ALIAS(from,to) ALIAS2( from, __gl ## to ## _size )' print '#else' print '# define ALIAS(from,to) \\' - print ' INTERNAL PURE FASTCALL GLint __gl ## from ## _size( GLenum e ) \\' + print ' _X_INTERNAL PURE FASTCALL GLint __gl ## from ## _size( GLenum e ) \\' print ' { return __gl ## to ## _size( e ); }' print '#endif' print '' @@ -387,12 +385,12 @@ class PrintGlxSizeStubs_h(PrintGlxSizeStubs_common): * \\author Ian Romanick <idr@us.ibm.com> */ """ + print '#include <X11/Xfuncproto.h>' + print '' self.printPure(); print '' self.printFastcall(); print '' - self.printVisibility( "INTERNAL", "internal" ); - print '' def printBody(self, api): @@ -402,7 +400,7 @@ class PrintGlxSizeStubs_h(PrintGlxSizeStubs_common): continue if (ef.is_set() and self.emit_set) or (not ef.is_set() and self.emit_get): - print 'extern INTERNAL PURE FASTCALL GLint __gl%s_size(GLenum);' % (func.name) + print 'extern _X_INTERNAL PURE FASTCALL GLint __gl%s_size(GLenum);' % (func.name) class PrintGlxReqSize_common(gl_XML.gl_print_base): @@ -426,7 +424,7 @@ class PrintGlxReqSize_h(PrintGlxReqSize_common): def printRealHeader(self): - self.printVisibility("HIDDEN", "hidden") + print '#include <X11/Xfuncproto.h>' print '' self.printPure() print '' @@ -435,7 +433,7 @@ class PrintGlxReqSize_h(PrintGlxReqSize_common): def printBody(self, api): for func in api.functionIterateGlx(): if not func.ignore and func.has_variable_size_request(): - print 'extern PURE HIDDEN int __glX%sReqSize(const GLbyte *pc, Bool swap);' % (func.name) + print 'extern PURE _X_HIDDEN int __glX%sReqSize(const GLbyte *pc, Bool swap);' % (func.name) class PrintGlxReqSize_c(PrintGlxReqSize_common): diff --git a/mesalib/src/mapi/glapi/gen/gl_gentable.py b/mesalib/src/mapi/glapi/gen/gl_gentable.py index 28d9fb104..5657e3277 100644 --- a/mesalib/src/mapi/glapi/gen/gl_gentable.py +++ b/mesalib/src/mapi/glapi/gen/gl_gentable.py @@ -33,12 +33,20 @@ import license import gl_XML, glX_XML import sys, getopt -header = """ +header = """/* GLXEXT is the define used in the xserver when the GLX extension is being + * built. Hijack this to determine whether this file is being built for the + * server or the client. + */ #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif -#ifdef HAVE_BACKTRACE +#if (defined(GLXEXT) && defined(HAVE_BACKTRACE)) \\ + || (!defined(GLXEXT) && defined(DEBUG) && !defined(_WIN32_WCE)) +#define USE_BACKTRACE +#endif + +#ifdef USE_BACKTRACE #include <execinfo.h> #endif @@ -51,15 +59,22 @@ header = """ #include "glapi.h" #include "glapitable.h" +#ifdef GLXEXT #include "os.h" +#endif static void __glapi_gentable_NoOp(void) { -#if defined(DEBUG) && !defined(_WIN32_WCE) - if (getenv("MESA_DEBUG") || getenv("LIBGL_DEBUG")) { - const char *fstr = "Unknown"; - -#ifdef HAVE_BACKTRACE + const char *fstr = "Unknown"; + + /* Silence potential GCC warning for some #ifdef paths. + */ + (void) fstr; +#if defined(USE_BACKTRACE) +#if !defined(GLXEXT) + if (getenv("MESA_DEBUG") || getenv("LIBGL_DEBUG")) +#endif + { void *frames[2]; if(backtrace(frames, 2) == 2) { @@ -68,11 +83,15 @@ __glapi_gentable_NoOp(void) { if(info.dli_sname) fstr = info.dli_sname; } -#endif - LogMessage(X_ERROR, "GLX: Call to unimplemented API: %s\\n", fstr); +#if !defined(GLXEXT) + fprintf(stderr, "Call to unimplemented API: %s\\n", fstr); +#endif } #endif +#if defined(GLXEXT) + LogMessage(X_ERROR, "GLX: Call to unimplemented API: %s\\n", fstr); +#endif } static void diff --git a/mesalib/src/mapi/glapi/gen/gl_table.py b/mesalib/src/mapi/glapi/gen/gl_table.py index b3dd4d8d0..608ace41a 100644 --- a/mesalib/src/mapi/glapi/gen/gl_table.py +++ b/mesalib/src/mapi/glapi/gen/gl_table.py @@ -92,6 +92,10 @@ class PrintRemapTable(gl_XML.gl_print_base): * can SET_FuncName, are used to get and set the dispatch pointer for the * named function in the specified dispatch table. */ +/* GLXEXT is defined when building the GLX extension in the xserver. + */ +#if !defined(GLXEXT) +#endif """ return |