From 1cc98f5a48924d750fbef7ea6b05a1ba49c28589 Mon Sep 17 00:00:00 2001 From: marha Date: Mon, 5 Nov 2012 07:36:16 +0100 Subject: xserver mesa xkbcomp git update 5 nov 2012 xserver: a194630f7f7b287cb4ea4a459df0745f4c0d4c1a mesa: ccbfe3dde94cd50a4e6468cfeabf95c79c9d8072 xkbcomp: a68c5b7b29eb1433b1be73b50c4248e10eab8e64 --- mesalib/configure.ac | 58 +- mesalib/m4/ax_prog_cc_for_build.m4 | 140 ++ mesalib/m4/ax_prog_cxx_for_build.m4 | 123 + mesalib/src/gallium/auxiliary/util/u_vbuf.c | 120 +- mesalib/src/gallium/auxiliary/util/u_vbuf.h | 6 +- mesalib/src/glsl/.gitignore | 1 - mesalib/src/glsl/Android.mk | 2 +- mesalib/src/glsl/Makefile.am | 48 +- mesalib/src/glsl/SConscript | 7 +- mesalib/src/glsl/builtin_compiler/.gitignore | 6 + mesalib/src/glsl/builtin_compiler/Makefile.am | 68 + .../src/glsl/builtin_compiler/builtin_stubs.cpp | 39 + mesalib/src/glsl/builtin_stubs.cpp | 39 - mesalib/src/mapi/glapi/SConscript | 6 +- .../src/mapi/glapi/gen/ARB_geometry_shader4.xml | 4 +- mesalib/src/mapi/glapi/gen/Makefile.am | 31 +- mesalib/src/mapi/glapi/gen/SConscript | 10 +- mesalib/src/mapi/glapi/gen/gl_API.xml | 3 + mesalib/src/mapi/glapi/gen/gl_XML.py | 7 +- mesalib/src/mapi/glapi/gen/gl_and_es_API.xml | 1 - mesalib/src/mapi/glapi/gen/gl_apitemp.py | 2 +- mesalib/src/mapi/glapi/gen/gl_gentable.py | 2 +- mesalib/src/mesa/Android.gen.mk | 33 +- mesalib/src/mesa/Makefile.am | 15 - mesalib/src/mesa/SConscript | 18 - mesalib/src/mesa/main/.gitignore | 3 - mesalib/src/mesa/main/APIspec.py | 617 ----- mesalib/src/mesa/main/APIspec.xml | 2383 -------------------- mesalib/src/mesa/main/APIspecutil.py | 272 --- mesalib/src/mesa/main/api_exec.c | 260 ++- mesalib/src/mesa/main/api_exec.h | 6 - mesalib/src/mesa/main/api_loopback.c | 9 +- mesalib/src/mesa/main/arrayobj.c | 2 +- mesalib/src/mesa/main/bufferobj.c | 24 +- mesalib/src/mesa/main/context.c | 27 +- mesalib/src/mesa/main/dlist.c | 12 +- mesalib/src/mesa/main/es1_conversion.c | 4 - mesalib/src/mesa/main/es1_conversion.h | 31 + mesalib/src/mesa/main/es_generator.py | 765 ------- mesalib/src/mesa/main/fbobject.c | 21 - mesalib/src/mesa/main/fbobject.h | 9 - mesalib/src/mesa/main/querymatrix.c | 13 +- mesalib/src/mesa/main/querymatrix.h | 39 + mesalib/src/mesa/main/queryobj.c | 16 +- mesalib/src/mesa/main/shaderapi.c | 76 +- mesalib/src/mesa/main/texgen.c | 10 +- mesalib/src/mesa/main/texgen.h | 2 +- mesalib/src/mesa/main/texobj.c | 2 +- mesalib/src/mesa/main/uniforms.c | 52 +- mesalib/src/mesa/main/vtxfmt.c | 51 +- mesalib/src/mesa/sources.mak | 1 - mesalib/src/mesa/swrast/s_texfetch.c | 2 +- 52 files changed, 985 insertions(+), 4513 deletions(-) create mode 100644 mesalib/m4/ax_prog_cc_for_build.m4 create mode 100644 mesalib/m4/ax_prog_cxx_for_build.m4 create mode 100644 mesalib/src/glsl/builtin_compiler/.gitignore create mode 100644 mesalib/src/glsl/builtin_compiler/Makefile.am create mode 100644 mesalib/src/glsl/builtin_compiler/builtin_stubs.cpp delete mode 100644 mesalib/src/glsl/builtin_stubs.cpp delete mode 100644 mesalib/src/mesa/main/APIspec.py delete mode 100644 mesalib/src/mesa/main/APIspec.xml delete mode 100644 mesalib/src/mesa/main/APIspecutil.py delete mode 100644 mesalib/src/mesa/main/es_generator.py create mode 100644 mesalib/src/mesa/main/querymatrix.h (limited to 'mesalib') diff --git a/mesalib/configure.ac b/mesalib/configure.ac index 6b97a26fc..55a9fa712 100644 --- a/mesalib/configure.ac +++ b/mesalib/configure.ac @@ -10,7 +10,7 @@ AC_INIT([Mesa], [9.1.0], [https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa]) AC_CONFIG_AUX_DIR([bin]) AC_CONFIG_MACRO_DIR([m4]) -AC_CANONICAL_HOST +AC_CANONICAL_SYSTEM AM_INIT_AUTOMAKE([foreign]) dnl http://people.gnome.org/~walters/docs/build-api.txt @@ -24,9 +24,6 @@ m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) -LT_PREREQ([2.2]) -LT_INIT([disable-static]) - dnl Set internal versions OSMESA_VERSION=8 AC_SUBST([OSMESA_VERSION]) @@ -45,7 +42,9 @@ LIBKMS_XORG_REQUIRED=1.0.0 dnl Check for progs AC_PROG_CPP AC_PROG_CC +AX_PROG_CC_FOR_BUILD AC_PROG_CXX +AX_PROG_CXX_FOR_BUILD AM_PROG_CC_C_O AM_PROG_AS AC_CHECK_PROGS([MAKE], [gmake make]) @@ -54,6 +53,9 @@ AC_PROG_SED AC_PROG_MKDIR_P AC_PATH_PROG([MKDEP], [makedepend]) +LT_PREREQ([2.2]) +LT_INIT([disable-static]) + if test "x$MKDEP" = "x"; then AC_MSG_ERROR([makedepend is required to build Mesa]) fi @@ -155,6 +157,21 @@ dnl Cache LDFLAGS and CPPFLAGS so we can add to them and restore later _SAVE_LDFLAGS="$LDFLAGS" _SAVE_CPPFLAGS="$CPPFLAGS" +dnl build host compiler macros +DEFINES_FOR_BUILD="" +AC_SUBST([DEFINES_FOR_BUILD]) +case "$build_os" in +linux*|*-gnu*|gnu*) + DEFINES_FOR_BUILD="$DEFINES_FOR_BUILD -D_GNU_SOURCE" + ;; +solaris*) + DEFINES_FOR_BUILD="$DEFINES_FOR_BUILD -DSVR4" + ;; +cygwin*) + DEFINES_FOR_BUILD="$DEFINES_FOR_BUILD" + ;; +esac + dnl Compiler macros DEFINES="" AC_SUBST([DEFINES]) @@ -177,6 +194,7 @@ if test "x$GCC" = xyes; then CFLAGS="$CFLAGS -Wall -std=gnu99" ;; *) + CFLAGS_FOR_BUILD="$CFLAGS_FOR_BUILD -Wall -std=c99" CFLAGS="$CFLAGS -Wall -std=c99" ;; esac @@ -206,13 +224,16 @@ if test "x$GCC" = xyes; then CFLAGS=$save_CFLAGS # Work around aliasing bugs - developers should comment this out + CFLAGS_FOR_BUILD="$CFLAGS_FOR_BUILD -fno-strict-aliasing" CFLAGS="$CFLAGS -fno-strict-aliasing" # gcc's builtin memcmp is slower than glibc's # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43052 + CFLAGS_FOR_BUILD="$CFLAGS_FOR_BUILD -fno-builtin-memcmp" CFLAGS="$CFLAGS -fno-builtin-memcmp" fi if test "x$GXX" = xyes; then + CXXFLAGS_FOR_BUILD="$CXXFLAGS_FOR_BUILD -Wall" CXXFLAGS="$CXXFLAGS -Wall" # Enable -fvisibility=hidden if using a gcc that supports it @@ -229,10 +250,12 @@ if test "x$GXX" = xyes; then CXXFLAGS=$save_CXXFLAGS # Work around aliasing bugs - developers should comment this out + CXXFLAGS_FOR_BUILD="$CXXFLAGS_FOR_BUILD -fno-strict-aliasing" CXXFLAGS="$CXXFLAGS -fno-strict-aliasing" # gcc's builtin memcmp is slower than glibc's # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43052 + CXXFLAGS_FOR_BUILD="$CXXFLAGS_FOR_BUILD -fno-builtin-memcmp" CXXFLAGS="$CXXFLAGS -fno-builtin-memcmp" fi @@ -316,6 +339,14 @@ AC_ARG_ENABLE([debug], [enable_debug=no] ) if test "x$enable_debug" = xyes; then + DEFINES_FOR_BUILD="$DEFINES_FOR_BUILD -DDEBUG" + if test "x$GCC_FOR_BUILD" = xyes; then + CFLAGS_FOR_BUILD="$CFLAGS_FOR_BUILD -g" + fi + if test "x$GXX_FOR_BUILD" = xyes; then + CXXFLAGS_FOR_BUILD="$CXXFLAGS_FOR_BUILD -g" + fi + DEFINES="$DEFINES -DDEBUG" if test "x$GCC" = xyes; then CFLAGS="$CFLAGS -g" @@ -1748,15 +1779,23 @@ gallium_require_drm_loader() { } radeon_llvm_check() { - LLVM_VERSION_MAJOR=`echo $LLVM_VERSION | cut -d. -f1` - if test "$LLVM_VERSION_MAJOR" -lt "3" -o "x$LLVM_VERSION" = "x3.0"; then - AC_MSG_ERROR([LLVM 3.1 or newer is required for the r600/radeonsi llvm compiler.]) + LLVM_REQUIRED_VERSION_MAJOR="3" + LLVM_REQUIRED_VERSION_MINOR="2" + LLVM_AVAILABLE_VERSION_MAJOR=`echo $LLVM_VERSION | cut -d. -f1` + LLVM_AVAILABLE_VERSION_MINOR=`echo $LLVM_VERSION | cut -d. -f2` + if test "$LLVM_AVAILABLE_VERSION_MAJOR" -lt "$LLVM_REQUIRED_VERSION_MAJOR" -o [ "$LLVM_AVAILABLE_VERSION_MAJOR" -eq "$LLVM_REQUIRED_VERSION_MAJOR" -a "$LLVM_AVAILABLE_VERSION_MINOR" -lt "$LLVM_REQUIRED_VERSION_MINOR" ] ; then + AC_MSG_ERROR([LLVM $LLVM_REQUIRED_VERSION_MAJOR.$LLVM_REQUIRED_VERSION_MINOR or newer with AMDGPU target enabled is required. + To use the r600/radeonsi LLVM backend, you need to fetch the LLVM source from: + git://people.freedesktop.org/~tstellar/llvm master + and build with --enable-experimental-targets=AMDGPU]) fi - if test "$LLVM_VERSION_MAJOR" -ge "3" -a "x$LLVM_VERSION" != "x3.1" && $LLVM_CONFIG --targets-built | grep -qv '\' ; then - AC_MSG_ERROR([To use the r600/radeonsi LLVM backend with LLVM 3.2 and newer, you need to fetch the LLVM source from: + if test true && $LLVM_CONFIG --targets-built | grep -qv '\' ; then + AC_MSG_ERROR([LLVM AMDGPU Target not enabled. + To use the r600/radeonsi LLVM backend, you need to fetch the LLVM source from: git://people.freedesktop.org/~tstellar/llvm master and build with --enable-experimental-targets=AMDGPU]) fi + AC_MSG_WARN([Please ensure you use the latest llvm tree from git://people.freedesktop.org/~tstellar/llvm master before submitting a bug]) if test "x$LLVM_VERSION" = "x3.2"; then LLVM_LIBS="$LLVM_LIBS `$LLVM_CONFIG --libs amdgpu`" fi @@ -1940,6 +1979,7 @@ AC_CONFIG_FILES([configs/current src/gbm/Makefile src/gbm/main/gbm.pc src/glsl/Makefile + src/glsl/builtin_compiler/Makefile src/glsl/glcpp/Makefile src/glsl/tests/Makefile src/glx/Makefile diff --git a/mesalib/m4/ax_prog_cc_for_build.m4 b/mesalib/m4/ax_prog_cc_for_build.m4 new file mode 100644 index 000000000..08095a83d --- /dev/null +++ b/mesalib/m4/ax_prog_cc_for_build.m4 @@ -0,0 +1,140 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_prog_cc_for_build.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_PROG_CC_FOR_BUILD +# +# DESCRIPTION +# +# This macro searches for a C compiler that generates native executables, +# that is a C compiler that surely is not a cross-compiler. This can be +# useful if you have to generate source code at compile-time like for +# example GCC does. +# +# The macro sets the CC_FOR_BUILD and CPP_FOR_BUILD macros to anything +# needed to compile or link (CC_FOR_BUILD) and preprocess (CPP_FOR_BUILD). +# The value of these variables can be overridden by the user by specifying +# a compiler with an environment variable (like you do for standard CC). +# +# It also sets BUILD_EXEEXT and BUILD_OBJEXT to the executable and object +# file extensions for the build platform, and GCC_FOR_BUILD to `yes' if +# the compiler we found is GCC. All these variables but GCC_FOR_BUILD are +# substituted in the Makefile. +# +# LICENSE +# +# Copyright (c) 2008 Paolo Bonzini +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 5 + +AU_ALIAS([AC_PROG_CC_FOR_BUILD], [AX_PROG_CC_FOR_BUILD]) +AC_DEFUN([AX_PROG_CC_FOR_BUILD], [dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_PROG_CPP])dnl +AC_REQUIRE([AC_EXEEXT])dnl +AC_REQUIRE([AC_CANONICAL_SYSTEM])dnl +dnl +pushdef([AC_TRY_COMPILER], [ +cat > conftest.$ac_ext << EOF +#line __oline__ "configure" +#include "confdefs.h" +[$1] +EOF +# If we can't run a trivial program, we are probably using a cross +compiler. +# Fail miserably. +if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} && (./conftest; +exit) 2>/dev/null; then + [$2]=yes +else + echo "configure: failed program was:" >&AC_FD_CC + cat conftest.$ac_ext >&AC_FD_CC + [$2]=no +fi +[$3]=no +rm -fr conftest*])dnl + +dnl Use the standard macros, but make them use other variable names +dnl +pushdef([cross_compiling], [#])dnl +pushdef([ac_cv_prog_CPP], ac_cv_build_prog_CPP)dnl +pushdef([ac_cv_prog_gcc], ac_cv_build_prog_gcc)dnl +pushdef([ac_cv_prog_cc_works], ac_cv_build_prog_cc_works)dnl +pushdef([ac_cv_prog_cc_cross], ac_cv_build_prog_cc_cross)dnl +pushdef([ac_cv_prog_cc_g], ac_cv_build_prog_cc_g)dnl +pushdef([ac_cv_exeext], ac_cv_build_exeext)dnl +pushdef([ac_cv_objext], ac_cv_build_objext)dnl +pushdef([ac_exeext], ac_build_exeext)dnl +pushdef([ac_objext], ac_build_objext)dnl +pushdef([CC], CC_FOR_BUILD)dnl +pushdef([CPP], CPP_FOR_BUILD)dnl +pushdef([CFLAGS], CFLAGS_FOR_BUILD)dnl +pushdef([CPPFLAGS], CPPFLAGS_FOR_BUILD)dnl +pushdef([LDFLAGS], LDFLAGS_FOR_BUILD)dnl +pushdef([host], build)dnl +pushdef([host_alias], build_alias)dnl +pushdef([host_cpu], build_cpu)dnl +pushdef([host_vendor], build_vendor)dnl +pushdef([host_os], build_os)dnl +pushdef([ac_cv_host], ac_cv_build)dnl +pushdef([ac_cv_host_alias], ac_cv_build_alias)dnl +pushdef([ac_cv_host_cpu], ac_cv_build_cpu)dnl +pushdef([ac_cv_host_vendor], ac_cv_build_vendor)dnl +pushdef([ac_cv_host_os], ac_cv_build_os)dnl +pushdef([ac_cpp], ac_build_cpp)dnl +pushdef([ac_compile], ac_build_compile)dnl +pushdef([ac_link], ac_build_link)dnl +pushdef([ac_tool_prefix], [#])dnl + +AC_PROG_CC +AC_PROG_CPP +AC_EXEEXT + +dnl Restore the old definitions +dnl +popdef([AC_TRY_COMPILER])dnl +popdef([ac_tool_prefix])dnl +popdef([ac_link])dnl +popdef([ac_compile])dnl +popdef([ac_cpp])dnl +popdef([ac_cv_host_os])dnl +popdef([ac_cv_host_vendor])dnl +popdef([ac_cv_host_cpu])dnl +popdef([ac_cv_host_alias])dnl +popdef([ac_cv_host])dnl +popdef([host_os])dnl +popdef([host_vendor])dnl +popdef([host_cpu])dnl +popdef([host_alias])dnl +popdef([host])dnl +popdef([CPPFLAGS])dnl +popdef([CFLAGS])dnl +popdef([CPP])dnl +popdef([CC])dnl +popdef([ac_objext])dnl +popdef([ac_exeext])dnl +popdef([ac_cv_objext])dnl +popdef([ac_cv_exeext])dnl +popdef([ac_cv_prog_cc_g])dnl +popdef([ac_cv_prog_cc_works])dnl +popdef([ac_cv_prog_cc_cross])dnl +popdef([ac_cv_prog_gcc])dnl +popdef([cross_compiling])dnl + +dnl Finally, set Makefile variables +dnl +BUILD_EXEEXT=$ac_build_exeext +BUILD_OBJEXT=$ac_build_objext +AC_SUBST(BUILD_EXEEXT)dnl +AC_SUBST(BUILD_OBJEXT)dnl +AC_SUBST([CFLAGS_FOR_BUILD])dnl +AC_SUBST([CPPFLAGS_FOR_BUILD])dnl +AC_SUBST([LDFLAGS_FOR_BUILD])dnl +]) diff --git a/mesalib/m4/ax_prog_cxx_for_build.m4 b/mesalib/m4/ax_prog_cxx_for_build.m4 new file mode 100644 index 000000000..4a099f9fb --- /dev/null +++ b/mesalib/m4/ax_prog_cxx_for_build.m4 @@ -0,0 +1,123 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_prog_cxx_for_build.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_PROG_CXX_FOR_BUILD +# +# DESCRIPTION +# +# This macro searches for a C++ compiler that generates native executables, +# that is a C++ compiler that surely is not a cross-compiler. This can be +# useful if you have to generate source code at compile-time like for +# example GCC does. +# +# The macro sets the CXX_FOR_BUILD and CXXCPP_FOR_BUILD macros to anything +# needed to compile or link (CXX_FOR_BUILD) and preprocess (CXXCPP_FOR_BUILD). +# The value of these variables can be overridden by the user by specifying +# a compiler with an environment variable (like you do for standard CXX). +# +# LICENSE +# +# Copyright (c) 2008 Paolo Bonzini +# Copyright (c) 2012 Avionic Design GmbH +# +# Based on the AX_PROG_CC_FOR_BUILD macro by Paolo Bonzini. +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 5 + +AU_ALIAS([AC_PROG_CXX_FOR_BUILD], [AX_PROG_CXX_FOR_BUILD]) +AC_DEFUN([AX_PROG_CXX_FOR_BUILD], [dnl +AC_REQUIRE([AX_PROG_CC_FOR_BUILD])dnl +AC_REQUIRE([AC_PROG_CXX])dnl +AC_REQUIRE([AC_PROG_CXXCPP])dnl +AC_REQUIRE([AC_CANONICAL_SYSTEM])dnl +dnl +pushdef([AC_TRY_COMPILER], [ +cat > conftest.$ac_ext << EOF +#line __oline__ "configure" +#include "confdefs.h" +[$1] +EOF +# If we can't run a trivial program, we are probably using a cross +compiler. +# Fail miserably. +if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} && (./conftest; +exit) 2>/dev/null; then + [$2]=yes +else + echo "configure: failed program was:" >&AC_FD_CC + cat conftest.$ac_ext >&AC_FD_CC + [$2]=no +fi +[$3]=no +rm -fr conftest*])dnl + +dnl Use the standard macros, but make them use other variable names +dnl +pushdef([cross_compiling], [#])dnl +pushdef([ac_cv_prog_CXXCPP], ac_cv_build_prog_CXXCPP)dnl +pushdef([ac_cv_prog_gxx], ac_cv_build_prog_gxx)dnl +pushdef([ac_cv_prog_cxx_works], ac_cv_build_prog_cxx_works)dnl +pushdef([ac_cv_prog_cxx_cross], ac_cv_build_prog_cxx_cross)dnl +pushdef([ac_cv_prog_cxx_g], ac_cv_build_prog_cxx_g)dnl +pushdef([CXX], CXX_FOR_BUILD)dnl +pushdef([CXXCPP], CXXCPP_FOR_BUILD)dnl +pushdef([CXXFLAGS], CXXFLAGS_FOR_BUILD)dnl +pushdef([CXXCPPFLAGS], CXXCPPFLAGS_FOR_BUILD)dnl +pushdef([host], build)dnl +pushdef([host_alias], build_alias)dnl +pushdef([host_cpu], build_cpu)dnl +pushdef([host_vendor], build_vendor)dnl +pushdef([host_os], build_os)dnl +pushdef([ac_cv_host], ac_cv_build)dnl +pushdef([ac_cv_host_alias], ac_cv_build_alias)dnl +pushdef([ac_cv_host_cpu], ac_cv_build_cpu)dnl +pushdef([ac_cv_host_vendor], ac_cv_build_vendor)dnl +pushdef([ac_cv_host_os], ac_cv_build_os)dnl +pushdef([ac_cxxcpp], ac_build_cxxcpp)dnl +pushdef([ac_compile], ac_build_compile)dnl +pushdef([ac_link], ac_build_link)dnl +pushdef([ac_tool_prefix], [#])dnl + +AC_PROG_CXX +AC_PROG_CXXCPP + +dnl Restore the old definitions +dnl +popdef([AC_TRY_COMPILER])dnl +popdef([ac_tool_prefix])dnl +popdef([ac_link])dnl +popdef([ac_compile])dnl +popdef([ac_cxxcpp])dnl +popdef([ac_cv_host_os])dnl +popdef([ac_cv_host_vendor])dnl +popdef([ac_cv_host_cpu])dnl +popdef([ac_cv_host_alias])dnl +popdef([ac_cv_host])dnl +popdef([host_os])dnl +popdef([host_vendor])dnl +popdef([host_cpu])dnl +popdef([host_alias])dnl +popdef([host])dnl +popdef([CXXCPPFLAGS])dnl +popdef([CXXFLAGS])dnl +popdef([CXXCPP])dnl +popdef([CXX])dnl +popdef([ac_cv_prog_cxx_g])dnl +popdef([ac_cv_prog_cxx_works])dnl +popdef([ac_cv_prog_cxx_cross])dnl +popdef([ac_cv_prog_gxx])dnl +popdef([cross_compiling])dnl + +dnl Finally, set Makefile variables +dnl +AC_SUBST([CXXFLAGS_FOR_BUILD])dnl +AC_SUBST([CXXCPPFLAGS_FOR_BUILD])dnl +]) diff --git a/mesalib/src/gallium/auxiliary/util/u_vbuf.c b/mesalib/src/gallium/auxiliary/util/u_vbuf.c index 7fb492882..b712b52de 100644 --- a/mesalib/src/gallium/auxiliary/util/u_vbuf.c +++ b/mesalib/src/gallium/auxiliary/util/u_vbuf.c @@ -25,6 +25,66 @@ * **************************************************************************/ +/** + * This module uploads user buffers and translates the vertex buffers which + * contain incompatible vertices (i.e. not supported by the driver/hardware) + * into compatible ones, based on the Gallium CAPs. + * + * It does not upload index buffers. + * + * The module heavily uses bitmasks to represent per-buffer and + * per-vertex-element flags to avoid looping over the list of buffers just + * to see if there's a non-zero stride, or user buffer, or unsupported format, + * etc. + * + * There are 3 categories of vertex elements, which are processed separately: + * - per-vertex attribs (stride != 0, instance_divisor == 0) + * - instanced attribs (stride != 0, instance_divisor > 0) + * - constant attribs (stride == 0) + * + * All needed uploads and translations are performed every draw command, but + * only the subset of vertices needed for that draw command is uploaded or + * translated. (the module never translates whole buffers) + * + * + * The module consists of two main parts: + * + * + * 1) Translate (u_vbuf_translate_begin/end) + * + * This is pretty much a vertex fetch fallback. It translates vertices from + * one vertex buffer to another in an unused vertex buffer slot. It does + * whatever is needed to make the vertices readable by the hardware (changes + * vertex formats and aligns offsets and strides). The translate module is + * used here. + * + * Each of the 3 categories is translated to a separate buffer. + * Only the [min_index, max_index] range is translated. For instanced attribs, + * the range is [start_instance, start_instance+instance_count]. For constant + * attribs, the range is [0, 1]. + * + * + * 2) User buffer uploading (u_vbuf_upload_buffers) + * + * Only the [min_index, max_index] range is uploaded (just like Translate) + * with a single memcpy. + * + * This method works best for non-indexed draw operations or indexed draw + * operations where the [min_index, max_index] range is not being way bigger + * than the vertex count. + * + * If the range is too big (e.g. one triangle with indices {0, 1, 10000}), + * the per-vertex attribs are uploaded via the translate module, all packed + * into one vertex buffer, and the indexed draw call is turned into + * a non-indexed one in the process. This adds additional complexity + * to the translate part, but it prevents bad apps from bringing your frame + * rate down. + * + * + * If there is nothing to do, it forwards every command to the driver. + * The module also has its own CSO cache of vertex element states. + */ + #include "util/u_vbuf.h" #include "util/u_dump.h" @@ -49,6 +109,8 @@ struct u_vbuf_elements { enum pipe_format native_format[PIPE_MAX_ATTRIBS]; unsigned native_format_size[PIPE_MAX_ATTRIBS]; + /* Which buffers are used by the vertex element state. */ + uint32_t used_vb_mask; /* This might mean two things: * - src_format != native_format, as discussed above. * - src_offset % 4 != 0 (if the caps don't allow such an offset). */ @@ -430,6 +492,8 @@ u_vbuf_translate_begin(struct u_vbuf *mgr, struct translate_key key[VB_NUM]; unsigned elem_index[VB_NUM][PIPE_MAX_ATTRIBS]; /* ... into key.elements */ unsigned i, type; + unsigned incompatible_vb_mask = mgr->incompatible_vb_mask & + mgr->ve->used_vb_mask; int start[VB_NUM] = { start_vertex, /* VERTEX */ @@ -453,20 +517,20 @@ u_vbuf_translate_begin(struct u_vbuf *mgr, if (!mgr->vertex_buffer[vb_index].stride) { if (!(mgr->ve->incompatible_elem_mask & (1 << i)) && - !(mgr->incompatible_vb_mask & (1 << vb_index))) { + !(incompatible_vb_mask & (1 << vb_index))) { continue; } mask[VB_CONST] |= 1 << vb_index; } else if (mgr->ve->ve[i].instance_divisor) { if (!(mgr->ve->incompatible_elem_mask & (1 << i)) && - !(mgr->incompatible_vb_mask & (1 << vb_index))) { + !(incompatible_vb_mask & (1 << vb_index))) { continue; } mask[VB_INSTANCE] |= 1 << vb_index; } else { if (!unroll_indices && !(mgr->ve->incompatible_elem_mask & (1 << i)) && - !(mgr->incompatible_vb_mask & (1 << vb_index))) { + !(incompatible_vb_mask & (1 << vb_index))) { continue; } mask[VB_VERTEX] |= 1 << vb_index; @@ -488,7 +552,7 @@ u_vbuf_translate_begin(struct u_vbuf *mgr, bit = 1 << vb_index; if (!(mgr->ve->incompatible_elem_mask & (1 << i)) && - !(mgr->incompatible_vb_mask & (1 << vb_index)) && + !(incompatible_vb_mask & (1 << vb_index)) && (!unroll_indices || !(mask[VB_VERTEX] & bit))) { continue; } @@ -690,6 +754,7 @@ u_vbuf_create_vertex_elements(struct u_vbuf *mgr, unsigned count, } } + ve->used_vb_mask = used_buffers; ve->compatible_vb_mask_all = ~ve->incompatible_vb_mask_any & used_buffers; ve->incompatible_vb_mask_all = ~ve->compatible_vb_mask_any & used_buffers; @@ -826,18 +891,18 @@ u_vbuf_upload_buffers(struct u_vbuf *mgr, { unsigned i; unsigned nr_velems = mgr->ve->count; - unsigned nr_vbufs = util_last_bit(mgr->enabled_vb_mask); struct pipe_vertex_element *velems = mgr->using_translate ? mgr->fallback_velems : mgr->ve->ve; unsigned start_offset[PIPE_MAX_ATTRIBS]; - unsigned end_offset[PIPE_MAX_ATTRIBS] = {0}; + unsigned end_offset[PIPE_MAX_ATTRIBS]; + uint32_t buffer_mask = 0; /* Determine how much data needs to be uploaded. */ for (i = 0; i < nr_velems; i++) { struct pipe_vertex_element *velem = &velems[i]; unsigned index = velem->vertex_buffer_index; struct pipe_vertex_buffer *vb = &mgr->vertex_buffer[index]; - unsigned instance_div, first, size; + unsigned instance_div, first, size, index_bit; /* Skip the buffers generated by translate. */ if (index == mgr->fallback_vbs[VB_VERTEX] || @@ -867,8 +932,10 @@ u_vbuf_upload_buffers(struct u_vbuf *mgr, size = vb->stride * (num_vertices - 1) + mgr->ve->src_format_size[i]; } + index_bit = 1 << index; + /* Update offsets. */ - if (!end_offset[index]) { + if (!(buffer_mask & index_bit)) { start_offset[index] = first; end_offset[index] = first + size; } else { @@ -877,19 +944,20 @@ u_vbuf_upload_buffers(struct u_vbuf *mgr, if (first + size > end_offset[index]) end_offset[index] = first + size; } + + buffer_mask |= index_bit; } /* Upload buffers. */ - for (i = 0; i < nr_vbufs; i++) { - unsigned start, end = end_offset[i]; + while (buffer_mask) { + unsigned start, end; struct pipe_vertex_buffer *real_vb; const uint8_t *ptr; - if (!end) { - continue; - } + i = u_bit_scan(&buffer_mask); start = start_offset[i]; + end = end_offset[i]; assert(start < end); real_vb = &mgr->real_vertex_buffer[i]; @@ -907,9 +975,10 @@ static boolean u_vbuf_need_minmax_index(struct u_vbuf *mgr) /* See if there are any per-vertex attribs which will be uploaded or * translated. Use bitmasks to get the info instead of looping over vertex * elements. */ - return ((mgr->user_vb_mask | mgr->incompatible_vb_mask | - mgr->ve->incompatible_vb_mask_any) & - mgr->ve->noninstance_vb_mask_any & mgr->nonzero_stride_vb_mask) != 0; + return (mgr->ve->used_vb_mask & + ((mgr->user_vb_mask | mgr->incompatible_vb_mask | + mgr->ve->incompatible_vb_mask_any) & + mgr->ve->noninstance_vb_mask_any & mgr->nonzero_stride_vb_mask)) != 0; } static boolean u_vbuf_mapping_vertex_buffer_blocks(struct u_vbuf *mgr) @@ -918,9 +987,10 @@ static boolean u_vbuf_mapping_vertex_buffer_blocks(struct u_vbuf *mgr) * * We could query whether each buffer is busy, but that would * be way more costly than this. */ - return (~mgr->user_vb_mask & ~mgr->incompatible_vb_mask & - mgr->ve->compatible_vb_mask_all & mgr->ve->noninstance_vb_mask_any & - mgr->nonzero_stride_vb_mask) != 0; + return (mgr->ve->used_vb_mask & + (~mgr->user_vb_mask & ~mgr->incompatible_vb_mask & + mgr->ve->compatible_vb_mask_all & mgr->ve->noninstance_vb_mask_any & + mgr->nonzero_stride_vb_mask)) != 0; } static void u_vbuf_get_minmax_index(struct pipe_context *pipe, @@ -1041,15 +1111,17 @@ void u_vbuf_draw_vbo(struct u_vbuf *mgr, const struct pipe_draw_info *info) int start_vertex, min_index; unsigned num_vertices; boolean unroll_indices = FALSE; - uint32_t user_vb_mask = mgr->user_vb_mask; + uint32_t used_vb_mask = mgr->ve->used_vb_mask; + uint32_t user_vb_mask = mgr->user_vb_mask & used_vb_mask; + uint32_t incompatible_vb_mask = mgr->incompatible_vb_mask & used_vb_mask; /* Normal draw. No fallback and no user buffers. */ - if (!mgr->incompatible_vb_mask && + if (!incompatible_vb_mask && !mgr->ve->incompatible_elem_mask && !user_vb_mask) { /* Set vertex buffers if needed. */ - if (mgr->dirty_real_vb_mask) { + if (mgr->dirty_real_vb_mask & used_vb_mask) { u_vbuf_set_driver_vertex_buffers(mgr); } @@ -1102,7 +1174,7 @@ void u_vbuf_draw_vbo(struct u_vbuf *mgr, const struct pipe_draw_info *info) /* Translate vertices with non-native layouts or formats. */ if (unroll_indices || - mgr->incompatible_vb_mask || + incompatible_vb_mask || mgr->ve->incompatible_elem_mask) { /* XXX check the return value */ u_vbuf_translate_begin(mgr, start_vertex, num_vertices, @@ -1110,7 +1182,7 @@ void u_vbuf_draw_vbo(struct u_vbuf *mgr, const struct pipe_draw_info *info) info->start, info->count, min_index, unroll_indices); - user_vb_mask &= ~(mgr->incompatible_vb_mask | + user_vb_mask &= ~(incompatible_vb_mask | mgr->ve->incompatible_vb_mask_all); } diff --git a/mesalib/src/gallium/auxiliary/util/u_vbuf.h b/mesalib/src/gallium/auxiliary/util/u_vbuf.h index 0f8227164..a608184e5 100644 --- a/mesalib/src/gallium/auxiliary/util/u_vbuf.h +++ b/mesalib/src/gallium/auxiliary/util/u_vbuf.h @@ -28,9 +28,9 @@ #ifndef U_VBUF_H #define U_VBUF_H -/* This module builds upon u_upload_mgr and translate_cache and takes care of - * user buffer uploads and vertex format fallbacks. It's designed - * for the drivers which don't always use the Draw module. (e.g. for HWTCL) +/* This module takes care of user buffer uploads and vertex format fallbacks. + * It's designed for the drivers which don't want to use the Draw module. + * There is a more detailed description at the beginning of the .c file. */ #include "pipe/p_context.h" diff --git a/mesalib/src/glsl/.gitignore b/mesalib/src/glsl/.gitignore index 81240b952..068d4874b 100644 --- a/mesalib/src/glsl/.gitignore +++ b/mesalib/src/glsl/.gitignore @@ -4,6 +4,5 @@ glsl_parser.cc glsl_parser.h glsl_parser.output builtin_function.cpp -builtin_compiler glsl_test /Makefile diff --git a/mesalib/src/glsl/Android.mk b/mesalib/src/glsl/Android.mk index 87a02f51b..f975d03d1 100644 --- a/mesalib/src/glsl/Android.mk +++ b/mesalib/src/glsl/Android.mk @@ -60,7 +60,7 @@ LOCAL_SRC_FILES := \ $(LIBGLCPP_FILES) \ $(LIBGLSL_FILES) \ $(LIBGLSL_CXX_FILES) \ - $(BUILTIN_COMPILER_CXX_FILES) \ + $(GLSL_SRCDIR)/builtin_compiler/builtin_stubs.cpp \ $(GLSL_COMPILER_CXX_FILES) LOCAL_C_INCLUDES := \ diff --git a/mesalib/src/glsl/Makefile.am b/mesalib/src/glsl/Makefile.am index 1ecc0036c..6fb3d2d9d 100644 --- a/mesalib/src/glsl/Makefile.am +++ b/mesalib/src/glsl/Makefile.am @@ -19,9 +19,7 @@ # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS # IN THE SOFTWARE. - -# builtin_compiler is built before libglsl to generate builtin_function.cpp for libglsl. -# For this to work, a dummy version of builtin_function.cpp, builtin_stubs.cpp, is used. +SUBDIRS = builtin_compiler glcpp AM_CPPFLAGS = \ -I$(top_srcdir)/include \ @@ -38,32 +36,23 @@ AM_LFLAGS = --nounistd -o$(LEX_OUTPUT_ROOT).c include Makefile.sources -noinst_LTLIBRARIES = libglslcommon.la libglsl.la -noinst_PROGRAMS = glsl_compiler glsl_test builtin_compiler +noinst_LTLIBRARIES = libglsl.la +noinst_PROGRAMS = glsl_compiler glsl_test -# common sources for builtin_compiler and libglsl -libglslcommon_la_SOURCES = \ +libglsl_la_SOURCES = \ glsl_lexer.ll \ glsl_parser.cc \ $(LIBGLSL_FILES) \ - $(LIBGLSL_CXX_FILES) - -libglslcommon_la_LIBADD = glcpp/libglcpp.la - -# common sources for builtin_compiler and glsl_compiler -GLSL2_SOURCES = \ - $(top_srcdir)/src/mesa/program/hash_table.c \ - $(top_srcdir)/src/mesa/program/symbol_table.c \ - $(GLSL_COMPILER_CXX_FILES) - -libglsl_la_SOURCES = \ + $(LIBGLSL_CXX_FILES) \ builtin_function.cpp -libglsl_la_LIBADD = libglslcommon.la +libglsl_la_LIBADD = glcpp/libglcpp.la libglsl_la_LDFLAGS = glsl_compiler_SOURCES = \ - $(GLSL2_SOURCES) + $(top_srcdir)/src/mesa/program/hash_table.c \ + $(top_srcdir)/src/mesa/program/symbol_table.c \ + $(GLSL_COMPILER_CXX_FILES) glsl_compiler_LDADD = libglsl.la @@ -76,12 +65,6 @@ glsl_test_SOURCES = \ glsl_test_LDADD = libglsl.la -builtin_compiler_SOURCES = \ - $(GLSL2_SOURCES) \ - builtin_stubs.cpp - -builtin_compiler_LDADD = libglslcommon.la - # automake <=1.11 and automake >=1.12 have different conventions for naming C++ header files # made by yacc. To work with both, we write our own rule rather than using automake's. # When (if) we require automake >=1.12 in configure.ac, this can be removed, and we can use @@ -89,16 +72,11 @@ builtin_compiler_LDADD = libglslcommon.la glsl_parser.cc glsl_parser.h: glsl_parser.yy $(AM_V_GEN) $(YACC) -v -o glsl_parser.cc -p "_mesa_glsl_" --defines=glsl_parser.h $< -BUILT_SOURCES = glsl_parser.h builtin_function.cpp -CLEANFILES = glsl_lexer.cc glsl_parser.cc $(BUILT_SOURCES) - -builtin_function.cpp: $(srcdir)/builtins/profiles/* $(srcdir)/builtins/ir/* $(srcdir)/builtins/glsl/* $(srcdir)/builtins/tools/generate_builtins.py $(srcdir)/builtins/tools/texture_builtins.py builtin_compiler$(EXEEXT) - $(AM_V_GEN) $(PYTHON2) $(PYTHON_FLAGS) $(srcdir)/builtins/tools/generate_builtins.py ./builtin_compiler > builtin_function.cpp || rm -f builtin_function.cpp - -glcpp/libglcpp.la: - cd glcpp ; $(MAKE) $(AM_MAKEFLAGS) +BUILT_SOURCES = glsl_parser.h +CLEANFILES = glsl_lexer.cc glsl_parser.cc $(BUILT_SOURCES) builtin_function.cpp -SUBDIRS = glcpp +builtin_function.cpp: $(srcdir)/builtins/profiles/* $(srcdir)/builtins/ir/* $(srcdir)/builtins/glsl/* $(srcdir)/builtins/tools/generate_builtins.py $(srcdir)/builtins/tools/texture_builtins.py builtin_compiler/builtin_compiler$(BUILD_EXEEXT) + $(AM_V_GEN) $(PYTHON2) $(PYTHON_FLAGS) $(srcdir)/builtins/tools/generate_builtins.py builtin_compiler/builtin_compiler$(BUILD_EXEEXT) > builtin_function.cpp || rm -f builtin_function.cpp # Provide compatibility with scripts for the old Mesa build system for # a while by putting a link to the library in the current directory. diff --git a/mesalib/src/glsl/SConscript b/mesalib/src/glsl/SConscript index 6314c7551..89014ee3c 100644 --- a/mesalib/src/glsl/SConscript +++ b/mesalib/src/glsl/SConscript @@ -71,9 +71,10 @@ else: compiler_objs += mesa_objs builtin_compiler = env.Program( - target = 'builtin_compiler', - source = compiler_objs + glsl_sources + \ - source_lists['BUILTIN_COMPILER_CXX_FILES'], + target = 'builtin_compiler/builtin_compiler', + source = compiler_objs + glsl_sources + [ + 'builtin_compiler/builtin_stubs.cpp', + ] ) # SCons builtin dependency scanner doesn't detect that glsl_lexer.ll diff --git a/mesalib/src/glsl/builtin_compiler/.gitignore b/mesalib/src/glsl/builtin_compiler/.gitignore new file mode 100644 index 000000000..40c551baa --- /dev/null +++ b/mesalib/src/glsl/builtin_compiler/.gitignore @@ -0,0 +1,6 @@ +builtin_compiler +glcpp-lex.c +glcpp-parse.c +glcpp-parse.h +glcpp-parse.output +/Makefile diff --git a/mesalib/src/glsl/builtin_compiler/Makefile.am b/mesalib/src/glsl/builtin_compiler/Makefile.am new file mode 100644 index 000000000..72032b524 --- /dev/null +++ b/mesalib/src/glsl/builtin_compiler/Makefile.am @@ -0,0 +1,68 @@ +# Copyright © 2012 Jon TURNEY +# Copyright © 2012 Thierry Reding +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice (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 NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. + +CC = @CC_FOR_BUILD@ +CFLAGS = @CFLAGS_FOR_BUILD@ +CPP = @CPP_FOR_BUILD@ +CPPFLAGS = @CPPFLAGS_FOR_BUILD@ +CXX = @CXX_FOR_BUILD@ +CXXFLAGS = @CXXFLAGS_FOR_BUILD@ +LD = @LD_FOR_BUILD@ +LDFLAGS = @LDFLAGS_FOR_BUILD@ + +AM_CFLAGS = \ + -I $(top_srcdir)/include \ + -I $(top_srcdir)/src/mapi \ + -I $(top_srcdir)/src/mesa \ + -I $(GLSL_SRCDIR) \ + -I $(GLSL_SRCDIR)/glcpp \ + $(DEFINES_FOR_BUILD) + +AM_CXXFLAGS = $(AM_CFLAGS) + +AM_YFLAGS = -v -d -p "glcpp_parser_" +AM_LFLAGS = --nounistd -o$(LEX_OUTPUT_ROOT).c + +include ../Makefile.sources + +noinst_PROGRAMS = builtin_compiler + +builtin_compiler_SOURCES = \ + $(GLSL_SRCDIR)/glcpp/glcpp-lex.l \ + $(GLSL_SRCDIR)/glcpp/glcpp-parse.y \ + $(LIBGLCPP_FILES) \ + $(GLSL_SRCDIR)/glsl_lexer.ll \ + $(GLSL_SRCDIR)/glsl_parser.cc \ + $(LIBGLSL_FILES) \ + $(LIBGLSL_CXX_FILES) \ + $(top_srcdir)/src/mesa/program/hash_table.c \ + $(top_srcdir)/src/mesa/program/symbol_table.c \ + $(GLSL_COMPILER_CXX_FILES) \ + builtin_stubs.cpp + +BUILT_SOURCES = \ + glcpp-lex.c \ + glcpp-parse.c \ + glcpp-parse.h \ + glsl_lexer.cc + +CLEANFILES = $(BUILT_SOURCES) diff --git a/mesalib/src/glsl/builtin_compiler/builtin_stubs.cpp b/mesalib/src/glsl/builtin_compiler/builtin_stubs.cpp new file mode 100644 index 000000000..dfa5d324e --- /dev/null +++ b/mesalib/src/glsl/builtin_compiler/builtin_stubs.cpp @@ -0,0 +1,39 @@ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (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 NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#include +#include "glsl_parser_extras.h" + +/* A dummy file. When compiling prototypes, we don't care about builtins. + * We really don't want to half-compile builtin_functions.cpp and fail, though. + */ +void +_mesa_glsl_release_functions(void) +{ +} + +void +_mesa_glsl_initialize_functions(_mesa_glsl_parse_state *state) +{ + (void) state; +} diff --git a/mesalib/src/glsl/builtin_stubs.cpp b/mesalib/src/glsl/builtin_stubs.cpp deleted file mode 100644 index dfa5d324e..000000000 --- a/mesalib/src/glsl/builtin_stubs.cpp +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright © 2010 Intel Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (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 NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - -#include -#include "glsl_parser_extras.h" - -/* A dummy file. When compiling prototypes, we don't care about builtins. - * We really don't want to half-compile builtin_functions.cpp and fail, though. - */ -void -_mesa_glsl_release_functions(void) -{ -} - -void -_mesa_glsl_initialize_functions(_mesa_glsl_parse_state *state) -{ - (void) state; -} diff --git a/mesalib/src/mapi/glapi/SConscript b/mesalib/src/mapi/glapi/SConscript index c336c2510..153374cc5 100644 --- a/mesalib/src/mapi/glapi/SConscript +++ b/mesalib/src/mapi/glapi/SConscript @@ -61,7 +61,7 @@ if env['gcc'] and env['platform'] not in ('cygwin', 'darwin', 'windows'): env.CodeGenerate( target = 'glapi_x86.S', script = GLAPI + 'gen/gl_x86_asm.py', - source = GLAPI + 'gen/gl_API.xml', + source = GLAPI + 'gen/gl_and_es_API.xml', command = python_cmd + ' $SCRIPT -f $SOURCE > $TARGET' ) elif env['machine'] == 'x86_64': @@ -74,7 +74,7 @@ if env['gcc'] and env['platform'] not in ('cygwin', 'darwin', 'windows'): env.CodeGenerate( target = 'glapi_x86-64.S', script = GLAPI + 'gen/gl_x86-64_asm.py', - source = GLAPI + 'gen/gl_API.xml', + source = GLAPI + 'gen/gl_and_es_API.xml', command = python_cmd + ' $SCRIPT -f $SOURCE > $TARGET' ) elif env['machine'] == 'sparc': @@ -87,7 +87,7 @@ if env['gcc'] and env['platform'] not in ('cygwin', 'darwin', 'windows'): env.CodeGenerate( target = 'glapi_sparc.S', script = GLAPI + 'gen/gl_SPARC_asm.py', - source = GLAPI + 'gen/gl_API.xml', + source = GLAPI + 'gen/gl_and_es_API.xml', command = python_cmd + ' $SCRIPT -f $SOURCE > $TARGET' ) else: diff --git a/mesalib/src/mapi/glapi/gen/ARB_geometry_shader4.xml b/mesalib/src/mapi/glapi/gen/ARB_geometry_shader4.xml index d9e540fc9..97a4e2e8f 100644 --- a/mesalib/src/mapi/glapi/gen/ARB_geometry_shader4.xml +++ b/mesalib/src/mapi/glapi/gen/ARB_geometry_shader4.xml @@ -27,12 +27,12 @@ - + - + diff --git a/mesalib/src/mapi/glapi/gen/Makefile.am b/mesalib/src/mapi/glapi/gen/Makefile.am index 40aaf51cd..14bb2dfe6 100644 --- a/mesalib/src/mapi/glapi/gen/Makefile.am +++ b/mesalib/src/mapi/glapi/gen/Makefile.am @@ -135,10 +135,11 @@ API_XML = \ GL3x.xml -COMMON = $(API_XML) gl_XML.py glX_XML.py license.py typeexpr.py - -COMMON_ES = \ - $(COMMON) \ +COMMON = $(API_XML) \ + gl_XML.py \ + glX_XML.py \ + license.py \ + typeexpr.py \ gl_and_es_API.xml \ es_EXT.xml \ ARB_ES2_compatibility.xml \ @@ -182,43 +183,43 @@ $(XORG_GLAPI_DIR)/%.h: $(MESA_GLAPI_DIR)/%.h ###################################################################### -$(MESA_GLAPI_DIR)/glapi_mapi_tmp.h: $(MESA_MAPI_DIR)/mapi_abi.py $(COMMON_ES) +$(MESA_GLAPI_DIR)/glapi_mapi_tmp.h: $(MESA_MAPI_DIR)/mapi_abi.py $(COMMON) $(PYTHON_GEN) $< \ --printer glapi --mode lib $(srcdir)/gl_and_es_API.xml > $@ $(MESA_GLAPI_DIR)/glprocs.h: gl_procs.py $(COMMON) - $(PYTHON_GEN) $< -f $(srcdir)/gl_API.xml > $@ + $(PYTHON_GEN) $< -f $(srcdir)/gl_and_es_API.xml > $@ $(MESA_GLAPI_DIR)/glapitemp.h: gl_apitemp.py $(COMMON) - $(PYTHON_GEN) $< -f $(srcdir)/gl_API.xml > $@ + $(PYTHON_GEN) $< -f $(srcdir)/gl_and_es_API.xml > $@ $(MESA_GLAPI_DIR)/glapitable.h: gl_table.py $(COMMON) - $(PYTHON_GEN) $< -f $(srcdir)/gl_API.xml > $@ + $(PYTHON_GEN) $< -f $(srcdir)/gl_and_es_API.xml > $@ $(MESA_GLAPI_DIR)/glapi_gentable.c: gl_gentable.py $(COMMON) - $(PYTHON_GEN) $< -f $(srcdir)/gl_API.xml > $@ + $(PYTHON_GEN) $< -f $(srcdir)/gl_and_es_API.xml > $@ ###################################################################### $(MESA_GLAPI_DIR)/glapi_x86.S: gl_x86_asm.py $(COMMON) - $(PYTHON_GEN) $< -f $(srcdir)/gl_API.xml > $@ + $(PYTHON_GEN) $< -f $(srcdir)/gl_and_es_API.xml > $@ $(MESA_GLAPI_DIR)/glapi_x86-64.S: gl_x86-64_asm.py $(COMMON) - $(PYTHON_GEN) $< -f $(srcdir)/gl_API.xml > $@ + $(PYTHON_GEN) $< -f $(srcdir)/gl_and_es_API.xml > $@ $(MESA_GLAPI_DIR)/glapi_sparc.S: gl_SPARC_asm.py $(COMMON) - $(PYTHON_GEN) $< -f $(srcdir)/gl_API.xml > $@ + $(PYTHON_GEN) $< -f $(srcdir)/gl_and_es_API.xml > $@ ###################################################################### -$(MESA_DIR)/main/enums.c: gl_enums.py $(COMMON_ES) +$(MESA_DIR)/main/enums.c: gl_enums.py $(COMMON) $(PYTHON_GEN) $< -f $(srcdir)/gl_and_es_API.xml > $@ $(MESA_DIR)/main/dispatch.h: gl_table.py $(COMMON) - $(PYTHON_GEN) $< -f $(srcdir)/gl_API.xml -m remap_table > $@ + $(PYTHON_GEN) $< -f $(srcdir)/gl_and_es_API.xml -m remap_table > $@ $(MESA_DIR)/main/remap_helper.h: remap_helper.py $(COMMON) - $(PYTHON_GEN) $< -f $(srcdir)/gl_API.xml > $@ + $(PYTHON_GEN) $< -f $(srcdir)/gl_and_es_API.xml > $@ ###################################################################### diff --git a/mesalib/src/mapi/glapi/gen/SConscript b/mesalib/src/mapi/glapi/gen/SConscript index e8bb22731..353d02175 100644 --- a/mesalib/src/mapi/glapi/gen/SConscript +++ b/mesalib/src/mapi/glapi/gen/SConscript @@ -14,35 +14,35 @@ glapi_headers = [] glapi_headers += env.CodeGenerate( target = '#src/mesa/main/dispatch.h', script = GLAPI + 'gen/gl_table.py', - source = GLAPI + 'gen/gl_API.xml', + source = GLAPI + 'gen/gl_and_es_API.xml', command = python_cmd + ' $SCRIPT -m remap_table -f $SOURCE > $TARGET', ) glapi_headers += env.CodeGenerate( target = '#src/mapi/glapi/glapitable.h', script = GLAPI + 'gen/gl_table.py', - source = GLAPI + 'gen/gl_API.xml', + source = GLAPI + 'gen/gl_and_es_API.xml', command = python_cmd + ' $SCRIPT -f $SOURCE > $TARGET' ) glapi_headers += env.CodeGenerate( target = '#src/mapi/glapi/glapitemp.h', script = GLAPI + 'gen/gl_apitemp.py', - source = GLAPI + 'gen/gl_API.xml', + source = GLAPI + 'gen/gl_and_es_API.xml', command = python_cmd + ' $SCRIPT -f $SOURCE > $TARGET' ) glapi_headers += env.CodeGenerate( target = '#src/mapi/glapi/glprocs.h', script = GLAPI + 'gen/gl_procs.py', - source = GLAPI + 'gen/gl_API.xml', + source = GLAPI + 'gen/gl_and_es_API.xml', command = python_cmd + ' $SCRIPT -f $SOURCE > $TARGET' ) glapi_headers += env.CodeGenerate( target = '#src/mesa/main/remap_helper.h', script = GLAPI + 'gen/remap_helper.py', - source = GLAPI + 'gen/gl_API.xml', + source = GLAPI + 'gen/gl_and_es_API.xml', command = python_cmd + ' $SCRIPT -f $SOURCE > $TARGET' ) diff --git a/mesalib/src/mapi/glapi/gen/gl_API.xml b/mesalib/src/mapi/glapi/gen/gl_API.xml index c38aa3a59..ca7f383e3 100644 --- a/mesalib/src/mapi/glapi/gen/gl_API.xml +++ b/mesalib/src/mapi/glapi/gen/gl_API.xml @@ -12731,4 +12731,7 @@ + + + diff --git a/mesalib/src/mapi/glapi/gen/gl_XML.py b/mesalib/src/mapi/glapi/gen/gl_XML.py index ef7ed519b..019687912 100644 --- a/mesalib/src/mapi/glapi/gen/gl_XML.py +++ b/mesalib/src/mapi/glapi/gen/gl_XML.py @@ -757,8 +757,11 @@ class gl_function( gl_item ): return self.images - def parameterIterator(self): - return self.parameters.__iter__(); + def parameterIterator(self, name = None): + if name is not None: + return self.entry_point_parameters[name].__iter__(); + else: + return self.parameters.__iter__(); def get_parameter_string(self, entrypoint = None): diff --git a/mesalib/src/mapi/glapi/gen/gl_and_es_API.xml b/mesalib/src/mapi/glapi/gen/gl_and_es_API.xml index 8e000a8bc..7495a2e56 100644 --- a/mesalib/src/mapi/glapi/gen/gl_and_es_API.xml +++ b/mesalib/src/mapi/glapi/gen/gl_and_es_API.xml @@ -8,7 +8,6 @@ - diff --git a/mesalib/src/mapi/glapi/gen/gl_apitemp.py b/mesalib/src/mapi/glapi/gen/gl_apitemp.py index c9a6e2937..4157032c5 100644 --- a/mesalib/src/mapi/glapi/gen/gl_apitemp.py +++ b/mesalib/src/mapi/glapi/gen/gl_apitemp.py @@ -66,7 +66,7 @@ class PrintGlOffsets(gl_XML.gl_print_base): silence = '' space = '' - for p in f.parameterIterator(): + for p in f.parameterIterator(name): if p.is_padding: continue diff --git a/mesalib/src/mapi/glapi/gen/gl_gentable.py b/mesalib/src/mapi/glapi/gen/gl_gentable.py index b09013232..a00c9c27a 100644 --- a/mesalib/src/mapi/glapi/gen/gl_gentable.py +++ b/mesalib/src/mapi/glapi/gen/gl_gentable.py @@ -54,7 +54,7 @@ header = """/* GLXEXT is the define used in the xserver when the GLX extension i #include #include -#include +#include "main/glheader.h" #include "glapi.h" #include "glapitable.h" diff --git a/mesalib/src/mesa/Android.gen.mk b/mesalib/src/mesa/Android.gen.mk index 893fa4199..ffa36db4d 100644 --- a/mesalib/src/mesa/Android.gen.mk +++ b/mesalib/src/mesa/Android.gen.mk @@ -32,9 +32,6 @@ intermediates := $(call local-intermediates-dir) # This is the list of auto-generated files: sources and headers sources := \ main/enums.c \ - main/api_exec_es1.c \ - main/api_exec_es1_dispatch.h \ - main/api_exec_es1_remap_helper.h \ program/program_parse.tab.c \ program/lex.yy.c \ main/dispatch.h \ @@ -60,13 +57,7 @@ LOCAL_GENERATED_SOURCES += $(sources) glapi := $(MESA_TOP)/src/mapi/glapi/gen -es_src_deps := \ - $(LOCAL_PATH)/main/APIspec.xml \ - $(LOCAL_PATH)/main/es_generator.py \ - $(LOCAL_PATH)/main/APIspecutil.py \ - $(LOCAL_PATH)/main/APIspec.py - -es_hdr_deps := \ +dispatch_deps := \ $(wildcard $(glapi)/*.py) \ $(wildcard $(glapi)/*.xml) @@ -88,22 +79,6 @@ define es-gen $(hide) $(PRIVATE_SCRIPT) $(1) $(PRIVATE_XML) > $@ endef -$(intermediates)/main/api_exec_%.c: PRIVATE_SCRIPT := $(MESA_PYTHON2) $(LOCAL_PATH)/main/es_generator.py -$(intermediates)/main/api_exec_%.c: PRIVATE_XML := -S $(LOCAL_PATH)/main/APIspec.xml -$(intermediates)/main/api_exec_%_dispatch.h: PRIVATE_SCRIPT := $(MESA_PYTHON2) $(glapi)/gl_table.py -$(intermediates)/main/api_exec_%_dispatch.h: PRIVATE_XML := -f $(glapi)/gl_and_es_API.xml -$(intermediates)/main/api_exec_%_remap_helper.h: PRIVATE_SCRIPT := $(MESA_PYTHON2) $(glapi)/remap_helper.py -$(intermediates)/main/api_exec_%_remap_helper.h: PRIVATE_XML := -f $(glapi)/gl_and_es_API.xml - -$(intermediates)/main/api_exec_es1.c: $(es_src_deps) - $(call es-gen, -V GLES1.1) - -$(intermediates)/main/api_exec_%_dispatch.h: $(es_hdr_deps) - $(call es-gen, -c $* -m remap_table) - -$(intermediates)/main/api_exec_%_remap_helper.h: $(es_hdr_deps) - $(call es-gen, -c $*) - $(intermediates)/program/program_parse.tab.c: $(LOCAL_PATH)/program/program_parse.y $(mesa_local-y-to-c-and-h) @@ -133,19 +108,19 @@ $(intermediates)/x86/matypes.h: $(matypes_deps) $(intermediates)/main/dispatch.h: PRIVATE_SCRIPT := $(MESA_PYTHON2) $(glapi)/gl_table.py $(intermediates)/main/dispatch.h: PRIVATE_XML := -f $(glapi)/gl_and_es_API.xml -$(intermediates)/main/dispatch.h: $(es_hdr_deps) +$(intermediates)/main/dispatch.h: $(dispatch_deps) $(call es-gen, $* -m remap_table) $(intermediates)/main/remap_helper.h: PRIVATE_SCRIPT := $(MESA_PYTHON2) $(glapi)/remap_helper.py $(intermediates)/main/remap_helper.h: PRIVATE_XML := -f $(glapi)/gl_and_es_API.xml -$(intermediates)/main/remap_helper.h: $(es_hdr_deps) +$(intermediates)/main/remap_helper.h: $(dispatch_deps) $(call es-gen, $*) $(intermediates)/main/enums.c: PRIVATE_SCRIPT :=$(MESA_PYTHON2) $(glapi)/gl_enums.py $(intermediates)/main/enums.c: PRIVATE_XML := -f $(glapi)/gl_and_es_API.xml -$(intermediates)/main/enums.c: $(es_src_deps) +$(intermediates)/main/enums.c: $(dispatch_deps) $(call es-gen) GET_HASH_GEN := $(LOCAL_PATH)/main/get_hash_generator.py diff --git a/mesalib/src/mesa/Makefile.am b/mesalib/src/mesa/Makefile.am index 1dc3132c7..1f897257e 100644 --- a/mesalib/src/mesa/Makefile.am +++ b/mesalib/src/mesa/Makefile.am @@ -53,9 +53,6 @@ include $(GLAPI)/glapi_gen.mk BUILT_SOURCES = \ main/git_sha1.h \ - main/api_exec_es1_dispatch.h \ - main/api_exec_es1_remap_helper.h \ - main/api_exec_es1.c \ main/get_hash.h \ program/program_parse.tab.c \ program/program_parse.tab.h \ @@ -64,18 +61,6 @@ CLEANFILES = \ $(BUILT_SOURCES) \ git_sha1.h.tmp -main/api_exec_es1_dispatch.h: $(GLAPI)/gl_and_es_API.xml $(glapi_gen_dispatch_deps) - $(call glapi_gen_dispatch,$<,es1) - -main/api_exec_es1_remap_helper.h: $(GLAPI)/gl_and_es_API.xml $(glapi_gen_remap_deps) - $(call glapi_gen_remap,$<,es1) - -main/api_exec_es1.o: main/api_exec_es1_dispatch.h main/api_exec_es1_remap_helper.h - -main/api_exec_es1.c: main/APIspec.xml main/es_generator.py main/APIspecutil.py main/APIspec.py - $(AM_V_GEN) $(PYTHON2) $(PYTHON_FLAGS) $(srcdir)/main/es_generator.py \ - -S $(srcdir)/main/APIspec.xml -V GLES1.1 > $@ - program/program_parse.tab.c program/program_parse.tab.h: program/program_parse.y $(MKDIR_P) program $(AM_V_GEN) $(YACC) -p "_mesa_program_" -v -d --output=program/program_parse.tab.c $< diff --git a/mesalib/src/mesa/SConscript b/mesalib/src/mesa/SConscript index 12bb70aec..53e5ee8c2 100644 --- a/mesalib/src/mesa/SConscript +++ b/mesalib/src/mesa/SConscript @@ -339,27 +339,9 @@ if env['gles']: # generate GLES sources gles_sources = ['main/es1_conversion.c',] - gles_sources += env.CodeGenerate( - target = 'main/api_exec_es1.c', - script = 'main/es_generator.py', - source = 'main/APIspec.xml', - command = python_cmd + ' $SCRIPT -S $SOURCE -V GLES1.1 > $TARGET' - ) # generate GLES headers gles_headers = [] - gles_headers += env.CodeGenerate( - target = 'main/api_exec_es1_dispatch.h', - script = GLAPI + 'gen/gl_table.py', - source = GLAPI + 'gen/gl_and_es_API.xml', - command = python_cmd + ' $SCRIPT -c es1 -m remap_table -f $SOURCE > $TARGET', - ) - gles_headers += env.CodeGenerate( - target = 'main/api_exec_es1_remap_helper.h', - script = GLAPI + 'gen/remap_helper.py', - source = GLAPI + 'gen/gl_and_es_API.xml', - command = python_cmd + ' $SCRIPT -c es1 -f $SOURCE > $TARGET', - ) env.Depends(gles_sources, gles_headers) diff --git a/mesalib/src/mesa/main/.gitignore b/mesalib/src/mesa/main/.gitignore index 29ebf8df4..4115a9b2b 100644 --- a/mesalib/src/mesa/main/.gitignore +++ b/mesalib/src/mesa/main/.gitignore @@ -1,12 +1,9 @@ -api_exec_es1.c dispatch.h enums.c get_es1.c get_es2.c git_sha1.h git_sha1.h.tmp -api_exec_es1_dispatch.h -api_exec_es1_remap_helper.h remap_helper.h get_hash.h get_hash.h.tmp diff --git a/mesalib/src/mesa/main/APIspec.py b/mesalib/src/mesa/main/APIspec.py deleted file mode 100644 index 6947f7301..000000000 --- a/mesalib/src/mesa/main/APIspec.py +++ /dev/null @@ -1,617 +0,0 @@ -#!/usr/bin/python -# -# Copyright (C) 2009 Chia-I Wu -# -# 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. -""" -A parser for APIspec. -""" - -class SpecError(Exception): - """Error in the spec file.""" - - -class Spec(object): - """A Spec is an abstraction of the API spec.""" - - def __init__(self, doc): - self.doc = doc - - self.spec_node = doc.getRootElement() - self.tmpl_nodes = {} - self.api_nodes = {} - self.impl_node = None - - # parse - node = self.spec_node.children - while node: - if node.type == "element": - if node.name == "template": - self.tmpl_nodes[node.prop("name")] = node - elif node.name == "api": - self.api_nodes[node.prop("name")] = node - else: - raise SpecError("unexpected node %s in apispec" % - node.name) - node = node.next - - # find an implementation - for name, node in self.api_nodes.iteritems(): - if node.prop("implementation") == "true": - self.impl_node = node - break - if not self.impl_node: - raise SpecError("unable to find an implementation") - - def get_impl(self): - """Return the implementation.""" - return API(self, self.impl_node) - - def get_api(self, name): - """Return an API.""" - return API(self, self.api_nodes[name]) - - -class API(object): - """An API consists of categories and functions.""" - - def __init__(self, spec, api_node): - self.name = api_node.prop("name") - self.is_impl = (api_node.prop("implementation") == "true") - - self.categories = [] - self.functions = [] - - # parse - func_nodes = [] - node = api_node.children - while node: - if node.type == "element": - if node.name == "category": - cat = node.prop("name") - self.categories.append(cat) - elif node.name == "function": - func_nodes.append(node) - else: - raise SpecError("unexpected node %s in api" % node.name) - node = node.next - - # realize functions - for func_node in func_nodes: - tmpl_node = spec.tmpl_nodes[func_node.prop("template")] - try: - func = Function(tmpl_node, func_node, self.is_impl, - self.categories) - except SpecError, e: - func_name = func_node.prop("name") - raise SpecError("failed to parse %s: %s" % (func_name, e)) - self.functions.append(func) - - def match(self, func, conversions={}): - """Find a matching function in the API.""" - match = None - need_conv = False - for f in self.functions: - matched, conv = f.match(func, conversions) - if matched: - match = f - need_conv = conv - # exact match - if not need_conv: - break - return (match, need_conv) - - -class Function(object): - """Parse and realize a