diff options
Diffstat (limited to 'mesalib')
87 files changed, 1206 insertions, 1216 deletions
diff --git a/mesalib/SConstruct b/mesalib/SConstruct index 4a3fef080..1807ff835 100644 --- a/mesalib/SConstruct +++ b/mesalib/SConstruct @@ -69,6 +69,11 @@ if env['gles']: ####################################################################### # Environment setup +env.Append(CPPDEFINES = [ + ('PACKAGE_VERSION', '\\"9.2-devel\\"'), + ('PACKAGE_BUGREPORT', '\\"https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa\\"'), +]) + # Includes env.Prepend(CPPPATH = [ '#/include', diff --git a/mesalib/common.py b/mesalib/common.py index 6ff9608c4..1d618e675 100644 --- a/mesalib/common.py +++ b/mesalib/common.py @@ -100,4 +100,4 @@ def AddOptions(opts): opts.Add(BoolOption('quiet', 'DEPRECATED: profile build', 'yes')) opts.Add(BoolOption('texture_float', 'enable floating-point textures and renderbuffers', 'no')) if host_platform == 'windows': - opts.Add(EnumOption('MSVS_VERSION', 'MS Visual C++ version', None, allowed_values=('7.1', '8.0', '9.0'))) + opts.Add(EnumOption('MSVC_VERSION', 'MS Visual C++ version', None, allowed_values=('7.1', '8.0', '9.0', '10.0', '11.0'))) diff --git a/mesalib/configure.ac b/mesalib/configure.ac index 320486910..4b5b04576 100644 --- a/mesalib/configure.ac +++ b/mesalib/configure.ac @@ -35,6 +35,7 @@ LIBDRM_RADEON_REQUIRED=2.4.42 LIBDRM_INTEL_REQUIRED=2.4.38 LIBDRM_NVVIEUX_REQUIRED=2.4.33 LIBDRM_NOUVEAU_REQUIRED="2.4.33 libdrm >= 2.4.41" +LIBDRM_FREEDRENO_REQUIRED=2.4.39 DRI2PROTO_REQUIRED=2.6 GLPROTO_REQUIRED=1.4.14 LIBDRM_XORG_REQUIRED=2.4.24 @@ -432,7 +433,6 @@ AC_ARG_ENABLE([asm], [enable_asm=yes] ) asm_arch="" -MESA_ASM_FILES="" AC_MSG_CHECKING([whether to enable assembly]) test "x$enable_asm" = xno && AC_MSG_RESULT([no]) # disable if cross compiling on x86/x86_64 since we must run gen_matypes @@ -473,17 +473,14 @@ if test "x$enable_asm" = xyes; then case "$asm_arch" in x86) DEFINES="$DEFINES -DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM" - MESA_ASM_FILES='$(X86_FILES)' AC_MSG_RESULT([yes, x86]) ;; x86_64) DEFINES="$DEFINES -DUSE_X86_64_ASM" - MESA_ASM_FILES='$(X86_64_FILES)' AC_MSG_RESULT([yes, x86_64]) ;; sparc) DEFINES="$DEFINES -DUSE_SPARC_ASM" - MESA_ASM_FILES='$(SPARC_FILES)' AC_MSG_RESULT([yes, sparc]) ;; *) @@ -491,7 +488,6 @@ if test "x$enable_asm" = xyes; then ;; esac fi -AC_SUBST([MESA_ASM_FILES]) dnl Check to see if dlopen is in default libraries (like Solaris, which dnl has it in libc), or if libdl is needed to get it. @@ -590,13 +586,6 @@ AC_ARG_ENABLE([xa], [enable build of the XA X Acceleration API @<:@default=no@:>@])], [enable_xa="$enableval"], [enable_xa=no]) -dnl Broken, unmaintained. Don't want to see bug reports about it without patches. -enable_d3d1x=no -dnl AC_ARG_ENABLE([d3d1x], -dnl [AS_HELP_STRING([--enable-d3d1x], -dnl [enable support for Direct3D 10 & 11 low-level API @<:@default=no@:>@])], -dnl [enable_d3d1x="$enableval"], -dnl [enable_d3d1x=no]) AC_ARG_ENABLE([gbm], [AS_HELP_STRING([--enable-gbm], [enable gbm library @<:@default=auto@:>@])], @@ -660,7 +649,7 @@ GALLIUM_DRIVERS_DEFAULT="r300,r600,svga,swrast" AC_ARG_WITH([gallium-drivers], [AS_HELP_STRING([--with-gallium-drivers@<:@=DIRS...@:>@], [comma delimited Gallium drivers list, e.g. - "i915,nouveau,r300,r600,radeonsi,svga,swrast" + "i915,nouveau,r300,r600,radeonsi,freedreno,svga,swrast" @<:@default=r300,r600,svga,swrast@:>@])], [with_gallium_drivers="$withval"], [with_gallium_drivers="$GALLIUM_DRIVERS_DEFAULT"]) @@ -678,7 +667,6 @@ if test "x$enable_opengl" = xno -a \ "x$enable_openvg" = xno -a \ "x$enable_xorg" = xno -a \ "x$enable_xa" = xno -a \ - "x$enable_d3d1x" = xno -a \ "x$enable_xvmc" = xno -a \ "x$enable_vdpau" = xno -a \ "x$enable_opencl" = xno; then @@ -805,6 +793,8 @@ fi if test "x$enable_osmesa" = xyes; then DRIVER_DIRS="$DRIVER_DIRS osmesa" + GALLIUM_STATE_TRACKERS_DIRS="osmesa $GALLIUM_STATE_TRACKERS_DIRS" + GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS osmesa" fi AC_SUBST([SRC_DIRS]) @@ -1357,19 +1347,6 @@ fi AM_CONDITIONAL(HAVE_OPENVG, test "x$enable_openvg" = xyes) dnl -dnl D3D1X configuration -dnl - -if test "x$enable_d3d1x" = xyes; then - if test "x$with_gallium_drivers" = x; then - AC_MSG_ERROR([cannot enable D3D1X without Gallium]) - fi - - GALLIUM_STATE_TRACKERS_DIRS="d3d1x $GALLIUM_STATE_TRACKERS_DIRS" - HAVE_ST_D3D1X=yes -fi - -dnl dnl Gallium G3DVL configuration dnl AC_ARG_ENABLE([gallium-g3dvl], @@ -1795,7 +1772,7 @@ radeon_llvm_check() { configure flag]) fi AC_MSG_WARN([Please ensure you use the latest llvm tree from git://people.freedesktop.org/~tstellar/llvm master before submitting a bug]) - LLVM_COMPONENTS="${LLVM_COMPONENTS} r600" + LLVM_COMPONENTS="${LLVM_COMPONENTS} r600 bitreader" } dnl Gallium drivers @@ -1861,6 +1838,13 @@ if test "x$with_gallium_drivers" != x; then GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS nouveau nv30 nv50 nvc0" gallium_check_st "nouveau/drm" "dri-nouveau" "xorg-nouveau" "" "xvmc-nouveau" "vdpau-nouveau" ;; + xfreedreno) + HAVE_GALLIUM_FREEDRENO=yes + PKG_CHECK_MODULES([FREEDRENO], [libdrm_freedreno >= $LIBDRM_FREEDRENO_REQUIRED]) + gallium_require_drm_loader + GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS freedreno" + gallium_check_st "freedreno/drm" "dri-freedreno" "" "" "" "" + ;; xswrast) HAVE_GALLIUM_SOFTPIPE=yes GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS softpipe" @@ -1941,6 +1925,7 @@ AM_CONDITIONAL(HAVE_GALLIUM_R300, test "x$HAVE_GALLIUM_R300" = xyes) AM_CONDITIONAL(HAVE_GALLIUM_R600, test "x$HAVE_GALLIUM_R600" = xyes) AM_CONDITIONAL(HAVE_GALLIUM_RADEONSI, test "x$HAVE_GALLIUM_RADEONSI" = xyes) AM_CONDITIONAL(HAVE_GALLIUM_NOUVEAU, test "x$HAVE_GALLIUM_NOUVEAU" = xyes) +AM_CONDITIONAL(HAVE_GALLIUM_FREEDRENO, test "x$HAVE_GALLIUM_FREEDRENO" = xyes) AM_CONDITIONAL(HAVE_GALLIUM_SOFTPIPE, test "x$HAVE_GALLIUM_SOFTPIPE" = xyes) AM_CONDITIONAL(HAVE_GALLIUM_LLVMPIPE, test "x$HAVE_GALLIUM_LLVMPIPE" = xyes) @@ -2059,6 +2044,7 @@ AC_CONFIG_FILES([Makefile src/gallium/auxiliary/Makefile src/gallium/auxiliary/pipe-loader/Makefile src/gallium/drivers/Makefile + src/gallium/drivers/freedreno/Makefile src/gallium/drivers/i915/Makefile src/gallium/drivers/llvmpipe/Makefile src/gallium/drivers/nouveau/Makefile @@ -2081,12 +2067,14 @@ AC_CONFIG_FILES([Makefile src/gallium/state_trackers/egl/Makefile src/gallium/state_trackers/gbm/Makefile src/gallium/state_trackers/glx/Makefile + src/gallium/state_trackers/osmesa/Makefile src/gallium/state_trackers/vdpau/Makefile src/gallium/state_trackers/vega/Makefile src/gallium/state_trackers/xa/Makefile src/gallium/state_trackers/xorg/Makefile src/gallium/state_trackers/xvmc/Makefile src/gallium/targets/Makefile + src/gallium/targets/dri-freedreno/Makefile src/gallium/targets/dri-i915/Makefile src/gallium/targets/dri-nouveau/Makefile src/gallium/targets/dri-r300/Makefile @@ -2097,6 +2085,7 @@ AC_CONFIG_FILES([Makefile src/gallium/targets/egl-static/Makefile src/gallium/targets/gbm/Makefile src/gallium/targets/opencl/Makefile + src/gallium/targets/osmesa/Makefile src/gallium/targets/pipe-loader/Makefile src/gallium/targets/libgl-xlib/Makefile src/gallium/targets/vdpau-nouveau/Makefile @@ -2117,6 +2106,7 @@ AC_CONFIG_FILES([Makefile src/gallium/tests/trivial/Makefile src/gallium/tests/unit/Makefile src/gallium/winsys/Makefile + src/gallium/winsys/freedreno/drm/Makefile src/gallium/winsys/i915/drm/Makefile src/gallium/winsys/i915/sw/Makefile src/gallium/winsys/nouveau/drm/Makefile diff --git a/mesalib/docs/devinfo.html b/mesalib/docs/devinfo.html index d64171aee..c89bfc02e 100644 --- a/mesalib/docs/devinfo.html +++ b/mesalib/docs/devinfo.html @@ -200,8 +200,6 @@ branch is relevant. <dd>PACKAGE_VERSION</dd> <dt>configure.ac</dt> <dd>AC_INIT</dd> - <dt>src/mesa/main/version.h</dt> - <dd>MESA_MAJOR, MESA_MINOR, MESA_PATCH and MESA_VERSION_STRING</dd> </dl> <p> diff --git a/mesalib/docs/osmesa.html b/mesalib/docs/osmesa.html index b0609cf88..848754570 100644 --- a/mesalib/docs/osmesa.html +++ b/mesalib/docs/osmesa.html @@ -18,77 +18,62 @@ <p> -Mesa's off-screen rendering interface is used for rendering into -user-allocated blocks of memory. +Mesa's off-screen interface is used for rendering into user-allocated memory +without any sort of window system or operating system dependencies. That is, the GL_FRONT colorbuffer is actually a buffer in main memory, rather than a window on your display. -There are no window system or operating system dependencies. -One potential application is to use Mesa as an off-line, batch-style renderer. </p> <p> -The <b>OSMesa</b> API provides three basic functions for making off-screen +The OSMesa API provides three basic functions for making off-screen renderings: OSMesaCreateContext(), OSMesaMakeCurrent(), and OSMesaDestroyContext(). See the Mesa/include/GL/osmesa.h header for more information about the API functions. </p> <p> -There are several examples of OSMesa in the mesa/demos repository. +The OSMesa interface may be used with any of three software renderers: </p> +<ol> +<li>llvmpipe - this is the high-performance Gallium LLVM driver +<li>softpipe - this it the reference Gallium software driver +<li>swrast - this is the legacy Mesa software rasterizer +</ol> -<h2>Deep color channels</h2> - <p> -For some applications 8-bit color channels don't have sufficient -precision. -OSMesa supports 16-bit and 32-bit color channels through the OSMesa interface. -When using 16-bit channels, channels are GLushorts and RGBA pixels occupy -8 bytes. -When using 32-bit channels, channels are GLfloats and RGBA pixels occupy -16 bytes. +There are several examples of OSMesa in the mesa/demos repository. </p> -<p> -Before version 6.5.1, Mesa had to be recompiled to support exactly -one of 8, 16 or 32-bit channels. -With Mesa 6.5.1, Mesa can be compiled for either 8, 16 or 32-bit channels -and render into any of the smaller size channels. -For example, if Mesa's compiled for 32-bit channels, you can also render -16 and 8-bit channel images. -</p> +<h1>Building OSMesa</h1> <p> -To build Mesa/OSMesa for 16 and 8-bit color channel support: +Configure and build Mesa with something like: + <pre> - make realclean - make linux-osmesa16 +configure --enable-osmesa --disable-driglx-direct --disable-dri --with-gallium-drivers=swrast +make </pre> <p> -To build Mesa/OSMesa for 32, 16 and 8-bit color channel support: -<pre> - make realclean - make linux-osmesa32 -</pre> +Make sure you have LLVM installed first if you want to use the llvmpipe driver. +</p> <p> -You'll wind up with a library named libOSMesa16.so or libOSMesa32.so. -Otherwise, most Mesa configurations build an 8-bit/channel libOSMesa.so library -by default. +When the build is complete you should find: </p> +<pre> +lib/libOSMesa.so (swrast-based OSMesa) +lib/gallium/libOSMsea.so (gallium-based OSMesa) +</pre> <p> -If performance is important, compile Mesa for the channel size you're -most interested in. +Set your LD_LIBRARY_PATH to point to one directory or the other to select +the library you want to use. </p> <p> -If you need to compile on a non-Linux platform, copy Mesa/configs/linux-osmesa16 -to a new config file and edit it as needed. Then, add the new config name to -the top-level Makefile. Send a patch to the Mesa developers too, if you're -inclined. +When you link your application, link with -lOSMesa </p> </div> diff --git a/mesalib/include/c99_compat.h b/mesalib/include/c99_compat.h new file mode 100644 index 000000000..429c60148 --- /dev/null +++ b/mesalib/include/c99_compat.h @@ -0,0 +1,145 @@ +/************************************************************************** + * + * Copyright 2007-2013 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. + * + **************************************************************************/ + +#ifndef _C99_COMPAT_H_ +#define _C99_COMPAT_H_ + + +/* + * MSVC hacks. + */ +#if defined(_MSC_VER) + /* + * Visual Studio 2012 will complain if we define the `inline` keyword, but + * actually it only supports the keyword on C++. + * + * To avoid this the _ALLOW_KEYWORD_MACROS must be set. + */ +# if (_MSC_VER >= 1700) && !defined(_ALLOW_KEYWORD_MACROS) +# define _ALLOW_KEYWORD_MACROS +# endif + + /* + * XXX: MSVC has a `__restrict` keyword, but it also has a + * `__declspec(restrict)` modifier, so it is impossible to define a + * `restrict` macro without interfering with the latter. Furthermore the + * MSVC standard library uses __declspec(restrict) under the _CRTRESTRICT + * macro. For now resolve this issue by redefining _CRTRESTRICT, but going + * forward we should probably should stop using restrict, especially + * considering that our code does not obbey strict aliasing rules any way. + */ +# include <crtdefs.h> +# undef _CRTRESTRICT +# define _CRTRESTRICT +#endif + + +/* + * C99 inline keyword + */ +#ifndef inline +# ifdef __cplusplus + /* C++ supports inline keyword */ +# elif defined(__GNUC__) +# define inline __inline__ +# elif defined(_MSC_VER) +# define inline __inline +# elif defined(__ICL) +# define inline __inline +# elif defined(__INTEL_COMPILER) + /* Intel compiler supports inline keyword */ +# elif defined(__WATCOMC__) && (__WATCOMC__ >= 1100) +# define inline __inline +# elif defined(__SUNPRO_C) && defined(__C99FEATURES__) + /* C99 supports inline keyword */ +# elif (__STDC_VERSION__ >= 199901L) + /* C99 supports inline keyword */ +# else +# define inline +# endif +#endif + + +/* + * C99 restrict keyword + * + * See also: + * - http://cellperformance.beyond3d.com/articles/2006/05/demystifying-the-restrict-keyword.html + */ +#ifndef restrict +# if (__STDC_VERSION__ >= 199901L) + /* C99 */ +# elif defined(__SUNPRO_C) && defined(__C99FEATURES__) + /* C99 */ +# elif defined(__GNUC__) +# define restrict __restrict__ +# elif defined(_MSC_VER) +# define restrict __restrict +# else +# define restrict /* */ +# endif +#endif + + +/* + * C99 __func__ macro + */ +#ifndef __func__ +# if (__STDC_VERSION__ >= 199901L) + /* C99 */ +# elif defined(__SUNPRO_C) && defined(__C99FEATURES__) + /* C99 */ +# elif defined(__GNUC__) +# if __GNUC__ >= 2 +# define __func__ __FUNCTION__ +# else +# define __func__ "<unknown>" +# endif +# elif defined(_MSC_VER) +# if _MSC_VER >= 1300 +# define __func__ __FUNCTION__ +# else +# define __func__ "<unknown>" +# endif +# else +# define __func__ "<unknown>" +# endif +#endif + + +/* Simple test case for debugging */ +#if 0 +static inline const char * +test_c99_compat_h(const void * restrict a, + const void * restrict b) +{ + return __func__; +} +#endif + + +#endif /* _C99_COMPAT_H_ */ diff --git a/mesalib/scons/gallium.py b/mesalib/scons/gallium.py index 4b51b6e7c..b28be5d89 100644 --- a/mesalib/scons/gallium.py +++ b/mesalib/scons/gallium.py @@ -289,6 +289,7 @@ def generate(env): '_CRT_SECURE_NO_DEPRECATE', '_SCL_SECURE_NO_WARNINGS', '_SCL_SECURE_NO_DEPRECATE', + '_ALLOW_KEYWORD_MACROS', ] if env['build'] in ('debug', 'checked'): cppdefines += ['_DEBUG'] @@ -401,6 +402,8 @@ def generate(env): '/Oi', # enable intrinsic functions ] else: + if distutils.version.LooseVersion(env['MSVC_VERSION']) < distutils.version.LooseVersion('11.0'): + print 'scons: warning: Visual Studio versions prior to 2012 are known to produce incorrect code when optimizations are enabled ( https://bugs.freedesktop.org/show_bug.cgi?id=58718 )' ccflags += [ '/O2', # optimize for speed ] diff --git a/mesalib/src/gallium/auxiliary/Makefile.am b/mesalib/src/gallium/auxiliary/Makefile.am index a4eee4773..f14279b4f 100644 --- a/mesalib/src/gallium/auxiliary/Makefile.am +++ b/mesalib/src/gallium/auxiliary/Makefile.am @@ -7,7 +7,10 @@ noinst_LTLIBRARIES = libgallium.la AM_CFLAGS = \ -I$(top_srcdir)/src/gallium/auxiliary/util \ - $(GALLIUM_CFLAGS) + $(GALLIUM_CFLAGS) \ + $(VISIBILITY_CFLAGS) + +AM_CXXFLAGS = $(VISIBILITY_CXXFLAGS) libgallium_la_SOURCES = \ $(C_SOURCES) \ @@ -18,7 +21,7 @@ if HAVE_MESA_LLVM AM_CFLAGS += \ $(LLVM_CFLAGS) -AM_CXXFLAGS = \ +AM_CXXFLAGS += \ $(GALLIUM_CFLAGS) \ $(LLVM_CXXFLAGS) diff --git a/mesalib/src/gallium/auxiliary/util/u_blitter.c b/mesalib/src/gallium/auxiliary/util/u_blitter.c index a85183644..70fec9118 100644 --- a/mesalib/src/gallium/auxiliary/util/u_blitter.c +++ b/mesalib/src/gallium/auxiliary/util/u_blitter.c @@ -703,7 +703,7 @@ static void blitter_set_texcoords(struct blitter_context_priv *ctx, case PIPE_TEXTURE_2D: for (i = 0; i < 4; i++) { - ctx->vertices[i][1][2] = (float) sample; /*r*/ + ctx->vertices[i][1][3] = (float) sample; /*r*/ } break; diff --git a/mesalib/src/gallium/auxiliary/util/u_dump_state.c b/mesalib/src/gallium/auxiliary/util/u_dump_state.c index d7df5b495..2f28f3c84 100644 --- a/mesalib/src/gallium/auxiliary/util/u_dump_state.c +++ b/mesalib/src/gallium/auxiliary/util/u_dump_state.c @@ -722,9 +722,8 @@ util_dump_vertex_element(FILE *stream, const struct pipe_vertex_element *state) util_dump_struct_begin(stream, "pipe_vertex_element"); util_dump_member(stream, uint, state, src_offset); - + util_dump_member(stream, uint, state, instance_divisor); util_dump_member(stream, uint, state, vertex_buffer_index); - util_dump_member(stream, format, state, src_format); util_dump_struct_end(stream); diff --git a/mesalib/src/gallium/auxiliary/util/u_simple_shaders.c b/mesalib/src/gallium/auxiliary/util/u_simple_shaders.c index 7e3666122..c53c2d024 100644 --- a/mesalib/src/gallium/auxiliary/util/u_simple_shaders.c +++ b/mesalib/src/gallium/auxiliary/util/u_simple_shaders.c @@ -400,7 +400,7 @@ util_make_fs_blit_msaa_gen(struct pipe_context *pipe, "DCL TEMP[0]\n" "F2U TEMP[0], IN[0]\n" - "TXF OUT[0]%s, TEMP[0].xyzz, SAMP[0], %s\n" + "TXF OUT[0]%s, TEMP[0], SAMP[0], %s\n" "END\n"; const char *type = tgsi_texture_names[tgsi_tex]; diff --git a/mesalib/src/glsl/builtin_variables.cpp b/mesalib/src/glsl/builtin_variables.cpp index 53c4c51cd..b0c7a2035 100644 --- a/mesalib/src/glsl/builtin_variables.cpp +++ b/mesalib/src/glsl/builtin_variables.cpp @@ -47,18 +47,18 @@ struct builtin_variable { }; static const builtin_variable builtin_core_vs_variables[] = { - { ir_var_shader_out, VERT_RESULT_HPOS, "vec4", "gl_Position" }, - { ir_var_shader_out, VERT_RESULT_PSIZ, "float", "gl_PointSize" }, + { ir_var_shader_out, VARYING_SLOT_POS, "vec4", "gl_Position" }, + { ir_var_shader_out, VARYING_SLOT_PSIZ, "float", "gl_PointSize" }, }; static const builtin_variable builtin_core_fs_variables[] = { - { ir_var_shader_in, FRAG_ATTRIB_WPOS, "vec4", "gl_FragCoord" }, - { ir_var_shader_in, FRAG_ATTRIB_FACE, "bool", "gl_FrontFacing" }, + { ir_var_shader_in, VARYING_SLOT_POS, "vec4", "gl_FragCoord" }, + { ir_var_shader_in, VARYING_SLOT_FACE, "bool", "gl_FrontFacing" }, { ir_var_shader_out, FRAG_RESULT_COLOR, "vec4", "gl_FragColor" }, }; static const builtin_variable builtin_100ES_fs_variables[] = { - { ir_var_shader_in, FRAG_ATTRIB_PNTC, "vec2", "gl_PointCoord" }, + { ir_var_shader_in, VARYING_SLOT_PNTC, "vec2", "gl_PointCoord" }, }; static const builtin_variable builtin_300ES_vs_variables[] = { @@ -66,10 +66,10 @@ static const builtin_variable builtin_300ES_vs_variables[] = { }; static const builtin_variable builtin_300ES_fs_variables[] = { - { ir_var_shader_in, FRAG_ATTRIB_WPOS, "vec4", "gl_FragCoord" }, - { ir_var_shader_in, FRAG_ATTRIB_FACE, "bool", "gl_FrontFacing" }, + { ir_var_shader_in, VARYING_SLOT_POS, "vec4", "gl_FragCoord" }, + { ir_var_shader_in, VARYING_SLOT_FACE, "bool", "gl_FrontFacing" }, { ir_var_shader_out, FRAG_RESULT_DEPTH, "float", "gl_FragDepth" }, - { ir_var_shader_in, FRAG_ATTRIB_PNTC, "vec2", "gl_PointCoord" }, + { ir_var_shader_in, VARYING_SLOT_PNTC, "vec2", "gl_PointCoord" }, }; static const builtin_variable builtin_110_fs_variables[] = { @@ -77,9 +77,9 @@ static const builtin_variable builtin_110_fs_variables[] = { }; static const builtin_variable builtin_110_deprecated_fs_variables[] = { - { ir_var_shader_in, FRAG_ATTRIB_COL0, "vec4", "gl_Color" }, - { ir_var_shader_in, FRAG_ATTRIB_COL1, "vec4", "gl_SecondaryColor" }, - { ir_var_shader_in, FRAG_ATTRIB_FOGC, "float", "gl_FogFragCoord" }, + { ir_var_shader_in, VARYING_SLOT_COL0, "vec4", "gl_Color" }, + { ir_var_shader_in, VARYING_SLOT_COL1, "vec4", "gl_SecondaryColor" }, + { ir_var_shader_in, VARYING_SLOT_FOGC, "float", "gl_FogFragCoord" }, }; static const builtin_variable builtin_110_deprecated_vs_variables[] = { @@ -96,16 +96,16 @@ static const builtin_variable builtin_110_deprecated_vs_variables[] = { { ir_var_shader_in, VERT_ATTRIB_TEX6, "vec4", "gl_MultiTexCoord6" }, { ir_var_shader_in, VERT_ATTRIB_TEX7, "vec4", "gl_MultiTexCoord7" }, { ir_var_shader_in, VERT_ATTRIB_FOG, "float", "gl_FogCoord" }, - { ir_var_shader_out, VERT_RESULT_CLIP_VERTEX, "vec4", "gl_ClipVertex" }, - { ir_var_shader_out, VERT_RESULT_COL0, "vec4", "gl_FrontColor" }, - { ir_var_shader_out, VERT_RESULT_BFC0, "vec4", "gl_BackColor" }, - { ir_var_shader_out, VERT_RESULT_COL1, "vec4", "gl_FrontSecondaryColor" }, - { ir_var_shader_out, VERT_RESULT_BFC1, "vec4", "gl_BackSecondaryColor" }, - { ir_var_shader_out, VERT_RESULT_FOGC, "float", "gl_FogFragCoord" }, + { ir_var_shader_out, VARYING_SLOT_CLIP_VERTEX, "vec4", "gl_ClipVertex" }, + { ir_var_shader_out, VARYING_SLOT_COL0, "vec4", "gl_FrontColor" }, + { ir_var_shader_out, VARYING_SLOT_BFC0, "vec4", "gl_BackColor" }, + { ir_var_shader_out, VARYING_SLOT_COL1, "vec4", "gl_FrontSecondaryColor" }, + { ir_var_shader_out, VARYING_SLOT_BFC1, "vec4", "gl_BackSecondaryColor" }, + { ir_var_shader_out, VARYING_SLOT_FOGC, "float", "gl_FogFragCoord" }, }; static const builtin_variable builtin_120_fs_variables[] = { - { ir_var_shader_in, FRAG_ATTRIB_PNTC, "vec2", "gl_PointCoord" }, + { ir_var_shader_in, VARYING_SLOT_PNTC, "vec2", "gl_PointCoord" }, }; static const builtin_variable builtin_130_vs_variables[] = { @@ -681,7 +681,7 @@ generate_110_uniforms(exec_list *instructions, glsl_type::get_array_instance(glsl_type::vec4_type, VERT_ATTRIB_MAX); add_uniform(instructions, symtab, "gl_CurrentAttribVertMESA", vert_attribs); const glsl_type *const frag_attribs = - glsl_type::get_array_instance(glsl_type::vec4_type, FRAG_ATTRIB_MAX); + glsl_type::get_array_instance(glsl_type::vec4_type, VARYING_SLOT_MAX); add_uniform(instructions, symtab, "gl_CurrentAttribFragMESA", frag_attribs); } @@ -755,7 +755,7 @@ generate_110_vs_variables(exec_list *instructions, add_variable(instructions, state->symbols, "gl_TexCoord", vec4_array_type, ir_var_shader_out, - VERT_RESULT_TEX0); + VARYING_SLOT_TEX0); generate_ARB_draw_buffers_variables(instructions, state, false, vertex_shader); @@ -816,7 +816,7 @@ generate_130_vs_variables(exec_list *instructions, add_variable(instructions, state->symbols, "gl_ClipDistance", clip_distance_array_type, ir_var_shader_out, - VERT_RESULT_CLIP_DIST0); + VARYING_SLOT_CLIP_DIST0); } @@ -942,7 +942,7 @@ generate_110_fs_variables(exec_list *instructions, add_variable(instructions, state->symbols, "gl_TexCoord", vec4_array_type, ir_var_shader_in, - FRAG_ATTRIB_TEX0); + VARYING_SLOT_TEX0); generate_ARB_draw_buffers_variables(instructions, state, false, fragment_shader); @@ -1089,7 +1089,7 @@ generate_fs_clipdistance(exec_list *instructions, add_variable(instructions, state->symbols, "gl_ClipDistance", clip_distance_array_type, ir_var_shader_in, - FRAG_ATTRIB_CLIP_DIST0); + VARYING_SLOT_CLIP_DIST0); } static void diff --git a/mesalib/src/glsl/ir.cpp b/mesalib/src/glsl/ir.cpp index 2eb3af695..60ef8b95a 100644 --- a/mesalib/src/glsl/ir.cpp +++ b/mesalib/src/glsl/ir.cpp @@ -1553,7 +1553,7 @@ ir_variable::determine_interpolation_mode(bool flat_shade) return (glsl_interp_qualifier) this->interpolation; int location = this->location; bool is_gl_Color = - location == FRAG_ATTRIB_COL0 || location == FRAG_ATTRIB_COL1; + location == VARYING_SLOT_COL0 || location == VARYING_SLOT_COL1; if (flat_shade && is_gl_Color) return INTERP_QUALIFIER_FLAT; else diff --git a/mesalib/src/glsl/ir.h b/mesalib/src/glsl/ir.h index 393b48673..bbfec695f 100644 --- a/mesalib/src/glsl/ir.h +++ b/mesalib/src/glsl/ir.h @@ -505,8 +505,8 @@ public: * The precise meaning of this field depends on the nature of the variable. * * - Vertex shader input: one of the values from \c gl_vert_attrib. - * - Vertex shader output: one of the values from \c gl_vert_result. - * - Fragment shader input: one of the values from \c gl_frag_attrib. + * - Vertex shader output: one of the values from \c gl_varying_slot. + * - Fragment shader input: one of the values from \c gl_varying_slot. * - Fragment shader output: one of the values from \c gl_frag_result. * - Uniforms: Per-stage uniform slot number for default uniform block. * - Uniforms: Index within the uniform block definition for UBO members. diff --git a/mesalib/src/glsl/link_varyings.cpp b/mesalib/src/glsl/link_varyings.cpp index 616933dfd..04c9fdd7c 100644 --- a/mesalib/src/glsl/link_varyings.cpp +++ b/mesalib/src/glsl/link_varyings.cpp @@ -604,8 +604,8 @@ private: /** * The location which has been assigned for this varying. This is * expressed in multiples of a float, with the first generic varying - * (i.e. the one referred to by VERT_RESULT_VAR0 or FRAG_ATTRIB_VAR0) - * represented by the value 0. + * (i.e. the one referred to by VARYING_SLOT_VAR0) represented by the + * value 0. */ unsigned generic_location; } *matches; @@ -842,9 +842,9 @@ is_varying_var(GLenum shaderType, const ir_variable *var) if (shaderType == GL_FRAGMENT_SHADER && var->mode == ir_var_shader_in) { switch (var->location) { - case FRAG_ATTRIB_WPOS: - case FRAG_ATTRIB_FACE: - case FRAG_ATTRIB_PNTC: + case VARYING_SLOT_POS: + case VARYING_SLOT_FACE: + case VARYING_SLOT_PNTC: return false; default: return true; @@ -958,9 +958,8 @@ assign_varying_locations(struct gl_context *ctx, unsigned num_tfeedback_decls, tfeedback_decl *tfeedback_decls) { - /* FINISHME: Set dynamically when geometry shader support is added. */ - const unsigned producer_base = VERT_RESULT_VAR0; - const unsigned consumer_base = FRAG_ATTRIB_VAR0; + const unsigned producer_base = VARYING_SLOT_VAR0; + const unsigned consumer_base = VARYING_SLOT_VAR0; varying_matches matches(ctx->Const.DisableVaryingPacking); hash_table *tfeedback_candidates = hash_table_ctor(0, hash_table_string_hash, hash_table_string_compare); diff --git a/mesalib/src/glsl/linker.cpp b/mesalib/src/glsl/linker.cpp index 57e7a9ad3..29856b080 100644 --- a/mesalib/src/glsl/linker.cpp +++ b/mesalib/src/glsl/linker.cpp @@ -1777,13 +1777,13 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog) if (prog->_LinkedShaders[MESA_SHADER_VERTEX] != NULL) { link_invalidate_variable_locations( prog->_LinkedShaders[MESA_SHADER_VERTEX], - VERT_ATTRIB_GENERIC0, VERT_RESULT_VAR0); + VERT_ATTRIB_GENERIC0, VARYING_SLOT_VAR0); } /* FINISHME: Geometry shaders not implemented yet */ if (prog->_LinkedShaders[MESA_SHADER_FRAGMENT] != NULL) { link_invalidate_variable_locations( prog->_LinkedShaders[MESA_SHADER_FRAGMENT], - FRAG_ATTRIB_VAR0, FRAG_RESULT_DATA0); + VARYING_SLOT_VAR0, FRAG_RESULT_DATA0); } /* FINISHME: The value of the max_attribute_index parameter is diff --git a/mesalib/src/glsl/lower_packed_varyings.cpp b/mesalib/src/glsl/lower_packed_varyings.cpp index 8a40f5e72..b4cc5cd0d 100644 --- a/mesalib/src/glsl/lower_packed_varyings.cpp +++ b/mesalib/src/glsl/lower_packed_varyings.cpp @@ -117,7 +117,7 @@ private: /** * Location representing the first generic varying slot for this shader - * stage (e.g. VERT_RESULT_VAR0 if we are packing vertex shader outputs). + * stage (e.g. VARYING_SLOT_VAR0 if we are packing vertex shader outputs). * Varyings whose location is less than this value are assumed to * correspond to special fixed function hardware, so they are not lowered. */ diff --git a/mesalib/src/mapi/mapi/u_compiler.h b/mesalib/src/mapi/mapi/u_compiler.h index 2b019ed15..f376e97a0 100644 --- a/mesalib/src/mapi/mapi/u_compiler.h +++ b/mesalib/src/mapi/mapi/u_compiler.h @@ -1,28 +1,10 @@ #ifndef _U_COMPILER_H_ #define _U_COMPILER_H_ -/* Function inlining */ -#ifndef inline -# ifdef __cplusplus - /* C++ supports inline keyword */ -# elif defined(__GNUC__) -# define inline __inline__ -# elif defined(_MSC_VER) -# define inline __inline -# elif defined(__ICL) -# define inline __inline -# elif defined(__INTEL_COMPILER) - /* Intel compiler supports inline keyword */ -# elif defined(__WATCOMC__) && (__WATCOMC__ >= 1100) -# define inline __inline -# elif defined(__SUNPRO_C) && defined(__C99FEATURES__) - /* C99 supports inline keyword */ -# elif (__STDC_VERSION__ >= 199901L) - /* C99 supports inline keyword */ -# else -# define inline -# endif -#endif +#include "c99_compat.h" /* inline, __func__, etc. */ + + +/* XXX: Use standard `inline` keyword instead */ #ifndef INLINE # define INLINE inline #endif diff --git a/mesalib/src/mesa/Makefile.am b/mesalib/src/mesa/Makefile.am index 41483dd63..c341c48e7 100644 --- a/mesalib/src/mesa/Makefile.am +++ b/mesalib/src/mesa/Makefile.am @@ -87,7 +87,6 @@ AM_CPPFLAGS = $(API_DEFINES) $(DEFINES) $(INCLUDE_DIRS) AM_CFLAGS = $(LLVM_CFLAGS) $(VISIBILITY_CFLAGS) AM_CXXFLAGS = $(LLVM_CFLAGS) $(VISIBILITY_CXXFLAGS) -# cannot just add $(MESA_ASM_FILES) to libmesa_la_SOURCES as it contains a configure substitution MESA_ASM_FILES_FOR_ARCH = if HAVE_X86_ASM diff --git a/mesalib/src/mesa/drivers/dri/common/xmlpool/.gitignore b/mesalib/src/mesa/drivers/dri/common/xmlpool/.gitignore index f6ba5c849..0e0bf178e 100644 --- a/mesalib/src/mesa/drivers/dri/common/xmlpool/.gitignore +++ b/mesalib/src/mesa/drivers/dri/common/xmlpool/.gitignore @@ -4,5 +4,4 @@ fr nl sv options.h -Makefile xmlpool.pot diff --git a/mesalib/src/mesa/drivers/dri/common/xmlpool/t_options.h b/mesalib/src/mesa/drivers/dri/common/xmlpool/t_options.h index 683a47366..1e7eced06 100644 --- a/mesalib/src/mesa/drivers/dri/common/xmlpool/t_options.h +++ b/mesalib/src/mesa/drivers/dri/common/xmlpool/t_options.h @@ -47,7 +47,10 @@ * predefined option sections and options with multi-lingual descriptions */ -/** \brief Debugging options */ + +/** + * \brief Debugging options + */ #define DRI_CONF_SECTION_DEBUG \ DRI_CONF_SECTION_BEGIN \ DRI_CONF_DESC(en,gettext("Debugging")) @@ -62,8 +65,36 @@ DRI_CONF_OPT_BEGIN(performance_boxes,bool,def) \ DRI_CONF_DESC(en,gettext("Show performance boxes")) \ DRI_CONF_OPT_END +#define DRI_CONF_ALWAYS_FLUSH_BATCH(def) \ +DRI_CONF_OPT_BEGIN(always_flush_batch,bool,def) \ + DRI_CONF_DESC(en,gettext("Enable flushing batchbuffer after each draw call")) \ +DRI_CONF_OPT_END + +#define DRI_CONF_ALWAYS_FLUSH_CACHE(def) \ +DRI_CONF_OPT_BEGIN(always_flush_cache,bool,def) \ + DRI_CONF_DESC(en,gettext("Enable flushing GPU caches with each draw call")) \ +DRI_CONF_OPT_END -/** \brief Texture-related options */ +#define DRI_CONF_FORCE_GLSL_EXTENSIONS_WARN(def) \ +DRI_CONF_OPT_BEGIN(force_glsl_extensions_warn,bool,def) \ + DRI_CONF_DESC(en,gettext("Force GLSL extension default behavior to 'warn'")) \ +DRI_CONF_OPT_END + +#define DRI_CONF_DISABLE_BLEND_FUNC_EXTENDED(def) \ +DRI_CONF_OPT_BEGIN(disable_blend_func_extended,bool,def) \ + DRI_CONF_DESC(en,gettext("Disable dual source blending")) \ +DRI_CONF_OPT_END + +#define DRI_CONF_DISABLE_GLSL_LINE_CONTINUATIONS(def) \ +DRI_CONF_OPT_BEGIN(disable_glsl_line_continuations,bool,def) \ + DRI_CONF_DESC(en,gettext("Disable backslash-based line continuations in GLSL source")) \ +DRI_CONF_OPT_END + + + +/** + * \brief Image quality-related options + */ #define DRI_CONF_SECTION_QUALITY \ DRI_CONF_SECTION_BEGIN \ DRI_CONF_DESC(en,gettext("Image Quality")) @@ -139,7 +170,41 @@ DRI_CONF_OPT_BEGIN(float_depth,bool,def) \ DRI_CONF_DESC(en,gettext("Floating point depth buffer")) \ DRI_CONF_OPT_END -/** \brief Performance-related options */ +#define DRI_CONF_PP_CELSHADE(def) \ +DRI_CONF_OPT_BEGIN_V(pp_celshade,enum,def,"0:1") \ + DRI_CONF_DESC(en,gettext("A post-processing filter to cel-shade the output")) \ +DRI_CONF_OPT_END + +#define DRI_CONF_PP_NORED(def) \ +DRI_CONF_OPT_BEGIN_V(pp_nored,enum,def,"0:1") \ + DRI_CONF_DESC(en,gettext("A post-processing filter to remove the red channel")) \ +DRI_CONF_OPT_END + +#define DRI_CONF_PP_NOGREEN(def) \ +DRI_CONF_OPT_BEGIN_V(pp_nogreen,enum,def,"0:1") \ + DRI_CONF_DESC(en,gettext("A post-processing filter to remove the green channel")) \ +DRI_CONF_OPT_END + +#define DRI_CONF_PP_NOBLUE(def) \ +DRI_CONF_OPT_BEGIN_V(pp_noblue,enum,def,"0:1") \ + DRI_CONF_DESC(en,gettext("A post-processing filter to remove the blue channel")) \ +DRI_CONF_OPT_END + +#define DRI_CONF_PP_JIMENEZMLAA(def,min,max) \ +DRI_CONF_OPT_BEGIN_V(pp_jimenezmlaa,int,def, # min ":" # max ) \ + DRI_CONF_DESC(en,gettext("Morphological anti-aliasing based on Jimenez\\\' MLAA. 0 to disable, 8 for default quality")) \ +DRI_CONF_OPT_END + +#define DRI_CONF_PP_JIMENEZMLAA_COLOR(def,min,max) \ +DRI_CONF_OPT_BEGIN_V(pp_jimenezmlaa_color,int,def, # min ":" # max ) \ + DRI_CONF_DESC(en,gettext("Morphological anti-aliasing based on Jimenez\\\' MLAA. 0 to disable, 8 for default quality. Color version, usable with 2d GL apps")) \ +DRI_CONF_OPT_END + + + +/** + * \brief Performance-related options + */ #define DRI_CONF_SECTION_PERFORMANCE \ DRI_CONF_SECTION_BEGIN \ DRI_CONF_DESC(en,gettext("Performance")) @@ -191,36 +256,6 @@ DRI_CONF_OPT_BEGIN(hyperz,bool,def) \ DRI_CONF_DESC(en,gettext("Use HyperZ to boost performance")) \ DRI_CONF_OPT_END -#define DRI_CONF_PP_CELSHADE(def) \ -DRI_CONF_OPT_BEGIN_V(pp_celshade,enum,def,"0:1") \ - DRI_CONF_DESC(en,gettext("A post-processing filter to cel-shade the output")) \ -DRI_CONF_OPT_END - -#define DRI_CONF_PP_NORED(def) \ -DRI_CONF_OPT_BEGIN_V(pp_nored,enum,def,"0:1") \ - DRI_CONF_DESC(en,gettext("A post-processing filter to remove the red channel")) \ -DRI_CONF_OPT_END - -#define DRI_CONF_PP_NOGREEN(def) \ -DRI_CONF_OPT_BEGIN_V(pp_nogreen,enum,def,"0:1") \ - DRI_CONF_DESC(en,gettext("A post-processing filter to remove the green channel")) \ -DRI_CONF_OPT_END - -#define DRI_CONF_PP_NOBLUE(def) \ -DRI_CONF_OPT_BEGIN_V(pp_noblue,enum,def,"0:1") \ - DRI_CONF_DESC(en,gettext("A post-processing filter to remove the blue channel")) \ -DRI_CONF_OPT_END - -#define DRI_CONF_PP_JIMENEZMLAA(def,min,max) \ -DRI_CONF_OPT_BEGIN_V(pp_jimenezmlaa,int,def, # min ":" # max ) \ - DRI_CONF_DESC(en,gettext("Morphological anti-aliasing based on Jimenez\\\' MLAA. 0 to disable, 8 for default quality")) \ -DRI_CONF_OPT_END - -#define DRI_CONF_PP_JIMENEZMLAA_COLOR(def,min,max) \ -DRI_CONF_OPT_BEGIN_V(pp_jimenezmlaa_color,int,def, # min ":" # max ) \ - DRI_CONF_DESC(en,gettext("Morphological anti-aliasing based on Jimenez\\\' MLAA. 0 to disable, 8 for default quality. Color version, usable with 2d GL apps")) \ -DRI_CONF_OPT_END - #define DRI_CONF_MAX_TEXTURE_UNITS(def,min,max) \ DRI_CONF_OPT_BEGIN_V(texture_units,int,def, # min ":" # max ) \ DRI_CONF_DESC(en,gettext("Number of texture units used")) \ @@ -252,8 +287,12 @@ DRI_CONF_OPT_BEGIN_V(texture_heaps,enum,def,"0:2") \ DRI_CONF_DESC_END \ DRI_CONF_OPT_END -/* Options for features that are not done in hardware by the driver (like GL_ARB_vertex_program - On cards where there is no documentation (r200) or on rasterization-only hardware). */ + + +/** + * \brief Software-fallback options. To allow using features (like + * GL_ARB_vertex_program) on GPUs that don't otherwise support the feature. + */ #define DRI_CONF_SECTION_SOFTWARE \ DRI_CONF_SECTION_BEGIN \ DRI_CONF_DESC(en,gettext("Features that are not hardware-accelerated")) @@ -263,27 +302,16 @@ DRI_CONF_OPT_BEGIN(arb_vertex_program,bool,def) \ DRI_CONF_DESC(en,gettext("Enable extension GL_ARB_vertex_program")) \ DRI_CONF_OPT_END -#define DRI_CONF_ALWAYS_FLUSH_BATCH(def) \ -DRI_CONF_OPT_BEGIN(always_flush_batch,bool,def) \ - DRI_CONF_DESC(en,gettext("Enable flushing batchbuffer after each draw call")) \ -DRI_CONF_OPT_END - -#define DRI_CONF_ALWAYS_FLUSH_CACHE(def) \ -DRI_CONF_OPT_BEGIN(always_flush_cache,bool,def) \ - DRI_CONF_DESC(en,gettext("Enable flushing GPU caches with each draw call")) \ -DRI_CONF_OPT_END -#define DRI_CONF_FORCE_GLSL_EXTENSIONS_WARN(def) \ -DRI_CONF_OPT_BEGIN(force_glsl_extensions_warn,bool,def) \ - DRI_CONF_DESC(en,gettext("Force GLSL extension default behavior to 'warn'")) \ -DRI_CONF_OPT_END -#define DRI_CONF_DISABLE_BLEND_FUNC_EXTENDED(def) \ -DRI_CONF_OPT_BEGIN(disable_blend_func_extended,bool,def) \ - DRI_CONF_DESC(en,gettext("Disable dual source blending")) \ -DRI_CONF_OPT_END +/** + * \brief Miscellaneous configuration options + */ +#define DRI_CONF_SECTION_MISCELLANEOUS \ +DRI_CONF_SECTION_BEGIN \ + DRI_CONF_DESC(en,gettext("Miscellaneous")) -#define DRI_CONF_DISABLE_GLSL_LINE_CONTINUATIONS(def) \ -DRI_CONF_OPT_BEGIN(disable_glsl_line_continuations,bool,def) \ - DRI_CONF_DESC(en,gettext("Disable backslash-based line continuations in GLSL source")) \ +#define DRI_CONF_ALWAYS_HAVE_DEPTH_BUFFER(def) \ +DRI_CONF_OPT_BEGIN(always_have_depth_buffer, bool, def) \ + DRI_CONF_DESC(en,gettext("Create all visuals with a depth buffer")) \ DRI_CONF_OPT_END diff --git a/mesalib/src/mesa/main/compiler.h b/mesalib/src/mesa/main/compiler.h index b22b99485..48712485a 100644 --- a/mesalib/src/mesa/main/compiler.h +++ b/mesalib/src/mesa/main/compiler.h @@ -48,6 +48,8 @@ #include <float.h> #include <stdarg.h> +#include "c99_compat.h" /* inline, __func__, etc. */ + #ifdef __cplusplus extern "C" { @@ -111,30 +113,7 @@ extern "C" { -/** - * Function inlining - */ -#ifndef inline -# ifdef __cplusplus - /* C++ supports inline keyword */ -# elif defined(__GNUC__) -# define inline __inline__ -# elif defined(_MSC_VER) -# define inline __inline -# elif defined(__ICL) -# define inline __inline -# elif defined(__INTEL_COMPILER) - /* Intel compiler supports inline keyword */ -# elif defined(__WATCOMC__) && (__WATCOMC__ >= 1100) -# define inline __inline -# elif defined(__SUNPRO_C) && defined(__C99FEATURES__) - /* C99 supports inline keyword */ -# elif (__STDC_VERSION__ >= 199901L) - /* C99 supports inline keyword */ -# else -# define inline -# endif -#endif +/* XXX: Use standard `inline` keyword instead */ #ifndef INLINE # define INLINE inline #endif @@ -177,35 +156,10 @@ extern "C" { # endif #endif -/** - * The __FUNCTION__ gcc variable is generally only used for debugging. - * If we're not using gcc, define __FUNCTION__ as a cpp symbol here. - * Don't define it if using a newer Windows compiler. - */ +/* XXX: Use standard `__func__` instead */ #ifndef __FUNCTION__ -# if !defined(__GNUC__) && !defined(__xlC__) && \ - (!defined(_MSC_VER) || _MSC_VER < 1300) -# if (__STDC_VERSION__ >= 199901L) /* C99 */ || \ - (defined(__SUNPRO_C) && defined(__C99FEATURES__)) -# define __FUNCTION__ __func__ -# else -# define __FUNCTION__ "<unknown>" -# endif -# endif +# define __FUNCTION__ __func__ #endif -#ifndef __func__ -# if (__STDC_VERSION__ >= 199901L) || \ - (defined(__SUNPRO_C) && defined(__C99FEATURES__)) - /* __func__ is part of C99 */ -# elif defined(_MSC_VER) -# if _MSC_VER >= 1300 -# define __func__ __FUNCTION__ -# else -# define __func__ "<unknown>" -# endif -# endif -#endif - /** * Either define MESA_BIG_ENDIAN or MESA_LITTLE_ENDIAN, and CPU_TO_LE32. diff --git a/mesalib/src/mesa/main/context.c b/mesalib/src/mesa/main/context.c index cdcf7adfa..053993421 100644 --- a/mesalib/src/mesa/main/context.c +++ b/mesalib/src/mesa/main/context.c @@ -344,23 +344,17 @@ dummy_enum_func(void) { gl_buffer_index bi = BUFFER_FRONT_LEFT; gl_face_index fi = FACE_POS_X; - gl_frag_attrib fa = FRAG_ATTRIB_WPOS; gl_frag_result fr = FRAG_RESULT_DEPTH; gl_texture_index ti = TEXTURE_2D_ARRAY_INDEX; gl_vert_attrib va = VERT_ATTRIB_POS; - gl_vert_result vr = VERT_RESULT_HPOS; - gl_geom_attrib ga = GEOM_ATTRIB_POSITION; - gl_geom_result gr = GEOM_RESULT_POS; + gl_varying_slot vs = VARYING_SLOT_POS; (void) bi; (void) fi; - (void) fa; (void) fr; (void) ti; (void) va; - (void) vr; - (void) ga; - (void) gr; + (void) vs; } @@ -410,7 +404,7 @@ one_time_init( struct gl_context *ctx ) #if defined(DEBUG) && defined(__DATE__) && defined(__TIME__) if (MESA_VERBOSE != 0) { _mesa_debug(ctx, "Mesa %s DEBUG build %s %s\n", - MESA_VERSION_STRING, __DATE__, __TIME__); + PACKAGE_VERSION, __DATE__, __TIME__); } #endif @@ -677,9 +671,9 @@ static void check_context_limits(struct gl_context *ctx) { /* check that we don't exceed the size of various bitfields */ - assert(VERT_RESULT_MAX <= + assert(VARYING_SLOT_MAX <= (8 * sizeof(ctx->VertexProgram._Current->Base.OutputsWritten))); - assert(FRAG_ATTRIB_MAX <= + assert(VARYING_SLOT_MAX <= (8 * sizeof(ctx->FragmentProgram._Current->Base.InputsRead))); assert(MAX_COMBINED_TEXTURE_IMAGE_UNITS <= 8 * sizeof(GLbitfield)); diff --git a/mesalib/src/mesa/main/errors.c b/mesalib/src/mesa/main/errors.c index 97f1b8a03..5c6a393e4 100644 --- a/mesalib/src/mesa/main/errors.c +++ b/mesalib/src/mesa/main/errors.c @@ -651,8 +651,8 @@ _mesa_DebugMessageControlARB(GLenum gl_source, GLenum gl_type, return; } - source = gl_enum_to_debug_severity(gl_source); - type = gl_enum_to_debug_severity(gl_type); + source = gl_enum_to_debug_source(gl_source); + type = gl_enum_to_debug_type(gl_type); severity = gl_enum_to_debug_severity(gl_severity); control_app_messages(ctx, source, type, severity, count, ids, enabled); @@ -848,8 +848,8 @@ _mesa_problem( const struct gl_context *ctx, const char *fmtString, ... ) _mesa_vsnprintf( str, MAX_DEBUG_MESSAGE_LENGTH, fmtString, args ); va_end( args ); fprintf(stderr, "Mesa %s implementation error: %s\n", - MESA_VERSION_STRING, str); - fprintf(stderr, "Please report at bugs.freedesktop.org\n"); + PACKAGE_VERSION, str); + fprintf(stderr, "Please report at " PACKAGE_BUGREPORT "\n"); } } diff --git a/mesalib/src/mesa/main/fbobject.c b/mesalib/src/mesa/main/fbobject.c index d6acc5896..0126e2930 100644 --- a/mesalib/src/mesa/main/fbobject.c +++ b/mesalib/src/mesa/main/fbobject.c @@ -3190,7 +3190,9 @@ _mesa_BlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, } } - if (!mask) { + if (!mask || + (srcX1 - srcX0) == 0 || (srcY1 - srcY0) == 0 || + (dstX1 - dstX0) == 0 || (dstY1 - dstY0) == 0) { return; } diff --git a/mesalib/src/mesa/main/ff_fragment_shader.cpp b/mesalib/src/mesa/main/ff_fragment_shader.cpp index 02b4707f0..186988bbd 100644 --- a/mesalib/src/mesa/main/ff_fragment_shader.cpp +++ b/mesalib/src/mesa/main/ff_fragment_shader.cpp @@ -304,7 +304,6 @@ static GLuint translate_tex_src_bit( GLbitfield bit ) #define VERT_BIT_TEX_ANY (0xff << VERT_ATTRIB_TEX0) -#define VERT_RESULT_TEX_ANY (0xff << VERT_RESULT_TEX0) /** * Identify all possible varying inputs. The fragment program will @@ -334,7 +333,7 @@ static GLbitfield get_fp_input_mask( struct gl_context *ctx ) } else if (ctx->RenderMode == GL_FEEDBACK) { /* _NEW_RENDERMODE */ - fp_inputs = (FRAG_BIT_COL0 | FRAG_BIT_TEX0); + fp_inputs = (VARYING_BIT_COL0 | VARYING_BIT_TEX0); } else if (!(vertexProgram || vertexShader)) { /* Fixed function vertex logic */ @@ -346,33 +345,33 @@ static GLbitfield get_fp_input_mask( struct gl_context *ctx ) */ /* _NEW_POINT */ if (ctx->Point.PointSprite) - varying_inputs |= FRAG_BITS_TEX_ANY; + varying_inputs |= VARYING_BITS_TEX_ANY; /* First look at what values may be computed by the generated * vertex program: */ /* _NEW_LIGHT */ if (ctx->Light.Enabled) { - fp_inputs |= FRAG_BIT_COL0; + fp_inputs |= VARYING_BIT_COL0; if (texenv_doing_secondary_color(ctx)) - fp_inputs |= FRAG_BIT_COL1; + fp_inputs |= VARYING_BIT_COL1; } /* _NEW_TEXTURE */ fp_inputs |= (ctx->Texture._TexGenEnabled | - ctx->Texture._TexMatEnabled) << FRAG_ATTRIB_TEX0; + ctx->Texture._TexMatEnabled) << VARYING_SLOT_TEX0; /* Then look at what might be varying as a result of enabled * arrays, etc: */ if (varying_inputs & VERT_BIT_COLOR0) - fp_inputs |= FRAG_BIT_COL0; + fp_inputs |= VARYING_BIT_COL0; if (varying_inputs & VERT_BIT_COLOR1) - fp_inputs |= FRAG_BIT_COL1; + fp_inputs |= VARYING_BIT_COL1; fp_inputs |= (((varying_inputs & VERT_BIT_TEX_ANY) >> VERT_ATTRIB_TEX0) - << FRAG_ATTRIB_TEX0); + << VARYING_SLOT_TEX0); } else { @@ -396,15 +395,15 @@ static GLbitfield get_fp_input_mask( struct gl_context *ctx ) */ /* _NEW_POINT */ if (ctx->Point.PointSprite) - vp_outputs |= FRAG_BITS_TEX_ANY; + vp_outputs |= VARYING_BITS_TEX_ANY; - if (vp_outputs & (1 << VERT_RESULT_COL0)) - fp_inputs |= FRAG_BIT_COL0; - if (vp_outputs & (1 << VERT_RESULT_COL1)) - fp_inputs |= FRAG_BIT_COL1; + if (vp_outputs & (1 << VARYING_SLOT_COL0)) + fp_inputs |= VARYING_BIT_COL0; + if (vp_outputs & (1 << VARYING_SLOT_COL1)) + fp_inputs |= VARYING_BIT_COL1; - fp_inputs |= (((vp_outputs & VERT_RESULT_TEX_ANY) >> VERT_RESULT_TEX0) - << FRAG_ATTRIB_TEX0); + fp_inputs |= (((vp_outputs & VARYING_BITS_TEX_ANY) >> VARYING_SLOT_TEX0) + << VARYING_SLOT_TEX0); } return fp_inputs; @@ -418,7 +417,7 @@ static GLbitfield get_fp_input_mask( struct gl_context *ctx ) static GLuint make_state_key( struct gl_context *ctx, struct state_key *key ) { GLuint i, j; - GLbitfield inputs_referenced = FRAG_BIT_COL0; + GLbitfield inputs_referenced = VARYING_BIT_COL0; const GLbitfield inputs_available = get_fp_input_mask( ctx ); GLuint keySize; @@ -441,7 +440,7 @@ static GLuint make_state_key( struct gl_context *ctx, struct state_key *key ) key->unit[i].enabled = 1; key->enabled_units |= (1<<i); key->nr_enabled_units = i + 1; - inputs_referenced |= FRAG_BIT_TEX(i); + inputs_referenced |= VARYING_BIT_TEX(i); key->unit[i].source_index = translate_tex_src_bit(texUnit->_ReallyEnabled); @@ -483,14 +482,14 @@ static GLuint make_state_key( struct gl_context *ctx, struct state_key *key ) /* _NEW_LIGHT | _NEW_FOG */ if (texenv_doing_secondary_color(ctx)) { key->separate_specular = 1; - inputs_referenced |= FRAG_BIT_COL1; + inputs_referenced |= VARYING_BIT_COL1; } /* _NEW_FOG */ if (ctx->Fog.Enabled) { key->fog_enabled = 1; key->fog_mode = translate_fog_mode(ctx->Fog.Mode); - inputs_referenced |= FRAG_BIT_FOGC; /* maybe */ + inputs_referenced |= VARYING_BIT_FOGC; /* maybe */ } /* _NEW_BUFFERS */ @@ -554,7 +553,7 @@ get_current_attrib(texenv_fragment_program *p, GLuint attrib) static ir_rvalue * get_gl_Color(texenv_fragment_program *p) { - if (p->state->inputs_available & FRAG_BIT_COL0) { + if (p->state->inputs_available & VARYING_BIT_COL0) { ir_variable *var = p->shader->symbols->get_variable("gl_Color"); assert(var); return new(p->mem_ctx) ir_dereference_variable(var); @@ -919,7 +918,7 @@ static void load_texture( texenv_fragment_program *p, GLuint unit ) const GLuint texTarget = p->state->unit[unit].source_index; ir_rvalue *texcoord; - if (!(p->state->inputs_available & (FRAG_BIT_TEX0 << unit))) { + if (!(p->state->inputs_available & (VARYING_BIT_TEX0 << unit))) { texcoord = get_current_attrib(p, VERT_ATTRIB_TEX0 + unit); } else if (p->texcoord_tex[unit]) { texcoord = new(p->mem_ctx) ir_dereference_variable(p->texcoord_tex[unit]); @@ -1254,7 +1253,7 @@ emit_instructions(texenv_fragment_program *p) p->emit(assign(spec_result, cf)); ir_rvalue *secondary; - if (p->state->inputs_available & FRAG_BIT_COL1) { + if (p->state->inputs_available & VARYING_BIT_COL1) { ir_variable *var = p->shader->symbols->get_variable("gl_SecondaryColor"); assert(var); diff --git a/mesalib/src/mesa/main/ffvertex_prog.c b/mesalib/src/mesa/main/ffvertex_prog.c index efdca015e..093bc6651 100644 --- a/mesalib/src/mesa/main/ffvertex_prog.c +++ b/mesalib/src/mesa/main/ffvertex_prog.c @@ -165,7 +165,7 @@ static void make_state_key( struct gl_context *ctx, struct state_key *key ) if (ctx->RenderMode == GL_FEEDBACK) { /* make sure the vertprog emits color and tex0 */ - key->fragprog_inputs_read |= (FRAG_BIT_COL0 | FRAG_BIT_TEX0); + key->fragprog_inputs_read |= (VARYING_BIT_COL0 | VARYING_BIT_TEX0); } key->separate_specular = (ctx->Light.Model.ColorControl == @@ -456,7 +456,7 @@ static struct ureg register_input( struct tnl_program *p, GLuint input ) /** - * \param input one of VERT_RESULT_x tokens. + * \param input one of VARYING_SLOT_x tokens. */ static struct ureg register_output( struct tnl_program *p, GLuint output ) { @@ -833,7 +833,7 @@ static struct ureg get_transformed_normal( struct tnl_program *p ) static void build_hpos( struct tnl_program *p ) { struct ureg pos = register_input( p, VERT_ATTRIB_POS ); - struct ureg hpos = register_output( p, VERT_RESULT_HPOS ); + struct ureg hpos = register_output( p, VARYING_SLOT_POS ); struct ureg mvp[4]; if (p->mvp_with_dp4) { @@ -1088,22 +1088,22 @@ static void build_lighting( struct tnl_program *p ) /* If no lights, still need to emit the scenecolor. */ { - struct ureg res0 = register_output( p, VERT_RESULT_COL0 ); + struct ureg res0 = register_output( p, VARYING_SLOT_COL0 ); emit_op1(p, OPCODE_MOV, res0, 0, _col0); } if (separate) { - struct ureg res1 = register_output( p, VERT_RESULT_COL1 ); + struct ureg res1 = register_output( p, VARYING_SLOT_COL1 ); emit_op1(p, OPCODE_MOV, res1, 0, _col1); } if (twoside) { - struct ureg res0 = register_output( p, VERT_RESULT_BFC0 ); + struct ureg res0 = register_output( p, VARYING_SLOT_BFC0 ); emit_op1(p, OPCODE_MOV, res0, 0, _bfc0); } if (twoside && separate) { - struct ureg res1 = register_output( p, VERT_RESULT_BFC1 ); + struct ureg res1 = register_output( p, VARYING_SLOT_BFC1 ); emit_op1(p, OPCODE_MOV, res1, 0, _bfc1); } @@ -1189,14 +1189,14 @@ static void build_lighting( struct tnl_program *p ) if (separate) { mask0 = WRITEMASK_XYZ; mask1 = WRITEMASK_XYZ; - res0 = register_output( p, VERT_RESULT_COL0 ); - res1 = register_output( p, VERT_RESULT_COL1 ); + res0 = register_output( p, VARYING_SLOT_COL0 ); + res1 = register_output( p, VARYING_SLOT_COL1 ); } else { mask0 = 0; mask1 = WRITEMASK_XYZ; res0 = _col0; - res1 = register_output( p, VERT_RESULT_COL0 ); + res1 = register_output( p, VARYING_SLOT_COL0 ); } } else { @@ -1244,14 +1244,14 @@ static void build_lighting( struct tnl_program *p ) if (separate) { mask0 = WRITEMASK_XYZ; mask1 = WRITEMASK_XYZ; - res0 = register_output( p, VERT_RESULT_BFC0 ); - res1 = register_output( p, VERT_RESULT_BFC1 ); + res0 = register_output( p, VARYING_SLOT_BFC0 ); + res1 = register_output( p, VARYING_SLOT_BFC1 ); } else { mask0 = 0; mask1 = WRITEMASK_XYZ; res0 = _bfc0; - res1 = register_output( p, VERT_RESULT_BFC0 ); + res1 = register_output( p, VARYING_SLOT_BFC0 ); } } else { @@ -1306,7 +1306,7 @@ static void build_lighting( struct tnl_program *p ) static void build_fog( struct tnl_program *p ) { - struct ureg fog = register_output(p, VERT_RESULT_FOGC); + struct ureg fog = register_output(p, VARYING_SLOT_FOGC); struct ureg input; if (p->state->fog_source_is_depth) { @@ -1407,7 +1407,7 @@ static void build_texture_transform( struct tnl_program *p ) for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++) { - if (!(p->state->fragprog_inputs_read & FRAG_BIT_TEX(i))) + if (!(p->state->fragprog_inputs_read & VARYING_BIT_TEX(i))) continue; if (p->state->unit[i].coord_replace) @@ -1417,7 +1417,7 @@ static void build_texture_transform( struct tnl_program *p ) p->state->unit[i].texmat_enabled) { GLuint texmat_enabled = p->state->unit[i].texmat_enabled; - struct ureg out = register_output(p, VERT_RESULT_TEX0 + i); + struct ureg out = register_output(p, VARYING_SLOT_TEX0 + i); struct ureg out_texgen = undef; if (p->state->unit[i].texgen_enabled) { @@ -1512,7 +1512,7 @@ static void build_texture_transform( struct tnl_program *p ) release_temps(p); } else { - emit_passthrough(p, VERT_ATTRIB_TEX0+i, VERT_RESULT_TEX0+i); + emit_passthrough(p, VERT_ATTRIB_TEX0+i, VARYING_SLOT_TEX0+i); } } } @@ -1526,7 +1526,7 @@ static void build_atten_pointsize( struct tnl_program *p ) struct ureg eye = get_eye_position_z(p); struct ureg state_size = register_param2(p, STATE_INTERNAL, STATE_POINT_SIZE_CLAMPED); struct ureg state_attenuation = register_param1(p, STATE_POINT_ATTENUATION); - struct ureg out = register_output(p, VERT_RESULT_PSIZ); + struct ureg out = register_output(p, VARYING_SLOT_PSIZ); struct ureg ut = get_temp(p); /* dist = |eyez| */ @@ -1562,7 +1562,7 @@ static void build_atten_pointsize( struct tnl_program *p ) static void build_array_pointsize( struct tnl_program *p ) { struct ureg in = register_input(p, VERT_ATTRIB_POINT_SIZE); - struct ureg out = register_output(p, VERT_RESULT_PSIZ); + struct ureg out = register_output(p, VARYING_SLOT_PSIZ); emit_op1(p, OPCODE_MOV, out, WRITEMASK_X, in); } @@ -1575,22 +1575,22 @@ static void build_tnl_program( struct tnl_program *p ) /* Lighting calculations: */ - if (p->state->fragprog_inputs_read & (FRAG_BIT_COL0|FRAG_BIT_COL1)) { + if (p->state->fragprog_inputs_read & (VARYING_BIT_COL0|VARYING_BIT_COL1)) { if (p->state->light_global_enabled) build_lighting(p); else { - if (p->state->fragprog_inputs_read & FRAG_BIT_COL0) - emit_passthrough(p, VERT_ATTRIB_COLOR0, VERT_RESULT_COL0); + if (p->state->fragprog_inputs_read & VARYING_BIT_COL0) + emit_passthrough(p, VERT_ATTRIB_COLOR0, VARYING_SLOT_COL0); - if (p->state->fragprog_inputs_read & FRAG_BIT_COL1) - emit_passthrough(p, VERT_ATTRIB_COLOR1, VERT_RESULT_COL1); + if (p->state->fragprog_inputs_read & VARYING_BIT_COL1) + emit_passthrough(p, VERT_ATTRIB_COLOR1, VARYING_SLOT_COL1); } } - if (p->state->fragprog_inputs_read & FRAG_BIT_FOGC) + if (p->state->fragprog_inputs_read & VARYING_BIT_FOGC) build_fog(p); - if (p->state->fragprog_inputs_read & FRAG_BITS_TEX_ANY) + if (p->state->fragprog_inputs_read & VARYING_BITS_TEX_ANY) build_texture_transform(p); if (p->state->point_attenuated) diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h index 4f0951339..83b6c8984 100644 --- a/mesalib/src/mesa/main/mtypes.h +++ b/mesalib/src/mesa/main/mtypes.h @@ -209,212 +209,103 @@ typedef enum /** - * Indexes for vertex program result attributes. Note that - * _mesa_vert_result_to_frag_attrib() and _mesa_frag_attrib_to_vert_result() make - * assumptions about the layout of this enum. - */ -typedef enum -{ - VERT_RESULT_HPOS = 0, - VERT_RESULT_COL0 = 1, - VERT_RESULT_COL1 = 2, - VERT_RESULT_FOGC = 3, - VERT_RESULT_TEX0 = 4, - VERT_RESULT_TEX1 = 5, - VERT_RESULT_TEX2 = 6, - VERT_RESULT_TEX3 = 7, - VERT_RESULT_TEX4 = 8, - VERT_RESULT_TEX5 = 9, - VERT_RESULT_TEX6 = 10, - VERT_RESULT_TEX7 = 11, - VERT_RESULT_PSIZ = 12, - VERT_RESULT_BFC0 = 13, - VERT_RESULT_BFC1 = 14, - VERT_RESULT_EDGE = 15, - VERT_RESULT_CLIP_VERTEX = 16, - VERT_RESULT_CLIP_DIST0 = 17, - VERT_RESULT_CLIP_DIST1 = 18, - VERT_RESULT_VAR0 = 19, /**< shader varying */ - VERT_RESULT_MAX = (VERT_RESULT_VAR0 + MAX_VARYING) -} gl_vert_result; - - -/*********************************************/ - -/** - * Indexes for geometry program attributes. + * Indexes for vertex shader outputs, geometry shader inputs/outputs, and + * fragment shader inputs. + * + * Note that some of these values are not available to all pipeline stages. + * + * When this enum is updated, the following code must be updated too: + * - vertResults (in prog_print.c's arb_output_attrib_string()) + * - fragAttribs (in prog_print.c's arb_input_attrib_string()) + * - _mesa_varying_slot_in_fs() */ typedef enum { - GEOM_ATTRIB_POSITION = 0, - GEOM_ATTRIB_COLOR0 = 1, - GEOM_ATTRIB_COLOR1 = 2, - GEOM_ATTRIB_SECONDARY_COLOR0 = 3, - GEOM_ATTRIB_SECONDARY_COLOR1 = 4, - GEOM_ATTRIB_FOG_FRAG_COORD = 5, - GEOM_ATTRIB_POINT_SIZE = 6, - GEOM_ATTRIB_CLIP_VERTEX = 7, - GEOM_ATTRIB_PRIMITIVE_ID = 8, - GEOM_ATTRIB_TEX_COORD = 9, - - GEOM_ATTRIB_VAR0 = 16, - GEOM_ATTRIB_MAX = (GEOM_ATTRIB_VAR0 + MAX_VARYING) -} gl_geom_attrib; - -/** - * Bitflags for geometry attributes. - * These are used in bitfields in many places. + VARYING_SLOT_POS, + VARYING_SLOT_COL0, /* COL0 and COL1 must be contiguous */ + VARYING_SLOT_COL1, + VARYING_SLOT_FOGC, + VARYING_SLOT_TEX0, /* TEX0-TEX7 must be contiguous */ + VARYING_SLOT_TEX1, + VARYING_SLOT_TEX2, + VARYING_SLOT_TEX3, + VARYING_SLOT_TEX4, + VARYING_SLOT_TEX5, + VARYING_SLOT_TEX6, + VARYING_SLOT_TEX7, + VARYING_SLOT_PSIZ, /* Does not appear in FS */ + VARYING_SLOT_BFC0, /* Does not appear in FS */ + VARYING_SLOT_BFC1, /* Does not appear in FS */ + VARYING_SLOT_EDGE, /* Does not appear in FS */ + VARYING_SLOT_CLIP_VERTEX, /* Does not appear in FS */ + VARYING_SLOT_CLIP_DIST0, + VARYING_SLOT_CLIP_DIST1, + VARYING_SLOT_PRIMITIVE_ID, /* Does not appear in VS */ + VARYING_SLOT_LAYER, /* Appears only as GS output */ + VARYING_SLOT_FACE, /* FS only */ + VARYING_SLOT_PNTC, /* FS only */ + VARYING_SLOT_VAR0, /* First generic varying slot */ + VARYING_SLOT_MAX = VARYING_SLOT_VAR0 + MAX_VARYING +} gl_varying_slot; + + +/** + * Bitflags for varying slots. */ /*@{*/ -#define GEOM_BIT_COLOR0 (1 << GEOM_ATTRIB_COLOR0) -#define GEOM_BIT_COLOR1 (1 << GEOM_ATTRIB_COLOR1) -#define GEOM_BIT_SCOLOR0 (1 << GEOM_ATTRIB_SECONDARY_COLOR0) -#define GEOM_BIT_SCOLOR1 (1 << GEOM_ATTRIB_SECONDARY_COLOR1) -#define GEOM_BIT_TEX_COORD (1 << GEOM_ATTRIB_TEX_COORD) -#define GEOM_BIT_FOG_COORD (1 << GEOM_ATTRIB_FOG_FRAG_COORD) -#define GEOM_BIT_POSITION (1 << GEOM_ATTRIB_POSITION) -#define GEOM_BIT_POINT_SIDE (1 << GEOM_ATTRIB_POINT_SIZE) -#define GEOM_BIT_CLIP_VERTEX (1 << GEOM_ATTRIB_CLIP_VERTEX) -#define GEOM_BIT_PRIM_ID (1 << GEOM_ATTRIB_PRIMITIVE_ID) -#define GEOM_BIT_VAR0 (1 << GEOM_ATTRIB_VAR0) - -#define GEOM_BIT_VAR(g) (1 << (GEOM_BIT_VAR0 + (g))) +#define VARYING_BIT_POS BITFIELD64_BIT(VARYING_SLOT_POS) +#define VARYING_BIT_COL0 BITFIELD64_BIT(VARYING_SLOT_COL0) +#define VARYING_BIT_COL1 BITFIELD64_BIT(VARYING_SLOT_COL1) +#define VARYING_BIT_FOGC BITFIELD64_BIT(VARYING_SLOT_FOGC) +#define VARYING_BIT_TEX0 BITFIELD64_BIT(VARYING_SLOT_TEX0) +#define VARYING_BIT_TEX1 BITFIELD64_BIT(VARYING_SLOT_TEX1) +#define VARYING_BIT_TEX2 BITFIELD64_BIT(VARYING_SLOT_TEX2) +#define VARYING_BIT_TEX3 BITFIELD64_BIT(VARYING_SLOT_TEX3) +#define VARYING_BIT_TEX4 BITFIELD64_BIT(VARYING_SLOT_TEX4) +#define VARYING_BIT_TEX5 BITFIELD64_BIT(VARYING_SLOT_TEX5) +#define VARYING_BIT_TEX6 BITFIELD64_BIT(VARYING_SLOT_TEX6) +#define VARYING_BIT_TEX7 BITFIELD64_BIT(VARYING_SLOT_TEX7) +#define VARYING_BIT_TEX(U) BITFIELD64_BIT(VARYING_SLOT_TEX0 + (U)) +#define VARYING_BITS_TEX_ANY BITFIELD64_RANGE(VARYING_SLOT_TEX0, \ + MAX_TEXTURE_COORD_UNITS) +#define VARYING_BIT_PSIZ BITFIELD64_BIT(VARYING_SLOT_PSIZ) +#define VARYING_BIT_BFC0 BITFIELD64_BIT(VARYING_SLOT_BFC0) +#define VARYING_BIT_BFC1 BITFIELD64_BIT(VARYING_SLOT_BFC1) +#define VARYING_BIT_EDGE BITFIELD64_BIT(VARYING_SLOT_EDGE) +#define VARYING_BIT_CLIP_VERTEX BITFIELD64_BIT(VARYING_SLOT_CLIP_VERTEX) +#define VARYING_BIT_CLIP_DIST0 BITFIELD64_BIT(VARYING_SLOT_CLIP_DIST0) +#define VARYING_BIT_CLIP_DIST1 BITFIELD64_BIT(VARYING_SLOT_CLIP_DIST1) +#define VARYING_BIT_PRIMITIVE_ID BITFIELD64_BIT(VARYING_SLOT_PRIMITIVE_ID) +#define VARYING_BIT_LAYER BITFIELD64_BIT(VARYING_SLOT_LAYER) +#define VARYING_BIT_FACE BITFIELD64_BIT(VARYING_SLOT_FACE) +#define VARYING_BIT_PNTC BITFIELD64_BIT(VARYING_SLOT_PNTC) +#define VARYING_BIT_VAR(V) BITFIELD64_BIT(VARYING_SLOT_VAR0 + (V)) /*@}*/ +/*********************************************/ + /** - * Indexes for geometry program result attributes - */ -typedef enum -{ - GEOM_RESULT_POS = 0, - GEOM_RESULT_COL0 = 1, - GEOM_RESULT_COL1 = 2, - GEOM_RESULT_SCOL0 = 3, - GEOM_RESULT_SCOL1 = 4, - GEOM_RESULT_FOGC = 5, - GEOM_RESULT_TEX0 = 6, - GEOM_RESULT_TEX1 = 7, - GEOM_RESULT_TEX2 = 8, - GEOM_RESULT_TEX3 = 9, - GEOM_RESULT_TEX4 = 10, - GEOM_RESULT_TEX5 = 11, - GEOM_RESULT_TEX6 = 12, - GEOM_RESULT_TEX7 = 13, - GEOM_RESULT_PSIZ = 14, - GEOM_RESULT_CLPV = 15, - GEOM_RESULT_PRID = 16, - GEOM_RESULT_LAYR = 17, - GEOM_RESULT_VAR0 = 18, /**< shader varying, should really be 16 */ - /* ### we need to -2 because var0 is 18 instead 16 like in the others */ - GEOM_RESULT_MAX = (GEOM_RESULT_VAR0 + MAX_VARYING - 2) -} gl_geom_result; - - -/** - * Indexes for fragment program input attributes. Note that - * _mesa_vert_result_to_frag_attrib() and frag_attrib_to_vert_result() make - * assumptions about the layout of this enum. + * Determine if the given gl_varying_slot appears in the fragment shader. */ -typedef enum +static inline GLboolean +_mesa_varying_slot_in_fs(gl_varying_slot slot) { - FRAG_ATTRIB_WPOS = 0, - FRAG_ATTRIB_COL0 = 1, - FRAG_ATTRIB_COL1 = 2, - FRAG_ATTRIB_FOGC = 3, - FRAG_ATTRIB_TEX0 = 4, - FRAG_ATTRIB_TEX1 = 5, - FRAG_ATTRIB_TEX2 = 6, - FRAG_ATTRIB_TEX3 = 7, - FRAG_ATTRIB_TEX4 = 8, - FRAG_ATTRIB_TEX5 = 9, - FRAG_ATTRIB_TEX6 = 10, - FRAG_ATTRIB_TEX7 = 11, - FRAG_ATTRIB_FACE = 12, /**< front/back face */ - FRAG_ATTRIB_PNTC = 13, /**< sprite/point coord */ - FRAG_ATTRIB_CLIP_DIST0 = 14, - FRAG_ATTRIB_CLIP_DIST1 = 15, - FRAG_ATTRIB_VAR0 = 16, /**< shader varying */ - FRAG_ATTRIB_MAX = (FRAG_ATTRIB_VAR0 + MAX_VARYING) -} gl_frag_attrib; - - -/** - * Convert from a gl_vert_result value to the corresponding gl_frag_attrib. - * - * VERT_RESULT_HPOS is converted to FRAG_ATTRIB_WPOS. - * - * gl_vert_result values which have no corresponding gl_frag_attrib - * (VERT_RESULT_PSIZ, VERT_RESULT_BFC0, VERT_RESULT_BFC1, and - * VERT_RESULT_EDGE) are converted to a value of -1. - */ -static inline int -_mesa_vert_result_to_frag_attrib(gl_vert_result vert_result) -{ - if (vert_result >= VERT_RESULT_CLIP_DIST0) - return vert_result - VERT_RESULT_CLIP_DIST0 + FRAG_ATTRIB_CLIP_DIST0; - else if (vert_result <= VERT_RESULT_TEX7) - return vert_result; - else - return -1; + switch (slot) { + case VARYING_SLOT_PSIZ: + case VARYING_SLOT_BFC0: + case VARYING_SLOT_BFC1: + case VARYING_SLOT_EDGE: + case VARYING_SLOT_CLIP_VERTEX: + case VARYING_SLOT_LAYER: + return GL_FALSE; + default: + return GL_TRUE; + } } /** - * Convert from a gl_frag_attrib value to the corresponding gl_vert_result. - * - * FRAG_ATTRIB_WPOS is converted to VERT_RESULT_HPOS. - * - * gl_frag_attrib values which have no corresponding gl_vert_result - * (FRAG_ATTRIB_FACE and FRAG_ATTRIB_PNTC) are converted to a value of -1. - */ -static inline int -_mesa_frag_attrib_to_vert_result(gl_frag_attrib frag_attrib) -{ - if (frag_attrib <= FRAG_ATTRIB_TEX7) - return frag_attrib; - else if (frag_attrib >= FRAG_ATTRIB_CLIP_DIST0) - return frag_attrib - FRAG_ATTRIB_CLIP_DIST0 + VERT_RESULT_CLIP_DIST0; - else - return -1; -} - - -/** - * Bitflags for fragment program input attributes. - */ -/*@{*/ -#define FRAG_BIT_WPOS (1 << FRAG_ATTRIB_WPOS) -#define FRAG_BIT_COL0 (1 << FRAG_ATTRIB_COL0) -#define FRAG_BIT_COL1 (1 << FRAG_ATTRIB_COL1) -#define FRAG_BIT_FOGC (1 << FRAG_ATTRIB_FOGC) -#define FRAG_BIT_FACE (1 << FRAG_ATTRIB_FACE) -#define FRAG_BIT_PNTC (1 << FRAG_ATTRIB_PNTC) -#define FRAG_BIT_TEX0 (1 << FRAG_ATTRIB_TEX0) -#define FRAG_BIT_TEX1 (1 << FRAG_ATTRIB_TEX1) -#define FRAG_BIT_TEX2 (1 << FRAG_ATTRIB_TEX2) -#define FRAG_BIT_TEX3 (1 << FRAG_ATTRIB_TEX3) -#define FRAG_BIT_TEX4 (1 << FRAG_ATTRIB_TEX4) -#define FRAG_BIT_TEX5 (1 << FRAG_ATTRIB_TEX5) -#define FRAG_BIT_TEX6 (1 << FRAG_ATTRIB_TEX6) -#define FRAG_BIT_TEX7 (1 << FRAG_ATTRIB_TEX7) -#define FRAG_BIT_VAR0 (1 << FRAG_ATTRIB_VAR0) - -#define FRAG_BIT_TEX(U) (FRAG_BIT_TEX0 << (U)) -#define FRAG_BIT_VAR(V) (FRAG_BIT_VAR0 << (V)) - -#define FRAG_BITS_TEX_ANY (FRAG_BIT_TEX0| \ - FRAG_BIT_TEX1| \ - FRAG_BIT_TEX2| \ - FRAG_BIT_TEX3| \ - FRAG_BIT_TEX4| \ - FRAG_BIT_TEX5| \ - FRAG_BIT_TEX6| \ - FRAG_BIT_TEX7) -/*@}*/ - - -/** * Fragment program results */ typedef enum @@ -2065,7 +1956,7 @@ struct gl_fragment_program * For inputs that do not have an interpolation qualifier specified in * GLSL, the value is INTERP_QUALIFIER_NONE. */ - enum glsl_interp_qualifier InterpQualifier[FRAG_ATTRIB_MAX]; + enum glsl_interp_qualifier InterpQualifier[VARYING_SLOT_MAX]; /** * Bitfield indicating, for each fragment shader input, 1 if that input diff --git a/mesalib/src/mesa/main/state.h b/mesalib/src/mesa/main/state.h index 29a254092..7b3121b4e 100644 --- a/mesalib/src/mesa/main/state.h +++ b/mesalib/src/mesa/main/state.h @@ -66,7 +66,7 @@ _mesa_need_secondary_color(const struct gl_context *ctx) if (ctx->FragmentProgram._Current && (ctx->FragmentProgram._Current != ctx->FragmentProgram._TexEnvProgram) && - (ctx->FragmentProgram._Current->Base.InputsRead & FRAG_BIT_COL1)) + (ctx->FragmentProgram._Current->Base.InputsRead & VARYING_BIT_COL1)) return GL_TRUE; return GL_FALSE; diff --git a/mesalib/src/mesa/main/teximage.c b/mesalib/src/mesa/main/teximage.c index 7d996da47..4042e7969 100644 --- a/mesalib/src/mesa/main/teximage.c +++ b/mesalib/src/mesa/main/teximage.c @@ -3495,19 +3495,21 @@ copyteximage(struct gl_context *ctx, GLuint dims, _mesa_init_teximage_fields(ctx, texImage, width, height, 1, border, internalFormat, texFormat); - /* Allocate texture memory (no pixel data yet) */ - ctx->Driver.AllocTextureImageBuffer(ctx, texImage); + if (width && height) { + /* Allocate texture memory (no pixel data yet) */ + ctx->Driver.AllocTextureImageBuffer(ctx, texImage); - if (_mesa_clip_copytexsubimage(ctx, &dstX, &dstY, &srcX, &srcY, - &width, &height)) { - struct gl_renderbuffer *srcRb = - get_copy_tex_image_source(ctx, texImage->TexFormat); + if (_mesa_clip_copytexsubimage(ctx, &dstX, &dstY, &srcX, &srcY, + &width, &height)) { + struct gl_renderbuffer *srcRb = + get_copy_tex_image_source(ctx, texImage->TexFormat); - ctx->Driver.CopyTexSubImage(ctx, dims, texImage, dstX, dstY, dstZ, - srcRb, srcX, srcY, width, height); - } + ctx->Driver.CopyTexSubImage(ctx, dims, texImage, dstX, dstY, dstZ, + srcRb, srcX, srcY, width, height); + } - check_gen_mipmap(ctx, target, texObj, level); + check_gen_mipmap(ctx, target, texObj, level); + } _mesa_update_fbo_texture(ctx, texObj, face, level); diff --git a/mesalib/src/mesa/main/texstate.c b/mesalib/src/mesa/main/texstate.c index 1bd9f911f..d44cd7cf9 100644 --- a/mesalib/src/mesa/main/texstate.c +++ b/mesalib/src/mesa/main/texstate.c @@ -661,7 +661,7 @@ update_texture_state( struct gl_context *ctx ) if (fprog) { const GLuint coordMask = (1 << MAX_TEXTURE_COORD_UNITS) - 1; ctx->Texture._EnabledCoordUnits - = (fprog->InputsRead >> FRAG_ATTRIB_TEX0) & coordMask; + = (fprog->InputsRead >> VARYING_SLOT_TEX0) & coordMask; } else { ctx->Texture._EnabledCoordUnits = enabledFragUnits; diff --git a/mesalib/src/mesa/main/version.c b/mesalib/src/mesa/main/version.c index c90318981..3d4af5923 100644 --- a/mesalib/src/mesa/main/version.c +++ b/mesalib/src/mesa/main/version.c @@ -99,7 +99,7 @@ create_version_string(struct gl_context *ctx, const char *prefix) ctx->VersionString = malloc(max); if (ctx->VersionString) { _mesa_snprintf(ctx->VersionString, max, - "%s%u.%u%s Mesa " MESA_VERSION_STRING + "%s%u.%u%s Mesa " PACKAGE_VERSION #ifdef MESA_GIT_SHA1 " (" MESA_GIT_SHA1 ")" #endif diff --git a/mesalib/src/mesa/main/version.h b/mesalib/src/mesa/main/version.h index c1cb3177d..b4f8d8590 100644 --- a/mesalib/src/mesa/main/version.h +++ b/mesalib/src/mesa/main/version.h @@ -31,17 +31,6 @@ struct gl_context; -/* Mesa version */ -#define MESA_MAJOR 9 -#define MESA_MINOR 2 -#define MESA_PATCH 0 -#define MESA_VERSION_STRING "9.2-devel" - -/* To make version comparison easy */ -#define MESA_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) -#define MESA_VERSION_CODE MESA_VERSION(MESA_MAJOR, MESA_MINOR, MESA_PATCH) - - extern void _mesa_compute_version(struct gl_context *ctx); diff --git a/mesalib/src/mesa/program/ir_to_mesa.cpp b/mesalib/src/mesa/program/ir_to_mesa.cpp index 486cf4639..2cb5f02f4 100644 --- a/mesalib/src/mesa/program/ir_to_mesa.cpp +++ b/mesalib/src/mesa/program/ir_to_mesa.cpp @@ -93,7 +93,7 @@ public: explicit src_reg(dst_reg reg); gl_register_file file; /**< PROGRAM_* from Mesa */ - int index; /**< temporary index, VERT_ATTRIB_*, FRAG_ATTRIB_*, etc. */ + int index; /**< temporary index, VERT_ATTRIB_*, VARYING_SLOT_*, etc. */ GLuint swizzle; /**< SWIZZLE_XYZWONEZERO swizzles from Mesa. */ int negate; /**< NEGATE_XYZW mask from mesa */ /** Register index should be offset by the integer in this reg. */ @@ -123,7 +123,7 @@ public: explicit dst_reg(src_reg reg); gl_register_file file; /**< PROGRAM_* from Mesa */ - int index; /**< temporary index, VERT_ATTRIB_*, FRAG_ATTRIB_*, etc. */ + int index; /**< temporary index, VERT_ATTRIB_*, VARYING_SLOT_*, etc. */ int writemask; /**< Bitfield of WRITEMASK_[XYZW] */ GLuint cond_mask:4; /** Register index should be offset by the integer in this reg. */ diff --git a/mesalib/src/mesa/program/prog_execute.c b/mesalib/src/mesa/program/prog_execute.c index fe2359bc2..d205cdbbe 100644 --- a/mesalib/src/mesa/program/prog_execute.c +++ b/mesalib/src/mesa/program/prog_execute.c @@ -108,7 +108,7 @@ get_src_register_pointer(const struct prog_src_register *source, return machine->VertAttribs[reg]; } else { - if (reg >= FRAG_ATTRIB_MAX) + if (reg >= VARYING_SLOT_MAX) return ZeroVec; return machine->Attribs[reg][machine->CurElement]; } @@ -283,7 +283,7 @@ fetch_vector4_deriv(struct gl_context * ctx, if (source->File == PROGRAM_INPUT && source->Index < (GLint) machine->NumDeriv) { const GLint col = machine->CurElement; - const GLfloat w = machine->Attribs[FRAG_ATTRIB_WPOS][col][3]; + const GLfloat w = machine->Attribs[VARYING_SLOT_POS][col][3]; const GLfloat invQ = 1.0f / w; GLfloat deriv[4]; @@ -371,7 +371,7 @@ fetch_texel(struct gl_context *ctx, */ if (machine->NumDeriv > 0 && inst->SrcReg[0].File == PROGRAM_INPUT && - inst->SrcReg[0].Index == FRAG_ATTRIB_TEX0 + inst->TexSrcUnit) { + inst->SrcReg[0].Index == VARYING_SLOT_TEX0 + inst->TexSrcUnit) { /* simple texture fetch for which we should have derivatives */ GLuint attr = inst->SrcReg[0].Index; machine->FetchTexelDeriv(ctx, texcoord, diff --git a/mesalib/src/mesa/program/prog_print.c b/mesalib/src/mesa/program/prog_print.c index 7e7e081f7..c73f10df5 100644 --- a/mesalib/src/mesa/program/prog_print.c +++ b/mesalib/src/mesa/program/prog_print.c @@ -89,7 +89,7 @@ static const char * arb_input_attrib_string(GLint index, GLenum progType) { /* - * These strings should match the VERT_ATTRIB_x and FRAG_ATTRIB_x tokens. + * These strings should match the VERT_ATTRIB_x and VARYING_SLOT_x tokens. */ static const char *const vertAttribs[] = { "vertex.position", @@ -139,10 +139,17 @@ arb_input_attrib_string(GLint index, GLenum progType) "fragment.texcoord[5]", "fragment.texcoord[6]", "fragment.texcoord[7]", - "fragment.(twelve)", /* FRAG_ATTRIB_FACE */ - "fragment.(thirteen)", /* FRAG_ATTRIB_PNTC */ - "fragment.(fourteen)", /* FRAG_ATTRIB_CLIP_DIST0 */ - "fragment.(fifteen)", /* FRAG_ATTRIB_CLIP_DIST1 */ + "fragment.(twelve)", /* VARYING_SLOT_PSIZ */ + "fragment.(thirteen)", /* VARYING_SLOT_BFC0 */ + "fragment.(fourteen)", /* VARYING_SLOT_BFC1 */ + "fragment.(fifteen)", /* VARYING_SLOT_EDGE */ + "fragment.(sixteen)", /* VARYING_SLOT_CLIP_VERTEX */ + "fragment.(seventeen)", /* VARYING_SLOT_CLIP_DIST0 */ + "fragment.(eighteen)", /* VARYING_SLOT_CLIP_DIST1 */ + "fragment.(nineteen)", /* VARYING_SLOT_PRIMITIVE_ID */ + "fragment.(twenty)", /* VARYING_SLOT_LAYER */ + "fragment.(twenty-one)", /* VARYING_SLOT_FACE */ + "fragment.(twenty-two)", /* VARYING_SLOT_PNTC */ "fragment.varying[0]", "fragment.varying[1]", "fragment.varying[2]", @@ -179,11 +186,11 @@ arb_input_attrib_string(GLint index, GLenum progType) /* sanity checks */ STATIC_ASSERT(Elements(vertAttribs) == VERT_ATTRIB_MAX); - STATIC_ASSERT(Elements(fragAttribs) == FRAG_ATTRIB_MAX); + STATIC_ASSERT(Elements(fragAttribs) == VARYING_SLOT_MAX); assert(strcmp(vertAttribs[VERT_ATTRIB_TEX0], "vertex.texcoord[0]") == 0); assert(strcmp(vertAttribs[VERT_ATTRIB_GENERIC15], "vertex.attrib[15]") == 0); - assert(strcmp(fragAttribs[FRAG_ATTRIB_TEX0], "fragment.texcoord[0]") == 0); - assert(strcmp(fragAttribs[FRAG_ATTRIB_VAR0+15], "fragment.varying[15]") == 0); + assert(strcmp(fragAttribs[VARYING_SLOT_TEX0], "fragment.texcoord[0]") == 0); + assert(strcmp(fragAttribs[VARYING_SLOT_VAR0+15], "fragment.varying[15]") == 0); if (progType == GL_VERTEX_PROGRAM_ARB) { assert(index < Elements(vertAttribs)); @@ -241,7 +248,7 @@ static const char * arb_output_attrib_string(GLint index, GLenum progType) { /* - * These strings should match the VERT_RESULT_x and FRAG_RESULT_x tokens. + * These strings should match the VARYING_SLOT_x and FRAG_RESULT_x tokens. */ static const char *const vertResults[] = { "result.position", @@ -256,13 +263,17 @@ arb_output_attrib_string(GLint index, GLenum progType) "result.texcoord[5]", "result.texcoord[6]", "result.texcoord[7]", - "result.pointsize", /* VERT_RESULT_PSIZ */ - "result.(thirteen)", /* VERT_RESULT_BFC0 */ - "result.(fourteen)", /* VERT_RESULT_BFC1 */ - "result.(fifteen)", /* VERT_RESULT_EDGE */ - "result.(sixteen)", /* VERT_RESULT_CLIP_VERTEX */ - "result.(seventeen)", /* VERT_RESULT_CLIP_DIST0 */ - "result.(eighteen)", /* VERT_RESULT_CLIP_DIST1 */ + "result.pointsize", /* VARYING_SLOT_PSIZ */ + "result.(thirteen)", /* VARYING_SLOT_BFC0 */ + "result.(fourteen)", /* VARYING_SLOT_BFC1 */ + "result.(fifteen)", /* VARYING_SLOT_EDGE */ + "result.(sixteen)", /* VARYING_SLOT_CLIP_VERTEX */ + "result.(seventeen)", /* VARYING_SLOT_CLIP_DIST0 */ + "result.(eighteen)", /* VARYING_SLOT_CLIP_DIST1 */ + "result.(nineteen)", /* VARYING_SLOT_PRIMITIVE_ID */ + "result.(twenty)", /* VARYING_SLOT_LAYER */ + "result.(twenty-one)", /* VARYING_SLOT_FACE */ + "result.(twenty-two)", /* VARYING_SLOT_PNTC */ "result.varying[0]", "result.varying[1]", "result.varying[2]", @@ -311,10 +322,10 @@ arb_output_attrib_string(GLint index, GLenum progType) }; /* sanity checks */ - STATIC_ASSERT(Elements(vertResults) == VERT_RESULT_MAX); + STATIC_ASSERT(Elements(vertResults) == VARYING_SLOT_MAX); STATIC_ASSERT(Elements(fragResults) == FRAG_RESULT_MAX); - assert(strcmp(vertResults[VERT_RESULT_HPOS], "result.position") == 0); - assert(strcmp(vertResults[VERT_RESULT_VAR0], "result.varying[0]") == 0); + assert(strcmp(vertResults[VARYING_SLOT_POS], "result.position") == 0); + assert(strcmp(vertResults[VARYING_SLOT_VAR0], "result.varying[0]") == 0); assert(strcmp(fragResults[FRAG_RESULT_DATA0], "result.color[0]") == 0); if (progType == GL_VERTEX_PROGRAM_ARB) { diff --git a/mesalib/src/mesa/program/program.c b/mesalib/src/mesa/program/program.c index fb0aeb7ed..2ef969ff7 100644 --- a/mesalib/src/mesa/program/program.c +++ b/mesalib/src/mesa/program/program.c @@ -738,7 +738,7 @@ _mesa_combine_programs(struct gl_context *ctx, * of progB_colorFile/progB_colorIndex below... */ progB_colorFile = PROGRAM_INPUT; - progB_colorIndex = FRAG_ATTRIB_COL0; + progB_colorIndex = VARYING_SLOT_COL0; /* * The fragment program may get color from a state var rather than @@ -754,7 +754,7 @@ _mesa_combine_programs(struct gl_context *ctx, p->StateIndexes[0] == STATE_INTERNAL && p->StateIndexes[1] == STATE_CURRENT_ATTRIB && (int) p->StateIndexes[2] == (int) VERT_ATTRIB_COLOR0) { - progB_inputsRead |= FRAG_BIT_COL0; + progB_inputsRead |= VARYING_BIT_COL0; progB_colorFile = PROGRAM_STATE_VAR; progB_colorIndex = i; break; @@ -765,7 +765,7 @@ _mesa_combine_programs(struct gl_context *ctx, * new temporary register. */ if ((progA->OutputsWritten & BITFIELD64_BIT(FRAG_RESULT_COLOR)) && - (progB_inputsRead & FRAG_BIT_COL0)) { + (progB_inputsRead & VARYING_BIT_COL0)) { GLint tempReg = _mesa_find_free_register(usedTemps, MAX_PROGRAM_TEMPS, firstTemp); if (tempReg < 0) { @@ -788,7 +788,7 @@ _mesa_combine_programs(struct gl_context *ctx, /* compute combined program's InputsRead */ inputsB = progB_inputsRead; if (progA->OutputsWritten & BITFIELD64_BIT(FRAG_RESULT_COLOR)) { - inputsB &= ~(1 << FRAG_ATTRIB_COL0); + inputsB &= ~(1 << VARYING_SLOT_COL0); } newProg->InputsRead = progA->InputsRead | inputsB; newProg->OutputsWritten = progB->OutputsWritten; @@ -934,9 +934,9 @@ _mesa_valid_register_index(const struct gl_context *ctx, case MESA_SHADER_VERTEX: return index < VERT_ATTRIB_GENERIC0 + (GLint) c->MaxAttribs; case MESA_SHADER_FRAGMENT: - return index < FRAG_ATTRIB_VAR0 + (GLint) ctx->Const.MaxVarying; + return index < VARYING_SLOT_VAR0 + (GLint) ctx->Const.MaxVarying; case MESA_SHADER_GEOMETRY: - return index < GEOM_ATTRIB_VAR0 + (GLint) ctx->Const.MaxVarying; + return index < VARYING_SLOT_VAR0 + (GLint) ctx->Const.MaxVarying; default: return GL_FALSE; } @@ -947,11 +947,11 @@ _mesa_valid_register_index(const struct gl_context *ctx, switch (shaderType) { case MESA_SHADER_VERTEX: - return index < VERT_RESULT_VAR0 + (GLint) ctx->Const.MaxVarying; + return index < VARYING_SLOT_VAR0 + (GLint) ctx->Const.MaxVarying; case MESA_SHADER_FRAGMENT: return index < FRAG_RESULT_DATA0 + (GLint) ctx->Const.MaxDrawBuffers; case MESA_SHADER_GEOMETRY: - return index < GEOM_RESULT_VAR0 + (GLint) ctx->Const.MaxVarying; + return index < VARYING_SLOT_VAR0 + (GLint) ctx->Const.MaxVarying; default: return GL_FALSE; } diff --git a/mesalib/src/mesa/program/program_parse.y b/mesalib/src/mesa/program/program_parse.y index 025b54706..81d85f9fb 100644 --- a/mesalib/src/mesa/program/program_parse.y +++ b/mesalib/src/mesa/program/program_parse.y @@ -643,7 +643,7 @@ maskedDstReg: dstReg optionalMask optionalCcMask * set in fragment program mode, so it is somewhat irrelevant. */ if (state->option.PositionInvariant - && ($$.Index == VERT_RESULT_HPOS)) { + && ($$.Index == VARYING_SLOT_POS)) { yyerror(& @1, state, "position-invariant programs cannot " "write position"); YYERROR; @@ -1187,19 +1187,19 @@ vtxWeightNum: INTEGER; fragAttribItem: POSITION { - $$ = FRAG_ATTRIB_WPOS; + $$ = VARYING_SLOT_POS; } | COLOR optColorType { - $$ = FRAG_ATTRIB_COL0 + $2; + $$ = VARYING_SLOT_COL0 + $2; } | FOGCOORD { - $$ = FRAG_ATTRIB_FOGC; + $$ = VARYING_SLOT_FOGC; } | TEXCOORD optTexCoordUnitNum { - $$ = FRAG_ATTRIB_TEX0 + $2; + $$ = VARYING_SLOT_TEX0 + $2; } ; @@ -2005,7 +2005,7 @@ OUTPUT_statement: optVarSize OUTPUT IDENTIFIER '=' resultBinding resultBinding: RESULT POSITION { if (state->mode == ARB_vertex) { - $$ = VERT_RESULT_HPOS; + $$ = VARYING_SLOT_POS; } else { yyerror(& @2, state, "invalid program result name"); YYERROR; @@ -2014,7 +2014,7 @@ resultBinding: RESULT POSITION | RESULT FOGCOORD { if (state->mode == ARB_vertex) { - $$ = VERT_RESULT_FOGC; + $$ = VARYING_SLOT_FOGC; } else { yyerror(& @2, state, "invalid program result name"); YYERROR; @@ -2027,7 +2027,7 @@ resultBinding: RESULT POSITION | RESULT POINTSIZE { if (state->mode == ARB_vertex) { - $$ = VERT_RESULT_PSIZ; + $$ = VARYING_SLOT_PSIZ; } else { yyerror(& @2, state, "invalid program result name"); YYERROR; @@ -2036,7 +2036,7 @@ resultBinding: RESULT POSITION | RESULT TEXCOORD optTexCoordUnitNum { if (state->mode == ARB_vertex) { - $$ = VERT_RESULT_TEX0 + $3; + $$ = VARYING_SLOT_TEX0 + $3; } else { yyerror(& @2, state, "invalid program result name"); YYERROR; @@ -2062,7 +2062,7 @@ resultColBinding: COLOR optResultFaceType optResultColorType optResultFaceType: { if (state->mode == ARB_vertex) { - $$ = VERT_RESULT_COL0; + $$ = VARYING_SLOT_COL0; } else { if (state->option.DrawBuffers) $$ = FRAG_RESULT_DATA0; @@ -2101,7 +2101,7 @@ optResultFaceType: | FRONT { if (state->mode == ARB_vertex) { - $$ = VERT_RESULT_COL0; + $$ = VARYING_SLOT_COL0; } else { yyerror(& @1, state, "invalid program result name"); YYERROR; @@ -2110,7 +2110,7 @@ optResultFaceType: | BACK { if (state->mode == ARB_vertex) { - $$ = VERT_RESULT_BFC0; + $$ = VARYING_SLOT_BFC0; } else { yyerror(& @1, state, "invalid program result name"); YYERROR; diff --git a/mesalib/src/mesa/program/programopt.c b/mesalib/src/mesa/program/programopt.c index 2a3702198..d40ffd543 100644 --- a/mesalib/src/mesa/program/programopt.c +++ b/mesalib/src/mesa/program/programopt.c @@ -89,7 +89,7 @@ _mesa_insert_mvp_dp4_code(struct gl_context *ctx, struct gl_vertex_program *vpro for (i = 0; i < 4; i++) { newInst[i].Opcode = OPCODE_DP4; newInst[i].DstReg.File = PROGRAM_OUTPUT; - newInst[i].DstReg.Index = VERT_RESULT_HPOS; + newInst[i].DstReg.Index = VARYING_SLOT_POS; newInst[i].DstReg.WriteMask = (WRITEMASK_X << i); newInst[i].SrcReg[0].File = PROGRAM_STATE_VAR; newInst[i].SrcReg[0].Index = mvpRef[i]; @@ -109,7 +109,7 @@ _mesa_insert_mvp_dp4_code(struct gl_context *ctx, struct gl_vertex_program *vpro vprog->Base.Instructions = newInst; vprog->Base.NumInstructions = newLen; vprog->Base.InputsRead |= VERT_BIT_POS; - vprog->Base.OutputsWritten |= BITFIELD64_BIT(VERT_RESULT_HPOS); + vprog->Base.OutputsWritten |= BITFIELD64_BIT(VARYING_SLOT_POS); } @@ -188,7 +188,7 @@ _mesa_insert_mvp_mad_code(struct gl_context *ctx, struct gl_vertex_program *vpro newInst[3].Opcode = OPCODE_MAD; newInst[3].DstReg.File = PROGRAM_OUTPUT; - newInst[3].DstReg.Index = VERT_RESULT_HPOS; + newInst[3].DstReg.Index = VARYING_SLOT_POS; newInst[3].DstReg.WriteMask = WRITEMASK_XYZW; newInst[3].SrcReg[0].File = PROGRAM_INPUT; newInst[3].SrcReg[0].Index = VERT_ATTRIB_POS; @@ -211,7 +211,7 @@ _mesa_insert_mvp_mad_code(struct gl_context *ctx, struct gl_vertex_program *vpro vprog->Base.Instructions = newInst; vprog->Base.NumInstructions = newLen; vprog->Base.InputsRead |= VERT_BIT_POS; - vprog->Base.OutputsWritten |= BITFIELD64_BIT(VERT_RESULT_HPOS); + vprog->Base.OutputsWritten |= BITFIELD64_BIT(VARYING_SLOT_POS); } @@ -240,7 +240,7 @@ _mesa_insert_mvp_code(struct gl_context *ctx, struct gl_vertex_program *vprog) * \param saturate True if writes to color outputs should be clamped to [0, 1] * * \note - * This function sets \c FRAG_BIT_FOGC in \c fprog->Base.InputsRead. + * This function sets \c VARYING_BIT_FOGC in \c fprog->Base.InputsRead. * * \todo With a little work, this function could be adapted to add fog code * to vertex programs too. @@ -323,7 +323,7 @@ _mesa_append_fog_code(struct gl_context *ctx, inst->DstReg.Index = fogFactorTemp; inst->DstReg.WriteMask = WRITEMASK_X; inst->SrcReg[0].File = PROGRAM_INPUT; - inst->SrcReg[0].Index = FRAG_ATTRIB_FOGC; + inst->SrcReg[0].Index = VARYING_SLOT_FOGC; inst->SrcReg[0].Swizzle = SWIZZLE_XXXX; inst->SrcReg[1].File = PROGRAM_STATE_VAR; inst->SrcReg[1].Index = fogPRefOpt; @@ -348,7 +348,7 @@ _mesa_append_fog_code(struct gl_context *ctx, inst->SrcReg[0].Swizzle = (fog_mode == GL_EXP) ? SWIZZLE_ZZZZ : SWIZZLE_WWWW; inst->SrcReg[1].File = PROGRAM_INPUT; - inst->SrcReg[1].Index = FRAG_ATTRIB_FOGC; + inst->SrcReg[1].Index = VARYING_SLOT_FOGC; inst->SrcReg[1].Swizzle = SWIZZLE_XXXX; inst++; if (fog_mode == GL_EXP2) { @@ -411,7 +411,7 @@ _mesa_append_fog_code(struct gl_context *ctx, /* install new instructions */ fprog->Base.Instructions = newInst; fprog->Base.NumInstructions = inst - newInst; - fprog->Base.InputsRead |= FRAG_BIT_FOGC; + fprog->Base.InputsRead |= VARYING_BIT_FOGC; assert(fprog->Base.OutputsWritten & (1 << FRAG_RESULT_COLOR)); } @@ -507,7 +507,7 @@ void _mesa_remove_output_reads(struct gl_program *prog, gl_register_file type) { GLuint i; - GLint outputMap[VERT_RESULT_MAX]; + GLint outputMap[VARYING_SLOT_MAX]; GLuint numVaryingReads = 0; GLboolean usedTemps[MAX_PROGRAM_TEMPS]; GLuint firstTemp = 0; @@ -517,7 +517,7 @@ _mesa_remove_output_reads(struct gl_program *prog, gl_register_file type) assert(type == PROGRAM_OUTPUT); - for (i = 0; i < VERT_RESULT_MAX; i++) + for (i = 0; i < VARYING_SLOT_MAX; i++) outputMap[i] = -1; /* look for instructions which read from varying vars */ @@ -576,7 +576,7 @@ _mesa_remove_output_reads(struct gl_program *prog, gl_register_file type) /* insert new MOV instructions here */ inst = prog->Instructions + endPos; - for (var = 0; var < VERT_RESULT_MAX; var++) { + for (var = 0; var < VARYING_SLOT_MAX; var++) { if (outputMap[var] >= 0) { /* MOV VAR[var], TEMP[tmp]; */ inst->Opcode = OPCODE_MOV; @@ -615,10 +615,10 @@ _mesa_nop_fragment_program(struct gl_context *ctx, struct gl_fragment_program *p inst[0].DstReg.File = PROGRAM_OUTPUT; inst[0].DstReg.Index = FRAG_RESULT_COLOR; inst[0].SrcReg[0].File = PROGRAM_INPUT; - if (prog->Base.InputsRead & FRAG_BIT_COL0) - inputAttr = FRAG_ATTRIB_COL0; + if (prog->Base.InputsRead & VARYING_BIT_COL0) + inputAttr = VARYING_SLOT_COL0; else - inputAttr = FRAG_ATTRIB_TEX0; + inputAttr = VARYING_SLOT_TEX0; inst[0].SrcReg[0].Index = inputAttr; inst[1].Opcode = OPCODE_END; @@ -657,7 +657,7 @@ _mesa_nop_vertex_program(struct gl_context *ctx, struct gl_vertex_program *prog) inst[0].Opcode = OPCODE_MOV; inst[0].DstReg.File = PROGRAM_OUTPUT; - inst[0].DstReg.Index = VERT_RESULT_COL0; + inst[0].DstReg.Index = VARYING_SLOT_COL0; inst[0].SrcReg[0].File = PROGRAM_INPUT; if (prog->Base.InputsRead & VERT_BIT_COLOR0) inputAttr = VERT_ATTRIB_COLOR0; @@ -673,7 +673,7 @@ _mesa_nop_vertex_program(struct gl_context *ctx, struct gl_vertex_program *prog) prog->Base.Instructions = inst; prog->Base.NumInstructions = 2; prog->Base.InputsRead = BITFIELD64_BIT(inputAttr); - prog->Base.OutputsWritten = BITFIELD64_BIT(VERT_RESULT_COL0); + prog->Base.OutputsWritten = BITFIELD64_BIT(VARYING_SLOT_COL0); /* * Now insert code to do standard modelview/projection transformation. diff --git a/mesalib/src/mesa/program/register_allocate.c b/mesalib/src/mesa/program/register_allocate.c index 88793dbdc..a9064c38c 100644 --- a/mesalib/src/mesa/program/register_allocate.c +++ b/mesalib/src/mesa/program/register_allocate.c @@ -75,6 +75,7 @@ #include "main/imports.h" #include "main/macros.h" #include "main/mtypes.h" +#include "main/bitset.h" #include "register_allocate.h" #define NO_REG ~0 @@ -118,8 +119,9 @@ struct ra_node { * List of which nodes this node interferes with. This should be * symmetric with the other node. */ - GLboolean *adjacency; + BITSET_WORD *adjacency; unsigned int *adjacency_list; + unsigned int adjacency_list_size; unsigned int adjacency_count; /** @} */ @@ -306,7 +308,16 @@ ra_set_finalize(struct ra_regs *regs, unsigned int **q_values) static void ra_add_node_adjacency(struct ra_graph *g, unsigned int n1, unsigned int n2) { - g->nodes[n1].adjacency[n2] = GL_TRUE; + BITSET_SET(g->nodes[n1].adjacency, n2); + + if (g->nodes[n1].adjacency_count >= + g->nodes[n1].adjacency_list_size) { + g->nodes[n1].adjacency_list_size *= 2; + g->nodes[n1].adjacency_list = reralloc(g, g->nodes[n1].adjacency_list, + unsigned int, + g->nodes[n1].adjacency_list_size); + } + g->nodes[n1].adjacency_list[g->nodes[n1].adjacency_count] = n2; g->nodes[n1].adjacency_count++; } @@ -325,9 +336,14 @@ ra_alloc_interference_graph(struct ra_regs *regs, unsigned int count) g->stack = rzalloc_array(g, unsigned int, count); for (i = 0; i < count; i++) { - g->nodes[i].adjacency = rzalloc_array(g, GLboolean, count); - g->nodes[i].adjacency_list = ralloc_array(g, unsigned int, count); + int bitset_count = ALIGN(count, BITSET_WORDBITS) / BITSET_WORDBITS; + g->nodes[i].adjacency = rzalloc_array(g, BITSET_WORD, bitset_count); + + g->nodes[i].adjacency_list_size = 4; + g->nodes[i].adjacency_list = + ralloc_array(g, unsigned int, g->nodes[i].adjacency_list_size); g->nodes[i].adjacency_count = 0; + ra_add_node_adjacency(g, i, i); g->nodes[i].reg = NO_REG; } @@ -346,7 +362,7 @@ void ra_add_node_interference(struct ra_graph *g, unsigned int n1, unsigned int n2) { - if (!g->nodes[n1].adjacency[n2]) { + if (!BITSET_TEST(g->nodes[n1].adjacency, n2)) { ra_add_node_adjacency(g, n1, n2); ra_add_node_adjacency(g, n2, n1); } diff --git a/mesalib/src/mesa/sources.mak b/mesalib/src/mesa/sources.mak index 178ceb208..3c881082c 100644 --- a/mesalib/src/mesa/sources.mak +++ b/mesalib/src/mesa/sources.mak @@ -332,12 +332,6 @@ MESA_GALLIUM_FILES = \ $(STATETRACKER_FILES) \ $(SRCDIR)x86/common_x86.c -# All the core C sources, for dependency checking -ALL_FILES = \ - $(MESA_FILES) \ - $(MESA_ASM_FILES) \ - $(STATETRACKER_FILES) - ### Include directories INCLUDE_DIRS = \ diff --git a/mesalib/src/mesa/state_tracker/st_atom_pixeltransfer.c b/mesalib/src/mesa/state_tracker/st_atom_pixeltransfer.c index b612f7846..7e3997ef2 100644 --- a/mesalib/src/mesa/state_tracker/st_atom_pixeltransfer.c +++ b/mesalib/src/mesa/state_tracker/st_atom_pixeltransfer.c @@ -161,11 +161,11 @@ get_pixel_transfer_program(struct gl_context *ctx, const struct state_key *key) inst[ic].DstReg.File = PROGRAM_TEMPORARY; inst[ic].DstReg.Index = colorTemp; inst[ic].SrcReg[0].File = PROGRAM_INPUT; - inst[ic].SrcReg[0].Index = FRAG_ATTRIB_TEX0; + inst[ic].SrcReg[0].Index = VARYING_SLOT_TEX0; inst[ic].TexSrcUnit = 0; inst[ic].TexSrcTarget = TEXTURE_2D_INDEX; ic++; - fp->Base.InputsRead = BITFIELD64_BIT(FRAG_ATTRIB_TEX0); + fp->Base.InputsRead = BITFIELD64_BIT(VARYING_SLOT_TEX0); fp->Base.OutputsWritten = BITFIELD64_BIT(FRAG_RESULT_COLOR); fp->Base.SamplersUsed = 0x1; /* sampler 0 (bit 0) is used */ diff --git a/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c b/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c index 0e2a152cd..866e5627d 100644 --- a/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c +++ b/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c @@ -171,9 +171,9 @@ static void update_raster_state( struct st_context *st ) raster->sprite_coord_enable |= 1 << i; } } - if (fragProg->Base.InputsRead & FRAG_BIT_PNTC) { + if (fragProg->Base.InputsRead & VARYING_BIT_PNTC) { raster->sprite_coord_enable |= - 1 << (FRAG_ATTRIB_PNTC - FRAG_ATTRIB_TEX0); + 1 << (VARYING_SLOT_PNTC - VARYING_SLOT_TEX0); } raster->point_quad_rasterization = 1; @@ -183,7 +183,7 @@ static void update_raster_state( struct st_context *st ) */ if (vertProg) { if (vertProg->Base.Id == 0) { - if (vertProg->Base.OutputsWritten & BITFIELD64_BIT(VERT_RESULT_PSIZ)) { + if (vertProg->Base.OutputsWritten & BITFIELD64_BIT(VARYING_SLOT_PSIZ)) { /* generated program which emits point size */ raster->point_size_per_vertex = TRUE; } diff --git a/mesalib/src/mesa/state_tracker/st_cb_bitmap.c b/mesalib/src/mesa/state_tracker/st_cb_bitmap.c index 36fffe90d..bae9ff858 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_bitmap.c +++ b/mesalib/src/mesa/state_tracker/st_cb_bitmap.c @@ -139,7 +139,7 @@ make_bitmap_fragment_program(struct gl_context *ctx, GLuint samplerIndex) p->Instructions[ic].DstReg.File = PROGRAM_TEMPORARY; p->Instructions[ic].DstReg.Index = 0; p->Instructions[ic].SrcReg[0].File = PROGRAM_INPUT; - p->Instructions[ic].SrcReg[0].Index = FRAG_ATTRIB_TEX0; + p->Instructions[ic].SrcReg[0].Index = VARYING_SLOT_TEX0; p->Instructions[ic].TexSrcUnit = samplerIndex; p->Instructions[ic].TexSrcTarget = TEXTURE_2D_INDEX; ic++; @@ -160,7 +160,7 @@ make_bitmap_fragment_program(struct gl_context *ctx, GLuint samplerIndex) assert(ic == p->NumInstructions); - p->InputsRead = FRAG_BIT_TEX0; + p->InputsRead = VARYING_BIT_TEX0; p->OutputsWritten = 0x0; p->SamplersUsed = (1 << samplerIndex); diff --git a/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c b/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c index e282bf98d..f0baa3435 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c @@ -87,7 +87,7 @@ is_passthrough_program(const struct gl_fragment_program *prog) inst[0].DstReg.Index == FRAG_RESULT_COLOR && inst[0].DstReg.WriteMask == WRITEMASK_XYZW && inst[0].SrcReg[0].File == PROGRAM_INPUT && - inst[0].SrcReg[0].Index == FRAG_ATTRIB_COL0 && + inst[0].SrcReg[0].Index == VARYING_SLOT_COL0 && inst[0].SrcReg[0].Swizzle == SWIZZLE_XYZW) { return GL_TRUE; } @@ -233,7 +233,7 @@ st_make_drawpix_z_stencil_program(struct st_context *st, p->Instructions[ic].DstReg.Index = FRAG_RESULT_DEPTH; p->Instructions[ic].DstReg.WriteMask = WRITEMASK_Z; p->Instructions[ic].SrcReg[0].File = PROGRAM_INPUT; - p->Instructions[ic].SrcReg[0].Index = FRAG_ATTRIB_TEX0; + p->Instructions[ic].SrcReg[0].Index = VARYING_SLOT_TEX0; p->Instructions[ic].TexSrcUnit = 0; p->Instructions[ic].TexSrcTarget = TEXTURE_2D_INDEX; ic++; @@ -242,7 +242,7 @@ st_make_drawpix_z_stencil_program(struct st_context *st, p->Instructions[ic].DstReg.File = PROGRAM_OUTPUT; p->Instructions[ic].DstReg.Index = FRAG_RESULT_COLOR; p->Instructions[ic].SrcReg[0].File = PROGRAM_INPUT; - p->Instructions[ic].SrcReg[0].Index = FRAG_ATTRIB_COL0; + p->Instructions[ic].SrcReg[0].Index = VARYING_SLOT_COL0; ic++; } @@ -253,7 +253,7 @@ st_make_drawpix_z_stencil_program(struct st_context *st, p->Instructions[ic].DstReg.Index = FRAG_RESULT_STENCIL; p->Instructions[ic].DstReg.WriteMask = WRITEMASK_Y; p->Instructions[ic].SrcReg[0].File = PROGRAM_INPUT; - p->Instructions[ic].SrcReg[0].Index = FRAG_ATTRIB_TEX0; + p->Instructions[ic].SrcReg[0].Index = VARYING_SLOT_TEX0; p->Instructions[ic].TexSrcUnit = 1; p->Instructions[ic].TexSrcTarget = TEXTURE_2D_INDEX; ic++; @@ -264,7 +264,7 @@ st_make_drawpix_z_stencil_program(struct st_context *st, assert(ic == p->NumInstructions); - p->InputsRead = FRAG_BIT_TEX0 | FRAG_BIT_COL0; + p->InputsRead = VARYING_BIT_TEX0 | VARYING_BIT_COL0; p->OutputsWritten = 0; if (write_depth) { p->OutputsWritten |= BITFIELD64_BIT(FRAG_RESULT_DEPTH); diff --git a/mesalib/src/mesa/state_tracker/st_cb_drawtex.c b/mesalib/src/mesa/state_tracker/st_cb_drawtex.c index 5ca097004..a8806c91e 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_drawtex.c +++ b/mesalib/src/mesa/state_tracker/st_cb_drawtex.c @@ -116,7 +116,7 @@ st_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z, st_validate_state(st); /* determine if we need vertex color */ - if (ctx->FragmentProgram._Current->Base.InputsRead & FRAG_BIT_COL0) + if (ctx->FragmentProgram._Current->Base.InputsRead & VARYING_BIT_COL0) emitColor = GL_TRUE; else emitColor = GL_FALSE; diff --git a/mesalib/src/mesa/state_tracker/st_cb_fbo.c b/mesalib/src/mesa/state_tracker/st_cb_fbo.c index 72bc960b0..87c5b048c 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_fbo.c +++ b/mesalib/src/mesa/state_tracker/st_cb_fbo.c @@ -330,6 +330,9 @@ st_new_renderbuffer_fb(enum pipe_format format, int samples, boolean sw) /* accum buffer */ strb->Base.InternalFormat = GL_RGBA16_SNORM; break; + case PIPE_FORMAT_R16G16B16A16_UNORM: + strb->Base.InternalFormat = GL_RGBA16; + break; case PIPE_FORMAT_R8_UNORM: strb->Base.InternalFormat = GL_R8; break; diff --git a/mesalib/src/mesa/state_tracker/st_cb_feedback.c b/mesalib/src/mesa/state_tracker/st_cb_feedback.c index 9092e3a71..7a8fde465 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_feedback.c +++ b/mesalib/src/mesa/state_tracker/st_cb_feedback.c @@ -97,13 +97,13 @@ feedback_vertex(struct gl_context *ctx, const struct draw_context *draw, * color and texcoord attribs to use here. */ - slot = st->vertex_result_to_slot[VERT_RESULT_COL0]; + slot = st->vertex_result_to_slot[VARYING_SLOT_COL0]; if (slot != ~0U) color = v->data[slot]; else color = ctx->Current.Attrib[VERT_ATTRIB_COLOR0]; - slot = st->vertex_result_to_slot[VERT_RESULT_TEX0]; + slot = st->vertex_result_to_slot[VARYING_SLOT_TEX0]; if (slot != ~0U) texcoord = v->data[slot]; else diff --git a/mesalib/src/mesa/state_tracker/st_cb_rasterpos.c b/mesalib/src/mesa/state_tracker/st_cb_rasterpos.c index fb4a62ee3..4731f2648 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_rasterpos.c +++ b/mesalib/src/mesa/state_tracker/st_cb_rasterpos.c @@ -154,16 +154,16 @@ rastpos_point(struct draw_stage *stage, struct prim_header *prim) /* update other raster attribs */ update_attrib(ctx, outputMapping, prim->v[0], ctx->Current.RasterColor, - VERT_RESULT_COL0, VERT_ATTRIB_COLOR0); + VARYING_SLOT_COL0, VERT_ATTRIB_COLOR0); update_attrib(ctx, outputMapping, prim->v[0], ctx->Current.RasterSecondaryColor, - VERT_RESULT_COL1, VERT_ATTRIB_COLOR1); + VARYING_SLOT_COL1, VERT_ATTRIB_COLOR1); for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) { update_attrib(ctx, outputMapping, prim->v[0], ctx->Current.RasterTexCoords[i], - VERT_RESULT_TEX0 + i, VERT_ATTRIB_TEX0 + i); + VARYING_SLOT_TEX0 + i, VERT_ATTRIB_TEX0 + i); } if (ctx->RenderMode == GL_SELECT) { diff --git a/mesalib/src/mesa/state_tracker/st_context.h b/mesalib/src/mesa/state_tracker/st_context.h index a7b6cb535..b9a98cd05 100644 --- a/mesalib/src/mesa/state_tracker/st_context.h +++ b/mesalib/src/mesa/state_tracker/st_context.h @@ -126,7 +126,7 @@ struct st_context GLboolean missing_textures; GLboolean vertdata_edgeflags; - /** Mapping from VERT_RESULT_x to post-transformed vertex slot */ + /** Mapping from VARYING_SLOT_x to post-transformed vertex slot */ const GLuint *vertex_result_to_slot; struct st_vertex_program *vp; /**< Currently bound vertex program */ 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 131ecb22a..0cef092d3 100644 --- a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -148,7 +148,7 @@ public: explicit st_src_reg(st_dst_reg reg); gl_register_file file; /**< PROGRAM_* from Mesa */ - int index; /**< temporary index, VERT_ATTRIB_*, FRAG_ATTRIB_*, etc. */ + int index; /**< temporary index, VERT_ATTRIB_*, VARYING_SLOT_*, etc. */ int index2D; GLuint swizzle; /**< SWIZZLE_XYZWONEZERO swizzles from Mesa. */ int negate; /**< NEGATE_XYZW mask from mesa */ @@ -182,7 +182,7 @@ public: explicit st_dst_reg(st_src_reg reg); gl_register_file file; /**< PROGRAM_* from Mesa */ - int index; /**< temporary index, VERT_ATTRIB_*, FRAG_ATTRIB_*, etc. */ + int index; /**< temporary index, VERT_ATTRIB_*, VARYING_SLOT_*, etc. */ int writemask; /**< Bitfield of WRITEMASK_[XYZW] */ GLuint cond_mask:4; int type; /** GLSL_TYPE_* from GLSL IR (enum glsl_base_type) */ @@ -3830,14 +3830,14 @@ get_pixel_transfer_visitor(struct st_fragment_program *fp, * Get initial pixel color from the texture. * TEX colorTemp, fragment.texcoord[0], texture[0], 2D; */ - coord = st_src_reg(PROGRAM_INPUT, FRAG_ATTRIB_TEX0, glsl_type::vec2_type); + coord = st_src_reg(PROGRAM_INPUT, VARYING_SLOT_TEX0, glsl_type::vec2_type); src0 = v->get_temp(glsl_type::vec4_type); dst0 = st_dst_reg(src0); inst = v->emit(NULL, TGSI_OPCODE_TEX, dst0, coord); inst->sampler = 0; inst->tex_target = TEXTURE_2D_INDEX; - prog->InputsRead |= FRAG_BIT_TEX0; + prog->InputsRead |= VARYING_BIT_TEX0; prog->SamplersUsed |= (1 << 0); /* mark sampler 0 as used */ v->samplers_used |= (1 << 0); @@ -3903,7 +3903,7 @@ get_pixel_transfer_visitor(struct st_fragment_program *fp, for (int i=0; i<3; i++) { src_regs[i] = inst->src[i]; if (src_regs[i].file == PROGRAM_INPUT && - src_regs[i].index == FRAG_ATTRIB_COL0) + src_regs[i].index == VARYING_SLOT_COL0) { src_regs[i].file = PROGRAM_TEMPORARY; src_regs[i].index = src0.index; @@ -3958,14 +3958,14 @@ get_bitmap_visitor(struct st_fragment_program *fp, v->num_immediates = original->num_immediates; /* TEX tmp0, fragment.texcoord[0], texture[0], 2D; */ - coord = st_src_reg(PROGRAM_INPUT, FRAG_ATTRIB_TEX0, glsl_type::vec2_type); + coord = st_src_reg(PROGRAM_INPUT, VARYING_SLOT_TEX0, glsl_type::vec2_type); src0 = v->get_temp(glsl_type::vec4_type); dst0 = st_dst_reg(src0); inst = v->emit(NULL, TGSI_OPCODE_TEX, dst0, coord); inst->sampler = samplerIndex; inst->tex_target = TEXTURE_2D_INDEX; - prog->InputsRead |= FRAG_BIT_TEX0; + prog->InputsRead |= VARYING_BIT_TEX0; prog->SamplersUsed |= (1 << samplerIndex); /* mark sampler as used */ v->samplers_used |= (1 << samplerIndex); @@ -4144,11 +4144,11 @@ dst_register(struct st_translate *t, case PROGRAM_OUTPUT: if (t->procType == TGSI_PROCESSOR_VERTEX) - assert(index < VERT_RESULT_MAX); + assert(index < VARYING_SLOT_MAX); else if (t->procType == TGSI_PROCESSOR_FRAGMENT) assert(index < FRAG_RESULT_MAX); else - assert(index < GEOM_RESULT_MAX); + assert(index < VARYING_SLOT_MAX); assert(t->outputMapping[index] < Elements(t->outputs)); @@ -4246,10 +4246,10 @@ translate_dst(struct st_translate *t, case TGSI_PROCESSOR_VERTEX: /* XXX if the geometry shader is present, this must be done there * instead of here. */ - if (dst_reg->index == VERT_RESULT_COL0 || - dst_reg->index == VERT_RESULT_COL1 || - dst_reg->index == VERT_RESULT_BFC0 || - dst_reg->index == VERT_RESULT_BFC1) { + if (dst_reg->index == VARYING_SLOT_COL0 || + dst_reg->index == VARYING_SLOT_COL1 || + dst_reg->index == VARYING_SLOT_BFC0 || + dst_reg->index == VARYING_SLOT_BFC1) { dst = ureg_saturate(dst); } break; @@ -4441,7 +4441,7 @@ emit_wpos_adjustment( struct st_translate *t, struct ureg_src wpostrans = ureg_DECL_constant( ureg, wposTransConst ); struct ureg_dst wpos_temp = ureg_DECL_temporary( ureg ); - struct ureg_src wpos_input = t->inputs[t->inputMapping[FRAG_ATTRIB_WPOS]]; + struct ureg_src wpos_input = t->inputs[t->inputMapping[VARYING_SLOT_POS]]; /* First, apply the coordinate shift: */ if (adjX || adjY[0] || adjY[1]) { @@ -4492,7 +4492,7 @@ emit_wpos_adjustment( struct st_translate *t, /* Use wpos_temp as position input from here on: */ - t->inputs[t->inputMapping[FRAG_ATTRIB_WPOS]] = ureg_src(wpos_temp); + t->inputs[t->inputMapping[VARYING_SLOT_POS]] = ureg_src(wpos_temp); } @@ -4610,21 +4610,21 @@ emit_face_var(struct st_translate *t) { struct ureg_program *ureg = t->ureg; struct ureg_dst face_temp = ureg_DECL_temporary(ureg); - struct ureg_src face_input = t->inputs[t->inputMapping[FRAG_ATTRIB_FACE]]; + struct ureg_src face_input = t->inputs[t->inputMapping[VARYING_SLOT_FACE]]; /* MOV_SAT face_temp, input[face] */ face_temp = ureg_saturate(face_temp); ureg_MOV(ureg, face_temp, face_input); /* Use face_temp as face input from here on: */ - t->inputs[t->inputMapping[FRAG_ATTRIB_FACE]] = ureg_src(face_temp); + t->inputs[t->inputMapping[VARYING_SLOT_FACE]] = ureg_src(face_temp); } static void emit_edgeflags(struct st_translate *t) { struct ureg_program *ureg = t->ureg; - struct ureg_dst edge_dst = t->outputs[t->outputMapping[VERT_RESULT_EDGE]]; + struct ureg_dst edge_dst = t->outputs[t->outputMapping[VARYING_SLOT_EDGE]]; struct ureg_src edge_src = t->inputs[t->inputMapping[VERT_ATTRIB_EDGEFLAG]]; ureg_MOV(ureg, edge_dst, edge_src); @@ -4710,14 +4710,14 @@ st_translate_program( is_centroid[i]); } - if (proginfo->InputsRead & FRAG_BIT_WPOS) { + if (proginfo->InputsRead & VARYING_BIT_POS) { /* Must do this after setting up t->inputs, and before * emitting constant references, below: */ emit_wpos(st_context(ctx), t, proginfo, ureg); } - if (proginfo->InputsRead & FRAG_BIT_FACE) + if (proginfo->InputsRead & VARYING_BIT_FACE) emit_face_var(t); /* diff --git a/mesalib/src/mesa/state_tracker/st_manager.c b/mesalib/src/mesa/state_tracker/st_manager.c index a3a67712a..0b025d9d5 100644 --- a/mesalib/src/mesa/state_tracker/st_manager.c +++ b/mesalib/src/mesa/state_tracker/st_manager.c @@ -883,7 +883,7 @@ st_manager_add_color_renderbuffer(struct st_context *st, } static const struct st_api st_gl_api = { - "Mesa " MESA_VERSION_STRING, + "Mesa " PACKAGE_VERSION, ST_API_OPENGL, #if FEATURE_GL ST_PROFILE_DEFAULT_MASK | diff --git a/mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c b/mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c index e326bcc70..3831a0a79 100644 --- a/mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c +++ b/mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c @@ -175,11 +175,11 @@ dst_register( struct st_translate *t, case PROGRAM_OUTPUT: if (t->procType == TGSI_PROCESSOR_VERTEX) - assert(index < VERT_RESULT_MAX); + assert(index < VARYING_SLOT_MAX); else if (t->procType == TGSI_PROCESSOR_FRAGMENT) assert(index < FRAG_RESULT_MAX); else - assert(index < GEOM_RESULT_MAX); + assert(index < VARYING_SLOT_MAX); assert(t->outputMapping[index] < Elements(t->outputs)); @@ -310,10 +310,10 @@ translate_dst( struct st_translate *t, case TGSI_PROCESSOR_VERTEX: /* XXX if the geometry shader is present, this must be done there * instead of here. */ - if (DstReg->Index == VERT_RESULT_COL0 || - DstReg->Index == VERT_RESULT_COL1 || - DstReg->Index == VERT_RESULT_BFC0 || - DstReg->Index == VERT_RESULT_BFC1) { + if (DstReg->Index == VARYING_SLOT_COL0 || + DstReg->Index == VARYING_SLOT_COL1 || + DstReg->Index == VARYING_SLOT_BFC0 || + DstReg->Index == VARYING_SLOT_BFC1) { dst = ureg_saturate(dst); } break; @@ -790,7 +790,7 @@ emit_wpos_adjustment( struct st_translate *t, struct ureg_src wpostrans = ureg_DECL_constant( ureg, wposTransConst ); struct ureg_dst wpos_temp = ureg_DECL_temporary( ureg ); - struct ureg_src wpos_input = t->inputs[t->inputMapping[FRAG_ATTRIB_WPOS]]; + struct ureg_src wpos_input = t->inputs[t->inputMapping[VARYING_SLOT_POS]]; /* First, apply the coordinate shift: */ if (adjX || adjY[0] || adjY[1]) { @@ -841,7 +841,7 @@ emit_wpos_adjustment( struct st_translate *t, /* Use wpos_temp as position input from here on: */ - t->inputs[t->inputMapping[FRAG_ATTRIB_WPOS]] = ureg_src(wpos_temp); + t->inputs[t->inputMapping[VARYING_SLOT_POS]] = ureg_src(wpos_temp); } @@ -961,7 +961,7 @@ emit_face_var( struct st_translate *t, { struct ureg_program *ureg = t->ureg; struct ureg_dst face_temp = ureg_DECL_temporary( ureg ); - struct ureg_src face_input = t->inputs[t->inputMapping[FRAG_ATTRIB_FACE]]; + struct ureg_src face_input = t->inputs[t->inputMapping[VARYING_SLOT_FACE]]; /* MOV_SAT face_temp, input[face] */ @@ -970,7 +970,7 @@ emit_face_var( struct st_translate *t, /* Use face_temp as face input from here on: */ - t->inputs[t->inputMapping[FRAG_ATTRIB_FACE]] = ureg_src(face_temp); + t->inputs[t->inputMapping[VARYING_SLOT_FACE]] = ureg_src(face_temp); } @@ -979,7 +979,7 @@ emit_edgeflags( struct st_translate *t, const struct gl_program *program ) { struct ureg_program *ureg = t->ureg; - struct ureg_dst edge_dst = t->outputs[t->outputMapping[VERT_RESULT_EDGE]]; + struct ureg_dst edge_dst = t->outputs[t->outputMapping[VARYING_SLOT_EDGE]]; struct ureg_src edge_src = t->inputs[t->inputMapping[VERT_ATTRIB_EDGEFLAG]]; ureg_MOV( ureg, edge_dst, edge_src ); @@ -1051,14 +1051,14 @@ st_translate_mesa_program( interpMode[i]); } - if (program->InputsRead & FRAG_BIT_WPOS) { + if (program->InputsRead & VARYING_BIT_POS) { /* Must do this after setting up t->inputs, and before * emitting constant references, below: */ emit_wpos(st_context(ctx), t, program, ureg); } - if (program->InputsRead & FRAG_BIT_FACE) { + if (program->InputsRead & VARYING_BIT_FACE) { emit_face_var( t, program ); } diff --git a/mesalib/src/mesa/state_tracker/st_program.c b/mesalib/src/mesa/state_tracker/st_program.c index f56f7cb1c..6af8df316 100644 --- a/mesalib/src/mesa/state_tracker/st_program.c +++ b/mesalib/src/mesa/state_tracker/st_program.c @@ -168,7 +168,7 @@ st_release_gp_variants(struct st_context *st, struct st_geometry_program *stgp) /** * Translate a Mesa vertex shader into a TGSI shader. - * \param outputMapping to map vertex program output registers (VERT_RESULT_x) + * \param outputMapping to map vertex program output registers (VARYING_SLOT_x) * to TGSI output slots * \param tokensOut destination for TGSI tokens * \return pointer to cached pipe_shader object. @@ -205,7 +205,7 @@ st_prepare_vertex_program(struct gl_context *ctx, /* Compute mapping of vertex program outputs to slots. */ - for (attr = 0; attr < VERT_RESULT_MAX; attr++) { + for (attr = 0; attr < VARYING_SLOT_MAX; attr++) { if ((stvp->Base.Base.OutputsWritten & BITFIELD64_BIT(attr)) == 0) { stvp->result_to_output[attr] = ~0; } @@ -215,76 +215,76 @@ st_prepare_vertex_program(struct gl_context *ctx, stvp->result_to_output[attr] = slot; switch (attr) { - case VERT_RESULT_HPOS: + case VARYING_SLOT_POS: stvp->output_semantic_name[slot] = TGSI_SEMANTIC_POSITION; stvp->output_semantic_index[slot] = 0; break; - case VERT_RESULT_COL0: + case VARYING_SLOT_COL0: stvp->output_semantic_name[slot] = TGSI_SEMANTIC_COLOR; stvp->output_semantic_index[slot] = 0; break; - case VERT_RESULT_COL1: + case VARYING_SLOT_COL1: stvp->output_semantic_name[slot] = TGSI_SEMANTIC_COLOR; stvp->output_semantic_index[slot] = 1; break; - case VERT_RESULT_BFC0: + case VARYING_SLOT_BFC0: stvp->output_semantic_name[slot] = TGSI_SEMANTIC_BCOLOR; stvp->output_semantic_index[slot] = 0; break; - case VERT_RESULT_BFC1: + case VARYING_SLOT_BFC1: stvp->output_semantic_name[slot] = TGSI_SEMANTIC_BCOLOR; stvp->output_semantic_index[slot] = 1; break; - case VERT_RESULT_FOGC: + case VARYING_SLOT_FOGC: stvp->output_semantic_name[slot] = TGSI_SEMANTIC_FOG; stvp->output_semantic_index[slot] = 0; break; - case VERT_RESULT_PSIZ: + case VARYING_SLOT_PSIZ: stvp->output_semantic_name[slot] = TGSI_SEMANTIC_PSIZE; stvp->output_semantic_index[slot] = 0; break; - case VERT_RESULT_CLIP_DIST0: + case VARYING_SLOT_CLIP_DIST0: stvp->output_semantic_name[slot] = TGSI_SEMANTIC_CLIPDIST; stvp->output_semantic_index[slot] = 0; break; - case VERT_RESULT_CLIP_DIST1: + case VARYING_SLOT_CLIP_DIST1: stvp->output_semantic_name[slot] = TGSI_SEMANTIC_CLIPDIST; stvp->output_semantic_index[slot] = 1; break; - case VERT_RESULT_EDGE: + case VARYING_SLOT_EDGE: assert(0); break; - case VERT_RESULT_CLIP_VERTEX: + case VARYING_SLOT_CLIP_VERTEX: stvp->output_semantic_name[slot] = TGSI_SEMANTIC_CLIPVERTEX; stvp->output_semantic_index[slot] = 0; break; - case VERT_RESULT_TEX0: - case VERT_RESULT_TEX1: - case VERT_RESULT_TEX2: - case VERT_RESULT_TEX3: - case VERT_RESULT_TEX4: - case VERT_RESULT_TEX5: - case VERT_RESULT_TEX6: - case VERT_RESULT_TEX7: + case VARYING_SLOT_TEX0: + case VARYING_SLOT_TEX1: + case VARYING_SLOT_TEX2: + case VARYING_SLOT_TEX3: + case VARYING_SLOT_TEX4: + case VARYING_SLOT_TEX5: + case VARYING_SLOT_TEX6: + case VARYING_SLOT_TEX7: stvp->output_semantic_name[slot] = TGSI_SEMANTIC_GENERIC; - stvp->output_semantic_index[slot] = attr - VERT_RESULT_TEX0; + stvp->output_semantic_index[slot] = attr - VARYING_SLOT_TEX0; break; - case VERT_RESULT_VAR0: + case VARYING_SLOT_VAR0: default: - assert(attr < VERT_RESULT_MAX); + assert(attr < VARYING_SLOT_MAX); stvp->output_semantic_name[slot] = TGSI_SEMANTIC_GENERIC; - stvp->output_semantic_index[slot] = (FRAG_ATTRIB_VAR0 - - FRAG_ATTRIB_TEX0 + + stvp->output_semantic_index[slot] = (VARYING_SLOT_VAR0 - + VARYING_SLOT_TEX0 + attr - - VERT_RESULT_VAR0); + VARYING_SLOT_VAR0); break; } } } /* similar hack to above, presetup potentially unused edgeflag output */ - stvp->result_to_output[VERT_RESULT_EDGE] = stvp->num_outputs; + stvp->result_to_output[VARYING_SLOT_EDGE] = stvp->num_outputs; stvp->output_semantic_name[stvp->num_outputs] = TGSI_SEMANTIC_EDGEFLAG; stvp->output_semantic_index[stvp->num_outputs] = 0; } @@ -472,7 +472,7 @@ st_translate_fragment_program(struct st_context *st, GLboolean deleteFP = GL_FALSE; GLuint outputMapping[FRAG_RESULT_MAX]; - GLuint inputMapping[FRAG_ATTRIB_MAX]; + GLuint inputMapping[VARYING_SLOT_MAX]; GLuint interpMode[PIPE_MAX_SHADER_INPUTS]; /* XXX size? */ GLuint attr; GLbitfield64 inputsRead; @@ -529,7 +529,7 @@ st_translate_fragment_program(struct st_context *st, * Convert Mesa program inputs to TGSI input register semantics. */ inputsRead = stfp->Base.Base.InputsRead; - for (attr = 0; attr < FRAG_ATTRIB_MAX; attr++) { + for (attr = 0; attr < VARYING_SLOT_MAX; attr++) { if ((inputsRead & BITFIELD64_BIT(attr)) != 0) { const GLuint slot = fs_num_inputs++; @@ -537,46 +537,46 @@ st_translate_fragment_program(struct st_context *st, is_centroid[slot] = (stfp->Base.IsCentroid & BITFIELD64_BIT(attr)) != 0; switch (attr) { - case FRAG_ATTRIB_WPOS: + case VARYING_SLOT_POS: input_semantic_name[slot] = TGSI_SEMANTIC_POSITION; input_semantic_index[slot] = 0; interpMode[slot] = TGSI_INTERPOLATE_LINEAR; break; - case FRAG_ATTRIB_COL0: + case VARYING_SLOT_COL0: input_semantic_name[slot] = TGSI_SEMANTIC_COLOR; input_semantic_index[slot] = 0; interpMode[slot] = st_translate_interp(stfp->Base.InterpQualifier[attr], TRUE); break; - case FRAG_ATTRIB_COL1: + case VARYING_SLOT_COL1: input_semantic_name[slot] = TGSI_SEMANTIC_COLOR; input_semantic_index[slot] = 1; interpMode[slot] = st_translate_interp(stfp->Base.InterpQualifier[attr], TRUE); break; - case FRAG_ATTRIB_FOGC: + case VARYING_SLOT_FOGC: input_semantic_name[slot] = TGSI_SEMANTIC_FOG; input_semantic_index[slot] = 0; interpMode[slot] = TGSI_INTERPOLATE_PERSPECTIVE; break; - case FRAG_ATTRIB_FACE: + case VARYING_SLOT_FACE: input_semantic_name[slot] = TGSI_SEMANTIC_FACE; input_semantic_index[slot] = 0; interpMode[slot] = TGSI_INTERPOLATE_CONSTANT; break; - case FRAG_ATTRIB_CLIP_DIST0: + case VARYING_SLOT_CLIP_DIST0: input_semantic_name[slot] = TGSI_SEMANTIC_CLIPDIST; input_semantic_index[slot] = 0; interpMode[slot] = TGSI_INTERPOLATE_PERSPECTIVE; break; - case FRAG_ATTRIB_CLIP_DIST1: + case VARYING_SLOT_CLIP_DIST1: input_semantic_name[slot] = TGSI_SEMANTIC_CLIPDIST; input_semantic_index[slot] = 1; interpMode[slot] = TGSI_INTERPOLATE_PERSPECTIVE; break; /* In most cases, there is nothing special about these * inputs, so adopt a convention to use the generic - * semantic name and the mesa FRAG_ATTRIB_ number as the + * semantic name and the mesa VARYING_SLOT_ number as the * index. * * All that is required is that the vertex shader labels @@ -589,24 +589,24 @@ st_translate_fragment_program(struct st_context *st, * zero or be restricted to a particular range -- nobody * should be building tables based on semantic index. */ - case FRAG_ATTRIB_PNTC: - case FRAG_ATTRIB_TEX0: - case FRAG_ATTRIB_TEX1: - case FRAG_ATTRIB_TEX2: - case FRAG_ATTRIB_TEX3: - case FRAG_ATTRIB_TEX4: - case FRAG_ATTRIB_TEX5: - case FRAG_ATTRIB_TEX6: - case FRAG_ATTRIB_TEX7: - case FRAG_ATTRIB_VAR0: + case VARYING_SLOT_PNTC: + case VARYING_SLOT_TEX0: + case VARYING_SLOT_TEX1: + case VARYING_SLOT_TEX2: + case VARYING_SLOT_TEX3: + case VARYING_SLOT_TEX4: + case VARYING_SLOT_TEX5: + case VARYING_SLOT_TEX6: + case VARYING_SLOT_TEX7: + case VARYING_SLOT_VAR0: default: /* Actually, let's try and zero-base this just for * readability of the generated TGSI. */ - assert(attr >= FRAG_ATTRIB_TEX0); - input_semantic_index[slot] = (attr - FRAG_ATTRIB_TEX0); + assert(attr >= VARYING_SLOT_TEX0); + input_semantic_index[slot] = (attr - VARYING_SLOT_TEX0); input_semantic_name[slot] = TGSI_SEMANTIC_GENERIC; - if (attr == FRAG_ATTRIB_PNTC) + if (attr == VARYING_SLOT_PNTC) interpMode[slot] = TGSI_INTERPOLATE_LINEAR; else interpMode[slot] = st_translate_interp(stfp->Base.InterpQualifier[attr], @@ -800,8 +800,8 @@ st_translate_geometry_program(struct st_context *st, struct st_geometry_program *stgp, const struct st_gp_variant_key *key) { - GLuint inputMapping[GEOM_ATTRIB_MAX]; - GLuint outputMapping[GEOM_RESULT_MAX]; + GLuint inputMapping[VARYING_SLOT_MAX]; + GLuint outputMapping[VARYING_SLOT_MAX]; struct pipe_context *pipe = st->pipe; GLuint attr; GLbitfield64 inputsRead; @@ -844,7 +844,7 @@ st_translate_geometry_program(struct st_context *st, * Convert Mesa program inputs to TGSI input register semantics. */ inputsRead = stgp->Base.Base.InputsRead; - for (attr = 0; attr < GEOM_ATTRIB_MAX; attr++) { + for (attr = 0; attr < VARYING_SLOT_MAX; attr++) { if ((inputsRead & BITFIELD64_BIT(attr)) != 0) { const GLuint slot = gs_num_inputs; @@ -857,7 +857,7 @@ st_translate_geometry_program(struct st_context *st, stgp->index_to_input[vslot] = attr; ++vslot; - if (attr != GEOM_ATTRIB_PRIMITIVE_ID) { + if (attr != VARYING_SLOT_PRIMITIVE_ID) { gs_array_offset += 2; } else ++gs_builtin_inputs; @@ -868,31 +868,31 @@ st_translate_geometry_program(struct st_context *st, #endif switch (attr) { - case GEOM_ATTRIB_PRIMITIVE_ID: + case VARYING_SLOT_PRIMITIVE_ID: stgp->input_semantic_name[slot] = TGSI_SEMANTIC_PRIMID; stgp->input_semantic_index[slot] = 0; break; - case GEOM_ATTRIB_POSITION: + case VARYING_SLOT_POS: stgp->input_semantic_name[slot] = TGSI_SEMANTIC_POSITION; stgp->input_semantic_index[slot] = 0; break; - case GEOM_ATTRIB_COLOR0: + case VARYING_SLOT_COL0: stgp->input_semantic_name[slot] = TGSI_SEMANTIC_COLOR; stgp->input_semantic_index[slot] = 0; break; - case GEOM_ATTRIB_COLOR1: + case VARYING_SLOT_COL1: stgp->input_semantic_name[slot] = TGSI_SEMANTIC_COLOR; stgp->input_semantic_index[slot] = 1; break; - case GEOM_ATTRIB_FOG_FRAG_COORD: + case VARYING_SLOT_FOGC: stgp->input_semantic_name[slot] = TGSI_SEMANTIC_FOG; stgp->input_semantic_index[slot] = 0; break; - case GEOM_ATTRIB_TEX_COORD: + case VARYING_SLOT_TEX0: stgp->input_semantic_name[slot] = TGSI_SEMANTIC_GENERIC; stgp->input_semantic_index[slot] = num_generic++; break; - case GEOM_ATTRIB_VAR0: + case VARYING_SLOT_VAR0: /* fall-through */ default: stgp->input_semantic_name[slot] = TGSI_SEMANTIC_GENERIC; @@ -912,7 +912,7 @@ st_translate_geometry_program(struct st_context *st, * Determine number of outputs, the (default) output register * mapping and the semantic information for each output. */ - for (attr = 0; attr < GEOM_RESULT_MAX; attr++) { + for (attr = 0; attr < VARYING_SLOT_MAX; attr++) { if (stgp->Base.Base.OutputsWritten & BITFIELD64_BIT(attr)) { GLuint slot; @@ -921,45 +921,45 @@ st_translate_geometry_program(struct st_context *st, outputMapping[attr] = slot; switch (attr) { - case GEOM_RESULT_POS: + case VARYING_SLOT_POS: assert(slot == 0); gs_output_semantic_name[slot] = TGSI_SEMANTIC_POSITION; gs_output_semantic_index[slot] = 0; break; - case GEOM_RESULT_COL0: + case VARYING_SLOT_COL0: gs_output_semantic_name[slot] = TGSI_SEMANTIC_COLOR; gs_output_semantic_index[slot] = 0; break; - case GEOM_RESULT_COL1: + case VARYING_SLOT_COL1: gs_output_semantic_name[slot] = TGSI_SEMANTIC_COLOR; gs_output_semantic_index[slot] = 1; break; - case GEOM_RESULT_SCOL0: + case VARYING_SLOT_BFC0: gs_output_semantic_name[slot] = TGSI_SEMANTIC_BCOLOR; gs_output_semantic_index[slot] = 0; break; - case GEOM_RESULT_SCOL1: + case VARYING_SLOT_BFC1: gs_output_semantic_name[slot] = TGSI_SEMANTIC_BCOLOR; gs_output_semantic_index[slot] = 1; break; - case GEOM_RESULT_FOGC: + case VARYING_SLOT_FOGC: gs_output_semantic_name[slot] = TGSI_SEMANTIC_FOG; gs_output_semantic_index[slot] = 0; break; - case GEOM_RESULT_PSIZ: + case VARYING_SLOT_PSIZ: gs_output_semantic_name[slot] = TGSI_SEMANTIC_PSIZE; gs_output_semantic_index[slot] = 0; break; - case GEOM_RESULT_TEX0: - case GEOM_RESULT_TEX1: - case GEOM_RESULT_TEX2: - case GEOM_RESULT_TEX3: - case GEOM_RESULT_TEX4: - case GEOM_RESULT_TEX5: - case GEOM_RESULT_TEX6: - case GEOM_RESULT_TEX7: + case VARYING_SLOT_TEX0: + case VARYING_SLOT_TEX1: + case VARYING_SLOT_TEX2: + case VARYING_SLOT_TEX3: + case VARYING_SLOT_TEX4: + case VARYING_SLOT_TEX5: + case VARYING_SLOT_TEX6: + case VARYING_SLOT_TEX7: /* fall-through */ - case GEOM_RESULT_VAR0: + case VARYING_SLOT_VAR0: /* fall-through */ default: assert(slot < Elements(gs_output_semantic_name)); @@ -973,7 +973,7 @@ st_translate_geometry_program(struct st_context *st, assert(gs_output_semantic_name[0] == TGSI_SEMANTIC_POSITION); /* find max output slot referenced to compute gs_num_outputs */ - for (attr = 0; attr < GEOM_RESULT_MAX; attr++) { + for (attr = 0; attr < VARYING_SLOT_MAX; attr++) { if (outputMapping[attr] != ~0 && outputMapping[attr] > maxSlot) maxSlot = outputMapping[attr]; } diff --git a/mesalib/src/mesa/state_tracker/st_program.h b/mesalib/src/mesa/state_tracker/st_program.h index 23a262ccc..c764dc9c4 100644 --- a/mesalib/src/mesa/state_tracker/st_program.h +++ b/mesalib/src/mesa/state_tracker/st_program.h @@ -152,10 +152,10 @@ struct st_vertex_program GLuint index_to_input[PIPE_MAX_SHADER_INPUTS]; GLuint num_inputs; - /** Maps VERT_RESULT_x to slot */ - GLuint result_to_output[VERT_RESULT_MAX]; - ubyte output_semantic_name[VERT_RESULT_MAX]; - ubyte output_semantic_index[VERT_RESULT_MAX]; + /** Maps VARYING_SLOT_x to slot */ + GLuint result_to_output[VARYING_SLOT_MAX]; + ubyte output_semantic_name[VARYING_SLOT_MAX]; + ubyte output_semantic_index[VARYING_SLOT_MAX]; GLuint num_outputs; /** List of translated variants of this vertex program. @@ -198,14 +198,14 @@ struct st_geometry_program /** map GP input back to VP output */ GLuint input_map[PIPE_MAX_SHADER_INPUTS]; - /** maps a Mesa GEOM_ATTRIB_x to a packed TGSI input index */ - GLuint input_to_index[GEOM_ATTRIB_MAX]; - /** maps a TGSI input index back to a Mesa GEOM_ATTRIB_x */ + /** maps a Mesa VARYING_SLOT_x to a packed TGSI input index */ + GLuint input_to_index[VARYING_SLOT_MAX]; + /** maps a TGSI input index back to a Mesa VARYING_SLOT_x */ GLuint index_to_input[PIPE_MAX_SHADER_INPUTS]; GLuint num_inputs; - GLuint input_to_slot[GEOM_ATTRIB_MAX]; /**< Maps GEOM_ATTRIB_x to slot */ + GLuint input_to_slot[VARYING_SLOT_MAX]; /**< Maps VARYING_SLOT_x to slot */ GLuint num_input_slots; ubyte input_semantic_name[PIPE_MAX_SHADER_INPUTS]; diff --git a/mesalib/src/mesa/swrast/s_aaline.c b/mesalib/src/mesa/swrast/s_aaline.c index d36d87697..dcc9e3a5c 100644 --- a/mesalib/src/mesa/swrast/s_aaline.c +++ b/mesalib/src/mesa/swrast/s_aaline.c @@ -63,10 +63,10 @@ struct LineInfo GLfloat rPlane[4], gPlane[4], bPlane[4], aPlane[4]; /* DO_ATTRIBS */ GLfloat wPlane[4]; - GLfloat attrPlane[FRAG_ATTRIB_MAX][4][4]; - GLfloat lambda[FRAG_ATTRIB_MAX]; - GLfloat texWidth[FRAG_ATTRIB_MAX]; - GLfloat texHeight[FRAG_ATTRIB_MAX]; + GLfloat attrPlane[VARYING_SLOT_MAX][4][4]; + GLfloat lambda[VARYING_SLOT_MAX]; + GLfloat texWidth[VARYING_SLOT_MAX]; + GLfloat texHeight[VARYING_SLOT_MAX]; SWspan span; }; diff --git a/mesalib/src/mesa/swrast/s_aalinetemp.h b/mesalib/src/mesa/swrast/s_aalinetemp.h index 6cfd3bc28..75e28f417 100644 --- a/mesalib/src/mesa/swrast/s_aalinetemp.h +++ b/mesalib/src/mesa/swrast/s_aalinetemp.h @@ -66,10 +66,10 @@ NAME(plot)(struct gl_context *ctx, struct LineInfo *line, int ix, int iy) #if defined(DO_ATTRIBS) ATTRIB_LOOP_BEGIN GLfloat (*attribArray)[4] = line->span.array->attribs[attr]; - if (attr >= FRAG_ATTRIB_TEX0 && attr < FRAG_ATTRIB_VAR0 + if (attr >= VARYING_SLOT_TEX0 && attr < VARYING_SLOT_VAR0 && !_swrast_use_fragment_program(ctx)) { /* texcoord w/ divide by Q */ - const GLuint unit = attr - FRAG_ATTRIB_TEX0; + const GLuint unit = attr - VARYING_SLOT_TEX0; const GLfloat invQ = solve_plane_recip(fx, fy, line->attrPlane[attr][3]); GLuint c; for (c = 0; c < 3; c++) { @@ -112,10 +112,10 @@ NAME(line)(struct gl_context *ctx, const SWvertex *v0, const SWvertex *v1) /* Init the LineInfo struct */ struct LineInfo line; - line.x0 = v0->attrib[FRAG_ATTRIB_WPOS][0]; - line.y0 = v0->attrib[FRAG_ATTRIB_WPOS][1]; - line.x1 = v1->attrib[FRAG_ATTRIB_WPOS][0]; - line.y1 = v1->attrib[FRAG_ATTRIB_WPOS][1]; + line.x0 = v0->attrib[VARYING_SLOT_POS][0]; + line.y0 = v0->attrib[VARYING_SLOT_POS][1]; + line.x1 = v1->attrib[VARYING_SLOT_POS][0]; + line.y1 = v1->attrib[VARYING_SLOT_POS][1]; line.dx = line.x1 - line.x0; line.dy = line.y1 - line.y0; line.len = sqrtf(line.dx * line.dx + line.dy * line.dy); @@ -135,7 +135,7 @@ NAME(line)(struct gl_context *ctx, const SWvertex *v0, const SWvertex *v1) #ifdef DO_Z line.span.arrayMask |= SPAN_Z; compute_plane(line.x0, line.y0, line.x1, line.y1, - v0->attrib[FRAG_ATTRIB_WPOS][2], v1->attrib[FRAG_ATTRIB_WPOS][2], line.zPlane); + v0->attrib[VARYING_SLOT_POS][2], v1->attrib[VARYING_SLOT_POS][2], line.zPlane); #endif line.span.arrayMask |= SPAN_RGBA; if (ctx->Light.ShadeModel == GL_SMOOTH) { @@ -156,8 +156,8 @@ NAME(line)(struct gl_context *ctx, const SWvertex *v0, const SWvertex *v1) } #if defined(DO_ATTRIBS) { - const GLfloat invW0 = v0->attrib[FRAG_ATTRIB_WPOS][3]; - const GLfloat invW1 = v1->attrib[FRAG_ATTRIB_WPOS][3]; + const GLfloat invW0 = v0->attrib[VARYING_SLOT_POS][3]; + const GLfloat invW1 = v1->attrib[VARYING_SLOT_POS][3]; line.span.arrayMask |= SPAN_LAMBDA; compute_plane(line.x0, line.y0, line.x1, line.y1, invW0, invW1, line.wPlane); ATTRIB_LOOP_BEGIN @@ -176,8 +176,8 @@ NAME(line)(struct gl_context *ctx, const SWvertex *v0, const SWvertex *v1) } } line.span.arrayAttribs |= BITFIELD64_BIT(attr); - if (attr >= FRAG_ATTRIB_TEX0 && attr < FRAG_ATTRIB_VAR0) { - const GLuint u = attr - FRAG_ATTRIB_TEX0; + if (attr >= VARYING_SLOT_TEX0 && attr < VARYING_SLOT_VAR0) { + const GLuint u = attr - VARYING_SLOT_TEX0; const struct gl_texture_object *obj = ctx->Texture.Unit[u]._Current; const struct gl_texture_image *texImage = obj->Image[0][obj->BaseLevel]; line.texWidth[attr] = (GLfloat) texImage->Width; diff --git a/mesalib/src/mesa/swrast/s_aatritemp.h b/mesalib/src/mesa/swrast/s_aatritemp.h index 9cdb35fd2..4581248fd 100644 --- a/mesalib/src/mesa/swrast/s_aatritemp.h +++ b/mesalib/src/mesa/swrast/s_aatritemp.h @@ -39,9 +39,9 @@ /*void triangle( struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint pv )*/ { const SWcontext *swrast = SWRAST_CONTEXT(ctx); - const GLfloat *p0 = v0->attrib[FRAG_ATTRIB_WPOS]; - const GLfloat *p1 = v1->attrib[FRAG_ATTRIB_WPOS]; - const GLfloat *p2 = v2->attrib[FRAG_ATTRIB_WPOS]; + const GLfloat *p0 = v0->attrib[VARYING_SLOT_POS]; + const GLfloat *p1 = v1->attrib[VARYING_SLOT_POS]; + const GLfloat *p2 = v2->attrib[VARYING_SLOT_POS]; const SWvertex *vMin, *vMid, *vMax; GLint iyMin, iyMax; GLfloat yMin, yMax; @@ -55,7 +55,7 @@ #endif GLfloat rPlane[4], gPlane[4], bPlane[4], aPlane[4]; #if defined(DO_ATTRIBS) - GLfloat attrPlane[FRAG_ATTRIB_MAX][4][4]; + GLfloat attrPlane[VARYING_SLOT_MAX][4][4]; GLfloat wPlane[4]; /* win[3] */ #endif GLfloat bf = SWRAST_CONTEXT(ctx)->_BackfaceCullSign; @@ -67,9 +67,9 @@ /* determine bottom to top order of vertices */ { - GLfloat y0 = v0->attrib[FRAG_ATTRIB_WPOS][1]; - GLfloat y1 = v1->attrib[FRAG_ATTRIB_WPOS][1]; - GLfloat y2 = v2->attrib[FRAG_ATTRIB_WPOS][1]; + GLfloat y0 = v0->attrib[VARYING_SLOT_POS][1]; + GLfloat y1 = v1->attrib[VARYING_SLOT_POS][1]; + GLfloat y2 = v2->attrib[VARYING_SLOT_POS][1]; if (y0 <= y1) { if (y1 <= y2) { vMin = v0; vMid = v1; vMax = v2; /* y0<=y1<=y2 */ @@ -94,13 +94,13 @@ } } - majDx = vMax->attrib[FRAG_ATTRIB_WPOS][0] - vMin->attrib[FRAG_ATTRIB_WPOS][0]; - majDy = vMax->attrib[FRAG_ATTRIB_WPOS][1] - vMin->attrib[FRAG_ATTRIB_WPOS][1]; + majDx = vMax->attrib[VARYING_SLOT_POS][0] - vMin->attrib[VARYING_SLOT_POS][0]; + majDy = vMax->attrib[VARYING_SLOT_POS][1] - vMin->attrib[VARYING_SLOT_POS][1]; /* front/back-face determination and cullling */ { - const GLfloat botDx = vMid->attrib[FRAG_ATTRIB_WPOS][0] - vMin->attrib[FRAG_ATTRIB_WPOS][0]; - const GLfloat botDy = vMid->attrib[FRAG_ATTRIB_WPOS][1] - vMin->attrib[FRAG_ATTRIB_WPOS][1]; + const GLfloat botDx = vMid->attrib[VARYING_SLOT_POS][0] - vMin->attrib[VARYING_SLOT_POS][0]; + const GLfloat botDy = vMid->attrib[VARYING_SLOT_POS][1] - vMin->attrib[VARYING_SLOT_POS][1]; const GLfloat area = majDx * botDy - botDx * majDy; /* Do backface culling */ if (area * bf < 0 || area == 0 || IS_INF_OR_NAN(area)) @@ -134,12 +134,12 @@ span.arrayMask |= SPAN_RGBA; #if defined(DO_ATTRIBS) { - const GLfloat invW0 = v0->attrib[FRAG_ATTRIB_WPOS][3]; - const GLfloat invW1 = v1->attrib[FRAG_ATTRIB_WPOS][3]; - const GLfloat invW2 = v2->attrib[FRAG_ATTRIB_WPOS][3]; + const GLfloat invW0 = v0->attrib[VARYING_SLOT_POS][3]; + const GLfloat invW1 = v1->attrib[VARYING_SLOT_POS][3]; + const GLfloat invW2 = v2->attrib[VARYING_SLOT_POS][3]; compute_plane(p0, p1, p2, invW0, invW1, invW2, wPlane); - span.attrStepX[FRAG_ATTRIB_WPOS][3] = plane_dx(wPlane); - span.attrStepY[FRAG_ATTRIB_WPOS][3] = plane_dy(wPlane); + span.attrStepX[VARYING_SLOT_POS][3] = plane_dx(wPlane); + span.attrStepY[VARYING_SLOT_POS][3] = plane_dy(wPlane); ATTRIB_LOOP_BEGIN GLuint c; if (swrast->_InterpMode[attr] == GL_FLAT) { @@ -169,16 +169,16 @@ * edges, stopping when we find that coverage = 0. If the long edge * is on the left we scan left-to-right. Else, we scan right-to-left. */ - yMin = vMin->attrib[FRAG_ATTRIB_WPOS][1]; - yMax = vMax->attrib[FRAG_ATTRIB_WPOS][1]; + yMin = vMin->attrib[VARYING_SLOT_POS][1]; + yMax = vMax->attrib[VARYING_SLOT_POS][1]; iyMin = (GLint) yMin; iyMax = (GLint) yMax + 1; if (ltor) { /* scan left to right */ - const GLfloat *pMin = vMin->attrib[FRAG_ATTRIB_WPOS]; - const GLfloat *pMid = vMid->attrib[FRAG_ATTRIB_WPOS]; - const GLfloat *pMax = vMax->attrib[FRAG_ATTRIB_WPOS]; + const GLfloat *pMin = vMin->attrib[VARYING_SLOT_POS]; + const GLfloat *pMid = vMid->attrib[VARYING_SLOT_POS]; + const GLfloat *pMax = vMax->attrib[VARYING_SLOT_POS]; const GLfloat dxdy = majDx / majDy; const GLfloat xAdj = dxdy < 0.0F ? -dxdy : 0.0F; GLint iy; @@ -208,7 +208,7 @@ #if defined(DO_ATTRIBS) /* compute attributes at left-most fragment */ - span.attrStart[FRAG_ATTRIB_WPOS][3] = solve_plane(ix + 0.5F, iy + 0.5F, wPlane); + span.attrStart[VARYING_SLOT_POS][3] = solve_plane(ix + 0.5F, iy + 0.5F, wPlane); ATTRIB_LOOP_BEGIN GLuint c; for (c = 0; c < 4; c++) { @@ -245,9 +245,9 @@ } else { /* scan right to left */ - const GLfloat *pMin = vMin->attrib[FRAG_ATTRIB_WPOS]; - const GLfloat *pMid = vMid->attrib[FRAG_ATTRIB_WPOS]; - const GLfloat *pMax = vMax->attrib[FRAG_ATTRIB_WPOS]; + const GLfloat *pMin = vMin->attrib[VARYING_SLOT_POS]; + const GLfloat *pMid = vMid->attrib[VARYING_SLOT_POS]; + const GLfloat *pMax = vMax->attrib[VARYING_SLOT_POS]; const GLfloat dxdy = majDx / majDy; const GLfloat xAdj = dxdy > 0 ? dxdy : 0.0F; GLint iy; @@ -300,7 +300,7 @@ #if defined(DO_ATTRIBS) /* compute attributes at left-most fragment */ - span.attrStart[FRAG_ATTRIB_WPOS][3] = solve_plane(ix + 1.5F, iy + 0.5F, wPlane); + span.attrStart[VARYING_SLOT_POS][3] = solve_plane(ix + 1.5F, iy + 0.5F, wPlane); ATTRIB_LOOP_BEGIN GLuint c; for (c = 0; c < 4; c++) { diff --git a/mesalib/src/mesa/swrast/s_alpha.c b/mesalib/src/mesa/swrast/s_alpha.c index df2181ba9..1ceda531c 100644 --- a/mesalib/src/mesa/swrast/s_alpha.c +++ b/mesalib/src/mesa/swrast/s_alpha.c @@ -123,7 +123,7 @@ _swrast_alpha_test(const struct gl_context *ctx, SWspan *span) ALPHA_TEST(rgba[i][ACOMP], ;); } else { - GLfloat (*rgba)[4] = span->array->attribs[FRAG_ATTRIB_COL0]; + GLfloat (*rgba)[4] = span->array->attribs[VARYING_SLOT_COL0]; const GLfloat ref = ctx->Color.AlphaRef; ALPHA_TEST(rgba[i][ACOMP], ;); } diff --git a/mesalib/src/mesa/swrast/s_atifragshader.c b/mesalib/src/mesa/swrast/s_atifragshader.c index c5abaa0d4..1e91e2bee 100644 --- a/mesalib/src/mesa/swrast/s_atifragshader.c +++ b/mesalib/src/mesa/swrast/s_atifragshader.c @@ -248,7 +248,7 @@ handle_pass_op(struct atifs_machine *machine, struct atifs_setupinst *texinst, if (pass_tex >= GL_TEXTURE0_ARB && pass_tex <= GL_TEXTURE7_ARB) { pass_tex -= GL_TEXTURE0_ARB; COPY_4V(machine->Registers[idx], - span->array->attribs[FRAG_ATTRIB_TEX0 + pass_tex][column]); + span->array->attribs[VARYING_SLOT_TEX0 + pass_tex][column]); } else if (pass_tex >= GL_REG_0_ATI && pass_tex <= GL_REG_5_ATI) { pass_tex -= GL_REG_0_ATI; @@ -271,7 +271,7 @@ handle_sample_op(struct gl_context * ctx, struct atifs_machine *machine, if (coord_source >= GL_TEXTURE0_ARB && coord_source <= GL_TEXTURE7_ARB) { coord_source -= GL_TEXTURE0_ARB; COPY_4V(tex_coords, - span->array->attribs[FRAG_ATTRIB_TEX0 + coord_source][column]); + span->array->attribs[VARYING_SLOT_TEX0 + coord_source][column]); } else if (coord_source >= GL_REG_0_ATI && coord_source <= GL_REG_5_ATI) { coord_source -= GL_REG_0_ATI; @@ -554,8 +554,8 @@ init_machine(struct gl_context * ctx, struct atifs_machine *machine, machine->Registers[i][j] = 0.0; } - COPY_4V(inputs[ATI_FS_INPUT_PRIMARY], span->array->attribs[FRAG_ATTRIB_COL0][col]); - COPY_4V(inputs[ATI_FS_INPUT_SECONDARY], span->array->attribs[FRAG_ATTRIB_COL1][col]); + COPY_4V(inputs[ATI_FS_INPUT_PRIMARY], span->array->attribs[VARYING_SLOT_COL0][col]); + COPY_4V(inputs[ATI_FS_INPUT_SECONDARY], span->array->attribs[VARYING_SLOT_COL1][col]); } @@ -584,7 +584,7 @@ _swrast_exec_fragment_shader(struct gl_context * ctx, SWspan *span) const GLfloat *colOut = machine.Registers[0]; /*fprintf(stderr,"outputs %f %f %f %f\n", colOut[0], colOut[1], colOut[2], colOut[3]); */ - COPY_4V(span->array->attribs[FRAG_ATTRIB_COL0][i], colOut); + COPY_4V(span->array->attribs[VARYING_SLOT_COL0][i], colOut); } } } diff --git a/mesalib/src/mesa/swrast/s_context.c b/mesalib/src/mesa/swrast/s_context.c index ef7ca2e15..11e906436 100644 --- a/mesalib/src/mesa/swrast/s_context.c +++ b/mesalib/src/mesa/swrast/s_context.c @@ -502,7 +502,7 @@ _swrast_update_active_attribs(struct gl_context *ctx) if (_swrast_use_fragment_program(ctx)) { /* fragment program/shader */ attribsMask = ctx->FragmentProgram._Current->Base.InputsRead; - attribsMask &= ~FRAG_BIT_WPOS; /* WPOS is always handled specially */ + attribsMask &= ~VARYING_BIT_POS; /* WPOS is always handled specially */ } else if (ctx->ATIFragmentShader._Enabled) { attribsMask = ~0; /* XXX fix me */ @@ -512,19 +512,19 @@ _swrast_update_active_attribs(struct gl_context *ctx) attribsMask = 0x0; #if CHAN_TYPE == GL_FLOAT - attribsMask |= FRAG_BIT_COL0; + attribsMask |= VARYING_BIT_COL0; #endif if (ctx->Fog.ColorSumEnabled || (ctx->Light.Enabled && ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR)) { - attribsMask |= FRAG_BIT_COL1; + attribsMask |= VARYING_BIT_COL1; } if (swrast->_FogEnabled) - attribsMask |= FRAG_BIT_FOGC; + attribsMask |= VARYING_BIT_FOGC; - attribsMask |= (ctx->Texture._EnabledUnits << FRAG_ATTRIB_TEX0); + attribsMask |= (ctx->Texture._EnabledUnits << VARYING_SLOT_TEX0); } swrast->_ActiveAttribMask = attribsMask; @@ -532,11 +532,11 @@ _swrast_update_active_attribs(struct gl_context *ctx) /* Update _ActiveAttribs[] list */ { GLuint i, num = 0; - for (i = 0; i < FRAG_ATTRIB_MAX; i++) { + for (i = 0; i < VARYING_SLOT_MAX; i++) { if (attribsMask & BITFIELD64_BIT(i)) { swrast->_ActiveAttribs[num++] = i; /* how should this attribute be interpolated? */ - if (i == FRAG_ATTRIB_COL0 || i == FRAG_ATTRIB_COL1) + if (i == VARYING_SLOT_COL0 || i == VARYING_SLOT_COL1) swrast->_InterpMode[i] = ctx->Light.ShadeModel; else swrast->_InterpMode[i] = GL_SMOOTH; @@ -785,7 +785,7 @@ _swrast_CreateContext( struct gl_context *ctx ) #elif CHAN_TYPE == GL_UNSIGNED_SHORT swrast->SpanArrays[i].rgba = swrast->SpanArrays[i].rgba16; #else - swrast->SpanArrays[i].rgba = swrast->SpanArrays[i].attribs[FRAG_ATTRIB_COL0]; + swrast->SpanArrays[i].rgba = swrast->SpanArrays[i].attribs[VARYING_SLOT_COL0]; #endif } @@ -918,18 +918,18 @@ _swrast_print_vertex( struct gl_context *ctx, const SWvertex *v ) if (SWRAST_DEBUG_VERTICES) { _mesa_debug(ctx, "win %f %f %f %f\n", - v->attrib[FRAG_ATTRIB_WPOS][0], - v->attrib[FRAG_ATTRIB_WPOS][1], - v->attrib[FRAG_ATTRIB_WPOS][2], - v->attrib[FRAG_ATTRIB_WPOS][3]); + v->attrib[VARYING_SLOT_POS][0], + v->attrib[VARYING_SLOT_POS][1], + v->attrib[VARYING_SLOT_POS][2], + v->attrib[VARYING_SLOT_POS][3]); for (i = 0 ; i < ctx->Const.MaxTextureCoordUnits ; i++) if (ctx->Texture.Unit[i]._ReallyEnabled) _mesa_debug(ctx, "texcoord[%d] %f %f %f %f\n", i, - v->attrib[FRAG_ATTRIB_TEX0 + i][0], - v->attrib[FRAG_ATTRIB_TEX0 + i][1], - v->attrib[FRAG_ATTRIB_TEX0 + i][2], - v->attrib[FRAG_ATTRIB_TEX0 + i][3]); + v->attrib[VARYING_SLOT_TEX0 + i][0], + v->attrib[VARYING_SLOT_TEX0 + i][1], + v->attrib[VARYING_SLOT_TEX0 + i][2], + v->attrib[VARYING_SLOT_TEX0 + i][3]); #if CHAN_TYPE == GL_FLOAT _mesa_debug(ctx, "color %f %f %f %f\n", @@ -939,12 +939,12 @@ _swrast_print_vertex( struct gl_context *ctx, const SWvertex *v ) v->color[0], v->color[1], v->color[2], v->color[3]); #endif _mesa_debug(ctx, "spec %g %g %g %g\n", - v->attrib[FRAG_ATTRIB_COL1][0], - v->attrib[FRAG_ATTRIB_COL1][1], - v->attrib[FRAG_ATTRIB_COL1][2], - v->attrib[FRAG_ATTRIB_COL1][3]); - _mesa_debug(ctx, "fog %f\n", v->attrib[FRAG_ATTRIB_FOGC][0]); - _mesa_debug(ctx, "index %f\n", v->attrib[FRAG_ATTRIB_CI][0]); + v->attrib[VARYING_SLOT_COL1][0], + v->attrib[VARYING_SLOT_COL1][1], + v->attrib[VARYING_SLOT_COL1][2], + v->attrib[VARYING_SLOT_COL1][3]); + _mesa_debug(ctx, "fog %f\n", v->attrib[VARYING_SLOT_FOGC][0]); + _mesa_debug(ctx, "index %f\n", v->attrib[VARYING_SLOT_CI][0]); _mesa_debug(ctx, "pointsize %f\n", v->pointSize); _mesa_debug(ctx, "\n"); } diff --git a/mesalib/src/mesa/swrast/s_context.h b/mesalib/src/mesa/swrast/s_context.h index f3f188e47..2f7a2b531 100644 --- a/mesalib/src/mesa/swrast/s_context.h +++ b/mesalib/src/mesa/swrast/s_context.h @@ -224,13 +224,13 @@ typedef struct GLboolean _DeferredTexture; /** List/array of the fragment attributes to interpolate */ - GLuint _ActiveAttribs[FRAG_ATTRIB_MAX]; - /** Same info, but as a bitmask of FRAG_BIT_x bits */ + GLuint _ActiveAttribs[VARYING_SLOT_MAX]; + /** Same info, but as a bitmask of VARYING_BIT_x bits */ GLbitfield64 _ActiveAttribMask; /** Number of fragment attributes to interpolate */ GLuint _NumActiveAttribs; /** Indicates how each attrib is to be interpolated (lines/tris) */ - GLenum _InterpMode[FRAG_ATTRIB_MAX]; /* GL_FLAT or GL_SMOOTH (for now) */ + GLenum _InterpMode[VARYING_SLOT_MAX]; /* GL_FLAT or GL_SMOOTH (for now) */ /* Working values: */ diff --git a/mesalib/src/mesa/swrast/s_copypix.c b/mesalib/src/mesa/swrast/s_copypix.c index bbd1f228c..1d8926179 100644 --- a/mesalib/src/mesa/swrast/s_copypix.c +++ b/mesalib/src/mesa/swrast/s_copypix.c @@ -136,7 +136,7 @@ copy_rgba_pixels(struct gl_context *ctx, GLint srcx, GLint srcy, INIT_SPAN(span, GL_BITMAP); _swrast_span_default_attribs(ctx, &span); span.arrayMask = SPAN_RGBA; - span.arrayAttribs = FRAG_BIT_COL0; /* we'll fill in COL0 attrib values */ + span.arrayAttribs = VARYING_BIT_COL0; /* we'll fill in COL0 attrib values */ if (overlapping) { tmpImage = malloc(width * height * sizeof(GLfloat) * 4); @@ -161,7 +161,7 @@ copy_rgba_pixels(struct gl_context *ctx, GLint srcx, GLint srcy, ASSERT(width < SWRAST_MAX_WIDTH); for (row = 0; row < height; row++, sy += stepy, dy += stepy) { - GLvoid *rgba = span.array->attribs[FRAG_ATTRIB_COL0]; + GLvoid *rgba = span.array->attribs[VARYING_SLOT_COL0]; /* Get row/span of source pixels */ if (overlapping) { diff --git a/mesalib/src/mesa/swrast/s_drawpix.c b/mesalib/src/mesa/swrast/s_drawpix.c index 7665408fd..3d23f912f 100644 --- a/mesalib/src/mesa/swrast/s_drawpix.c +++ b/mesalib/src/mesa/swrast/s_drawpix.c @@ -429,7 +429,7 @@ draw_rgba_pixels( struct gl_context *ctx, GLint x, GLint y, INIT_SPAN(span, GL_BITMAP); _swrast_span_default_attribs(ctx, &span); span.arrayMask = SPAN_RGBA; - span.arrayAttribs = FRAG_BIT_COL0; /* we're fill in COL0 attrib values */ + span.arrayAttribs = VARYING_BIT_COL0; /* we're fill in COL0 attrib values */ if (ctx->DrawBuffer->_NumColorDrawBuffers > 0) { GLenum datatype = _mesa_get_format_datatype( @@ -451,7 +451,7 @@ draw_rgba_pixels( struct gl_context *ctx, GLint x, GLint y, = _mesa_image_row_stride(unpack, width, format, type); GLint skipPixels = 0; /* use span array for temp color storage */ - GLfloat *rgba = (GLfloat *) span.array->attribs[FRAG_ATTRIB_COL0]; + GLfloat *rgba = (GLfloat *) span.array->attribs[VARYING_SLOT_COL0]; /* if the span is wider than SWRAST_MAX_WIDTH we have to do it in chunks */ while (skipPixels < width) { diff --git a/mesalib/src/mesa/swrast/s_feedback.c b/mesalib/src/mesa/swrast/s_feedback.c index 00f92d463..00467e54f 100644 --- a/mesalib/src/mesa/swrast/s_feedback.c +++ b/mesalib/src/mesa/swrast/s_feedback.c @@ -37,13 +37,13 @@ static void feedback_vertex(struct gl_context * ctx, const SWvertex * v, const SWvertex * pv) { GLfloat win[4]; - const GLfloat *vtc = v->attrib[FRAG_ATTRIB_TEX0]; - const GLfloat *color = v->attrib[FRAG_ATTRIB_COL0]; + const GLfloat *vtc = v->attrib[VARYING_SLOT_TEX0]; + const GLfloat *color = v->attrib[VARYING_SLOT_COL0]; - win[0] = v->attrib[FRAG_ATTRIB_WPOS][0]; - win[1] = v->attrib[FRAG_ATTRIB_WPOS][1]; - win[2] = v->attrib[FRAG_ATTRIB_WPOS][2] / ctx->DrawBuffer->_DepthMaxF; - win[3] = 1.0F / v->attrib[FRAG_ATTRIB_WPOS][3]; + win[0] = v->attrib[VARYING_SLOT_POS][0]; + win[1] = v->attrib[VARYING_SLOT_POS][1]; + win[2] = v->attrib[VARYING_SLOT_POS][2] / ctx->DrawBuffer->_DepthMaxF; + win[3] = 1.0F / v->attrib[VARYING_SLOT_POS][3]; _mesa_feedback_vertex(ctx, win, color, vtc); } @@ -114,9 +114,9 @@ _swrast_select_triangle(struct gl_context *ctx, const SWvertex *v0, if (!_swrast_culltriangle(ctx, v0, v1, v2)) { const GLfloat zs = 1.0F / ctx->DrawBuffer->_DepthMaxF; - _mesa_update_hitflag( ctx, v0->attrib[FRAG_ATTRIB_WPOS][2] * zs ); - _mesa_update_hitflag( ctx, v1->attrib[FRAG_ATTRIB_WPOS][2] * zs ); - _mesa_update_hitflag( ctx, v2->attrib[FRAG_ATTRIB_WPOS][2] * zs ); + _mesa_update_hitflag( ctx, v0->attrib[VARYING_SLOT_POS][2] * zs ); + _mesa_update_hitflag( ctx, v1->attrib[VARYING_SLOT_POS][2] * zs ); + _mesa_update_hitflag( ctx, v2->attrib[VARYING_SLOT_POS][2] * zs ); } } @@ -125,8 +125,8 @@ void _swrast_select_line(struct gl_context *ctx, const SWvertex *v0, const SWvertex *v1) { const GLfloat zs = 1.0F / ctx->DrawBuffer->_DepthMaxF; - _mesa_update_hitflag( ctx, v0->attrib[FRAG_ATTRIB_WPOS][2] * zs ); - _mesa_update_hitflag( ctx, v1->attrib[FRAG_ATTRIB_WPOS][2] * zs ); + _mesa_update_hitflag( ctx, v0->attrib[VARYING_SLOT_POS][2] * zs ); + _mesa_update_hitflag( ctx, v1->attrib[VARYING_SLOT_POS][2] * zs ); } @@ -134,5 +134,5 @@ void _swrast_select_point(struct gl_context *ctx, const SWvertex *v) { const GLfloat zs = 1.0F / ctx->DrawBuffer->_DepthMaxF; - _mesa_update_hitflag( ctx, v->attrib[FRAG_ATTRIB_WPOS][2] * zs ); + _mesa_update_hitflag( ctx, v->attrib[VARYING_SLOT_POS][2] * zs ); } diff --git a/mesalib/src/mesa/swrast/s_fog.c b/mesalib/src/mesa/swrast/s_fog.c index ea59de160..57a6a8e61 100644 --- a/mesalib/src/mesa/swrast/s_fog.c +++ b/mesalib/src/mesa/swrast/s_fog.c @@ -87,10 +87,10 @@ do { \ * \param COMPUTE_F code to compute the fog blend factor, f. */ #define FOG_LOOP(TYPE, FOG_FUNC) \ -if (span->arrayAttribs & FRAG_BIT_FOGC) { \ +if (span->arrayAttribs & VARYING_BIT_FOGC) { \ GLuint i; \ for (i = 0; i < span->end; i++) { \ - const GLfloat fogCoord = span->array->attribs[FRAG_ATTRIB_FOGC][i][0]; \ + const GLfloat fogCoord = span->array->attribs[VARYING_SLOT_FOGC][i][0]; \ const GLfloat c = FABSF(fogCoord); \ GLfloat f, oneMinusF; \ FOG_FUNC(f, c); \ @@ -102,10 +102,10 @@ if (span->arrayAttribs & FRAG_BIT_FOGC) { \ } \ } \ else { \ - const GLfloat fogStep = span->attrStepX[FRAG_ATTRIB_FOGC][0]; \ - GLfloat fogCoord = span->attrStart[FRAG_ATTRIB_FOGC][0]; \ - const GLfloat wStep = span->attrStepX[FRAG_ATTRIB_WPOS][3]; \ - GLfloat w = span->attrStart[FRAG_ATTRIB_WPOS][3]; \ + const GLfloat fogStep = span->attrStepX[VARYING_SLOT_FOGC][0]; \ + GLfloat fogCoord = span->attrStart[VARYING_SLOT_FOGC][0]; \ + const GLfloat wStep = span->attrStepX[VARYING_SLOT_POS][3]; \ + GLfloat w = span->attrStart[VARYING_SLOT_POS][3]; \ GLuint i; \ for (i = 0; i < span->end; i++) { \ const GLfloat c = FABSF(fogCoord) / w; \ @@ -173,7 +173,7 @@ _swrast_fog_rgba_span( const struct gl_context *ctx, SWspan *span ) FOG_LOOP(GLushort, LINEAR_FOG); } else { - GLfloat (*rgba)[4] = span->array->attribs[FRAG_ATTRIB_COL0]; + GLfloat (*rgba)[4] = span->array->attribs[VARYING_SLOT_COL0]; ASSERT(span->array->ChanType == GL_FLOAT); FOG_LOOP(GLfloat, LINEAR_FOG); } @@ -192,7 +192,7 @@ _swrast_fog_rgba_span( const struct gl_context *ctx, SWspan *span ) FOG_LOOP(GLushort, EXP_FOG); } else { - GLfloat (*rgba)[4] = span->array->attribs[FRAG_ATTRIB_COL0]; + GLfloat (*rgba)[4] = span->array->attribs[VARYING_SLOT_COL0]; ASSERT(span->array->ChanType == GL_FLOAT); FOG_LOOP(GLfloat, EXP_FOG); } @@ -211,7 +211,7 @@ _swrast_fog_rgba_span( const struct gl_context *ctx, SWspan *span ) FOG_LOOP(GLushort, EXP2_FOG); } else { - GLfloat (*rgba)[4] = span->array->attribs[FRAG_ATTRIB_COL0]; + GLfloat (*rgba)[4] = span->array->attribs[VARYING_SLOT_COL0]; ASSERT(span->array->ChanType == GL_FLOAT); FOG_LOOP(GLfloat, EXP2_FOG); } @@ -236,7 +236,7 @@ _swrast_fog_rgba_span( const struct gl_context *ctx, SWspan *span ) FOG_LOOP(GLushort, BLEND_FOG); } else { - GLfloat (*rgba)[4] = span->array->attribs[FRAG_ATTRIB_COL0]; + GLfloat (*rgba)[4] = span->array->attribs[VARYING_SLOT_COL0]; ASSERT(span->array->ChanType == GL_FLOAT); FOG_LOOP(GLfloat, BLEND_FOG); } diff --git a/mesalib/src/mesa/swrast/s_fragprog.c b/mesalib/src/mesa/swrast/s_fragprog.c index 9b60893db..1ce2ee452 100644 --- a/mesalib/src/mesa/swrast/s_fragprog.c +++ b/mesalib/src/mesa/swrast/s_fragprog.c @@ -162,7 +162,7 @@ init_machine(struct gl_context *ctx, struct gl_program_machine *machine, const struct gl_fragment_program *program, const SWspan *span, GLuint col) { - GLfloat *wpos = span->array->attribs[FRAG_ATTRIB_WPOS][col]; + GLfloat *wpos = span->array->attribs[VARYING_SLOT_POS][col]; /* ARB_fragment_coord_conventions */ if (program->OriginUpperLeft) @@ -177,14 +177,14 @@ init_machine(struct gl_context *ctx, struct gl_program_machine *machine, machine->DerivX = (GLfloat (*)[4]) span->attrStepX; machine->DerivY = (GLfloat (*)[4]) span->attrStepY; - machine->NumDeriv = FRAG_ATTRIB_MAX; + machine->NumDeriv = VARYING_SLOT_MAX; machine->Samplers = program->Base.SamplerUnits; /* if running a GLSL program (not ARB_fragment_program) */ if (ctx->Shader.CurrentFragmentProgram) { /* Store front/back facing value */ - machine->Attribs[FRAG_ATTRIB_FACE][col][0] = 1.0F - span->facing; + machine->Attribs[VARYING_SLOT_FACE][col][0] = 1.0F - span->facing; } machine->CurElement = col; @@ -223,7 +223,7 @@ run_program(struct gl_context *ctx, SWspan *span, GLuint start, GLuint end) /* Store result color */ if (outputsWritten & BITFIELD64_BIT(FRAG_RESULT_COLOR)) { - COPY_4V(span->array->attribs[FRAG_ATTRIB_COL0][i], + COPY_4V(span->array->attribs[VARYING_SLOT_COL0][i], machine->Outputs[FRAG_RESULT_COLOR]); } else { @@ -234,7 +234,7 @@ run_program(struct gl_context *ctx, SWspan *span, GLuint start, GLuint end) GLuint buf; for (buf = 0; buf < ctx->DrawBuffer->_NumColorDrawBuffers; buf++) { if (outputsWritten & BITFIELD64_BIT(FRAG_RESULT_DATA0 + buf)) { - COPY_4V(span->array->attribs[FRAG_ATTRIB_COL0 + buf][i], + COPY_4V(span->array->attribs[VARYING_SLOT_COL0 + buf][i], machine->Outputs[FRAG_RESULT_DATA0 + buf]); } } @@ -272,7 +272,7 @@ _swrast_exec_fragment_program( struct gl_context *ctx, SWspan *span ) const struct gl_fragment_program *program = ctx->FragmentProgram._Current; /* incoming colors should be floats */ - if (program->Base.InputsRead & FRAG_BIT_COL0) { + if (program->Base.InputsRead & VARYING_BIT_COL0) { ASSERT(span->array->ChanType == GL_FLOAT); } diff --git a/mesalib/src/mesa/swrast/s_lines.c b/mesalib/src/mesa/swrast/s_lines.c index cfd3e6fa9..7364dd965 100644 --- a/mesalib/src/mesa/swrast/s_lines.c +++ b/mesalib/src/mesa/swrast/s_lines.c @@ -172,16 +172,16 @@ _swrast_add_spec_terms_line(struct gl_context *ctx, COPY_CHAN4(cSave[0], ncv0->color); COPY_CHAN4(cSave[1], ncv1->color); /* sum v0 */ - rSum = CHAN_TO_FLOAT(ncv0->color[0]) + ncv0->attrib[FRAG_ATTRIB_COL1][0]; - gSum = CHAN_TO_FLOAT(ncv0->color[1]) + ncv0->attrib[FRAG_ATTRIB_COL1][1]; - bSum = CHAN_TO_FLOAT(ncv0->color[2]) + ncv0->attrib[FRAG_ATTRIB_COL1][2]; + rSum = CHAN_TO_FLOAT(ncv0->color[0]) + ncv0->attrib[VARYING_SLOT_COL1][0]; + gSum = CHAN_TO_FLOAT(ncv0->color[1]) + ncv0->attrib[VARYING_SLOT_COL1][1]; + bSum = CHAN_TO_FLOAT(ncv0->color[2]) + ncv0->attrib[VARYING_SLOT_COL1][2]; UNCLAMPED_FLOAT_TO_CHAN(ncv0->color[0], rSum); UNCLAMPED_FLOAT_TO_CHAN(ncv0->color[1], gSum); UNCLAMPED_FLOAT_TO_CHAN(ncv0->color[2], bSum); /* sum v1 */ - rSum = CHAN_TO_FLOAT(ncv1->color[0]) + ncv1->attrib[FRAG_ATTRIB_COL1][0]; - gSum = CHAN_TO_FLOAT(ncv1->color[1]) + ncv1->attrib[FRAG_ATTRIB_COL1][1]; - bSum = CHAN_TO_FLOAT(ncv1->color[2]) + ncv1->attrib[FRAG_ATTRIB_COL1][2]; + rSum = CHAN_TO_FLOAT(ncv1->color[0]) + ncv1->attrib[VARYING_SLOT_COL1][0]; + gSum = CHAN_TO_FLOAT(ncv1->color[1]) + ncv1->attrib[VARYING_SLOT_COL1][1]; + bSum = CHAN_TO_FLOAT(ncv1->color[2]) + ncv1->attrib[VARYING_SLOT_COL1][2]; UNCLAMPED_FLOAT_TO_CHAN(ncv1->color[0], rSum); UNCLAMPED_FLOAT_TO_CHAN(ncv1->color[1], gSum); UNCLAMPED_FLOAT_TO_CHAN(ncv1->color[2], bSum); diff --git a/mesalib/src/mesa/swrast/s_linetemp.h b/mesalib/src/mesa/swrast/s_linetemp.h index 1668f7db9..8feb8b120 100644 --- a/mesalib/src/mesa/swrast/s_linetemp.h +++ b/mesalib/src/mesa/swrast/s_linetemp.h @@ -68,10 +68,10 @@ NAME( struct gl_context *ctx, const SWvertex *vert0, const SWvertex *vert1 ) const SWcontext *swrast = SWRAST_CONTEXT(ctx); SWspan span; GLuint interpFlags = 0; - GLint x0 = (GLint) vert0->attrib[FRAG_ATTRIB_WPOS][0]; - GLint x1 = (GLint) vert1->attrib[FRAG_ATTRIB_WPOS][0]; - GLint y0 = (GLint) vert0->attrib[FRAG_ATTRIB_WPOS][1]; - GLint y1 = (GLint) vert1->attrib[FRAG_ATTRIB_WPOS][1]; + GLint x0 = (GLint) vert0->attrib[VARYING_SLOT_POS][0]; + GLint x1 = (GLint) vert1->attrib[VARYING_SLOT_POS][0]; + GLint y0 = (GLint) vert0->attrib[VARYING_SLOT_POS][1]; + GLint y1 = (GLint) vert1->attrib[VARYING_SLOT_POS][1]; GLint dx, dy; GLint numPixels; GLint xstep, ystep; @@ -99,8 +99,8 @@ NAME( struct gl_context *ctx, const SWvertex *vert0, const SWvertex *vert1 ) /* Cull primitives with malformed coordinates. */ { - GLfloat tmp = vert0->attrib[FRAG_ATTRIB_WPOS][0] + vert0->attrib[FRAG_ATTRIB_WPOS][1] - + vert1->attrib[FRAG_ATTRIB_WPOS][0] + vert1->attrib[FRAG_ATTRIB_WPOS][1]; + GLfloat tmp = vert0->attrib[VARYING_SLOT_POS][0] + vert0->attrib[VARYING_SLOT_POS][1] + + vert1->attrib[VARYING_SLOT_POS][0] + vert1->attrib[VARYING_SLOT_POS][1]; if (IS_INF_OR_NAN(tmp)) return; } @@ -108,12 +108,12 @@ NAME( struct gl_context *ctx, const SWvertex *vert0, const SWvertex *vert1 ) /* printf("%s():\n", __FUNCTION__); printf(" (%f, %f, %f) -> (%f, %f, %f)\n", - vert0->attrib[FRAG_ATTRIB_WPOS][0], - vert0->attrib[FRAG_ATTRIB_WPOS][1], - vert0->attrib[FRAG_ATTRIB_WPOS][2], - vert1->attrib[FRAG_ATTRIB_WPOS][0], - vert1->attrib[FRAG_ATTRIB_WPOS][1], - vert1->attrib[FRAG_ATTRIB_WPOS][2]); + vert0->attrib[VARYING_SLOT_POS][0], + vert0->attrib[VARYING_SLOT_POS][1], + vert0->attrib[VARYING_SLOT_POS][2], + vert1->attrib[VARYING_SLOT_POS][0], + vert1->attrib[VARYING_SLOT_POS][1], + vert1->attrib[VARYING_SLOT_POS][2]); printf(" (%d, %d, %d) -> (%d, %d, %d)\n", vert0->color[0], vert0->color[1], vert0->color[2], vert1->color[0], vert1->color[1], vert1->color[2]); @@ -155,14 +155,14 @@ NAME( struct gl_context *ctx, const SWvertex *vert0, const SWvertex *vert1 ) /* printf("%s %d,%d %g %g %g %g %g %g %g %g\n", __FUNCTION__, dx, dy, - vert0->attrib[FRAG_ATTRIB_COL1][0], - vert0->attrib[FRAG_ATTRIB_COL1][1], - vert0->attrib[FRAG_ATTRIB_COL1][2], - vert0->attrib[FRAG_ATTRIB_COL1][3], - vert1->attrib[FRAG_ATTRIB_COL1][0], - vert1->attrib[FRAG_ATTRIB_COL1][1], - vert1->attrib[FRAG_ATTRIB_COL1][2], - vert1->attrib[FRAG_ATTRIB_COL1][3]); + vert0->attrib[VARYING_SLOT_COL1][0], + vert0->attrib[VARYING_SLOT_COL1][1], + vert0->attrib[VARYING_SLOT_COL1][2], + vert0->attrib[VARYING_SLOT_COL1][3], + vert1->attrib[VARYING_SLOT_COL1][0], + vert1->attrib[VARYING_SLOT_COL1][1], + vert1->attrib[VARYING_SLOT_COL1][2], + vert1->attrib[VARYING_SLOT_COL1][3]); */ #ifdef DEPTH_TYPE @@ -245,27 +245,27 @@ NAME( struct gl_context *ctx, const SWvertex *vert0, const SWvertex *vert1 ) interpFlags |= SPAN_Z; { if (depthBits <= 16) { - span.z = FloatToFixed(vert0->attrib[FRAG_ATTRIB_WPOS][2]) + FIXED_HALF; - span.zStep = FloatToFixed( vert1->attrib[FRAG_ATTRIB_WPOS][2] - - vert0->attrib[FRAG_ATTRIB_WPOS][2]) / numPixels; + span.z = FloatToFixed(vert0->attrib[VARYING_SLOT_POS][2]) + FIXED_HALF; + span.zStep = FloatToFixed( vert1->attrib[VARYING_SLOT_POS][2] + - vert0->attrib[VARYING_SLOT_POS][2]) / numPixels; } else { /* don't use fixed point */ - span.z = (GLuint) vert0->attrib[FRAG_ATTRIB_WPOS][2]; - span.zStep = (GLint) (( vert1->attrib[FRAG_ATTRIB_WPOS][2] - - vert0->attrib[FRAG_ATTRIB_WPOS][2]) / numPixels); + span.z = (GLuint) vert0->attrib[VARYING_SLOT_POS][2]; + span.zStep = (GLint) (( vert1->attrib[VARYING_SLOT_POS][2] + - vert0->attrib[VARYING_SLOT_POS][2]) / numPixels); } } #endif #if defined(INTERP_ATTRIBS) { const GLfloat invLen = 1.0F / numPixels; - const GLfloat invw0 = vert0->attrib[FRAG_ATTRIB_WPOS][3]; - const GLfloat invw1 = vert1->attrib[FRAG_ATTRIB_WPOS][3]; + const GLfloat invw0 = vert0->attrib[VARYING_SLOT_POS][3]; + const GLfloat invw1 = vert1->attrib[VARYING_SLOT_POS][3]; - span.attrStart[FRAG_ATTRIB_WPOS][3] = invw0; - span.attrStepX[FRAG_ATTRIB_WPOS][3] = (invw1 - invw0) * invLen; - span.attrStepY[FRAG_ATTRIB_WPOS][3] = 0.0; + span.attrStart[VARYING_SLOT_POS][3] = invw0; + span.attrStepX[VARYING_SLOT_POS][3] = (invw1 - invw0) * invLen; + span.attrStepY[VARYING_SLOT_POS][3] = 0.0; ATTRIB_LOOP_BEGIN if (swrast->_InterpMode[attr] == GL_FLAT) { diff --git a/mesalib/src/mesa/swrast/s_logic.c b/mesalib/src/mesa/swrast/s_logic.c index 8791630a4..93388d720 100644 --- a/mesalib/src/mesa/swrast/s_logic.c +++ b/mesalib/src/mesa/swrast/s_logic.c @@ -212,7 +212,7 @@ _swrast_logicop_rgba_span(struct gl_context *ctx, struct gl_renderbuffer *rb, } else { logicop_uint4(ctx, 4 * span->end, - (GLuint *) span->array->attribs[FRAG_ATTRIB_COL0], + (GLuint *) span->array->attribs[VARYING_SLOT_COL0], (const GLuint *) rbPixels, span->array->mask); } } diff --git a/mesalib/src/mesa/swrast/s_masking.c b/mesalib/src/mesa/swrast/s_masking.c index 4f262fa97..8f5344650 100644 --- a/mesalib/src/mesa/swrast/s_masking.c +++ b/mesalib/src/mesa/swrast/s_masking.c @@ -90,7 +90,7 @@ _swrast_mask_rgba_span(struct gl_context *ctx, struct gl_renderbuffer *rb, const GLuint bMask = ctx->Color.ColorMask[buf][BCOMP] ? ~0x0 : 0x0; const GLuint aMask = ctx->Color.ColorMask[buf][ACOMP] ? ~0x0 : 0x0; const GLuint (*dst)[4] = (const GLuint (*)[4]) rbPixels; - GLuint (*src)[4] = (GLuint (*)[4]) span->array->attribs[FRAG_ATTRIB_COL0]; + GLuint (*src)[4] = (GLuint (*)[4]) span->array->attribs[VARYING_SLOT_COL0]; GLuint i; for (i = 0; i < n; i++) { src[i][RCOMP] = (src[i][RCOMP] & rMask) | (dst[i][RCOMP] & ~rMask); diff --git a/mesalib/src/mesa/swrast/s_points.c b/mesalib/src/mesa/swrast/s_points.c index acbdb2d42..80693be8e 100644 --- a/mesalib/src/mesa/swrast/s_points.c +++ b/mesalib/src/mesa/swrast/s_points.c @@ -37,8 +37,8 @@ */ #define CULL_INVALID(V) \ do { \ - float tmp = (V)->attrib[FRAG_ATTRIB_WPOS][0] \ - + (V)->attrib[FRAG_ATTRIB_WPOS][1]; \ + float tmp = (V)->attrib[VARYING_SLOT_POS][0] \ + + (V)->attrib[VARYING_SLOT_POS][1]; \ if (IS_INF_OR_NAN(tmp)) \ return; \ } while(0) @@ -93,9 +93,9 @@ sprite_point(struct gl_context *ctx, const SWvertex *vert) /* z coord */ if (ctx->DrawBuffer->Visual.depthBits <= 16) - span.z = FloatToFixed(vert->attrib[FRAG_ATTRIB_WPOS][2] + 0.5F); + span.z = FloatToFixed(vert->attrib[VARYING_SLOT_POS][2] + 0.5F); else - span.z = (GLuint) (vert->attrib[FRAG_ATTRIB_WPOS][2] + 0.5F); + span.z = (GLuint) (vert->attrib[VARYING_SLOT_POS][2] + 0.5F); span.zStep = 0; size = get_size(ctx, vert, GL_FALSE); @@ -116,9 +116,9 @@ sprite_point(struct gl_context *ctx, const SWvertex *vert) span.alphaStep = 0; /* need these for fragment programs */ - span.attrStart[FRAG_ATTRIB_WPOS][3] = 1.0F; - span.attrStepX[FRAG_ATTRIB_WPOS][3] = 0.0F; - span.attrStepY[FRAG_ATTRIB_WPOS][3] = 0.0F; + span.attrStart[VARYING_SLOT_POS][3] = 1.0F; + span.attrStepX[VARYING_SLOT_POS][3] = 0.0F; + span.attrStepY[VARYING_SLOT_POS][3] = 0.0F; { GLfloat s, r, dsdx; @@ -137,9 +137,9 @@ sprite_point(struct gl_context *ctx, const SWvertex *vert) } ATTRIB_LOOP_BEGIN - if (attr >= FRAG_ATTRIB_TEX0 && attr <= FRAG_ATTRIB_TEX7) { + if (attr >= VARYING_SLOT_TEX0 && attr <= VARYING_SLOT_TEX7) { /* a texcoord attribute */ - const GLuint u = attr - FRAG_ATTRIB_TEX0; + const GLuint u = attr - VARYING_SLOT_TEX0; ASSERT(u < Elements(ctx->Point.CoordReplace)); if (ctx->Point.CoordReplace[u]) { tCoords[numTcoords++] = attr; @@ -169,15 +169,15 @@ sprite_point(struct gl_context *ctx, const SWvertex *vert) continue; } } - else if (attr == FRAG_ATTRIB_PNTC) { + else if (attr == VARYING_SLOT_PNTC) { /* GLSL gl_PointCoord.xy (.zw undefined) */ - span.attrStart[FRAG_ATTRIB_PNTC][0] = 0.0; - span.attrStart[FRAG_ATTRIB_PNTC][1] = 0.0; /* t0 set below */ - span.attrStepX[FRAG_ATTRIB_PNTC][0] = dsdx; - span.attrStepX[FRAG_ATTRIB_PNTC][1] = 0.0; - span.attrStepY[FRAG_ATTRIB_PNTC][0] = 0.0; - span.attrStepY[FRAG_ATTRIB_PNTC][1] = dtdy; - tCoords[numTcoords++] = FRAG_ATTRIB_PNTC; + span.attrStart[VARYING_SLOT_PNTC][0] = 0.0; + span.attrStart[VARYING_SLOT_PNTC][1] = 0.0; /* t0 set below */ + span.attrStepX[VARYING_SLOT_PNTC][0] = dsdx; + span.attrStepX[VARYING_SLOT_PNTC][1] = 0.0; + span.attrStepY[VARYING_SLOT_PNTC][0] = 0.0; + span.attrStepY[VARYING_SLOT_PNTC][1] = dtdy; + tCoords[numTcoords++] = VARYING_SLOT_PNTC; continue; } /* use vertex's texcoord/attrib */ @@ -189,8 +189,8 @@ sprite_point(struct gl_context *ctx, const SWvertex *vert) /* compute pos, bounds and render */ { - const GLfloat x = vert->attrib[FRAG_ATTRIB_WPOS][0]; - const GLfloat y = vert->attrib[FRAG_ATTRIB_WPOS][1]; + const GLfloat x = vert->attrib[VARYING_SLOT_POS][0]; + const GLfloat y = vert->attrib[VARYING_SLOT_POS][1]; GLint iSize = (GLint) (size + 0.5F); GLint xmin, xmax, ymin, ymax, iy; GLint iRadius; @@ -250,9 +250,9 @@ smooth_point(struct gl_context *ctx, const SWvertex *vert) /* z coord */ if (ctx->DrawBuffer->Visual.depthBits <= 16) - span.z = FloatToFixed(vert->attrib[FRAG_ATTRIB_WPOS][2] + 0.5F); + span.z = FloatToFixed(vert->attrib[VARYING_SLOT_POS][2] + 0.5F); else - span.z = (GLuint) (vert->attrib[FRAG_ATTRIB_WPOS][2] + 0.5F); + span.z = (GLuint) (vert->attrib[VARYING_SLOT_POS][2] + 0.5F); span.zStep = 0; size = get_size(ctx, vert, GL_TRUE); @@ -289,9 +289,9 @@ smooth_point(struct gl_context *ctx, const SWvertex *vert) span.alphaStep = 0; /* need these for fragment programs */ - span.attrStart[FRAG_ATTRIB_WPOS][3] = 1.0F; - span.attrStepX[FRAG_ATTRIB_WPOS][3] = 0.0F; - span.attrStepY[FRAG_ATTRIB_WPOS][3] = 0.0F; + span.attrStart[VARYING_SLOT_POS][3] = 1.0F; + span.attrStepX[VARYING_SLOT_POS][3] = 0.0F; + span.attrStepY[VARYING_SLOT_POS][3] = 0.0F; ATTRIB_LOOP_BEGIN COPY_4V(span.attrStart[attr], vert->attrib[attr]); @@ -301,8 +301,8 @@ smooth_point(struct gl_context *ctx, const SWvertex *vert) /* compute pos, bounds and render */ { - const GLfloat x = vert->attrib[FRAG_ATTRIB_WPOS][0]; - const GLfloat y = vert->attrib[FRAG_ATTRIB_WPOS][1]; + const GLfloat x = vert->attrib[VARYING_SLOT_POS][0]; + const GLfloat y = vert->attrib[VARYING_SLOT_POS][1]; const GLfloat radius = 0.5F * size; const GLfloat rmin = radius - 0.7071F; /* 0.7071 = sqrt(2)/2 */ const GLfloat rmax = radius + 0.7071F; @@ -370,9 +370,9 @@ large_point(struct gl_context *ctx, const SWvertex *vert) /* z coord */ if (ctx->DrawBuffer->Visual.depthBits <= 16) - span.z = FloatToFixed(vert->attrib[FRAG_ATTRIB_WPOS][2] + 0.5F); + span.z = FloatToFixed(vert->attrib[VARYING_SLOT_POS][2] + 0.5F); else - span.z = (GLuint) (vert->attrib[FRAG_ATTRIB_WPOS][2] + 0.5F); + span.z = (GLuint) (vert->attrib[VARYING_SLOT_POS][2] + 0.5F); span.zStep = 0; size = get_size(ctx, vert, GL_FALSE); @@ -393,9 +393,9 @@ large_point(struct gl_context *ctx, const SWvertex *vert) span.alphaStep = 0; /* need these for fragment programs */ - span.attrStart[FRAG_ATTRIB_WPOS][3] = 1.0F; - span.attrStepX[FRAG_ATTRIB_WPOS][3] = 0.0F; - span.attrStepY[FRAG_ATTRIB_WPOS][3] = 0.0F; + span.attrStart[VARYING_SLOT_POS][3] = 1.0F; + span.attrStepX[VARYING_SLOT_POS][3] = 0.0F; + span.attrStepY[VARYING_SLOT_POS][3] = 0.0F; ATTRIB_LOOP_BEGIN COPY_4V(span.attrStart[attr], vert->attrib[attr]); @@ -405,8 +405,8 @@ large_point(struct gl_context *ctx, const SWvertex *vert) /* compute pos, bounds and render */ { - const GLfloat x = vert->attrib[FRAG_ATTRIB_WPOS][0]; - const GLfloat y = vert->attrib[FRAG_ATTRIB_WPOS][1]; + const GLfloat x = vert->attrib[VARYING_SLOT_POS][0]; + const GLfloat y = vert->attrib[VARYING_SLOT_POS][1]; GLint iSize = (GLint) (size + 0.5F); GLint xmin, xmax, ymin, ymax, ix, iy; GLint iRadius; @@ -470,9 +470,9 @@ pixel_point(struct gl_context *ctx, const SWvertex *vert) span->arrayAttribs = swrast->_ActiveAttribMask; /* we'll produce these vals */ /* need these for fragment programs */ - span->attrStart[FRAG_ATTRIB_WPOS][3] = 1.0F; - span->attrStepX[FRAG_ATTRIB_WPOS][3] = 0.0F; - span->attrStepY[FRAG_ATTRIB_WPOS][3] = 0.0F; + span->attrStart[VARYING_SLOT_POS][3] = 1.0F; + span->attrStepX[VARYING_SLOT_POS][3] = 0.0F; + span->attrStepY[VARYING_SLOT_POS][3] = 0.0F; /* check if we need to flush */ if (span->end >= SWRAST_MAX_WIDTH || @@ -499,9 +499,9 @@ pixel_point(struct gl_context *ctx, const SWvertex *vert) ATTRIB_LOOP_END /* fragment position */ - span->array->x[count] = (GLint) vert->attrib[FRAG_ATTRIB_WPOS][0]; - span->array->y[count] = (GLint) vert->attrib[FRAG_ATTRIB_WPOS][1]; - span->array->z[count] = (GLint) (vert->attrib[FRAG_ATTRIB_WPOS][2] + 0.5F); + span->array->x[count] = (GLint) vert->attrib[VARYING_SLOT_POS][0]; + span->array->y[count] = (GLint) vert->attrib[VARYING_SLOT_POS][1]; + span->array->z[count] = (GLint) (vert->attrib[VARYING_SLOT_POS][2] + 0.5F); span->end = count + 1; ASSERT(span->end <= SWRAST_MAX_WIDTH); @@ -522,9 +522,9 @@ _swrast_add_spec_terms_point(struct gl_context *ctx, const SWvertex *v0) /* save */ COPY_CHAN4(cSave, ncv0->color); /* sum */ - rSum = CHAN_TO_FLOAT(ncv0->color[0]) + ncv0->attrib[FRAG_ATTRIB_COL1][0]; - gSum = CHAN_TO_FLOAT(ncv0->color[1]) + ncv0->attrib[FRAG_ATTRIB_COL1][1]; - bSum = CHAN_TO_FLOAT(ncv0->color[2]) + ncv0->attrib[FRAG_ATTRIB_COL1][2]; + rSum = CHAN_TO_FLOAT(ncv0->color[0]) + ncv0->attrib[VARYING_SLOT_COL1][0]; + gSum = CHAN_TO_FLOAT(ncv0->color[1]) + ncv0->attrib[VARYING_SLOT_COL1][1]; + bSum = CHAN_TO_FLOAT(ncv0->color[2]) + ncv0->attrib[VARYING_SLOT_COL1][2]; UNCLAMPED_FLOAT_TO_CHAN(ncv0->color[0], rSum); UNCLAMPED_FLOAT_TO_CHAN(ncv0->color[1], gSum); UNCLAMPED_FLOAT_TO_CHAN(ncv0->color[2], bSum); diff --git a/mesalib/src/mesa/swrast/s_span.c b/mesalib/src/mesa/swrast/s_span.c index ff653a622..7bb3b1f2b 100644 --- a/mesalib/src/mesa/swrast/s_span.c +++ b/mesalib/src/mesa/swrast/s_span.c @@ -79,9 +79,9 @@ _swrast_span_default_attribs(struct gl_context *ctx, SWspan *span) } /* W (for perspective correction) */ - span->attrStart[FRAG_ATTRIB_WPOS][3] = 1.0; - span->attrStepX[FRAG_ATTRIB_WPOS][3] = 0.0; - span->attrStepY[FRAG_ATTRIB_WPOS][3] = 0.0; + span->attrStart[VARYING_SLOT_POS][3] = 1.0; + span->attrStepX[VARYING_SLOT_POS][3] = 0.0; + span->attrStepY[VARYING_SLOT_POS][3] = 0.0; /* primary color, or color index */ UNCLAMPED_FLOAT_TO_CHAN(r, ctx->Current.RasterColor[0]); @@ -105,16 +105,16 @@ _swrast_span_default_attribs(struct gl_context *ctx, SWspan *span) span->alphaStep = 0; span->interpMask |= SPAN_RGBA; - COPY_4V(span->attrStart[FRAG_ATTRIB_COL0], ctx->Current.RasterColor); - ASSIGN_4V(span->attrStepX[FRAG_ATTRIB_COL0], 0.0, 0.0, 0.0, 0.0); - ASSIGN_4V(span->attrStepY[FRAG_ATTRIB_COL0], 0.0, 0.0, 0.0, 0.0); + COPY_4V(span->attrStart[VARYING_SLOT_COL0], ctx->Current.RasterColor); + ASSIGN_4V(span->attrStepX[VARYING_SLOT_COL0], 0.0, 0.0, 0.0, 0.0); + ASSIGN_4V(span->attrStepY[VARYING_SLOT_COL0], 0.0, 0.0, 0.0, 0.0); /* Secondary color */ if (ctx->Light.Enabled || ctx->Fog.ColorSumEnabled) { - COPY_4V(span->attrStart[FRAG_ATTRIB_COL1], ctx->Current.RasterSecondaryColor); - ASSIGN_4V(span->attrStepX[FRAG_ATTRIB_COL1], 0.0, 0.0, 0.0, 0.0); - ASSIGN_4V(span->attrStepY[FRAG_ATTRIB_COL1], 0.0, 0.0, 0.0, 0.0); + COPY_4V(span->attrStart[VARYING_SLOT_COL1], ctx->Current.RasterSecondaryColor); + ASSIGN_4V(span->attrStepX[VARYING_SLOT_COL1], 0.0, 0.0, 0.0, 0.0); + ASSIGN_4V(span->attrStepY[VARYING_SLOT_COL1], 0.0, 0.0, 0.0, 0.0); } /* fog */ @@ -129,16 +129,16 @@ _swrast_span_default_attribs(struct gl_context *ctx, SWspan *span) /* fog blend factor should be computed from fogcoord now */ fogVal = _swrast_z_to_fogfactor(ctx, ctx->Current.RasterDistance); } - span->attrStart[FRAG_ATTRIB_FOGC][0] = fogVal; - span->attrStepX[FRAG_ATTRIB_FOGC][0] = 0.0; - span->attrStepY[FRAG_ATTRIB_FOGC][0] = 0.0; + span->attrStart[VARYING_SLOT_FOGC][0] = fogVal; + span->attrStepX[VARYING_SLOT_FOGC][0] = 0.0; + span->attrStepY[VARYING_SLOT_FOGC][0] = 0.0; } /* texcoords */ { GLuint i; for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) { - const GLuint attr = FRAG_ATTRIB_TEX0 + i; + const GLuint attr = VARYING_SLOT_TEX0 + i; const GLfloat *tc = ctx->Current.RasterTexCoords[i]; if (_swrast_use_fragment_program(ctx) || ctx->ATIFragmentShader._Enabled) { @@ -165,7 +165,7 @@ _swrast_span_default_attribs(struct gl_context *ctx, SWspan *span) * Interpolate the active attributes (and'd with attrMask) to * fill in span->array->attribs[]. * Perspective correction will be done. The point/line/triangle function - * should have computed attrStart/Step values for FRAG_ATTRIB_WPOS[3]! + * should have computed attrStart/Step values for VARYING_SLOT_POS[3]! */ static inline void interpolate_active_attribs(struct gl_context *ctx, SWspan *span, @@ -181,8 +181,8 @@ interpolate_active_attribs(struct gl_context *ctx, SWspan *span, ATTRIB_LOOP_BEGIN if (attrMask & BITFIELD64_BIT(attr)) { - const GLfloat dwdx = span->attrStepX[FRAG_ATTRIB_WPOS][3]; - GLfloat w = span->attrStart[FRAG_ATTRIB_WPOS][3]; + const GLfloat dwdx = span->attrStepX[VARYING_SLOT_POS][3]; + GLfloat w = span->attrStart[VARYING_SLOT_POS][3]; const GLfloat dv0dx = span->attrStepX[attr][0]; const GLfloat dv1dx = span->attrStepX[attr][1]; const GLfloat dv2dx = span->attrStepX[attr][2]; @@ -302,7 +302,7 @@ interpolate_int_colors(struct gl_context *ctx, SWspan *span) break; #endif case GL_FLOAT: - interpolate_active_attribs(ctx, span, FRAG_BIT_COL0); + interpolate_active_attribs(ctx, span, VARYING_BIT_COL0); break; default: _mesa_problem(ctx, "bad datatype 0x%x in interpolate_int_colors", @@ -313,16 +313,16 @@ interpolate_int_colors(struct gl_context *ctx, SWspan *span) /** - * Populate the FRAG_ATTRIB_COL0 array. + * Populate the VARYING_SLOT_COL0 array. */ static inline void interpolate_float_colors(SWspan *span) { - GLfloat (*col0)[4] = span->array->attribs[FRAG_ATTRIB_COL0]; + GLfloat (*col0)[4] = span->array->attribs[VARYING_SLOT_COL0]; const GLuint n = span->end; GLuint i; - assert(!(span->arrayAttribs & FRAG_BIT_COL0)); + assert(!(span->arrayAttribs & VARYING_BIT_COL0)); if (span->arrayMask & SPAN_RGBA) { /* convert array of int colors */ @@ -367,7 +367,7 @@ interpolate_float_colors(SWspan *span) } } - span->arrayAttribs |= FRAG_BIT_COL0; + span->arrayAttribs |= VARYING_BIT_COL0; span->array->ChanType = GL_FLOAT; } @@ -456,7 +456,7 @@ _swrast_compute_lambda(GLfloat dsdx, GLfloat dsdy, GLfloat dtdx, GLfloat dtdy, /** - * Fill in the span.array->attrib[FRAG_ATTRIB_TEXn] arrays from the + * Fill in the span.array->attrib[VARYING_SLOT_TEXn] arrays from the * using the attrStart/Step values. * * This function only used during fixed-function fragment processing. @@ -476,7 +476,7 @@ interpolate_texcoords(struct gl_context *ctx, SWspan *span) /* XXX CoordUnits vs. ImageUnits */ for (u = 0; u < maxUnit; u++) { if (ctx->Texture._EnabledCoordUnits & (1 << u)) { - const GLuint attr = FRAG_ATTRIB_TEX0 + u; + const GLuint attr = VARYING_SLOT_TEX0 + u; const struct gl_texture_object *obj = ctx->Texture.Unit[u]._Current; GLfloat texW, texH; GLboolean needLambda; @@ -524,8 +524,8 @@ interpolate_texcoords(struct gl_context *ctx, SWspan *span) if (_swrast_use_fragment_program(ctx) || ctx->ATIFragmentShader._Enabled) { /* do perspective correction but don't divide s, t, r by q */ - const GLfloat dwdx = span->attrStepX[FRAG_ATTRIB_WPOS][3]; - GLfloat w = span->attrStart[FRAG_ATTRIB_WPOS][3] + span->leftClip * dwdx; + const GLfloat dwdx = span->attrStepX[VARYING_SLOT_POS][3]; + GLfloat w = span->attrStart[VARYING_SLOT_POS][3] + span->leftClip * dwdx; for (i = 0; i < span->end; i++) { const GLfloat invW = 1.0F / w; texcoord[i][0] = s * invW; @@ -565,8 +565,8 @@ interpolate_texcoords(struct gl_context *ctx, SWspan *span) if (_swrast_use_fragment_program(ctx) || ctx->ATIFragmentShader._Enabled) { /* do perspective correction but don't divide s, t, r by q */ - const GLfloat dwdx = span->attrStepX[FRAG_ATTRIB_WPOS][3]; - GLfloat w = span->attrStart[FRAG_ATTRIB_WPOS][3] + span->leftClip * dwdx; + const GLfloat dwdx = span->attrStepX[VARYING_SLOT_POS][3]; + GLfloat w = span->attrStart[VARYING_SLOT_POS][3] + span->leftClip * dwdx; for (i = 0; i < span->end; i++) { const GLfloat invW = 1.0F / w; texcoord[i][0] = s * invW; @@ -616,12 +616,12 @@ interpolate_texcoords(struct gl_context *ctx, SWspan *span) /** - * Fill in the arrays->attribs[FRAG_ATTRIB_WPOS] array. + * Fill in the arrays->attribs[VARYING_SLOT_POS] array. */ static inline void interpolate_wpos(struct gl_context *ctx, SWspan *span) { - GLfloat (*wpos)[4] = span->array->attribs[FRAG_ATTRIB_WPOS]; + GLfloat (*wpos)[4] = span->array->attribs[VARYING_SLOT_POS]; GLuint i; const GLfloat zScale = 1.0F / ctx->DrawBuffer->_DepthMaxF; GLfloat w, dw; @@ -639,8 +639,8 @@ interpolate_wpos(struct gl_context *ctx, SWspan *span) } } - dw = span->attrStepX[FRAG_ATTRIB_WPOS][3]; - w = span->attrStart[FRAG_ATTRIB_WPOS][3] + span->leftClip * dw; + dw = span->attrStepX[VARYING_SLOT_POS][3]; + w = span->attrStart[VARYING_SLOT_POS][3] + span->leftClip * dw; for (i = 0; i < span->end; i++) { wpos[i][2] = (GLfloat) span->array->z[i] * zScale; wpos[i][3] = w; @@ -764,7 +764,7 @@ clip_span( struct gl_context *ctx, SWspan *span ) * fragment attributes. * For arrays of values, shift them left. */ - for (i = 0; i < FRAG_ATTRIB_MAX; i++) { + for (i = 0; i < VARYING_SLOT_MAX; i++) { if (span->interpMask & (1 << i)) { GLuint j; for (j = 0; j < 4; j++) { @@ -785,7 +785,7 @@ clip_span( struct gl_context *ctx, SWspan *span ) #define SHIFT_ARRAY(ARRAY, SHIFT, LEN) \ memmove(ARRAY, ARRAY + (SHIFT), (LEN) * sizeof(ARRAY[0])) - for (i = 0; i < FRAG_ATTRIB_MAX; i++) { + for (i = 0; i < VARYING_SLOT_MAX; i++) { if (span->arrayAttribs & (1 << i)) { /* shift array elements left by 'leftClip' */ SHIFT_ARRAY(span->array->attribs[i], leftClip, n - leftClip); @@ -825,41 +825,41 @@ clip_span( struct gl_context *ctx, SWspan *span ) /** * Add specular colors to primary colors. * Only called during fixed-function operation. - * Result is float color array (FRAG_ATTRIB_COL0). + * Result is float color array (VARYING_SLOT_COL0). */ static inline void add_specular(struct gl_context *ctx, SWspan *span) { const SWcontext *swrast = SWRAST_CONTEXT(ctx); const GLubyte *mask = span->array->mask; - GLfloat (*col0)[4] = span->array->attribs[FRAG_ATTRIB_COL0]; - GLfloat (*col1)[4] = span->array->attribs[FRAG_ATTRIB_COL1]; + GLfloat (*col0)[4] = span->array->attribs[VARYING_SLOT_COL0]; + GLfloat (*col1)[4] = span->array->attribs[VARYING_SLOT_COL1]; GLuint i; ASSERT(!_swrast_use_fragment_program(ctx)); ASSERT(span->arrayMask & SPAN_RGBA); - ASSERT(swrast->_ActiveAttribMask & FRAG_BIT_COL1); + ASSERT(swrast->_ActiveAttribMask & VARYING_BIT_COL1); (void) swrast; /* silence warning */ if (span->array->ChanType == GL_FLOAT) { - if ((span->arrayAttribs & FRAG_BIT_COL0) == 0) { - interpolate_active_attribs(ctx, span, FRAG_BIT_COL0); + if ((span->arrayAttribs & VARYING_BIT_COL0) == 0) { + interpolate_active_attribs(ctx, span, VARYING_BIT_COL0); } } else { /* need float colors */ - if ((span->arrayAttribs & FRAG_BIT_COL0) == 0) { + if ((span->arrayAttribs & VARYING_BIT_COL0) == 0) { interpolate_float_colors(span); } } - if ((span->arrayAttribs & FRAG_BIT_COL1) == 0) { + if ((span->arrayAttribs & VARYING_BIT_COL1) == 0) { /* XXX could avoid this and interpolate COL1 in the loop below */ - interpolate_active_attribs(ctx, span, FRAG_BIT_COL1); + interpolate_active_attribs(ctx, span, VARYING_BIT_COL1); } - ASSERT(span->arrayAttribs & FRAG_BIT_COL0); - ASSERT(span->arrayAttribs & FRAG_BIT_COL1); + ASSERT(span->arrayAttribs & VARYING_BIT_COL0); + ASSERT(span->arrayAttribs & VARYING_BIT_COL1); for (i = 0; i < span->end; i++) { if (mask[i]) { @@ -898,7 +898,7 @@ apply_aa_coverage(SWspan *span) } } else { - GLfloat (*rgba)[4] = span->array->attribs[FRAG_ATTRIB_COL0]; + GLfloat (*rgba)[4] = span->array->attribs[VARYING_SLOT_COL0]; for (i = 0; i < span->end; i++) { rgba[i][ACOMP] = rgba[i][ACOMP] * coverage[i]; /* clamp later */ @@ -913,7 +913,7 @@ apply_aa_coverage(SWspan *span) static inline void clamp_colors(SWspan *span) { - GLfloat (*rgba)[4] = span->array->attribs[FRAG_ATTRIB_COL0]; + GLfloat (*rgba)[4] = span->array->attribs[VARYING_SLOT_COL0]; GLuint i; ASSERT(span->array->ChanType == GL_FLOAT); for (i = 0; i < span->end; i++) { @@ -937,7 +937,7 @@ convert_color_type(SWspan *span, GLenum newType, GLuint output) GLvoid *src, *dst; if (output > 0 || span->array->ChanType == GL_FLOAT) { - src = span->array->attribs[FRAG_ATTRIB_COL0 + output]; + src = span->array->attribs[VARYING_SLOT_COL0 + output]; span->array->ChanType = GL_FLOAT; } else if (span->array->ChanType == GL_UNSIGNED_BYTE) { @@ -955,7 +955,7 @@ convert_color_type(SWspan *span, GLenum newType, GLuint output) dst = span->array->rgba16; } else { - dst = span->array->attribs[FRAG_ATTRIB_COL0]; + dst = span->array->attribs[VARYING_SLOT_COL0]; } _mesa_convert_colors(span->array->ChanType, src, @@ -981,7 +981,7 @@ shade_texture_span(struct gl_context *ctx, SWspan *span) convert_color_type(span, GL_FLOAT, 0); } else { - span->array->rgba = (void *) span->array->attribs[FRAG_ATTRIB_COL0]; + span->array->rgba = (void *) span->array->attribs[VARYING_SLOT_COL0]; } if (span->primitive != GL_POINT || @@ -996,7 +996,7 @@ shade_texture_span(struct gl_context *ctx, SWspan *span) _swrast_span_interpolate_z (ctx, span); #if 0 - if (inputsRead & FRAG_BIT_WPOS) + if (inputsRead & VARYING_BIT_POS) #else /* XXX always interpolate wpos so that DDX/DDY work */ #endif @@ -1015,14 +1015,14 @@ shade_texture_span(struct gl_context *ctx, SWspan *span) /* conventional texturing */ #if CHAN_BITS == 32 - if ((span->arrayAttribs & FRAG_BIT_COL0) == 0) { + if ((span->arrayAttribs & VARYING_BIT_COL0) == 0) { interpolate_int_colors(ctx, span); } #else if (!(span->arrayMask & SPAN_RGBA)) interpolate_int_colors(ctx, span); #endif - if ((span->arrayAttribs & FRAG_BITS_TEX_ANY) == 0x0) + if ((span->arrayAttribs & VARYING_BITS_TEX_ANY) == 0x0) interpolate_texcoords(ctx, span); _swrast_texture_span(ctx, span); @@ -1262,8 +1262,8 @@ _swrast_write_rgba_span( struct gl_context *ctx, SWspan *span) } #if CHAN_BITS == 32 - if ((span->arrayAttribs & FRAG_BIT_COL0) == 0) { - interpolate_active_attribs(ctx, span, FRAG_BIT_COL0); + if ((span->arrayAttribs & VARYING_BIT_COL0) == 0) { + interpolate_active_attribs(ctx, span, VARYING_BIT_COL0); } #else if ((span->arrayMask & SPAN_RGBA) == 0) { @@ -1339,7 +1339,7 @@ _swrast_write_rgba_span( struct gl_context *ctx, SWspan *span) } else { span->array->rgba = (void *) - span->array->attribs[FRAG_ATTRIB_COL0]; + span->array->attribs[VARYING_SLOT_COL0]; } } @@ -1574,7 +1574,7 @@ _swrast_get_dest_rgba(struct gl_context *ctx, struct gl_renderbuffer *rb, void *rbPixels; /* Point rbPixels to a temporary space */ - rbPixels = span->array->attribs[FRAG_ATTRIB_MAX - 1]; + rbPixels = span->array->attribs[VARYING_SLOT_MAX - 1]; /* Get destination values from renderbuffer */ if (span->arrayMask & SPAN_XY) { diff --git a/mesalib/src/mesa/swrast/s_span.h b/mesalib/src/mesa/swrast/s_span.h index 0763c7161..6f710c533 100644 --- a/mesalib/src/mesa/swrast/s_span.h +++ b/mesalib/src/mesa/swrast/s_span.h @@ -68,11 +68,11 @@ struct gl_renderbuffer; */ typedef struct sw_span_arrays { - /** Per-fragment attributes (indexed by FRAG_ATTRIB_* tokens) */ + /** Per-fragment attributes (indexed by VARYING_SLOT_* tokens) */ /* XXX someday look at transposing first two indexes for better memory * access pattern. */ - GLfloat attribs[FRAG_ATTRIB_MAX][SWRAST_MAX_WIDTH][4]; + GLfloat attribs[VARYING_SLOT_MAX][SWRAST_MAX_WIDTH][4]; /** This mask indicates which fragments are alive or culled */ GLubyte mask[SWRAST_MAX_WIDTH]; @@ -133,9 +133,9 @@ typedef struct sw_span GLbitfield interpMask; /** Fragment attribute interpolants */ - GLfloat attrStart[FRAG_ATTRIB_MAX][4]; /**< initial value */ - GLfloat attrStepX[FRAG_ATTRIB_MAX][4]; /**< dvalue/dx */ - GLfloat attrStepY[FRAG_ATTRIB_MAX][4]; /**< dvalue/dy */ + GLfloat attrStart[VARYING_SLOT_MAX][4]; /**< initial value */ + GLfloat attrStepX[VARYING_SLOT_MAX][4]; /**< dvalue/dx */ + GLfloat attrStepY[VARYING_SLOT_MAX][4]; /**< dvalue/dy */ /* XXX the rest of these will go away eventually... */ @@ -156,7 +156,7 @@ typedef struct sw_span */ GLbitfield arrayMask; - /** Mask of FRAG_BIT_x bits */ + /** Mask of VARYING_BIT_x bits */ GLbitfield64 arrayAttribs; /** diff --git a/mesalib/src/mesa/swrast/s_texcombine.c b/mesalib/src/mesa/swrast/s_texcombine.c index 1a2db35e2..c24807cb7 100644 --- a/mesalib/src/mesa/swrast/s_texcombine.c +++ b/mesalib/src/mesa/swrast/s_texcombine.c @@ -648,9 +648,9 @@ _swrast_texture_span( struct gl_context *ctx, SWspan *span ) if (texUnit->_ReallyEnabled && texUnit->_CurrentCombine->ModeRGB == GL_BUMP_ENVMAP_ATI) { const GLfloat (*texcoords)[4] = (const GLfloat (*)[4]) - span->array->attribs[FRAG_ATTRIB_TEX0 + unit]; + span->array->attribs[VARYING_SLOT_TEX0 + unit]; float4_array targetcoords = - span->array->attribs[FRAG_ATTRIB_TEX0 + + span->array->attribs[VARYING_SLOT_TEX0 + ctx->Texture.Unit[unit].BumpTarget - GL_TEXTURE0]; const struct gl_sampler_object *samp = _mesa_get_samplerobj(ctx, unit); @@ -714,7 +714,7 @@ _swrast_texture_span( struct gl_context *ctx, SWspan *span ) if (texUnit->_ReallyEnabled && texUnit->_CurrentCombine->ModeRGB != GL_BUMP_ENVMAP_ATI) { const GLfloat (*texcoords)[4] = (const GLfloat (*)[4]) - span->array->attribs[FRAG_ATTRIB_TEX0 + unit]; + span->array->attribs[VARYING_SLOT_TEX0 + unit]; const struct gl_texture_object *curObj = texUnit->_Current; const struct gl_sampler_object *samp = _mesa_get_samplerobj(ctx, unit); GLfloat *lambda = span->array->lambda[unit]; diff --git a/mesalib/src/mesa/swrast/s_texfilter.c b/mesalib/src/mesa/swrast/s_texfilter.c index 953300f65..ae3ffe5f4 100644 --- a/mesalib/src/mesa/swrast/s_texfilter.c +++ b/mesalib/src/mesa/swrast/s_texfilter.c @@ -1880,7 +1880,7 @@ sample_lambda_2d_aniso(struct gl_context *ctx, * from the context list of available texture objects. */ const GLuint u = texture_unit_index(ctx, tObj); - const GLuint attr = FRAG_ATTRIB_TEX0 + u; + const GLuint attr = VARYING_SLOT_TEX0 + u; GLfloat texW, texH; const GLfloat dsdx = span->attrStepX[attr][0]; diff --git a/mesalib/src/mesa/swrast/s_triangle.c b/mesalib/src/mesa/swrast/s_triangle.c index 893859db0..f0b1d383d 100644 --- a/mesalib/src/mesa/swrast/s_triangle.c +++ b/mesalib/src/mesa/swrast/s_triangle.c @@ -57,10 +57,10 @@ _swrast_culltriangle( struct gl_context *ctx, const SWvertex *v2 ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); - GLfloat ex = v1->attrib[FRAG_ATTRIB_WPOS][0] - v0->attrib[FRAG_ATTRIB_WPOS][0]; - GLfloat ey = v1->attrib[FRAG_ATTRIB_WPOS][1] - v0->attrib[FRAG_ATTRIB_WPOS][1]; - GLfloat fx = v2->attrib[FRAG_ATTRIB_WPOS][0] - v0->attrib[FRAG_ATTRIB_WPOS][0]; - GLfloat fy = v2->attrib[FRAG_ATTRIB_WPOS][1] - v0->attrib[FRAG_ATTRIB_WPOS][1]; + GLfloat ex = v1->attrib[VARYING_SLOT_POS][0] - v0->attrib[VARYING_SLOT_POS][0]; + GLfloat ey = v1->attrib[VARYING_SLOT_POS][1] - v0->attrib[VARYING_SLOT_POS][1]; + GLfloat fx = v2->attrib[VARYING_SLOT_POS][0] - v0->attrib[VARYING_SLOT_POS][0]; + GLfloat fy = v2->attrib[VARYING_SLOT_POS][1] - v0->attrib[VARYING_SLOT_POS][1]; GLfloat c = ex*fy-ey*fx; if (c * swrast->_BackfaceSign * swrast->_BackfaceCullSign <= 0.0F) @@ -678,13 +678,13 @@ fast_persp_span(struct gl_context *ctx, SWspan *span, const GLuint texEnableSave = ctx->Texture._EnabledCoordUnits; ctx->Texture._EnabledCoordUnits = 0; - tex_coord[0] = span->attrStart[FRAG_ATTRIB_TEX0][0] * (info->smask + 1); - tex_step[0] = span->attrStepX[FRAG_ATTRIB_TEX0][0] * (info->smask + 1); - tex_coord[1] = span->attrStart[FRAG_ATTRIB_TEX0][1] * (info->tmask + 1); - tex_step[1] = span->attrStepX[FRAG_ATTRIB_TEX0][1] * (info->tmask + 1); - /* span->attrStart[FRAG_ATTRIB_TEX0][2] only if 3D-texturing, here only 2D */ - tex_coord[2] = span->attrStart[FRAG_ATTRIB_TEX0][3]; - tex_step[2] = span->attrStepX[FRAG_ATTRIB_TEX0][3]; + tex_coord[0] = span->attrStart[VARYING_SLOT_TEX0][0] * (info->smask + 1); + tex_step[0] = span->attrStepX[VARYING_SLOT_TEX0][0] * (info->smask + 1); + tex_coord[1] = span->attrStart[VARYING_SLOT_TEX0][1] * (info->tmask + 1); + tex_step[1] = span->attrStepX[VARYING_SLOT_TEX0][1] * (info->tmask + 1); + /* span->attrStart[VARYING_SLOT_TEX0][2] only if 3D-texturing, here only 2D */ + tex_coord[2] = span->attrStart[VARYING_SLOT_TEX0][3]; + tex_step[2] = span->attrStepX[VARYING_SLOT_TEX0][3]; switch (info->filter) { case GL_NEAREST: @@ -939,23 +939,23 @@ _swrast_add_spec_terms_triangle(struct gl_context *ctx, const SWvertex *v0, COPY_CHAN4( cSave[1], ncv1->color ); COPY_CHAN4( cSave[2], ncv2->color ); /* sum v0 */ - rSum = CHAN_TO_FLOAT(ncv0->color[0]) + ncv0->attrib[FRAG_ATTRIB_COL1][0]; - gSum = CHAN_TO_FLOAT(ncv0->color[1]) + ncv0->attrib[FRAG_ATTRIB_COL1][1]; - bSum = CHAN_TO_FLOAT(ncv0->color[2]) + ncv0->attrib[FRAG_ATTRIB_COL1][2]; + rSum = CHAN_TO_FLOAT(ncv0->color[0]) + ncv0->attrib[VARYING_SLOT_COL1][0]; + gSum = CHAN_TO_FLOAT(ncv0->color[1]) + ncv0->attrib[VARYING_SLOT_COL1][1]; + bSum = CHAN_TO_FLOAT(ncv0->color[2]) + ncv0->attrib[VARYING_SLOT_COL1][2]; UNCLAMPED_FLOAT_TO_CHAN(ncv0->color[0], rSum); UNCLAMPED_FLOAT_TO_CHAN(ncv0->color[1], gSum); UNCLAMPED_FLOAT_TO_CHAN(ncv0->color[2], bSum); /* sum v1 */ - rSum = CHAN_TO_FLOAT(ncv1->color[0]) + ncv1->attrib[FRAG_ATTRIB_COL1][0]; - gSum = CHAN_TO_FLOAT(ncv1->color[1]) + ncv1->attrib[FRAG_ATTRIB_COL1][1]; - bSum = CHAN_TO_FLOAT(ncv1->color[2]) + ncv1->attrib[FRAG_ATTRIB_COL1][2]; + rSum = CHAN_TO_FLOAT(ncv1->color[0]) + ncv1->attrib[VARYING_SLOT_COL1][0]; + gSum = CHAN_TO_FLOAT(ncv1->color[1]) + ncv1->attrib[VARYING_SLOT_COL1][1]; + bSum = CHAN_TO_FLOAT(ncv1->color[2]) + ncv1->attrib[VARYING_SLOT_COL1][2]; UNCLAMPED_FLOAT_TO_CHAN(ncv1->color[0], rSum); UNCLAMPED_FLOAT_TO_CHAN(ncv1->color[1], gSum); UNCLAMPED_FLOAT_TO_CHAN(ncv1->color[2], bSum); /* sum v2 */ - rSum = CHAN_TO_FLOAT(ncv2->color[0]) + ncv2->attrib[FRAG_ATTRIB_COL1][0]; - gSum = CHAN_TO_FLOAT(ncv2->color[1]) + ncv2->attrib[FRAG_ATTRIB_COL1][1]; - bSum = CHAN_TO_FLOAT(ncv2->color[2]) + ncv2->attrib[FRAG_ATTRIB_COL1][2]; + rSum = CHAN_TO_FLOAT(ncv2->color[0]) + ncv2->attrib[VARYING_SLOT_COL1][0]; + gSum = CHAN_TO_FLOAT(ncv2->color[1]) + ncv2->attrib[VARYING_SLOT_COL1][1]; + bSum = CHAN_TO_FLOAT(ncv2->color[2]) + ncv2->attrib[VARYING_SLOT_COL1][2]; UNCLAMPED_FLOAT_TO_CHAN(ncv2->color[0], rSum); UNCLAMPED_FLOAT_TO_CHAN(ncv2->color[1], gSum); UNCLAMPED_FLOAT_TO_CHAN(ncv2->color[2], bSum); diff --git a/mesalib/src/mesa/swrast/s_tritemp.h b/mesalib/src/mesa/swrast/s_tritemp.h index 061759d26..797afc41a 100644 --- a/mesalib/src/mesa/swrast/s_tritemp.h +++ b/mesalib/src/mesa/swrast/s_tritemp.h @@ -153,26 +153,26 @@ static void NAME(struct gl_context *ctx, const SWvertex *v0, /* printf("%s()\n", __FUNCTION__); printf(" %g, %g, %g\n", - v0->attrib[FRAG_ATTRIB_WPOS][0], - v0->attrib[FRAG_ATTRIB_WPOS][1], - v0->attrib[FRAG_ATTRIB_WPOS][2]); + v0->attrib[VARYING_SLOT_POS][0], + v0->attrib[VARYING_SLOT_POS][1], + v0->attrib[VARYING_SLOT_POS][2]); printf(" %g, %g, %g\n", - v1->attrib[FRAG_ATTRIB_WPOS][0], - v1->attrib[FRAG_ATTRIB_WPOS][1], - v1->attrib[FRAG_ATTRIB_WPOS][2]); + v1->attrib[VARYING_SLOT_POS][0], + v1->attrib[VARYING_SLOT_POS][1], + v1->attrib[VARYING_SLOT_POS][2]); printf(" %g, %g, %g\n", - v2->attrib[FRAG_ATTRIB_WPOS][0], - v2->attrib[FRAG_ATTRIB_WPOS][1], - v2->attrib[FRAG_ATTRIB_WPOS][2]); + v2->attrib[VARYING_SLOT_POS][0], + v2->attrib[VARYING_SLOT_POS][1], + v2->attrib[VARYING_SLOT_POS][2]); */ /* Compute fixed point x,y coords w/ half-pixel offsets and snapping. * And find the order of the 3 vertices along the Y axis. */ { - const GLfixed fy0 = FloatToFixed(v0->attrib[FRAG_ATTRIB_WPOS][1] - 0.5F) & snapMask; - const GLfixed fy1 = FloatToFixed(v1->attrib[FRAG_ATTRIB_WPOS][1] - 0.5F) & snapMask; - const GLfixed fy2 = FloatToFixed(v2->attrib[FRAG_ATTRIB_WPOS][1] - 0.5F) & snapMask; + const GLfixed fy0 = FloatToFixed(v0->attrib[VARYING_SLOT_POS][1] - 0.5F) & snapMask; + const GLfixed fy1 = FloatToFixed(v1->attrib[VARYING_SLOT_POS][1] - 0.5F) & snapMask; + const GLfixed fy2 = FloatToFixed(v2->attrib[VARYING_SLOT_POS][1] - 0.5F) & snapMask; if (fy0 <= fy1) { if (fy1 <= fy2) { /* y0 <= y1 <= y2 */ @@ -212,9 +212,9 @@ static void NAME(struct gl_context *ctx, const SWvertex *v0, } /* fixed point X coords */ - vMin_fx = FloatToFixed(vMin->attrib[FRAG_ATTRIB_WPOS][0] + 0.5F) & snapMask; - vMid_fx = FloatToFixed(vMid->attrib[FRAG_ATTRIB_WPOS][0] + 0.5F) & snapMask; - vMax_fx = FloatToFixed(vMax->attrib[FRAG_ATTRIB_WPOS][0] + 0.5F) & snapMask; + vMin_fx = FloatToFixed(vMin->attrib[VARYING_SLOT_POS][0] + 0.5F) & snapMask; + vMid_fx = FloatToFixed(vMid->attrib[VARYING_SLOT_POS][0] + 0.5F) & snapMask; + vMax_fx = FloatToFixed(vMax->attrib[VARYING_SLOT_POS][0] + 0.5F) & snapMask; } /* vertex/edge relationship */ @@ -333,22 +333,22 @@ static void NAME(struct gl_context *ctx, const SWvertex *v0, #ifdef INTERP_Z span.interpMask |= SPAN_Z; { - GLfloat eMaj_dz = vMax->attrib[FRAG_ATTRIB_WPOS][2] - vMin->attrib[FRAG_ATTRIB_WPOS][2]; - GLfloat eBot_dz = vMid->attrib[FRAG_ATTRIB_WPOS][2] - vMin->attrib[FRAG_ATTRIB_WPOS][2]; - span.attrStepX[FRAG_ATTRIB_WPOS][2] = oneOverArea * (eMaj_dz * eBot.dy - eMaj.dy * eBot_dz); - if (span.attrStepX[FRAG_ATTRIB_WPOS][2] > maxDepth || - span.attrStepX[FRAG_ATTRIB_WPOS][2] < -maxDepth) { + GLfloat eMaj_dz = vMax->attrib[VARYING_SLOT_POS][2] - vMin->attrib[VARYING_SLOT_POS][2]; + GLfloat eBot_dz = vMid->attrib[VARYING_SLOT_POS][2] - vMin->attrib[VARYING_SLOT_POS][2]; + span.attrStepX[VARYING_SLOT_POS][2] = oneOverArea * (eMaj_dz * eBot.dy - eMaj.dy * eBot_dz); + if (span.attrStepX[VARYING_SLOT_POS][2] > maxDepth || + span.attrStepX[VARYING_SLOT_POS][2] < -maxDepth) { /* probably a sliver triangle */ - span.attrStepX[FRAG_ATTRIB_WPOS][2] = 0.0; - span.attrStepY[FRAG_ATTRIB_WPOS][2] = 0.0; + span.attrStepX[VARYING_SLOT_POS][2] = 0.0; + span.attrStepY[VARYING_SLOT_POS][2] = 0.0; } else { - span.attrStepY[FRAG_ATTRIB_WPOS][2] = oneOverArea * (eMaj.dx * eBot_dz - eMaj_dz * eBot.dx); + span.attrStepY[VARYING_SLOT_POS][2] = oneOverArea * (eMaj.dx * eBot_dz - eMaj_dz * eBot.dx); } if (depthBits <= 16) - span.zStep = SignedFloatToFixed(span.attrStepX[FRAG_ATTRIB_WPOS][2]); + span.zStep = SignedFloatToFixed(span.attrStepX[VARYING_SLOT_POS][2]); else - span.zStep = (GLint) span.attrStepX[FRAG_ATTRIB_WPOS][2]; + span.zStep = (GLint) span.attrStepX[VARYING_SLOT_POS][2]; } #endif #ifdef INTERP_RGB @@ -364,61 +364,61 @@ static void NAME(struct gl_context *ctx, const SWvertex *v0, GLfloat eMaj_da = (GLfloat) (vMax->color[ACOMP] - vMin->color[ACOMP]); GLfloat eBot_da = (GLfloat) (vMid->color[ACOMP] - vMin->color[ACOMP]); # endif - span.attrStepX[FRAG_ATTRIB_COL0][0] = oneOverArea * (eMaj_dr * eBot.dy - eMaj.dy * eBot_dr); - span.attrStepY[FRAG_ATTRIB_COL0][0] = oneOverArea * (eMaj.dx * eBot_dr - eMaj_dr * eBot.dx); - span.attrStepX[FRAG_ATTRIB_COL0][1] = oneOverArea * (eMaj_dg * eBot.dy - eMaj.dy * eBot_dg); - span.attrStepY[FRAG_ATTRIB_COL0][1] = oneOverArea * (eMaj.dx * eBot_dg - eMaj_dg * eBot.dx); - span.attrStepX[FRAG_ATTRIB_COL0][2] = oneOverArea * (eMaj_db * eBot.dy - eMaj.dy * eBot_db); - span.attrStepY[FRAG_ATTRIB_COL0][2] = oneOverArea * (eMaj.dx * eBot_db - eMaj_db * eBot.dx); - span.redStep = SignedFloatToFixed(span.attrStepX[FRAG_ATTRIB_COL0][0]); - span.greenStep = SignedFloatToFixed(span.attrStepX[FRAG_ATTRIB_COL0][1]); - span.blueStep = SignedFloatToFixed(span.attrStepX[FRAG_ATTRIB_COL0][2]); + span.attrStepX[VARYING_SLOT_COL0][0] = oneOverArea * (eMaj_dr * eBot.dy - eMaj.dy * eBot_dr); + span.attrStepY[VARYING_SLOT_COL0][0] = oneOverArea * (eMaj.dx * eBot_dr - eMaj_dr * eBot.dx); + span.attrStepX[VARYING_SLOT_COL0][1] = oneOverArea * (eMaj_dg * eBot.dy - eMaj.dy * eBot_dg); + span.attrStepY[VARYING_SLOT_COL0][1] = oneOverArea * (eMaj.dx * eBot_dg - eMaj_dg * eBot.dx); + span.attrStepX[VARYING_SLOT_COL0][2] = oneOverArea * (eMaj_db * eBot.dy - eMaj.dy * eBot_db); + span.attrStepY[VARYING_SLOT_COL0][2] = oneOverArea * (eMaj.dx * eBot_db - eMaj_db * eBot.dx); + span.redStep = SignedFloatToFixed(span.attrStepX[VARYING_SLOT_COL0][0]); + span.greenStep = SignedFloatToFixed(span.attrStepX[VARYING_SLOT_COL0][1]); + span.blueStep = SignedFloatToFixed(span.attrStepX[VARYING_SLOT_COL0][2]); # ifdef INTERP_ALPHA - span.attrStepX[FRAG_ATTRIB_COL0][3] = oneOverArea * (eMaj_da * eBot.dy - eMaj.dy * eBot_da); - span.attrStepY[FRAG_ATTRIB_COL0][3] = oneOverArea * (eMaj.dx * eBot_da - eMaj_da * eBot.dx); - span.alphaStep = SignedFloatToFixed(span.attrStepX[FRAG_ATTRIB_COL0][3]); + span.attrStepX[VARYING_SLOT_COL0][3] = oneOverArea * (eMaj_da * eBot.dy - eMaj.dy * eBot_da); + span.attrStepY[VARYING_SLOT_COL0][3] = oneOverArea * (eMaj.dx * eBot_da - eMaj_da * eBot.dx); + span.alphaStep = SignedFloatToFixed(span.attrStepX[VARYING_SLOT_COL0][3]); # endif /* INTERP_ALPHA */ } else { ASSERT(ctx->Light.ShadeModel == GL_FLAT); span.interpMask |= SPAN_FLAT; - span.attrStepX[FRAG_ATTRIB_COL0][0] = span.attrStepY[FRAG_ATTRIB_COL0][0] = 0.0F; - span.attrStepX[FRAG_ATTRIB_COL0][1] = span.attrStepY[FRAG_ATTRIB_COL0][1] = 0.0F; - span.attrStepX[FRAG_ATTRIB_COL0][2] = span.attrStepY[FRAG_ATTRIB_COL0][2] = 0.0F; + span.attrStepX[VARYING_SLOT_COL0][0] = span.attrStepY[VARYING_SLOT_COL0][0] = 0.0F; + span.attrStepX[VARYING_SLOT_COL0][1] = span.attrStepY[VARYING_SLOT_COL0][1] = 0.0F; + span.attrStepX[VARYING_SLOT_COL0][2] = span.attrStepY[VARYING_SLOT_COL0][2] = 0.0F; span.redStep = 0; span.greenStep = 0; span.blueStep = 0; # ifdef INTERP_ALPHA - span.attrStepX[FRAG_ATTRIB_COL0][3] = span.attrStepY[FRAG_ATTRIB_COL0][3] = 0.0F; + span.attrStepX[VARYING_SLOT_COL0][3] = span.attrStepY[VARYING_SLOT_COL0][3] = 0.0F; span.alphaStep = 0; # endif } #endif /* INTERP_RGB */ #ifdef INTERP_INT_TEX { - GLfloat eMaj_ds = (vMax->attrib[FRAG_ATTRIB_TEX0][0] - vMin->attrib[FRAG_ATTRIB_TEX0][0]) * S_SCALE; - GLfloat eBot_ds = (vMid->attrib[FRAG_ATTRIB_TEX0][0] - vMin->attrib[FRAG_ATTRIB_TEX0][0]) * S_SCALE; - GLfloat eMaj_dt = (vMax->attrib[FRAG_ATTRIB_TEX0][1] - vMin->attrib[FRAG_ATTRIB_TEX0][1]) * T_SCALE; - GLfloat eBot_dt = (vMid->attrib[FRAG_ATTRIB_TEX0][1] - vMin->attrib[FRAG_ATTRIB_TEX0][1]) * T_SCALE; - span.attrStepX[FRAG_ATTRIB_TEX0][0] = oneOverArea * (eMaj_ds * eBot.dy - eMaj.dy * eBot_ds); - span.attrStepY[FRAG_ATTRIB_TEX0][0] = oneOverArea * (eMaj.dx * eBot_ds - eMaj_ds * eBot.dx); - span.attrStepX[FRAG_ATTRIB_TEX0][1] = oneOverArea * (eMaj_dt * eBot.dy - eMaj.dy * eBot_dt); - span.attrStepY[FRAG_ATTRIB_TEX0][1] = oneOverArea * (eMaj.dx * eBot_dt - eMaj_dt * eBot.dx); - span.intTexStep[0] = SignedFloatToFixed(span.attrStepX[FRAG_ATTRIB_TEX0][0]); - span.intTexStep[1] = SignedFloatToFixed(span.attrStepX[FRAG_ATTRIB_TEX0][1]); + GLfloat eMaj_ds = (vMax->attrib[VARYING_SLOT_TEX0][0] - vMin->attrib[VARYING_SLOT_TEX0][0]) * S_SCALE; + GLfloat eBot_ds = (vMid->attrib[VARYING_SLOT_TEX0][0] - vMin->attrib[VARYING_SLOT_TEX0][0]) * S_SCALE; + GLfloat eMaj_dt = (vMax->attrib[VARYING_SLOT_TEX0][1] - vMin->attrib[VARYING_SLOT_TEX0][1]) * T_SCALE; + GLfloat eBot_dt = (vMid->attrib[VARYING_SLOT_TEX0][1] - vMin->attrib[VARYING_SLOT_TEX0][1]) * T_SCALE; + span.attrStepX[VARYING_SLOT_TEX0][0] = oneOverArea * (eMaj_ds * eBot.dy - eMaj.dy * eBot_ds); + span.attrStepY[VARYING_SLOT_TEX0][0] = oneOverArea * (eMaj.dx * eBot_ds - eMaj_ds * eBot.dx); + span.attrStepX[VARYING_SLOT_TEX0][1] = oneOverArea * (eMaj_dt * eBot.dy - eMaj.dy * eBot_dt); + span.attrStepY[VARYING_SLOT_TEX0][1] = oneOverArea * (eMaj.dx * eBot_dt - eMaj_dt * eBot.dx); + span.intTexStep[0] = SignedFloatToFixed(span.attrStepX[VARYING_SLOT_TEX0][0]); + span.intTexStep[1] = SignedFloatToFixed(span.attrStepX[VARYING_SLOT_TEX0][1]); } #endif #ifdef INTERP_ATTRIBS { - /* attrib[FRAG_ATTRIB_WPOS][3] is 1/W */ - const GLfloat wMax = vMax->attrib[FRAG_ATTRIB_WPOS][3]; - const GLfloat wMin = vMin->attrib[FRAG_ATTRIB_WPOS][3]; - const GLfloat wMid = vMid->attrib[FRAG_ATTRIB_WPOS][3]; + /* attrib[VARYING_SLOT_POS][3] is 1/W */ + const GLfloat wMax = vMax->attrib[VARYING_SLOT_POS][3]; + const GLfloat wMin = vMin->attrib[VARYING_SLOT_POS][3]; + const GLfloat wMid = vMid->attrib[VARYING_SLOT_POS][3]; { const GLfloat eMaj_dw = wMax - wMin; const GLfloat eBot_dw = wMid - wMin; - span.attrStepX[FRAG_ATTRIB_WPOS][3] = oneOverArea * (eMaj_dw * eBot.dy - eMaj.dy * eBot_dw); - span.attrStepY[FRAG_ATTRIB_WPOS][3] = oneOverArea * (eMaj.dx * eBot_dw - eMaj_dw * eBot.dx); + span.attrStepX[VARYING_SLOT_POS][3] = oneOverArea * (eMaj_dw * eBot.dy - eMaj.dy * eBot_dw); + span.attrStepY[VARYING_SLOT_POS][3] = oneOverArea * (eMaj.dx * eBot_dw - eMaj_dw * eBot.dx); } ATTRIB_LOOP_BEGIN if (swrast->_InterpMode[attr] == GL_FLAT) { @@ -518,8 +518,8 @@ static void NAME(struct gl_context *ctx, const SWvertex *v0, #endif #ifdef INTERP_ATTRIBS GLfloat wLeft = 0, dwOuter = 0, dwInner; - GLfloat attrLeft[FRAG_ATTRIB_MAX][4]; - GLfloat daOuter[FRAG_ATTRIB_MAX][4], daInner[FRAG_ATTRIB_MAX][4]; + GLfloat attrLeft[VARYING_SLOT_MAX][4]; + GLfloat daOuter[VARYING_SLOT_MAX][4], daInner[VARYING_SLOT_MAX][4]; #endif for (subTriangle=0; subTriangle<=1; subTriangle++) { @@ -609,25 +609,25 @@ static void NAME(struct gl_context *ctx, const SWvertex *v0, #ifdef INTERP_Z { - GLfloat z0 = vLower->attrib[FRAG_ATTRIB_WPOS][2]; + GLfloat z0 = vLower->attrib[VARYING_SLOT_POS][2]; if (depthBits <= 16) { /* interpolate fixed-pt values */ GLfloat tmp = (z0 * FIXED_SCALE - + span.attrStepX[FRAG_ATTRIB_WPOS][2] * adjx - + span.attrStepY[FRAG_ATTRIB_WPOS][2] * adjy) + FIXED_HALF; + + span.attrStepX[VARYING_SLOT_POS][2] * adjx + + span.attrStepY[VARYING_SLOT_POS][2] * adjy) + FIXED_HALF; if (tmp < MAX_GLUINT / 2) zLeft = (GLfixed) tmp; else zLeft = MAX_GLUINT / 2; - fdzOuter = SignedFloatToFixed(span.attrStepY[FRAG_ATTRIB_WPOS][2] + - dxOuter * span.attrStepX[FRAG_ATTRIB_WPOS][2]); + fdzOuter = SignedFloatToFixed(span.attrStepY[VARYING_SLOT_POS][2] + + dxOuter * span.attrStepX[VARYING_SLOT_POS][2]); } else { /* interpolate depth values w/out scaling */ - zLeft = (GLuint) (z0 + span.attrStepX[FRAG_ATTRIB_WPOS][2] * FixedToFloat(adjx) - + span.attrStepY[FRAG_ATTRIB_WPOS][2] * FixedToFloat(adjy)); - fdzOuter = (GLint) (span.attrStepY[FRAG_ATTRIB_WPOS][2] + - dxOuter * span.attrStepX[FRAG_ATTRIB_WPOS][2]); + zLeft = (GLuint) (z0 + span.attrStepX[VARYING_SLOT_POS][2] * FixedToFloat(adjx) + + span.attrStepY[VARYING_SLOT_POS][2] * FixedToFloat(adjy)); + fdzOuter = (GLint) (span.attrStepY[VARYING_SLOT_POS][2] + + dxOuter * span.attrStepX[VARYING_SLOT_POS][2]); } # ifdef DEPTH_TYPE zRow = (DEPTH_TYPE *) @@ -639,26 +639,26 @@ static void NAME(struct gl_context *ctx, const SWvertex *v0, #ifdef INTERP_RGB if (ctx->Light.ShadeModel == GL_SMOOTH) { rLeft = (GLint)(ChanToFixed(vLower->color[RCOMP]) - + span.attrStepX[FRAG_ATTRIB_COL0][0] * adjx - + span.attrStepY[FRAG_ATTRIB_COL0][0] * adjy) + FIXED_HALF; + + span.attrStepX[VARYING_SLOT_COL0][0] * adjx + + span.attrStepY[VARYING_SLOT_COL0][0] * adjy) + FIXED_HALF; gLeft = (GLint)(ChanToFixed(vLower->color[GCOMP]) - + span.attrStepX[FRAG_ATTRIB_COL0][1] * adjx - + span.attrStepY[FRAG_ATTRIB_COL0][1] * adjy) + FIXED_HALF; + + span.attrStepX[VARYING_SLOT_COL0][1] * adjx + + span.attrStepY[VARYING_SLOT_COL0][1] * adjy) + FIXED_HALF; bLeft = (GLint)(ChanToFixed(vLower->color[BCOMP]) - + span.attrStepX[FRAG_ATTRIB_COL0][2] * adjx - + span.attrStepY[FRAG_ATTRIB_COL0][2] * adjy) + FIXED_HALF; - fdrOuter = SignedFloatToFixed(span.attrStepY[FRAG_ATTRIB_COL0][0] - + dxOuter * span.attrStepX[FRAG_ATTRIB_COL0][0]); - fdgOuter = SignedFloatToFixed(span.attrStepY[FRAG_ATTRIB_COL0][1] - + dxOuter * span.attrStepX[FRAG_ATTRIB_COL0][1]); - fdbOuter = SignedFloatToFixed(span.attrStepY[FRAG_ATTRIB_COL0][2] - + dxOuter * span.attrStepX[FRAG_ATTRIB_COL0][2]); + + span.attrStepX[VARYING_SLOT_COL0][2] * adjx + + span.attrStepY[VARYING_SLOT_COL0][2] * adjy) + FIXED_HALF; + fdrOuter = SignedFloatToFixed(span.attrStepY[VARYING_SLOT_COL0][0] + + dxOuter * span.attrStepX[VARYING_SLOT_COL0][0]); + fdgOuter = SignedFloatToFixed(span.attrStepY[VARYING_SLOT_COL0][1] + + dxOuter * span.attrStepX[VARYING_SLOT_COL0][1]); + fdbOuter = SignedFloatToFixed(span.attrStepY[VARYING_SLOT_COL0][2] + + dxOuter * span.attrStepX[VARYING_SLOT_COL0][2]); # ifdef INTERP_ALPHA aLeft = (GLint)(ChanToFixed(vLower->color[ACOMP]) - + span.attrStepX[FRAG_ATTRIB_COL0][3] * adjx - + span.attrStepY[FRAG_ATTRIB_COL0][3] * adjy) + FIXED_HALF; - fdaOuter = SignedFloatToFixed(span.attrStepY[FRAG_ATTRIB_COL0][3] - + dxOuter * span.attrStepX[FRAG_ATTRIB_COL0][3]); + + span.attrStepX[VARYING_SLOT_COL0][3] * adjx + + span.attrStepY[VARYING_SLOT_COL0][3] * adjy) + FIXED_HALF; + fdaOuter = SignedFloatToFixed(span.attrStepY[VARYING_SLOT_COL0][3] + + dxOuter * span.attrStepX[VARYING_SLOT_COL0][3]); # endif } else { @@ -678,29 +678,29 @@ static void NAME(struct gl_context *ctx, const SWvertex *v0, #ifdef INTERP_INT_TEX { GLfloat s0, t0; - s0 = vLower->attrib[FRAG_ATTRIB_TEX0][0] * S_SCALE; - sLeft = (GLfixed)(s0 * FIXED_SCALE + span.attrStepX[FRAG_ATTRIB_TEX0][0] * adjx - + span.attrStepY[FRAG_ATTRIB_TEX0][0] * adjy) + FIXED_HALF; - dsOuter = SignedFloatToFixed(span.attrStepY[FRAG_ATTRIB_TEX0][0] - + dxOuter * span.attrStepX[FRAG_ATTRIB_TEX0][0]); - - t0 = vLower->attrib[FRAG_ATTRIB_TEX0][1] * T_SCALE; - tLeft = (GLfixed)(t0 * FIXED_SCALE + span.attrStepX[FRAG_ATTRIB_TEX0][1] * adjx - + span.attrStepY[FRAG_ATTRIB_TEX0][1] * adjy) + FIXED_HALF; - dtOuter = SignedFloatToFixed(span.attrStepY[FRAG_ATTRIB_TEX0][1] - + dxOuter * span.attrStepX[FRAG_ATTRIB_TEX0][1]); + s0 = vLower->attrib[VARYING_SLOT_TEX0][0] * S_SCALE; + sLeft = (GLfixed)(s0 * FIXED_SCALE + span.attrStepX[VARYING_SLOT_TEX0][0] * adjx + + span.attrStepY[VARYING_SLOT_TEX0][0] * adjy) + FIXED_HALF; + dsOuter = SignedFloatToFixed(span.attrStepY[VARYING_SLOT_TEX0][0] + + dxOuter * span.attrStepX[VARYING_SLOT_TEX0][0]); + + t0 = vLower->attrib[VARYING_SLOT_TEX0][1] * T_SCALE; + tLeft = (GLfixed)(t0 * FIXED_SCALE + span.attrStepX[VARYING_SLOT_TEX0][1] * adjx + + span.attrStepY[VARYING_SLOT_TEX0][1] * adjy) + FIXED_HALF; + dtOuter = SignedFloatToFixed(span.attrStepY[VARYING_SLOT_TEX0][1] + + dxOuter * span.attrStepX[VARYING_SLOT_TEX0][1]); } #endif #ifdef INTERP_ATTRIBS { - const GLuint attr = FRAG_ATTRIB_WPOS; - wLeft = vLower->attrib[FRAG_ATTRIB_WPOS][3] + const GLuint attr = VARYING_SLOT_POS; + wLeft = vLower->attrib[VARYING_SLOT_POS][3] + (span.attrStepX[attr][3] * adjx + span.attrStepY[attr][3] * adjy) * (1.0F/FIXED_SCALE); dwOuter = span.attrStepY[attr][3] + dxOuter * span.attrStepX[attr][3]; } ATTRIB_LOOP_BEGIN - const GLfloat invW = vLower->attrib[FRAG_ATTRIB_WPOS][3]; + const GLfloat invW = vLower->attrib[VARYING_SLOT_POS][3]; if (swrast->_InterpMode[attr] == GL_FLAT) { GLuint c; for (c = 0; c < 4; c++) { @@ -755,7 +755,7 @@ static void NAME(struct gl_context *ctx, const SWvertex *v0, dtInner = dtOuter + span.intTexStep[1]; #endif #ifdef INTERP_ATTRIBS - dwInner = dwOuter + span.attrStepX[FRAG_ATTRIB_WPOS][3]; + dwInner = dwOuter + span.attrStepX[VARYING_SLOT_POS][3]; ATTRIB_LOOP_BEGIN GLuint c; for (c = 0; c < 4; c++) { @@ -791,7 +791,7 @@ static void NAME(struct gl_context *ctx, const SWvertex *v0, #endif #ifdef INTERP_ATTRIBS - span.attrStart[FRAG_ATTRIB_WPOS][3] = wLeft; + span.attrStart[VARYING_SLOT_POS][3] = wLeft; ATTRIB_LOOP_BEGIN GLuint c; for (c = 0; c < 4; c++) { diff --git a/mesalib/src/mesa/swrast/s_zoom.c b/mesalib/src/mesa/swrast/s_zoom.c index 828374f68..3b309a251 100644 --- a/mesalib/src/mesa/swrast/s_zoom.c +++ b/mesalib/src/mesa/swrast/s_zoom.c @@ -166,15 +166,15 @@ zoom_span( struct gl_context *ctx, GLint imgX, GLint imgY, const SWspan *span, else if (zoomed.array->ChanType == GL_UNSIGNED_SHORT) zoomed.array->rgba = (GLchan (*)[4]) zoomed.array->rgba16; else - zoomed.array->rgba = (GLchan (*)[4]) zoomed.array->attribs[FRAG_ATTRIB_COL0]; + zoomed.array->rgba = (GLchan (*)[4]) zoomed.array->attribs[VARYING_SLOT_COL0]; - COPY_4V(zoomed.attrStart[FRAG_ATTRIB_WPOS], span->attrStart[FRAG_ATTRIB_WPOS]); - COPY_4V(zoomed.attrStepX[FRAG_ATTRIB_WPOS], span->attrStepX[FRAG_ATTRIB_WPOS]); - COPY_4V(zoomed.attrStepY[FRAG_ATTRIB_WPOS], span->attrStepY[FRAG_ATTRIB_WPOS]); + COPY_4V(zoomed.attrStart[VARYING_SLOT_POS], span->attrStart[VARYING_SLOT_POS]); + COPY_4V(zoomed.attrStepX[VARYING_SLOT_POS], span->attrStepX[VARYING_SLOT_POS]); + COPY_4V(zoomed.attrStepY[VARYING_SLOT_POS], span->attrStepY[VARYING_SLOT_POS]); - zoomed.attrStart[FRAG_ATTRIB_FOGC][0] = span->attrStart[FRAG_ATTRIB_FOGC][0]; - zoomed.attrStepX[FRAG_ATTRIB_FOGC][0] = span->attrStepX[FRAG_ATTRIB_FOGC][0]; - zoomed.attrStepY[FRAG_ATTRIB_FOGC][0] = span->attrStepY[FRAG_ATTRIB_FOGC][0]; + zoomed.attrStart[VARYING_SLOT_FOGC][0] = span->attrStart[VARYING_SLOT_FOGC][0]; + zoomed.attrStepX[VARYING_SLOT_FOGC][0] = span->attrStepX[VARYING_SLOT_FOGC][0]; + zoomed.attrStepY[VARYING_SLOT_FOGC][0] = span->attrStepY[VARYING_SLOT_FOGC][0]; if (format == GL_RGBA || format == GL_RGB) { /* copy Z info */ @@ -183,7 +183,7 @@ zoom_span( struct gl_context *ctx, GLint imgX, GLint imgY, const SWspan *span, /* we'll generate an array of colorss */ zoomed.interpMask = span->interpMask & ~SPAN_RGBA; zoomed.arrayMask |= SPAN_RGBA; - zoomed.arrayAttribs |= FRAG_BIT_COL0; /* we'll produce these values */ + zoomed.arrayAttribs |= VARYING_BIT_COL0; /* we'll produce these values */ ASSERT(span->arrayMask & SPAN_RGBA); } else if (format == GL_DEPTH_COMPONENT) { @@ -235,7 +235,7 @@ zoom_span( struct gl_context *ctx, GLint imgX, GLint imgY, const SWspan *span, GLint j = unzoom_x(ctx->Pixel.ZoomX, imgX, x0 + i) - span->x; ASSERT(j >= 0); ASSERT(j < (GLint) span->end); - COPY_4V(zoomed.array->attribs[FRAG_ATTRIB_COL0][i], rgba[j]); + COPY_4V(zoomed.array->attribs[VARYING_SLOT_COL0][i], rgba[j]); } } } @@ -273,10 +273,10 @@ zoom_span( struct gl_context *ctx, GLint imgX, GLint imgY, const SWspan *span, GLint j = unzoom_x(ctx->Pixel.ZoomX, imgX, x0 + i) - span->x; ASSERT(j >= 0); ASSERT(j < (GLint) span->end); - zoomed.array->attribs[FRAG_ATTRIB_COL0][i][0] = rgb[j][0]; - zoomed.array->attribs[FRAG_ATTRIB_COL0][i][1] = rgb[j][1]; - zoomed.array->attribs[FRAG_ATTRIB_COL0][i][2] = rgb[j][2]; - zoomed.array->attribs[FRAG_ATTRIB_COL0][i][3] = 1.0F; + zoomed.array->attribs[VARYING_SLOT_COL0][i][0] = rgb[j][0]; + zoomed.array->attribs[VARYING_SLOT_COL0][i][1] = rgb[j][1]; + zoomed.array->attribs[VARYING_SLOT_COL0][i][2] = rgb[j][2]; + zoomed.array->attribs[VARYING_SLOT_COL0][i][3] = 1.0F; } } } diff --git a/mesalib/src/mesa/swrast/swrast.h b/mesalib/src/mesa/swrast/swrast.h index 97cc5ee63..82555ae6a 100644 --- a/mesalib/src/mesa/swrast/swrast.h +++ b/mesalib/src/mesa/swrast/swrast.h @@ -74,7 +74,7 @@ * improve its usefulness as a fallback mechanism for hardware * drivers. * - * wpos = attr[FRAG_ATTRIB_WPOS] and MUST BE THE FIRST values in the + * wpos = attr[VARYING_SLOT_POS] and MUST BE THE FIRST values in the * vertex because of the tnl clipping code. * wpos[0] and [1] are the screen-coords of SWvertex. @@ -98,13 +98,13 @@ * primitives unaccelerated), hook in swrast_setup instead. */ typedef struct { - GLfloat attrib[FRAG_ATTRIB_MAX][4]; + GLfloat attrib[VARYING_SLOT_MAX][4]; GLchan color[4]; /** integer color */ GLfloat pointSize; } SWvertex; -#define FRAG_ATTRIB_CI FRAG_ATTRIB_COL0 +#define VARYING_SLOT_CI VARYING_SLOT_COL0 struct swrast_device_driver; diff --git a/mesalib/src/mesa/swrast_setup/ss_context.c b/mesalib/src/mesa/swrast_setup/ss_context.c index 9444611f1..5847a7682 100644 --- a/mesalib/src/mesa/swrast_setup/ss_context.c +++ b/mesalib/src/mesa/swrast_setup/ss_context.c @@ -125,22 +125,22 @@ setup_vertex_format(struct gl_context *ctx) swsetup->intColors = intColors; - EMIT_ATTR( _TNL_ATTRIB_POS, EMIT_4F_VIEWPORT, attrib[FRAG_ATTRIB_WPOS] ); + EMIT_ATTR( _TNL_ATTRIB_POS, EMIT_4F_VIEWPORT, attrib[VARYING_SLOT_POS] ); if (index_bitset & BITFIELD64_BIT(_TNL_ATTRIB_COLOR0)) { if (swsetup->intColors) EMIT_ATTR( _TNL_ATTRIB_COLOR0, EMIT_4CHAN_4F_RGBA, color ); else - EMIT_ATTR( _TNL_ATTRIB_COLOR0, EMIT_4F, attrib[FRAG_ATTRIB_COL0]); + EMIT_ATTR( _TNL_ATTRIB_COLOR0, EMIT_4F, attrib[VARYING_SLOT_COL0]); } if (index_bitset & BITFIELD64_BIT(_TNL_ATTRIB_COLOR1)) { - EMIT_ATTR( _TNL_ATTRIB_COLOR1, EMIT_4F, attrib[FRAG_ATTRIB_COL1]); + EMIT_ATTR( _TNL_ATTRIB_COLOR1, EMIT_4F, attrib[VARYING_SLOT_COL1]); } if (index_bitset & BITFIELD64_BIT(_TNL_ATTRIB_FOG)) { const GLint emit = ctx->FragmentProgram._Current ? EMIT_4F : EMIT_1F; - EMIT_ATTR( _TNL_ATTRIB_FOG, emit, attrib[FRAG_ATTRIB_FOGC]); + EMIT_ATTR( _TNL_ATTRIB_FOG, emit, attrib[VARYING_SLOT_FOGC]); } if (index_bitset & BITFIELD64_RANGE(_TNL_ATTRIB_TEX0, _TNL_NUM_TEX)) @@ -148,7 +148,7 @@ setup_vertex_format(struct gl_context *ctx) for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++) { if (index_bitset & BITFIELD64_BIT(_TNL_ATTRIB_TEX(i))) { EMIT_ATTR( _TNL_ATTRIB_TEX(i), EMIT_4F, - attrib[FRAG_ATTRIB_TEX0 + i] ); + attrib[VARYING_SLOT_TEX0 + i] ); } } } @@ -158,7 +158,7 @@ setup_vertex_format(struct gl_context *ctx) for (i = 0; i < ctx->Const.MaxVarying; i++) { if (index_bitset & BITFIELD64_BIT(_TNL_ATTRIB_GENERIC(i))) { EMIT_ATTR( _TNL_ATTRIB_GENERIC(i), VARYING_EMIT_STYLE, - attrib[FRAG_ATTRIB_VAR0 + i] ); + attrib[VARYING_SLOT_VAR0 + i] ); } } } @@ -271,29 +271,29 @@ _swsetup_Translate( struct gl_context *ctx, const void *vertex, SWvertex *dest ) _tnl_get_attr( ctx, vertex, _TNL_ATTRIB_POS, tmp ); - dest->attrib[FRAG_ATTRIB_WPOS][0] = m[0] * tmp[0] + m[12]; - dest->attrib[FRAG_ATTRIB_WPOS][1] = m[5] * tmp[1] + m[13]; - dest->attrib[FRAG_ATTRIB_WPOS][2] = m[10] * tmp[2] + m[14]; - dest->attrib[FRAG_ATTRIB_WPOS][3] = tmp[3]; + dest->attrib[VARYING_SLOT_POS][0] = m[0] * tmp[0] + m[12]; + dest->attrib[VARYING_SLOT_POS][1] = m[5] * tmp[1] + m[13]; + dest->attrib[VARYING_SLOT_POS][2] = m[10] * tmp[2] + m[14]; + dest->attrib[VARYING_SLOT_POS][3] = tmp[3]; /** XXX try to limit these loops someday */ for (i = 0 ; i < ctx->Const.MaxTextureCoordUnits ; i++) _tnl_get_attr( ctx, vertex, _TNL_ATTRIB_TEX0 + i, - dest->attrib[FRAG_ATTRIB_TEX0 + i] ); + dest->attrib[VARYING_SLOT_TEX0 + i] ); for (i = 0 ; i < ctx->Const.MaxVarying ; i++) _tnl_get_attr( ctx, vertex, _TNL_ATTRIB_GENERIC0 + i, - dest->attrib[FRAG_ATTRIB_VAR0 + i] ); + dest->attrib[VARYING_SLOT_VAR0 + i] ); _tnl_get_attr( ctx, vertex, _TNL_ATTRIB_COLOR0, - dest->attrib[FRAG_ATTRIB_COL0] ); + dest->attrib[VARYING_SLOT_COL0] ); UNCLAMPED_FLOAT_TO_RGBA_CHAN( dest->color, tmp ); _tnl_get_attr( ctx, vertex, _TNL_ATTRIB_COLOR1, - dest->attrib[FRAG_ATTRIB_COL1]); + dest->attrib[VARYING_SLOT_COL1]); _tnl_get_attr( ctx, vertex, _TNL_ATTRIB_FOG, tmp ); - dest->attrib[FRAG_ATTRIB_FOGC][0] = tmp[0]; + dest->attrib[VARYING_SLOT_FOGC][0] = tmp[0]; /* XXX See _tnl_get_attr about pointsize ... */ _tnl_get_attr( ctx, vertex, _TNL_ATTRIB_POINTSIZE, tmp ); diff --git a/mesalib/src/mesa/swrast_setup/ss_triangle.c b/mesalib/src/mesa/swrast_setup/ss_triangle.c index 5d1c70e94..5f4a997ee 100644 --- a/mesalib/src/mesa/swrast_setup/ss_triangle.c +++ b/mesalib/src/mesa/swrast_setup/ss_triangle.c @@ -137,21 +137,21 @@ static void _swsetup_render_tri(struct gl_context *ctx, /* save colors/indexes for v0, v1 vertices */ COPY_CHAN4(c[0], v0->color); COPY_CHAN4(c[1], v1->color); - COPY_4V(s[0], v0->attrib[FRAG_ATTRIB_COL1]); - COPY_4V(s[1], v1->attrib[FRAG_ATTRIB_COL1]); + COPY_4V(s[0], v0->attrib[VARYING_SLOT_COL1]); + COPY_4V(s[1], v1->attrib[VARYING_SLOT_COL1]); /* copy v2 color/indexes to v0, v1 indexes */ COPY_CHAN4(v0->color, v2->color); COPY_CHAN4(v1->color, v2->color); - COPY_4V(v0->attrib[FRAG_ATTRIB_COL1], v2->attrib[FRAG_ATTRIB_COL1]); - COPY_4V(v1->attrib[FRAG_ATTRIB_COL1], v2->attrib[FRAG_ATTRIB_COL1]); + COPY_4V(v0->attrib[VARYING_SLOT_COL1], v2->attrib[VARYING_SLOT_COL1]); + COPY_4V(v1->attrib[VARYING_SLOT_COL1], v2->attrib[VARYING_SLOT_COL1]); render(ctx, ef, e0, e1, e2, v0, v1, v2); COPY_CHAN4(v0->color, c[0]); COPY_CHAN4(v1->color, c[1]); - COPY_4V(v0->attrib[FRAG_ATTRIB_COL1], s[0]); - COPY_4V(v1->attrib[FRAG_ATTRIB_COL1], s[1]); + COPY_4V(v0->attrib[VARYING_SLOT_COL1], s[0]); + COPY_4V(v1->attrib[VARYING_SLOT_COL1], s[1]); } else { render(ctx, ef, e0, e1, e2, v0, v1, v2); diff --git a/mesalib/src/mesa/swrast_setup/ss_tritmp.h b/mesalib/src/mesa/swrast_setup/ss_tritmp.h index 5844ad594..11742067f 100644 --- a/mesalib/src/mesa/swrast_setup/ss_tritmp.h +++ b/mesalib/src/mesa/swrast_setup/ss_tritmp.h @@ -50,10 +50,10 @@ static void TAG(triangle)(struct gl_context *ctx, GLuint e0, GLuint e1, GLuint e if (IND & (SS_TWOSIDE_BIT | SS_OFFSET_BIT | SS_UNFILLED_BIT)) { - GLfloat ex = v[0]->attrib[FRAG_ATTRIB_WPOS][0] - v[2]->attrib[FRAG_ATTRIB_WPOS][0]; - GLfloat ey = v[0]->attrib[FRAG_ATTRIB_WPOS][1] - v[2]->attrib[FRAG_ATTRIB_WPOS][1]; - GLfloat fx = v[1]->attrib[FRAG_ATTRIB_WPOS][0] - v[2]->attrib[FRAG_ATTRIB_WPOS][0]; - GLfloat fy = v[1]->attrib[FRAG_ATTRIB_WPOS][1] - v[2]->attrib[FRAG_ATTRIB_WPOS][1]; + GLfloat ex = v[0]->attrib[VARYING_SLOT_POS][0] - v[2]->attrib[VARYING_SLOT_POS][0]; + GLfloat ey = v[0]->attrib[VARYING_SLOT_POS][1] - v[2]->attrib[VARYING_SLOT_POS][1]; + GLfloat fx = v[1]->attrib[VARYING_SLOT_POS][0] - v[2]->attrib[VARYING_SLOT_POS][0]; + GLfloat fy = v[1]->attrib[VARYING_SLOT_POS][1] - v[2]->attrib[VARYING_SLOT_POS][1]; GLfloat cc = ex*fy - ey*fx; if (IND & (SS_TWOSIDE_BIT | SS_UNFILLED_BIT)) @@ -74,9 +74,9 @@ static void TAG(triangle)(struct gl_context *ctx, GLuint e0, GLuint e1, GLuint e COPY_CHAN4(saved_color[2], v[2]->color); } else { - COPY_4V(saved_col0[0], v[0]->attrib[FRAG_ATTRIB_COL0]); - COPY_4V(saved_col0[1], v[1]->attrib[FRAG_ATTRIB_COL0]); - COPY_4V(saved_col0[2], v[2]->attrib[FRAG_ATTRIB_COL0]); + COPY_4V(saved_col0[0], v[0]->attrib[VARYING_SLOT_COL0]); + COPY_4V(saved_col0[1], v[1]->attrib[VARYING_SLOT_COL0]); + COPY_4V(saved_col0[2], v[2]->attrib[VARYING_SLOT_COL0]); } if (VB->BackfaceColorPtr->stride) { @@ -86,9 +86,9 @@ static void TAG(triangle)(struct gl_context *ctx, GLuint e0, GLuint e1, GLuint e SS_COLOR(v[2]->color, vbcolor[e2]); } else { - COPY_4V(v[0]->attrib[FRAG_ATTRIB_COL0], vbcolor[e0]); - COPY_4V(v[1]->attrib[FRAG_ATTRIB_COL0], vbcolor[e1]); - COPY_4V(v[2]->attrib[FRAG_ATTRIB_COL0], vbcolor[e2]); + COPY_4V(v[0]->attrib[VARYING_SLOT_COL0], vbcolor[e0]); + COPY_4V(v[1]->attrib[VARYING_SLOT_COL0], vbcolor[e1]); + COPY_4V(v[2]->attrib[VARYING_SLOT_COL0], vbcolor[e2]); } } else { @@ -99,9 +99,9 @@ static void TAG(triangle)(struct gl_context *ctx, GLuint e0, GLuint e1, GLuint e SS_COLOR(v[2]->color, vbcolor[0]); } else { - COPY_4V(v[0]->attrib[FRAG_ATTRIB_COL0], vbcolor[0]); - COPY_4V(v[1]->attrib[FRAG_ATTRIB_COL0], vbcolor[0]); - COPY_4V(v[2]->attrib[FRAG_ATTRIB_COL0], vbcolor[0]); + COPY_4V(v[0]->attrib[VARYING_SLOT_COL0], vbcolor[0]); + COPY_4V(v[1]->attrib[VARYING_SLOT_COL0], vbcolor[0]); + COPY_4V(v[2]->attrib[VARYING_SLOT_COL0], vbcolor[0]); } } } @@ -109,19 +109,19 @@ static void TAG(triangle)(struct gl_context *ctx, GLuint e0, GLuint e1, GLuint e if (VB->BackfaceSecondaryColorPtr) { GLfloat (*vbspec)[4] = VB->BackfaceSecondaryColorPtr->data; - COPY_4V(saved_spec[0], v[0]->attrib[FRAG_ATTRIB_COL1]); - COPY_4V(saved_spec[1], v[1]->attrib[FRAG_ATTRIB_COL1]); - COPY_4V(saved_spec[2], v[2]->attrib[FRAG_ATTRIB_COL1]); + COPY_4V(saved_spec[0], v[0]->attrib[VARYING_SLOT_COL1]); + COPY_4V(saved_spec[1], v[1]->attrib[VARYING_SLOT_COL1]); + COPY_4V(saved_spec[2], v[2]->attrib[VARYING_SLOT_COL1]); if (VB->BackfaceSecondaryColorPtr->stride) { - SS_SPEC(v[0]->attrib[FRAG_ATTRIB_COL1], vbspec[e0]); - SS_SPEC(v[1]->attrib[FRAG_ATTRIB_COL1], vbspec[e1]); - SS_SPEC(v[2]->attrib[FRAG_ATTRIB_COL1], vbspec[e2]); + SS_SPEC(v[0]->attrib[VARYING_SLOT_COL1], vbspec[e0]); + SS_SPEC(v[1]->attrib[VARYING_SLOT_COL1], vbspec[e1]); + SS_SPEC(v[2]->attrib[VARYING_SLOT_COL1], vbspec[e2]); } else { - SS_SPEC(v[0]->attrib[FRAG_ATTRIB_COL1], vbspec[0]); - SS_SPEC(v[1]->attrib[FRAG_ATTRIB_COL1], vbspec[0]); - SS_SPEC(v[2]->attrib[FRAG_ATTRIB_COL1], vbspec[0]); + SS_SPEC(v[0]->attrib[VARYING_SLOT_COL1], vbspec[0]); + SS_SPEC(v[1]->attrib[VARYING_SLOT_COL1], vbspec[0]); + SS_SPEC(v[2]->attrib[VARYING_SLOT_COL1], vbspec[0]); } } } @@ -131,9 +131,9 @@ static void TAG(triangle)(struct gl_context *ctx, GLuint e0, GLuint e1, GLuint e if (IND & SS_OFFSET_BIT) { const GLfloat max = ctx->DrawBuffer->_DepthMaxF; /* save original Z values (restored later) */ - z[0] = v[0]->attrib[FRAG_ATTRIB_WPOS][2]; - z[1] = v[1]->attrib[FRAG_ATTRIB_WPOS][2]; - z[2] = v[2]->attrib[FRAG_ATTRIB_WPOS][2]; + z[0] = v[0]->attrib[VARYING_SLOT_POS][2]; + z[1] = v[1]->attrib[VARYING_SLOT_POS][2]; + z[2] = v[2]->attrib[VARYING_SLOT_POS][2]; /* Note that Z values are already scaled to [0,65535] (for example) * so no MRD value is used here. */ @@ -147,31 +147,31 @@ static void TAG(triangle)(struct gl_context *ctx, GLuint e0, GLuint e1, GLuint e offset += MAX2(dzdx, dzdy) * ctx->Polygon.OffsetFactor; } /* new Z values */ - oz0 = CLAMP(v[0]->attrib[FRAG_ATTRIB_WPOS][2] + offset, 0.0F, max); - oz1 = CLAMP(v[1]->attrib[FRAG_ATTRIB_WPOS][2] + offset, 0.0F, max); - oz2 = CLAMP(v[2]->attrib[FRAG_ATTRIB_WPOS][2] + offset, 0.0F, max); + oz0 = CLAMP(v[0]->attrib[VARYING_SLOT_POS][2] + offset, 0.0F, max); + oz1 = CLAMP(v[1]->attrib[VARYING_SLOT_POS][2] + offset, 0.0F, max); + oz2 = CLAMP(v[2]->attrib[VARYING_SLOT_POS][2] + offset, 0.0F, max); } } if (mode == GL_POINT) { if ((IND & SS_OFFSET_BIT) && ctx->Polygon.OffsetPoint) { - v[0]->attrib[FRAG_ATTRIB_WPOS][2] = oz0; - v[1]->attrib[FRAG_ATTRIB_WPOS][2] = oz1; - v[2]->attrib[FRAG_ATTRIB_WPOS][2] = oz2; + v[0]->attrib[VARYING_SLOT_POS][2] = oz0; + v[1]->attrib[VARYING_SLOT_POS][2] = oz1; + v[2]->attrib[VARYING_SLOT_POS][2] = oz2; } _swsetup_render_tri(ctx, e0, e1, e2, facing, _swsetup_edge_render_point_tri); } else if (mode == GL_LINE) { if ((IND & SS_OFFSET_BIT) && ctx->Polygon.OffsetLine) { - v[0]->attrib[FRAG_ATTRIB_WPOS][2] = oz0; - v[1]->attrib[FRAG_ATTRIB_WPOS][2] = oz1; - v[2]->attrib[FRAG_ATTRIB_WPOS][2] = oz2; + v[0]->attrib[VARYING_SLOT_POS][2] = oz0; + v[1]->attrib[VARYING_SLOT_POS][2] = oz1; + v[2]->attrib[VARYING_SLOT_POS][2] = oz2; } _swsetup_render_tri(ctx, e0, e1, e2, facing, _swsetup_edge_render_line_tri); } else { if ((IND & SS_OFFSET_BIT) && ctx->Polygon.OffsetFill) { - v[0]->attrib[FRAG_ATTRIB_WPOS][2] = oz0; - v[1]->attrib[FRAG_ATTRIB_WPOS][2] = oz1; - v[2]->attrib[FRAG_ATTRIB_WPOS][2] = oz2; + v[0]->attrib[VARYING_SLOT_POS][2] = oz0; + v[1]->attrib[VARYING_SLOT_POS][2] = oz1; + v[2]->attrib[VARYING_SLOT_POS][2] = oz2; } _swrast_Triangle( ctx, v[0], v[1], v[2] ); } @@ -180,9 +180,9 @@ static void TAG(triangle)(struct gl_context *ctx, GLuint e0, GLuint e1, GLuint e * Restore original vertex colors, etc. */ if (IND & SS_OFFSET_BIT) { - v[0]->attrib[FRAG_ATTRIB_WPOS][2] = z[0]; - v[1]->attrib[FRAG_ATTRIB_WPOS][2] = z[1]; - v[2]->attrib[FRAG_ATTRIB_WPOS][2] = z[2]; + v[0]->attrib[VARYING_SLOT_POS][2] = z[0]; + v[1]->attrib[VARYING_SLOT_POS][2] = z[1]; + v[2]->attrib[VARYING_SLOT_POS][2] = z[2]; } if (IND & SS_TWOSIDE_BIT) { @@ -194,16 +194,16 @@ static void TAG(triangle)(struct gl_context *ctx, GLuint e0, GLuint e1, GLuint e COPY_CHAN4(v[2]->color, saved_color[2]); } else { - COPY_4V(v[0]->attrib[FRAG_ATTRIB_COL0], saved_col0[0]); - COPY_4V(v[1]->attrib[FRAG_ATTRIB_COL0], saved_col0[1]); - COPY_4V(v[2]->attrib[FRAG_ATTRIB_COL0], saved_col0[2]); + COPY_4V(v[0]->attrib[VARYING_SLOT_COL0], saved_col0[0]); + COPY_4V(v[1]->attrib[VARYING_SLOT_COL0], saved_col0[1]); + COPY_4V(v[2]->attrib[VARYING_SLOT_COL0], saved_col0[2]); } } if (VB->BackfaceSecondaryColorPtr) { - COPY_4V(v[0]->attrib[FRAG_ATTRIB_COL1], saved_spec[0]); - COPY_4V(v[1]->attrib[FRAG_ATTRIB_COL1], saved_spec[1]); - COPY_4V(v[2]->attrib[FRAG_ATTRIB_COL1], saved_spec[2]); + COPY_4V(v[0]->attrib[VARYING_SLOT_COL1], saved_spec[0]); + COPY_4V(v[1]->attrib[VARYING_SLOT_COL1], saved_spec[1]); + COPY_4V(v[2]->attrib[VARYING_SLOT_COL1], saved_spec[2]); } } } diff --git a/mesalib/src/mesa/tnl/t_context.c b/mesalib/src/mesa/tnl/t_context.c index df3a11666..ed31b9c45 100644 --- a/mesalib/src/mesa/tnl/t_context.c +++ b/mesalib/src/mesa/tnl/t_context.c @@ -142,7 +142,7 @@ _tnl_InvalidateState( struct gl_context *ctx, GLuint new_state ) */ tnl->render_inputs_bitset = BITFIELD64_BIT(_TNL_ATTRIB_POS); - if (!fp || (fp->Base.InputsRead & FRAG_BIT_COL0)) { + if (!fp || (fp->Base.InputsRead & VARYING_BIT_COL0)) { tnl->render_inputs_bitset |= BITFIELD64_BIT(_TNL_ATTRIB_COLOR0); } @@ -151,13 +151,13 @@ _tnl_InvalidateState( struct gl_context *ctx, GLuint new_state ) for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) { if (ctx->Texture._EnabledCoordUnits & (1 << i) || - (fp && fp->Base.InputsRead & FRAG_BIT_TEX(i))) { + (fp && fp->Base.InputsRead & VARYING_BIT_TEX(i))) { tnl->render_inputs_bitset |= BITFIELD64_BIT(_TNL_ATTRIB_TEX(i)); } } if (ctx->Fog.Enabled - || (fp != NULL && (fp->Base.InputsRead & FRAG_BIT_FOGC) != 0)) { + || (fp != NULL && (fp->Base.InputsRead & VARYING_BIT_FOGC) != 0)) { /* Either fixed-function fog or a fragment program needs fog coord. */ tnl->render_inputs_bitset |= BITFIELD64_BIT(_TNL_ATTRIB_FOG); @@ -177,7 +177,7 @@ _tnl_InvalidateState( struct gl_context *ctx, GLuint new_state ) if (vp) { GLuint i; for (i = 0; i < MAX_VARYING; i++) { - if (vp->Base.OutputsWritten & BITFIELD64_BIT(VERT_RESULT_VAR0 + i)) { + if (vp->Base.OutputsWritten & BITFIELD64_BIT(VARYING_SLOT_VAR0 + i)) { tnl->render_inputs_bitset |= BITFIELD64_BIT(_TNL_ATTRIB_GENERIC(i)); } } diff --git a/mesalib/src/mesa/tnl/t_context.h b/mesalib/src/mesa/tnl/t_context.h index 62dde4f4e..c9ff1246d 100644 --- a/mesalib/src/mesa/tnl/t_context.h +++ b/mesalib/src/mesa/tnl/t_context.h @@ -133,7 +133,7 @@ enum { _TNL_ATTRIB_MAT_FRONT_INDEXES = 27, _TNL_ATTRIB_MAT_BACK_INDEXES = 28, - /* This is really a VERT_RESULT, not an attrib. Need to fix + /* This is really a VARYING_SLOT, not an attrib. Need to fix * tnl to understand the difference. */ _TNL_ATTRIB_POINTSIZE = 16, diff --git a/mesalib/src/mesa/tnl/t_pipeline.c b/mesalib/src/mesa/tnl/t_pipeline.c index 881d5d5f5..806d9ca6e 100644 --- a/mesalib/src/mesa/tnl/t_pipeline.c +++ b/mesalib/src/mesa/tnl/t_pipeline.c @@ -94,7 +94,7 @@ static GLuint check_output_changes( struct gl_context *ctx ) #if 0 TNLcontext *tnl = TNL_CONTEXT(ctx); - for (i = 0; i < VERT_RESULT_MAX; i++) { + for (i = 0; i < VARYING_SLOT_MAX; i++) { if (tnl->vb.ResultPtr[i]->size != tnl->last_result_size[i] || tnl->vb.ResultPtr[i]->stride != tnl->last_result_stride[i]) { tnl->last_result_size[i] = tnl->vb.ResultPtr[i]->size; diff --git a/mesalib/src/mesa/tnl/t_vb_program.c b/mesalib/src/mesa/tnl/t_vb_program.c index 8ff300cd7..452285f6b 100644 --- a/mesalib/src/mesa/tnl/t_vb_program.c +++ b/mesalib/src/mesa/tnl/t_vb_program.c @@ -63,7 +63,7 @@ check_float(float x) */ struct vp_stage_data { /** The results of running the vertex program go into these arrays. */ - GLvector4f results[VERT_RESULT_MAX]; + GLvector4f results[VARYING_SLOT_MAX]; GLvector4f ndcCoords; /**< normalized device coords */ GLubyte *clipmask; /**< clip flags */ @@ -300,7 +300,7 @@ run_vp( struct gl_context *ctx, struct tnl_pipeline_stage *stage ) struct vertex_buffer *VB = &tnl->vb; struct gl_vertex_program *program = ctx->VertexProgram._Current; struct gl_program_machine *machine = &store->machine; - GLuint outputs[VERT_RESULT_MAX], numOutputs; + GLuint outputs[VARYING_SLOT_MAX], numOutputs; GLuint i, j; if (!program) @@ -311,7 +311,7 @@ run_vp( struct gl_context *ctx, struct tnl_pipeline_stage *stage ) /* make list of outputs to save some time below */ numOutputs = 0; - for (i = 0; i < VERT_RESULT_MAX; i++) { + for (i = 0; i < VARYING_SLOT_MAX; i++) { if (program->Base.OutputsWritten & BITFIELD64_BIT(i)) { outputs[numOutputs++] = i; } @@ -321,7 +321,7 @@ run_vp( struct gl_context *ctx, struct tnl_pipeline_stage *stage ) * memory that would never be used if we don't run the software tnl pipeline. */ if (!store->results[0].storage) { - for (i = 0; i < VERT_RESULT_MAX; i++) { + for (i = 0; i < VARYING_SLOT_MAX; i++) { assert(!store->results[i].storage); _mesa_vector4f_alloc( &store->results[i], 0, VB->Size, 32 ); store->results[i].size = 4; @@ -386,10 +386,10 @@ run_vp( struct gl_context *ctx, struct tnl_pipeline_stage *stage ) } /* FOGC is a special case. Fragment shader expects (f,0,0,1) */ - if (program->Base.OutputsWritten & BITFIELD64_BIT(VERT_RESULT_FOGC)) { - store->results[VERT_RESULT_FOGC].data[i][1] = 0.0; - store->results[VERT_RESULT_FOGC].data[i][2] = 0.0; - store->results[VERT_RESULT_FOGC].data[i][3] = 1.0; + if (program->Base.OutputsWritten & BITFIELD64_BIT(VARYING_SLOT_FOGC)) { + store->results[VARYING_SLOT_FOGC].data[i][1] = 0.0; + store->results[VARYING_SLOT_FOGC].data[i][2] = 0.0; + store->results[VARYING_SLOT_FOGC].data[i][3] = 1.0; } #ifdef NAN_CHECK ASSERT(machine->Outputs[0][3] != 0.0F); @@ -433,28 +433,28 @@ run_vp( struct gl_context *ctx, struct tnl_pipeline_stage *stage ) /* Setup the VB pointers so that the next pipeline stages get * their data from the right place (the program output arrays). */ - VB->ClipPtr = &store->results[VERT_RESULT_HPOS]; + VB->ClipPtr = &store->results[VARYING_SLOT_POS]; VB->ClipPtr->size = 4; VB->ClipPtr->count = VB->Count; } - VB->AttribPtr[VERT_ATTRIB_COLOR0] = &store->results[VERT_RESULT_COL0]; - VB->AttribPtr[VERT_ATTRIB_COLOR1] = &store->results[VERT_RESULT_COL1]; - VB->AttribPtr[VERT_ATTRIB_FOG] = &store->results[VERT_RESULT_FOGC]; - VB->AttribPtr[_TNL_ATTRIB_POINTSIZE] = &store->results[VERT_RESULT_PSIZ]; - VB->BackfaceColorPtr = &store->results[VERT_RESULT_BFC0]; - VB->BackfaceSecondaryColorPtr = &store->results[VERT_RESULT_BFC1]; + VB->AttribPtr[VERT_ATTRIB_COLOR0] = &store->results[VARYING_SLOT_COL0]; + VB->AttribPtr[VERT_ATTRIB_COLOR1] = &store->results[VARYING_SLOT_COL1]; + VB->AttribPtr[VERT_ATTRIB_FOG] = &store->results[VARYING_SLOT_FOGC]; + VB->AttribPtr[_TNL_ATTRIB_POINTSIZE] = &store->results[VARYING_SLOT_PSIZ]; + VB->BackfaceColorPtr = &store->results[VARYING_SLOT_BFC0]; + VB->BackfaceSecondaryColorPtr = &store->results[VARYING_SLOT_BFC1]; for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) { VB->AttribPtr[_TNL_ATTRIB_TEX0 + i] - = &store->results[VERT_RESULT_TEX0 + i]; + = &store->results[VARYING_SLOT_TEX0 + i]; } for (i = 0; i < ctx->Const.MaxVarying; i++) { - if (program->Base.OutputsWritten & BITFIELD64_BIT(VERT_RESULT_VAR0 + i)) { + if (program->Base.OutputsWritten & BITFIELD64_BIT(VARYING_SLOT_VAR0 + i)) { /* Note: varying results get put into the generic attributes */ VB->AttribPtr[VERT_ATTRIB_GENERIC0+i] - = &store->results[VERT_RESULT_VAR0 + i]; + = &store->results[VARYING_SLOT_VAR0 + i]; } } @@ -502,7 +502,7 @@ dtr(struct tnl_pipeline_stage *stage) GLuint i; /* free the vertex program result arrays */ - for (i = 0; i < VERT_RESULT_MAX; i++) + for (i = 0; i < VARYING_SLOT_MAX; i++) _mesa_vector4f_free( &store->results[i] ); /* free misc arrays */ |