diff options
Diffstat (limited to 'mesalib')
120 files changed, 2379 insertions, 2176 deletions
diff --git a/mesalib/Makefile.am b/mesalib/Makefile.am index 453e5f672..ccf9ac994 100644 --- a/mesalib/Makefile.am +++ b/mesalib/Makefile.am @@ -21,85 +21,38 @@ SUBDIRS = src -ACLOCAL_AMFLAGS = -I m4 - -doxygen: - cd doxygen && $(MAKE) - -.PHONY: doxygen - -# Rules for making release tarballs - -PACKAGE_DIR = Mesa-$(PACKAGE_VERSION) -PACKAGE_NAME = MesaLib-$(PACKAGE_VERSION) - -EXTRA_FILES = \ - aclocal.m4 \ - configure \ - bin/ar-lib \ - bin/compile \ - bin/config.sub \ - bin/config.guess \ - bin/depcomp \ - bin/install-sh \ - bin/ltmain.sh \ - bin/missing \ - bin/ylwrap \ - bin/test-driver \ - src/glsl/glsl_parser.cpp \ - src/glsl/glsl_parser.h \ - src/glsl/glsl_lexer.cpp \ - src/glsl/glcpp/glcpp-lex.c \ - src/glsl/glcpp/glcpp-parse.c \ - src/glsl/glcpp/glcpp-parse.h \ - src/mesa/program/lex.yy.c \ - src/mesa/program/program_parse.tab.c \ - src/mesa/program/program_parse.tab.h \ - `git ls-files | grep "Makefile.am" | sed -e "s/Makefile.am/Makefile.in/"` - - -IGNORE_FILES = \ - -x autogen.sh - - -parsers: configure - $(MAKE) -C src/glsl glsl_parser.cpp glsl_parser.h glsl_lexer.cpp glcpp/glcpp-lex.c glcpp/glcpp-parse.c glcpp/glcpp-parse.h +DISTCHECK_CONFIGURE_FLAGS = \ + --enable-dri3 \ + --enable-gallium-tests \ + --enable-gbm \ + --enable-gles1 \ + --enable-gles2 \ + --enable-glx-tls \ + --enable-va \ + --enable-vdpau \ + --enable-xa \ + --enable-xvmc \ + --with-egl-platforms=x11,wayland,drm -# Everything for new a Mesa release: -ARCHIVES = $(PACKAGE_NAME).tar.gz \ - $(PACKAGE_NAME).tar.bz2 \ - $(PACKAGE_NAME).zip - -tarballs: checksums - rm -f ../$(PACKAGE_DIR) $(PACKAGE_NAME).tar - -manifest.txt: .git - ( \ - ls -1 $(EXTRA_FILES) ; \ - git ls-files $(IGNORE_FILES) \ - ) | sed -e '/^\(.*\/\)\?\./d' -e "s@^@$(PACKAGE_DIR)/@" > $@ - -../$(PACKAGE_DIR): - ln -s $(PWD) $@ - -$(PACKAGE_NAME).tar: parsers ../$(PACKAGE_DIR) manifest.txt - cd .. ; tar -cf $(PACKAGE_DIR)/$(PACKAGE_NAME).tar -T $(PACKAGE_DIR)/manifest.txt - -$(PACKAGE_NAME).tar.gz: $(PACKAGE_NAME).tar ../$(PACKAGE_DIR) - gzip --stdout --best $(PACKAGE_NAME).tar > $(PACKAGE_NAME).tar.gz - -$(PACKAGE_NAME).tar.bz2: $(PACKAGE_NAME).tar - bzip2 --stdout --best $(PACKAGE_NAME).tar > $(PACKAGE_NAME).tar.bz2 - -$(PACKAGE_NAME).zip: parsers ../$(PACKAGE_DIR) manifest.txt - rm -f $(PACKAGE_NAME).zip ; \ - cd .. ; \ - zip -q -@ $(PACKAGE_NAME).zip < $(PACKAGE_DIR)/manifest.txt ; \ - mv $(PACKAGE_NAME).zip $(PACKAGE_DIR) - -checksums: $(ARCHIVES) - @-sha256sum $(PACKAGE_NAME).tar.gz - @-sha256sum $(PACKAGE_NAME).tar.bz2 - @-sha256sum $(PACKAGE_NAME).zip +ACLOCAL_AMFLAGS = -I m4 -.PHONY: tarballs checksums +EXTRA_DIST = \ + autogen.sh \ + common.py \ + docs \ + doxygen \ + scons \ + SConstruct + +noinst_HEADERS = \ + include/c99_compat.h \ + include/c99 \ + include/c11 \ + include/D3D9 \ + include/HaikuGL \ + include/pci_ids + +# We list some directories in EXTRA_DIST, but don't actually want to include +# the .gitignore files in the tarball. +dist-hook: + find $(distdir) -name .gitignore -exec $(RM) {} + diff --git a/mesalib/configure.ac b/mesalib/configure.ac index 1d9d01548..c8723ef26 100644 --- a/mesalib/configure.ac +++ b/mesalib/configure.ac @@ -12,7 +12,7 @@ AC_INIT([Mesa], [MESA_VERSION], AC_CONFIG_AUX_DIR([bin]) AC_CONFIG_MACRO_DIR([m4]) AC_CANONICAL_SYSTEM -AM_INIT_AUTOMAKE([foreign]) +AM_INIT_AUTOMAKE([foreign tar-ustar dist-xz]) # Support silent build rules, requires at least automake-1.11. Disable # by either passing --disable-silent-rules to configure or passing V=1 @@ -102,7 +102,7 @@ AC_COMPILE_IFELSE( AC_MSG_RESULT([$acv_mesa_CLANG]) -dnl If we're using GCC, make sure that it is at least version 3.3.0. Older +dnl If we're using GCC, make sure that it is at least version 4.2.0. Older dnl versions are explictly not supported. GEN_ASM_OFFSETS=no if test "x$GCC" = xyes -a "x$acv_mesa_CLANG" = xno; then @@ -116,9 +116,9 @@ if test "x$GCC" = xyes -a "x$acv_mesa_CLANG" = xno; then GCC_VERSION_MINOR=`echo $GCC_VERSION | cut -d. -f2` fi - if test $GCC_VERSION_MAJOR -lt 3 -o $GCC_VERSION_MAJOR -eq 3 -a $GCC_VERSION_MINOR -lt 3 ; then + if test $GCC_VERSION_MAJOR -lt 4 -o $GCC_VERSION_MAJOR -eq 4 -a $GCC_VERSION_MINOR -lt 2 ; then AC_MSG_RESULT([no]) - AC_MSG_ERROR([If using GCC, version 3.3.0 or later is required.]) + AC_MSG_ERROR([If using GCC, version 4.2.0 or later is required.]) else AC_MSG_RESULT([yes]) fi @@ -253,8 +253,16 @@ AC_SUBST([VISIBILITY_CXXFLAGS]) dnl dnl Optional flags, check for compiler support dnl +SSE41_CFLAGS="-msse4.1" +dnl Code compiled by GCC with -msse* assumes a 16 byte aligned +dnl stack, but on x86-32 such alignment is not guaranteed. +case "$target_cpu" in +i?86) + SSE41_CFLAGS="$SSE41_CFLAGS -mstackrealign" + ;; +esac save_CFLAGS="$CFLAGS" -CFLAGS="-msse4.1 $CFLAGS" +CFLAGS="$SSE41_CFLAGS $CFLAGS" AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ #include <smmintrin.h> int main () { @@ -267,6 +275,7 @@ if test "x$SSE41_SUPPORTED" = x1; then DEFINES="$DEFINES -DUSE_SSE41" fi AM_CONDITIONAL([SSE41_SUPPORTED], [test x$SSE41_SUPPORTED = x1]) +AC_SUBST([SSE41_CFLAGS], $SSE41_CFLAGS) dnl Can't have static and shared libraries, default to static if user dnl explicitly requested. If both disabled, set to static since shared @@ -1345,7 +1354,7 @@ if test "x$enable_openvg" = xyes; then fi AC_MSG_ERROR([Cannot enable OpenVG, because egl_gallium has been removed and - OpenVG hasn't been integrated into standard libEGL yet]) + OpenVG has not been integrated into standard libEGL yet]) EGL_CLIENT_APIS="$EGL_CLIENT_APIS "'$(VG_LIB)' VG_LIB_DEPS="$VG_LIB_DEPS $SELINUX_LIBS $PTHREAD_LIBS" @@ -2137,7 +2146,6 @@ AC_CONFIG_FILES([Makefile src/egl/drivers/dri2/Makefile src/egl/main/Makefile src/egl/main/egl.pc - src/egl/wayland/Makefile src/egl/wayland/wayland-drm/Makefile src/egl/wayland/wayland-egl/Makefile src/egl/wayland/wayland-egl/wayland-egl.pc @@ -2176,8 +2184,6 @@ AC_CONFIG_FILES([Makefile src/gallium/targets/d3dadapter9/Makefile src/gallium/targets/d3dadapter9/d3d.pc src/gallium/targets/dri/Makefile - src/gallium/targets/egl-static/Makefile - src/gallium/targets/gbm/Makefile src/gallium/targets/libgl-xlib/Makefile src/gallium/targets/omx/Makefile src/gallium/targets/opencl/Makefile diff --git a/mesalib/docs/index.html b/mesalib/docs/index.html index 024bb5f59..27b1c713d 100644 --- a/mesalib/docs/index.html +++ b/mesalib/docs/index.html @@ -16,6 +16,27 @@ <h1>News</h1> +<h2>December 29, 2014</h2> +<p> +<a href="relnotes/10.3.6.html">Mesa 10.3.6</a> +and <a href="relnotes/10.4.1.html">Mesa 10.4.1</a> are released. + +These are bug-fix releases from the 10.3 and 10.4 branches, respectively. +</p> + +<h2>December 14, 2014</h2> +<p> +<a href="relnotes/10.4.html">Mesa 10.4</a> is released. This is a new +development release. See the release notes for more information about +the release. +</p> + +<h2>December 5, 2014</h2> +<p> +<a href="relnotes/10.3.5.html">Mesa 10.3.5</a> is released. +This is a bug-fix release. +</p> + <h2>November 21, 2014</h2> <p> <a href="relnotes/10.3.4.html">Mesa 10.3.4</a> is released. diff --git a/mesalib/docs/relnotes.html b/mesalib/docs/relnotes.html index 8dd732618..22c6f6e44 100644 --- a/mesalib/docs/relnotes.html +++ b/mesalib/docs/relnotes.html @@ -21,6 +21,10 @@ The release notes summarize what's new or changed in each Mesa release. </p> <ul> +<li><a href="relnotes/10.4.1.html">10.4.1 release notes</a> +<li><a href="relnotes/10.3.6.html">10.3.6 release notes</a> +<li><a href="relnotes/10.4.html">10.4 release notes</a> +<li><a href="relnotes/10.3.5.html">10.3.5 release notes</a> <li><a href="relnotes/10.3.4.html">10.3.4 release notes</a> <li><a href="relnotes/10.3.3.html">10.3.3 release notes</a> <li><a href="relnotes/10.3.2.html">10.3.2 release notes</a> diff --git a/mesalib/docs/relnotes/10.2.html b/mesalib/docs/relnotes/10.2.html index f17bfcc28..e9d30c5c1 100644 --- a/mesalib/docs/relnotes/10.2.html +++ b/mesalib/docs/relnotes/10.2.html @@ -88,6 +88,8 @@ following options during configure, if you would like support for svga driver Note: The files are installed in $(libdir)/gallium-pipe/ and the interface between them and libxatracker.so is <strong>not</strong> stable. </p> + +<li>The environment variable GALLIUM_MSAA that forced a multisample GLX visual was removed.</li> </ul> </div> diff --git a/mesalib/docs/relnotes/10.3.5.html b/mesalib/docs/relnotes/10.3.5.html new file mode 100644 index 000000000..8efb3035d --- /dev/null +++ b/mesalib/docs/relnotes/10.3.5.html @@ -0,0 +1,88 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<html lang="en"> +<head> + <meta http-equiv="content-type" content="text/html; charset=utf-8"> + <title>Mesa Release Notes</title> + <link rel="stylesheet" type="text/css" href="../mesa.css"> +</head> +<body> + +<div class="header"> + <h1>The Mesa 3D Graphics Library</h1> +</div> + +<iframe src="../contents.html"></iframe> +<div class="content"> + +<h1>Mesa 10.3.5 Release Notes / December 5, 2014</h1> + +<p> +Mesa 10.3.5 is a bug fix release which fixes bugs found since the 10.3.4 release. +</p> +<p> +Mesa 10.3.5 implements the OpenGL 3.3 API, but the version reported by +glGetString(GL_VERSION) or glGetIntegerv(GL_MAJOR_VERSION) / +glGetIntegerv(GL_MINOR_VERSION) depends on the particular driver being used. +Some drivers don't support all the features required in OpenGL 3.3. OpenGL +3.3 is <strong>only</strong> available if requested at context creation +because compatibility contexts are not supported. +</p> + +<h2>SHA256 checksums</h2> +<pre> +7ea71c3cce89114df3dc050376afa1c6f6bf235d77a68f9703273603d6a90621 MesaLib-10.3.5.tar.gz +eb75d2790f1606d59d50a6acaa637b6c75f2155b3e0eca3d5099165c0d9556ae MesaLib-10.3.5.tar.bz2 +164bc64ba63fb07ff255ff8de6ed3c95ff545dfe8f864c44c33abe94788da910 MesaLib-10.3.5.zip +</pre> + +<h2>New features</h2> +<p>None</p> + +<h2>Bug fixes</h2> + +<p>This list is likely incomplete.</p> + +<ul> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=86618">Bug 86618</a> - [NV96] neg modifiers not working in MIN and MAX operations</li> + +</ul> + +<h2>Changes</h2> +<p>Brian Paul (2):</p> +<ul> + <li>mesa: fix arithmetic error in _mesa_compute_compressed_pixelstore()</li> + <li>mesa: fix height error check for 1D array textures</li> +</ul> + +<p>Chris Forbes (2):</p> +<ul> + <li>i965: Handle nested uniform array indexing</li> + <li>mesa: Fix Get(GL_TRANSPOSE_CURRENT_MATRIX_ARB) to transpose</li> +</ul> + +<p>Emil Velikov (2):</p> +<ul> + <li>docs: Add sha256 sums for the 10.3.5 release</li> + <li>Update version to 10.3.5</li> +</ul> + +<p>Ilia Mirkin (6):</p> +<ul> + <li>nv50/ir: set neg modifiers on min/max args</li> + <li>nv50,nvc0: actually check constbufs for invalidation</li> + <li>nv50,nvc0: buffer resources can be bound as other things down the line</li> + <li>freedreno/ir3: don't pass consts to madsh.m16 in MOD logic</li> + <li>freedreno/a3xx: only enable blend clamp for non-float formats</li> + <li>freedreno/ir3: fix UMAD</li> +</ul> + +<p>Rob Clark (1):</p> +<ul> + <li>configure.ac: bump libdrm_freedreno requirement</li> +</ul> + + +</div> +</body> +</html> diff --git a/mesalib/docs/relnotes/10.3.6.html b/mesalib/docs/relnotes/10.3.6.html new file mode 100644 index 000000000..84db587b5 --- /dev/null +++ b/mesalib/docs/relnotes/10.3.6.html @@ -0,0 +1,124 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<html lang="en"> +<head> + <meta http-equiv="content-type" content="text/html; charset=utf-8"> + <title>Mesa Release Notes</title> + <link rel="stylesheet" type="text/css" href="../mesa.css"> +</head> +<body> + +<div class="header"> + <h1>The Mesa 3D Graphics Library</h1> +</div> + +<iframe src="../contents.html"></iframe> +<div class="content"> + +<h1>Mesa 10.3.6 Release Notes / December 29, 2014</h1> + +<p> +Mesa 10.3.6 is a bug fix release which fixes bugs found since the 10.3.5 release. +</p> +<p> +Mesa 10.3.6 implements the OpenGL 3.3 API, but the version reported by +glGetString(GL_VERSION) or glGetIntegerv(GL_MAJOR_VERSION) / +glGetIntegerv(GL_MINOR_VERSION) depends on the particular driver being used. +Some drivers don't support all the features required in OpenGL 3.3. OpenGL +3.3 is <strong>only</strong> available if requested at context creation +because compatibility contexts are not supported. +</p> + +<h2>SHA256 checksums</h2> +<pre> +c4d053d6bc6604cb5c93c99e0ef2e815c539f26dc5a03737eb3809bc1767d12f MesaLib-10.3.6.tar.gz +8d43673c6788fbf85f9c36c3a95c61ccf46f8835fc9c0d85d34474490d80572b MesaLib-10.3.6.tar.bz2 +6b5b1e9a13949cfdb76fe51e8dcc3ea71e464a5ca73d11fdc29c20c4ba3f411a MesaLib-10.3.6.zip +</pre> + +<h2>New features</h2> +<p>None</p> + +<h2>Bug fixes</h2> + +<p>This list is likely incomplete.</p> + +<ul> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=60879">Bug 60879</a> - [radeonsi] X11 can't start with acceleration enabled</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=82585">Bug 82585</a> - geometry shader with optional out variable segfaults</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=82991">Bug 82991</a> - Inverted bumpmap in webgl applications</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=84777">Bug 84777</a> - [BSW]Piglit spec_glsl-1.50_execution_geometry-basic fails</li> + +</ul> + +<h2>Changes</h2> + +<p>Andres Gomez (1):</p> +<ul> + <li>i965/brw_reg: struct constructor now needs explicit negate and abs values.</li> +</ul> + +<p>Ben Widawsky (1):</p> +<ul> + <li>i965/gs: Avoid DW * DW mul</li> +</ul> + +<p>Dave Airlie (1):</p> +<ul> + <li>r600g: only init GS_VERT_ITEMSIZE on r600</li> +</ul> + +<p>Emil Velikov (3):</p> +<ul> + <li>docs: Add sha256 sums for the 10.3.5 release</li> + <li>Revert "glx/dri3: Request non-vsynced Present for swapinterval zero. (v3)"</li> + <li>Update version to 10.3.6</li> +</ul> + +<p>Ian Romanick (2):</p> +<ul> + <li>linker: Wrap access of producer_var with a NULL check</li> + <li>linker: Assign varying locations geometry shader inputs for SSO</li> +</ul> + +<p>Ilia Mirkin (3):</p> +<ul> + <li>util/primconvert: pass index bias through</li> + <li>util/primconvert: support instanced rendering</li> + <li>util/primconvert: take ib offset into account</li> +</ul> + +<p>José Fonseca (1):</p> +<ul> + <li>util/primconvert: Avoid point arithmetic; apply offset on all cases.</li> +</ul> + +<p>Marek Olšák (1):</p> +<ul> + <li>docs/relnotes: document the removal of GALLIUM_MSAA</li> +</ul> + +<p>Mario Kleiner (4):</p> +<ul> + <li>glx/dri3: Fix glXWaitForSbcOML() to handle targetSBC==0 correctly. (v2)</li> + <li>glx/dri3: Track separate (ust, msc) for PresentPixmap vs. PresentNotifyMsc (v2)</li> + <li>glx/dri3: Request non-vsynced Present for swapinterval zero. (v3)</li> + <li>glx/dri3: Don't fail on glXSwapBuffersMscOML(dpy, window, 0, 0, 0) (v2)</li> +</ul> + +<p>Maxence Le Doré (1):</p> +<ul> + <li>glsl: Add gl_MaxViewports to available builtin constants</li> +</ul> + +<p>Tom Stellard (1):</p> +<ul> + <li>radeonsi: Program RASTER_CONFIG for harvested GPUs v5</li> +</ul> + +</div> +</body> +</html> diff --git a/mesalib/docs/relnotes/10.3.html b/mesalib/docs/relnotes/10.3.html index 53cd62d3d..e3ee7b1d5 100644 --- a/mesalib/docs/relnotes/10.3.html +++ b/mesalib/docs/relnotes/10.3.html @@ -327,6 +327,7 @@ DRM drivers that don't have a full-fledged GEM (such as qxl or simpledrm)</li> <li>Removed support for the GL_ATI_envmap_bumpmap extension</li> <li>The hacky --enable-32/64-bit is no longer available in configure. To build 32/64 bit mesa refer to the default method recommended by your distribution</li> +</li>The environment variable GALLIUM_MSAA that forced a multisample GLX visual was removed.</li> </ul> </div> diff --git a/mesalib/docs/relnotes/10.4.1.html b/mesalib/docs/relnotes/10.4.1.html new file mode 100644 index 000000000..206320bb6 --- /dev/null +++ b/mesalib/docs/relnotes/10.4.1.html @@ -0,0 +1,97 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<html lang="en"> +<head> + <meta http-equiv="content-type" content="text/html; charset=utf-8"> + <title>Mesa Release Notes</title> + <link rel="stylesheet" type="text/css" href="../mesa.css"> +</head> +<body> + +<div class="header"> + <h1>The Mesa 3D Graphics Library</h1> +</div> + +<iframe src="../contents.html"></iframe> +<div class="content"> + +<h1>Mesa 10.4.1 Release Notes / December 29, 2014</h1> + +<p> +Mesa 10.4.1 is a bug fix release which fixes bugs found since the 10.4.0 release. +</p> +<p> +Mesa 10.4.1 implements the OpenGL 3.3 API, but the version reported by +glGetString(GL_VERSION) or glGetIntegerv(GL_MAJOR_VERSION) / +glGetIntegerv(GL_MINOR_VERSION) depends on the particular driver being used. +Some drivers don't support all the features required in OpenGL 3.3. OpenGL +3.3 is <strong>only</strong> available if requested at context creation +because compatibility contexts are not supported. +</p> + +<h2>SHA256 checksums</h2> +<pre> +5311285e791a6bfaa468ad002bd1e1164acb3eaa040b5a1bf958bdb7c27e0a9d MesaLib-10.4.1.tar.gz +91e8b71c8aff4cb92022a09a872b1c5d1ae5bfec8c6c84dbc4221333da5bf1ca MesaLib-10.4.1.tar.bz2 +e09c8135f5a86ecb21182c6f8959aafd39ae2f98858fdf7c0e25df65b5abcdb8 MesaLib-10.4.1.zip +</pre> + +<h2>New features</h2> +<p>None</p> + +<h2>Bug fixes</h2> + +<p>This list is likely incomplete.</p> + +<ul> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=82585">Bug 82585</a> - geometry shader with optional out variable segfaults</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=82991">Bug 82991</a> - Inverted bumpmap in webgl applications</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=83908">Bug 83908</a> - [i965] Incorrect icon colors in Steam Big Picture</li> + +</ul> + + +<h2>Changes</h2> + +<p>Andres Gomez (1):</p> +<ul> + <li>i965/brw_reg: struct constructor now needs explicit negate and abs values.</li> +</ul> + +<p>Cody Northrop (1):</p> +<ul> + <li>i965: Require pixel alignment for GPU copy blit</li> +</ul> + +<p>Emil Velikov (3):</p> +<ul> + <li>docs: Add 10.4 sha256 sums, news item and link release notes</li> + <li>Revert "glx/dri3: Request non-vsynced Present for swapinterval zero. (v3)"</li> + <li>Update version to 10.4.1</li> +</ul> + +<p>Ian Romanick (2):</p> +<ul> + <li>linker: Wrap access of producer_var with a NULL check</li> + <li>linker: Assign varying locations geometry shader inputs for SSO</li> +</ul> + +<p>Mario Kleiner (4):</p> +<ul> + <li>glx/dri3: Fix glXWaitForSbcOML() to handle targetSBC==0 correctly. (v2)</li> + <li>glx/dri3: Track separate (ust, msc) for PresentPixmap vs. PresentNotifyMsc (v2)</li> + <li>glx/dri3: Request non-vsynced Present for swapinterval zero. (v3)</li> + <li>glx/dri3: Don't fail on glXSwapBuffersMscOML(dpy, window, 0, 0, 0) (v2)</li> +</ul> + +<p>Maxence Le Doré (1):</p> +<ul> + <li>glsl: Add gl_MaxViewports to available builtin constants</li> +</ul> + + +</div> +</body> +</html> diff --git a/mesalib/docs/relnotes/10.4.html b/mesalib/docs/relnotes/10.4.html index 8682d7196..f46fd6809 100644 --- a/mesalib/docs/relnotes/10.4.html +++ b/mesalib/docs/relnotes/10.4.html @@ -14,7 +14,7 @@ <iframe src="../contents.html"></iframe> <div class="content"> -<h1>Mesa 10.4 Release Notes / TBD</h1> +<h1>Mesa 10.4 Release Notes / December 14, 2014</h1> <p> Mesa 10.4 is a new development release. @@ -31,9 +31,11 @@ because compatibility contexts are not supported. </p> -<h2>MD5 checksums</h2> +<h2>SHA256 checksums</h2> <pre> -TBD. +abfbfd2d91ce81491c5bb6923ae649212ad5f82d0bee277de8704cc948dc221e MesaLib-10.4.0.tar.gz +98a7dff3a1a6708c79789de8b9a05d8042e867067f70e8f30387c15026233219 MesaLib-10.4.0.tar.bz2 +443a6d46d0691b5ac811d8d30091b1716c365689b16d49c57cf273c2b76086fe MesaLib-10.4.0.zip </pre> @@ -54,11 +56,202 @@ Note: some of the new features are only available with certain drivers. <h2>Bug fixes</h2> -TBD. +<p>This list is likely incomplete.</p> + +<ul> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=79963">Bug 79963</a> - [ILK Bisected]some piglit and ogles2conform cases fail </li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=29661">Bug 29661</a> - MSVC built u_format_test fails on Windows</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=38873">Bug 38873</a> - [855gm] gnome-shell misrendered</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=54372">Bug 54372</a> - GLX_INTEL_swap_event crashes driver when swapping window buffers</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=60879">Bug 60879</a> - [radeonsi] X11 can't start with acceleration enabled</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=61415">Bug 61415</a> - Clover ignores --with-opencl-libdir path</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=64471">Bug 64471</a> - Radeon HD6570 lockup in Brütal Legend with HyperZ</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=66184">Bug 66184</a> - src/mesa/state_tracker/st_glsl_to_tgsi.cpp:3216:simplify_cmp: Assertion `inst->dst.index < 4096' failed.</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=67672">Bug 67672</a> - [llvmpipe] lp_test_arit fails on old CPUs</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=69200">Bug 69200</a> - [Bisected]Piglit glx/glx-multithread-shader-compile aborted</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=70410">Bug 70410</a> - egl-static/Makefile: linking fails with llvm >= 3.4</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=72685">Bug 72685</a> - [radeonsi hyperz] Artifacts in Unigine Sanctuary</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=72819">Bug 72819</a> - [855GM] Incorrect drop shadow color on windows and strange white rectangle when showing/hiding GLX-dock...</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=74563">Bug 74563</a> - Surfaceless contexts are not properly released by DRI drivers</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=74863">Bug 74863</a> - [r600g] HyperZ broken on RV770 and CYPRESS (Left 4 Dead 2 trees corruption) bisected!</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=75011">Bug 75011</a> - [hyperz] Performance drop since git-01e6371 (disable hyperz by default) with radeonsi</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=75112">Bug 75112</a> - Meta Bug for HyperZ issues on r600g and radeonsi</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=76252">Bug 76252</a> - Dynamic loading/unloading of opengl32.dll results in a deadlock</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=76861">Bug 76861</a> - mid3 generates slow code for constant arguments</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=77957">Bug 77957</a> - Variably-indexed constant arrays result in terrible shader code</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=78468">Bug 78468</a> - Compiling of shader gets stuck in infinite loop</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=78770">Bug 78770</a> - [SNB bisected]Webglc conformance/textures/texture-size-limit.html fails</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=79155">Bug 79155</a> - [Tesseract Game] Global Illumination: Medium Causes Color Distortion</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=79462">Bug 79462</a> - [NVC0/Codegen] Shader compilation falis in spill logic</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=80011">Bug 80011</a> - [softpipe] tgsi/tgsi_exec.c:2023:exec_txf: Assertion `0' failed.</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=80012">Bug 80012</a> - [softpipe] draw/draw_gs.c:113:tgsi_fetch_gs_outputs: Assertion `!util_is_inf_or_nan(output[slot][0])' failed.</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=80050">Bug 80050</a> - [855GM] Incorrect drop shadow color under windows in Cinnamon persists with MESA 10.1.</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=80247">Bug 80247</a> - Khronos conformance test ES3-CTS.gtf.GL3Tests.transform_feedback.transform_feedback_vertex_id fails</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=80561">Bug 80561</a> - Incorrect implementation of some VDPAU APIs.</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=80615">Bug 80615</a> - Files in bellagio directory [omx tracker] don't respect installation folder</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=80848">Bug 80848</a> - [dri3] Building mesa fails with dri3 enabled</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=81680">Bug 81680</a> - [r600g] Firefox crashes with hardware acceleration turned on</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=82255">Bug 82255</a> - [VP2] Chroma planes are vertically stretched during VDPAU playback</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=82472">Bug 82472</a> - piglit 16385-consecutive-chars regression</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=82537">Bug 82537</a> - Stunt Rally GLSL compiler assertion failure</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=82538">Bug 82538</a> - Super Maryo Chronicles fails with st/mesa assertion failure</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=82539">Bug 82539</a> - vmw_screen_dri.lo In file included from vmw_screen_dri.c:41: vmwgfx_drm.h:32:17: error: drm.h: No such file or directory</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=82796">Bug 82796</a> - [IVB/BYT-M/HSW/BDW Bisected]Synmark2_v6.0_OglTerrainFlyInst/OglTerrainPanInst cannot run as image validation failed</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=82804">Bug 82804</a> - unreal engine 4 rendering errors</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=82828">Bug 82828</a> - Regression: Crash in 3Dmark2001</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=82846">Bug 82846</a> - [BDW Bisected] Gpu hang when running Lightsmark v2008/Warsow v1.0/Xonotic v0.7/unigine-demos</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=82881">Bug 82881</a> - test_vec4_register_coalesce regression</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=82882">Bug 82882</a> - [swrast] piglit glsl-fs-uniform-bool-1 regression</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=82921">Bug 82921</a> - layout(location=0) emits error >= MAX_UNIFORM_LOCATIONS due to integer underflow</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=82929">Bug 82929</a> - [BDW Bisected]glxgears causes X hang</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=82932">Bug 82932</a> - [SNB+ Bisected]Ogles3conform ES3-CTS.shaders.indexing.vector_subscript.vec3_static_loop_subscript_write_direct_read_vertex fails</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=83079">Bug 83079</a> - [NVC0] Dota 2 (Linux native and Wine) crash with Nouveau Drivers</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=83080">Bug 83080</a> - [SNB+ Bisected]ES3-CTS.shaders.loops.do_while_constant_iterations.mixed_break_continue_fragment fails</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=83081">Bug 83081</a> - [BDW Bisected]Piglit spec_ARB_sample_shading_builtin-gl-sample-mask_2 is core dumped</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=83127">Bug 83127</a> - [ILK Bisected]Piglit glean_texCombine fails</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=83148">Bug 83148</a> - Unity invisible under Ubuntu 14.04 and 14.10</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=83355">Bug 83355</a> - FTBFS: src/mesa/program/program_lexer.l:122:64: error: unknown type name 'YYSTYPE'</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=83380">Bug 83380</a> - Linking fails when not writing gl_Position.</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=83418">Bug 83418</a> - EU IV is incorrectly rendered after git1409011930.d571f2</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=83432">Bug 83432</a> - r600_query.c:269:r600_emit_query_end: Assertion `ctx->num_pipelinestat_queries > 0' failed [Gallium HUD]</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=83463">Bug 83463</a> - [swrast] piglit glsl-vs-clamp-1 regression</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=83468">Bug 83468</a> - [UBO] Using bool from UBO as if-statement condition asserts</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=83500">Bug 83500</a> - si_dma_copy_tile causes GPU hangs</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=83506">Bug 83506</a> - [UBO] row_major layout ignored inside structures</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=83533">Bug 83533</a> - [UBO] nested structures don't get appropriate padding</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=83573">Bug 83573</a> - [swrast] piglit fs-op-not-bool-using-if regression</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=83574">Bug 83574</a> - [llvmpipe] [softpipe] piglit arb_explicit_uniform_location-use-of-unused-loc regression</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=83741">Bug 83741</a> - [UBO] row_major layout partially ignored for arrays of structures</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=83777">Bug 83777</a> - [regression] ilo fails to build</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=83934">Bug 83934</a> - Structures must have same name to be considered same type.</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=84140">Bug 84140</a> - mplayer crashes playing some files using vdpau output</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=84145">Bug 84145</a> - UE4: Realistic Rendering Demo render blue</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=84178">Bug 84178</a> - Big glamor regression in Xorg server 1.6.99.1 GIT: x11perf 1.5 Test: PutImage XY 500x500 Square</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=84355">Bug 84355</a> - texture2DProjLod and textureCubeLod are not supported when using GLES.</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=84529">Bug 84529</a> - [IVB bisected] glean fragProg1 CMP test failed</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=84538">Bug 84538</a> - lp_test_format.c:226:4: error: too few arguments to function ‘gallivm_create’</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=84539">Bug 84539</a> - brw_fs_register_coalesce.cpp:183: bool fs_visitor::register_coalesce(): Assertion `src_size <= 11' failed.</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=84557">Bug 84557</a> - [HSW] "Emit ELSE/ENDIF JIP with type D on Gen 7" causes Atomic Afterlife and GPU hangs</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=84651">Bug 84651</a> - Distorted graphics or black window when running Battle.net app on Intel hardware via wine</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=84662">Bug 84662</a> - Long pauses with Unreal demo Elemental on R9270X since : Always flush the HDP cache before submitting a CS to the GPU</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=84777">Bug 84777</a> - [BSW]Piglit spec_glsl-1.50_execution_geometry-basic fails</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=84807">Bug 84807</a> - Build issue starting between bf4aecfb2acc8d0dc815105d2f36eccbc97c284b and a3e9582f09249ad27716ba82c7dfcee685b65d51</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=85189">Bug 85189</a> - llvm/invocation.cpp: In function 'void {anonymous}::optimize(llvm::Module*, unsigned int, const std::vector<llvm::Function*>&)': llvm/invocation.cpp:324:18: error: expected type-specifier</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=85267">Bug 85267</a> - vlc crashes with vdpau (Radeon 3850HD) [r600]</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=85377">Bug 85377</a> - lp_test_format failure with llvm-3.6</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=85425">Bug 85425</a> - [bisected] Compiler error in clip control operations in meta</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=85429">Bug 85429</a> - indirect.c:296: multiple definition of `__indirect_glNewList'</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=85454">Bug 85454</a> - Unigine Sanctuary with Wine crashes on Mesa Git</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=85647">Bug 85647</a> - Random radeonsi crashes with mesa 10.3.x</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=85683">Bug 85683</a> - [i965 Bisected]Piglit shaders_glsl-vs-raytrace-bug26691 segfault</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=85691">Bug 85691</a> - 'glsl: Drop constant 0.0 components from dot products.' broke piglit shaders/glsl-gnome-shell-dim-window and a few others with Gallium</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=86025">Bug 86025</a> - src\glsl\list.h(535) : error C2143: syntax error : missing ';' before 'type'</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=86089">Bug 86089</a> - [r600g][mesa 10.4.0-dev] shader failure - r600_sb::bc_finalizer::cf_peephole() when starting Second Life</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=86145">Bug 86145</a> - Pipeline statistic counter values for VF always 0</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=86618">Bug 86618</a> - [NV96] neg modifiers not working in MIN and MAX operations</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=86760">Bug 86760</a> - mesa doesn't build: recipe for target 'r600_llvm.lo' failed</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=86764">Bug 86764</a> - [SNB+ Bisected]Piglit glean/pointSprite fails</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=86788">Bug 86788</a> - (bisected) 32bit UrbanTerror 4.1 timedemo sse4.1 segfault...</li> + +</ul> <h2>Changes</h2> <ul> +<li>The environment variable GALLIUM_MSAA that forced a multisample GLX visual was removed.</li> </ul> </div> diff --git a/mesalib/docs/relnotes/10.5.0.html b/mesalib/docs/relnotes/10.5.0.html index 84bfcdbdb..4f921ea4d 100644 --- a/mesalib/docs/relnotes/10.5.0.html +++ b/mesalib/docs/relnotes/10.5.0.html @@ -44,6 +44,11 @@ Note: some of the new features are only available with certain drivers. </p> <ul> +<li>GL_ARB_framebuffer_sRGB on freedreno</li> +<li>GL_ARB_texture_rg on freedreno</li> +<li>GL_EXT_packed_float on freedreno</li> +<li>GL_EXT_texture_shared_exponent on freedreno</li> +<li>GL_EXT_texture_snorm on freedreno</li> </ul> @@ -54,6 +59,7 @@ TBD. <h2>Changes</h2> <ul> +<li>Removed support for GCC versions earlier than 4.2.0.</li> </ul> </div> diff --git a/mesalib/include/EGL/eglplatform.h b/mesalib/include/EGL/eglplatform.h index 21b18fe73..2eb686590 100644 --- a/mesalib/include/EGL/eglplatform.h +++ b/mesalib/include/EGL/eglplatform.h @@ -106,7 +106,7 @@ typedef void *EGLNativeDisplayType; #elif defined(__unix__) -#ifdef MESA_EGL_NO_X11_HEADERS +#if defined(MESA_EGL_NO_X11_HEADERS) typedef void *EGLNativeDisplayType; typedef khronos_uintptr_t EGLNativePixmapType; @@ -124,8 +124,16 @@ typedef Window EGLNativeWindowType; #endif /* MESA_EGL_NO_X11_HEADERS */ +#elif __HAIKU__ +#include <kernel/image.h> +typedef void *EGLNativeDisplayType; +typedef khronos_uintptr_t EGLNativePixmapType; +typedef khronos_uintptr_t EGLNativeWindowType; + #else + #error "Platform not recognized" + #endif /* EGL 1.2 types, renamed for consistency in EGL 1.3 */ diff --git a/mesalib/include/GL/glext.h b/mesalib/include/GL/glext.h index 256ad353c..d3cfbb562 100644 --- a/mesalib/include/GL/glext.h +++ b/mesalib/include/GL/glext.h @@ -33,7 +33,7 @@ extern "C" { ** used to make the header, and the header can be found at ** http://www.opengl.org/registry/ ** -** Khronos $Revision: 27684 $ on $Date: 2014-08-11 01:21:35 -0700 (Mon, 11 Aug 2014) $ +** Khronos $Revision: 28986 $ on $Date: 2014-11-18 18:43:15 -0800 (Tue, 18 Nov 2014) $ */ #if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) @@ -53,7 +53,7 @@ extern "C" { #define GLAPI extern #endif -#define GL_GLEXT_VERSION 20140810 +#define GL_GLEXT_VERSION 20141118 /* Generated C header for: * API: gl @@ -2044,6 +2044,10 @@ GLAPI void APIENTRY glGetDoublei_v (GLenum target, GLuint index, GLdouble *data) #ifndef GL_VERSION_4_2 #define GL_VERSION_4_2 1 +#define GL_COPY_READ_BUFFER_BINDING 0x8F36 +#define GL_COPY_WRITE_BUFFER_BINDING 0x8F37 +#define GL_TRANSFORM_FEEDBACK_ACTIVE 0x8E24 +#define GL_TRANSFORM_FEEDBACK_PAUSED 0x8E23 #define GL_UNPACK_COMPRESSED_BLOCK_WIDTH 0x9127 #define GL_UNPACK_COMPRESSED_BLOCK_HEIGHT 0x9128 #define GL_UNPACK_COMPRESSED_BLOCK_DEPTH 0x9129 @@ -2694,6 +2698,10 @@ typedef void (APIENTRYP PFNGLGETVERTEXARRAYINDEXED64IVPROC) (GLuint vaobj, GLuin typedef void (APIENTRYP PFNGLCREATESAMPLERSPROC) (GLsizei n, GLuint *samplers); typedef void (APIENTRYP PFNGLCREATEPROGRAMPIPELINESPROC) (GLsizei n, GLuint *pipelines); typedef void (APIENTRYP PFNGLCREATEQUERIESPROC) (GLenum target, GLsizei n, GLuint *ids); +typedef void (APIENTRYP PFNGLGETQUERYBUFFEROBJECTI64VPROC) (GLuint id, GLuint buffer, GLenum pname, GLintptr offset); +typedef void (APIENTRYP PFNGLGETQUERYBUFFEROBJECTIVPROC) (GLuint id, GLuint buffer, GLenum pname, GLintptr offset); +typedef void (APIENTRYP PFNGLGETQUERYBUFFEROBJECTUI64VPROC) (GLuint id, GLuint buffer, GLenum pname, GLintptr offset); +typedef void (APIENTRYP PFNGLGETQUERYBUFFEROBJECTUIVPROC) (GLuint id, GLuint buffer, GLenum pname, GLintptr offset); typedef void (APIENTRYP PFNGLMEMORYBARRIERBYREGIONPROC) (GLbitfield barriers); typedef void (APIENTRYP PFNGLGETTEXTURESUBIMAGEPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLsizei bufSize, void *pixels); typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXTURESUBIMAGEPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei bufSize, void *pixels); @@ -2813,6 +2821,10 @@ GLAPI void APIENTRY glGetVertexArrayIndexed64iv (GLuint vaobj, GLuint index, GLe GLAPI void APIENTRY glCreateSamplers (GLsizei n, GLuint *samplers); GLAPI void APIENTRY glCreateProgramPipelines (GLsizei n, GLuint *pipelines); GLAPI void APIENTRY glCreateQueries (GLenum target, GLsizei n, GLuint *ids); +GLAPI void APIENTRY glGetQueryBufferObjecti64v (GLuint id, GLuint buffer, GLenum pname, GLintptr offset); +GLAPI void APIENTRY glGetQueryBufferObjectiv (GLuint id, GLuint buffer, GLenum pname, GLintptr offset); +GLAPI void APIENTRY glGetQueryBufferObjectui64v (GLuint id, GLuint buffer, GLenum pname, GLintptr offset); +GLAPI void APIENTRY glGetQueryBufferObjectuiv (GLuint id, GLuint buffer, GLenum pname, GLintptr offset); GLAPI void APIENTRY glMemoryBarrierByRegion (GLbitfield barriers); GLAPI void APIENTRY glGetTextureSubImage (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLsizei bufSize, void *pixels); GLAPI void APIENTRY glGetCompressedTextureSubImage (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei bufSize, void *pixels); @@ -2979,8 +2991,6 @@ GLAPI void APIENTRY glDispatchComputeGroupSizeARB (GLuint num_groups_x, GLuint n #ifndef GL_ARB_copy_buffer #define GL_ARB_copy_buffer 1 -#define GL_COPY_READ_BUFFER_BINDING 0x8F36 -#define GL_COPY_WRITE_BUFFER_BINDING 0x8F37 #endif /* GL_ARB_copy_buffer */ #ifndef GL_ARB_copy_image @@ -4065,13 +4075,13 @@ GLAPI void APIENTRY glGetNamedStringivARB (GLint namelen, const GLchar *name, GL #define GL_ARB_sparse_buffer 1 #define GL_SPARSE_STORAGE_BIT_ARB 0x0400 #define GL_SPARSE_BUFFER_PAGE_SIZE_ARB 0x82F8 -typedef void (APIENTRYP PFNGLBUFFERPAGECOMMITMENTARBPROC) (GLenum target, GLintptr offset, GLsizei size, GLboolean commit); -typedef void (APIENTRYP PFNGLNAMEDBUFFERPAGECOMMITMENTEXTPROC) (GLuint buffer, GLintptr offset, GLsizei size, GLboolean commit); -typedef void (APIENTRYP PFNGLNAMEDBUFFERPAGECOMMITMENTARBPROC) (GLuint buffer, GLintptr offset, GLsizei size, GLboolean commit); +typedef void (APIENTRYP PFNGLBUFFERPAGECOMMITMENTARBPROC) (GLenum target, GLintptr offset, GLsizeiptr size, GLboolean commit); +typedef void (APIENTRYP PFNGLNAMEDBUFFERPAGECOMMITMENTEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, GLboolean commit); +typedef void (APIENTRYP PFNGLNAMEDBUFFERPAGECOMMITMENTARBPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, GLboolean commit); #ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBufferPageCommitmentARB (GLenum target, GLintptr offset, GLsizei size, GLboolean commit); -GLAPI void APIENTRY glNamedBufferPageCommitmentEXT (GLuint buffer, GLintptr offset, GLsizei size, GLboolean commit); -GLAPI void APIENTRY glNamedBufferPageCommitmentARB (GLuint buffer, GLintptr offset, GLsizei size, GLboolean commit); +GLAPI void APIENTRY glBufferPageCommitmentARB (GLenum target, GLintptr offset, GLsizeiptr size, GLboolean commit); +GLAPI void APIENTRY glNamedBufferPageCommitmentEXT (GLuint buffer, GLintptr offset, GLsizeiptr size, GLboolean commit); +GLAPI void APIENTRY glNamedBufferPageCommitmentARB (GLuint buffer, GLintptr offset, GLsizeiptr size, GLboolean commit); #endif #endif /* GL_ARB_sparse_buffer */ @@ -4079,7 +4089,7 @@ GLAPI void APIENTRY glNamedBufferPageCommitmentARB (GLuint buffer, GLintptr offs #define GL_ARB_sparse_texture 1 #define GL_TEXTURE_SPARSE_ARB 0x91A6 #define GL_VIRTUAL_PAGE_SIZE_INDEX_ARB 0x91A7 -#define GL_MIN_SPARSE_LEVEL_ARB 0x919B +#define GL_NUM_SPARSE_LEVELS_ARB 0x91AA #define GL_NUM_VIRTUAL_PAGE_SIZES_ARB 0x91A8 #define GL_VIRTUAL_PAGE_SIZE_X_ARB 0x9195 #define GL_VIRTUAL_PAGE_SIZE_Y_ARB 0x9196 @@ -4344,8 +4354,6 @@ GLAPI void APIENTRY glGetCompressedTexImageARB (GLenum target, GLint level, void #ifndef GL_ARB_transform_feedback2 #define GL_ARB_transform_feedback2 1 -#define GL_TRANSFORM_FEEDBACK_PAUSED 0x8E23 -#define GL_TRANSFORM_FEEDBACK_ACTIVE 0x8E24 #endif /* GL_ARB_transform_feedback2 */ #ifndef GL_ARB_transform_feedback3 @@ -7485,6 +7493,19 @@ GLAPI void APIENTRY glPolygonOffsetEXT (GLfloat factor, GLfloat bias); #endif #endif /* GL_EXT_polygon_offset */ +#ifndef GL_EXT_polygon_offset_clamp +#define GL_EXT_polygon_offset_clamp 1 +#define GL_POLYGON_OFFSET_CLAMP_EXT 0x8E1B +typedef void (APIENTRYP PFNGLPOLYGONOFFSETCLAMPEXTPROC) (GLfloat factor, GLfloat units, GLfloat clamp); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPolygonOffsetClampEXT (GLfloat factor, GLfloat units, GLfloat clamp); +#endif +#endif /* GL_EXT_polygon_offset_clamp */ + +#ifndef GL_EXT_post_depth_coverage +#define GL_EXT_post_depth_coverage 1 +#endif /* GL_EXT_post_depth_coverage */ + #ifndef GL_EXT_provoking_vertex #define GL_EXT_provoking_vertex 1 #define GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT 0x8E4C @@ -7497,6 +7518,20 @@ GLAPI void APIENTRY glProvokingVertexEXT (GLenum mode); #endif #endif /* GL_EXT_provoking_vertex */ +#ifndef GL_EXT_raster_multisample +#define GL_EXT_raster_multisample 1 +#define GL_RASTER_MULTISAMPLE_EXT 0x9327 +#define GL_RASTER_SAMPLES_EXT 0x9328 +#define GL_MAX_RASTER_SAMPLES_EXT 0x9329 +#define GL_RASTER_FIXED_SAMPLE_LOCATIONS_EXT 0x932A +#define GL_MULTISAMPLE_RASTERIZATION_ALLOWED_EXT 0x932B +#define GL_EFFECTIVE_RASTER_SAMPLES_EXT 0x932C +typedef void (APIENTRYP PFNGLRASTERSAMPLESEXTPROC) (GLuint samples, GLboolean fixedsamplelocations); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glRasterSamplesEXT (GLuint samples, GLboolean fixedsamplelocations); +#endif +#endif /* GL_EXT_raster_multisample */ + #ifndef GL_EXT_rescale_normal #define GL_EXT_rescale_normal 1 #define GL_RESCALE_NORMAL_EXT 0x803A @@ -7651,6 +7686,10 @@ GLAPI void APIENTRY glMemoryBarrierEXT (GLbitfield barriers); #define GL_SHARED_TEXTURE_PALETTE_EXT 0x81FB #endif /* GL_EXT_shared_texture_palette */ +#ifndef GL_EXT_sparse_texture2 +#define GL_EXT_sparse_texture2 1 +#endif /* GL_EXT_sparse_texture2 */ + #ifndef GL_EXT_stencil_clear_tag #define GL_EXT_stencil_clear_tag 1 #define GL_STENCIL_TAG_BITS_EXT 0x88F2 @@ -7863,6 +7902,10 @@ GLAPI void APIENTRY glTexBufferEXT (GLenum target, GLenum internalformat, GLuint #define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF #endif /* GL_EXT_texture_filter_anisotropic */ +#ifndef GL_EXT_texture_filter_minmax +#define GL_EXT_texture_filter_minmax 1 +#endif /* GL_EXT_texture_filter_minmax */ + #ifndef GL_EXT_texture_integer #define GL_EXT_texture_integer 1 #define GL_RGBA32UI_EXT 0x8D70 @@ -8912,6 +8955,18 @@ GLAPI void APIENTRY glEndConditionalRenderNV (void); #endif #endif /* GL_NV_conditional_render */ +#ifndef GL_NV_conservative_raster +#define GL_NV_conservative_raster 1 +#define GL_CONSERVATIVE_RASTERIZATION_NV 0x9346 +#define GL_SUBPIXEL_PRECISION_BIAS_X_BITS_NV 0x9347 +#define GL_SUBPIXEL_PRECISION_BIAS_Y_BITS_NV 0x9348 +#define GL_MAX_SUBPIXEL_PRECISION_BIAS_BITS_NV 0x9349 +typedef void (APIENTRYP PFNGLSUBPIXELPRECISIONBIASNVPROC) (GLuint xbits, GLuint ybits); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glSubpixelPrecisionBiasNV (GLuint xbits, GLuint ybits); +#endif +#endif /* GL_NV_conservative_raster */ + #ifndef GL_NV_copy_depth_to_color #define GL_NV_copy_depth_to_color 1 #define GL_DEPTH_STENCIL_TO_RGBA_NV 0x886E @@ -9054,6 +9109,11 @@ GLAPI void APIENTRY glSetFenceNV (GLuint fence, GLenum condition); #endif #endif /* GL_NV_fence */ +#ifndef GL_NV_fill_rectangle +#define GL_NV_fill_rectangle 1 +#define GL_FILL_RECTANGLE_NV 0x933C +#endif /* GL_NV_fill_rectangle */ + #ifndef GL_NV_float_buffer #define GL_NV_float_buffer 1 #define GL_FLOAT_R_NV 0x8880 @@ -9080,6 +9140,16 @@ GLAPI void APIENTRY glSetFenceNV (GLuint fence, GLenum condition); #define GL_EYE_PLANE_ABSOLUTE_NV 0x855C #endif /* GL_NV_fog_distance */ +#ifndef GL_NV_fragment_coverage_to_color +#define GL_NV_fragment_coverage_to_color 1 +#define GL_FRAGMENT_COVERAGE_TO_COLOR_NV 0x92DD +#define GL_FRAGMENT_COVERAGE_COLOR_NV 0x92DE +typedef void (APIENTRYP PFNGLFRAGMENTCOVERAGECOLORNVPROC) (GLuint color); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFragmentCoverageColorNV (GLuint color); +#endif +#endif /* GL_NV_fragment_coverage_to_color */ + #ifndef GL_NV_fragment_program #define GL_NV_fragment_program 1 #define GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV 0x8868 @@ -9121,6 +9191,30 @@ GLAPI void APIENTRY glGetProgramNamedParameterdvNV (GLuint id, GLsizei len, cons #define GL_NV_fragment_program_option 1 #endif /* GL_NV_fragment_program_option */ +#ifndef GL_NV_fragment_shader_interlock +#define GL_NV_fragment_shader_interlock 1 +#endif /* GL_NV_fragment_shader_interlock */ + +#ifndef GL_NV_framebuffer_mixed_samples +#define GL_NV_framebuffer_mixed_samples 1 +#define GL_COVERAGE_MODULATION_TABLE_NV 0x9331 +#define GL_COLOR_SAMPLES_NV 0x8E20 +#define GL_DEPTH_SAMPLES_NV 0x932D +#define GL_STENCIL_SAMPLES_NV 0x932E +#define GL_MIXED_DEPTH_SAMPLES_SUPPORTED_NV 0x932F +#define GL_MIXED_STENCIL_SAMPLES_SUPPORTED_NV 0x9330 +#define GL_COVERAGE_MODULATION_NV 0x9332 +#define GL_COVERAGE_MODULATION_TABLE_SIZE_NV 0x9333 +typedef void (APIENTRYP PFNGLCOVERAGEMODULATIONTABLENVPROC) (GLsizei n, const GLfloat *v); +typedef void (APIENTRYP PFNGLGETCOVERAGEMODULATIONTABLENVPROC) (GLsizei bufsize, GLfloat *v); +typedef void (APIENTRYP PFNGLCOVERAGEMODULATIONNVPROC) (GLenum components); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glCoverageModulationTableNV (GLsizei n, const GLfloat *v); +GLAPI void APIENTRY glGetCoverageModulationTableNV (GLsizei bufsize, GLfloat *v); +GLAPI void APIENTRY glCoverageModulationNV (GLenum components); +#endif +#endif /* GL_NV_framebuffer_mixed_samples */ + #ifndef GL_NV_framebuffer_multisample_coverage #define GL_NV_framebuffer_multisample_coverage 1 #define GL_RENDERBUFFER_COVERAGE_SAMPLES_NV 0x8CAB @@ -9152,6 +9246,10 @@ GLAPI void APIENTRY glFramebufferTextureFaceEXT (GLenum target, GLenum attachmen #define GL_NV_geometry_shader4 1 #endif /* GL_NV_geometry_shader4 */ +#ifndef GL_NV_geometry_shader_passthrough +#define GL_NV_geometry_shader_passthrough 1 +#endif /* GL_NV_geometry_shader_passthrough */ + #ifndef GL_NV_gpu_program4 #define GL_NV_gpu_program4 1 #define GL_MIN_PROGRAM_TEXEL_OFFSET_NV 0x8904 @@ -9324,6 +9422,18 @@ GLAPI void APIENTRY glVertexAttribs4hvNV (GLuint index, GLsizei n, const GLhalfN #endif #endif /* GL_NV_half_float */ +#ifndef GL_NV_internalformat_sample_query +#define GL_NV_internalformat_sample_query 1 +#define GL_MULTISAMPLES_NV 0x9371 +#define GL_SUPERSAMPLE_SCALE_X_NV 0x9372 +#define GL_SUPERSAMPLE_SCALE_Y_NV 0x9373 +#define GL_CONFORMANT_NV 0x9374 +typedef void (APIENTRYP PFNGLGETINTERNALFORMATSAMPLEIVNVPROC) (GLenum target, GLenum internalformat, GLsizei samples, GLenum pname, GLsizei bufSize, GLint *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGetInternalformatSampleivNV (GLenum target, GLenum internalformat, GLsizei samples, GLenum pname, GLsizei bufSize, GLint *params); +#endif +#endif /* GL_NV_internalformat_sample_query */ + #ifndef GL_NV_light_max_exponent #define GL_NV_light_max_exponent 1 #define GL_MAX_SHININESS_NV 0x8504 @@ -9332,7 +9442,6 @@ GLAPI void APIENTRY glVertexAttribs4hvNV (GLuint index, GLsizei n, const GLhalfN #ifndef GL_NV_multisample_coverage #define GL_NV_multisample_coverage 1 -#define GL_COLOR_SAMPLES_NV 0x8E20 #endif /* GL_NV_multisample_coverage */ #ifndef GL_NV_multisample_filter_hint @@ -9445,13 +9554,11 @@ GLAPI void APIENTRY glProgramBufferParametersIuivNV (GLenum target, GLuint bindi #define GL_SKIP_MISSING_GLYPH_NV 0x90A9 #define GL_USE_MISSING_GLYPH_NV 0x90AA #define GL_PATH_ERROR_POSITION_NV 0x90AB -#define GL_PATH_FOG_GEN_MODE_NV 0x90AC #define GL_ACCUM_ADJACENT_PAIRS_NV 0x90AD #define GL_ADJACENT_PAIRS_NV 0x90AE #define GL_FIRST_TO_REST_NV 0x90AF #define GL_PATH_GEN_MODE_NV 0x90B0 #define GL_PATH_GEN_COEFF_NV 0x90B1 -#define GL_PATH_GEN_COLOR_FORMAT_NV 0x90B2 #define GL_PATH_GEN_COMPONENTS_NV 0x90B3 #define GL_PATH_STENCIL_FUNC_NV 0x90B7 #define GL_PATH_STENCIL_REF_NV 0x90B8 @@ -9520,8 +9627,6 @@ GLAPI void APIENTRY glProgramBufferParametersIuivNV (GLenum target, GLuint bindi #define GL_FONT_UNDERLINE_POSITION_BIT_NV 0x04000000 #define GL_FONT_UNDERLINE_THICKNESS_BIT_NV 0x08000000 #define GL_FONT_HAS_KERNING_BIT_NV 0x10000000 -#define GL_PRIMARY_COLOR_NV 0x852C -#define GL_SECONDARY_COLOR_NV 0x852D #define GL_ROUNDED_RECT_NV 0xE8 #define GL_RELATIVE_ROUNDED_RECT_NV 0xE9 #define GL_ROUNDED_RECT2_NV 0xEA @@ -9545,6 +9650,10 @@ GLAPI void APIENTRY glProgramBufferParametersIuivNV (GLenum target, GLuint bindi #define GL_EYE_LINEAR_NV 0x2400 #define GL_OBJECT_LINEAR_NV 0x2401 #define GL_CONSTANT_NV 0x8576 +#define GL_PATH_FOG_GEN_MODE_NV 0x90AC +#define GL_PRIMARY_COLOR_NV 0x852C +#define GL_SECONDARY_COLOR_NV 0x852D +#define GL_PATH_GEN_COLOR_FORMAT_NV 0x90B2 #define GL_PATH_PROJECTION_NV 0x1701 #define GL_PATH_MODELVIEW_NV 0x1700 #define GL_PATH_MODELVIEW_STACK_DEPTH_NV 0x0BA3 @@ -9582,9 +9691,6 @@ typedef void (APIENTRYP PFNGLSTENCILSTROKEPATHNVPROC) (GLuint path, GLint refere typedef void (APIENTRYP PFNGLSTENCILFILLPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum transformType, const GLfloat *transformValues); typedef void (APIENTRYP PFNGLSTENCILSTROKEPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLint reference, GLuint mask, GLenum transformType, const GLfloat *transformValues); typedef void (APIENTRYP PFNGLPATHCOVERDEPTHFUNCNVPROC) (GLenum func); -typedef void (APIENTRYP PFNGLPATHCOLORGENNVPROC) (GLenum color, GLenum genMode, GLenum colorFormat, const GLfloat *coeffs); -typedef void (APIENTRYP PFNGLPATHTEXGENNVPROC) (GLenum texCoordSet, GLenum genMode, GLint components, const GLfloat *coeffs); -typedef void (APIENTRYP PFNGLPATHFOGGENNVPROC) (GLenum genMode); typedef void (APIENTRYP PFNGLCOVERFILLPATHNVPROC) (GLuint path, GLenum coverMode); typedef void (APIENTRYP PFNGLCOVERSTROKEPATHNVPROC) (GLuint path, GLenum coverMode); typedef void (APIENTRYP PFNGLCOVERFILLPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); @@ -9597,10 +9703,6 @@ typedef void (APIENTRYP PFNGLGETPATHDASHARRAYNVPROC) (GLuint path, GLfloat *dash typedef void (APIENTRYP PFNGLGETPATHMETRICSNVPROC) (GLbitfield metricQueryMask, GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLsizei stride, GLfloat *metrics); typedef void (APIENTRYP PFNGLGETPATHMETRICRANGENVPROC) (GLbitfield metricQueryMask, GLuint firstPathName, GLsizei numPaths, GLsizei stride, GLfloat *metrics); typedef void (APIENTRYP PFNGLGETPATHSPACINGNVPROC) (GLenum pathListMode, GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLfloat advanceScale, GLfloat kerningScale, GLenum transformType, GLfloat *returnedSpacing); -typedef void (APIENTRYP PFNGLGETPATHCOLORGENIVNVPROC) (GLenum color, GLenum pname, GLint *value); -typedef void (APIENTRYP PFNGLGETPATHCOLORGENFVNVPROC) (GLenum color, GLenum pname, GLfloat *value); -typedef void (APIENTRYP PFNGLGETPATHTEXGENIVNVPROC) (GLenum texCoordSet, GLenum pname, GLint *value); -typedef void (APIENTRYP PFNGLGETPATHTEXGENFVNVPROC) (GLenum texCoordSet, GLenum pname, GLfloat *value); typedef GLboolean (APIENTRYP PFNGLISPOINTINFILLPATHNVPROC) (GLuint path, GLuint mask, GLfloat x, GLfloat y); typedef GLboolean (APIENTRYP PFNGLISPOINTINSTROKEPATHNVPROC) (GLuint path, GLfloat x, GLfloat y); typedef GLfloat (APIENTRYP PFNGLGETPATHLENGTHNVPROC) (GLuint path, GLsizei startSegment, GLsizei numSegments); @@ -9620,6 +9722,13 @@ typedef GLenum (APIENTRYP PFNGLPATHGLYPHINDEXARRAYNVPROC) (GLuint firstPathName, typedef GLenum (APIENTRYP PFNGLPATHMEMORYGLYPHINDEXARRAYNVPROC) (GLuint firstPathName, GLenum fontTarget, GLsizeiptr fontSize, const void *fontData, GLsizei faceIndex, GLuint firstGlyphIndex, GLsizei numGlyphs, GLuint pathParameterTemplate, GLfloat emScale); typedef void (APIENTRYP PFNGLPROGRAMPATHFRAGMENTINPUTGENNVPROC) (GLuint program, GLint location, GLenum genMode, GLint components, const GLfloat *coeffs); typedef void (APIENTRYP PFNGLGETPROGRAMRESOURCEFVNVPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLfloat *params); +typedef void (APIENTRYP PFNGLPATHCOLORGENNVPROC) (GLenum color, GLenum genMode, GLenum colorFormat, const GLfloat *coeffs); +typedef void (APIENTRYP PFNGLPATHTEXGENNVPROC) (GLenum texCoordSet, GLenum genMode, GLint components, const GLfloat *coeffs); +typedef void (APIENTRYP PFNGLPATHFOGGENNVPROC) (GLenum genMode); +typedef void (APIENTRYP PFNGLGETPATHCOLORGENIVNVPROC) (GLenum color, GLenum pname, GLint *value); +typedef void (APIENTRYP PFNGLGETPATHCOLORGENFVNVPROC) (GLenum color, GLenum pname, GLfloat *value); +typedef void (APIENTRYP PFNGLGETPATHTEXGENIVNVPROC) (GLenum texCoordSet, GLenum pname, GLint *value); +typedef void (APIENTRYP PFNGLGETPATHTEXGENFVNVPROC) (GLenum texCoordSet, GLenum pname, GLfloat *value); #ifdef GL_GLEXT_PROTOTYPES GLAPI GLuint APIENTRY glGenPathsNV (GLsizei range); GLAPI void APIENTRY glDeletePathsNV (GLuint path, GLsizei range); @@ -9647,9 +9756,6 @@ GLAPI void APIENTRY glStencilStrokePathNV (GLuint path, GLint reference, GLuint GLAPI void APIENTRY glStencilFillPathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum transformType, const GLfloat *transformValues); GLAPI void APIENTRY glStencilStrokePathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLint reference, GLuint mask, GLenum transformType, const GLfloat *transformValues); GLAPI void APIENTRY glPathCoverDepthFuncNV (GLenum func); -GLAPI void APIENTRY glPathColorGenNV (GLenum color, GLenum genMode, GLenum colorFormat, const GLfloat *coeffs); -GLAPI void APIENTRY glPathTexGenNV (GLenum texCoordSet, GLenum genMode, GLint components, const GLfloat *coeffs); -GLAPI void APIENTRY glPathFogGenNV (GLenum genMode); GLAPI void APIENTRY glCoverFillPathNV (GLuint path, GLenum coverMode); GLAPI void APIENTRY glCoverStrokePathNV (GLuint path, GLenum coverMode); GLAPI void APIENTRY glCoverFillPathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); @@ -9662,10 +9768,6 @@ GLAPI void APIENTRY glGetPathDashArrayNV (GLuint path, GLfloat *dashArray); GLAPI void APIENTRY glGetPathMetricsNV (GLbitfield metricQueryMask, GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLsizei stride, GLfloat *metrics); GLAPI void APIENTRY glGetPathMetricRangeNV (GLbitfield metricQueryMask, GLuint firstPathName, GLsizei numPaths, GLsizei stride, GLfloat *metrics); GLAPI void APIENTRY glGetPathSpacingNV (GLenum pathListMode, GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLfloat advanceScale, GLfloat kerningScale, GLenum transformType, GLfloat *returnedSpacing); -GLAPI void APIENTRY glGetPathColorGenivNV (GLenum color, GLenum pname, GLint *value); -GLAPI void APIENTRY glGetPathColorGenfvNV (GLenum color, GLenum pname, GLfloat *value); -GLAPI void APIENTRY glGetPathTexGenivNV (GLenum texCoordSet, GLenum pname, GLint *value); -GLAPI void APIENTRY glGetPathTexGenfvNV (GLenum texCoordSet, GLenum pname, GLfloat *value); GLAPI GLboolean APIENTRY glIsPointInFillPathNV (GLuint path, GLuint mask, GLfloat x, GLfloat y); GLAPI GLboolean APIENTRY glIsPointInStrokePathNV (GLuint path, GLfloat x, GLfloat y); GLAPI GLfloat APIENTRY glGetPathLengthNV (GLuint path, GLsizei startSegment, GLsizei numSegments); @@ -9685,9 +9787,21 @@ GLAPI GLenum APIENTRY glPathGlyphIndexArrayNV (GLuint firstPathName, GLenum font GLAPI GLenum APIENTRY glPathMemoryGlyphIndexArrayNV (GLuint firstPathName, GLenum fontTarget, GLsizeiptr fontSize, const void *fontData, GLsizei faceIndex, GLuint firstGlyphIndex, GLsizei numGlyphs, GLuint pathParameterTemplate, GLfloat emScale); GLAPI void APIENTRY glProgramPathFragmentInputGenNV (GLuint program, GLint location, GLenum genMode, GLint components, const GLfloat *coeffs); GLAPI void APIENTRY glGetProgramResourcefvNV (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLfloat *params); +GLAPI void APIENTRY glPathColorGenNV (GLenum color, GLenum genMode, GLenum colorFormat, const GLfloat *coeffs); +GLAPI void APIENTRY glPathTexGenNV (GLenum texCoordSet, GLenum genMode, GLint components, const GLfloat *coeffs); +GLAPI void APIENTRY glPathFogGenNV (GLenum genMode); +GLAPI void APIENTRY glGetPathColorGenivNV (GLenum color, GLenum pname, GLint *value); +GLAPI void APIENTRY glGetPathColorGenfvNV (GLenum color, GLenum pname, GLfloat *value); +GLAPI void APIENTRY glGetPathTexGenivNV (GLenum texCoordSet, GLenum pname, GLint *value); +GLAPI void APIENTRY glGetPathTexGenfvNV (GLenum texCoordSet, GLenum pname, GLfloat *value); #endif #endif /* GL_NV_path_rendering */ +#ifndef GL_NV_path_rendering_shared_edge +#define GL_NV_path_rendering_shared_edge 1 +#define GL_SHARED_EDGE_NV 0xC0 +#endif /* GL_NV_path_rendering_shared_edge */ + #ifndef GL_NV_pixel_data_range #define GL_NV_pixel_data_range 1 #define GL_WRITE_PIXEL_DATA_RANGE_NV 0x8878 @@ -9845,6 +9959,30 @@ GLAPI void APIENTRY glGetCombinerStageParameterfvNV (GLenum stage, GLenum pname, #endif #endif /* GL_NV_register_combiners2 */ +#ifndef GL_NV_sample_locations +#define GL_NV_sample_locations 1 +#define GL_SAMPLE_LOCATION_SUBPIXEL_BITS_NV 0x933D +#define GL_SAMPLE_LOCATION_PIXEL_GRID_WIDTH_NV 0x933E +#define GL_SAMPLE_LOCATION_PIXEL_GRID_HEIGHT_NV 0x933F +#define GL_PROGRAMMABLE_SAMPLE_LOCATION_TABLE_SIZE_NV 0x9340 +#define GL_SAMPLE_LOCATION_NV 0x8E50 +#define GL_PROGRAMMABLE_SAMPLE_LOCATION_NV 0x9341 +#define GL_FRAMEBUFFER_PROGRAMMABLE_SAMPLE_LOCATIONS_NV 0x9342 +#define GL_FRAMEBUFFER_SAMPLE_LOCATION_PIXEL_GRID_NV 0x9343 +typedef void (APIENTRYP PFNGLFRAMEBUFFERSAMPLELOCATIONSFVNVPROC) (GLenum target, GLuint start, GLsizei count, const GLfloat *v); +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERSAMPLELOCATIONSFVNVPROC) (GLuint framebuffer, GLuint start, GLsizei count, const GLfloat *v); +typedef void (APIENTRYP PFNGLRESOLVEDEPTHVALUESNVPROC) (void); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFramebufferSampleLocationsfvNV (GLenum target, GLuint start, GLsizei count, const GLfloat *v); +GLAPI void APIENTRY glNamedFramebufferSampleLocationsfvNV (GLuint framebuffer, GLuint start, GLsizei count, const GLfloat *v); +GLAPI void APIENTRY glResolveDepthValuesNV (void); +#endif +#endif /* GL_NV_sample_locations */ + +#ifndef GL_NV_sample_mask_override_coverage +#define GL_NV_sample_mask_override_coverage 1 +#endif /* GL_NV_sample_mask_override_coverage */ + #ifndef GL_NV_shader_atomic_counters #define GL_NV_shader_atomic_counters 1 #endif /* GL_NV_shader_atomic_counters */ @@ -9853,6 +9991,10 @@ GLAPI void APIENTRY glGetCombinerStageParameterfvNV (GLenum stage, GLenum pname, #define GL_NV_shader_atomic_float 1 #endif /* GL_NV_shader_atomic_float */ +#ifndef GL_NV_shader_atomic_fp16_vector +#define GL_NV_shader_atomic_fp16_vector 1 +#endif /* GL_NV_shader_atomic_fp16_vector */ + #ifndef GL_NV_shader_atomic_int64 #define GL_NV_shader_atomic_int64 1 #endif /* GL_NV_shader_atomic_int64 */ @@ -10176,6 +10318,13 @@ GLAPI void APIENTRY glDrawTransformFeedbackNV (GLenum mode, GLuint id); #endif #endif /* GL_NV_transform_feedback2 */ +#ifndef GL_NV_uniform_buffer_unified_memory +#define GL_NV_uniform_buffer_unified_memory 1 +#define GL_UNIFORM_BUFFER_UNIFIED_NV 0x936E +#define GL_UNIFORM_BUFFER_ADDRESS_NV 0x936F +#define GL_UNIFORM_BUFFER_LENGTH_NV 0x9370 +#endif /* GL_NV_uniform_buffer_unified_memory */ + #ifndef GL_NV_vdpau_interop #define GL_NV_vdpau_interop 1 typedef GLintptr GLvdpauSurfaceNV; diff --git a/mesalib/include/c99_compat.h b/mesalib/include/c99_compat.h index 429c60148..e5d0ae43a 100644 --- a/mesalib/include/c99_compat.h +++ b/mesalib/include/c99_compat.h @@ -114,11 +114,7 @@ # elif defined(__SUNPRO_C) && defined(__C99FEATURES__) /* C99 */ # elif defined(__GNUC__) -# if __GNUC__ >= 2 -# define __func__ __FUNCTION__ -# else -# define __func__ "<unknown>" -# endif +# define __func__ __FUNCTION__ # elif defined(_MSC_VER) # if _MSC_VER >= 1300 # define __func__ __FUNCTION__ diff --git a/mesalib/install-lib-links.mk b/mesalib/install-lib-links.mk index 5ea738537..6976ca491 100644 --- a/mesalib/install-lib-links.mk +++ b/mesalib/install-lib-links.mk @@ -14,5 +14,11 @@ all-local : .libs/install-mesa-links ln -f $$f $(top_builddir)/$(LIB_DIR); \ fi; \ done && touch $@ + +clean-local: + for f in $(notdir $(lib_LTLIBRARIES:%.la=.libs/%.$(LIB_EXT)*)); do \ + $(RM) $(top_builddir)/$(LIB_DIR)/$$f; \ + done; + endif endif diff --git a/mesalib/src/Makefile.am b/mesalib/src/Makefile.am index 3e736d029..85b75a93b 100644 --- a/mesalib/src/Makefile.am +++ b/mesalib/src/Makefile.am @@ -19,7 +19,7 @@ # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS # IN THE SOFTWARE. -SUBDIRS = gtest util mapi +SUBDIRS = gtest util mapi/glapi/gen mapi if NEED_OPENGL_COMMON SUBDIRS += glsl mesa @@ -32,7 +32,7 @@ SUBDIRS += glx endif if HAVE_EGL_PLATFORM_WAYLAND -SUBDIRS += egl/wayland +SUBDIRS += egl/wayland/wayland-egl egl/wayland/wayland-drm endif if HAVE_EGL_DRIVER_DRI2 @@ -51,4 +51,4 @@ if HAVE_GALLIUM SUBDIRS += gallium endif -EXTRA_DIST = getopt +EXTRA_DIST = egl/docs getopt hgl SConscript diff --git a/mesalib/src/SConscript b/mesalib/src/SConscript index 2657bba47..c25adc728 100644 --- a/mesalib/src/SConscript +++ b/mesalib/src/SConscript @@ -33,6 +33,11 @@ if not env['embedded']: if env['platform'] not in ('cygwin', 'darwin', 'freebsd', 'haiku', 'windows'): SConscript('glx/SConscript') if env['platform'] not in ['darwin', 'haiku', 'sunos']: + if env['dri']: + SConscript('egl/drivers/dri2/SConscript') + SConscript('egl/main/SConscript') + if env['platform'] == 'haiku': + SConscript('egl/drivers/haiku/SConscript') SConscript('egl/main/SConscript') if env['gles']: diff --git a/mesalib/src/gallium/Automake.inc b/mesalib/src/gallium/Automake.inc index 9b312b113..95aae50d6 100644 --- a/mesalib/src/gallium/Automake.inc +++ b/mesalib/src/gallium/Automake.inc @@ -32,6 +32,7 @@ GALLIUM_DRIVER_CXXFLAGS = \ $(VISIBILITY_CXXFLAGS) GALLIUM_TARGET_CFLAGS = \ + -I$(top_srcdir)/src \ -I$(top_srcdir)/include \ -I$(top_srcdir)/src/loader \ -I$(top_srcdir)/src/gallium/include \ @@ -50,6 +51,7 @@ GALLIUM_COMMON_LIB_DEPS = \ $(DLOPEN_LIBS) GALLIUM_WINSYS_CFLAGS = \ + -I$(top_srcdir)/src \ -I$(top_srcdir)/include \ -I$(top_srcdir)/src/gallium/include \ -I$(top_srcdir)/src/gallium/auxiliary \ diff --git a/mesalib/src/gallium/Makefile.am b/mesalib/src/gallium/Makefile.am index 81840b208..6a2a86654 100644 --- a/mesalib/src/gallium/Makefile.am +++ b/mesalib/src/gallium/Makefile.am @@ -112,7 +112,13 @@ SUBDIRS += winsys/sw/wrapper ## EXTRA_DIST = \ - winsys/sw/android \ + docs \ + README.portability \ + SConscript \ + state_trackers/egl \ + state_trackers/gbm \ + targets/egl-static \ + targets/gbm \ winsys/sw/gdi \ winsys/sw/hgl diff --git a/mesalib/src/gallium/SConscript b/mesalib/src/gallium/SConscript index 977e3fbf4..25d0af6f9 100644 --- a/mesalib/src/gallium/SConscript +++ b/mesalib/src/gallium/SConscript @@ -63,7 +63,7 @@ SConscript([ if not env['embedded']: SConscript('state_trackers/vega/SConscript') - if env['platform'] not in ('cygwin', 'darwin', 'freebsd', 'haiku', 'sunos'): + if env['platform'] not in ('cygwin', 'darwin', 'freebsd', 'sunos'): SConscript([ 'state_trackers/egl/SConscript', 'targets/egl-static/SConscript', diff --git a/mesalib/src/gallium/auxiliary/Makefile.am b/mesalib/src/gallium/auxiliary/Makefile.am index 4085e510b..1053ce4ee 100644 --- a/mesalib/src/gallium/auxiliary/Makefile.am +++ b/mesalib/src/gallium/auxiliary/Makefile.am @@ -74,11 +74,13 @@ libgalliumvl_la_SOURCES = \ endif EXTRA_DIST = \ - Android.mk SConscript \ + SConscript \ indices/u_indices.c \ indices/u_unfilled_indices.c \ indices/u_indices_gen.py \ indices/u_unfilled_gen.py \ + postprocess/ADDING \ + rbug/README \ target-helpers \ util/u_format.csv \ util/u_format_pack.py \ diff --git a/mesalib/src/gallium/auxiliary/Makefile.sources b/mesalib/src/gallium/auxiliary/Makefile.sources index 862626461..3460482c1 100644 --- a/mesalib/src/gallium/auxiliary/Makefile.sources +++ b/mesalib/src/gallium/auxiliary/Makefile.sources @@ -165,9 +165,9 @@ C_SOURCES := \ translate/translate_generic.c \ translate/translate_sse.c \ util/dbghelp.h \ - util/u_atomic.h \ util/u_bitmask.c \ util/u_bitmask.h \ + util/u_blend.h \ util/u_blit.c \ util/u_blit.h \ util/u_blitter.c \ diff --git a/mesalib/src/gallium/auxiliary/util/u_atomic.h b/mesalib/src/gallium/auxiliary/util/u_atomic.h deleted file mode 100644 index 2500bc752..000000000 --- a/mesalib/src/gallium/auxiliary/util/u_atomic.h +++ /dev/null @@ -1,401 +0,0 @@ -/** - * Many similar implementations exist. See for example libwsbm - * or the linux kernel include/atomic.h - * - * No copyright claimed on this file. - * - */ - -#ifndef U_ATOMIC_H -#define U_ATOMIC_H - -#include "pipe/p_compiler.h" -#include "pipe/p_defines.h" - -/* Favor OS-provided implementations. - * - * Where no OS-provided implementation is available, fall back to - * locally coded assembly, compiler intrinsic or ultimately a - * mutex-based implementation. - */ -#if defined(PIPE_OS_SOLARIS) -#define PIPE_ATOMIC_OS_SOLARIS -#elif defined(PIPE_CC_MSVC) -#define PIPE_ATOMIC_MSVC_INTRINSIC -#elif (defined(PIPE_CC_MSVC) && defined(PIPE_ARCH_X86)) -#define PIPE_ATOMIC_ASM_MSVC_X86 -#elif defined(PIPE_CC_GCC) && (PIPE_CC_GCC_VERSION >= 401) -#define PIPE_ATOMIC_GCC_INTRINSIC -#elif (defined(PIPE_CC_GCC) && defined(PIPE_ARCH_X86)) -#define PIPE_ATOMIC_ASM_GCC_X86 -#elif (defined(PIPE_CC_GCC) && defined(PIPE_ARCH_X86_64)) -#define PIPE_ATOMIC_ASM_GCC_X86_64 -#else -#error "Unsupported platform" -#endif - - -#if defined(PIPE_ATOMIC_ASM_GCC_X86_64) -#define PIPE_ATOMIC "GCC x86_64 assembly" - -#ifdef __cplusplus -extern "C" { -#endif - -#define p_atomic_set(_v, _i) (*(_v) = (_i)) -#define p_atomic_read(_v) (*(_v)) - -static INLINE boolean -p_atomic_dec_zero(int32_t *v) -{ - unsigned char c; - - __asm__ __volatile__("lock; decl %0; sete %1":"+m"(*v), "=qm"(c) - ::"memory"); - - return c != 0; -} - -static INLINE void -p_atomic_inc(int32_t *v) -{ - __asm__ __volatile__("lock; incl %0":"+m"(*v)); -} - -static INLINE void -p_atomic_dec(int32_t *v) -{ - __asm__ __volatile__("lock; decl %0":"+m"(*v)); -} - -static INLINE int32_t -p_atomic_inc_return(int32_t *v) -{ - return __sync_add_and_fetch(v, 1); -} - -static INLINE int32_t -p_atomic_dec_return(int32_t *v) -{ - return __sync_sub_and_fetch(v, 1); -} - -static INLINE int32_t -p_atomic_cmpxchg(int32_t *v, int32_t old, int32_t _new) -{ - return __sync_val_compare_and_swap(v, old, _new); -} - -#ifdef __cplusplus -} -#endif - -#endif /* PIPE_ATOMIC_ASM_GCC_X86_64 */ - - -#if defined(PIPE_ATOMIC_ASM_GCC_X86) - -#define PIPE_ATOMIC "GCC x86 assembly" - -#ifdef __cplusplus -extern "C" { -#endif - -#define p_atomic_set(_v, _i) (*(_v) = (_i)) -#define p_atomic_read(_v) (*(_v)) - -static INLINE boolean -p_atomic_dec_zero(int32_t *v) -{ - unsigned char c; - - __asm__ __volatile__("lock; decl %0; sete %1":"+m"(*v), "=qm"(c) - ::"memory"); - - return c != 0; -} - -static INLINE void -p_atomic_inc(int32_t *v) -{ - __asm__ __volatile__("lock; incl %0":"+m"(*v)); -} - -static INLINE void -p_atomic_dec(int32_t *v) -{ - __asm__ __volatile__("lock; decl %0":"+m"(*v)); -} - -static INLINE int32_t -p_atomic_inc_return(int32_t *v) -{ - return __sync_add_and_fetch(v, 1); -} - -static INLINE int32_t -p_atomic_dec_return(int32_t *v) -{ - return __sync_sub_and_fetch(v, 1); -} - -static INLINE int32_t -p_atomic_cmpxchg(int32_t *v, int32_t old, int32_t _new) -{ - return __sync_val_compare_and_swap(v, old, _new); -} - -#ifdef __cplusplus -} -#endif - -#endif - - - -/* Implementation using GCC-provided synchronization intrinsics - */ -#if defined(PIPE_ATOMIC_GCC_INTRINSIC) - -#define PIPE_ATOMIC "GCC Sync Intrinsics" - -#ifdef __cplusplus -extern "C" { -#endif - -#define p_atomic_set(_v, _i) (*(_v) = (_i)) -#define p_atomic_read(_v) (*(_v)) - -static INLINE boolean -p_atomic_dec_zero(int32_t *v) -{ - return (__sync_sub_and_fetch(v, 1) == 0); -} - -static INLINE void -p_atomic_inc(int32_t *v) -{ - (void) __sync_add_and_fetch(v, 1); -} - -static INLINE void -p_atomic_dec(int32_t *v) -{ - (void) __sync_sub_and_fetch(v, 1); -} - -static INLINE int32_t -p_atomic_inc_return(int32_t *v) -{ - return __sync_add_and_fetch(v, 1); -} - -static INLINE int32_t -p_atomic_dec_return(int32_t *v) -{ - return __sync_sub_and_fetch(v, 1); -} - -static INLINE int32_t -p_atomic_cmpxchg(int32_t *v, int32_t old, int32_t _new) -{ - return __sync_val_compare_and_swap(v, old, _new); -} - -#ifdef __cplusplus -} -#endif - -#endif - - - -/* Unlocked version for single threaded environments, such as some - * windows kernel modules. - */ -#if defined(PIPE_ATOMIC_OS_UNLOCKED) - -#define PIPE_ATOMIC "Unlocked" - -#define p_atomic_set(_v, _i) (*(_v) = (_i)) -#define p_atomic_read(_v) (*(_v)) -#define p_atomic_dec_zero(_v) ((boolean) --(*(_v))) -#define p_atomic_inc(_v) ((void) (*(_v))++) -#define p_atomic_dec(_v) ((void) (*(_v))--) -#define p_atomic_inc_return(_v) ((*(_v))++) -#define p_atomic_dec_return(_v) ((*(_v))--) -#define p_atomic_cmpxchg(_v, old, _new) (*(_v) == old ? *(_v) = (_new) : *(_v)) - -#endif - - -/* Locally coded assembly for MSVC on x86: - */ -#if defined(PIPE_ATOMIC_ASM_MSVC_X86) - -#define PIPE_ATOMIC "MSVC x86 assembly" - -#ifdef __cplusplus -extern "C" { -#endif - -#define p_atomic_set(_v, _i) (*(_v) = (_i)) -#define p_atomic_read(_v) (*(_v)) - -static INLINE boolean -p_atomic_dec_zero(int32_t *v) -{ - unsigned char c; - - __asm { - mov eax, [v] - lock dec dword ptr [eax] - sete byte ptr [c] - } - - return c != 0; -} - -static INLINE void -p_atomic_inc(int32_t *v) -{ - __asm { - mov eax, [v] - lock inc dword ptr [eax] - } -} - -static INLINE void -p_atomic_dec(int32_t *v) -{ - __asm { - mov eax, [v] - lock dec dword ptr [eax] - } -} - -static INLINE int32_t -p_atomic_cmpxchg(int32_t *v, int32_t old, int32_t _new) -{ - int32_t orig; - - __asm { - mov ecx, [v] - mov eax, [old] - mov edx, [_new] - lock cmpxchg [ecx], edx - mov [orig], eax - } - - return orig; -} - -#ifdef __cplusplus -} -#endif - -#endif - - -#if defined(PIPE_ATOMIC_MSVC_INTRINSIC) - -#define PIPE_ATOMIC "MSVC Intrinsics" - -#include <intrin.h> - -#pragma intrinsic(_InterlockedIncrement) -#pragma intrinsic(_InterlockedDecrement) -#pragma intrinsic(_InterlockedCompareExchange) - -#ifdef __cplusplus -extern "C" { -#endif - -#define p_atomic_set(_v, _i) (*(_v) = (_i)) -#define p_atomic_read(_v) (*(_v)) - -static INLINE boolean -p_atomic_dec_zero(int32_t *v) -{ - return _InterlockedDecrement((long *)v) == 0; -} - -static INLINE void -p_atomic_inc(int32_t *v) -{ - _InterlockedIncrement((long *)v); -} - -static INLINE int32_t -p_atomic_inc_return(int32_t *v) -{ - return _InterlockedIncrement((long *)v); -} - -static INLINE void -p_atomic_dec(int32_t *v) -{ - _InterlockedDecrement((long *)v); -} - -static INLINE int32_t -p_atomic_dec_return(int32_t *v) -{ - return _InterlockedDecrement((long *)v); -} - -static INLINE int32_t -p_atomic_cmpxchg(int32_t *v, int32_t old, int32_t _new) -{ - return _InterlockedCompareExchange((long *)v, _new, old); -} - -#ifdef __cplusplus -} -#endif - -#endif - -#if defined(PIPE_ATOMIC_OS_SOLARIS) - -#define PIPE_ATOMIC "Solaris OS atomic functions" - -#include <atomic.h> - -#ifdef __cplusplus -extern "C" { -#endif - -#define p_atomic_set(_v, _i) (*(_v) = (_i)) -#define p_atomic_read(_v) (*(_v)) - -static INLINE boolean -p_atomic_dec_zero(int32_t *v) -{ - uint32_t n = atomic_dec_32_nv((uint32_t *) v); - - return n != 0; -} - -#define p_atomic_inc(_v) atomic_inc_32((uint32_t *) _v) -#define p_atomic_dec(_v) atomic_dec_32((uint32_t *) _v) -#define p_atomic_inc_return(_v) atomic_inc_32_nv((uint32_t *) _v) -#define p_atomic_dec_return(_v) atomic_dec_32_nv((uint32_t *) _v) - -#define p_atomic_cmpxchg(_v, _old, _new) \ - atomic_cas_32( (uint32_t *) _v, (uint32_t) _old, (uint32_t) _new) - -#ifdef __cplusplus -} -#endif - -#endif - - -#ifndef PIPE_ATOMIC -#error "No pipe_atomic implementation selected" -#endif - - - -#endif /* U_ATOMIC_H */ diff --git a/mesalib/src/gallium/auxiliary/util/u_blend.h b/mesalib/src/gallium/auxiliary/util/u_blend.h new file mode 100644 index 000000000..2485c34d4 --- /dev/null +++ b/mesalib/src/gallium/auxiliary/util/u_blend.h @@ -0,0 +1,25 @@ +#ifndef U_BLEND_H +#define U_BLEND_H + +#include "pipe/p_state.h" + +/** + * When faking RGBX render target formats with RGBA ones, the blender is still + * supposed to treat the destination's alpha channel as 1 instead of the + * garbage that's there. Return a blend factor that will take that into + * account. + */ +static INLINE int +util_blend_dst_alpha_to_one(int factor) +{ + switch (factor) { + case PIPE_BLENDFACTOR_DST_ALPHA: + return PIPE_BLENDFACTOR_ONE; + case PIPE_BLENDFACTOR_INV_DST_ALPHA: + return PIPE_BLENDFACTOR_ZERO; + default: + return factor; + } +} + +#endif /* U_BLEND_H */ diff --git a/mesalib/src/gallium/auxiliary/util/u_debug.h b/mesalib/src/gallium/auxiliary/util/u_debug.h index badd5e296..4c22fdfb6 100644 --- a/mesalib/src/gallium/auxiliary/util/u_debug.h +++ b/mesalib/src/gallium/auxiliary/util/u_debug.h @@ -185,7 +185,7 @@ void _debug_assert_fail(const char *expr, #ifdef DEBUG #define debug_assert(expr) ((expr) ? (void)0 : _debug_assert_fail(#expr, __FILE__, __LINE__, __FUNCTION__)) #else -#define debug_assert(expr) do { } while (0 && (expr)) +#define debug_assert(expr) (void)(0 && (expr)) #endif diff --git a/mesalib/src/gallium/auxiliary/util/u_debug_flush.c b/mesalib/src/gallium/auxiliary/util/u_debug_flush.c index fdb248c23..cdefca2fb 100644 --- a/mesalib/src/gallium/auxiliary/util/u_debug_flush.c +++ b/mesalib/src/gallium/auxiliary/util/u_debug_flush.c @@ -132,8 +132,7 @@ debug_flush_buf_reference(struct debug_flush_buf **dst, struct debug_flush_buf *fbuf = *dst; if (pipe_reference(&(*dst)->reference, &src->reference)) { - if (fbuf->map_frame) - FREE(fbuf->map_frame); + FREE(fbuf->map_frame); FREE(fbuf); } @@ -146,8 +145,7 @@ debug_flush_item_destroy(struct debug_flush_item *item) { debug_flush_buf_reference(&item->fbuf, NULL); - if (item->ref_frame) - FREE(item->ref_frame); + FREE(item->ref_frame); FREE(item); } @@ -263,10 +261,8 @@ debug_flush_unmap(struct debug_flush_buf *fbuf) fbuf->mapped_sync = FALSE; fbuf->mapped = FALSE; - if (fbuf->map_frame) { - FREE(fbuf->map_frame); - fbuf->map_frame = NULL; - } + FREE(fbuf->map_frame); + fbuf->map_frame = NULL; pipe_mutex_unlock(fbuf->mutex); } diff --git a/mesalib/src/gallium/auxiliary/util/u_math.h b/mesalib/src/gallium/auxiliary/util/u_math.h index 0113fb1a0..19c7343b1 100644 --- a/mesalib/src/gallium/auxiliary/util/u_math.h +++ b/mesalib/src/gallium/auxiliary/util/u_math.h @@ -541,7 +541,7 @@ unsigned ffs( unsigned u ) static INLINE unsigned util_last_bit(unsigned u) { -#if defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 304) +#if defined(__GNUC__) return u == 0 ? 0 : 32 - __builtin_clz(u); #else unsigned r = 0; @@ -658,7 +658,7 @@ float_to_byte_tex(float f) static INLINE unsigned util_logbase2(unsigned n) { -#if defined(PIPE_CC_GCC) && (PIPE_CC_GCC_VERSION >= 304) +#if defined(PIPE_CC_GCC) return ((sizeof(unsigned) * 8 - 1) - __builtin_clz(n | 1)); #else unsigned pos = 0; @@ -678,7 +678,7 @@ util_logbase2(unsigned n) static INLINE unsigned util_next_power_of_two(unsigned x) { -#if defined(PIPE_CC_GCC) && (PIPE_CC_GCC_VERSION >= 304) +#if defined(PIPE_CC_GCC) if (x <= 1) return 1; @@ -710,7 +710,7 @@ util_next_power_of_two(unsigned x) static INLINE unsigned util_bitcount(unsigned n) { -#if defined(PIPE_CC_GCC) && (PIPE_CC_GCC_VERSION >= 304) +#if defined(PIPE_CC_GCC) return __builtin_popcount(n); #else /* K&R classic bitcount. diff --git a/mesalib/src/gallium/auxiliary/util/u_prim.h b/mesalib/src/gallium/auxiliary/util/u_prim.h index cf1a18f42..b2dd44df2 100644 --- a/mesalib/src/gallium/auxiliary/util/u_prim.h +++ b/mesalib/src/gallium/auxiliary/util/u_prim.h @@ -280,4 +280,10 @@ u_reduced_prims_for_vertices(int primitive, int vertices) const char *u_prim_name( unsigned pipe_prim ); + +#ifdef __cplusplus +} +#endif + + #endif diff --git a/mesalib/src/gallium/auxiliary/util/u_tests.c b/mesalib/src/gallium/auxiliary/util/u_tests.c index c0f6327b6..b42f5e137 100644 --- a/mesalib/src/gallium/auxiliary/util/u_tests.c +++ b/mesalib/src/gallium/auxiliary/util/u_tests.c @@ -248,7 +248,6 @@ tgsi_vs_window_space_position(struct pipe_context *ctx) cb->width0, cb->height0, red); /* Cleanup. */ - cso_release_all(cso); cso_destroy_context(cso); ctx->delete_vs_state(ctx, vs); ctx->delete_fs_state(ctx, fs); diff --git a/mesalib/src/glsl/Makefile.am b/mesalib/src/glsl/Makefile.am index 0ccc81d75..9a3131738 100644 --- a/mesalib/src/glsl/Makefile.am +++ b/mesalib/src/glsl/Makefile.am @@ -30,6 +30,13 @@ AM_CPPFLAGS = \ AM_CFLAGS = $(VISIBILITY_CFLAGS) AM_CXXFLAGS = $(VISIBILITY_CXXFLAGS) +EXTRA_DIST = tests glcpp/tests README TODO glcpp/README \ + glsl_lexer.ll \ + glsl_parser.yy \ + glcpp/glcpp-lex.l \ + glcpp/glcpp-parse.y \ + SConscript + include Makefile.sources TESTS = glcpp/tests/glcpp-test \ @@ -77,6 +84,7 @@ tests_uniform_initializer_test_SOURCES = \ tests/copy_constant_to_storage_tests.cpp \ tests/set_uniform_initializer_tests.cpp \ tests/uniform_initializer_utils.cpp \ + tests/uniform_initializer_utils.h \ tests/common.c tests_uniform_initializer_test_CFLAGS = \ $(PTHREAD_CFLAGS) @@ -102,6 +110,7 @@ libglcpp_la_LIBADD = \ libglcpp_la_SOURCES = \ glcpp/glcpp-lex.c \ glcpp/glcpp-parse.c \ + glcpp/glcpp-parse.h \ $(LIBGLCPP_FILES) glcpp_glcpp_SOURCES = \ @@ -116,6 +125,7 @@ libglsl_la_LIBADD = libglcpp.la libglsl_la_SOURCES = \ glsl_lexer.cpp \ glsl_parser.cpp \ + glsl_parser.h \ $(LIBGLSL_FILES) glsl_compiler_SOURCES = \ @@ -135,7 +145,8 @@ glsl_test_SOURCES = \ $(GLSL_SRCDIR)/standalone_scaffolding.cpp \ tests/common.c \ test.cpp \ - test_optpass.cpp + test_optpass.cpp \ + test_optpass.h glsl_test_LDADD = libglsl.la @@ -198,3 +209,10 @@ CLEANFILES = \ glcpp/glcpp-parse.h \ glsl_parser.h \ $(BUILT_SOURCES) + +clean-local: + $(RM) -r subtest-cr subtest-cr-lf subtest-lf subtest-lf-cr + +dist-hook: + $(RM) glcpp/tests/*.out + $(RM) glcpp/tests/subtest*/*.out diff --git a/mesalib/src/glsl/Makefile.sources b/mesalib/src/glsl/Makefile.sources index 676fa0d7a..e2acbac25 100644 --- a/mesalib/src/glsl/Makefile.sources +++ b/mesalib/src/glsl/Makefile.sources @@ -6,6 +6,7 @@ GLSL_BUILDDIR = $(top_builddir)/src/glsl # libglcpp LIBGLCPP_FILES = \ + $(GLSL_SRCDIR)/glcpp/glcpp.h \ $(GLSL_SRCDIR)/glcpp/pp.c LIBGLCPP_GENERATED_FILES = \ @@ -15,47 +16,70 @@ LIBGLCPP_GENERATED_FILES = \ # libglsl LIBGLSL_FILES = \ + $(GLSL_SRCDIR)/ast.h \ $(GLSL_SRCDIR)/ast_array_index.cpp \ $(GLSL_SRCDIR)/ast_expr.cpp \ $(GLSL_SRCDIR)/ast_function.cpp \ $(GLSL_SRCDIR)/ast_to_hir.cpp \ $(GLSL_SRCDIR)/ast_type.cpp \ $(GLSL_SRCDIR)/builtin_functions.cpp \ + $(GLSL_SRCDIR)/builtin_type_macros.h \ $(GLSL_SRCDIR)/builtin_types.cpp \ $(GLSL_SRCDIR)/builtin_variables.cpp \ $(GLSL_SRCDIR)/glsl_parser_extras.cpp \ - $(GLSL_SRCDIR)/glsl_types.cpp \ + $(GLSL_SRCDIR)/glsl_parser_extras.h \ $(GLSL_SRCDIR)/glsl_symbol_table.cpp \ + $(GLSL_SRCDIR)/glsl_symbol_table.h \ + $(GLSL_SRCDIR)/glsl_types.cpp \ + $(GLSL_SRCDIR)/glsl_types.h \ $(GLSL_SRCDIR)/hir_field_selection.cpp \ $(GLSL_SRCDIR)/ir_basic_block.cpp \ + $(GLSL_SRCDIR)/ir_basic_block.h \ $(GLSL_SRCDIR)/ir_builder.cpp \ + $(GLSL_SRCDIR)/ir_builder.h \ $(GLSL_SRCDIR)/ir_clone.cpp \ $(GLSL_SRCDIR)/ir_constant_expression.cpp \ $(GLSL_SRCDIR)/ir.cpp \ + $(GLSL_SRCDIR)/ir.h \ $(GLSL_SRCDIR)/ir_equals.cpp \ $(GLSL_SRCDIR)/ir_expression_flattening.cpp \ + $(GLSL_SRCDIR)/ir_expression_flattening.h \ $(GLSL_SRCDIR)/ir_function_can_inline.cpp \ $(GLSL_SRCDIR)/ir_function_detect_recursion.cpp \ + $(GLSL_SRCDIR)/ir_function_inlining.h \ $(GLSL_SRCDIR)/ir_function.cpp \ $(GLSL_SRCDIR)/ir_hierarchical_visitor.cpp \ + $(GLSL_SRCDIR)/ir_hierarchical_visitor.h \ $(GLSL_SRCDIR)/ir_hv_accept.cpp \ $(GLSL_SRCDIR)/ir_import_prototypes.cpp \ + $(GLSL_SRCDIR)/ir_optimization.h \ $(GLSL_SRCDIR)/ir_print_visitor.cpp \ + $(GLSL_SRCDIR)/ir_print_visitor.h \ $(GLSL_SRCDIR)/ir_reader.cpp \ + $(GLSL_SRCDIR)/ir_reader.h \ $(GLSL_SRCDIR)/ir_rvalue_visitor.cpp \ + $(GLSL_SRCDIR)/ir_rvalue_visitor.h \ $(GLSL_SRCDIR)/ir_set_program_inouts.cpp \ + $(GLSL_SRCDIR)/ir_uniform.h \ $(GLSL_SRCDIR)/ir_validate.cpp \ $(GLSL_SRCDIR)/ir_variable_refcount.cpp \ + $(GLSL_SRCDIR)/ir_variable_refcount.h \ + $(GLSL_SRCDIR)/ir_visitor.h \ $(GLSL_SRCDIR)/linker.cpp \ + $(GLSL_SRCDIR)/linker.h \ $(GLSL_SRCDIR)/link_atomics.cpp \ $(GLSL_SRCDIR)/link_functions.cpp \ $(GLSL_SRCDIR)/link_interface_blocks.cpp \ $(GLSL_SRCDIR)/link_uniforms.cpp \ $(GLSL_SRCDIR)/link_uniform_initializers.cpp \ $(GLSL_SRCDIR)/link_uniform_block_active_visitor.cpp \ + $(GLSL_SRCDIR)/link_uniform_block_active_visitor.h \ $(GLSL_SRCDIR)/link_uniform_blocks.cpp \ $(GLSL_SRCDIR)/link_varyings.cpp \ + $(GLSL_SRCDIR)/link_varyings.h \ + $(GLSL_SRCDIR)/list.h \ $(GLSL_SRCDIR)/loop_analysis.cpp \ + $(GLSL_SRCDIR)/loop_analysis.h \ $(GLSL_SRCDIR)/loop_controls.cpp \ $(GLSL_SRCDIR)/loop_unroll.cpp \ $(GLSL_SRCDIR)/lower_clip_distance.cpp \ @@ -105,12 +129,15 @@ LIBGLSL_FILES = \ $(GLSL_SRCDIR)/opt_swizzle_swizzle.cpp \ $(GLSL_SRCDIR)/opt_tree_grafting.cpp \ $(GLSL_SRCDIR)/opt_vectorize.cpp \ - $(GLSL_SRCDIR)/s_expression.cpp + $(GLSL_SRCDIR)/program.h \ + $(GLSL_SRCDIR)/s_expression.cpp \ + $(GLSL_SRCDIR)/s_expression.h # glsl_compiler GLSL_COMPILER_CXX_FILES = \ $(GLSL_SRCDIR)/standalone_scaffolding.cpp \ + $(GLSL_SRCDIR)/standalone_scaffolding.h \ $(GLSL_SRCDIR)/main.cpp # libglsl generated sources diff --git a/mesalib/src/glsl/ast_to_hir.cpp b/mesalib/src/glsl/ast_to_hir.cpp index fe1e1291e..811a9557d 100644 --- a/mesalib/src/glsl/ast_to_hir.cpp +++ b/mesalib/src/glsl/ast_to_hir.cpp @@ -5908,7 +5908,7 @@ ast_cs_input_layout::hir(exec_list *instructions, * declare it earlier). */ ir_variable *var = new(state->symbols) - ir_variable(glsl_type::ivec3_type, "gl_WorkGroupSize", ir_var_auto); + ir_variable(glsl_type::uvec3_type, "gl_WorkGroupSize", ir_var_auto); var->data.how_declared = ir_var_declared_implicitly; var->data.read_only = true; instructions->push_tail(var); @@ -5916,10 +5916,10 @@ ast_cs_input_layout::hir(exec_list *instructions, ir_constant_data data; memset(&data, 0, sizeof(data)); for (int i = 0; i < 3; i++) - data.i[i] = this->local_size[i]; - var->constant_value = new(var) ir_constant(glsl_type::ivec3_type, &data); + data.u[i] = this->local_size[i]; + var->constant_value = new(var) ir_constant(glsl_type::uvec3_type, &data); var->constant_initializer = - new(var) ir_constant(glsl_type::ivec3_type, &data); + new(var) ir_constant(glsl_type::uvec3_type, &data); var->data.has_initializer = true; return NULL; diff --git a/mesalib/src/glsl/builtin_variables.cpp b/mesalib/src/glsl/builtin_variables.cpp index c36d19831..65e32ad73 100644 --- a/mesalib/src/glsl/builtin_variables.cpp +++ b/mesalib/src/glsl/builtin_variables.cpp @@ -724,6 +724,10 @@ builtin_variable_generator::generate_constants() add_const("gl_MaxCombinedImageUniforms", state->Const.MaxCombinedImageUniforms); } + + if (state->is_version(410, 0) || + state->ARB_viewport_array_enable) + add_const("gl_MaxViewports", state->Const.MaxViewports); } diff --git a/mesalib/src/glsl/glcpp/glcpp-parse.y b/mesalib/src/glsl/glcpp/glcpp-parse.y index f1119eb80..9b1a4f401 100644 --- a/mesalib/src/glsl/glcpp/glcpp-parse.y +++ b/mesalib/src/glsl/glcpp/glcpp-parse.y @@ -290,9 +290,10 @@ control_line_success: macro_t *macro; if (strcmp("__LINE__", $4) == 0 || strcmp("__FILE__", $4) == 0 - || strcmp("__VERSION__", $4) == 0) + || strcmp("__VERSION__", $4) == 0 + || strncmp("GL_", $4, 3) == 0) glcpp_error(& @1, parser, "Built-in (pre-defined)" - " macro names can not be undefined."); + " macro names cannot be undefined."); macro = hash_table_find (parser->defines, $4); if (macro) { diff --git a/mesalib/src/glsl/glsl_parser.yy b/mesalib/src/glsl/glsl_parser.yy index 6160e265e..7fb8c38ab 100644 --- a/mesalib/src/glsl/glsl_parser.yy +++ b/mesalib/src/glsl/glsl_parser.yy @@ -331,7 +331,18 @@ pragma_statement: | PRAGMA_OPTIMIZE_OFF EOL | PRAGMA_INVARIANT_ALL EOL { - if (!state->is_version(120, 100)) { + /* Pragma invariant(all) cannot be used in a fragment shader. + * + * Page 27 of the GLSL 1.20 spec, Page 53 of the GLSL ES 3.00 spec: + * + * "It is an error to use this pragma in a fragment shader." + */ + if (state->is_version(120, 300) && + state->stage == MESA_SHADER_FRAGMENT) { + _mesa_glsl_error(& @1, state, + "pragma `invariant(all)' cannot be used " + "in a fragment shader."); + } else if (!state->is_version(120, 100)) { _mesa_glsl_warning(& @1, state, "pragma `invariant(all)' not supported in %s " "(GLSL ES 1.00 or GLSL 1.20 required)", @@ -1591,6 +1602,17 @@ type_qualifier: $$ = $2; $$.flags.q.invariant = 1; + + /* GLSL ES 3.00 spec, section 4.6.1 "The Invariant Qualifier": + * + * "Only variables output from a shader can be candidates for invariance. + * This includes user-defined output variables and the built-in output + * variables. As only outputs can be declared as invariant, an invariant + * output from one shader stage will still match an input of a subsequent + * stage without the input being declared as invariant." + */ + if (state->es_shader && state->language_version >= 300 && $$.flags.q.in) + _mesa_glsl_error(&@1, state, "invariant qualifiers cannot be used with shader inputs"); } | interpolation_qualifier type_qualifier { diff --git a/mesalib/src/glsl/glsl_parser_extras.cpp b/mesalib/src/glsl/glsl_parser_extras.cpp index 27e3301e2..27e2eaf37 100644 --- a/mesalib/src/glsl/glsl_parser_extras.cpp +++ b/mesalib/src/glsl/glsl_parser_extras.cpp @@ -25,12 +25,10 @@ #include <string.h> #include <assert.h> -extern "C" { #include "main/core.h" /* for struct gl_context */ #include "main/context.h" #include "main/shaderobj.h" -} - +#include "util/u_atomic.h" /* for p_atomic_cmpxchg */ #include "util/ralloc.h" #include "ast.h" #include "glsl_parser_extras.h" @@ -50,7 +48,7 @@ glsl_compute_version_string(void *mem_ctx, bool is_es, unsigned version) static const unsigned known_desktop_glsl_versions[] = - { 110, 120, 130, 140, 150, 330, 400, 410, 420, 430, 440 }; + { 110, 120, 130, 140, 150, 330, 400, 410, 420, 430, 440, 450 }; _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *_ctx, @@ -134,6 +132,9 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *_ctx, this->Const.MaxFragmentImageUniforms = ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxImageUniforms; this->Const.MaxCombinedImageUniforms = ctx->Const.MaxCombinedImageUniforms; + /* ARB_viewport_array */ + this->Const.MaxViewports = ctx->Const.MaxViewports; + this->current_function = NULL; this->toplevel_ir = NULL; this->found_return = false; @@ -141,6 +142,12 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *_ctx, this->user_structures = NULL; this->num_user_structures = 0; + /* supported_versions should be large enough to support the known desktop + * GLSL versions plus 2 GLES versions (ES2 & ES3) + */ + STATIC_ASSERT((ARRAY_SIZE(known_desktop_glsl_versions) + 2) == + ARRAY_SIZE(this->supported_versions)); + /* Populate the list of supported GLSL versions */ /* FINISHME: Once the OpenGL 3.0 'forward compatible' context or * the OpenGL 3.2 Core context is supported, this logic will need @@ -168,8 +175,6 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *_ctx, this->supported_versions[this->num_supported_versions].es = true; this->num_supported_versions++; } - assert(this->num_supported_versions - <= ARRAY_SIZE(this->supported_versions)); /* Create a string for use in error messages to tell the user which GLSL * versions are supported. @@ -1447,7 +1452,8 @@ _mesa_glsl_compile_shader(struct gl_context *ctx, struct gl_shader *shader, const char *source = shader->Source; if (ctx->Const.GenerateTemporaryNames) - ir_variable::temporaries_allocate_names = true; + (void) p_atomic_cmpxchg(&ir_variable::temporaries_allocate_names, + false, true); state->error = glcpp_preprocess(state, &source, &state->info_log, &ctx->Extensions, ctx); diff --git a/mesalib/src/glsl/glsl_parser_extras.h b/mesalib/src/glsl/glsl_parser_extras.h index c14d74c98..e04f7ced5 100644 --- a/mesalib/src/glsl/glsl_parser_extras.h +++ b/mesalib/src/glsl/glsl_parser_extras.h @@ -217,7 +217,7 @@ struct _mesa_glsl_parse_state { struct { unsigned ver; bool es; - } supported_versions[12]; + } supported_versions[14]; bool es_shader; unsigned language_version; @@ -343,6 +343,9 @@ struct _mesa_glsl_parse_state { unsigned MaxGeometryImageUniforms; unsigned MaxFragmentImageUniforms; unsigned MaxCombinedImageUniforms; + + /* ARB_viewport_array */ + unsigned MaxViewports; } Const; /** diff --git a/mesalib/src/glsl/glsl_types.cpp b/mesalib/src/glsl/glsl_types.cpp index 5f9919348..0d2eb7cec 100644 --- a/mesalib/src/glsl/glsl_types.cpp +++ b/mesalib/src/glsl/glsl_types.cpp @@ -25,9 +25,8 @@ #include "main/core.h" /* for Elements, MAX2 */ #include "glsl_parser_extras.h" #include "glsl_types.h" -extern "C" { #include "program/hash_table.h" -} + mtx_t glsl_type::mutex = _MTX_INITIALIZER_NP; hash_table *glsl_type::array_types = NULL; diff --git a/mesalib/src/glsl/ir_variable_refcount.cpp b/mesalib/src/glsl/ir_variable_refcount.cpp index f67fe6784..e4d825c45 100644 --- a/mesalib/src/glsl/ir_variable_refcount.cpp +++ b/mesalib/src/glsl/ir_variable_refcount.cpp @@ -38,7 +38,8 @@ ir_variable_refcount_visitor::ir_variable_refcount_visitor() { this->mem_ctx = ralloc_context(NULL); - this->ht = _mesa_hash_table_create(NULL, _mesa_key_pointer_equal); + this->ht = _mesa_hash_table_create(NULL, _mesa_hash_pointer, + _mesa_key_pointer_equal); } static void @@ -70,15 +71,13 @@ ir_variable_refcount_visitor::get_variable_entry(ir_variable *var) { assert(var); - struct hash_entry *e = _mesa_hash_table_search(this->ht, - _mesa_hash_pointer(var), - var); + struct hash_entry *e = _mesa_hash_table_search(this->ht, var); if (e) return (ir_variable_refcount_entry *)e->data; ir_variable_refcount_entry *entry = new ir_variable_refcount_entry(var); assert(entry->referenced_count == 0); - _mesa_hash_table_insert(this->ht, _mesa_hash_pointer(var), var, entry); + _mesa_hash_table_insert(this->ht, var, entry); return entry; } diff --git a/mesalib/src/glsl/link_uniform_block_active_visitor.cpp b/mesalib/src/glsl/link_uniform_block_active_visitor.cpp index 9da6a4bba..292cde343 100644 --- a/mesalib/src/glsl/link_uniform_block_active_visitor.cpp +++ b/mesalib/src/glsl/link_uniform_block_active_visitor.cpp @@ -27,9 +27,8 @@ link_uniform_block_active * process_block(void *mem_ctx, struct hash_table *ht, ir_variable *var) { - const uint32_t h = _mesa_hash_string(var->get_interface_type()->name); const hash_entry *const existing_block = - _mesa_hash_table_search(ht, h, var->get_interface_type()->name); + _mesa_hash_table_search(ht, var->get_interface_type()->name); const glsl_type *const block_type = var->is_interface_instance() ? var->type : var->get_interface_type(); @@ -54,8 +53,7 @@ process_block(void *mem_ctx, struct hash_table *ht, ir_variable *var) b->binding = 0; } - _mesa_hash_table_insert(ht, h, var->get_interface_type()->name, - (void *) b); + _mesa_hash_table_insert(ht, var->get_interface_type()->name, (void *) b); return b; } else { link_uniform_block_active *const b = diff --git a/mesalib/src/glsl/link_uniform_blocks.cpp b/mesalib/src/glsl/link_uniform_blocks.cpp index 536fcd458..f5fc5022e 100644 --- a/mesalib/src/glsl/link_uniform_blocks.cpp +++ b/mesalib/src/glsl/link_uniform_blocks.cpp @@ -182,7 +182,8 @@ link_uniform_blocks(void *mem_ctx, * the hash is organized by block-name. */ struct hash_table *block_hash = - _mesa_hash_table_create(mem_ctx, _mesa_key_string_equal); + _mesa_hash_table_create(mem_ctx, _mesa_key_hash_string, + _mesa_key_string_equal); if (block_hash == NULL) { _mesa_error_no_memory(__func__); diff --git a/mesalib/src/glsl/link_varyings.cpp b/mesalib/src/glsl/link_varyings.cpp index 1866ab265..22617990f 100644 --- a/mesalib/src/glsl/link_varyings.cpp +++ b/mesalib/src/glsl/link_varyings.cpp @@ -116,7 +116,7 @@ cross_validate_types_and_qualifiers(struct gl_shader_program *prog, return; } - if (input->data.invariant != output->data.invariant) { + if (!prog->IsES && input->data.invariant != output->data.invariant) { linker_error(prog, "%s shader output `%s' %s invariant qualifier, " "but %s shader input %s invariant qualifier\n", @@ -835,9 +835,11 @@ varying_matches::record(ir_variable *producer_var, ir_variable *consumer_var) * regardless of where they appear. We can trivially satisfy that * requirement by changing the interpolation type to flat here. */ - producer_var->data.centroid = false; - producer_var->data.sample = false; - producer_var->data.interpolation = INTERP_QUALIFIER_FLAT; + if (producer_var) { + producer_var->data.centroid = false; + producer_var->data.sample = false; + producer_var->data.interpolation = INTERP_QUALIFIER_FLAT; + } if (consumer_var) { consumer_var->data.centroid = false; diff --git a/mesalib/src/glsl/linker.cpp b/mesalib/src/glsl/linker.cpp index de6b1fb9f..3f5eac1e2 100644 --- a/mesalib/src/glsl/linker.cpp +++ b/mesalib/src/glsl/linker.cpp @@ -76,10 +76,9 @@ #include "ir_rvalue_visitor.h" #include "ir_uniform.h" -extern "C" { #include "main/shaderobj.h" #include "main/enums.h" -} + void linker_error(gl_shader_program *, const char *, ...); @@ -732,8 +731,27 @@ cross_validate_globals(struct gl_shader_program *prog, && ((var->type->length == 0) || (existing->type->length == 0))) { if (var->type->length != 0) { + if (var->type->length <= existing->data.max_array_access) { + linker_error(prog, "%s `%s' declared as type " + "`%s' but outermost dimension has an index" + " of `%i'\n", + mode_string(var), + var->name, var->type->name, + existing->data.max_array_access); + return; + } existing->type = var->type; - } + } else if (existing->type->length != 0 + && existing->type->length <= + var->data.max_array_access) { + linker_error(prog, "%s `%s' declared as type " + "`%s' but outermost dimension has an index" + " of `%i'\n", + mode_string(var), + var->name, existing->type->name, + var->data.max_array_access); + return; + } } else if (var->type->is_record() && existing->type->is_record() && existing->type->record_compare(var->type)) { @@ -2746,6 +2764,21 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog) if (last >= 0 && last < MESA_SHADER_FRAGMENT) { gl_shader *const sh = prog->_LinkedShaders[last]; + if (first == MESA_SHADER_GEOMETRY) { + /* There was no vertex shader, but we still have to assign varying + * locations for use by geometry shader inputs in SSO. + * + * If the shader is not separable (i.e., prog->SeparateShader is + * false), linking will have already failed when first is + * MESA_SHADER_GEOMETRY. + */ + if (!assign_varying_locations(ctx, mem_ctx, prog, + NULL, sh, + num_tfeedback_decls, tfeedback_decls, + prog->Geom.VerticesIn)) + goto done; + } + if (num_tfeedback_decls != 0 || prog->SeparateShader) { /* There was no fragment shader, but we still have to assign varying * locations for use by transform feedback. diff --git a/mesalib/src/glsl/main.cpp b/mesalib/src/glsl/main.cpp index 91e457ada..ccac83996 100644 --- a/mesalib/src/glsl/main.cpp +++ b/mesalib/src/glsl/main.cpp @@ -182,8 +182,6 @@ initialize_context(struct gl_context *ctx, gl_api api) ctx->Const.MaxGeometryOutputVertices = 256; ctx->Const.MaxGeometryTotalOutputComponents = 1024; -// ctx->Const.MaxGeometryVaryingComponents = 64; - ctx->Const.MaxVarying = 60 / 4; break; case 300: diff --git a/mesalib/src/glsl/opt_algebraic.cpp b/mesalib/src/glsl/opt_algebraic.cpp index 430f5cb97..c6f4a9c78 100644 --- a/mesalib/src/glsl/opt_algebraic.cpp +++ b/mesalib/src/glsl/opt_algebraic.cpp @@ -584,6 +584,16 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir) } break; + case ir_binop_all_equal: + case ir_binop_any_nequal: + if (ir->operands[0]->type->is_scalar() && + ir->operands[1]->type->is_scalar()) + return new(mem_ctx) ir_expression(ir->operation == ir_binop_all_equal + ? ir_binop_equal : ir_binop_nequal, + ir->operands[0], + ir->operands[1]); + break; + case ir_binop_rshift: case ir_binop_lshift: /* 0 >> x == 0 */ @@ -679,7 +689,7 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir) case ir_binop_min: case ir_binop_max: - if (ir->type->base_type != GLSL_TYPE_FLOAT) + if (ir->type->base_type != GLSL_TYPE_FLOAT || options->EmitNoSat) break; /* Replace min(max) operations and its commutative combinations with diff --git a/mesalib/src/hgl/GLRendererRoster.cpp b/mesalib/src/hgl/GLRendererRoster.cpp index d29f7ecc8..9e5d847a1 100644 --- a/mesalib/src/hgl/GLRendererRoster.cpp +++ b/mesalib/src/hgl/GLRendererRoster.cpp @@ -144,7 +144,7 @@ GLRendererRoster::AddPath(const char* path) entry_ref ref; BEntry entry; while (directory.GetNextRef(&ref) == B_OK) { - entry.SetTo(&ref); + entry.SetTo(&ref, true); if (entry.InitCheck() == B_OK && !entry.IsFile()) continue; @@ -187,7 +187,7 @@ GLRendererRoster::AddRenderer(BGLRenderer* renderer, status_t GLRendererRoster::CreateRenderer(const entry_ref& ref) { - BEntry entry(&ref); + BEntry entry(&ref, true); node_ref nodeRef; status_t status = entry.GetNodeRef(&nodeRef); if (status < B_OK) diff --git a/mesalib/src/loader/Makefile.am b/mesalib/src/loader/Makefile.am index 16b9f8f70..c59663681 100644 --- a/mesalib/src/loader/Makefile.am +++ b/mesalib/src/loader/Makefile.am @@ -21,6 +21,8 @@ include Makefile.sources +EXTRA_DIST = SConscript + noinst_LTLIBRARIES = libloader.la libloader_la_CPPFLAGS = \ @@ -40,7 +42,8 @@ libloader_la_CPPFLAGS += \ -I$(top_builddir)/src/mesa/drivers/dri/common/ \ -I$(top_srcdir)/src/mesa/ \ -I$(top_srcdir)/src/mapi/ \ - -DUSE_DRICONF + -DUSE_DRICONF \ + $(EXPAT_CFLAGS) libloader_la_SOURCES += \ $(top_srcdir)/src/mesa/drivers/dri/common/xmlconfig.c diff --git a/mesalib/src/loader/Makefile.sources b/mesalib/src/loader/Makefile.sources index 1a1345fcd..b61ef1cd9 100644 --- a/mesalib/src/loader/Makefile.sources +++ b/mesalib/src/loader/Makefile.sources @@ -1,3 +1,5 @@ LOADER_C_FILES := \ loader.c \ - pci_id_driver_map.c + loader.h \ + pci_id_driver_map.c \ + pci_id_driver_map.h diff --git a/mesalib/src/mapi/.gitignore b/mesalib/src/mapi/.gitignore new file mode 100644 index 000000000..0d280c9b6 --- /dev/null +++ b/mesalib/src/mapi/.gitignore @@ -0,0 +1,2 @@ +shared-glapi-test +glapi-test diff --git a/mesalib/src/mapi/Makefile.am b/mesalib/src/mapi/Makefile.am index 80ead821c..024283c55 100644 --- a/mesalib/src/mapi/Makefile.am +++ b/mesalib/src/mapi/Makefile.am @@ -19,7 +19,7 @@ # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS # IN THE SOFTWARE. -SUBDIRS = glapi/gen . +SUBDIRS = TESTS = TOP = $(top_srcdir) @@ -32,6 +32,13 @@ check_PROGRAMS = pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = +EXTRA_DIST = \ + es1api/ABI-check \ + es2api/ABI-check \ + mapi_abi.py \ + glapi/SConscript \ + shared-glapi/SConscript + AM_CFLAGS = $(PTHREAD_CFLAGS) AM_CPPFLAGS = \ $(DEFINES) \ @@ -62,9 +69,6 @@ shared_glapi_libglapi_la_LDFLAGS = \ $(GC_SECTIONS) \ $(LD_NO_UNDEFINED) -shared-glapi/glapi_mapi_tmp.h : $(GLAPI)/gen/gl_and_es_API.xml $(glapi_gen_mapi_deps) - $(call glapi_gen_mapi,$<,shared-glapi) - TESTS += shared-glapi-test check_PROGRAMS += shared-glapi-test @@ -77,6 +81,9 @@ shared_glapi_test_LDADD = \ $(top_builddir)/src/gtest/libgtest.la endif +shared-glapi/glapi_mapi_tmp.h : $(GLAPI)/gen/gl_and_es_API.xml $(glapi_gen_mapi_deps) + $(call glapi_gen_mapi,$<,shared-glapi) + if HAVE_OPENGL noinst_LTLIBRARIES = glapi/libglapi.la @@ -158,10 +165,10 @@ es1api_libGLESv1_CM_la_LDFLAGS = \ if HAVE_SHARED_GLAPI es1api_libGLESv1_CM_la_LIBADD += shared-glapi/libglapi.la endif +endif es1api/glapi_mapi_tmp.h: glapi/gen/gl_and_es_API.xml $(glapi_gen_mapi_deps) $(call glapi_gen_mapi,$<,es1api) -endif if HAVE_OPENGL_ES2 TESTS += es2api/ABI-check @@ -202,10 +209,10 @@ es2api_libGLESv2_la_LDFLAGS = \ if HAVE_SHARED_GLAPI es2api_libGLESv2_la_LIBADD += shared-glapi/libglapi.la endif +endif es2api/glapi_mapi_tmp.h: glapi/gen/gl_and_es_API.xml $(glapi_gen_mapi_deps) $(call glapi_gen_mapi,$<,es2api) -endif if HAVE_OPENVG SUBDIRS += vgapi diff --git a/mesalib/src/mapi/glapi/gen/Makefile.am b/mesalib/src/mapi/glapi/gen/Makefile.am index 7f76f1971..e56b46e3d 100644 --- a/mesalib/src/mapi/glapi/gen/Makefile.am +++ b/mesalib/src/mapi/glapi/gen/Makefile.am @@ -75,6 +75,7 @@ EXTRA_DIST= \ glX_proto_size.py \ glX_server_table.py \ remap_helper.py \ + SConscript \ gl_API.dtd ###################################################################### @@ -106,6 +107,7 @@ API_XML = \ gl_API.xml \ es_EXT.xml \ gl_and_es_API.xml \ + gl_and_glX_API.xml \ ARB_base_instance.xml \ ARB_blend_func_extended.xml \ ARB_clear_buffer_object.xml \ @@ -176,6 +178,7 @@ API_XML = \ EXT_transform_feedback.xml \ INTEL_performance_query.xml \ KHR_debug.xml \ + KHR_context_flush_control.xml \ NV_conditional_render.xml \ NV_primitive_restart.xml \ NV_texture_barrier.xml \ diff --git a/mesalib/src/mesa/Makefile.am b/mesalib/src/mesa/Makefile.am index 932db4fb8..8d8082ae3 100644 --- a/mesalib/src/mesa/Makefile.am +++ b/mesalib/src/mesa/Makefile.am @@ -62,6 +62,23 @@ include $(GLAPI)/glapi_gen.mk BUILDDIR = $(builddir)/ include Makefile.sources +EXTRA_DIST = \ + drivers/haiku \ + drivers/SConscript \ + drivers/windows \ + main/format_info.py \ + main/format_parser.py \ + main/formats.csv \ + main/get_hash_generator.py \ + main/get_hash_params.py \ + program/program_lexer.l \ + program/program_parse.y \ + SConscript \ + swrast/NOTES \ + swrast_setup/NOTES \ + tnl/NOTES \ + tnl_dd + BUILT_SOURCES = \ main/get_hash.h \ main/format_info.c \ @@ -152,8 +169,10 @@ libmesagallium_la_LIBADD = \ libmesa_sse41_la_SOURCES = \ main/streaming-load-memcpy.c \ - main/sse_minmax.c -libmesa_sse41_la_CFLAGS = $(AM_CFLAGS) -msse4.1 + main/streaming-load-memcpy.h \ + main/sse_minmax.c \ + main/sse_minmax.h +libmesa_sse41_la_CFLAGS = $(AM_CFLAGS) $(SSE41_CFLAGS) pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = gl.pc diff --git a/mesalib/src/mesa/Makefile.sources b/mesalib/src/mesa/Makefile.sources index 475501877..7ac3bbc71 100644 --- a/mesalib/src/mesa/Makefile.sources +++ b/mesalib/src/mesa/Makefile.sources @@ -8,283 +8,526 @@ BUILDDIR = $(top_builddir)/src/mesa/ # this is part of MAIN_FILES MAIN_ES_FILES = \ - $(SRCDIR)main/es1_conversion.c + $(SRCDIR)main/es1_conversion.c \ + $(SRCDIR)main/es1_conversion.h MAIN_FILES = \ + $(SRCDIR)main/accum.c \ + $(SRCDIR)main/accum.h \ $(SRCDIR)main/api_arrayelt.c \ + $(SRCDIR)main/api_arrayelt.h \ $(BUILDDIR)main/api_exec.c \ + $(SRCDIR)main/api_exec.h \ $(SRCDIR)main/api_loopback.c \ + $(SRCDIR)main/api_loopback.h \ $(SRCDIR)main/api_validate.c \ - $(SRCDIR)main/accum.c \ + $(SRCDIR)main/api_validate.h \ $(SRCDIR)main/arbprogram.c \ + $(SRCDIR)main/arbprogram.h \ + $(SRCDIR)main/arrayobj.c \ + $(SRCDIR)main/arrayobj.h \ $(SRCDIR)main/atifragshader.c \ + $(SRCDIR)main/atifragshader.h \ $(SRCDIR)main/attrib.c \ - $(SRCDIR)main/arrayobj.c \ + $(SRCDIR)main/attrib.h \ + $(SRCDIR)main/bitset.h \ $(SRCDIR)main/blend.c \ + $(SRCDIR)main/blend.h \ $(SRCDIR)main/blit.c \ + $(SRCDIR)main/blit.h \ $(SRCDIR)main/bufferobj.c \ + $(SRCDIR)main/bufferobj.h \ $(SRCDIR)main/buffers.c \ + $(SRCDIR)main/buffers.h \ $(SRCDIR)main/clear.c \ + $(SRCDIR)main/clear.h \ $(SRCDIR)main/clip.c \ + $(SRCDIR)main/clip.h \ + $(SRCDIR)main/colormac.h \ $(SRCDIR)main/colortab.c \ + $(SRCDIR)main/colortab.h \ $(SRCDIR)main/compute.c \ + $(SRCDIR)main/compute.h \ + $(SRCDIR)main/compiler.h \ $(SRCDIR)main/condrender.c \ + $(SRCDIR)main/condrender.h \ + $(SRCDIR)main/config.h \ $(SRCDIR)main/context.c \ + $(SRCDIR)main/context.h \ $(SRCDIR)main/convolve.c \ + $(SRCDIR)main/convolve.h \ $(SRCDIR)main/copyimage.c \ + $(SRCDIR)main/copyimage.h \ + $(SRCDIR)main/core.h \ $(SRCDIR)main/cpuinfo.c \ + $(SRCDIR)main/cpuinfo.h \ + $(SRCDIR)main/dd.h \ $(SRCDIR)main/debug.c \ + $(SRCDIR)main/debug.h \ $(SRCDIR)main/depth.c \ + $(SRCDIR)main/depth.h \ $(SRCDIR)main/dlist.c \ + $(SRCDIR)main/dlist.h \ + $(SRCDIR)main/dlopen.h \ $(SRCDIR)main/drawpix.c \ + $(SRCDIR)main/drawpix.h \ $(SRCDIR)main/drawtex.c \ + $(SRCDIR)main/drawtex.h \ $(SRCDIR)main/enable.c \ + $(SRCDIR)main/enable.h \ + $(BUILDDIR)main/enums.c \ + $(SRCDIR)main/enums.h \ $(SRCDIR)main/errors.c \ + $(SRCDIR)main/errors.h \ $(SRCDIR)main/eval.c \ + $(SRCDIR)main/eval.h \ $(SRCDIR)main/execmem.c \ $(SRCDIR)main/extensions.c \ + $(SRCDIR)main/extensions.h \ $(SRCDIR)main/fbobject.c \ + $(SRCDIR)main/fbobject.h \ $(SRCDIR)main/feedback.c \ - $(SRCDIR)main/ffvertex_prog.c \ + $(SRCDIR)main/feedback.h \ $(SRCDIR)main/ff_fragment_shader.cpp \ + $(SRCDIR)main/ffvertex_prog.c \ + $(SRCDIR)main/ffvertex_prog.h \ $(SRCDIR)main/fog.c \ + $(SRCDIR)main/fog.h \ + $(SRCDIR)main/format_pack.c \ + $(SRCDIR)main/format_pack.h \ $(SRCDIR)main/formatquery.c \ + $(SRCDIR)main/formatquery.h \ $(SRCDIR)main/formats.c \ - $(SRCDIR)main/format_pack.c \ + $(SRCDIR)main/formats.h \ $(SRCDIR)main/format_unpack.c \ + $(SRCDIR)main/format_unpack.h \ $(SRCDIR)main/format_utils.c \ + $(SRCDIR)main/format_utils.h \ $(SRCDIR)main/framebuffer.c \ + $(SRCDIR)main/framebuffer.h \ $(SRCDIR)main/get.c \ + $(SRCDIR)main/get.h \ $(SRCDIR)main/genmipmap.c \ + $(SRCDIR)main/genmipmap.h \ $(SRCDIR)main/getstring.c \ $(SRCDIR)main/glformats.c \ + $(SRCDIR)main/glformats.h \ + $(SRCDIR)main/glheader.h \ $(SRCDIR)main/hash.c \ + $(SRCDIR)main/hash.h \ $(SRCDIR)main/hint.c \ + $(SRCDIR)main/hint.h \ $(SRCDIR)main/histogram.c \ + $(SRCDIR)main/histogram.h \ $(SRCDIR)main/image.c \ + $(SRCDIR)main/image.h \ $(SRCDIR)main/imports.c \ + $(SRCDIR)main/imports.h \ $(SRCDIR)main/light.c \ + $(SRCDIR)main/light.h \ $(SRCDIR)main/lines.c \ + $(SRCDIR)main/lines.h \ + $(SRCDIR)main/macros.h \ $(SRCDIR)main/matrix.c \ + $(SRCDIR)main/matrix.h \ $(SRCDIR)main/mipmap.c \ + $(SRCDIR)main/mipmap.h \ $(SRCDIR)main/mm.c \ + $(SRCDIR)main/mm.h \ + $(SRCDIR)main/mtypes.h \ $(SRCDIR)main/multisample.c \ - $(SRCDIR)main/objectlabel.c \ + $(SRCDIR)main/multisample.h \ + $(SRCDIR)main/objectlabel.c \ + $(SRCDIR)main/objectlabel.h \ $(SRCDIR)main/pack.c \ + $(SRCDIR)main/pack.h \ + $(SRCDIR)main/pack_tmp.h \ $(SRCDIR)main/pbo.c \ + $(SRCDIR)main/pbo.h \ $(SRCDIR)main/performance_monitor.c \ + $(SRCDIR)main/performance_monitor.h \ $(SRCDIR)main/pipelineobj.c \ + $(SRCDIR)main/pipelineobj.h \ $(SRCDIR)main/pixel.c \ + $(SRCDIR)main/pixel.h \ $(SRCDIR)main/pixelstore.c \ + $(SRCDIR)main/pixelstore.h \ $(SRCDIR)main/pixeltransfer.c \ + $(SRCDIR)main/pixeltransfer.h \ $(SRCDIR)main/points.c \ + $(SRCDIR)main/points.h \ $(SRCDIR)main/polygon.c \ - $(SRCDIR)main/queryobj.c \ + $(SRCDIR)main/polygon.h \ $(SRCDIR)main/querymatrix.c \ + $(SRCDIR)main/querymatrix.h \ + $(SRCDIR)main/queryobj.c \ + $(SRCDIR)main/queryobj.h \ $(SRCDIR)main/rastpos.c \ + $(SRCDIR)main/rastpos.h \ $(SRCDIR)main/readpix.c \ + $(SRCDIR)main/readpix.h \ $(SRCDIR)main/remap.c \ + $(SRCDIR)main/remap.h \ $(SRCDIR)main/renderbuffer.c \ + $(SRCDIR)main/renderbuffer.h \ $(SRCDIR)main/samplerobj.c \ + $(SRCDIR)main/samplerobj.h \ $(SRCDIR)main/scissor.c \ + $(SRCDIR)main/scissor.h \ $(SRCDIR)main/set.c \ + $(SRCDIR)main/set.h \ $(SRCDIR)main/shaderapi.c \ + $(SRCDIR)main/shaderapi.h \ $(SRCDIR)main/shaderimage.c \ + $(SRCDIR)main/shaderimage.h \ $(SRCDIR)main/shaderobj.c \ + $(SRCDIR)main/shaderobj.h \ $(SRCDIR)main/shader_query.cpp \ $(SRCDIR)main/shared.c \ + $(SRCDIR)main/shared.h \ + $(SRCDIR)main/simple_list.h \ $(SRCDIR)main/state.c \ + $(SRCDIR)main/state.h \ $(SRCDIR)main/stencil.c \ + $(SRCDIR)main/stencil.h \ $(SRCDIR)main/syncobj.c \ + $(SRCDIR)main/syncobj.h \ $(SRCDIR)main/texcompress.c \ $(SRCDIR)main/texcompress_bptc.c \ + $(SRCDIR)main/texcompress_bptc.h \ $(SRCDIR)main/texcompress_cpal.c \ + $(SRCDIR)main/texcompress_cpal.h \ + $(SRCDIR)main/texcompress_etc.c \ + $(SRCDIR)main/texcompress_etc.h \ + $(SRCDIR)main/texcompress_etc_tmp.h \ + $(SRCDIR)main/texcompress_fxt1.c \ + $(SRCDIR)main/texcompress_fxt1.h \ + $(SRCDIR)main/texcompress.h \ $(SRCDIR)main/texcompress_rgtc.c \ + $(SRCDIR)main/texcompress_rgtc.h \ $(SRCDIR)main/texcompress_s3tc.c \ - $(SRCDIR)main/texcompress_fxt1.c \ - $(SRCDIR)main/texcompress_etc.c \ + $(SRCDIR)main/texcompress_s3tc.h \ $(SRCDIR)main/texenv.c \ + $(SRCDIR)main/texenv.h \ + $(SRCDIR)main/texenvprogram.h \ $(SRCDIR)main/texformat.c \ + $(SRCDIR)main/texformat.h \ $(SRCDIR)main/texgen.c \ + $(SRCDIR)main/texgen.h \ $(SRCDIR)main/texgetimage.c \ + $(SRCDIR)main/texgetimage.h \ $(SRCDIR)main/teximage.c \ + $(SRCDIR)main/teximage.h \ $(SRCDIR)main/texobj.c \ + $(SRCDIR)main/texobj.h \ $(SRCDIR)main/texparam.c \ + $(SRCDIR)main/texparam.h \ $(SRCDIR)main/texstate.c \ + $(SRCDIR)main/texstate.h \ $(SRCDIR)main/texstorage.c \ + $(SRCDIR)main/texstorage.h \ $(SRCDIR)main/texstore.c \ - $(SRCDIR)main/textureview.c \ + $(SRCDIR)main/texstore.h \ + $(SRCDIR)main/textureview.c \ + $(SRCDIR)main/textureview.h \ $(SRCDIR)main/texturebarrier.c \ + $(SRCDIR)main/texturebarrier.h \ $(SRCDIR)main/transformfeedback.c \ - $(SRCDIR)main/uniforms.c \ + $(SRCDIR)main/transformfeedback.h \ $(SRCDIR)main/uniform_query.cpp \ + $(SRCDIR)main/uniforms.c \ + $(SRCDIR)main/uniforms.h \ $(SRCDIR)main/varray.c \ + $(SRCDIR)main/varray.h \ $(SRCDIR)main/vdpau.c \ + $(SRCDIR)main/vdpau.h \ $(SRCDIR)main/version.c \ + $(SRCDIR)main/version.h \ $(SRCDIR)main/viewport.c \ + $(SRCDIR)main/viewport.h \ $(SRCDIR)main/vtxfmt.c \ - $(BUILDDIR)main/enums.c \ + $(SRCDIR)main/vtxfmt.h \ $(MAIN_ES_FILES) MATH_FILES = \ + $(SRCDIR)math/m_debug.h \ $(SRCDIR)math/m_debug_clip.c \ $(SRCDIR)math/m_debug_norm.c \ + $(SRCDIR)math/m_debug_util.h \ $(SRCDIR)math/m_debug_xform.c \ $(SRCDIR)math/m_eval.c \ + $(SRCDIR)math/m_eval.h \ $(SRCDIR)math/m_matrix.c \ + $(SRCDIR)math/m_matrix.h \ + $(SRCDIR)math/m_trans_tmp.h \ $(SRCDIR)math/m_translate.c \ - $(SRCDIR)math/m_vector.c + $(SRCDIR)math/m_translate.h \ + $(SRCDIR)math/m_vector.c \ + $(SRCDIR)math/m_vector.h MATH_XFORM_FILES = \ - $(SRCDIR)math/m_xform.c + $(SRCDIR)math/m_clip_tmp.h \ + $(SRCDIR)math/m_copy_tmp.h \ + $(SRCDIR)math/m_dotprod_tmp.h \ + $(SRCDIR)math/m_norm_tmp.h \ + $(SRCDIR)math/m_xform.c \ + $(SRCDIR)math/m_xform.h \ + $(SRCDIR)math/m_xform_tmp.h SWRAST_FILES = \ $(SRCDIR)swrast/s_aaline.c \ + $(SRCDIR)swrast/s_aaline.h \ + $(SRCDIR)swrast/s_aalinetemp.h \ $(SRCDIR)swrast/s_aatriangle.c \ + $(SRCDIR)swrast/s_aatriangle.h \ + $(SRCDIR)swrast/s_aatritemp.h \ $(SRCDIR)swrast/s_alpha.c \ + $(SRCDIR)swrast/s_alpha.h \ $(SRCDIR)swrast/s_atifragshader.c \ + $(SRCDIR)swrast/s_atifragshader.h \ $(SRCDIR)swrast/s_bitmap.c \ $(SRCDIR)swrast/s_blend.c \ + $(SRCDIR)swrast/s_blend.h \ $(SRCDIR)swrast/s_blit.c \ + $(SRCDIR)swrast/s_chan.h \ $(SRCDIR)swrast/s_clear.c \ - $(SRCDIR)swrast/s_copypix.c \ $(SRCDIR)swrast/s_context.c \ + $(SRCDIR)swrast/s_context.h \ + $(SRCDIR)swrast/s_copypix.c \ $(SRCDIR)swrast/s_depth.c \ + $(SRCDIR)swrast/s_depth.h \ $(SRCDIR)swrast/s_drawpix.c \ + $(SRCDIR)swrast_setup/ss_tritmp.h \ + $(SRCDIR)swrast_setup/ss_vb.h \ + $(SRCDIR)swrast_setup/swrast_setup.h \ $(SRCDIR)swrast/s_feedback.c \ + $(SRCDIR)swrast/s_feedback.h \ $(SRCDIR)swrast/s_fog.c \ + $(SRCDIR)swrast/s_fog.h \ $(SRCDIR)swrast/s_fragprog.c \ + $(SRCDIR)swrast/s_fragprog.h \ $(SRCDIR)swrast/s_lines.c \ + $(SRCDIR)swrast/s_lines.h \ + $(SRCDIR)swrast/s_linetemp.h \ $(SRCDIR)swrast/s_logic.c \ + $(SRCDIR)swrast/s_logic.h \ $(SRCDIR)swrast/s_masking.c \ + $(SRCDIR)swrast/s_masking.h \ $(SRCDIR)swrast/s_points.c \ + $(SRCDIR)swrast/s_points.h \ $(SRCDIR)swrast/s_renderbuffer.c \ + $(SRCDIR)swrast/s_renderbuffer.h \ $(SRCDIR)swrast/s_span.c \ + $(SRCDIR)swrast/s_span.h \ $(SRCDIR)swrast/s_stencil.c \ + $(SRCDIR)swrast/s_stencil.h \ $(SRCDIR)swrast/s_texcombine.c \ + $(SRCDIR)swrast/s_texcombine.h \ $(SRCDIR)swrast/s_texfetch.c \ + $(SRCDIR)swrast/s_texfetch.h \ + $(SRCDIR)swrast/s_texfetch_tmp.h \ $(SRCDIR)swrast/s_texfilter.c \ + $(SRCDIR)swrast/s_texfilter.h \ $(SRCDIR)swrast/s_texrender.c \ $(SRCDIR)swrast/s_texture.c \ $(SRCDIR)swrast/s_triangle.c \ - $(SRCDIR)swrast/s_zoom.c + $(SRCDIR)swrast/s_triangle.h \ + $(SRCDIR)swrast/s_tritemp.h \ + $(SRCDIR)swrast/swrast.h \ + $(SRCDIR)swrast/s_zoom.c \ + $(SRCDIR)swrast/s_zoom.h SWRAST_SETUP_FILES = \ $(SRCDIR)swrast_setup/ss_context.c \ - $(SRCDIR)swrast_setup/ss_triangle.c + $(SRCDIR)swrast_setup/ss_context.h \ + $(SRCDIR)swrast_setup/ss_triangle.c \ + $(SRCDIR)swrast_setup/ss_triangle.h TNL_FILES = \ $(SRCDIR)tnl/t_context.c \ - $(SRCDIR)tnl/t_pipeline.c \ + $(SRCDIR)tnl/t_context.h \ $(SRCDIR)tnl/t_draw.c \ + $(SRCDIR)tnl/tnl.h \ + $(SRCDIR)tnl/t_pipeline.c \ + $(SRCDIR)tnl/t_pipeline.h \ $(SRCDIR)tnl/t_rasterpos.c \ + $(SRCDIR)tnl/t_vb_cliptmp.h \ + $(SRCDIR)tnl/t_vb_fog.c \ + $(SRCDIR)tnl/t_vb_light.c \ + $(SRCDIR)tnl/t_vb_lighttmp.h \ + $(SRCDIR)tnl/t_vb_normals.c \ + $(SRCDIR)tnl/t_vb_points.c \ $(SRCDIR)tnl/t_vb_program.c \ $(SRCDIR)tnl/t_vb_render.c \ + $(SRCDIR)tnl/t_vb_rendertmp.h \ $(SRCDIR)tnl/t_vb_texgen.c \ $(SRCDIR)tnl/t_vb_texmat.c \ $(SRCDIR)tnl/t_vb_vertex.c \ - $(SRCDIR)tnl/t_vb_fog.c \ - $(SRCDIR)tnl/t_vb_light.c \ - $(SRCDIR)tnl/t_vb_normals.c \ - $(SRCDIR)tnl/t_vb_points.c \ - $(SRCDIR)tnl/t_vp_build.c \ $(SRCDIR)tnl/t_vertex.c \ + $(SRCDIR)tnl/t_vertex_generic.c \ + $(SRCDIR)tnl/t_vertex.h \ $(SRCDIR)tnl/t_vertex_sse.c \ - $(SRCDIR)tnl/t_vertex_generic.c + $(SRCDIR)tnl/t_vp_build.c \ + $(SRCDIR)tnl/t_vp_build.h VBO_FILES = \ + $(SRCDIR)vbo/vbo_attrib.h \ + $(SRCDIR)vbo/vbo_attrib_tmp.h \ $(SRCDIR)vbo/vbo_context.c \ - $(SRCDIR)vbo/vbo_exec.c \ + $(SRCDIR)vbo/vbo_context.h \ $(SRCDIR)vbo/vbo_exec_api.c \ $(SRCDIR)vbo/vbo_exec_array.c \ + $(SRCDIR)vbo/vbo_exec.c \ $(SRCDIR)vbo/vbo_exec_draw.c \ $(SRCDIR)vbo/vbo_exec_eval.c \ + $(SRCDIR)vbo/vbo_exec.h \ + $(SRCDIR)vbo/vbo.h \ $(SRCDIR)vbo/vbo_noop.c \ + $(SRCDIR)vbo/vbo_noop.h \ $(SRCDIR)vbo/vbo_primitive_restart.c \ $(SRCDIR)vbo/vbo_rebase.c \ - $(SRCDIR)vbo/vbo_split.c \ - $(SRCDIR)vbo/vbo_split_copy.c \ - $(SRCDIR)vbo/vbo_split_inplace.c \ - $(SRCDIR)vbo/vbo_save.c \ $(SRCDIR)vbo/vbo_save_api.c \ + $(SRCDIR)vbo/vbo_save.c \ $(SRCDIR)vbo/vbo_save_draw.c \ - $(SRCDIR)vbo/vbo_save_loopback.c + $(SRCDIR)vbo/vbo_save.h \ + $(SRCDIR)vbo/vbo_save_loopback.c \ + $(SRCDIR)vbo/vbo_split.c \ + $(SRCDIR)vbo/vbo_split_copy.c \ + $(SRCDIR)vbo/vbo_split.h \ + $(SRCDIR)vbo/vbo_split_inplace.c STATETRACKER_FILES = \ - $(SRCDIR)state_tracker/st_atom.c \ $(SRCDIR)state_tracker/st_atom_array.c \ $(SRCDIR)state_tracker/st_atom_blend.c \ + $(SRCDIR)state_tracker/st_atom.c \ $(SRCDIR)state_tracker/st_atom_clip.c \ $(SRCDIR)state_tracker/st_atom_constbuf.c \ + $(SRCDIR)state_tracker/st_atom_constbuf.h \ $(SRCDIR)state_tracker/st_atom_depth.c \ $(SRCDIR)state_tracker/st_atom_framebuffer.c \ + $(SRCDIR)state_tracker/st_atom.h \ $(SRCDIR)state_tracker/st_atom_msaa.c \ $(SRCDIR)state_tracker/st_atom_pixeltransfer.c \ + $(SRCDIR)state_tracker/st_atom_rasterizer.c \ $(SRCDIR)state_tracker/st_atom_sampler.c \ $(SRCDIR)state_tracker/st_atom_scissor.c \ $(SRCDIR)state_tracker/st_atom_shader.c \ - $(SRCDIR)state_tracker/st_atom_rasterizer.c \ + $(SRCDIR)state_tracker/st_atom_shader.h \ $(SRCDIR)state_tracker/st_atom_stipple.c \ $(SRCDIR)state_tracker/st_atom_texture.c \ $(SRCDIR)state_tracker/st_atom_viewport.c \ + $(SRCDIR)state_tracker/st_cache.h \ $(SRCDIR)state_tracker/st_cb_bitmap.c \ + $(SRCDIR)state_tracker/st_cb_bitmap.h \ $(SRCDIR)state_tracker/st_cb_blit.c \ + $(SRCDIR)state_tracker/st_cb_blit.h \ $(SRCDIR)state_tracker/st_cb_bufferobjects.c \ + $(SRCDIR)state_tracker/st_cb_bufferobjects.h \ $(SRCDIR)state_tracker/st_cb_clear.c \ + $(SRCDIR)state_tracker/st_cb_clear.h \ $(SRCDIR)state_tracker/st_cb_condrender.c \ - $(SRCDIR)state_tracker/st_cb_flush.c \ + $(SRCDIR)state_tracker/st_cb_condrender.h \ $(SRCDIR)state_tracker/st_cb_drawpixels.c \ + $(SRCDIR)state_tracker/st_cb_drawpixels.h \ $(SRCDIR)state_tracker/st_cb_drawtex.c \ + $(SRCDIR)state_tracker/st_cb_drawtex.h \ $(SRCDIR)state_tracker/st_cb_eglimage.c \ + $(SRCDIR)state_tracker/st_cb_eglimage.h \ $(SRCDIR)state_tracker/st_cb_fbo.c \ + $(SRCDIR)state_tracker/st_cb_fbo.h \ $(SRCDIR)state_tracker/st_cb_feedback.c \ + $(SRCDIR)state_tracker/st_cb_feedback.h \ + $(SRCDIR)state_tracker/st_cb_flush.c \ + $(SRCDIR)state_tracker/st_cb_flush.h \ $(SRCDIR)state_tracker/st_cb_msaa.c \ + $(SRCDIR)state_tracker/st_cb_msaa.h \ $(SRCDIR)state_tracker/st_cb_program.c \ + $(SRCDIR)state_tracker/st_cb_program.h \ $(SRCDIR)state_tracker/st_cb_queryobj.c \ + $(SRCDIR)state_tracker/st_cb_queryobj.h \ $(SRCDIR)state_tracker/st_cb_rasterpos.c \ + $(SRCDIR)state_tracker/st_cb_rasterpos.h \ $(SRCDIR)state_tracker/st_cb_readpixels.c \ - $(SRCDIR)state_tracker/st_cb_syncobj.c \ + $(SRCDIR)state_tracker/st_cb_readpixels.h \ $(SRCDIR)state_tracker/st_cb_strings.c \ - $(SRCDIR)state_tracker/st_cb_texture.c \ + $(SRCDIR)state_tracker/st_cb_strings.h \ + $(SRCDIR)state_tracker/st_cb_syncobj.c \ + $(SRCDIR)state_tracker/st_cb_syncobj.h \ $(SRCDIR)state_tracker/st_cb_texturebarrier.c \ + $(SRCDIR)state_tracker/st_cb_texturebarrier.h \ + $(SRCDIR)state_tracker/st_cb_texture.c \ + $(SRCDIR)state_tracker/st_cb_texture.h \ $(SRCDIR)state_tracker/st_cb_viewport.c \ + $(SRCDIR)state_tracker/st_cb_viewport.h \ $(SRCDIR)state_tracker/st_cb_xformfb.c \ + $(SRCDIR)state_tracker/st_cb_xformfb.h \ $(SRCDIR)state_tracker/st_context.c \ + $(SRCDIR)state_tracker/st_context.h \ $(SRCDIR)state_tracker/st_debug.c \ + $(SRCDIR)state_tracker/st_debug.h \ $(SRCDIR)state_tracker/st_draw.c \ $(SRCDIR)state_tracker/st_draw_feedback.c \ + $(SRCDIR)state_tracker/st_draw.h \ $(SRCDIR)state_tracker/st_extensions.c \ + $(SRCDIR)state_tracker/st_extensions.h \ $(SRCDIR)state_tracker/st_format.c \ + $(SRCDIR)state_tracker/st_format.h \ $(SRCDIR)state_tracker/st_gen_mipmap.c \ + $(SRCDIR)state_tracker/st_gen_mipmap.h \ + $(SRCDIR)state_tracker/st_gl_api.h \ $(SRCDIR)state_tracker/st_glsl_to_tgsi.cpp \ + $(SRCDIR)state_tracker/st_glsl_to_tgsi.h \ $(SRCDIR)state_tracker/st_manager.c \ + $(SRCDIR)state_tracker/st_manager.h \ $(SRCDIR)state_tracker/st_mesa_to_tgsi.c \ + $(SRCDIR)state_tracker/st_mesa_to_tgsi.h \ $(SRCDIR)state_tracker/st_program.c \ + $(SRCDIR)state_tracker/st_program.h \ $(SRCDIR)state_tracker/st_texture.c \ - $(SRCDIR)state_tracker/st_vdpau.c + $(SRCDIR)state_tracker/st_texture.h \ + $(SRCDIR)state_tracker/st_vdpau.c \ + $(SRCDIR)state_tracker/st_vdpau.h PROGRAM_FILES = \ $(SRCDIR)program/arbprogparse.c \ - $(SRCDIR)program/prog_hash_table.c \ + $(SRCDIR)program/arbprogparse.h \ + $(SRCDIR)program/hash_table.h \ $(SRCDIR)program/ir_to_mesa.cpp \ - $(SRCDIR)program/program.c \ - $(SRCDIR)program/program_parse_extra.c \ + $(SRCDIR)program/ir_to_mesa.h \ + $(BUILDDIR)program/lex.yy.c \ $(SRCDIR)program/prog_cache.c \ + $(SRCDIR)program/prog_cache.h \ $(SRCDIR)program/prog_execute.c \ + $(SRCDIR)program/prog_execute.h \ + $(SRCDIR)program/prog_hash_table.c \ $(SRCDIR)program/prog_instruction.c \ + $(SRCDIR)program/prog_instruction.h \ $(SRCDIR)program/prog_noise.c \ - $(SRCDIR)program/prog_optimize.c \ + $(SRCDIR)program/prog_noise.h \ $(SRCDIR)program/prog_opt_constant_fold.c \ + $(SRCDIR)program/prog_optimize.c \ + $(SRCDIR)program/prog_optimize.h \ $(SRCDIR)program/prog_parameter.c \ + $(SRCDIR)program/prog_parameter.h \ $(SRCDIR)program/prog_parameter_layout.c \ + $(SRCDIR)program/prog_parameter_layout.h \ $(SRCDIR)program/prog_print.c \ - $(SRCDIR)program/prog_statevars.c \ + $(SRCDIR)program/prog_print.h \ + $(SRCDIR)program/program.c \ + $(SRCDIR)program/program.h \ $(SRCDIR)program/programopt.c \ + $(SRCDIR)program/programopt.h \ + $(SRCDIR)program/program_parse_extra.c \ + $(BUILDDIR)program/program_parse.tab.c \ + $(BUILDDIR)program/program_parse.tab.h \ + $(SRCDIR)program/program_parser.h \ + $(SRCDIR)program/prog_statevars.c \ + $(SRCDIR)program/prog_statevars.h \ $(SRCDIR)program/sampler.cpp \ + $(SRCDIR)program/sampler.h \ $(SRCDIR)program/string_to_uint_map.cpp \ $(SRCDIR)program/symbol_table.c \ - $(BUILDDIR)program/lex.yy.c \ - $(BUILDDIR)program/program_parse.tab.c + $(SRCDIR)program/symbol_table.h ASM_C_FILES = \ $(SRCDIR)x86/common_x86.c \ @@ -292,21 +535,32 @@ ASM_C_FILES = \ $(SRCDIR)x86/3dnow.c \ $(SRCDIR)x86/sse.c \ $(SRCDIR)x86/rtasm/x86sse.c \ + $(SRCDIR)x86/rtasm/x86sse.h \ $(SRCDIR)sparc/sparc.c \ $(SRCDIR)x86-64/x86-64.c X86_FILES = \ + $(SRCDIR)x86/assyntax.h \ + $(SRCDIR)x86/clip_args.h \ + $(SRCDIR)x86/norm_args.h \ + $(SRCDIR)x86/xform_args.h \ $(SRCDIR)x86/common_x86_asm.S \ + $(SRCDIR)x86/common_x86_asm.h \ + $(SRCDIR)x86/common_x86_features.h \ + $(SRCDIR)x86/x86_xform.h \ $(SRCDIR)x86/x86_xform2.S \ $(SRCDIR)x86/x86_xform3.S \ $(SRCDIR)x86/x86_xform4.S \ $(SRCDIR)x86/x86_cliptest.S \ - $(SRCDIR)x86/mmx_blend.S \ + $(SRCDIR)x86/mmx.h \ + $(SRCDIR)x86/mmx_blend.S \ + $(SRCDIR)x86/mmx_blendtmp.h \ + $(SRCDIR)x86/3dnow.h \ $(SRCDIR)x86/3dnow_xform1.S \ $(SRCDIR)x86/3dnow_xform2.S \ $(SRCDIR)x86/3dnow_xform3.S \ $(SRCDIR)x86/3dnow_xform4.S \ - $(SRCDIR)x86/3dnow_normal.S \ + $(SRCDIR)x86/sse.h \ $(SRCDIR)x86/sse_xform1.S \ $(SRCDIR)x86/sse_xform2.S \ $(SRCDIR)x86/sse_xform3.S \ @@ -315,19 +569,24 @@ X86_FILES = \ $(SRCDIR)x86/read_rgba_span_x86.S X86_64_FILES = \ + $(SRCDIR)x86-64/x86-64.h \ $(SRCDIR)x86-64/xform4.S SPARC_FILES = \ + $(SRCDIR)sparc/sparc.h \ $(SRCDIR)sparc/sparc_clip.S \ + $(SRCDIR)sparc/sparc_matrix.h \ $(SRCDIR)sparc/norm.S \ $(SRCDIR)sparc/xform.S COMMON_DRIVER_FILES = \ $(SRCDIR)drivers/common/driverfuncs.c \ + $(SRCDIR)drivers/common/driverfuncs.h \ $(SRCDIR)drivers/common/meta_blit.c \ $(SRCDIR)drivers/common/meta_copy_image.c \ $(SRCDIR)drivers/common/meta_generate_mipmap.c \ - $(SRCDIR)drivers/common/meta.c + $(SRCDIR)drivers/common/meta.c \ + $(SRCDIR)drivers/common/meta.h # Sources for building non-Gallium drivers diff --git a/mesalib/src/mesa/drivers/dri/Makefile.am b/mesalib/src/mesa/drivers/dri/Makefile.am index 2009da921..fa1de103b 100644 --- a/mesalib/src/mesa/drivers/dri/Makefile.am +++ b/mesalib/src/mesa/drivers/dri/Makefile.am @@ -46,7 +46,8 @@ pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = dri.pc driincludedir = $(includedir)/GL/internal -driinclude_HEADERS = $(top_srcdir)/include/GL/internal/dri_interface.h +driinclude_HEADERS = \ + $(top_srcdir)/include/GL/internal/dri_interface.h nodist_EXTRA_mesa_dri_drivers_la_SOURCES = dummy.cpp mesa_dri_drivers_la_SOURCES = @@ -76,6 +77,12 @@ all-local: mesa_dri_drivers.la ln -f $(top_builddir)/$(LIB_DIR)/mesa_dri_drivers.so \ $(top_builddir)/$(LIB_DIR)/$$i; \ done; + +clean-local: + $(AM_V_GEN)$(RM) $(top_builddir)/$(LIB_DIR)/mesa_dri_drivers.so; + $(AM_V_GEN)for i in $(MEGADRIVERS); do \ + $(RM) $(top_builddir)/$(LIB_DIR)/$$i; \ + done; endif # hardlink each megadriver instance, but don't actually have @@ -85,6 +92,11 @@ install-data-hook: ln -f $(DESTDIR)$(dridir)/mesa_dri_drivers.so \ $(DESTDIR)$(dridir)/$$i; \ done; - $(RM) -f $(DESTDIR)$(dridir)/mesa_dri_drivers.* + $(RM) $(DESTDIR)$(dridir)/mesa_dri_drivers.* + +uninstall-hook: + for i in $(MEGADRIVERS); do \ + $(RM) $(DESTDIR)$(dridir)/$$i; \ + done; endif diff --git a/mesalib/src/mesa/drivers/dri/common/Makefile.am b/mesalib/src/mesa/drivers/dri/common/Makefile.am index 7222a96c6..af6f742a0 100644 --- a/mesalib/src/mesa/drivers/dri/common/Makefile.am +++ b/mesalib/src/mesa/drivers/dri/common/Makefile.am @@ -23,6 +23,8 @@ SUBDIRS = xmlpool include Makefile.sources +EXTRA_DIST = drirc xmlpool.h SConscript + AM_CFLAGS = \ -I$(top_srcdir)/include \ -I$(top_srcdir)/src/ \ diff --git a/mesalib/src/mesa/drivers/dri/common/Makefile.sources b/mesalib/src/mesa/drivers/dri/common/Makefile.sources index 43b289e90..d00ec5f73 100644 --- a/mesalib/src/mesa/drivers/dri/common/Makefile.sources +++ b/mesalib/src/mesa/drivers/dri/common/Makefile.sources @@ -1,7 +1,10 @@ DRI_COMMON_FILES := \ utils.c \ + utils.h \ dri_util.c \ - xmlconfig.c + dri_util.h \ + xmlconfig.c \ + xmlconfig.h # Paths are relative to MESA_TOP. mesa_dri_common_INCLUDES := \ diff --git a/mesalib/src/mesa/drivers/dri/common/mmio.h b/mesalib/src/mesa/drivers/dri/common/mmio.h deleted file mode 100644 index ce95d8c90..000000000 --- a/mesalib/src/mesa/drivers/dri/common/mmio.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * (C) Copyright IBM Corporation 2004 - * 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 THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - * USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -/** - * \file mmio.h - * Functions for properly handling memory mapped IO on various platforms. - * - * \author Ian Romanick <idr@us.ibm.com> - */ - - -#ifndef MMIO_H -#define MMIO_H - -#include "main/glheader.h" - -#if defined( __powerpc__ ) - -static INLINE uint32_t -read_MMIO_LE32( volatile void * base, unsigned long offset ) -{ - uint32_t val; - - __asm__ __volatile__( "lwbrx %0, %1, %2 ; eieio" - : "=r" (val) - : "b" (base), "r" (offset) ); - return val; -} - -#else - -static INLINE uint32_t -read_MMIO_LE32( volatile void * base, unsigned long offset ) -{ - volatile uint32_t * p = (volatile uint32_t *) (((volatile char *) base) + offset); - return LE32_TO_CPU( p[0] ); -} - -#endif - -#endif /* MMIO_H */ diff --git a/mesalib/src/mesa/drivers/dri/common/xmlconfig.c b/mesalib/src/mesa/drivers/dri/common/xmlconfig.c index 8e48522e2..d69eb0196 100644 --- a/mesalib/src/mesa/drivers/dri/common/xmlconfig.c +++ b/mesalib/src/mesa/drivers/dri/common/xmlconfig.c @@ -312,8 +312,7 @@ static unsigned char parseValue (driOptionValue *v, driOptionType type, v->_float = strToF (string, &tail); break; case DRI_STRING: - if (v->_string) - free (v->_string); + free (v->_string); v->_string = strndup(string, STRING_CONF_MAXLEN); return GL_TRUE; } diff --git a/mesalib/src/mesa/drivers/dri/common/xmlpool/Makefile.am b/mesalib/src/mesa/drivers/dri/common/xmlpool/Makefile.am index 57e604845..da7d03480 100644 --- a/mesalib/src/mesa/drivers/dri/common/xmlpool/Makefile.am +++ b/mesalib/src/mesa/drivers/dri/common/xmlpool/Makefile.am @@ -52,7 +52,9 @@ POT=xmlpool.pot .PHONY: all clean pot po mo +EXTRA_DIST = gen_xmlpool.py t_options.h $(POS) SConscript BUILT_SOURCES = options.h +CLEANFILES = $(MOS) options.h # All generated files are cleaned up. clean: diff --git a/mesalib/src/mesa/drivers/dri/swrast/Makefile.sources b/mesalib/src/mesa/drivers/dri/swrast/Makefile.sources index 70e432feb..8154fcaf7 100644 --- a/mesalib/src/mesa/drivers/dri/swrast/Makefile.sources +++ b/mesalib/src/mesa/drivers/dri/swrast/Makefile.sources @@ -1,5 +1,6 @@ SWRAST_DRIVER_FILES = \ - swrast.c + swrast.c \ + swrast_priv.h SWRAST_C_FILES = \ $(SWRAST_DRIVER_FILES) diff --git a/mesalib/src/mesa/drivers/dri/swrast/swrast.c b/mesalib/src/mesa/drivers/dri/swrast/swrast.c index e8a2c12d7..d62fed30c 100644 --- a/mesalib/src/mesa/drivers/dri/swrast/swrast.c +++ b/mesalib/src/mesa/drivers/dri/swrast/swrast.c @@ -61,8 +61,8 @@ const __DRIextension **__driDriverGetExtensions_swrast(void); -const char const *swrast_vendor_string = "Mesa Project"; -const char const *swrast_renderer_string = "Software Rasterizer"; +const char * const swrast_vendor_string = "Mesa Project"; +const char * const swrast_renderer_string = "Software Rasterizer"; /** * Screen and config-related functions diff --git a/mesalib/src/mesa/drivers/haiku/swrast/SConscript b/mesalib/src/mesa/drivers/haiku/swrast/SConscript index 2c25f727d..907325e32 100644 --- a/mesalib/src/mesa/drivers/haiku/swrast/SConscript +++ b/mesalib/src/mesa/drivers/haiku/swrast/SConscript @@ -13,6 +13,7 @@ env.Append(CPPPATH = [ ]) env.Prepend(LIBS = [ + mesautil, glsl, mesa, ]) diff --git a/mesalib/src/mesa/main/api_validate.c b/mesalib/src/mesa/main/api_validate.c index bf4fa3ea8..7d9893385 100644 --- a/mesalib/src/mesa/main/api_validate.c +++ b/mesalib/src/mesa/main/api_validate.c @@ -57,58 +57,65 @@ index_bytes(GLenum type, GLsizei count) /** * Check if OK to draw arrays/elements. */ -static GLboolean +static bool check_valid_to_render(struct gl_context *ctx, const char *function) { if (!_mesa_valid_to_render(ctx, function)) { - return GL_FALSE; + return false; } switch (ctx->API) { case API_OPENGLES2: /* For ES2, we can draw if we have a vertex program/shader). */ if (!ctx->VertexProgram._Current) - return GL_FALSE; + return false; break; case API_OPENGLES: /* For OpenGL ES, only draw if we have vertex positions */ if (!ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_POS].Enabled) - return GL_FALSE; + return false; break; case API_OPENGL_CORE: - if (ctx->Array.VAO == ctx->Array.DefaultVAO) - return GL_FALSE; + /* Section 10.4 (Drawing Commands Using Vertex Arrays) of the OpenGL 4.5 + * Core Profile spec says: + * + * "An INVALID_OPERATION error is generated if no vertex array + * object is bound (see section 10.3.1)." + */ + if (ctx->Array.VAO == ctx->Array.DefaultVAO) { + _mesa_error(ctx, GL_INVALID_OPERATION, "%s(no VAO bound)", function); + return false; + } /* fallthrough */ - case API_OPENGL_COMPAT: - { - const struct gl_shader_program *vsProg = - ctx->_Shader->CurrentProgram[MESA_SHADER_VERTEX]; - GLboolean haveVertexShader = (vsProg && vsProg->LinkStatus); - GLboolean haveVertexProgram = ctx->VertexProgram._Enabled; - if (haveVertexShader || haveVertexProgram) { - /* Draw regardless of whether or not we have any vertex arrays. - * (Ex: could draw a point using a constant vertex pos) - */ - return GL_TRUE; - } - else { - /* Draw if we have vertex positions (GL_VERTEX_ARRAY or generic - * array [0]). - */ - return (ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_POS].Enabled || - ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_GENERIC0].Enabled); - } + case API_OPENGL_COMPAT: { + const struct gl_shader_program *const vsProg = + ctx->_Shader->CurrentProgram[MESA_SHADER_VERTEX]; + const bool haveVertexShader = (vsProg && vsProg->LinkStatus); + const bool haveVertexProgram = ctx->VertexProgram._Enabled; + + if (haveVertexShader || haveVertexProgram) { + /* Draw regardless of whether or not we have any vertex arrays. + * (Ex: could draw a point using a constant vertex pos) + */ + return true; + } else { + /* Draw if we have vertex positions (GL_VERTEX_ARRAY or generic + * array [0]). + */ + return (ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_POS].Enabled || + ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_GENERIC0].Enabled); } break; + } default: - assert(!"Invalid API value in check_valid_to_render()"); + unreachable("Invalid API value in check_valid_to_render()"); } - return GL_TRUE; + return true; } @@ -310,18 +317,12 @@ valid_elements_type(struct gl_context *ctx, GLenum type, const char *name) } } -/** - * Error checking for glDrawElements(). Includes parameter checking - * and VBO bounds checking. - * \return GL_TRUE if OK to render, GL_FALSE if error found - */ -GLboolean -_mesa_validate_DrawElements(struct gl_context *ctx, - GLenum mode, GLsizei count, GLenum type, - const GLvoid *indices, GLint basevertex) +static bool +validate_DrawElements_common(struct gl_context *ctx, + GLenum mode, GLsizei count, GLenum type, + const GLvoid *indices, + const char *caller) { - FLUSH_CURRENT(ctx, 0); - /* From the GLES3 specification, section 2.14.2 (Transform Feedback * Primitive Capture): * @@ -331,44 +332,60 @@ _mesa_validate_DrawElements(struct gl_context *ctx, */ if (_mesa_is_gles3(ctx) && _mesa_is_xfb_active_and_unpaused(ctx)) { _mesa_error(ctx, GL_INVALID_OPERATION, - "glDrawElements(transform feedback active)"); - return GL_FALSE; + "%s(transform feedback active)", caller); + return false; } if (count < 0) { - _mesa_error(ctx, GL_INVALID_VALUE, "glDrawElements(count)" ); - return GL_FALSE; + _mesa_error(ctx, GL_INVALID_VALUE, "%s(count)", caller); + return false; } - if (!_mesa_valid_prim_mode(ctx, mode, "glDrawElements")) { - return GL_FALSE; + if (!_mesa_valid_prim_mode(ctx, mode, caller)) { + return false; } - if (!valid_elements_type(ctx, type, "glDrawElements")) - return GL_FALSE; + if (!valid_elements_type(ctx, type, caller)) + return false; - if (!check_valid_to_render(ctx, "glDrawElements")) - return GL_FALSE; + if (!check_valid_to_render(ctx, caller)) + return false; /* Vertex buffer object tests */ if (_mesa_is_bufferobj(ctx->Array.VAO->IndexBufferObj)) { /* use indices in the buffer object */ /* make sure count doesn't go outside buffer bounds */ if (index_bytes(type, count) > ctx->Array.VAO->IndexBufferObj->Size) { - _mesa_warning(ctx, "glDrawElements index out of buffer bounds"); - return GL_FALSE; + _mesa_warning(ctx, "%s index out of buffer bounds", caller); + return false; } } else { /* not using a VBO */ if (!indices) - return GL_FALSE; + return false; } if (count == 0) - return GL_FALSE; + return false; - return GL_TRUE; + return true; +} + +/** + * Error checking for glDrawElements(). Includes parameter checking + * and VBO bounds checking. + * \return GL_TRUE if OK to render, GL_FALSE if error found + */ +GLboolean +_mesa_validate_DrawElements(struct gl_context *ctx, + GLenum mode, GLsizei count, GLenum type, + const GLvoid *indices) +{ + FLUSH_CURRENT(ctx, 0); + + return validate_DrawElements_common(ctx, mode, count, type, indices, + "glDrawElements"); } @@ -381,7 +398,7 @@ GLboolean _mesa_validate_MultiDrawElements(struct gl_context *ctx, GLenum mode, const GLsizei *count, GLenum type, const GLvoid * const *indices, - GLuint primcount, const GLint *basevertex) + GLuint primcount) { unsigned i; @@ -439,62 +456,17 @@ GLboolean _mesa_validate_DrawRangeElements(struct gl_context *ctx, GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, - const GLvoid *indices, GLint basevertex) + const GLvoid *indices) { FLUSH_CURRENT(ctx, 0); - /* From the GLES3 specification, section 2.14.2 (Transform Feedback - * Primitive Capture): - * - * The error INVALID_OPERATION is also generated by DrawElements, - * DrawElementsInstanced, and DrawRangeElements while transform feedback - * is active and not paused, regardless of mode. - */ - if (_mesa_is_gles3(ctx) && _mesa_is_xfb_active_and_unpaused(ctx)) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glDrawElements(transform feedback active)"); - return GL_FALSE; - } - - if (count < 0) { - _mesa_error(ctx, GL_INVALID_VALUE, "glDrawRangeElements(count)" ); - return GL_FALSE; - } - - if (!_mesa_valid_prim_mode(ctx, mode, "glDrawRangeElements")) { - return GL_FALSE; - } - if (end < start) { _mesa_error(ctx, GL_INVALID_VALUE, "glDrawRangeElements(end<start)"); return GL_FALSE; } - if (!valid_elements_type(ctx, type, "glDrawRangeElements")) - return GL_FALSE; - - if (!check_valid_to_render(ctx, "glDrawRangeElements")) - return GL_FALSE; - - /* Vertex buffer object tests */ - if (_mesa_is_bufferobj(ctx->Array.VAO->IndexBufferObj)) { - /* use indices in the buffer object */ - /* make sure count doesn't go outside buffer bounds */ - if (index_bytes(type, count) > ctx->Array.VAO->IndexBufferObj->Size) { - _mesa_warning(ctx, "glDrawRangeElements index out of buffer bounds"); - return GL_FALSE; - } - } - else { - /* not using a VBO */ - if (!indices) - return GL_FALSE; - } - - if (count == 0) - return GL_FALSE; - - return GL_TRUE; + return validate_DrawElements_common(ctx, mode, count, type, indices, + "glDrawRangeElements"); } @@ -504,8 +476,7 @@ _mesa_validate_DrawRangeElements(struct gl_context *ctx, GLenum mode, * \return GL_TRUE if OK to render, GL_FALSE if error found */ GLboolean -_mesa_validate_DrawArrays(struct gl_context *ctx, - GLenum mode, GLint start, GLsizei count) +_mesa_validate_DrawArrays(struct gl_context *ctx, GLenum mode, GLsizei count) { struct gl_transform_feedback_object *xfb_obj = ctx->TransformFeedback.CurrentObject; @@ -621,67 +592,19 @@ _mesa_validate_DrawArraysInstanced(struct gl_context *ctx, GLenum mode, GLint fi GLboolean _mesa_validate_DrawElementsInstanced(struct gl_context *ctx, GLenum mode, GLsizei count, GLenum type, - const GLvoid *indices, GLsizei numInstances, - GLint basevertex) + const GLvoid *indices, GLsizei numInstances) { FLUSH_CURRENT(ctx, 0); - /* From the GLES3 specification, section 2.14.2 (Transform Feedback - * Primitive Capture): - * - * The error INVALID_OPERATION is also generated by DrawElements, - * DrawElementsInstanced, and DrawRangeElements while transform feedback - * is active and not paused, regardless of mode. - */ - if (_mesa_is_gles3(ctx) && _mesa_is_xfb_active_and_unpaused(ctx)) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glDrawElements(transform feedback active)"); - return GL_FALSE; - } - - if (count < 0) { + if (numInstances < 0) { _mesa_error(ctx, GL_INVALID_VALUE, - "glDrawElementsInstanced(count=%d)", count); - return GL_FALSE; - } - - if (!_mesa_valid_prim_mode(ctx, mode, "glDrawElementsInstanced")) { + "glDrawElementsInstanced(numInstances=%d)", numInstances); return GL_FALSE; } - if (!valid_elements_type(ctx, type, "glDrawElementsInstanced")) - return GL_FALSE; - - if (numInstances <= 0) { - if (numInstances < 0) - _mesa_error(ctx, GL_INVALID_VALUE, - "glDrawElementsInstanced(numInstances=%d)", numInstances); - return GL_FALSE; - } - - if (!check_valid_to_render(ctx, "glDrawElementsInstanced")) - return GL_FALSE; - - /* Vertex buffer object tests */ - if (_mesa_is_bufferobj(ctx->Array.VAO->IndexBufferObj)) { - /* use indices in the buffer object */ - /* make sure count doesn't go outside buffer bounds */ - if (index_bytes(type, count) > ctx->Array.VAO->IndexBufferObj->Size) { - _mesa_warning(ctx, - "glDrawElementsInstanced index out of buffer bounds"); - return GL_FALSE; - } - } - else { - /* not using a VBO */ - if (!indices) - return GL_FALSE; - } - - if (count == 0) - return GL_FALSE; - - return GL_TRUE; + return validate_DrawElements_common(ctx, mode, count, type, indices, + "glDrawElementsInstanced") + && (numInstances > 0); } diff --git a/mesalib/src/mesa/main/api_validate.h b/mesalib/src/mesa/main/api_validate.h index 0bb91c675..0ce7b69d5 100644 --- a/mesalib/src/mesa/main/api_validate.h +++ b/mesalib/src/mesa/main/api_validate.h @@ -43,25 +43,24 @@ _mesa_valid_prim_mode(struct gl_context *ctx, GLenum mode, const char *name); extern GLboolean -_mesa_validate_DrawArrays(struct gl_context *ctx, - GLenum mode, GLint start, GLsizei count); +_mesa_validate_DrawArrays(struct gl_context *ctx, GLenum mode, GLsizei count); extern GLboolean _mesa_validate_DrawElements(struct gl_context *ctx, GLenum mode, GLsizei count, GLenum type, - const GLvoid *indices, GLint basevertex); + const GLvoid *indices); extern GLboolean _mesa_validate_MultiDrawElements(struct gl_context *ctx, GLenum mode, const GLsizei *count, GLenum type, const GLvoid * const *indices, - GLuint primcount, const GLint *basevertex); + GLuint primcount); extern GLboolean _mesa_validate_DrawRangeElements(struct gl_context *ctx, GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, - const GLvoid *indices, GLint basevertex); + const GLvoid *indices); extern GLboolean @@ -71,8 +70,7 @@ _mesa_validate_DrawArraysInstanced(struct gl_context *ctx, GLenum mode, GLint fi extern GLboolean _mesa_validate_DrawElementsInstanced(struct gl_context *ctx, GLenum mode, GLsizei count, GLenum type, - const GLvoid *indices, GLsizei primcount, - GLint basevertex); + const GLvoid *indices, GLsizei primcount); extern GLboolean _mesa_validate_DrawTransformFeedback(struct gl_context *ctx, diff --git a/mesalib/src/mesa/main/clear.c b/mesalib/src/mesa/main/clear.c index f7f15cf59..4671ee245 100644 --- a/mesalib/src/mesa/main/clear.c +++ b/mesalib/src/mesa/main/clear.c @@ -58,10 +58,6 @@ _mesa_ClearIndex( GLfloat c ) * \param alpha alpha component. * * \sa glClearColor(). - * - * Clamps the parameters and updates gl_colorbuffer_attrib::ClearColor. On a - * change, flushes the vertices and notifies the driver via the - * dd_function_table::ClearColor callback. */ void GLAPIENTRY _mesa_ClearColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) @@ -132,14 +128,15 @@ color_buffer_writes_enabled(const struct gl_context *ctx, unsigned idx) /** * Clear buffers. - * + * * \param mask bit-mask indicating the buffers to be cleared. * - * Flushes the vertices and verifies the parameter. If __struct gl_contextRec::NewState - * is set then calls _mesa_update_state() to update gl_frame_buffer::_Xmin, - * etc. If the rasterization mode is set to GL_RENDER then requests the driver - * to clear the buffers, via the dd_function_table::Clear callback. - */ + * Flushes the vertices and verifies the parameter. + * If __struct gl_contextRec::NewState is set then calls _mesa_update_state() + * to update gl_frame_buffer::_Xmin, etc. If the rasterization mode is set to + * GL_RENDER then requests the driver to clear the buffers, via the + * dd_function_table::Clear callback. + */ void GLAPIENTRY _mesa_Clear( GLbitfield mask ) { @@ -340,7 +337,8 @@ _mesa_ClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value) drawbuffer); return; } - else if (ctx->DrawBuffer->Attachment[BUFFER_STENCIL].Renderbuffer && !ctx->RasterDiscard) { + else if (ctx->DrawBuffer->Attachment[BUFFER_STENCIL].Renderbuffer + && !ctx->RasterDiscard) { /* Save current stencil clear value, set to 'value', do the * stencil clear and restore the clear value. * XXX in the future we may have a new ctx->Driver.ClearBuffer() @@ -503,7 +501,8 @@ _mesa_ClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value) drawbuffer); return; } - else if (ctx->DrawBuffer->Attachment[BUFFER_DEPTH].Renderbuffer && !ctx->RasterDiscard) { + else if (ctx->DrawBuffer->Attachment[BUFFER_DEPTH].Renderbuffer + && !ctx->RasterDiscard) { /* Save current depth clear value, set to 'value', do the * depth clear and restore the clear value. * XXX in the future we may have a new ctx->Driver.ClearBuffer() diff --git a/mesalib/src/mesa/main/compiler.h b/mesalib/src/mesa/main/compiler.h index 34671dc7e..cdc843db2 100644 --- a/mesalib/src/mesa/main/compiler.h +++ b/mesalib/src/mesa/main/compiler.h @@ -122,7 +122,7 @@ extern "C" { * inline a static function that we later use in an alias. - ajax */ #ifndef PUBLIC -# if (defined(__GNUC__) && __GNUC__ >= 4) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)) +# if defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)) # define PUBLIC __attribute__((visibility("default"))) # define USED __attribute__((used)) # else diff --git a/mesalib/src/mesa/main/dlist.c b/mesalib/src/mesa/main/dlist.c index 4b7b0604b..d297f5120 100644 --- a/mesalib/src/mesa/main/dlist.c +++ b/mesalib/src/mesa/main/dlist.c @@ -81,7 +81,7 @@ struct gl_list_instruction GLuint Size; void (*Execute)( struct gl_context *ctx, void *data ); void (*Destroy)( struct gl_context *ctx, void *data ); - void (*Print)( struct gl_context *ctx, void *data ); + void (*Print)( struct gl_context *ctx, void *data, FILE *f ); }; @@ -666,11 +666,11 @@ ext_opcode_execute(struct gl_context *ctx, Node *node) /** Print an extended opcode instruction */ static GLint -ext_opcode_print(struct gl_context *ctx, Node *node) +ext_opcode_print(struct gl_context *ctx, Node *node, FILE *f) { const GLint i = node[0].opcode - OPCODE_EXT_0; GLint step; - ctx->ListExt->Opcode[i].Print(ctx, &node[1]); + ctx->ListExt->Opcode[i].Print(ctx, &node[1], f); step = ctx->ListExt->Opcode[i].Size; return step; } @@ -1098,7 +1098,7 @@ _mesa_dlist_alloc_opcode(struct gl_context *ctx, GLuint size, void (*execute) (struct gl_context *, void *), void (*destroy) (struct gl_context *, void *), - void (*print) (struct gl_context *, void *)) + void (*print) (struct gl_context *, void *, FILE *)) { if (ctx->ListExt->NumOpcodes < MAX_DLIST_EXT_OPCODES) { const GLuint i = ctx->ListExt->NumOpcodes++; @@ -9716,16 +9716,24 @@ enum_string(GLenum k) /** * Print the commands in a display list. For debugging only. * TODO: many commands aren't handled yet. + * \param fname filename to write display list to. If null, use stdout. */ static void GLAPIENTRY -print_list(struct gl_context *ctx, GLuint list) +print_list(struct gl_context *ctx, GLuint list, const char *fname) { struct gl_display_list *dlist; Node *n; GLboolean done; + FILE *f = stdout; + + if (fname) { + f = fopen(fname, "w"); + if (!f) + return; + } if (!islist(ctx, list)) { - printf("%u is not a display list ID\n", list); + fprintf(f, "%u is not a display list ID\n", list); return; } @@ -9735,199 +9743,202 @@ print_list(struct gl_context *ctx, GLuint list) n = dlist->Head; - printf("START-LIST %u, address %p\n", list, (void *) n); + fprintf(f, "START-LIST %u, address %p\n", list, (void *) n); done = n ? GL_FALSE : GL_TRUE; while (!done) { const OpCode opcode = n[0].opcode; if (is_ext_opcode(opcode)) { - n += ext_opcode_print(ctx, n); + n += ext_opcode_print(ctx, n, f); } else { switch (opcode) { case OPCODE_ACCUM: - printf("Accum %s %g\n", enum_string(n[1].e), n[2].f); + fprintf(f, "Accum %s %g\n", enum_string(n[1].e), n[2].f); + break; + case OPCODE_ACTIVE_TEXTURE: + fprintf(f, "ActiveTexture(%s)\n", enum_string(n[1].e)); break; case OPCODE_BITMAP: - printf("Bitmap %d %d %g %g %g %g %p\n", n[1].i, n[2].i, + fprintf(f, "Bitmap %d %d %g %g %g %g %p\n", n[1].i, n[2].i, n[3].f, n[4].f, n[5].f, n[6].f, get_pointer(&n[7])); break; case OPCODE_CALL_LIST: - printf("CallList %d\n", (int) n[1].ui); + fprintf(f, "CallList %d\n", (int) n[1].ui); break; case OPCODE_CALL_LIST_OFFSET: - printf("CallList %d + offset %u = %u\n", (int) n[1].ui, + fprintf(f, "CallList %d + offset %u = %u\n", (int) n[1].ui, ctx->List.ListBase, ctx->List.ListBase + n[1].ui); break; case OPCODE_DISABLE: - printf("Disable %s\n", enum_string(n[1].e)); + fprintf(f, "Disable %s\n", enum_string(n[1].e)); break; case OPCODE_ENABLE: - printf("Enable %s\n", enum_string(n[1].e)); + fprintf(f, "Enable %s\n", enum_string(n[1].e)); break; case OPCODE_FRUSTUM: - printf("Frustum %g %g %g %g %g %g\n", + fprintf(f, "Frustum %g %g %g %g %g %g\n", n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f); break; case OPCODE_LINE_STIPPLE: - printf("LineStipple %d %x\n", n[1].i, (int) n[2].us); + fprintf(f, "LineStipple %d %x\n", n[1].i, (int) n[2].us); break; case OPCODE_LOAD_IDENTITY: - printf("LoadIdentity\n"); + fprintf(f, "LoadIdentity\n"); break; case OPCODE_LOAD_MATRIX: - printf("LoadMatrix\n"); - printf(" %8f %8f %8f %8f\n", + fprintf(f, "LoadMatrix\n"); + fprintf(f, " %8f %8f %8f %8f\n", n[1].f, n[5].f, n[9].f, n[13].f); - printf(" %8f %8f %8f %8f\n", + fprintf(f, " %8f %8f %8f %8f\n", n[2].f, n[6].f, n[10].f, n[14].f); - printf(" %8f %8f %8f %8f\n", + fprintf(f, " %8f %8f %8f %8f\n", n[3].f, n[7].f, n[11].f, n[15].f); - printf(" %8f %8f %8f %8f\n", + fprintf(f, " %8f %8f %8f %8f\n", n[4].f, n[8].f, n[12].f, n[16].f); break; case OPCODE_MULT_MATRIX: - printf("MultMatrix (or Rotate)\n"); - printf(" %8f %8f %8f %8f\n", + fprintf(f, "MultMatrix (or Rotate)\n"); + fprintf(f, " %8f %8f %8f %8f\n", n[1].f, n[5].f, n[9].f, n[13].f); - printf(" %8f %8f %8f %8f\n", + fprintf(f, " %8f %8f %8f %8f\n", n[2].f, n[6].f, n[10].f, n[14].f); - printf(" %8f %8f %8f %8f\n", + fprintf(f, " %8f %8f %8f %8f\n", n[3].f, n[7].f, n[11].f, n[15].f); - printf(" %8f %8f %8f %8f\n", + fprintf(f, " %8f %8f %8f %8f\n", n[4].f, n[8].f, n[12].f, n[16].f); break; case OPCODE_ORTHO: - printf("Ortho %g %g %g %g %g %g\n", + fprintf(f, "Ortho %g %g %g %g %g %g\n", n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f); break; case OPCODE_POP_ATTRIB: - printf("PopAttrib\n"); + fprintf(f, "PopAttrib\n"); break; case OPCODE_POP_MATRIX: - printf("PopMatrix\n"); + fprintf(f, "PopMatrix\n"); break; case OPCODE_POP_NAME: - printf("PopName\n"); + fprintf(f, "PopName\n"); break; case OPCODE_PUSH_ATTRIB: - printf("PushAttrib %x\n", n[1].bf); + fprintf(f, "PushAttrib %x\n", n[1].bf); break; case OPCODE_PUSH_MATRIX: - printf("PushMatrix\n"); + fprintf(f, "PushMatrix\n"); break; case OPCODE_PUSH_NAME: - printf("PushName %d\n", (int) n[1].ui); + fprintf(f, "PushName %d\n", (int) n[1].ui); break; case OPCODE_RASTER_POS: - printf("RasterPos %g %g %g %g\n", + fprintf(f, "RasterPos %g %g %g %g\n", n[1].f, n[2].f, n[3].f, n[4].f); break; case OPCODE_ROTATE: - printf("Rotate %g %g %g %g\n", + fprintf(f, "Rotate %g %g %g %g\n", n[1].f, n[2].f, n[3].f, n[4].f); break; case OPCODE_SCALE: - printf("Scale %g %g %g\n", n[1].f, n[2].f, n[3].f); + fprintf(f, "Scale %g %g %g\n", n[1].f, n[2].f, n[3].f); break; case OPCODE_TRANSLATE: - printf("Translate %g %g %g\n", n[1].f, n[2].f, n[3].f); + fprintf(f, "Translate %g %g %g\n", n[1].f, n[2].f, n[3].f); break; case OPCODE_BIND_TEXTURE: - printf("BindTexture %s %d\n", + fprintf(f, "BindTexture %s %d\n", _mesa_lookup_enum_by_nr(n[1].ui), n[2].ui); break; case OPCODE_SHADE_MODEL: - printf("ShadeModel %s\n", _mesa_lookup_enum_by_nr(n[1].ui)); + fprintf(f, "ShadeModel %s\n", _mesa_lookup_enum_by_nr(n[1].ui)); break; case OPCODE_MAP1: - printf("Map1 %s %.3f %.3f %d %d\n", + fprintf(f, "Map1 %s %.3f %.3f %d %d\n", _mesa_lookup_enum_by_nr(n[1].ui), n[2].f, n[3].f, n[4].i, n[5].i); break; case OPCODE_MAP2: - printf("Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n", + fprintf(f, "Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n", _mesa_lookup_enum_by_nr(n[1].ui), n[2].f, n[3].f, n[4].f, n[5].f, n[6].i, n[7].i, n[8].i, n[9].i); break; case OPCODE_MAPGRID1: - printf("MapGrid1 %d %.3f %.3f\n", n[1].i, n[2].f, n[3].f); + fprintf(f, "MapGrid1 %d %.3f %.3f\n", n[1].i, n[2].f, n[3].f); break; case OPCODE_MAPGRID2: - printf("MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n", + fprintf(f, "MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n", n[1].i, n[2].f, n[3].f, n[4].i, n[5].f, n[6].f); break; case OPCODE_EVALMESH1: - printf("EvalMesh1 %d %d\n", n[1].i, n[2].i); + fprintf(f, "EvalMesh1 %d %d\n", n[1].i, n[2].i); break; case OPCODE_EVALMESH2: - printf("EvalMesh2 %d %d %d %d\n", + fprintf(f, "EvalMesh2 %d %d %d %d\n", n[1].i, n[2].i, n[3].i, n[4].i); break; case OPCODE_ATTR_1F_NV: - printf("ATTR_1F_NV attr %d: %f\n", n[1].i, n[2].f); + fprintf(f, "ATTR_1F_NV attr %d: %f\n", n[1].i, n[2].f); break; case OPCODE_ATTR_2F_NV: - printf("ATTR_2F_NV attr %d: %f %f\n", + fprintf(f, "ATTR_2F_NV attr %d: %f %f\n", n[1].i, n[2].f, n[3].f); break; case OPCODE_ATTR_3F_NV: - printf("ATTR_3F_NV attr %d: %f %f %f\n", + fprintf(f, "ATTR_3F_NV attr %d: %f %f %f\n", n[1].i, n[2].f, n[3].f, n[4].f); break; case OPCODE_ATTR_4F_NV: - printf("ATTR_4F_NV attr %d: %f %f %f %f\n", + fprintf(f, "ATTR_4F_NV attr %d: %f %f %f %f\n", n[1].i, n[2].f, n[3].f, n[4].f, n[5].f); break; case OPCODE_ATTR_1F_ARB: - printf("ATTR_1F_ARB attr %d: %f\n", n[1].i, n[2].f); + fprintf(f, "ATTR_1F_ARB attr %d: %f\n", n[1].i, n[2].f); break; case OPCODE_ATTR_2F_ARB: - printf("ATTR_2F_ARB attr %d: %f %f\n", + fprintf(f, "ATTR_2F_ARB attr %d: %f %f\n", n[1].i, n[2].f, n[3].f); break; case OPCODE_ATTR_3F_ARB: - printf("ATTR_3F_ARB attr %d: %f %f %f\n", + fprintf(f, "ATTR_3F_ARB attr %d: %f %f %f\n", n[1].i, n[2].f, n[3].f, n[4].f); break; case OPCODE_ATTR_4F_ARB: - printf("ATTR_4F_ARB attr %d: %f %f %f %f\n", + fprintf(f, "ATTR_4F_ARB attr %d: %f %f %f %f\n", n[1].i, n[2].f, n[3].f, n[4].f, n[5].f); break; case OPCODE_MATERIAL: - printf("MATERIAL %x %x: %f %f %f %f\n", + fprintf(f, "MATERIAL %x %x: %f %f %f %f\n", n[1].i, n[2].i, n[3].f, n[4].f, n[5].f, n[6].f); break; case OPCODE_BEGIN: - printf("BEGIN %x\n", n[1].i); + fprintf(f, "BEGIN %x\n", n[1].i); break; case OPCODE_END: - printf("END\n"); + fprintf(f, "END\n"); break; case OPCODE_RECTF: - printf("RECTF %f %f %f %f\n", n[1].f, n[2].f, n[3].f, + fprintf(f, "RECTF %f %f %f %f\n", n[1].f, n[2].f, n[3].f, n[4].f); break; case OPCODE_EVAL_C1: - printf("EVAL_C1 %f\n", n[1].f); + fprintf(f, "EVAL_C1 %f\n", n[1].f); break; case OPCODE_EVAL_C2: - printf("EVAL_C2 %f %f\n", n[1].f, n[2].f); + fprintf(f, "EVAL_C2 %f %f\n", n[1].f, n[2].f); break; case OPCODE_EVAL_P1: - printf("EVAL_P1 %d\n", n[1].i); + fprintf(f, "EVAL_P1 %d\n", n[1].i); break; case OPCODE_EVAL_P2: - printf("EVAL_P2 %d %d\n", n[1].i, n[2].i); + fprintf(f, "EVAL_P2 %d %d\n", n[1].i, n[2].i); break; case OPCODE_PROVOKING_VERTEX: - printf("ProvokingVertex %s\n", + fprintf(f, "ProvokingVertex %s\n", _mesa_lookup_enum_by_nr(n[1].ui)); break; @@ -9935,15 +9946,15 @@ print_list(struct gl_context *ctx, GLuint list) * meta opcodes/commands */ case OPCODE_ERROR: - printf("Error: %s %s\n", enum_string(n[1].e), + fprintf(f, "Error: %s %s\n", enum_string(n[1].e), (const char *) get_pointer(&n[2])); break; case OPCODE_CONTINUE: - printf("DISPLAY-LIST-CONTINUE\n"); + fprintf(f, "DISPLAY-LIST-CONTINUE\n"); n = (Node *) get_pointer(&n[1]); break; case OPCODE_END_OF_LIST: - printf("END-LIST %u\n", list); + fprintf(f, "END-LIST %u\n", list); done = GL_TRUE; break; default: @@ -9954,7 +9965,7 @@ print_list(struct gl_context *ctx, GLuint list) return; } else { - printf("command %d, %u operands\n", opcode, + fprintf(f, "command %d, %u operands\n", opcode, InstSize[opcode]); } } @@ -9964,6 +9975,10 @@ print_list(struct gl_context *ctx, GLuint list) } } } + + fflush(f); + if (fname) + fclose(f); } @@ -9977,7 +9992,7 @@ void mesa_print_display_list(GLuint list) { GET_CURRENT_CONTEXT(ctx); - print_list(ctx, list); + print_list(ctx, list, NULL); } diff --git a/mesalib/src/mesa/main/dlist.h b/mesalib/src/mesa/main/dlist.h index 7726e77d8..c57eb74da 100644 --- a/mesalib/src/mesa/main/dlist.h +++ b/mesalib/src/mesa/main/dlist.h @@ -63,7 +63,7 @@ extern void *_mesa_dlist_alloc(struct gl_context *ctx, GLuint opcode, GLuint sz) extern GLint _mesa_dlist_alloc_opcode( struct gl_context *ctx, GLuint sz, void (*execute)( struct gl_context *, void * ), void (*destroy)( struct gl_context *, void * ), - void (*print)( struct gl_context *, void * ) ); + void (*print)( struct gl_context *, void *, FILE * ) ); extern void _mesa_delete_list(struct gl_context *ctx, struct gl_display_list *dlist); diff --git a/mesalib/src/mesa/main/enums.h b/mesalib/src/mesa/main/enums.h index 36c053d4b..66bdd53bb 100644 --- a/mesalib/src/mesa/main/enums.h +++ b/mesalib/src/mesa/main/enums.h @@ -37,6 +37,11 @@ #define _ENUMS_H_ +#ifdef __cplusplus +extern "C" { +#endif + + extern const char *_mesa_lookup_enum_by_nr( int nr ); /* Get the name of an enum given that it is a primitive type. Avoids @@ -44,4 +49,10 @@ extern const char *_mesa_lookup_enum_by_nr( int nr ); */ const char *_mesa_lookup_prim_by_nr( unsigned nr ); + +#ifdef __cplusplus +} +#endif + + #endif diff --git a/mesalib/src/mesa/main/errors.c b/mesalib/src/mesa/main/errors.c index 7d622bb16..4e7853b90 100644 --- a/mesalib/src/mesa/main/errors.c +++ b/mesalib/src/mesa/main/errors.c @@ -1395,6 +1395,7 @@ should_output(struct gl_context *ctx, GLenum error, const char *fmtString) void _mesa_gl_debug(struct gl_context *ctx, GLuint *id, + enum mesa_debug_source source, enum mesa_debug_type type, enum mesa_debug_severity severity, const char *fmtString, ...) @@ -1409,7 +1410,7 @@ _mesa_gl_debug(struct gl_context *ctx, len = _mesa_vsnprintf(s, MAX_DEBUG_MESSAGE_LENGTH, fmtString, args); va_end(args); - log_msg(ctx, MESA_DEBUG_SOURCE_API, type, *id, severity, len, s); + log_msg(ctx, source, type, *id, severity, len, s); } diff --git a/mesalib/src/mesa/main/errors.h b/mesalib/src/mesa/main/errors.h index b388138e8..0c521c0d0 100644 --- a/mesalib/src/mesa/main/errors.h +++ b/mesalib/src/mesa/main/errors.h @@ -38,14 +38,13 @@ #include "compiler.h" #include "glheader.h" +#include "mtypes.h" #ifdef __cplusplus extern "C" { #endif -#include "mtypes.h" - struct _glapi_table; extern void @@ -72,14 +71,16 @@ _mesa_debug( const struct gl_context *ctx, const char *fmtString, ... ) PRINTFLI extern void _mesa_gl_debug(struct gl_context *ctx, GLuint *id, + enum mesa_debug_source source, enum mesa_debug_type type, enum mesa_debug_severity severity, - const char *fmtString, ...) PRINTFLIKE(5, 6); + const char *fmtString, ...) PRINTFLIKE(6, 7); #define _mesa_perf_debug(ctx, sev, ...) do { \ static GLuint msg_id = 0; \ if (unlikely(ctx->Const.ContextFlags & GL_CONTEXT_FLAG_DEBUG_BIT)) { \ _mesa_gl_debug(ctx, &msg_id, \ + MESA_DEBUG_SOURCE_API, \ MESA_DEBUG_TYPE_PERFORMANCE, \ sev, \ __VA_ARGS__); \ diff --git a/mesalib/src/mesa/main/fbobject.c b/mesalib/src/mesa/main/fbobject.c index 8283373a4..4c3c157a4 100644 --- a/mesalib/src/mesa/main/fbobject.c +++ b/mesalib/src/mesa/main/fbobject.c @@ -599,6 +599,7 @@ fbo_incomplete(struct gl_context *ctx, const char *msg, int index) static GLuint msg_id; _mesa_gl_debug(ctx, &msg_id, + MESA_DEBUG_SOURCE_API, MESA_DEBUG_TYPE_OTHER, MESA_DEBUG_SEVERITY_MEDIUM, "FBO incomplete: %s [%d]\n", msg, index); @@ -1429,6 +1430,9 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat) case GL_RGB8: return GL_RGB; case GL_RGB: + if (_mesa_is_gles3(ctx)) + return GL_RGB; + /* fallthrough */ case GL_R3_G3_B2: case GL_RGB4: case GL_RGB5: @@ -1443,6 +1447,9 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat) case GL_RGBA8: return GL_RGBA; case GL_RGBA: + if (_mesa_is_gles3(ctx)) + return GL_RGBA; + /* fallthrough */ case GL_RGBA2: case GL_RGBA12: case GL_RGBA16: @@ -3073,6 +3080,14 @@ invalidate_framebuffer_storage(GLenum target, GLsizei numAttachments, case GL_DEPTH_ATTACHMENT: case GL_STENCIL_ATTACHMENT: break; + case GL_DEPTH_STENCIL_ATTACHMENT: + /* GL_DEPTH_STENCIL_ATTACHMENT is a valid attachment point only + * in desktop and ES 3.0 profiles. Note that OES_packed_depth_stencil + * extension does not make this attachment point valid on ES 2.0. + */ + if (_mesa_is_desktop_gl(ctx) || _mesa_is_gles3(ctx)) + break; + /* fallthrough */ case GL_COLOR_ATTACHMENT0: case GL_COLOR_ATTACHMENT1: case GL_COLOR_ATTACHMENT2: diff --git a/mesalib/src/mesa/main/ff_fragment_shader.cpp b/mesalib/src/mesa/main/ff_fragment_shader.cpp index 5591d57df..bc6fdbdd8 100644 --- a/mesalib/src/mesa/main/ff_fragment_shader.cpp +++ b/mesalib/src/mesa/main/ff_fragment_shader.cpp @@ -27,13 +27,15 @@ * **************************************************************************/ -extern "C" { #include "glheader.h" #include "imports.h" #include "mtypes.h" #include "main/context.h" #include "main/macros.h" #include "main/samplerobj.h" +#include "main/texenvprogram.h" +#include "main/texobj.h" +#include "main/uniforms.h" #include "program/program.h" #include "program/prog_parameter.h" #include "program/prog_cache.h" @@ -41,10 +43,6 @@ extern "C" { #include "program/prog_print.h" #include "program/prog_statevars.h" #include "program/programopt.h" -#include "texenvprogram.h" -#include "texobj.h" -} -#include "main/uniforms.h" #include "../glsl/glsl_types.h" #include "../glsl/ir.h" #include "../glsl/ir_builder.h" diff --git a/mesalib/src/mesa/main/formatquery.c b/mesalib/src/mesa/main/formatquery.c index 40eca8711..f6274fe30 100644 --- a/mesalib/src/mesa/main/formatquery.c +++ b/mesalib/src/mesa/main/formatquery.c @@ -115,29 +115,40 @@ _mesa_GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname, internalformat, buffer); break; case GL_NUM_SAMPLE_COUNTS: { - /* The driver can return 0, and we should pass that along to the - * application. The ARB decided that ARB_internalformat_query should - * behave as ARB_internalformat_query2 in this situation. - * - * The ARB_internalformat_query2 spec says: - * - * "- NUM_SAMPLE_COUNTS: The number of sample counts that would be - * returned by querying SAMPLES is returned in <params>. - * * If <internalformat> is not color-renderable, - * depth-renderable, or stencil-renderable (as defined in - * section 4.4.4), or if <target> does not support multiple - * samples (ie other than TEXTURE_2D_MULTISAMPLE, - * TEXTURE_2D_MULTISAMPLE_ARRAY, or RENDERBUFFER), 0 is - * returned." - */ - const size_t num_samples = - ctx->Driver.QuerySamplesForFormat(ctx, target, internalformat, buffer); - - /* QuerySamplesForFormat writes some stuff to buffer, so we have to - * separately over-write it with the requested value. - */ - buffer[0] = (GLint) num_samples; - count = 1; + if (_mesa_is_gles3(ctx) && _mesa_is_enum_format_integer(internalformat)) { + /* From GL ES 3.0 specification, section 6.1.15 page 236: "Since + * multisampling is not supported for signed and unsigned integer + * internal formats, the value of NUM_SAMPLE_COUNTS will be zero + * for such formats. + */ + buffer[0] = 0; + count = 1; + } else { + size_t num_samples; + + /* The driver can return 0, and we should pass that along to the + * application. The ARB decided that ARB_internalformat_query should + * behave as ARB_internalformat_query2 in this situation. + * + * The ARB_internalformat_query2 spec says: + * + * "- NUM_SAMPLE_COUNTS: The number of sample counts that would be + * returned by querying SAMPLES is returned in <params>. + * * If <internalformat> is not color-renderable, + * depth-renderable, or stencil-renderable (as defined in + * section 4.4.4), or if <target> does not support multiple + * samples (ie other than TEXTURE_2D_MULTISAMPLE, + * TEXTURE_2D_MULTISAMPLE_ARRAY, or RENDERBUFFER), 0 is + * returned." + */ + num_samples = ctx->Driver.QuerySamplesForFormat(ctx, target, internalformat, buffer); + + /* QuerySamplesForFormat writes some stuff to buffer, so we have to + * separately over-write it with the requested value. + */ + buffer[0] = (GLint) num_samples; + count = 1; + } break; } default: diff --git a/mesalib/src/mesa/main/getstring.c b/mesalib/src/mesa/main/getstring.c index 431d60b03..1b2c7f054 100644 --- a/mesalib/src/mesa/main/getstring.c +++ b/mesalib/src/mesa/main/getstring.c @@ -58,6 +58,12 @@ shading_language_version(struct gl_context *ctx) return (const GLubyte *) "4.10"; case 420: return (const GLubyte *) "4.20"; + case 430: + return (const GLubyte *) "4.30"; + case 440: + return (const GLubyte *) "4.40"; + case 450: + return (const GLubyte *) "4.50"; default: _mesa_problem(ctx, "Invalid GLSL version in shading_language_version()"); @@ -68,7 +74,7 @@ shading_language_version(struct gl_context *ctx) case API_OPENGLES2: return (ctx->Version < 30) ? (const GLubyte *) "OpenGL ES GLSL ES 1.0.16" - : (const GLubyte *) "OpenGL ES GLSL ES 3.0"; + : (const GLubyte *) "OpenGL ES GLSL ES 3.00"; case API_OPENGLES: /* fall-through */ diff --git a/mesalib/src/mesa/main/hash.c b/mesalib/src/mesa/main/hash.c index 52095f7d1..a8c796b9a 100644 --- a/mesalib/src/mesa/main/hash.c +++ b/mesalib/src/mesa/main/hash.c @@ -96,6 +96,12 @@ uint_hash(GLuint id) return id; } +static uint32_t +uint_key_hash(const void *key) +{ + return uint_hash((uintptr_t)key); +} + static void * uint_key(GLuint id) { @@ -114,7 +120,8 @@ _mesa_NewHashTable(void) struct _mesa_HashTable *table = CALLOC_STRUCT(_mesa_HashTable); if (table) { - table->ht = _mesa_hash_table_create(NULL, uint_key_compare); + table->ht = _mesa_hash_table_create(NULL, uint_key_hash, + uint_key_compare); if (table->ht == NULL) { free(table); _mesa_error_no_memory(__func__); @@ -175,7 +182,7 @@ _mesa_HashLookup_unlocked(struct _mesa_HashTable *table, GLuint key) if (key == DELETED_KEY_VALUE) return table->deleted_key_data; - entry = _mesa_hash_table_search(table->ht, uint_hash(key), uint_key(key)); + entry = _mesa_hash_table_search(table->ht, uint_key(key)); if (!entry) return NULL; @@ -266,11 +273,11 @@ _mesa_HashInsert_unlocked(struct _mesa_HashTable *table, GLuint key, void *data) if (key == DELETED_KEY_VALUE) { table->deleted_key_data = data; } else { - entry = _mesa_hash_table_search(table->ht, hash, uint_key(key)); + entry = _mesa_hash_table_search_pre_hashed(table->ht, hash, uint_key(key)); if (entry) { entry->data = data; } else { - _mesa_hash_table_insert(table->ht, hash, uint_key(key), data); + _mesa_hash_table_insert_with_hash(table->ht, hash, uint_key(key), data); } } } @@ -340,7 +347,7 @@ _mesa_HashRemove(struct _mesa_HashTable *table, GLuint key) if (key == DELETED_KEY_VALUE) { table->deleted_key_data = NULL; } else { - entry = _mesa_hash_table_search(table->ht, uint_hash(key), uint_key(key)); + entry = _mesa_hash_table_search(table->ht, uint_key(key)); _mesa_hash_table_remove(table->ht, entry); } mtx_unlock(&table->Mutex); diff --git a/mesalib/src/mesa/main/imports.c b/mesalib/src/mesa/main/imports.c index 4f5a2d11f..6945c2f62 100644 --- a/mesalib/src/mesa/main/imports.c +++ b/mesalib/src/mesa/main/imports.c @@ -94,7 +94,7 @@ _mesa_align_malloc(size_t bytes, unsigned long alignment) ASSERT( alignment > 0 ); - ptr = (uintptr_t)malloc(bytes + alignment + sizeof(void *)); + ptr = malloc(bytes + alignment + sizeof(void *)); if (!ptr) return NULL; @@ -143,7 +143,7 @@ _mesa_align_calloc(size_t bytes, unsigned long alignment) ASSERT( alignment > 0 ); - ptr = (uintptr_t)calloc(1, bytes + alignment + sizeof(void *)); + ptr = calloc(1, bytes + alignment + sizeof(void *)); if (!ptr) return NULL; diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h index 7389baa1d..b95dfb9f7 100644 --- a/mesalib/src/mesa/main/mtypes.h +++ b/mesalib/src/mesa/main/mtypes.h @@ -1657,6 +1657,20 @@ typedef enum { DRAW_ARRAYS } gl_draw_method; +/** + * Enum for the OpenGL APIs we know about and may support. + * + * NOTE: This must match the api_enum table in + * src/mesa/main/get_hash_generator.py + */ +typedef enum +{ + API_OPENGL_COMPAT, /* legacy / compatibility contexts */ + API_OPENGLES, + API_OPENGLES2, + API_OPENGL_CORE, + API_OPENGL_LAST = API_OPENGL_CORE +} gl_api; /** * Vertex array state @@ -1701,8 +1715,9 @@ struct gl_array_attrib /** One of the DRAW_xxx flags, not consumed by drivers */ gl_draw_method DrawMethod; - /** Legal array datatypes */ + /** Legal array datatypes and the API for which they have been computed */ GLbitfield LegalTypesMask; + gl_api LegalTypesMaskAPI; }; @@ -2990,6 +3005,7 @@ struct gl_shader_compiler_options GLboolean EmitNoMainReturn; /**< Emit CONT/RET opcodes? */ GLboolean EmitNoNoise; /**< Emit NOISE opcodes? */ GLboolean EmitNoPow; /**< Emit POW opcodes? */ + GLboolean EmitNoSat; /**< Emit SAT opcodes? */ GLboolean LowerClipDistance; /**< Lower gl_ClipDistance from float[8] to vec4[2]? */ /** @@ -4039,21 +4055,6 @@ enum mesa_debug_severity { /** @} */ /** - * Enum for the OpenGL APIs we know about and may support. - * - * NOTE: This must match the api_enum table in - * src/mesa/main/get_hash_generator.py - */ -typedef enum -{ - API_OPENGL_COMPAT, /* legacy / compatibility contexts */ - API_OPENGLES, - API_OPENGLES2, - API_OPENGL_CORE, - API_OPENGL_LAST = API_OPENGL_CORE -} gl_api; - -/** * Driver-specific state flags. * * These are or'd with gl_context::NewDriverState to notify a driver about diff --git a/mesalib/src/mesa/main/objectlabel.c b/mesalib/src/mesa/main/objectlabel.c index 8efc33e0d..78df96b9b 100644 --- a/mesalib/src/mesa/main/objectlabel.c +++ b/mesalib/src/mesa/main/objectlabel.c @@ -45,11 +45,8 @@ static void set_label(struct gl_context *ctx, char **labelPtr, const char *label, int length, const char *caller) { - if (*labelPtr) { - /* free old label string */ - free(*labelPtr); - *labelPtr = NULL; - } + free(*labelPtr); + *labelPtr = NULL; /* set new label string */ if (label) { @@ -61,7 +58,7 @@ set_label(struct gl_context *ctx, char **labelPtr, const char *label, MAX_LABEL_LENGTH); /* explicit length */ - *labelPtr = (char *) malloc(length+1); + *labelPtr = malloc(length+1); if (*labelPtr) { memcpy(*labelPtr, label, length); /* length is not required to include the null terminator so diff --git a/mesalib/src/mesa/main/polygon.c b/mesalib/src/mesa/main/polygon.c index 76d601977..cdaa24483 100644 --- a/mesalib/src/mesa/main/polygon.c +++ b/mesalib/src/mesa/main/polygon.c @@ -176,19 +176,18 @@ _mesa_PolygonMode( GLenum face, GLenum mode ) /** - * This routine updates the ctx->Polygon.Stipple state. - * If we're getting the stipple data from a PBO, we map the buffer - * in order to access the data. - * In any case, we obey the current pixel unpacking parameters when fetching - * the stipple data. - * - * In the future, this routine should be used as a fallback, called via - * ctx->Driver.PolygonStipple(). We'll have to update all the DRI drivers - * too. + * Called by glPolygonStipple. */ -void -_mesa_polygon_stipple(struct gl_context *ctx, const GLubyte *pattern) +void GLAPIENTRY +_mesa_PolygonStipple(const GLubyte *pattern) { + GET_CURRENT_CONTEXT(ctx); + + if (MESA_VERBOSE & VERBOSE_API) + _mesa_debug(ctx, "glPolygonStipple\n"); + + FLUSH_VERTICES(ctx, _NEW_POLYGONSTIPPLE); + pattern = _mesa_map_validate_pbo_source(ctx, 2, &ctx->Unpack, 32, 32, 1, GL_COLOR_INDEX, GL_BITMAP, @@ -200,23 +199,6 @@ _mesa_polygon_stipple(struct gl_context *ctx, const GLubyte *pattern) _mesa_unpack_polygon_stipple(pattern, ctx->PolygonStipple, &ctx->Unpack); _mesa_unmap_pbo_source(ctx, &ctx->Unpack); -} - - -/** - * Called by glPolygonStipple. - */ -void GLAPIENTRY -_mesa_PolygonStipple( const GLubyte *pattern ) -{ - GET_CURRENT_CONTEXT(ctx); - - if (MESA_VERBOSE&VERBOSE_API) - _mesa_debug(ctx, "glPolygonStipple\n"); - - FLUSH_VERTICES(ctx, _NEW_POLYGONSTIPPLE); - - _mesa_polygon_stipple(ctx, pattern); if (ctx->Driver.PolygonStipple) ctx->Driver.PolygonStipple(ctx, pattern); diff --git a/mesalib/src/mesa/main/polygon.h b/mesalib/src/mesa/main/polygon.h index 69c5cbc45..530adba4c 100644 --- a/mesalib/src/mesa/main/polygon.h +++ b/mesalib/src/mesa/main/polygon.h @@ -39,10 +39,6 @@ struct gl_context; extern void GLAPIENTRY _mesa_GetnPolygonStippleARB( GLsizei bufSize, GLubyte *dest ); -extern void -_mesa_polygon_stipple(struct gl_context *ctx, const GLubyte *pattern); - - extern void GLAPIENTRY _mesa_CullFace( GLenum mode ); diff --git a/mesalib/src/mesa/main/samplerobj.h b/mesalib/src/mesa/main/samplerobj.h index 7d80b383d..1bb3193e4 100644 --- a/mesalib/src/mesa/main/samplerobj.h +++ b/mesalib/src/mesa/main/samplerobj.h @@ -27,6 +27,11 @@ #ifndef SAMPLEROBJ_H #define SAMPLEROBJ_H +#ifdef __cplusplus +extern "C" { +#endif + + struct dd_function_table; static inline struct gl_sampler_object * @@ -103,4 +108,8 @@ _mesa_GetSamplerParameterIiv(GLuint sampler, GLenum pname, GLint *params); void GLAPIENTRY _mesa_GetSamplerParameterIuiv(GLuint sampler, GLenum pname, GLuint *params); +#ifdef __cplusplus +} +#endif + #endif /* SAMPLEROBJ_H */ diff --git a/mesalib/src/mesa/main/shaderapi.c b/mesalib/src/mesa/main/shaderapi.c index 66578204f..6d831f762 100644 --- a/mesalib/src/mesa/main/shaderapi.c +++ b/mesalib/src/mesa/main/shaderapi.c @@ -274,9 +274,8 @@ attach_shader(struct gl_context *ctx, GLuint program, GLuint shader) } /* grow list */ - shProg->Shaders = (struct gl_shader **) - realloc(shProg->Shaders, - (n + 1) * sizeof(struct gl_shader *)); + shProg->Shaders = realloc(shProg->Shaders, + (n + 1) * sizeof(struct gl_shader *)); if (!shProg->Shaders) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glAttachShader"); return; diff --git a/mesalib/src/mesa/main/sse_minmax.c b/mesalib/src/mesa/main/sse_minmax.c index 222ac1454..2e3471625 100644 --- a/mesalib/src/mesa/main/sse_minmax.c +++ b/mesalib/src/mesa/main/sse_minmax.c @@ -25,7 +25,6 @@ * */ -#ifdef __SSE4_1__ #include "main/sse_minmax.h" #include <smmintrin.h> #include <stdint.h> @@ -93,5 +92,3 @@ _mesa_uint_array_min_max(const unsigned *ui_indices, unsigned *min_index, *min_index = min_ui; *max_index = max_ui; } - -#endif diff --git a/mesalib/src/mesa/main/texenvprogram.h b/mesalib/src/mesa/main/texenvprogram.h index 15ab31a50..11439f13b 100644 --- a/mesalib/src/mesa/main/texenvprogram.h +++ b/mesalib/src/mesa/main/texenvprogram.h @@ -27,9 +27,20 @@ #define TEXENVPROGRAM_H +#ifdef __cplusplus +extern "C" { +#endif + + struct gl_context; extern struct gl_shader_program * _mesa_get_fixed_func_fragment_program(struct gl_context *ctx); + +#ifdef __cplusplus +} +#endif + + #endif diff --git a/mesalib/src/mesa/main/teximage.c b/mesalib/src/mesa/main/teximage.c index 4f4bb11dd..7766904c9 100644 --- a/mesalib/src/mesa/main/teximage.c +++ b/mesalib/src/mesa/main/teximage.c @@ -1542,7 +1542,7 @@ _mesa_legal_texture_dimensions(struct gl_context *ctx, GLenum target, maxSize >>= level; if (width < 2 * border || width > 2 * border + maxSize) return GL_FALSE; - if (height < 1 || height > ctx->Const.MaxArrayTextureLayers) + if (height < 0 || height > ctx->Const.MaxArrayTextureLayers) return GL_FALSE; if (!ctx->Extensions.ARB_texture_non_power_of_two) { if (width > 0 && !_mesa_is_pow_two(width - 2 * border)) diff --git a/mesalib/src/mesa/main/texobj.c b/mesalib/src/mesa/main/texobj.c index 923cf60d7..f0ff605fc 100644 --- a/mesalib/src/mesa/main/texobj.c +++ b/mesalib/src/mesa/main/texobj.c @@ -89,7 +89,7 @@ _mesa_lookup_texture_locked(struct gl_context *ctx, GLuint id) * * Called via ctx->Driver.NewTextureObject, unless overridden by a device * driver. - * + * * \param shared the shared GL state structure to contain the texture object * \param name integer name for the texture object * \param target either GL_TEXTURE_1D, GL_TEXTURE_2D, GL_TEXTURE_3D, @@ -268,7 +268,6 @@ _mesa_delete_texture_object(struct gl_context *ctx, } - /** * Copy texture object state from one texture object to another. * Use for glPush/PopAttrib. @@ -653,7 +652,8 @@ _mesa_test_texobj_completeness( const struct gl_context *ctx, if (height > 1 && t->Target != GL_TEXTURE_1D_ARRAY) { height /= 2; } - if (depth > 1 && t->Target != GL_TEXTURE_2D_ARRAY && t->Target != GL_TEXTURE_CUBE_MAP_ARRAY) { + if (depth > 1 && t->Target != GL_TEXTURE_2D_ARRAY + && t->Target != GL_TEXTURE_CUBE_MAP_ARRAY) { depth /= 2; } @@ -675,22 +675,25 @@ _mesa_test_texobj_completeness( const struct gl_context *ctx, return; } if (img->Width2 != width) { - incomplete(t, MIPMAP, "TexImage[%d] bad width %u", i, img->Width2); + incomplete(t, MIPMAP, "TexImage[%d] bad width %u", i, + img->Width2); return; } if (img->Height2 != height) { - incomplete(t, MIPMAP, "TexImage[%d] bad height %u", i, img->Height2); + incomplete(t, MIPMAP, "TexImage[%d] bad height %u", i, + img->Height2); return; } if (img->Depth2 != depth) { - incomplete(t, MIPMAP, "TexImage[%d] bad depth %u", i, img->Depth2); + incomplete(t, MIPMAP, "TexImage[%d] bad depth %u", i, + img->Depth2); return; } /* Extra checks for cube textures */ if (face > 0) { /* check that cube faces are the same size */ - if (img->Width2 != t->Image[0][i]->Width2 || + if (img->Width2 != t->Image[0][i]->Width2 || img->Height2 != t->Image[0][i]->Height2) { incomplete(t, MIPMAP, "CubeMap Image[n][i] bad size"); return; @@ -698,7 +701,7 @@ _mesa_test_texobj_completeness( const struct gl_context *ctx, } } } - + if (width == 1 && height == 1 && depth == 1) { return; /* found smallest needed mipmap, all done! */ } @@ -950,6 +953,7 @@ _mesa_total_texture_memory(struct gl_context *ctx) return total; } + static struct gl_texture_object * invalidate_tex_image_error_check(struct gl_context *ctx, GLuint texture, GLint level, const char *name) @@ -1022,7 +1026,7 @@ invalidate_tex_image_error_check(struct gl_context *ctx, GLuint texture, * Calls _mesa_HashFindFreeKeyBlock() to find a block of free texture * IDs which are stored in \p textures. Corresponding empty texture * objects are also generated. - */ + */ void GLAPIENTRY _mesa_GenTextures( GLsizei n, GLuint *textures ) { @@ -1155,6 +1159,7 @@ unbind_texobj_from_image_units(struct gl_context *ctx, } } + /** * Unbinds all textures bound to the given texture image unit. */ @@ -1178,6 +1183,7 @@ unbind_textures_from_unit(struct gl_context *ctx, GLuint unit) } } + /** * Delete named textures. * @@ -1305,10 +1311,10 @@ _mesa_tex_target_to_index(const struct gl_context *ctx, GLenum target) /** * Bind a named texture to a texturing target. - * + * * \param target texture target. * \param texName texture name. - * + * * \sa glBindTexture(). * * Determines the old texture object bound and returns immediately if rebinding @@ -1350,7 +1356,9 @@ _mesa_BindTexture( GLenum target, GLuint texName ) if (newTexObj) { /* error checking */ if (newTexObj->Target != 0 && newTexObj->Target != target) { - /* the named texture object's target doesn't match the given target */ + /* The named texture object's target doesn't match the + * given target + */ _mesa_error( ctx, GL_INVALID_OPERATION, "glBindTexture(target mismatch)" ); return; @@ -1361,7 +1369,8 @@ _mesa_BindTexture( GLenum target, GLuint texName ) } else { if (ctx->API == API_OPENGL_CORE) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glBindTexture(non-gen name)"); + _mesa_error(ctx, GL_INVALID_OPERATION, + "glBindTexture(non-gen name)"); return; } @@ -1526,13 +1535,13 @@ _mesa_BindTextures(GLuint first, GLsizei count, const GLuint *textures) /** * Set texture priorities. - * + * * \param n number of textures. * \param texName texture names. * \param priorities corresponding texture priorities. - * + * * \sa glPrioritizeTextures(). - * + * * Looks up each texture in the hash, clamps the corresponding priority between * 0.0 and 1.0, and calls dd_function_table::PrioritizeTexture. */ @@ -1572,13 +1581,14 @@ _mesa_PrioritizeTextures( GLsizei n, const GLuint *texName, /** * See if textures are loaded in texture memory. - * + * * \param n number of textures to query. * \param texName array with the texture names. * \param residences array which will hold the residence status. * - * \return GL_TRUE if all textures are resident and \p residences is left unchanged, - * + * \return GL_TRUE if all textures are resident and + * residences is left unchanged, + * * Note: we assume all textures are always resident */ GLboolean GLAPIENTRY @@ -1614,7 +1624,7 @@ _mesa_AreTexturesResident(GLsizei n, const GLuint *texName, return GL_FALSE; } } - + return allResident; } @@ -1626,7 +1636,7 @@ _mesa_AreTexturesResident(GLsizei n, const GLuint *texName, * * \return GL_TRUE if texture name corresponds to a texture, or GL_FALSE * otherwise. - * + * * \sa glIsTexture(). * * Calls _mesa_HashLookup(). @@ -1681,6 +1691,7 @@ _mesa_unlock_context_textures( struct gl_context *ctx ) mtx_unlock(&ctx->Shared->TexMutex); } + void GLAPIENTRY _mesa_InvalidateTexSubImage(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, @@ -1827,6 +1838,7 @@ _mesa_InvalidateTexSubImage(GLuint texture, GLint level, GLint xoffset, return; } + void GLAPIENTRY _mesa_InvalidateTexImage(GLuint texture, GLint level) { diff --git a/mesalib/src/mesa/main/texobj.h b/mesalib/src/mesa/main/texobj.h index b1b7a3027..efcd7661e 100644 --- a/mesalib/src/mesa/main/texobj.h +++ b/mesalib/src/mesa/main/texobj.h @@ -38,6 +38,11 @@ #include "samplerobj.h" +#ifdef __cplusplus +extern "C" { +#endif + + /** * \name Internal functions */ @@ -212,4 +217,9 @@ _mesa_InvalidateTexImage(GLuint texture, GLint level); /*@}*/ +#ifdef __cplusplus +} +#endif + + #endif diff --git a/mesalib/src/mesa/main/texstore.c b/mesalib/src/mesa/main/texstore.c index f858cef50..50aa1fd5e 100644 --- a/mesalib/src/mesa/main/texstore.c +++ b/mesalib/src/mesa/main/texstore.c @@ -2231,7 +2231,7 @@ _mesa_compute_compressed_pixelstore(GLuint dims, mesa_format texFormat, if (packing->RowLength) { store->TotalBytesPerRow = packing->CompressedBlockSize * - (packing->RowLength + bw - 1) / bw; + ((packing->RowLength + bw - 1) / bw); } store->SkipBytes += packing->SkipPixels * packing->CompressedBlockSize / bw; diff --git a/mesalib/src/mesa/main/varray.c b/mesalib/src/mesa/main/varray.c index 96c2b26f7..89aaad1aa 100644 --- a/mesalib/src/mesa/main/varray.c +++ b/mesalib/src/mesa/main/varray.c @@ -258,11 +258,14 @@ update_array_format(struct gl_context *ctx, GLuint elementSize; GLenum format = GL_RGBA; - if (ctx->Array.LegalTypesMask == 0) { - /* One-time initialization. We can't do this in _mesa_init_varrays() - * below because extensions are not yet enabled at that point. + if (ctx->Array.LegalTypesMask == 0 || ctx->Array.LegalTypesMaskAPI != ctx->API) { + /* Compute the LegalTypesMask only once, unless the context API has + * changed, in which case we want to compute it again. We can't do this + * in _mesa_init_varrays() below because extensions are not yet enabled + * at that point. */ ctx->Array.LegalTypesMask = get_legal_types_mask(ctx); + ctx->Array.LegalTypesMaskAPI = ctx->API; } legalTypesMask &= ctx->Array.LegalTypesMask; diff --git a/mesalib/src/mesa/program/ir_to_mesa.cpp b/mesalib/src/mesa/program/ir_to_mesa.cpp index 5cd905822..ce3af3120 100644 --- a/mesalib/src/mesa/program/ir_to_mesa.cpp +++ b/mesalib/src/mesa/program/ir_to_mesa.cpp @@ -43,19 +43,18 @@ #include "linker.h" #include "main/mtypes.h" +#include "main/shaderapi.h" #include "main/shaderobj.h" #include "main/uniforms.h" -#include "program/hash_table.h" -extern "C" { -#include "main/shaderapi.h" +#include "program/hash_table.h" #include "program/prog_instruction.h" #include "program/prog_optimize.h" #include "program/prog_print.h" #include "program/program.h" #include "program/prog_parameter.h" #include "program/sampler.h" -} + static int swizzle_for_size(int size); @@ -2943,12 +2942,9 @@ _mesa_ir_link_shader(struct gl_context *ctx, struct gl_shader_program *prog) /* Lowering */ do_mat_op_to_vec(ir); - GLenum target = _mesa_shader_stage_to_program(prog->_LinkedShaders[i]->Stage); lower_instructions(ir, (MOD_TO_FRACT | DIV_TO_MUL_RCP | EXP_TO_EXP2 | LOG_TO_LOG2 | INT_DIV_TO_MUL_RCP - | ((options->EmitNoPow) ? POW_TO_EXP2 : 0) - | ((target == GL_VERTEX_PROGRAM_ARB) ? SAT_TO_CLAMP - : 0))); + | ((options->EmitNoPow) ? POW_TO_EXP2 : 0))); progress = do_lower_jumps(ir, true, true, options->EmitNoMainReturn, options->EmitNoCont, options->EmitNoLoops) || progress; diff --git a/mesalib/src/mesa/program/prog_cache.h b/mesalib/src/mesa/program/prog_cache.h index fdd7e264b..e37f1d7be 100644 --- a/mesalib/src/mesa/program/prog_cache.h +++ b/mesalib/src/mesa/program/prog_cache.h @@ -32,6 +32,12 @@ #include "main/glheader.h" + +#ifdef __cplusplus +extern "C" { +#endif + + struct gl_context; /** Opaque type */ @@ -65,4 +71,9 @@ _mesa_shader_cache_insert(struct gl_context *ctx, struct gl_shader_program *program); +#ifdef __cplusplus +} +#endif + + #endif /* PROG_CACHE_H */ diff --git a/mesalib/src/mesa/program/prog_execute.c b/mesalib/src/mesa/program/prog_execute.c index 650c40f2a..33c1751e8 100644 --- a/mesalib/src/mesa/program/prog_execute.c +++ b/mesalib/src/mesa/program/prog_execute.c @@ -298,15 +298,6 @@ fetch_vector1(const struct prog_src_register *source, } -static GLuint -fetch_vector1ui(const struct prog_src_register *source, - const struct gl_program_machine *machine) -{ - const GLuint *src = (GLuint *) get_src_register_pointer(source, machine); - return src[GET_SWZ(source->Swizzle, 0)]; -} - - /** * Fetch texel from texture. Use partial derivatives when possible. */ @@ -488,71 +479,6 @@ store_vector4(const struct prog_instruction *inst, /** - * Store 4 uints into a register. Observe the set-condition-code flags. - */ -static void -store_vector4ui(const struct prog_instruction *inst, - struct gl_program_machine *machine, const GLuint value[4]) -{ - const struct prog_dst_register *dstReg = &(inst->DstReg); - GLuint writeMask = dstReg->WriteMask; - GLuint *dst = (GLuint *) get_dst_register_pointer(dstReg, machine); - - if (dstReg->CondMask != COND_TR) { - /* condition codes may turn off some writes */ - if (writeMask & WRITEMASK_X) { - if (!test_cc(machine->CondCodes[GET_SWZ(dstReg->CondSwizzle, 0)], - dstReg->CondMask)) - writeMask &= ~WRITEMASK_X; - } - if (writeMask & WRITEMASK_Y) { - if (!test_cc(machine->CondCodes[GET_SWZ(dstReg->CondSwizzle, 1)], - dstReg->CondMask)) - writeMask &= ~WRITEMASK_Y; - } - if (writeMask & WRITEMASK_Z) { - if (!test_cc(machine->CondCodes[GET_SWZ(dstReg->CondSwizzle, 2)], - dstReg->CondMask)) - writeMask &= ~WRITEMASK_Z; - } - if (writeMask & WRITEMASK_W) { - if (!test_cc(machine->CondCodes[GET_SWZ(dstReg->CondSwizzle, 3)], - dstReg->CondMask)) - writeMask &= ~WRITEMASK_W; - } - } - - if (writeMask & WRITEMASK_X) - dst[0] = value[0]; - if (writeMask & WRITEMASK_Y) - dst[1] = value[1]; - if (writeMask & WRITEMASK_Z) - dst[2] = value[2]; - if (writeMask & WRITEMASK_W) - dst[3] = value[3]; - - if (inst->CondUpdate) { - if (writeMask & WRITEMASK_X) - machine->CondCodes[0] = generate_cc((float)value[0]); - if (writeMask & WRITEMASK_Y) - machine->CondCodes[1] = generate_cc((float)value[1]); - if (writeMask & WRITEMASK_Z) - machine->CondCodes[2] = generate_cc((float)value[2]); - if (writeMask & WRITEMASK_W) - machine->CondCodes[3] = generate_cc((float)value[3]); -#if DEBUG_PROG - printf("CondCodes=(%s,%s,%s,%s) for:\n", - _mesa_condcode_string(machine->CondCodes[0]), - _mesa_condcode_string(machine->CondCodes[1]), - _mesa_condcode_string(machine->CondCodes[2]), - _mesa_condcode_string(machine->CondCodes[3])); -#endif - } -} - - - -/** * Execute the given vertex/fragment program. * * \param ctx rendering context diff --git a/mesalib/src/mesa/program/prog_instruction.c b/mesalib/src/mesa/program/prog_instruction.c index 976024e3c..254c0128f 100644 --- a/mesalib/src/mesa/program/prog_instruction.c +++ b/mesalib/src/mesa/program/prog_instruction.c @@ -75,29 +75,6 @@ _mesa_alloc_instructions(GLuint numInst) /** - * Reallocate memory storing an array of program instructions. - * This is used when we need to append additional instructions onto an - * program. - * \param oldInst pointer to first of old/src instructions - * \param numOldInst number of instructions at <oldInst> - * \param numNewInst desired size of new instruction array. - * \return pointer to start of new instruction array. - */ -struct prog_instruction * -_mesa_realloc_instructions(struct prog_instruction *oldInst, - GLuint numOldInst, GLuint numNewInst) -{ - struct prog_instruction *newInst; - - newInst = (struct prog_instruction *) - realloc(oldInst, - numNewInst * sizeof(struct prog_instruction)); - - return newInst; -} - - -/** * Copy an array of program instructions. * \param dest pointer to destination. * \param src pointer to source. diff --git a/mesalib/src/mesa/program/prog_instruction.h b/mesalib/src/mesa/program/prog_instruction.h index de7880499..0957bd9d7 100644 --- a/mesalib/src/mesa/program/prog_instruction.h +++ b/mesalib/src/mesa/program/prog_instruction.h @@ -385,10 +385,6 @@ extern struct prog_instruction * _mesa_alloc_instructions(GLuint numInst); extern struct prog_instruction * -_mesa_realloc_instructions(struct prog_instruction *oldInst, - GLuint numOldInst, GLuint numNewInst); - -extern struct prog_instruction * _mesa_copy_instructions(struct prog_instruction *dest, const struct prog_instruction *src, GLuint n); diff --git a/mesalib/src/mesa/program/prog_optimize.h b/mesalib/src/mesa/program/prog_optimize.h index 7607bffdd..1f20ac0f8 100644 --- a/mesalib/src/mesa/program/prog_optimize.h +++ b/mesalib/src/mesa/program/prog_optimize.h @@ -29,6 +29,11 @@ #include "main/glheader.h" +#ifdef __cplusplus +extern "C" { +#endif + + struct gl_context; struct gl_program; struct prog_instruction; @@ -46,4 +51,10 @@ _mesa_optimize_program(struct gl_context *ctx, struct gl_program *program); extern GLboolean _mesa_constant_fold(struct gl_program *prog); + +#ifdef __cplusplus +} +#endif + + #endif diff --git a/mesalib/src/mesa/program/prog_parameter.c b/mesalib/src/mesa/program/prog_parameter.c index 896c6052b..0ef46415d 100644 --- a/mesalib/src/mesa/program/prog_parameter.c +++ b/mesalib/src/mesa/program/prog_parameter.c @@ -120,7 +120,7 @@ _mesa_add_parameter(struct gl_program_parameter_list *paramList, paramList->Size = paramList->Size + 4 * sz4; /* realloc arrays */ - paramList->Parameters = (struct gl_program_parameter *) + paramList->Parameters = realloc(paramList->Parameters, paramList->Size * sizeof(struct gl_program_parameter)); diff --git a/mesalib/src/mesa/program/prog_print.h b/mesalib/src/mesa/program/prog_print.h index cd61568e9..9058dfa76 100644 --- a/mesalib/src/mesa/program/prog_print.h +++ b/mesalib/src/mesa/program/prog_print.h @@ -31,6 +31,12 @@ #include "main/glheader.h" #include "main/mtypes.h" + +#ifdef __cplusplus +extern "C" { +#endif + + struct gl_program; struct gl_program_parameter_list; struct gl_shader; @@ -115,4 +121,9 @@ extern void _mesa_append_uniforms_to_file(const struct gl_shader *shader); +#ifdef __cplusplus +} +#endif + + #endif /* PROG_PRINT_H */ diff --git a/mesalib/src/mesa/program/programopt.h b/mesalib/src/mesa/program/programopt.h index f22109fb4..93c00f740 100644 --- a/mesalib/src/mesa/program/programopt.h +++ b/mesalib/src/mesa/program/programopt.h @@ -28,6 +28,12 @@ #include "main/mtypes.h" + +#ifdef __cplusplus +extern "C" { +#endif + + extern void _mesa_insert_mvp_code(struct gl_context *ctx, struct gl_vertex_program *vprog); @@ -52,4 +58,8 @@ extern void _mesa_nop_vertex_program(struct gl_context *ctx, struct gl_vertex_program *prog); +#ifdef __cplusplus +} +#endif + #endif /* PROGRAMOPT_H */ diff --git a/mesalib/src/mesa/program/sampler.cpp b/mesalib/src/mesa/program/sampler.cpp index 29a540871..f8584c968 100644 --- a/mesalib/src/mesa/program/sampler.cpp +++ b/mesalib/src/mesa/program/sampler.cpp @@ -27,15 +27,14 @@ #include "glsl_types.h" #include "ir_visitor.h" #include "../glsl/program.h" -#include "program/hash_table.h" #include "ir_uniform.h" -extern "C" { #include "main/compiler.h" #include "main/mtypes.h" +#include "program/hash_table.h" #include "program/prog_parameter.h" #include "program/program.h" -} + class get_sampler_name : public ir_hierarchical_visitor { @@ -104,7 +103,7 @@ public: }; -extern "C" int +int _mesa_get_sampler_uniform_value(class ir_dereference *sampler, struct gl_shader_program *shader_program, const struct gl_program *prog) @@ -136,7 +135,7 @@ _mesa_get_sampler_uniform_value(class ir_dereference *sampler, } -extern "C" class ir_rvalue * +class ir_rvalue * _mesa_get_sampler_array_nonconst_index(class ir_dereference *sampler) { ir_dereference_array *deref_arr = sampler->as_dereference_array(); diff --git a/mesalib/src/mesa/program/sampler.h b/mesalib/src/mesa/program/sampler.h index 8b7c3b63e..61c7f5851 100644 --- a/mesalib/src/mesa/program/sampler.h +++ b/mesalib/src/mesa/program/sampler.h @@ -23,6 +23,10 @@ * DEALINGS IN THE SOFTWARE. */ +#ifndef SAMPLER_H +#define SAMPLER_H + + int _mesa_get_sampler_uniform_value(class ir_dereference *sampler, struct gl_shader_program *shader_program, @@ -30,3 +34,6 @@ _mesa_get_sampler_uniform_value(class ir_dereference *sampler, class ir_rvalue * _mesa_get_sampler_array_nonconst_index(class ir_dereference *sampler); + + +#endif /* SAMPLER_H */ diff --git a/mesalib/src/mesa/state_tracker/st_context.c b/mesalib/src/mesa/state_tracker/st_context.c index 17235132e..9fd6caece 100644 --- a/mesalib/src/mesa/state_tracker/st_context.c +++ b/mesalib/src/mesa/state_tracker/st_context.c @@ -136,6 +136,8 @@ st_destroy_context_priv(struct st_context *st) if (st->constbuf_uploader) { u_upload_destroy(st->constbuf_uploader); } + + cso_destroy_context(st->cso_context); free( st ); } @@ -271,6 +273,8 @@ st_create_context_priv( struct gl_context *ctx, struct pipe_context *pipe, */ st->ctx->Point.MaxSize = MAX2(ctx->Const.MaxPointSize, ctx->Const.MaxPointSizeAA); + /* For vertex shaders, make sure not to emit saturate when SM 3.0 is not supported */ + ctx->Const.ShaderCompilerOptions[MESA_SHADER_VERTEX].EmitNoSat = !st->has_shader_model3; _mesa_compute_version(ctx); @@ -346,15 +350,11 @@ destroy_tex_sampler_cb(GLuint id, void *data, void *userData) void st_destroy_context( struct st_context *st ) { struct pipe_context *pipe = st->pipe; - struct cso_context *cso = st->cso_context; struct gl_context *ctx = st->ctx; GLuint i; _mesa_HashWalk(ctx->Shared->TexObjects, destroy_tex_sampler_cb, st); - /* need to unbind and destroy CSO objects before anything else */ - cso_release_all(st->cso_context); - st_reference_fragprog(st, &st->fp, NULL); st_reference_geomprog(st, &st->gp, NULL); st_reference_vertprog(st, &st->vp, NULL); @@ -384,8 +384,6 @@ void st_destroy_context( struct st_context *st ) st_destroy_context_priv(st); st = NULL; - cso_destroy_context(cso); - pipe->destroy( pipe ); free(ctx); diff --git a/mesalib/src/mesa/state_tracker/st_context.h b/mesalib/src/mesa/state_tracker/st_context.h index 15f9df492..20d567864 100644 --- a/mesalib/src/mesa/state_tracker/st_context.h +++ b/mesalib/src/mesa/state_tracker/st_context.h @@ -33,6 +33,12 @@ #include "state_tracker/st_api.h" #include "main/fbobject.h" + +#ifdef __cplusplus +extern "C" { +#endif + + struct bitmap_cache; struct dd_function_table; struct draw_context; @@ -278,4 +284,8 @@ extern void st_destroy_context(struct st_context *st); +#ifdef __cplusplus +} +#endif + #endif diff --git a/mesalib/src/mesa/state_tracker/st_extensions.c b/mesalib/src/mesa/state_tracker/st_extensions.c index bdfab8b41..e472b84a8 100644 --- a/mesalib/src/mesa/state_tracker/st_extensions.c +++ b/mesalib/src/mesa/state_tracker/st_extensions.c @@ -674,6 +674,10 @@ void st_init_extensions(struct pipe_screen *screen, consts->NativeIntegers = GL_TRUE; consts->MaxClipPlanes = 8; + if (screen->get_param(screen, PIPE_CAP_VERTEXID_NOBASE)) { + consts->VertexID_is_zero_based = GL_TRUE; + } + /* Extensions that either depend on GLSL 1.30 or are a subset thereof. */ extensions->ARB_conservative_depth = GL_TRUE; extensions->ARB_shading_language_packing = GL_TRUE; @@ -696,6 +700,9 @@ void st_init_extensions(struct pipe_screen *screen, extensions->EXT_shader_integer_mix = GL_TRUE; } + + /* Integer textures make no sense before GLSL 1.30 */ + extensions->EXT_texture_integer = GL_FALSE; } consts->UniformBooleanTrue = consts->NativeIntegers ? ~0 : fui(1.0f); diff --git a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index 8e91c4b61..89654344b 100644 --- a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -44,10 +44,8 @@ #include "main/mtypes.h" #include "main/shaderobj.h" #include "main/uniforms.h" -#include "program/hash_table.h" - -extern "C" { #include "main/shaderapi.h" +#include "program/hash_table.h" #include "program/prog_instruction.h" #include "program/prog_optimize.h" #include "program/prog_print.h" @@ -67,7 +65,7 @@ extern "C" { #include "st_program.h" #include "st_glsl_to_tgsi.h" #include "st_mesa_to_tgsi.h" -} + #define PROGRAM_IMMEDIATE PROGRAM_FILE_MAX #define PROGRAM_ANY_CONST ((1 << PROGRAM_STATE_VAR) | \ @@ -2288,6 +2286,37 @@ glsl_to_tgsi_visitor::process_move_condition(ir_rvalue *ir) bool switch_order = false; ir_expression *const expr = ir->as_expression(); + + if (native_integers) { + if ((expr != NULL) && (expr->get_num_operands() == 2)) { + enum glsl_base_type type = expr->operands[0]->type->base_type; + if (type == GLSL_TYPE_INT || type == GLSL_TYPE_UINT || + type == GLSL_TYPE_BOOL) { + if (expr->operation == ir_binop_equal) { + if (expr->operands[0]->is_zero()) { + src_ir = expr->operands[1]; + switch_order = true; + } + else if (expr->operands[1]->is_zero()) { + src_ir = expr->operands[0]; + switch_order = true; + } + } + else if (expr->operation == ir_binop_nequal) { + if (expr->operands[0]->is_zero()) { + src_ir = expr->operands[1]; + } + else if (expr->operands[1]->is_zero()) { + src_ir = expr->operands[0]; + } + } + } + } + + src_ir->accept(this); + return switch_order; + } + if ((expr != NULL) && (expr->get_num_operands() == 2)) { bool zero_on_left = false; @@ -2379,7 +2408,7 @@ glsl_to_tgsi_visitor::emit_block_mov(ir_assignment *ir, const struct glsl_type * const struct glsl_type *vec_type; vec_type = glsl_type::get_instance(GLSL_TYPE_FLOAT, - type->vector_elements, 1); + type->vector_elements, 1); for (int i = 0; i < type->matrix_columns; i++) { emit_block_mov(ir, vec_type, l, r); @@ -2447,7 +2476,7 @@ glsl_to_tgsi_visitor::visit(ir_assignment *ir) swizzles[i] = first_enabled_chan; } r.swizzle = MAKE_SWIZZLE4(swizzles[0], swizzles[1], - swizzles[2], swizzles[3]); + swizzles[2], swizzles[3]); } assert(l.file != PROGRAM_UNDEFINED); @@ -2460,24 +2489,21 @@ glsl_to_tgsi_visitor::visit(ir_assignment *ir) for (i = 0; i < type_size(ir->lhs->type); i++) { st_src_reg l_src = st_src_reg(l); st_src_reg condition_temp = condition; + st_src_reg op1, op2; l_src.swizzle = swizzle_for_size(ir->lhs->type->vector_elements); - + + op1 = r; + op2 = l_src; + if (switch_order) { + op1 = l_src; + op2 = r; + } + if (native_integers) { - /* This is necessary because TGSI's CMP instruction expects the - * condition to be a float, and we store booleans as integers. - * TODO: really want to avoid i2f path and use UCMP. Requires - * changes to process_move_condition though too. - */ - condition_temp = get_temp(glsl_type::vec4_type); - condition.negate = 0; - emit(ir, TGSI_OPCODE_I2F, st_dst_reg(condition_temp), condition); - condition_temp.swizzle = condition.swizzle; + emit(ir, TGSI_OPCODE_UCMP, l, condition_temp, op1, op2); } - - if (switch_order) { - emit(ir, TGSI_OPCODE_CMP, l, condition_temp, l_src, r); - } else { - emit(ir, TGSI_OPCODE_CMP, l, condition_temp, r, l_src); + else { + emit(ir, TGSI_OPCODE_CMP, l, condition_temp, op1, op2); } l.index++; @@ -3527,7 +3553,8 @@ glsl_to_tgsi_visitor::copy_propagate(void) first = copy_chan; } else { if (first->src[0].file != copy_chan->src[0].file || - first->src[0].index != copy_chan->src[0].index) { + first->src[0].index != copy_chan->src[0].index || + first->src[0].index2D != copy_chan->src[0].index2D) { good = false; break; } @@ -4167,8 +4194,8 @@ const unsigned _mesa_sysval_to_semantic[SYSTEM_VALUE_MAX] = { */ TGSI_SEMANTIC_VERTEXID, TGSI_SEMANTIC_INSTANCEID, - 0, - 0, + TGSI_SEMANTIC_VERTEXID_NOBASE, + TGSI_SEMANTIC_BASEVERTEX, /* Geometry shader */ @@ -4879,6 +4906,10 @@ st_translate_program( TGSI_SEMANTIC_SAMPLEMASK); assert(_mesa_sysval_to_semantic[SYSTEM_VALUE_INVOCATION_ID] == TGSI_SEMANTIC_INVOCATIONID); + assert(_mesa_sysval_to_semantic[SYSTEM_VALUE_VERTEX_ID_ZERO_BASE] == + TGSI_SEMANTIC_VERTEXID_NOBASE); + assert(_mesa_sysval_to_semantic[SYSTEM_VALUE_BASE_VERTEX] == + TGSI_SEMANTIC_BASEVERTEX); t = CALLOC_STRUCT(st_translate); if (!t) { @@ -5391,9 +5422,6 @@ st_link_shader(struct gl_context *ctx, struct gl_shader_program *prog) if (!pscreen->get_param(pscreen, PIPE_CAP_TEXTURE_GATHER_OFFSETS)) lower_offset_arrays(ir); do_mat_op_to_vec(ir); - /* Emit saturates in the vertex shader only if SM 3.0 is supported. */ - bool vs_sm3 = (_mesa_shader_stage_to_program(prog->_LinkedShaders[i]->Stage) == - GL_VERTEX_PROGRAM_ARB) && st_context(ctx)->has_shader_model3; lower_instructions(ir, MOD_TO_FRACT | DIV_TO_MUL_RCP | @@ -5404,7 +5432,7 @@ st_link_shader(struct gl_context *ctx, struct gl_shader_program *prog) BORROW_TO_ARITH | (options->EmitNoPow ? POW_TO_EXP2 : 0) | (!ctx->Const.NativeIntegers ? INT_DIV_TO_MUL_RCP : 0) | - (vs_sm3 ? SAT_TO_CLAMP : 0)); + (options->EmitNoSat ? SAT_TO_CLAMP : 0)); lower_ubo_reference(prog->_LinkedShaders[i], ir); do_vec_index_to_cond_assign(ir); diff --git a/mesalib/src/mesa/state_tracker/st_program.h b/mesalib/src/mesa/state_tracker/st_program.h index cf1b40a55..870d0d57a 100644 --- a/mesalib/src/mesa/state_tracker/st_program.h +++ b/mesalib/src/mesa/state_tracker/st_program.h @@ -41,6 +41,11 @@ #include "st_glsl_to_tgsi.h" +#ifdef __cplusplus +extern "C" { +#endif + + /** Fragment program variant key */ struct st_fp_variant_key { @@ -347,4 +352,8 @@ extern void st_print_current_vertex_program(void); +#ifdef __cplusplus +} +#endif + #endif diff --git a/mesalib/src/mesa/swrast/s_texfilter.c b/mesalib/src/mesa/swrast/s_texfilter.c index 65cf52e21..faeccae7c 100644 --- a/mesalib/src/mesa/swrast/s_texfilter.c +++ b/mesalib/src/mesa/swrast/s_texfilter.c @@ -73,7 +73,7 @@ lerp_2d(GLfloat a, GLfloat b, * Do 3D/trilinear interpolation of float values. * \sa lerp_2d */ -static inline GLfloat +static GLfloat lerp_3d(GLfloat a, GLfloat b, GLfloat c, GLfloat v000, GLfloat v100, GLfloat v010, GLfloat v110, GLfloat v001, GLfloat v101, GLfloat v011, GLfloat v111) @@ -91,7 +91,7 @@ lerp_3d(GLfloat a, GLfloat b, GLfloat c, /** * Do linear interpolation of colors. */ -static inline void +static void lerp_rgba(GLfloat result[4], GLfloat t, const GLfloat a[4], const GLfloat b[4]) { result[0] = LERP(t, a[0], b[0]); @@ -104,7 +104,7 @@ lerp_rgba(GLfloat result[4], GLfloat t, const GLfloat a[4], const GLfloat b[4]) /** * Do bilinear interpolation of colors. */ -static inline void +static void lerp_rgba_2d(GLfloat result[4], GLfloat a, GLfloat b, const GLfloat t00[4], const GLfloat t10[4], const GLfloat t01[4], const GLfloat t11[4]) @@ -119,7 +119,7 @@ lerp_rgba_2d(GLfloat result[4], GLfloat a, GLfloat b, /** * Do trilinear interpolation of colors. */ -static inline void +static void lerp_rgba_3d(GLfloat result[4], GLfloat a, GLfloat b, GLfloat c, const GLfloat t000[4], const GLfloat t100[4], const GLfloat t010[4], const GLfloat t110[4], @@ -155,7 +155,7 @@ lerp_rgba_3d(GLfloat result[4], GLfloat a, GLfloat b, GLfloat c, * i0, i1 = returns two nearest texel indexes * weight = returns blend factor between texels */ -static inline void +static void linear_texel_locations(GLenum wrapMode, const struct gl_texture_image *img, GLint size, GLfloat s, @@ -285,7 +285,7 @@ linear_texel_locations(GLenum wrapMode, /** * Used to compute texel location for nearest sampling. */ -static inline GLint +static GLint nearest_texel_location(GLenum wrapMode, const struct gl_texture_image *img, GLint size, GLfloat s) @@ -410,7 +410,7 @@ nearest_texel_location(GLenum wrapMode, /* Power of two image sizes only */ -static inline void +static void linear_repeat_texel_location(GLuint size, GLfloat s, GLint *i0, GLint *i1, GLfloat *weight) { @@ -424,7 +424,7 @@ linear_repeat_texel_location(GLuint size, GLfloat s, /** * Do clamp/wrap for a texture rectangle coord, GL_NEAREST filter mode. */ -static inline GLint +static GLint clamp_rect_coord_nearest(GLenum wrapMode, GLfloat coord, GLint max) { switch (wrapMode) { @@ -444,7 +444,7 @@ clamp_rect_coord_nearest(GLenum wrapMode, GLfloat coord, GLint max) /** * As above, but GL_LINEAR filtering. */ -static inline void +static void clamp_rect_coord_linear(GLenum wrapMode, GLfloat coord, GLint max, GLint *i0out, GLint *i1out, GLfloat *weight) { @@ -486,7 +486,7 @@ clamp_rect_coord_linear(GLenum wrapMode, GLfloat coord, GLint max, /** * Compute slice/image to use for 1D or 2D array texture. */ -static inline GLint +static GLint tex_array_slice(GLfloat coord, GLsizei size) { GLint slice = IFLOOR(coord + 0.5f); @@ -499,7 +499,7 @@ tex_array_slice(GLfloat coord, GLsizei size) * Compute nearest integer texcoords for given texobj and coordinate. * NOTE: only used for depth texture sampling. */ -static inline void +static void nearest_texcoord(const struct gl_sampler_object *samp, const struct gl_texture_object *texObj, GLuint level, @@ -548,7 +548,7 @@ nearest_texcoord(const struct gl_sampler_object *samp, * Compute linear integer texcoords for given texobj and coordinate. * NOTE: only used for depth texture sampling. */ -static inline void +static void linear_texcoord(const struct gl_sampler_object *samp, const struct gl_texture_object *texObj, GLuint level, @@ -607,7 +607,7 @@ linear_texcoord(const struct gl_sampler_object *samp, * For linear interpolation between mipmap levels N and N+1, this function * computes N. */ -static inline GLint +static GLint linear_mipmap_level(const struct gl_texture_object *tObj, GLfloat lambda) { if (lambda < 0.0F) @@ -622,7 +622,7 @@ linear_mipmap_level(const struct gl_texture_object *tObj, GLfloat lambda) /** * Compute the nearest mipmap level to take texels from. */ -static inline GLint +static GLint nearest_mipmap_level(const struct gl_texture_object *tObj, GLfloat lambda) { GLfloat l; @@ -658,7 +658,7 @@ nearest_mipmap_level(const struct gl_texture_object *tObj, GLfloat lambda) * will be minified, magnified, or split between the two. This function * determines the subranges in [0, n-1] that are to be minified or magnified. */ -static inline void +static void compute_min_mag_ranges(const struct gl_sampler_object *samp, GLuint n, const GLfloat lambda[], GLuint *minStart, GLuint *minEnd, @@ -767,7 +767,7 @@ compute_min_mag_ranges(const struct gl_sampler_object *samp, * the base texture format. Ex: if the texture base format it GL_ALPHA, * we return (0,0,0,BorderAlpha). */ -static inline void +static void get_border_color(const struct gl_sampler_object *samp, const struct gl_texture_image *img, GLfloat rgba[4]) @@ -804,7 +804,7 @@ get_border_color(const struct gl_sampler_object *samp, /** * Put z into texel according to GL_DEPTH_MODE. */ -static inline void +static void apply_depth_mode(GLenum depthMode, GLfloat z, GLfloat texel[4]) { switch (depthMode) { @@ -844,7 +844,7 @@ is_depth_texture(const struct gl_texture_object *tObj) /** * Return the texture sample for coordinate (s) using GL_NEAREST filter. */ -static inline void +static void sample_1d_nearest(struct gl_context *ctx, const struct gl_sampler_object *samp, const struct gl_texture_image *img, @@ -869,7 +869,7 @@ sample_1d_nearest(struct gl_context *ctx, /** * Return the texture sample for coordinate (s) using GL_LINEAR filter. */ -static inline void +static void sample_1d_linear(struct gl_context *ctx, const struct gl_sampler_object *samp, const struct gl_texture_image *img, @@ -1110,7 +1110,7 @@ sample_lambda_1d( struct gl_context *ctx, /** * Return the texture sample for coordinate (s,t) using GL_NEAREST filter. */ -static inline void +static void sample_2d_nearest(struct gl_context *ctx, const struct gl_sampler_object *samp, const struct gl_texture_image *img, @@ -1144,7 +1144,7 @@ sample_2d_nearest(struct gl_context *ctx, * Return the texture sample for coordinate (s,t) using GL_LINEAR filter. * New sampling code contributed by Lynn Quam <quam@ai.sri.com>. */ -static inline void +static void sample_2d_linear(struct gl_context *ctx, const struct gl_sampler_object *samp, const struct gl_texture_image *img, @@ -1209,7 +1209,7 @@ sample_2d_linear(struct gl_context *ctx, * As above, but we know WRAP_S == REPEAT and WRAP_T == REPEAT. * We don't have to worry about the texture border. */ -static inline void +static void sample_2d_linear_repeat(struct gl_context *ctx, const struct gl_sampler_object *samp, const struct gl_texture_image *img, @@ -1830,7 +1830,7 @@ sample_2d_footprint(struct gl_context *ctx, * Returns the index of the specified texture object in the * gl_context texture unit array. */ -static inline GLuint +static GLuint texture_unit_index(const struct gl_context *ctx, const struct gl_texture_object *tObj) { @@ -2012,7 +2012,7 @@ sample_lambda_2d_aniso(struct gl_context *ctx, /** * Return the texture sample for coordinate (s,t,r) using GL_NEAREST filter. */ -static inline void +static void sample_3d_nearest(struct gl_context *ctx, const struct gl_sampler_object *samp, const struct gl_texture_image *img, @@ -3416,7 +3416,7 @@ sample_lambda_1d_array(struct gl_context *ctx, /** * Compare texcoord against depth sample. Return 1.0 or 0.0 value. */ -static inline GLfloat +static GLfloat shadow_compare(GLenum function, GLfloat coord, GLfloat depthSample) { switch (function) { @@ -3448,7 +3448,7 @@ shadow_compare(GLenum function, GLfloat coord, GLfloat depthSample) /** * Compare texcoord against four depth samples. */ -static inline GLfloat +static GLfloat shadow_compare4(GLenum function, GLfloat coord, GLfloat depth00, GLfloat depth01, GLfloat depth10, GLfloat depth11, diff --git a/mesalib/src/mesa/vbo/vbo_exec_array.c b/mesalib/src/mesa/vbo/vbo_exec_array.c index e623b361a..6eac841b1 100644 --- a/mesalib/src/mesa/vbo/vbo_exec_array.c +++ b/mesalib/src/mesa/vbo/vbo_exec_array.c @@ -786,7 +786,7 @@ vbo_exec_DrawArrays(GLenum mode, GLint start, GLsizei count) _mesa_debug(ctx, "glDrawArrays(%s, %d, %d)\n", _mesa_lookup_enum_by_nr(mode), start, count); - if (!_mesa_validate_DrawArrays( ctx, mode, start, count )) + if (!_mesa_validate_DrawArrays(ctx, mode, count)) return; if (0) @@ -1022,8 +1022,8 @@ vbo_exec_DrawRangeElementsBaseVertex(GLenum mode, _mesa_lookup_enum_by_nr(mode), start, end, count, _mesa_lookup_enum_by_nr(type), indices, basevertex); - if (!_mesa_validate_DrawRangeElements( ctx, mode, start, end, count, - type, indices, basevertex )) + if (!_mesa_validate_DrawRangeElements(ctx, mode, start, end, count, + type, indices)) return; if ((int) end + basevertex < 0 || @@ -1120,7 +1120,7 @@ vbo_exec_DrawElements(GLenum mode, GLsizei count, GLenum type, _mesa_lookup_enum_by_nr(mode), count, _mesa_lookup_enum_by_nr(type), indices); - if (!_mesa_validate_DrawElements( ctx, mode, count, type, indices, 0 )) + if (!_mesa_validate_DrawElements(ctx, mode, count, type, indices)) return; vbo_validated_drawrangeelements(ctx, mode, GL_FALSE, ~0, ~0, @@ -1142,8 +1142,7 @@ vbo_exec_DrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type, _mesa_lookup_enum_by_nr(mode), count, _mesa_lookup_enum_by_nr(type), indices, basevertex); - if (!_mesa_validate_DrawElements( ctx, mode, count, type, indices, - basevertex )) + if (!_mesa_validate_DrawElements(ctx, mode, count, type, indices)) return; vbo_validated_drawrangeelements(ctx, mode, GL_FALSE, ~0, ~0, @@ -1166,7 +1165,7 @@ vbo_exec_DrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, _mesa_lookup_enum_by_nr(type), indices, numInstances); if (!_mesa_validate_DrawElementsInstanced(ctx, mode, count, type, indices, - numInstances, 0)) + numInstances)) return; vbo_validated_drawrangeelements(ctx, mode, GL_FALSE, ~0, ~0, @@ -1191,7 +1190,7 @@ vbo_exec_DrawElementsInstancedBaseVertex(GLenum mode, GLsizei count, GLenum type numInstances, basevertex); if (!_mesa_validate_DrawElementsInstanced(ctx, mode, count, type, indices, - numInstances, basevertex)) + numInstances)) return; vbo_validated_drawrangeelements(ctx, mode, GL_FALSE, ~0, ~0, @@ -1216,7 +1215,7 @@ vbo_exec_DrawElementsInstancedBaseInstance(GLenum mode, GLsizei count, GLenum ty numInstances, baseInstance); if (!_mesa_validate_DrawElementsInstanced(ctx, mode, count, type, indices, - numInstances, 0)) + numInstances)) return; vbo_validated_drawrangeelements(ctx, mode, GL_FALSE, ~0, ~0, @@ -1242,7 +1241,7 @@ vbo_exec_DrawElementsInstancedBaseVertexBaseInstance(GLenum mode, GLsizei count, numInstances, basevertex, baseInstance); if (!_mesa_validate_DrawElementsInstanced(ctx, mode, count, type, indices, - numInstances, basevertex)) + numInstances)) return; vbo_validated_drawrangeelements(ctx, mode, GL_FALSE, ~0, ~0, @@ -1399,7 +1398,7 @@ vbo_exec_MultiDrawElements(GLenum mode, GET_CURRENT_CONTEXT(ctx); if (!_mesa_validate_MultiDrawElements(ctx, mode, count, type, indices, - primcount, NULL)) + primcount)) return; vbo_validated_multidrawelements(ctx, mode, count, type, indices, primcount, @@ -1417,7 +1416,7 @@ vbo_exec_MultiDrawElementsBaseVertex(GLenum mode, GET_CURRENT_CONTEXT(ctx); if (!_mesa_validate_MultiDrawElements(ctx, mode, count, type, indices, - primcount, basevertex)) + primcount)) return; vbo_validated_multidrawelements(ctx, mode, count, type, indices, primcount, diff --git a/mesalib/src/mesa/vbo/vbo_save_api.c b/mesalib/src/mesa/vbo/vbo_save_api.c index 848eedaa4..5055c221b 100644 --- a/mesalib/src/mesa/vbo/vbo_save_api.c +++ b/mesalib/src/mesa/vbo/vbo_save_api.c @@ -1523,18 +1523,22 @@ vbo_destroy_vertex_list(struct gl_context *ctx, void *data) static void -vbo_print_vertex_list(struct gl_context *ctx, void *data) +vbo_print_vertex_list(struct gl_context *ctx, void *data, FILE *f) { struct vbo_save_vertex_list *node = (struct vbo_save_vertex_list *) data; GLuint i; + struct gl_buffer_object *buffer = node->vertex_store ? + node->vertex_store->bufferobj : NULL; (void) ctx; - printf("VBO-VERTEX-LIST, %u vertices %d primitives, %d vertsize\n", - node->count, node->prim_count, node->vertex_size); + fprintf(f, "VBO-VERTEX-LIST, %u vertices %d primitives, %d vertsize " + "buffer %p\n", + node->count, node->prim_count, node->vertex_size, + buffer); for (i = 0; i < node->prim_count; i++) { struct _mesa_prim *prim = &node->prim[i]; - printf(" prim %d: %s%s %d..%d %s %s\n", + fprintf(f, " prim %d: %s%s %d..%d %s %s\n", i, _mesa_lookup_prim_by_nr(prim->mode), prim->weak ? " (weak)" : "", diff --git a/mesalib/src/mesa/x86/3dnow.c b/mesalib/src/mesa/x86/3dnow.c index 4e3003b43..c46cfbc57 100644 --- a/mesalib/src/mesa/x86/3dnow.c +++ b/mesalib/src/mesa/x86/3dnow.c @@ -46,8 +46,6 @@ DECLARE_XFORM_GROUP( 3dnow, 2 ) DECLARE_XFORM_GROUP( 3dnow, 3 ) DECLARE_XFORM_GROUP( 3dnow, 4 ) -DECLARE_NORM_GROUP( 3dnow ) - extern void _ASMAPI _mesa_v16_3dnow_general_xform( GLfloat *first_vert, @@ -78,11 +76,6 @@ void _mesa_init_3dnow_transform_asm( void ) ASSIGN_XFORM_GROUP( 3dnow, 3 ); ASSIGN_XFORM_GROUP( 3dnow, 4 ); - /* There's a bug somewhere in the 3dnow_normal.S file that causes - * bad shading. Disable for now. - ASSIGN_NORM_GROUP( 3dnow ); - */ - #ifdef DEBUG_MATH _math_test_all_transform_functions( "3DNow!" ); _math_test_all_normal_transform_functions( "3DNow!" ); diff --git a/mesalib/src/mesa/x86/3dnow_normal.S b/mesalib/src/mesa/x86/3dnow_normal.S deleted file mode 100644 index ca95f2548..000000000 --- a/mesalib/src/mesa/x86/3dnow_normal.S +++ /dev/null @@ -1,852 +0,0 @@ - -/* - * Mesa 3-D graphics library - * - * Copyright (C) 1999-2003 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * 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. - */ - -/* - * 3Dnow assembly code by Holger Waechtler - */ - -#ifdef USE_3DNOW_ASM - -#include "assyntax.h" -#include "matypes.h" -#include "norm_args.h" - - SEG_TEXT - -#define M(i) REGOFF(i * 4, ECX) -#define STRIDE REGOFF(12, ESI) - - -ALIGNTEXT16 -GLOBL GLNAME(_mesa_3dnow_transform_normalize_normals) -HIDDEN(_mesa_3dnow_transform_normalize_normals) -GLNAME(_mesa_3dnow_transform_normalize_normals): - -#define FRAME_OFFSET 12 - - PUSH_L ( EDI ) - PUSH_L ( ESI ) - PUSH_L ( EBP ) - - MOV_L ( ARG_LENGTHS, EDI ) - MOV_L ( ARG_IN, ESI ) - MOV_L ( ARG_DEST, EAX ) - MOV_L ( REGOFF(V4F_COUNT, ESI), EBP ) /* dest->count = in->count */ - MOV_L ( EBP, REGOFF(V4F_COUNT, EAX) ) - MOV_L ( REGOFF(V4F_START, ESI), EDX ) /* in->start */ - MOV_L ( REGOFF(V4F_START, EAX), EAX ) /* dest->start */ - MOV_L ( ARG_MAT, ECX ) - MOV_L ( REGOFF(MATRIX_INV, ECX), ECX ) /* mat->inv */ - - CMP_L ( CONST(0), EBP ) /* count > 0 ?? */ - JE ( LLBL (G3TN_end) ) - - MOV_L ( REGOFF (V4F_COUNT, ESI), EBP ) - FEMMS - - PUSH_L ( EBP ) - PUSH_L ( EAX ) - PUSH_L ( EDX ) /* save counter & pointer for */ - /* the normalize pass */ -#undef FRAME_OFFSET -#define FRAME_OFFSET 24 - - MOVQ ( M(0), MM3 ) /* m1 | m0 */ - MOVQ ( M(4), MM4 ) /* m5 | m4 */ - - MOVD ( M(2), MM5 ) /* | m2 */ - PUNPCKLDQ ( M(6), MM5 ) /* m6 | m2 */ - - MOVQ ( M(8), MM6 ) /* m9 | m8 */ - MOVQ ( M(10), MM7 ) /* | m10 */ - - CMP_L ( CONST(0), EDI ) /* lengths == 0 ? */ - JNE ( LLBL (G3TN_scale_end ) ) - - MOVD ( ARG_SCALE, MM0 ) /* | scale */ - PUNPCKLDQ ( MM0, MM0 ) /* scale | scale */ - - PFMUL ( MM0, MM3 ) /* scale * m1 | scale * m0 */ - PFMUL ( MM0, MM4 ) /* scale * m5 | scale * m4 */ - PFMUL ( MM0, MM5 ) /* scale * m6 | scale * m2 */ - PFMUL ( MM0, MM6 ) /* scale * m9 | scale * m8 */ - PFMUL ( MM0, MM7 ) /* | scale * m10 */ - -ALIGNTEXT32 -LLBL (G3TN_scale_end): -LLBL (G3TN_transform): - MOVQ ( REGIND (EDX), MM0 ) /* x1 | x0 */ - MOVD ( REGOFF (8, EDX), MM2 ) /* | x2 */ - - MOVQ ( MM0, MM1 ) /* x1 | x0 */ - PUNPCKLDQ ( MM2, MM2 ) /* x2 | x2 */ - - PFMUL ( MM3, MM0 ) /* x1*m1 | x0*m0 */ - ADD_L ( CONST(16), EAX ) /* next r */ - - PREFETCHW ( REGIND(EAX) ) - - PFMUL ( MM4, MM1 ) /* x1*m5 | x0*m4 */ - PFACC ( MM1, MM0 ) /* x0*m4+x1*m5 | x0*m0+x1*m1 */ - - PFMUL ( MM5, MM2 ) /* x2*m6 | x2*m2 */ - PFADD ( MM2, MM0 ) /* x0*m4+x1*m5+x2*m6| x0*m0+...+x2**/ - - MOVQ ( REGIND (EDX), MM1 ) /* x1 | x0 */ - MOVQ ( MM0, REGOFF(-16, EAX) ) /* write r0, r1 */ - - PFMUL ( MM6, MM1 ) /* x1*m9 | x0*m8 */ - MOVD ( REGOFF (8, EDX), MM2 ) /* | x2 */ - - PFMUL ( MM7, MM2 ) /* | x2*m10 */ - PFACC ( MM1, MM1 ) /* *not used* | x0*m8+x1*m9 */ - - PFADD ( MM2, MM1 ) /* *not used* | x0*m8+x1*m9+x2*m*/ - ADD_L ( STRIDE, EDX ) /* next normal */ - - PREFETCH ( REGIND(EDX) ) - - MOVD ( MM1, REGOFF(-8, EAX) ) /* write r2 */ - SUB_L ( CONST(1), EBP ) /* decrement normal counter */ - JNZ ( LLBL (G3TN_transform) ) - - - POP_L ( EDX ) /* end of transform --- */ - POP_L ( EAX ) /* now normalizing ... */ - POP_L ( EBP ) - - CMP_L ( CONST(0), EDI ) /* lengths == 0 ? */ - JE ( LLBL (G3TN_norm ) ) /* calculate lengths */ - - -ALIGNTEXT32 -LLBL (G3TN_norm_w_lengths): - - PREFETCHW ( REGOFF(12,EAX) ) - - MOVQ ( REGIND(EAX), MM0 ) /* x1 | x0 */ - MOVD ( REGOFF(8, EAX), MM1 ) /* | x2 */ - - MOVD ( REGIND (EDI), MM3 ) /* | length (x) */ - PFMUL ( MM3, MM1 ) /* | x2 (normalize*/ - - PUNPCKLDQ ( MM3, MM3 ) /* length (x) | length (x) */ - PFMUL ( MM3, MM0 ) /* x1 (normalized) | x0 (normalize*/ - - ADD_L ( STRIDE, EDX ) /* next normal */ - ADD_L ( CONST(4), EDI ) /* next length */ - - PREFETCH ( REGIND(EDI) ) - - MOVQ ( MM0, REGIND(EAX) ) /* write new x0, x1 */ - MOVD ( MM1, REGOFF(8, EAX) ) /* write new x2 */ - - ADD_L ( CONST(16), EAX ) /* next r */ - SUB_L ( CONST(1), EBP ) /* decrement normal counter */ - - JNZ ( LLBL (G3TN_norm_w_lengths) ) - JMP ( LLBL (G3TN_exit_3dnow) ) - -ALIGNTEXT32 -LLBL (G3TN_norm): - - PREFETCHW ( REGIND(EAX) ) - - MOVQ ( REGIND (EAX), MM0 ) /* x1 | x0 */ - MOVD ( REGOFF(8, EAX), MM1 ) /* | x2 */ - - MOVQ ( MM0, MM3 ) /* x1 | x0 */ - MOVQ ( MM1, MM4 ) /* | x2 */ - - PFMUL ( MM0, MM3 ) /* x1*x1 | x0*x0 */ - ADD_L ( CONST(16), EAX ) /* next r */ - - PFMUL ( MM1, MM4 ) /* | x2*x2 */ - PFADD ( MM4, MM3 ) /* | x0*x0+x2*x2 */ - - PFACC ( MM3, MM3 ) /* **not used** | x0*x0+x1*x1+x2**/ - PFRSQRT ( MM3, MM5 ) /* 1/sqrt (x0*x0+x1*x1+x2*x2) */ - - MOVQ ( MM5, MM4 ) - PUNPCKLDQ ( MM3, MM3 ) - - SUB_L ( CONST(1), EBP ) /* decrement normal counter */ - PFMUL ( MM5, MM5 ) - - PFRSQIT1 ( MM3, MM5 ) - PFRCPIT2 ( MM4, MM5 ) - - PFMUL ( MM5, MM0 ) /* x1 (normalized) | x0 (normalize*/ - - MOVQ ( MM0, REGOFF(-16, EAX) ) /* write new x0, x1 */ - PFMUL ( MM5, MM1 ) /* | x2 (normalize*/ - - MOVD ( MM1, REGOFF(-8, EAX) ) /* write new x2 */ - JNZ ( LLBL (G3TN_norm) ) - -LLBL (G3TN_exit_3dnow): - FEMMS - -LLBL (G3TN_end): - POP_L ( EBP ) - POP_L ( ESI ) - POP_L ( EDI ) - RET - - - -ALIGNTEXT16 -GLOBL GLNAME(_mesa_3dnow_transform_normalize_normals_no_rot) -HIDDEN(_mesa_3dnow_transform_normalize_normals_no_rot) -GLNAME(_mesa_3dnow_transform_normalize_normals_no_rot): - -#undef FRAME_OFFSET -#define FRAME_OFFSET 12 - - PUSH_L ( EDI ) - PUSH_L ( ESI ) - PUSH_L ( EBP ) - - MOV_L ( ARG_LENGTHS, EDI ) - MOV_L ( ARG_IN, ESI ) - MOV_L ( ARG_DEST, EAX ) - MOV_L ( REGOFF(V4F_COUNT, ESI), EBP ) /* dest->count = in->count */ - MOV_L ( EBP, REGOFF(V4F_COUNT, EAX) ) - MOV_L ( ARG_MAT, ECX ) - MOV_L ( REGOFF(V4F_START, EAX), EAX ) /* dest->start */ - MOV_L ( REGOFF(MATRIX_INV, ECX), ECX ) /* mat->inv */ - MOV_L ( REGOFF(V4F_START, ESI), EDX ) /* in->start */ - - CMP_L ( CONST(0), EBP ) /* count > 0 ?? */ - JE ( LLBL (G3TNNR_end) ) - - FEMMS - - MOVD ( M(0), MM0 ) /* | m0 */ - PUNPCKLDQ ( M(5), MM0 ) /* m5 | m0 */ - - MOVD ( M(10), MM2 ) /* | m10 */ - PUNPCKLDQ ( MM2, MM2 ) /* m10 | m10 */ - - CMP_L ( CONST(0), EDI ) /* lengths == 0 ? */ - JNE ( LLBL (G3TNNR_scale_end ) ) - - MOVD ( ARG_SCALE, MM7 ) /* | scale */ - PUNPCKLDQ ( MM7, MM7 ) /* scale | scale */ - - PFMUL ( MM7, MM0 ) /* scale * m5 | scale * m0 */ - PFMUL ( MM7, MM2 ) /* scale * m10 | scale * m10 */ - -ALIGNTEXT32 -LLBL (G3TNNR_scale_end): - CMP_L ( CONST(0), EDI ) /* lengths == 0 ? */ - JE ( LLBL (G3TNNR_norm) ) /* need to calculate lengths */ - - MOVD ( REGIND(EDI), MM3 ) /* | length (x) */ - - -ALIGNTEXT32 -LLBL (G3TNNR_norm_w_lengths): /* use precalculated lengths */ - - PREFETCHW ( REGIND(EAX) ) - - MOVQ ( REGIND(EDX), MM6 ) /* x1 | x0 */ - MOVD ( REGOFF(8, EDX), MM7 ) /* | x2 */ - - PFMUL ( MM0, MM6 ) /* x1*m5 | x0*m0 */ - ADD_L ( STRIDE, EDX ) /* next normal */ - - PREFETCH ( REGIND(EDX) ) - - PFMUL ( MM2, MM7 ) /* | x2*m10 */ - ADD_L ( CONST(16), EAX ) /* next r */ - - PFMUL ( MM3, MM7 ) /* | x2 (normalized) */ - PUNPCKLDQ ( MM3, MM3 ) /* length (x) | length (x) */ - - ADD_L ( CONST(4), EDI ) /* next length */ - PFMUL ( MM3, MM6 ) /* x1 (normalized) | x0 (normalized) */ - - SUB_L ( CONST(1), EBP ) /* decrement normal counter */ - MOVQ ( MM6, REGOFF(-16, EAX) ) /* write r0, r1 */ - - MOVD ( MM7, REGOFF(-8, EAX) ) /* write r2 */ - MOVD ( REGIND(EDI), MM3 ) /* | length (x) */ - - JNZ ( LLBL (G3TNNR_norm_w_lengths) ) - JMP ( LLBL (G3TNNR_exit_3dnow) ) - -ALIGNTEXT32 -LLBL (G3TNNR_norm): /* need to calculate lengths */ - - PREFETCHW ( REGIND(EAX) ) - - MOVQ ( REGIND(EDX), MM6 ) /* x1 | x0 */ - MOVD ( REGOFF(8, EDX), MM7 ) /* | x2 */ - - PFMUL ( MM0, MM6 ) /* x1*m5 | x0*m0 */ - ADD_L ( CONST(16), EAX ) /* next r */ - - PFMUL ( MM2, MM7 ) /* | x2*m10 */ - MOVQ ( MM6, MM3 ) /* x1 (transformed)| x0 (transformed) */ - - MOVQ ( MM7, MM4 ) /* | x2 (transformed) */ - PFMUL ( MM6, MM3 ) /* x1*x1 | x0*x0 */ - - - PFMUL ( MM7, MM4 ) /* | x2*x2 */ - PFACC ( MM3, MM3 ) /* **not used** | x0*x0+x1*x1 */ - - PFADD ( MM4, MM3 ) /* | x0*x0+x1*x1+x2*x2*/ - ADD_L ( STRIDE, EDX ) /* next normal */ - - PREFETCH ( REGIND(EDX) ) - - PFRSQRT ( MM3, MM5 ) /* 1/sqrt (x0*x0+x1*x1+x2*x2) */ - MOVQ ( MM5, MM4 ) - - PUNPCKLDQ ( MM3, MM3 ) - PFMUL ( MM5, MM5 ) - - PFRSQIT1 ( MM3, MM5 ) - SUB_L ( CONST(1), EBP ) /* decrement normal counter */ - - PFRCPIT2 ( MM4, MM5 ) - PFMUL ( MM5, MM6 ) /* x1 (normalized) | x0 (normalized) */ - - MOVQ ( MM6, REGOFF(-16, EAX) ) /* write r0, r1 */ - PFMUL ( MM5, MM7 ) /* | x2 (normalized) */ - - MOVD ( MM7, REGOFF(-8, EAX) ) /* write r2 */ - JNZ ( LLBL (G3TNNR_norm) ) - - -LLBL (G3TNNR_exit_3dnow): - FEMMS - -LLBL (G3TNNR_end): - POP_L ( EBP ) - POP_L ( ESI ) - POP_L ( EDI ) - RET - - - - - - -ALIGNTEXT16 -GLOBL GLNAME(_mesa_3dnow_transform_rescale_normals_no_rot) -HIDDEN(_mesa_3dnow_transform_rescale_normals_no_rot) -GLNAME(_mesa_3dnow_transform_rescale_normals_no_rot): - -#undef FRAME_OFFSET -#define FRAME_OFFSET 12 - - PUSH_L ( EDI ) - PUSH_L ( ESI ) - PUSH_L ( EBP ) - - MOV_L ( ARG_IN, EAX ) - MOV_L ( ARG_DEST, EDX ) - MOV_L ( REGOFF(V4F_COUNT, EAX), EBP ) /* dest->count = in->count */ - MOV_L ( EBP, REGOFF(V4F_COUNT, EDX) ) - MOV_L ( ARG_IN, ESI ) - MOV_L ( ARG_MAT, ECX ) - MOV_L ( REGOFF(MATRIX_INV, ECX), ECX ) /* mat->inv */ - MOV_L ( REGOFF(V4F_START, EDX), EAX ) /* dest->start */ - MOV_L ( REGOFF(V4F_START, ESI), EDX ) /* in->start */ - - CMP_L ( CONST(0), EBP ) - JE ( LLBL (G3TRNR_end) ) - - FEMMS - - MOVD ( ARG_SCALE, MM6 ) /* | scale */ - PUNPCKLDQ ( MM6, MM6 ) /* scale | scale */ - - MOVD ( REGIND(ECX), MM0 ) /* | m0 */ - PUNPCKLDQ ( REGOFF(20, ECX), MM0 ) /* m5 | m0 */ - - PFMUL ( MM6, MM0 ) /* scale*m5 | scale*m0 */ - MOVD ( REGOFF(40, ECX), MM2 ) /* | m10 */ - - PFMUL ( MM6, MM2 ) /* | scale*m10 */ - -ALIGNTEXT32 -LLBL (G3TRNR_rescale): - - PREFETCHW ( REGIND(EAX) ) - - MOVQ ( REGIND(EDX), MM4 ) /* x1 | x0 */ - MOVD ( REGOFF(8, EDX), MM5 ) /* | x2 */ - - PFMUL ( MM0, MM4 ) /* x1*m5 | x0*m0 */ - ADD_L ( STRIDE, EDX ) /* next normal */ - - PREFETCH ( REGIND(EDX) ) - - PFMUL ( MM2, MM5 ) /* | x2*m10 */ - ADD_L ( CONST(16), EAX ) /* next r */ - - SUB_L ( CONST(1), EBP ) /* decrement normal counter */ - MOVQ ( MM4, REGOFF(-16, EAX) ) /* write r0, r1 */ - - MOVD ( MM5, REGOFF(-8, EAX) ) /* write r2 */ - JNZ ( LLBL (G3TRNR_rescale) ) /* cnt > 0 ? -> process next normal */ - - FEMMS - -LLBL (G3TRNR_end): - POP_L ( EBP ) - POP_L ( ESI ) - POP_L ( EDI ) - RET - - - - - -ALIGNTEXT16 -GLOBL GLNAME(_mesa_3dnow_transform_rescale_normals) -HIDDEN(_mesa_3dnow_transform_rescale_normals) -GLNAME(_mesa_3dnow_transform_rescale_normals): - -#undef FRAME_OFFSET -#define FRAME_OFFSET 8 - - PUSH_L ( EDI ) - PUSH_L ( ESI ) - - MOV_L ( ARG_IN, ESI ) - MOV_L ( ARG_DEST, EAX ) - MOV_L ( ARG_MAT, ECX ) - MOV_L ( REGOFF(V4F_COUNT, ESI), EDI ) /* dest->count = in->count */ - MOV_L ( EDI, REGOFF(V4F_COUNT, EAX) ) - MOV_L ( REGOFF(V4F_START, EAX), EAX ) /* dest->start */ - MOV_L ( REGOFF(V4F_START, ESI), EDX ) /* in->start */ - MOV_L ( REGOFF(MATRIX_INV, ECX), ECX ) /* mat->inv */ - - CMP_L ( CONST(0), EDI ) - JE ( LLBL (G3TR_end) ) - - FEMMS - - MOVQ ( REGIND(ECX), MM3 ) /* m1 | m0 */ - - MOVQ ( REGOFF(16,ECX), MM4 ) /* m5 | m4 */ - MOVD ( ARG_SCALE, MM0 ) /* scale */ - - MOVD ( REGOFF(8,ECX), MM5 ) /* | m2 */ - PUNPCKLDQ ( MM0, MM0 ) /* scale | scale */ - - PUNPCKLDQ ( REGOFF(24, ECX), MM5 ) - PFMUL ( MM0, MM3 ) /* scale*m1 | scale*m0 */ - - MOVQ ( REGOFF(32, ECX), MM6 ) /* m9 | m8*/ - PFMUL ( MM0, MM4 ) /* scale*m5 | scale*m4 */ - - MOVD ( REGOFF(40, ECX), MM7 ) /* | m10 */ - PFMUL ( MM0, MM5 ) /* scale*m6 | scale*m2 */ - - PFMUL ( MM0, MM6 ) /* scale*m9 | scale*m8 */ - - PFMUL ( MM0, MM7 ) /* | scale*m10 */ - -ALIGNTEXT32 -LLBL (G3TR_rescale): - - PREFETCHW ( REGIND(EAX) ) - - MOVQ ( REGIND(EDX), MM0 ) /* x1 | x0 */ - MOVD ( REGOFF(8, EDX), MM2 ) /* | x2 */ - - MOVQ ( MM0, MM1 ) /* x1 | x0 */ - PUNPCKLDQ ( MM2, MM2 ) /* x2 | x2 */ - - PFMUL ( MM3, MM0 ) /* x1*m1 | x0*m0 */ - ADD_L ( CONST(16), EAX ) /* next r */ - - PFMUL ( MM4, MM1 ) /* x1*m5 | x0*m4 */ - PFACC ( MM1, MM0 ) /* x0*m4+x1*m5 | x0*m0+x1*m1 */ - - MOVQ ( REGIND(EDX), MM1 ) /* x1 | x0 */ - - PFMUL ( MM5, MM2 ) /* x2*m6 | x2*m2 */ - PFADD ( MM2, MM0 ) /* x0*m4...+x2*m6| x0*m0+x1*m1+x2*m2 */ - - MOVD ( REGOFF(8, EDX), MM2 ) /* | x2 */ - ADD_L ( STRIDE, EDX ) /* next normal */ - - PREFETCH ( REGIND(EDX) ) - - MOVQ ( MM0, REGOFF(-16, EAX) ) /* write r0, r1 */ - PFMUL ( MM6, MM1 ) /* x1*m9 | x0*m8 */ - - PFMUL ( MM7, MM2 ) /* | x2*m10 */ - PFACC ( MM1, MM1 ) /* *not used* | x0*m8+x1*m9 */ - - PFADD ( MM2, MM1 ) /* *not used* | x0*m8+x1*m9+x2*m10 */ - MOVD ( MM1, REGOFF(-8, EAX) ) /* write r2 */ - - SUB_L ( CONST(1), EDI ) /* decrement normal counter */ - JNZ ( LLBL (G3TR_rescale) ) - - FEMMS - -LLBL (G3TR_end): - POP_L ( ESI ) - POP_L ( EDI ) - RET - - - - - - - -ALIGNTEXT16 -GLOBL GLNAME(_mesa_3dnow_transform_normals_no_rot) -HIDDEN(_mesa_3dnow_transform_normals_no_rot) -GLNAME(_mesa_3dnow_transform_normals_no_rot): - -#undef FRAME_OFFSET -#define FRAME_OFFSET 8 - - PUSH_L ( EDI ) - PUSH_L ( ESI ) - - MOV_L ( ARG_IN, ESI ) - MOV_L ( ARG_DEST, EAX ) - MOV_L ( ARG_MAT, ECX ) - MOV_L ( REGOFF(V4F_COUNT, ESI), EDI ) /* dest->count = in->count */ - MOV_L ( EDI, REGOFF(V4F_COUNT, EAX) ) - MOV_L ( REGOFF(V4F_START, EAX), EAX ) /* dest->start */ - MOV_L ( REGOFF(V4F_START, ESI), EDX ) /* in->start */ - MOV_L ( REGOFF(MATRIX_INV, ECX), ECX ) /* mat->inv */ - - CMP_L ( CONST(0), EDI ) - JE ( LLBL (G3TNR_end) ) - - FEMMS - - MOVD ( REGIND(ECX), MM0 ) /* | m0 */ - PUNPCKLDQ ( REGOFF(20, ECX), MM0 ) /* m5 | m0 */ - - MOVD ( REGOFF(40, ECX), MM2 ) /* | m10 */ - PUNPCKLDQ ( MM2, MM2 ) /* m10 | m10 */ - -ALIGNTEXT32 -LLBL (G3TNR_transform): - - PREFETCHW ( REGIND(EAX) ) - - MOVQ ( REGIND(EDX), MM4 ) /* x1 | x0 */ - MOVD ( REGOFF(8, EDX), MM5 ) /* | x2 */ - - PFMUL ( MM0, MM4 ) /* x1*m5 | x0*m0 */ - ADD_L ( STRIDE, EDX) /* next normal */ - - PREFETCH ( REGIND(EDX) ) - - PFMUL ( MM2, MM5 ) /* | x2*m10 */ - ADD_L ( CONST(16), EAX ) /* next r */ - - SUB_L ( CONST(1), EDI ) /* decrement normal counter */ - MOVQ ( MM4, REGOFF(-16, EAX) ) /* write r0, r1 */ - - MOVD ( MM5, REGOFF(-8, EAX) ) /* write r2 */ - JNZ ( LLBL (G3TNR_transform) ) - - FEMMS - -LLBL (G3TNR_end): - POP_L ( ESI ) - POP_L ( EDI ) - RET - - - - - - - - -ALIGNTEXT16 -GLOBL GLNAME(_mesa_3dnow_transform_normals) -HIDDEN(_mesa_3dnow_transform_normals) -GLNAME(_mesa_3dnow_transform_normals): - -#undef FRAME_OFFSET -#define FRAME_OFFSET 8 - - PUSH_L ( EDI ) - PUSH_L ( ESI ) - - MOV_L ( ARG_IN, ESI ) - MOV_L ( ARG_DEST, EAX ) - MOV_L ( ARG_MAT, ECX ) - MOV_L ( REGOFF(V4F_COUNT, ESI), EDI ) /* dest->count = in->count */ - MOV_L ( EDI, REGOFF(V4F_COUNT, EAX) ) - MOV_L ( REGOFF(V4F_START, EAX), EAX ) /* dest->start */ - MOV_L ( REGOFF(V4F_START, ESI), EDX ) /* in->start */ - MOV_L ( REGOFF(MATRIX_INV, ECX), ECX ) /* mat->inv */ - - CMP_L ( CONST(0), EDI ) /* count > 0 ?? */ - JE ( LLBL (G3T_end) ) - - FEMMS - - MOVQ ( REGIND(ECX), MM3 ) /* m1 | m0 */ - MOVQ ( REGOFF(16, ECX), MM4 ) /* m5 | m4 */ - - MOVD ( REGOFF(8, ECX), MM5 ) /* | m2 */ - PUNPCKLDQ ( REGOFF(24, ECX), MM5 ) /* m6 | m2 */ - - MOVQ ( REGOFF(32, ECX), MM6 ) /* m9 | m8 */ - MOVD ( REGOFF(40, ECX), MM7 ) /* | m10 */ - -ALIGNTEXT32 -LLBL (G3T_transform): - - PREFETCHW ( REGIND(EAX) ) - - MOVQ ( REGIND(EDX), MM0 ) /* x1 | x0 */ - MOVD ( REGOFF(8, EDX), MM2 ) /* | x2 */ - - MOVQ ( MM0, MM1 ) /* x1 | x0 */ - PUNPCKLDQ ( MM2, MM2 ) /* x2 | x2 */ - - PFMUL ( MM3, MM0 ) /* x1*m1 | x0*m0 */ - ADD_L ( CONST(16), EAX ) /* next r */ - - PFMUL ( MM4, MM1 ) /* x1*m5 | x0*m4 */ - PFACC ( MM1, MM0 ) /* x0*m4+x1*m5 | x0*m0+x1*m1 */ - - PFMUL ( MM5, MM2 ) /* x2*m6 | x2*m2 */ - PFADD ( MM2, MM0 ) /* x0*m4...+x2*m6| x0*m0+x1*m1+x2*m2 */ - - MOVQ ( REGIND(EDX), MM1 ) /* x1 | x0 */ - MOVQ ( MM0, REGOFF(-16, EAX) ) /* write r0, r1 */ - - PFMUL ( MM6, MM1 ) /* x1*m9 | x0*m8 */ - MOVD ( REGOFF(8, EDX), MM2 ) /* | x2 */ - - PFMUL ( MM7, MM2 ) /* | x2*m10 */ - ADD_L ( STRIDE, EDX ) /* next normal */ - - PREFETCH ( REGIND(EDX) ) - - PFACC ( MM1, MM1 ) /* *not used* | x0*m8+x1*m9 */ - PFADD ( MM2, MM1 ) /* *not used* | x0*m8+x1*m9+x2*m10 */ - - MOVD ( MM1, REGOFF(-8, EAX) ) /* write r2 */ - SUB_L ( CONST(1), EDI ) /* decrement normal counter */ - - JNZ ( LLBL (G3T_transform) ) - - FEMMS - -LLBL (G3T_end): - POP_L ( ESI ) - POP_L ( EDI ) - RET - - - - - - -ALIGNTEXT16 -GLOBL GLNAME(_mesa_3dnow_normalize_normals) -HIDDEN(_mesa_3dnow_normalize_normals) -GLNAME(_mesa_3dnow_normalize_normals): - -#undef FRAME_OFFSET -#define FRAME_OFFSET 12 - - PUSH_L ( EDI ) - PUSH_L ( ESI ) - PUSH_L ( EBP ) - - MOV_L ( ARG_IN, ESI ) - MOV_L ( ARG_DEST, EAX ) - MOV_L ( REGOFF(V4F_COUNT, ESI), EBP ) /* dest->count = in->count */ - MOV_L ( EBP, REGOFF(V4F_COUNT, EAX) ) - MOV_L ( REGOFF(V4F_START, EAX), EAX ) /* dest->start */ - MOV_L ( REGOFF(V4F_START, ESI), ECX ) /* in->start */ - MOV_L ( ARG_LENGTHS, EDX ) - - CMP_L ( CONST(0), EBP ) /* count > 0 ?? */ - JE ( LLBL (G3N_end) ) - - FEMMS - - CMP_L ( CONST(0), EDX ) /* lengths == 0 ? */ - JE ( LLBL (G3N_norm2) ) /* calculate lengths */ - -ALIGNTEXT32 -LLBL (G3N_norm1): /* use precalculated lengths */ - - PREFETCH ( REGIND(EAX) ) - - MOVQ ( REGIND(ECX), MM0 ) /* x1 | x0 */ - MOVD ( REGOFF(8, ECX), MM1 ) /* | x2 */ - - MOVD ( REGIND(EDX), MM3 ) /* | length (x) */ - PFMUL ( MM3, MM1 ) /* | x2 (normalized) */ - - PUNPCKLDQ ( MM3, MM3 ) /* length (x) | length (x) */ - ADD_L ( STRIDE, ECX ) /* next normal */ - - PREFETCH ( REGIND(ECX) ) - - PFMUL ( MM3, MM0 ) /* x1 (normalized) | x0 (normalized) */ - MOVQ ( MM0, REGIND(EAX) ) /* write new x0, x1 */ - - MOVD ( MM1, REGOFF(8, EAX) ) /* write new x2 */ - ADD_L ( CONST(16), EAX ) /* next r */ - - ADD_L ( CONST(4), EDX ) /* next length */ - SUB_L ( CONST(1), EBP ) /* decrement normal counter */ - - JNZ ( LLBL (G3N_norm1) ) - - JMP ( LLBL (G3N_end1) ) - -ALIGNTEXT32 -LLBL (G3N_norm2): /* need to calculate lengths */ - - PREFETCHW ( REGIND(EAX) ) - - PREFETCH ( REGIND(ECX) ) - - MOVQ ( REGIND(ECX), MM0 ) /* x1 | x0 */ - MOVD ( REGOFF(8, ECX), MM1 ) /* | x2 */ - - MOVQ ( MM0, MM3 ) /* x1 | x0 */ - ADD_L ( STRIDE, ECX ) /* next normal */ - - PFMUL ( MM0, MM3 ) /* x1*x1 | x0*x0 */ - MOVQ ( MM1, MM4 ) /* | x2 */ - - ADD_L ( CONST(16), EAX ) /* next r */ - PFMUL ( MM1, MM4 ) /* | x2*x2 */ - - PFADD ( MM4, MM3 ) /* | x0*x0+x2*x2 */ - PFACC ( MM3, MM3 ) /* x0*x0+...+x2*x2 | x0*x0+x1*x1+x2*x2*/ - - PFRSQRT ( MM3, MM5 ) /* 1/sqrt (x0*x0+x1*x1+x2*x2) */ - MOVQ ( MM5, MM4 ) - - PUNPCKLDQ ( MM3, MM3 ) - PFMUL ( MM5, MM5 ) - - PFRSQIT1 ( MM3, MM5 ) - SUB_L ( CONST(1), EBP ) /* decrement normal counter */ - - PFRCPIT2 ( MM4, MM5 ) - - PFMUL ( MM5, MM0 ) /* x1 (normalized) | x0 (normalized) */ - MOVQ ( MM0, REGOFF(-16, EAX) ) /* write new x0, x1 */ - - PFMUL ( MM5, MM1 ) /* | x2 (normalized) */ - MOVD ( MM1, REGOFF(-8, EAX) ) /* write new x2 */ - - JNZ ( LLBL (G3N_norm2) ) - -LLBL (G3N_end1): - FEMMS - -LLBL (G3N_end): - POP_L ( EBP ) - POP_L ( ESI ) - POP_L ( EDI ) - RET - - - - - - -ALIGNTEXT16 -GLOBL GLNAME(_mesa_3dnow_rescale_normals) -HIDDEN(_mesa_3dnow_rescale_normals) -GLNAME(_mesa_3dnow_rescale_normals): - -#undef FRAME_OFFSET -#define FRAME_OFFSET 8 - PUSH_L ( EDI ) - PUSH_L ( ESI ) - - MOV_L ( ARG_IN, ESI ) - MOV_L ( ARG_DEST, EAX ) - MOV_L ( REGOFF(V4F_COUNT, ESI), EDX ) /* dest->count = in->count */ - MOV_L ( EDX, REGOFF(V4F_COUNT, EAX) ) - MOV_L ( REGOFF(V4F_START, EAX), EAX ) /* dest->start */ - MOV_L ( REGOFF(V4F_START, ESI), ECX ) /* in->start */ - - CMP_L ( CONST(0), EDX ) - JE ( LLBL (G3R_end) ) - - FEMMS - - MOVD ( ARG_SCALE, MM0 ) /* scale */ - PUNPCKLDQ ( MM0, MM0 ) - -ALIGNTEXT32 -LLBL (G3R_rescale): - - PREFETCHW ( REGIND(EAX) ) - - MOVQ ( REGIND(ECX), MM1 ) /* x1 | x0 */ - MOVD ( REGOFF(8, ECX), MM2 ) /* | x2 */ - - PFMUL ( MM0, MM1 ) /* x1*scale | x0*scale */ - ADD_L ( STRIDE, ECX ) /* next normal */ - - PREFETCH ( REGIND(ECX) ) - - PFMUL ( MM0, MM2 ) /* | x2*scale */ - ADD_L ( CONST(16), EAX ) /* next r */ - - MOVQ ( MM1, REGOFF(-16, EAX) ) /* write r0, r1 */ - MOVD ( MM2, REGOFF(-8, EAX) ) /* write r2 */ - - SUB_L ( CONST(1), EDX ) /* decrement normal counter */ - JNZ ( LLBL (G3R_rescale) ) - - FEMMS - -LLBL (G3R_end): - POP_L ( ESI ) - POP_L ( EDI ) - RET - -#endif - -#if defined (__ELF__) && defined (__linux__) - .section .note.GNU-stack,"",%progbits -#endif diff --git a/mesalib/src/util/.gitignore b/mesalib/src/util/.gitignore index e945ecbb5..ecf4985fe 100644 --- a/mesalib/src/util/.gitignore +++ b/mesalib/src/util/.gitignore @@ -1 +1,2 @@ format_srgb.c +u_atomic_test diff --git a/mesalib/src/util/Makefile.am b/mesalib/src/util/Makefile.am index 8d5f90e97..c7e183e8d 100644 --- a/mesalib/src/util/Makefile.am +++ b/mesalib/src/util/Makefile.am @@ -37,8 +37,12 @@ libmesautil_la_SOURCES = \ $(MESA_UTIL_FILES) \ $(MESA_UTIL_GENERATED_FILES) +check_PROGRAMS = u_atomic_test +TESTS = $(check_PROGRAMS) + BUILT_SOURCES = $(MESA_UTIL_GENERATED_FILES) CLEANFILES = $(BUILT_SOURCES) +EXTRA_DIST = format_srgb.py SConscript format_srgb.c: $(srcdir)/format_srgb.py $(AM_V_GEN) $(PYTHON2) $< > $@ diff --git a/mesalib/src/util/Makefile.sources b/mesalib/src/util/Makefile.sources index 9e274241d..5f87fc32a 100644 --- a/mesalib/src/util/Makefile.sources +++ b/mesalib/src/util/Makefile.sources @@ -1,10 +1,18 @@ MESA_UTIL_FILES := \ + format_srgb.h \ hash_table.c \ + hash_table.h \ + macros.h \ ralloc.c \ + ralloc.h \ register_allocate.c \ register_allocate.h \ rgtc.c \ - strtod.cpp + rgtc.h \ + strtod.cpp \ + strtod.h \ + texcompress_rgtc_tmp.h \ + u_atomic.h MESA_UTIL_GENERATED_FILES = \ format_srgb.c diff --git a/mesalib/src/util/SConscript b/mesalib/src/util/SConscript index ade1d6c6c..34b9a2dea 100644 --- a/mesalib/src/util/SConscript +++ b/mesalib/src/util/SConscript @@ -36,3 +36,12 @@ mesautil = env.ConvenienceLibrary( env.Alias('mesautil', mesautil) Export('mesautil') + + +# http://www.scons.org/wiki/UnitTests +u_atomic_test = env.Program( + target = 'u_atomic_test', + source = ['u_atomic_test.c'], +) +alias = env.Alias("u_atomic_test", u_atomic_test, u_atomic_test[0].abspath) +AlwaysBuild(alias) diff --git a/mesalib/src/util/hash_table.c b/mesalib/src/util/hash_table.c index 920bdfd33..0ad038377 100644 --- a/mesalib/src/util/hash_table.c +++ b/mesalib/src/util/hash_table.c @@ -42,6 +42,7 @@ #include <stdlib.h> #include <string.h> +#include <assert.h> #include "hash_table.h" #include "ralloc.h" @@ -110,6 +111,7 @@ entry_is_present(const struct hash_table *ht, struct hash_entry *entry) struct hash_table * _mesa_hash_table_create(void *mem_ctx, + uint32_t (*key_hash_function)(const void *key), bool (*key_equals_function)(const void *a, const void *b)) { @@ -123,6 +125,7 @@ _mesa_hash_table_create(void *mem_ctx, ht->size = hash_sizes[ht->size_index].size; ht->rehash = hash_sizes[ht->size_index].rehash; ht->max_entries = hash_sizes[ht->size_index].max_entries; + ht->key_hash_function = key_hash_function; ht->key_equals_function = key_equals_function; ht->table = rzalloc_array(ht, struct hash_entry, ht->size); ht->entries = 0; @@ -176,15 +179,8 @@ _mesa_hash_table_set_deleted_key(struct hash_table *ht, const void *deleted_key) ht->deleted_key = deleted_key; } -/** - * Finds a hash table entry with the given key and hash of that key. - * - * Returns NULL if no entry is found. Note that the data pointer may be - * modified by the user. - */ -struct hash_entry * -_mesa_hash_table_search(struct hash_table *ht, uint32_t hash, - const void *key) +static struct hash_entry * +hash_table_search(struct hash_table *ht, uint32_t hash, const void *key) { uint32_t start_hash_address = hash % ht->size; uint32_t hash_address = start_hash_address; @@ -210,6 +206,31 @@ _mesa_hash_table_search(struct hash_table *ht, uint32_t hash, return NULL; } +/** + * Finds a hash table entry with the given key and hash of that key. + * + * Returns NULL if no entry is found. Note that the data pointer may be + * modified by the user. + */ +struct hash_entry * +_mesa_hash_table_search(struct hash_table *ht, const void *key) +{ + assert(ht->key_hash_function); + return hash_table_search(ht, ht->key_hash_function(key), key); +} + +struct hash_entry * +_mesa_hash_table_search_pre_hashed(struct hash_table *ht, uint32_t hash, + const void *key) +{ + assert(ht->key_hash_function == NULL || hash == ht->key_hash_function(key)); + return hash_table_search(ht, hash, key); +} + +static struct hash_entry * +hash_table_insert(struct hash_table *ht, uint32_t hash, + const void *key, void *data); + static void _mesa_hash_table_rehash(struct hash_table *ht, int new_size_index) { @@ -235,22 +256,15 @@ _mesa_hash_table_rehash(struct hash_table *ht, int new_size_index) ht->deleted_entries = 0; hash_table_foreach(&old_ht, entry) { - _mesa_hash_table_insert(ht, entry->hash, - entry->key, entry->data); + hash_table_insert(ht, entry->hash, entry->key, entry->data); } ralloc_free(old_ht.table); } -/** - * Inserts the key with the given hash into the table. - * - * Note that insertion may rearrange the table on a resize or rehash, - * so previously found hash_entries are no longer valid after this function. - */ -struct hash_entry * -_mesa_hash_table_insert(struct hash_table *ht, uint32_t hash, - const void *key, void *data) +static struct hash_entry * +hash_table_insert(struct hash_table *ht, uint32_t hash, + const void *key, void *data) { uint32_t start_hash_address, hash_address; @@ -307,6 +321,27 @@ _mesa_hash_table_insert(struct hash_table *ht, uint32_t hash, } /** + * Inserts the key with the given hash into the table. + * + * Note that insertion may rearrange the table on a resize or rehash, + * so previously found hash_entries are no longer valid after this function. + */ +struct hash_entry * +_mesa_hash_table_insert(struct hash_table *ht, const void *key, void *data) +{ + assert(ht->key_hash_function); + return hash_table_insert(ht, ht->key_hash_function(key), key, data); +} + +struct hash_entry * +_mesa_hash_table_insert_with_hash(struct hash_table *ht, uint32_t hash, + const void *key, void *data) +{ + assert(ht->key_hash_function == NULL || hash == ht->key_hash_function(key)); + return hash_table_insert(ht, hash, key, data); +} + +/** * This function deletes the given hash table entry. * * Note that deletion doesn't otherwise modify the table, so an iteration over diff --git a/mesalib/src/util/hash_table.h b/mesalib/src/util/hash_table.h index d6b6ebf40..5561e1584 100644 --- a/mesalib/src/util/hash_table.h +++ b/mesalib/src/util/hash_table.h @@ -46,6 +46,7 @@ struct hash_entry { struct hash_table { struct hash_entry *table; + uint32_t (*key_hash_function)(const void *key); bool (*key_equals_function)(const void *a, const void *b); const void *deleted_key; uint32_t size; @@ -58,6 +59,7 @@ struct hash_table { struct hash_table * _mesa_hash_table_create(void *mem_ctx, + uint32_t (*key_hash_function)(const void *key), bool (*key_equals_function)(const void *a, const void *b)); void _mesa_hash_table_destroy(struct hash_table *ht, @@ -66,11 +68,15 @@ void _mesa_hash_table_set_deleted_key(struct hash_table *ht, const void *deleted_key); struct hash_entry * -_mesa_hash_table_insert(struct hash_table *ht, uint32_t hash, - const void *key, void *data); +_mesa_hash_table_insert(struct hash_table *ht, const void *key, void *data); struct hash_entry * -_mesa_hash_table_search(struct hash_table *ht, uint32_t hash, - const void *key); +_mesa_hash_table_insert_with_hash(struct hash_table *ht, uint32_t hash, + const void *key, void *data); +struct hash_entry * +_mesa_hash_table_search(struct hash_table *ht, const void *key); +struct hash_entry * +_mesa_hash_table_search_pre_hashed(struct hash_table *ht, uint32_t hash, + const void *key); void _mesa_hash_table_remove(struct hash_table *ht, struct hash_entry *entry); @@ -85,6 +91,11 @@ uint32_t _mesa_hash_string(const char *key); bool _mesa_key_string_equal(const void *a, const void *b); bool _mesa_key_pointer_equal(const void *a, const void *b); +static inline uint32_t _mesa_key_hash_string(const void *key) +{ + return _mesa_hash_string((const char *)key); +} + static inline uint32_t _mesa_hash_pointer(const void *pointer) { return _mesa_hash_data(&pointer, sizeof(pointer)); diff --git a/mesalib/src/util/register_allocate.c b/mesalib/src/util/register_allocate.c index 6cf7ce721..af7a20c09 100644 --- a/mesalib/src/util/register_allocate.c +++ b/mesalib/src/util/register_allocate.c @@ -79,7 +79,7 @@ #include "main/bitset.h" #include "register_allocate.h" -#define NO_REG ~0 +#define NO_REG ~0U struct ra_reg { BITSET_WORD *conflicts; @@ -251,7 +251,7 @@ void ra_add_transitive_reg_conflict(struct ra_regs *regs, unsigned int base_reg, unsigned int reg) { - int i; + unsigned int i; ra_add_reg_conflict(regs, reg, base_reg); @@ -328,7 +328,7 @@ ra_set_finalize(struct ra_regs *regs, unsigned int **q_values) for (rc = 0; rc < regs->count; rc++) { int conflicts = 0; - int i; + unsigned int i; if (!reg_belongs_to_class(rc, regs->classes[c])) continue; @@ -374,7 +374,7 @@ ra_alloc_interference_graph(struct ra_regs *regs, unsigned int count) struct ra_graph *g; unsigned int i; - g = rzalloc(regs, struct ra_graph); + g = rzalloc(NULL, struct ra_graph); g->regs = regs; g->nodes = rzalloc_array(g, struct ra_node, count); g->count = count; @@ -481,7 +481,7 @@ ra_simplify(struct ra_graph *g) } } - if (!progress && best_optimistic_node != ~0) { + if (!progress && best_optimistic_node != ~0U) { decrement_q(g, best_optimistic_node); g->stack[g->stack_count] = best_optimistic_node; g->stack_count++; @@ -501,10 +501,10 @@ ra_simplify(struct ra_graph *g) static bool ra_select(struct ra_graph *g) { - int i; int start_search_reg = 0; while (g->stack_count != 0) { + unsigned int i; unsigned int ri; unsigned int r = -1; int n = g->stack[g->stack_count - 1]; @@ -585,7 +585,7 @@ ra_set_node_reg(struct ra_graph *g, unsigned int n, unsigned int reg) static float ra_get_spill_benefit(struct ra_graph *g, unsigned int n) { - int j; + unsigned int j; float benefit = 0; int n_class = g->nodes[n].class; diff --git a/mesalib/src/util/u_atomic.h b/mesalib/src/util/u_atomic.h new file mode 100644 index 000000000..401003638 --- /dev/null +++ b/mesalib/src/util/u_atomic.h @@ -0,0 +1,188 @@ +/** + * Many similar implementations exist. See for example libwsbm + * or the linux kernel include/atomic.h + * + * No copyright claimed on this file. + * + */ + +#ifndef U_ATOMIC_H +#define U_ATOMIC_H + +#include <stdbool.h> + +/* Favor OS-provided implementations. + * + * Where no OS-provided implementation is available, fall back to + * locally coded assembly, compiler intrinsic or ultimately a + * mutex-based implementation. + */ +#if defined(__sun) +#define PIPE_ATOMIC_OS_SOLARIS +#elif defined(_MSC_VER) +#define PIPE_ATOMIC_MSVC_INTRINSIC +#elif defined(__GNUC__) +#define PIPE_ATOMIC_GCC_INTRINSIC +#else +#error "Unsupported platform" +#endif + + +/* Implementation using GCC-provided synchronization intrinsics + */ +#if defined(PIPE_ATOMIC_GCC_INTRINSIC) + +#define PIPE_ATOMIC "GCC Sync Intrinsics" + +#define p_atomic_set(_v, _i) (*(_v) = (_i)) +#define p_atomic_read(_v) (*(_v)) +#define p_atomic_dec_zero(v) (__sync_sub_and_fetch((v), 1) == 0) +#define p_atomic_inc(v) (void) __sync_add_and_fetch((v), 1) +#define p_atomic_dec(v) (void) __sync_sub_and_fetch((v), 1) +#define p_atomic_inc_return(v) __sync_add_and_fetch((v), 1) +#define p_atomic_dec_return(v) __sync_sub_and_fetch((v), 1) +#define p_atomic_cmpxchg(v, old, _new) \ + __sync_val_compare_and_swap((v), (old), (_new)) + +#endif + + + +/* Unlocked version for single threaded environments, such as some + * windows kernel modules. + */ +#if defined(PIPE_ATOMIC_OS_UNLOCKED) + +#define PIPE_ATOMIC "Unlocked" + +#define p_atomic_set(_v, _i) (*(_v) = (_i)) +#define p_atomic_read(_v) (*(_v)) +#define p_atomic_dec_zero(_v) (p_atomic_dec_return(_v) == 0) +#define p_atomic_inc(_v) ((void) p_atomic_inc_return(_v)) +#define p_atomic_dec(_v) ((void) p_atomic_dec_return(_v)) +#define p_atomic_inc_return(_v) (++(*(_v))) +#define p_atomic_dec_return(_v) (--(*(_v))) +#define p_atomic_cmpxchg(_v, _old, _new) (*(_v) == (_old) ? (*(_v) = (_new), (_old)) : *(_v)) + +#endif + + +#if defined(PIPE_ATOMIC_MSVC_INTRINSIC) + +#define PIPE_ATOMIC "MSVC Intrinsics" + +/* We use the Windows header's Interlocked* functions instead of the + * _Interlocked* intrinsics wherever we can, as support for the latter varies + * with target CPU, whereas Windows headers take care of all portability + * issues: using intrinsics where available, falling back to library + * implementations where not. + */ +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN 1 +#endif +#include <windows.h> +#include <intrin.h> +#include <assert.h> + +#pragma intrinsic(_InterlockedCompareExchange8) + +/* MSVC supports decltype keyword, but it's only supported on C++ and doesn't + * quite work here; and if a C++-only solution is worthwhile, then it would be + * better to use templates / function overloading, instead of decltype magic. + * Therefore, we rely on implicit casting to LONGLONG for the functions that return + */ + +#define p_atomic_set(_v, _i) (*(_v) = (_i)) +#define p_atomic_read(_v) (*(_v)) + +#define p_atomic_dec_zero(_v) \ + (p_atomic_dec_return(_v) == 0) + +#define p_atomic_inc(_v) \ + ((void) p_atomic_inc_return(_v)) + +#define p_atomic_inc_return(_v) (\ + sizeof *(_v) == sizeof(short) ? InterlockedIncrement16((short *) (_v)) : \ + sizeof *(_v) == sizeof(long) ? InterlockedIncrement ((long *) (_v)) : \ + sizeof *(_v) == sizeof(__int64) ? InterlockedIncrement64((__int64 *)(_v)) : \ + (assert(!"should not get here"), 0)) + +#define p_atomic_dec(_v) \ + ((void) p_atomic_dec_return(_v)) + +#define p_atomic_dec_return(_v) (\ + sizeof *(_v) == sizeof(short) ? InterlockedDecrement16((short *) (_v)) : \ + sizeof *(_v) == sizeof(long) ? InterlockedDecrement ((long *) (_v)) : \ + sizeof *(_v) == sizeof(__int64) ? InterlockedDecrement64((__int64 *)(_v)) : \ + (assert(!"should not get here"), 0)) + +#define p_atomic_cmpxchg(_v, _old, _new) (\ + sizeof *(_v) == sizeof(char) ? _InterlockedCompareExchange8((char *) (_v), (char) (_new), (char) (_old)) : \ + sizeof *(_v) == sizeof(short) ? InterlockedCompareExchange16((short *) (_v), (short) (_new), (short) (_old)) : \ + sizeof *(_v) == sizeof(long) ? InterlockedCompareExchange ((long *) (_v), (long) (_new), (long) (_old)) : \ + sizeof *(_v) == sizeof(__int64) ? InterlockedCompareExchange64((__int64 *)(_v), (__int64)(_new), (__int64)(_old)) : \ + (assert(!"should not get here"), 0)) + +#endif + +#if defined(PIPE_ATOMIC_OS_SOLARIS) + +#define PIPE_ATOMIC "Solaris OS atomic functions" + +#include <atomic.h> +#include <assert.h> + +#define p_atomic_set(_v, _i) (*(_v) = (_i)) +#define p_atomic_read(_v) (*(_v)) + +#define p_atomic_dec_zero(v) (\ + sizeof(*v) == sizeof(uint8_t) ? atomic_dec_8_nv ((uint8_t *)(v)) == 0 : \ + sizeof(*v) == sizeof(uint16_t) ? atomic_dec_16_nv((uint16_t *)(v)) == 0 : \ + sizeof(*v) == sizeof(uint32_t) ? atomic_dec_32_nv((uint32_t *)(v)) == 0 : \ + sizeof(*v) == sizeof(uint64_t) ? atomic_dec_64_nv((uint64_t *)(v)) == 0 : \ + (assert(!"should not get here"), 0)) + +#define p_atomic_inc(v) (void) (\ + sizeof(*v) == sizeof(uint8_t) ? atomic_inc_8 ((uint8_t *)(v)) : \ + sizeof(*v) == sizeof(uint16_t) ? atomic_inc_16((uint16_t *)(v)) : \ + sizeof(*v) == sizeof(uint32_t) ? atomic_inc_32((uint32_t *)(v)) : \ + sizeof(*v) == sizeof(uint64_t) ? atomic_inc_64((uint64_t *)(v)) : \ + (assert(!"should not get here"), 0)) + +#define p_atomic_inc_return(v) ((typeof(*v)) \ + sizeof(*v) == sizeof(uint8_t) ? atomic_inc_8_nv ((uint8_t *)(v)) : \ + sizeof(*v) == sizeof(uint16_t) ? atomic_inc_16_nv((uint16_t *)(v)) : \ + sizeof(*v) == sizeof(uint32_t) ? atomic_inc_32_nv((uint32_t *)(v)) : \ + sizeof(*v) == sizeof(uint64_t) ? atomic_inc_64_nv((uint64_t *)(v)) : \ + (assert(!"should not get here"), 0)) + +#define p_atomic_dec(v) ((void) \ + sizeof(*v) == sizeof(uint8_t) ? atomic_dec_8 ((uint8_t *)(v)) : \ + sizeof(*v) == sizeof(uint16_t) ? atomic_dec_16((uint16_t *)(v)) : \ + sizeof(*v) == sizeof(uint32_t) ? atomic_dec_32((uint32_t *)(v)) : \ + sizeof(*v) == sizeof(uint64_t) ? atomic_dec_64((uint64_t *)(v)) : \ + (assert(!"should not get here"), 0)) + +#define p_atomic_dec_return(v) ((typeof(*v)) \ + sizeof(*v) == sizeof(uint8_t) ? atomic_dec_8_nv ((uint8_t *)(v)) : \ + sizeof(*v) == sizeof(uint16_t) ? atomic_dec_16_nv((uint16_t *)(v)) : \ + sizeof(*v) == sizeof(uint32_t) ? atomic_dec_32_nv((uint32_t *)(v)) : \ + sizeof(*v) == sizeof(uint64_t) ? atomic_dec_64_nv((uint64_t *)(v)) : \ + (assert(!"should not get here"), 0)) + +#define p_atomic_cmpxchg(v, old, _new) ((typeof(*v)) \ + sizeof(*v) == sizeof(uint8_t) ? atomic_cas_8 ((uint8_t *)(v), (uint8_t )(old), (uint8_t )(_new)) : \ + sizeof(*v) == sizeof(uint16_t) ? atomic_cas_16((uint16_t *)(v), (uint16_t)(old), (uint16_t)(_new)) : \ + sizeof(*v) == sizeof(uint32_t) ? atomic_cas_32((uint32_t *)(v), (uint32_t)(old), (uint32_t)(_new)) : \ + sizeof(*v) == sizeof(uint64_t) ? atomic_cas_64((uint64_t *)(v), (uint64_t)(old), (uint64_t)(_new)) : \ + (assert(!"should not get here"), 0)) + +#endif + +#ifndef PIPE_ATOMIC +#error "No pipe_atomic implementation selected" +#endif + + + +#endif /* U_ATOMIC_H */ diff --git a/mesalib/src/util/u_atomic_test.c b/mesalib/src/util/u_atomic_test.c new file mode 100644 index 000000000..4845e753e --- /dev/null +++ b/mesalib/src/util/u_atomic_test.c @@ -0,0 +1,137 @@ +/************************************************************************** + * + * Copyright 2014 VMware, Inc. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL VMWARE 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. + * + **************************************************************************/ + + +/* Force assertions, even on debug builds. */ +#undef NDEBUG + + +#include <stdint.h> +#include <inttypes.h> +#include <assert.h> + +#include "u_atomic.h" + + +#define test_atomic_cmpxchg(type, ones) \ + static void test_atomic_cmpxchg_##type (void) { \ + type v, r; \ + \ + p_atomic_set(&v, ones); \ + assert(v == ones && "p_atomic_set"); \ + \ + r = p_atomic_read(&v); \ + assert(r == ones && "p_atomic_read"); \ + \ + v = ones; \ + r = p_atomic_cmpxchg(&v, 0, 1); \ + assert(v == ones && "p_atomic_cmpxchg"); \ + assert(r == ones && "p_atomic_cmpxchg"); \ + r = p_atomic_cmpxchg(&v, ones, 0); \ + assert(v == 0 && "p_atomic_cmpxchg"); \ + assert(r == ones && "p_atomic_cmpxchg"); \ + \ + (void) r; \ + } + + +#define test_atomic(type, ones) \ + test_atomic_cmpxchg(type, ones) \ + \ + static void test_atomic_##type (void) { \ + type v, r; \ + bool b; \ + \ + test_atomic_cmpxchg_##type(); \ + \ + v = 2; \ + b = p_atomic_dec_zero(&v); \ + assert(v == 1 && "p_atomic_dec_zero"); \ + assert(b == false && "p_atomic_dec_zero"); \ + b = p_atomic_dec_zero(&v); \ + assert(v == 0 && "p_atomic_dec_zero"); \ + assert(b == true && "p_atomic_dec_zero"); \ + b = p_atomic_dec_zero(&v); \ + assert(v == ones && "p_atomic_dec_zero"); \ + assert(b == false && "p_atomic_dec_zero"); \ + \ + v = ones; \ + p_atomic_inc(&v); \ + assert(v == 0 && "p_atomic_inc"); \ + \ + v = ones; \ + r = p_atomic_inc_return(&v); \ + assert(v == 0 && "p_atomic_inc_return"); \ + assert(r == v && "p_atomic_inc_return"); \ + \ + v = 0; \ + p_atomic_dec(&v); \ + assert(v == ones && "p_atomic_dec"); \ + \ + v = 0; \ + r = p_atomic_dec_return(&v); \ + assert(v == ones && "p_atomic_dec_return"); \ + assert(r == v && "p_atomic_dec_return"); \ + \ + (void) r; \ + (void) b; \ + } + + +test_atomic(int, -1) +test_atomic(unsigned, ~0U) + +test_atomic(int16_t, INT16_C(-1)) +test_atomic(uint16_t, UINT16_C(0xffff)) +test_atomic(int32_t, INT32_C(-1)) +test_atomic(uint32_t, UINT32_C(0xffffffff)) +test_atomic(int64_t, INT64_C(-1)) +test_atomic(uint64_t, UINT64_C(0xffffffffffffffff)) + +test_atomic_cmpxchg(int8_t, INT8_C(-1)) +test_atomic_cmpxchg(uint8_t, UINT8_C(0xff)) +test_atomic_cmpxchg(bool, true) + +int +main() +{ + test_atomic_int(); + test_atomic_unsigned(); + + test_atomic_int16_t(); + test_atomic_uint16_t(); + test_atomic_int32_t(); + test_atomic_uint32_t(); + test_atomic_int64_t(); + test_atomic_uint64_t(); + + test_atomic_cmpxchg_int8_t(); + test_atomic_cmpxchg_uint8_t(); + test_atomic_cmpxchg_bool(); + + return 0; +} |