aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2015-04-30 23:24:30 +0200
committermarha <marha@users.sourceforge.net>2015-04-30 23:24:30 +0200
commita71d524ecad48837e0124a03124bc05f59a48be7 (patch)
tree87c5ba1711e03cb9692e23cc685b938571b52d76
parent2a00e489122f6c4b525090dbdba2855a2ea2d519 (diff)
downloadvcxsrv-a71d524ecad48837e0124a03124bc05f59a48be7.tar.gz
vcxsrv-a71d524ecad48837e0124a03124bc05f59a48be7.tar.bz2
vcxsrv-a71d524ecad48837e0124a03124bc05f59a48be7.zip
fontconfig pixman libX11 mesa git update 30 Apr 2015
libX11 commit d3415d1f052530760b4617db45affcb984cfe35c pixman commit e0c0153d8e5d42c08c2b9bd2cf2123bff2c48d75 fontconfig commit 4a6f5efd5f6a468e1872d58e589bcf30ba88e2fd mesa commit 1ac7db07b363207e8ded9259f84bbcaa084b8667
-rw-r--r--fontconfig/conf.d/10-scale-bitmap-fonts.conf32
-rw-r--r--fontconfig/doc/fontconfig-user.sgml2
-rw-r--r--fontconfig/src/fcfreetype.c84
-rw-r--r--libX11/nls/locale.alias.pre6
-rw-r--r--mesalib/Android.common.mk18
-rw-r--r--mesalib/Android.mk10
-rw-r--r--mesalib/CleanSpec.mk8
-rw-r--r--mesalib/docs/GL3.txt6
-rw-r--r--mesalib/docs/VERSIONS4
-rw-r--r--mesalib/docs/index.html8
-rw-r--r--mesalib/docs/libGL.txt2
-rw-r--r--mesalib/docs/relnotes.html1
-rw-r--r--mesalib/docs/relnotes/10.0.3.html2
-rw-r--r--mesalib/docs/relnotes/10.5.4.html125
-rw-r--r--mesalib/docs/relnotes/10.6.0.html12
-rw-r--r--mesalib/docs/relnotes/7.10.html2
-rw-r--r--mesalib/docs/versions.html4
-rw-r--r--mesalib/docs/viewperf.html7
-rw-r--r--mesalib/include/GL/internal/dri_interface.h60
-rw-r--r--mesalib/scons/llvm.py33
-rw-r--r--mesalib/src/gallium/SConscript5
-rw-r--r--mesalib/src/gallium/auxiliary/Android.mk5
-rw-r--r--mesalib/src/gallium/auxiliary/hud/hud_context.c163
-rw-r--r--mesalib/src/gallium/auxiliary/hud/hud_private.h4
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_tile.c4
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_video.h36
-rw-r--r--mesalib/src/glsl/Android.gen.mk66
-rw-r--r--mesalib/src/glsl/Android.mk13
-rw-r--r--mesalib/src/glsl/ast_function.cpp2
-rw-r--r--mesalib/src/glsl/ast_to_hir.cpp4
-rw-r--r--mesalib/src/glsl/glcpp/glcpp-parse.y2
-rw-r--r--mesalib/src/glsl/glsl_types.cpp23
-rw-r--r--mesalib/src/glsl/glsl_types.h7
-rw-r--r--mesalib/src/glsl/link_uniforms.cpp2
-rw-r--r--mesalib/src/glsl/linker.cpp3
-rw-r--r--mesalib/src/glsl/lower_packed_varyings.cpp8
-rw-r--r--mesalib/src/glsl/lower_packing_builtins.cpp8
-rw-r--r--mesalib/src/glsl/nir/nir.c112
-rw-r--r--mesalib/src/glsl/nir/nir.h17
-rw-r--r--mesalib/src/glsl/nir/nir_array.h96
-rw-r--r--mesalib/src/glsl/nir/nir_from_ssa.c2
-rw-r--r--mesalib/src/glsl/nir/nir_lower_locals_to_regs.c148
-rw-r--r--mesalib/src/glsl/nir/nir_lower_to_source_mods.c7
-rw-r--r--mesalib/src/glsl/nir/nir_lower_var_copies.c24
-rw-r--r--mesalib/src/glsl/nir/nir_lower_vars_to_ssa.c120
-rw-r--r--mesalib/src/glsl/nir/nir_opt_algebraic.py1
-rw-r--r--mesalib/src/glsl/nir/nir_print.c2
-rw-r--r--mesalib/src/glsl/nir/nir_types.cpp2
-rw-r--r--mesalib/src/glsl/opt_algebraic.cpp20
-rw-r--r--mesalib/src/glsl/opt_dead_builtin_varyings.cpp8
-rw-r--r--mesalib/src/glsl/opt_function_inlining.cpp2
-rw-r--r--mesalib/src/glsl/standalone_scaffolding.cpp3
-rw-r--r--mesalib/src/loader/Android.mk2
-rw-r--r--mesalib/src/loader/loader.h2
-rw-r--r--mesalib/src/mapi/Android.mk2
-rw-r--r--mesalib/src/mapi/glapi/gen/glX_proto_send.py2
-rw-r--r--mesalib/src/mapi/glapi/gen/glX_proto_size.py2
-rw-r--r--mesalib/src/mapi/glapi/gen/gl_x86-64_asm.py2
-rw-r--r--mesalib/src/mapi/glapi/glapi_entrypoint.c2
-rw-r--r--mesalib/src/mesa/Android.gen.mk23
-rw-r--r--mesalib/src/mesa/Android.libmesa_dricore.mk15
-rw-r--r--mesalib/src/mesa/Android.libmesa_glsl_utils.mk10
-rw-r--r--mesalib/src/mesa/Android.libmesa_st_mesa.mk9
-rw-r--r--mesalib/src/mesa/Android.mesa_gen_matypes.mk1
-rw-r--r--mesalib/src/mesa/drivers/common/meta.c1
-rw-r--r--mesalib/src/mesa/drivers/dri/Android.mk11
-rw-r--r--mesalib/src/mesa/drivers/dri/common/Android.mk38
-rw-r--r--mesalib/src/mesa/drivers/dri/common/drirc4
-rw-r--r--mesalib/src/mesa/main/compiler.h5
-rw-r--r--mesalib/src/mesa/main/context.c6
-rw-r--r--mesalib/src/mesa/main/extensions.c2
-rw-r--r--mesalib/src/mesa/main/fbobject.c9
-rw-r--r--mesalib/src/mesa/main/ffvertex_prog.c2
-rw-r--r--mesalib/src/mesa/main/formats.c2
-rw-r--r--mesalib/src/mesa/main/macros.h5
-rw-r--r--mesalib/src/mesa/main/mtypes.h13
-rw-r--r--mesalib/src/mesa/main/shader_query.cpp56
-rw-r--r--mesalib/src/mesa/main/shaderapi.c9
-rw-r--r--mesalib/src/mesa/main/texgetimage.c54
-rw-r--r--mesalib/src/mesa/main/teximage.c7
-rw-r--r--mesalib/src/mesa/main/texobj.c1
-rw-r--r--mesalib/src/mesa/main/texturebarrier.c6
-rw-r--r--mesalib/src/mesa/main/uniform_query.cpp20
-rw-r--r--mesalib/src/mesa/main/version.c63
-rw-r--r--mesalib/src/mesa/math/m_matrix.c2
-rw-r--r--mesalib/src/mesa/program/Android.mk14
-rw-r--r--mesalib/src/mesa/program/hash_table.h4
-rw-r--r--mesalib/src/mesa/program/prog_cache.c2
-rw-r--r--mesalib/src/mesa/program/prog_to_nir.c25
-rw-r--r--mesalib/src/mesa/state_tracker/st_atom_texture.c14
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_flush.c2
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_texture.c2
-rw-r--r--mesalib/src/mesa/state_tracker/st_extensions.c9
-rw-r--r--mesalib/src/mesa/state_tracker/st_format.c19
-rw-r--r--mesalib/src/mesa/swrast/s_texcombine.c2
-rw-r--r--mesalib/src/mesa/tnl/t_vertex.h2
-rw-r--r--mesalib/src/mesa/vbo/vbo_exec_api.c2
-rw-r--r--mesalib/src/mesa/vbo/vbo_save_draw.c2
-rw-r--r--mesalib/src/util/Android.mk42
-rw-r--r--mesalib/src/util/macros.h2
-rw-r--r--pixman/.gitignore1
-rw-r--r--pixman/test/Makefile.sources1
-rw-r--r--pixman/test/affine-bench.c436
103 files changed, 1783 insertions, 531 deletions
diff --git a/fontconfig/conf.d/10-scale-bitmap-fonts.conf b/fontconfig/conf.d/10-scale-bitmap-fonts.conf
index e3bcd46cd..b4e9cb4f2 100644
--- a/fontconfig/conf.d/10-scale-bitmap-fonts.conf
+++ b/fontconfig/conf.d/10-scale-bitmap-fonts.conf
@@ -2,8 +2,13 @@
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
+<!--
+ If font is bitmap, calculate scale factor.
+ Note that color bitmap fonts have scalable=true, while
+ non-color ones have scalable=false. Both groups have outline=false.
+ -->
<match target="font">
- <test name="scalable" compare="eq">
+ <test name="outline" compare="eq">
<bool>false</bool>
</test>
<edit name="pixelsizefixupfactor" mode="assign">
@@ -13,10 +18,20 @@
</divide>
</edit>
</match>
+<!--
+ For non-scalable bitmap fonts (ie. non-color), skip
+ minor scaling if hinting is enabled.
+ -->
<match target="font">
+ <test name="outline" compare="eq">
+ <bool>false</bool>
+ </test>
<test name="scalable" compare="eq">
<bool>false</bool>
</test>
+ <test name="hinting" compare="eq">
+ <bool>true</bool>
+ </test>
<edit name="scalingnotneeded" mode="assign">
<and>
<less>
@@ -30,20 +45,7 @@
</and>
</edit>
</match>
-<!--
- So far we determined the scale factor. Now, check and if
- scaling is NOT desirable, just reset the scale factor to 1.0.
- -->
<match target="font">
- <test name="scalable" compare="eq">
- <bool>false</bool>
- </test>
- <test name="pixelsize" target="pattern" compare="less">
- <double>64</double>
- </test>
- <test name="hinting" compare="eq">
- <bool>true</bool>
- </test>
<test name="scalingnotneeded" compare="eq">
<bool>true</bool>
</test>
@@ -55,7 +57,7 @@
If we *are* going to scale, go ahead and do it.
-->
<match target="font">
- <test name="scalable" compare="eq">
+ <test name="outline" compare="eq">
<bool>false</bool>
</test>
<test name="pixelsizefixupfactor" compare="not_eq">
diff --git a/fontconfig/doc/fontconfig-user.sgml b/fontconfig/doc/fontconfig-user.sgml
index 7b4ad7408..5803929f7 100644
--- a/fontconfig/doc/fontconfig-user.sgml
+++ b/fontconfig/doc/fontconfig-user.sgml
@@ -322,7 +322,7 @@ will be used to store the cache files. If it starts with '~', it refers to
a directory in the users home directory. If 'prefix' is set to "xdg", the value in the XDG_CACHE_HOME environment variable will be added as the path prefix. please see XDG Base Directory Specification for more details.
The default directory is ``$XDG_CACHE_HOME/fontconfig'' and it contains the cache files
named ``<literal>&lt;hash value&gt;</literal>-<literal>&lt;architecture&gt;</literal>.cache-<literal>&lt;version&gt;</literal>'',
-where <literal>&lt;version&gt;</literal> is the font configureation file
+where <literal>&lt;version&gt;</literal> is the font configuration file
version number (currently 5).
</para></refsect2>
<refsect2><title><literal>&lt;include ignore_missing="no" prefix="default"&gt;</literal></title><para>
diff --git a/fontconfig/src/fcfreetype.c b/fontconfig/src/fcfreetype.c
index 50ff3489c..afbd9ac1e 100644
--- a/fontconfig/src/fcfreetype.c
+++ b/fontconfig/src/fcfreetype.c
@@ -978,76 +978,6 @@ FcNoticeFoundry(const FT_String *notice)
return 0;
}
-static FcBool
-FcVendorMatch(const FT_Char vendor[4], const FT_Char *vendor_string)
-{
- /* vendor is not necessarily NUL-terminated. */
- int i, len;
-
- len = strlen((char *) vendor_string);
- if (memcmp(vendor, vendor_string, len) != 0)
- return FcFalse;
- for (i = len; i < 4; i++)
- if (vendor[i] != ' ' && vendor[i] != '\0')
- return FcFalse;
- return FcTrue;
-}
-
-/* This table is partly taken from ttmkfdir by Joerg Pommnitz. */
-
-/* It should not contain useless entries (such as UNKN) nor duplicate
- entries for padding both with spaces and NULs. */
-
-static const struct {
- const FT_Char vendor[5];
- const FcChar8 foundry[13];
-} FcVendorFoundries[] = {
- { "ADBE", "adobe"},
- { "AGFA", "agfa"},
- { "ALTS", "altsys"},
- { "APPL", "apple"},
- { "ARPH", "arphic"},
- { "ATEC", "alltype"},
- { "B&H", "b&h"},
- { "BITS", "bitstream"},
- { "CANO", "cannon"},
- { "CLM", "culmus"},
- { "DYNA", "dynalab"},
- { "EPSN", "epson"},
- { "FJ", "fujitsu"},
- { "IBM", "ibm"},
- { "ITC", "itc"},
- { "IMPR", "impress"},
- { "LARA", "larabiefonts"},
- { "LEAF", "interleaf"},
- { "LETR", "letraset"},
- { "LINO", "linotype"},
- { "MACR", "macromedia"},
- { "MONO", "monotype"},
- { "MS", "microsoft"},
- { "MT", "monotype"},
- { "NEC", "nec"},
- { "PARA", "paratype"},
- { "QMSI", "qms"},
- { "RICO", "ricoh"},
- { "URW", "urw"},
- { "Y&Y", "y&y"}
-};
-
-#define NUM_VENDOR_FOUNDRIES (int) (sizeof (FcVendorFoundries) / sizeof (FcVendorFoundries[0]))
-
-static const FcChar8 *
-FcVendorFoundry(const FT_Char vendor[4])
-{
- int i;
-
- if (vendor)
- for(i = 0; i < NUM_VENDOR_FOUNDRIES; i++)
- if (FcVendorMatch (vendor, FcVendorFoundries[i].vendor))
- return FcVendorFoundries[i].foundry;
- return 0;
-}
-
typedef struct _FcStringConst {
const FcChar8 *name;
int value;
@@ -1239,7 +1169,7 @@ FcFreeTypeQueryFace (const FT_Face face,
#if 0
FcChar8 *family = 0;
#endif
- FcChar8 *complex_;
+ FcChar8 *complex_, *foundry_ = NULL;
const FcChar8 *foundry = 0;
int spacing;
TT_OS2 *os2;
@@ -1315,7 +1245,15 @@ FcFreeTypeQueryFace (const FT_Face face,
*/
if (os2 && os2->version >= 0x0001 && os2->version != 0xffff)
- foundry = FcVendorFoundry(os2->achVendID);
+ {
+ if (os2->achVendID && os2->achVendID[0] != 0)
+ {
+ foundry_ = (FcChar8 *) malloc (sizeof (os2->achVendID) + 1);
+ memcpy ((void *)foundry_, os2->achVendID, sizeof (os2->achVendID));
+ foundry_[sizeof (os2->achVendID)] = 0;
+ foundry = foundry_;
+ }
+ }
if (FcDebug () & FC_DBG_SCANV)
printf ("\n");
@@ -1946,6 +1884,8 @@ bail2:
FcCharSetDestroy (cs);
bail1:
FcPatternDestroy (pat);
+ if (foundry_)
+ free (foundry_);
bail0:
return NULL;
}
diff --git a/libX11/nls/locale.alias.pre b/libX11/nls/locale.alias.pre
index 63d224612..d9f078551 100644
--- a/libX11/nls/locale.alias.pre
+++ b/libX11/nls/locale.alias.pre
@@ -982,9 +982,9 @@ rw_RW.ISO-8859-1: rw_RW.ISO8859-1
rw_RW.utf8: rw_RW.UTF-8
sd: sd_IN.UTF-8
sd_IN.utf8: sd_IN.UTF-8
-sd@devanagari: sd_INUTF-8@devanagari
-sd_IN@devanagari: sd_INUTF-8@devanagari
-sd_IN.utf8@devanagari: sd_INUTF-8@devanagari
+sd@devanagari: sd_IN.UTF-8@devanagari
+sd_IN@devanagari: sd_IN.UTF-8@devanagari
+sd_IN.utf8@devanagari: sd_IN.UTF-8@devanagari
se_NO: se_NO.UTF-8
se_NO.utf8: se_NO.UTF-8
XCOMM sh was the old ISO code for Serbo-Croatian (now individual sr and hr).
diff --git a/mesalib/Android.common.mk b/mesalib/Android.common.mk
index 3e6d4c398..edf52d6fa 100644
--- a/mesalib/Android.common.mk
+++ b/mesalib/Android.common.mk
@@ -24,16 +24,17 @@
# use c99 compiler by default
ifeq ($(LOCAL_CC),)
ifeq ($(LOCAL_IS_HOST_MODULE),true)
-LOCAL_CC := $(HOST_CC) -std=c99
+LOCAL_CC := $(HOST_CC) -std=c99 -D_GNU_SOURCE
else
LOCAL_CC := $(TARGET_CC) -std=c99
endif
endif
LOCAL_C_INCLUDES += \
+ $(MESA_TOP)/src \
$(MESA_TOP)/include
-MESA_VERSION=$(shell cat $(MESA_TOP)/VERSION)
+MESA_VERSION := $(shell cat $(MESA_TOP)/VERSION)
# define ANDROID_VERSION (e.g., 4.0.x => 0x0400)
LOCAL_CFLAGS += \
-DPACKAGE_VERSION=\"$(MESA_VERSION)\" \
@@ -41,6 +42,19 @@ LOCAL_CFLAGS += \
-DANDROID_VERSION=0x0$(MESA_ANDROID_MAJOR_VERSION)0$(MESA_ANDROID_MINOR_VERSION)
LOCAL_CFLAGS += \
+ -DHAVE___BUILTIN_EXPECT \
+ -DHAVE___BUILTIN_FFS \
+ -DHAVE___BUILTIN_FFSLL \
+ -DHAVE_FUNC_ATTRIBUTE_FLATTEN \
+ -DHAVE_FUNC_ATTRIBUTE_UNUSED \
+ -DHAVE_FUNC_ATTRIBUTE_FORMAT \
+ -DHAVE_FUNC_ATTRIBUTE_PACKED \
+ -DHAVE___BUILTIN_CTZ \
+ -DHAVE___BUILTIN_POPCOUNT \
+ -DHAVE___BUILTIN_POPCOUNTLL \
+ -DHAVE___BUILTIN_CLZ \
+ -DHAVE___BUILTIN_CLZLL \
+ -DHAVE___BUILTIN_UNREACHABLE \
-DHAVE_PTHREAD=1 \
-fvisibility=hidden \
-Wno-sign-compare
diff --git a/mesalib/Android.mk b/mesalib/Android.mk
index e190f749b..b19419ba7 100644
--- a/mesalib/Android.mk
+++ b/mesalib/Android.mk
@@ -34,6 +34,13 @@ MESA_TOP := $(call my-dir)
MESA_ANDROID_MAJOR_VERSION := $(word 1, $(subst ., , $(PLATFORM_VERSION)))
MESA_ANDROID_MINOR_VERSION := $(word 2, $(subst ., , $(PLATFORM_VERSION)))
MESA_ANDROID_VERSION := $(MESA_ANDROID_MAJOR_VERSION).$(MESA_ANDROID_MINOR_VERSION)
+ifeq ($(filter 1 2 3 4,$(MESA_ANDROID_MAJOR_VERSION)),)
+MESA_LOLLIPOP_BUILD := true
+else
+define local-generated-sources-dir
+$(call local-intermediates-dir)
+endef
+endif
MESA_COMMON_MK := $(MESA_TOP)/Android.common.mk
MESA_PYTHON2 := python
@@ -94,7 +101,6 @@ ifeq ($(strip $(MESA_BUILD_GALLIUM)),true)
SUBDIRS += src/gallium
endif
-mkfiles := $(patsubst %,$(MESA_TOP)/%/Android.mk,$(SUBDIRS))
-include $(mkfiles)
+include $(call all-named-subdir-makefiles,$(SUBDIRS))
endif
diff --git a/mesalib/CleanSpec.mk b/mesalib/CleanSpec.mk
index 820a1c7f0..20681638e 100644
--- a/mesalib/CleanSpec.mk
+++ b/mesalib/CleanSpec.mk
@@ -5,3 +5,11 @@ $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libGLES_mesa_i
$(call add-clean-step, rm -rf $(OUT_DIR)/host/$(HOST_OS)-$(HOST_ARCH)/obj/EXECUTABLES/mesa_*_intermediates)
$(call add-clean-step, rm -rf $(OUT_DIR)/host/$(HOST_OS)-$(HOST_ARCH)/obj/EXECUTABLES/glsl_compiler_intermediates)
$(call add-clean-step, rm -rf $(OUT_DIR)/host/$(HOST_OS)-$(HOST_ARCH)/obj/STATIC_LIBRARIES/libmesa_glsl_utils_intermediates)
+
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/*/STATIC_LIBRARIES/libmesa_*_intermediates)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/*/SHARED_LIBRARIES/i9?5_dri_intermediates)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/*/SHARED_LIBRARIES/libglapi_intermediates)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/*/SHARED_LIBRARIES/libGLES_mesa_intermediates)
+$(call add-clean-step, rm -rf $(HOST_OUT_release)/*/EXECUTABLES/mesa_*_intermediates)
+$(call add-clean-step, rm -rf $(HOST_OUT_release)/*/EXECUTABLES/glsl_compiler_intermediates)
+$(call add-clean-step, rm -rf $(HOST_OUT_release)/*/STATIC_LIBRARIES/libmesa_*_intermediates)
diff --git a/mesalib/docs/GL3.txt b/mesalib/docs/GL3.txt
index 2dbd987de..617ff3447 100644
--- a/mesalib/docs/GL3.txt
+++ b/mesalib/docs/GL3.txt
@@ -163,7 +163,7 @@ GL 4.3, GLSL 4.30:
GL_ARB_multi_draw_indirect DONE (i965, nvc0, r600, radeonsi, llvmpipe, softpipe)
GL_ARB_program_interface_query DONE (all drivers)
GL_ARB_robust_buffer_access_behavior not started
- GL_ARB_shader_image_size not started
+ GL_ARB_shader_image_size in progress (Martin Peres)
GL_ARB_shader_storage_buffer_object not started
GL_ARB_stencil_texturing DONE (i965/gen8+, nv50, nvc0, r600, radeonsi, llvmpipe, softpipe)
GL_ARB_texture_buffer_range DONE (nv50, nvc0, i965, r600, radeonsi, llvmpipe)
@@ -182,7 +182,7 @@ GL 4.4, GLSL 4.40:
GL_ARB_multi_bind DONE (all drivers)
GL_ARB_query_buffer_object not started
GL_ARB_texture_mirror_clamp_to_edge DONE (i965, nv50, nvc0, r600, radeonsi, llvmpipe, softpipe)
- GL_ARB_texture_stencil8 not started
+ GL_ARB_texture_stencil8 DONE (nv50, nvc0, r600, radeonsi, llvmpipe, softpipe)
GL_ARB_vertex_type_10f_11f_11f_rev DONE (i965, nv50, nvc0, r600, radeonsi, llvmpipe, softpipe)
GL 4.5, GLSL 4.50:
@@ -220,7 +220,7 @@ GLES3.1, GLSL ES 3.1
GL_ARB_program_interface_query DONE (all drivers)
GL_ARB_shader_atomic_counters DONE (i965)
GL_ARB_shader_image_load_store in progress (curro)
- GL_ARB_shader_image_size not started
+ GL_ARB_shader_image_size in progress (Martin Peres)
GL_ARB_shader_storage_buffer_object not started
GL_ARB_shading_language_packing DONE (all drivers)
GL_ARB_separate_shader_objects DONE (all drivers)
diff --git a/mesalib/docs/VERSIONS b/mesalib/docs/VERSIONS
index 0ebcd1469..9af1546a8 100644
--- a/mesalib/docs/VERSIONS
+++ b/mesalib/docs/VERSIONS
@@ -103,7 +103,7 @@ Mesa Version History
- Stencil-related functions now work in display lists
Changes:
- renamed aux.h as glaux.h (MS-DOS names can't start with aux)
- - most filenames are in 8.3 format to accomodate MS-DOS
+ - most filenames are in 8.3 format to accommodate MS-DOS
- use GLubytes to store arrays of colors instead of GLints
1.2.2 August 2, 1995
@@ -1007,7 +1007,7 @@ Mesa Version History
- glGetTexImage was using pixel unpacking instead of packing params
- auto-mipmap generation for cube maps was incorrect
Changes:
- - max texture units reduced to six to accomodate texture rectangles
+ - max texture units reduced to six to accommodate texture rectangles
- removed unfinished GL_MESA_sprite_point extension code
diff --git a/mesalib/docs/index.html b/mesalib/docs/index.html
index 9e4644caa..e01790cd7 100644
--- a/mesalib/docs/index.html
+++ b/mesalib/docs/index.html
@@ -16,6 +16,12 @@
<h1>News</h1>
+<h2>April 24, 2015</h2>
+<p>
+<a href="relnotes/10.5.4.html">Mesa 10.5.4</a> is released.
+This is a bug-fix release.
+</p>
+
<h2>April 12, 2015</h2>
<p>
<a href="relnotes/10.5.3.html">Mesa 10.5.3</a> is released.
@@ -1360,7 +1366,7 @@ The <a href="faq.html">Mesa FAQ</a> has been rewritten.
- glGetTexImage was using pixel unpacking instead of packing params
- auto-mipmap generation for cube maps was incorrect
Changes:
- - max texture units reduced to six to accomodate texture rectangles
+ - max texture units reduced to six to accommodate texture rectangles
- removed unfinished GL_MESA_sprite_point extension code
</pre>
diff --git a/mesalib/docs/libGL.txt b/mesalib/docs/libGL.txt
index d06b4e62a..839e330cf 100644
--- a/mesalib/docs/libGL.txt
+++ b/mesalib/docs/libGL.txt
@@ -49,7 +49,7 @@ stderr if the LIBGL_DEBUG environment variable is defined.
libGL.so is thread safe. The overhead of thread safety for common,
single-thread clients is negligible. However, the overhead of thread
safety for multi-threaded clients is significant. Each GL API call
-requires two calls to pthread_get_specific() which can noticably
+requires two calls to pthread_get_specific() which can noticeably
impact performance. Warning: libGL.so is thread safe but individual
DRI drivers may not be. Please consult the documentation for a driver
to learn if it is thread safe.
diff --git a/mesalib/docs/relnotes.html b/mesalib/docs/relnotes.html
index 6ec35d11f..7f2e1d851 100644
--- a/mesalib/docs/relnotes.html
+++ b/mesalib/docs/relnotes.html
@@ -21,6 +21,7 @@ The release notes summarize what's new or changed in each Mesa release.
</p>
<ul>
+<li><a href="relnotes/10.5.4.html">10.5.4 release notes</a>
<li><a href="relnotes/10.5.3.html">10.5.3 release notes</a>
<li><a href="relnotes/10.5.2.html">10.5.2 release notes</a>
<li><a href="relnotes/10.4.7.html">10.4.7 release notes</a>
diff --git a/mesalib/docs/relnotes/10.0.3.html b/mesalib/docs/relnotes/10.0.3.html
index ad7b50864..ce0dcf033 100644
--- a/mesalib/docs/relnotes/10.0.3.html
+++ b/mesalib/docs/relnotes/10.0.3.html
@@ -104,7 +104,7 @@ a07b4b6b9eb449b88a6cb5061e51c331 MesaLib-10.0.3.zip
<li>Add md5sums for 10.0.2. release.</li>
<li>cherry-ignore: Ignore several patches not yet ready for the stable branch</li>
<li>Drop another couple of patches.</li>
- <li>cherry-ignore: Ignore 4 patches at teh request of the author, (Anuj).</li>
+ <li>cherry-ignore: Ignore 4 patches at the request of the author, (Anuj).</li>
<li>Update version to 10.0.3</li>
</ul>
diff --git a/mesalib/docs/relnotes/10.5.4.html b/mesalib/docs/relnotes/10.5.4.html
new file mode 100644
index 000000000..4c466d0b3
--- /dev/null
+++ b/mesalib/docs/relnotes/10.5.4.html
@@ -0,0 +1,125 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html lang="en">
+<head>
+ <meta http-equiv="content-type" content="text/html; charset=utf-8">
+ <title>Mesa Release Notes</title>
+ <link rel="stylesheet" type="text/css" href="../mesa.css">
+</head>
+<body>
+
+<div class="header">
+ <h1>The Mesa 3D Graphics Library</h1>
+</div>
+
+<iframe src="../contents.html"></iframe>
+<div class="content">
+
+<h1>Mesa 10.5.4 Release Notes / April 24, 2015</h1>
+
+<p>
+Mesa 10.5.4 is a bug fix release which fixes bugs found since the 10.5.3 release.
+</p>
+<p>
+Mesa 10.5.4 implements the OpenGL 3.3 API, but the version reported by
+glGetString(GL_VERSION) or glGetIntegerv(GL_MAJOR_VERSION) /
+glGetIntegerv(GL_MINOR_VERSION) depends on the particular driver being used.
+Some drivers don't support all the features required in OpenGL 3.3. OpenGL
+3.3 is <strong>only</strong> available if requested at context creation
+because compatibility contexts are not supported.
+</p>
+
+
+<h2>SHA256 checksums</h2>
+<pre>
+e1089567fc7bf8d9b2d8badcc9f2fc3b758701c8c0ccfe7af1805549fea53f11 mesa-10.5.4.tar.gz
+b51e723f3a20d842c88a92d809435b229fc4744ca0dbec0317d9d4a3ac4c6803 mesa-10.5.4.tar.xz
+</pre>
+
+
+<h2>New features</h2>
+<p>None</p>
+
+<h2>Bug fixes</h2>
+
+<p>This list is likely incomplete.</p>
+
+<ul>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=69226">Bug 69226</a> - Cannot enable basic shaders with Second Life aborts attempt</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=71591">Bug 71591</a> - Second Life shaders fail to compile (extension declared in middle of shader)</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=81025">Bug 81025</a> - [IVB/BYT Bisected]Piglit spec_ARB_draw_indirect_arb_draw_indirect-draw-elements-prim-restart-ugly fails</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=89457">Bug 89457</a> - [BSW Bisected]ogles3conform ES3-CTS.gtf.GL3Tests.shadow.shadow_execution_vert fails</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=89957">Bug 89957</a> - vm protection faults in piglit lest: texsubimage cube_map_array pbo</li>
+
+</ul>
+
+
+<h2>Changes</h2>
+
+<p>Brian Paul (1):</p>
+<ul>
+ <li>glsl: rewrite glsl_type::record_key_hash() to avoid buffer overflow</li>
+</ul>
+
+<p>Dave Airlie (2):</p>
+<ul>
+ <li>st/mesa: convert sub image for cube map arrays to 2d arrays for upload</li>
+ <li>st/mesa: align cube map arrays layers</li>
+</ul>
+
+<p>Emil Velikov (11):</p>
+<ul>
+ <li>docs: Add 256 sums for the 10.5.3 release</li>
+ <li>radeonsi: remove unused si_dump_key()</li>
+ <li>android: use LOCAL_SHARED_LIBRARIES over TARGET_OUT_HEADERS</li>
+ <li>android: add $(mesa_top)/src include to the whole of mesa</li>
+ <li>android: egl: add libsync_cflags to the build</li>
+ <li>android: dri/common: conditionally include drm_cflags/set __NOT_HAVE_DRM_H</li>
+ <li>android: add HAVE__BUILTIN_* and HAVE_FUNC_ATTRIBUTE_* defines</li>
+ <li>android: add $(mesa_top)/src/mesa/main to the includes list</li>
+ <li>android: dri: link against libmesa_util</li>
+ <li>android: mesa: fix the path of the SSE4_1 optimisations</li>
+ <li>Update version to 10.5.4</li>
+</ul>
+
+<p>Ian Romanick (1):</p>
+<ul>
+ <li>nir: Fix typo in "ushr by 0" algebraic replacement</li>
+</ul>
+
+<p>Kenneth Graunke (2):</p>
+<ul>
+ <li>i965: Fix software primitive restart with indirect draws.</li>
+ <li>drirc: Add "Second Life" quirk (allow_glsl_extension_directive_midshader).</li>
+</ul>
+
+<p>Kristian Høgsberg (1):</p>
+<ul>
+ <li>i965: Rewrite ir_tex to ir_txl with lod 0 for vertex shaders</li>
+</ul>
+
+<p>Marek Olšák (2):</p>
+<ul>
+ <li>glsl_to_tgsi: fix out-of-bounds constant access and crash for uniforms</li>
+ <li>glsl_to_tgsi: don't use a potentially-undefined immediate for ir_query_levels</li>
+</ul>
+
+<p>Mathias Froehlich (1):</p>
+<ul>
+ <li>i965: Flush batchbuffer containing the query on glQueryCounter.</li>
+</ul>
+
+<p>Mauro Rossi (2):</p>
+<ul>
+ <li>android: mesa: generate the format_{un,}pack.[ch] sources</li>
+ <li>android: add inital NIR build</li>
+</ul>
+
+
+</div>
+</body>
+</html>
diff --git a/mesalib/docs/relnotes/10.6.0.html b/mesalib/docs/relnotes/10.6.0.html
index 82aea5cf9..fbc4d5be9 100644
--- a/mesalib/docs/relnotes/10.6.0.html
+++ b/mesalib/docs/relnotes/10.6.0.html
@@ -45,15 +45,23 @@ Note: some of the new features are only available with certain drivers.
<ul>
<li>GL_AMD_pinned_memory on r600, radeonsi</li>
+<li>GL_ARB_clip_control on i965</li>
+<li>GL_ARB_depth_buffer_float on freedreno</li>
+<li>GL_ARB_depth_clamp on freedreno</li>
<li>GL_ARB_draw_indirect, GL_ARB_multi_draw_indirect on r600</li>
<li>GL_ARB_draw_instanced on freedreno</li>
<li>GL_ARB_gpu_shader_fp64 on nvc0, softpipe</li>
+<li>GL_ARB_gpu_shader5 on i965/gen8+</li>
<li>GL_ARB_instanced_arrays on freedreno</li>
<li>GL_ARB_pipeline_statistics_query on i965, nv50, nvc0, r600, radeonsi, softpipe</li>
+<li>GL_ARB_program_interface_query (all drivers)</li>
+<li>GL_ARB_texture_stencil8 on nv50, nvc0, r600, radeonsi, softpipe</li>
<li>GL_ARB_uniform_buffer_object on freedreno</li>
<li>GL_EXT_draw_buffers2 on freedreno</li>
-<li>GL_ARB_clip_control on i965</li>
-<li>GL_ARB_program_interface_query (all drivers)</li>
+<li>GL_OES_EGL_sync on all drivers</li>
+<li>EGL_KHR_fence_sync on freedreno, nv50, nvc0, r600, radeonsi</li>
+<li>EGL_KHR_wait_sync on freedreno, nv50, nvc0, r600, radeonsi</li>
+<li>EGL_KHR_cl_event2 on freedreno, nv50, nvc0, r600, radeonsi</li>
</ul>
<h2>Bug fixes</h2>
diff --git a/mesalib/docs/relnotes/7.10.html b/mesalib/docs/relnotes/7.10.html
index a88811e50..447465e71 100644
--- a/mesalib/docs/relnotes/7.10.html
+++ b/mesalib/docs/relnotes/7.10.html
@@ -1693,7 +1693,7 @@ bc644be551ed585fc4f66c16b64a91c9 MesaGLUT-7.10.tar.gz
<li>llvmpipe: Special case complementary and identify blend factors in SoA.</li>
<li>llvmpipe: Make rgb/alpha bland func/factors match, when there is no alpha.</li>
<li>draw: Prevent clipped vertices overflow.</li>
- <li>draw: Fullfil the new min_lod/max_lod/lod_bias/border_color dynamic state</li>
+ <li>draw: Fulfil the new min_lod/max_lod/lod_bias/border_color dynamic state</li>
<li>gallivm: Fetch the lod from the dynamic state when min_lod == max_lod.</li>
<li>gallivm: Remove dead experimental code.</li>
<li>llvmpipe: Decouple sampler view and sampler state updates.</li>
diff --git a/mesalib/docs/versions.html b/mesalib/docs/versions.html
index 30c1817e1..c7f94c513 100644
--- a/mesalib/docs/versions.html
+++ b/mesalib/docs/versions.html
@@ -150,7 +150,7 @@ New features:
Changes:
<ul>
<li>renamed aux.h as glaux.h (MS-DOS names can't start with aux)
-<li>most filenames are in 8.3 format to accomodate MS-DOS
+<li>most filenames are in 8.3 format to accommodate MS-DOS
<li>use GLubytes to store arrays of colors instead of GLints
</ul>
@@ -1224,7 +1224,7 @@ Bug fixes:
</ul>
Changes:
<ul>
-<li>max texture units reduced to six to accomodate texture rectangles
+<li>max texture units reduced to six to accommodate texture rectangles
<li>removed unfinished GL_MESA_sprite_point extension code
</ul>
diff --git a/mesalib/docs/viewperf.html b/mesalib/docs/viewperf.html
index 6b63b94d8..a60a44f36 100644
--- a/mesalib/docs/viewperf.html
+++ b/mesalib/docs/viewperf.html
@@ -329,6 +329,13 @@ array initializer statement, but it neglects to specify
<code>#version 120</code> at the top of the shader code.
So, the shader does not compile and all that's rendered is plain white polygons.
</p>
+<p>
+Also, the test tries to create a very large 3D texture that may exceed
+the device driver's limit.
+When this happens, the glTexImage3D call fails and all that's rendered is
+a white box.
+</p>
+
<h3>showcase-01</h3>
diff --git a/mesalib/include/GL/internal/dri_interface.h b/mesalib/include/GL/internal/dri_interface.h
index eb7da23f7..c827bb640 100644
--- a/mesalib/include/GL/internal/dri_interface.h
+++ b/mesalib/include/GL/internal/dri_interface.h
@@ -85,6 +85,7 @@ typedef struct __DRIdri2ExtensionRec __DRIdri2Extension;
typedef struct __DRIdri2LoaderExtensionRec __DRIdri2LoaderExtension;
typedef struct __DRI2flushExtensionRec __DRI2flushExtension;
typedef struct __DRI2throttleExtensionRec __DRI2throttleExtension;
+typedef struct __DRI2fenceExtensionRec __DRI2fenceExtension;
typedef struct __DRIimageLoaderExtensionRec __DRIimageLoaderExtension;
@@ -339,6 +340,65 @@ struct __DRI2throttleExtensionRec {
enum __DRI2throttleReason reason);
};
+
+/**
+ * Extension for fences / synchronization objects.
+ */
+
+#define __DRI2_FENCE "DRI2_Fence"
+#define __DRI2_FENCE_VERSION 1
+
+#define __DRI2_FENCE_TIMEOUT_INFINITE 0xffffffffffffffffllu
+
+#define __DRI2_FENCE_FLAG_FLUSH_COMMANDS (1 << 0)
+
+struct __DRI2fenceExtensionRec {
+ __DRIextension base;
+
+ /**
+ * Create and insert a fence into the command stream of the context.
+ */
+ void *(*create_fence)(__DRIcontext *ctx);
+
+ /**
+ * Get a fence associated with the OpenCL event object.
+ * This can be NULL, meaning that OpenCL interoperability is not supported.
+ */
+ void *(*get_fence_from_cl_event)(__DRIscreen *screen, intptr_t cl_event);
+
+ /**
+ * Destroy a fence.
+ */
+ void (*destroy_fence)(__DRIscreen *screen, void *fence);
+
+ /**
+ * This function waits and doesn't return until the fence is signalled
+ * or the timeout expires. It returns true if the fence has been signaled.
+ *
+ * \param ctx the context where commands are flushed
+ * \param fence the fence
+ * \param flags a combination of __DRI2_FENCE_FLAG_xxx flags
+ * \param timeout the timeout in ns or __DRI2_FENCE_TIMEOUT_INFINITE
+ */
+ GLboolean (*client_wait_sync)(__DRIcontext *ctx, void *fence,
+ unsigned flags, uint64_t timeout);
+
+ /**
+ * This function enqueues a wait command into the command stream of
+ * the context and then returns. When the execution reaches the wait
+ * command, no further execution will be done in the context until
+ * the fence is signaled. This is a no-op if the device doesn't support
+ * parallel execution of contexts.
+ *
+ * \param ctx the context where the waiting is done
+ * \param fence the fence
+ * \param flags a combination of __DRI2_FENCE_FLAG_xxx flags that make
+ * sense with this function (right now there are none)
+ */
+ void (*server_wait_sync)(__DRIcontext *ctx, void *fence, unsigned flags);
+};
+
+
/*@}*/
/**
diff --git a/mesalib/scons/llvm.py b/mesalib/scons/llvm.py
index be7df9fad..17278df88 100644
--- a/mesalib/scons/llvm.py
+++ b/mesalib/scons/llvm.py
@@ -72,18 +72,25 @@ def generate(env):
return
# Try to determine the LLVM version from llvm/Config/config.h
- llvm_config = os.path.join(llvm_dir, 'include/llvm/Config/config.h')
+ llvm_config = os.path.join(llvm_dir, 'include/llvm/Config/llvm-config.h')
if not os.path.exists(llvm_config):
print 'scons: could not find %s' % llvm_config
return
- llvm_version_re = re.compile(r'^#define PACKAGE_VERSION "([^"]*)"')
+ llvm_version_major_re = re.compile(r'^#define LLVM_VERSION_MAJOR ([0-9]+)')
+ llvm_version_minor_re = re.compile(r'^#define LLVM_VERSION_MINOR ([0-9]+)')
llvm_version = None
+ llvm_version_major = None
+ llvm_version_minor = None
for line in open(llvm_config, 'rt'):
- mo = llvm_version_re.match(line)
+ mo = llvm_version_major_re.match(line)
if mo:
- llvm_version = mo.group(1)
- llvm_version = distutils.version.LooseVersion(llvm_version)
- break
+ llvm_version_major = mo.group(1)
+ mo = llvm_version_minor_re.match(line)
+ if mo:
+ llvm_version_minor = mo.group(1)
+ if llvm_version_major is not None and llvm_version_minor is not None:
+ llvm_version = distutils.version.LooseVersion('%s.%s' % (llvm_version_major, llvm_version_minor))
+
if llvm_version is None:
print 'scons: could not determine the LLVM version from %s' % llvm_config
return
@@ -99,7 +106,19 @@ def generate(env):
])
env.Prepend(LIBPATH = [os.path.join(llvm_dir, 'lib')])
# LIBS should match the output of `llvm-config --libs engine mcjit bitwriter x86asmprinter`
- if llvm_version >= distutils.version.LooseVersion('3.5'):
+ if llvm_version >= distutils.version.LooseVersion('3.6'):
+ env.Prepend(LIBS = [
+ 'LLVMBitWriter', 'LLVMX86Disassembler', 'LLVMX86AsmParser',
+ 'LLVMX86CodeGen', 'LLVMSelectionDAG', 'LLVMAsmPrinter',
+ 'LLVMCodeGen', 'LLVMScalarOpts', 'LLVMProfileData',
+ 'LLVMInstCombine', 'LLVMTransformUtils', 'LLVMipa',
+ 'LLVMAnalysis', 'LLVMX86Desc', 'LLVMMCDisassembler',
+ 'LLVMX86Info', 'LLVMX86AsmPrinter', 'LLVMX86Utils',
+ 'LLVMMCJIT', 'LLVMTarget', 'LLVMExecutionEngine',
+ 'LLVMRuntimeDyld', 'LLVMObject', 'LLVMMCParser',
+ 'LLVMBitReader', 'LLVMMC', 'LLVMCore', 'LLVMSupport'
+ ])
+ elif llvm_version >= distutils.version.LooseVersion('3.5'):
env.Prepend(LIBS = [
'LLVMBitWriter', 'LLVMMCJIT', 'LLVMRuntimeDyld',
'LLVMX86Disassembler', 'LLVMX86AsmParser', 'LLVMX86CodeGen',
diff --git a/mesalib/src/gallium/SConscript b/mesalib/src/gallium/SConscript
index 680ad925f..eeb1c780f 100644
--- a/mesalib/src/gallium/SConscript
+++ b/mesalib/src/gallium/SConscript
@@ -60,6 +60,11 @@ SConscript([
])
if not env['embedded']:
+ SConscript([
+ 'state_trackers/osmesa/SConscript',
+ 'targets/osmesa/SConscript',
+ ])
+
if env['x11']:
SConscript([
'state_trackers/glx/xlib/SConscript',
diff --git a/mesalib/src/gallium/auxiliary/Android.mk b/mesalib/src/gallium/auxiliary/Android.mk
index 0bc183170..96a2125de 100644
--- a/mesalib/src/gallium/auxiliary/Android.mk
+++ b/mesalib/src/gallium/auxiliary/Android.mk
@@ -33,14 +33,13 @@ LOCAL_SRC_FILES := \
$(VL_STUB_SOURCES)
LOCAL_C_INCLUDES := \
- $(GALLIUM_TOP)/auxiliary/util \
- $(MESA_TOP)/src
+ $(GALLIUM_TOP)/auxiliary/util
LOCAL_MODULE := libmesa_gallium
# generate sources
LOCAL_MODULE_CLASS := STATIC_LIBRARIES
-intermediates := $(call local-intermediates-dir)
+intermediates := $(call local-generated-sources-dir)
LOCAL_GENERATED_SOURCES := $(addprefix $(intermediates)/, $(GENERATED_SOURCES))
$(LOCAL_GENERATED_SOURCES): PRIVATE_PYTHON := $(MESA_PYTHON2)
diff --git a/mesalib/src/gallium/auxiliary/hud/hud_context.c b/mesalib/src/gallium/auxiliary/hud/hud_context.c
index e46c68cdd..00ec20589 100644
--- a/mesalib/src/gallium/auxiliary/hud/hud_context.c
+++ b/mesalib/src/gallium/auxiliary/hud/hud_context.c
@@ -569,9 +569,36 @@ hud_pane_set_max_value(struct hud_pane *pane, uint64_t value)
pane->yscale = -(int)pane->inner_height / (float)pane->max_value;
}
+static void
+hud_pane_update_dyn_ceiling(struct hud_graph *gr, struct hud_pane *pane)
+{
+ unsigned i;
+ float tmp = 0.0f;
+
+ if (pane->dyn_ceil_last_ran != gr->index) {
+ LIST_FOR_EACH_ENTRY(gr, &pane->graph_list, head) {
+ for (i = 0; i < gr->num_vertices; ++i) {
+ tmp = gr->vertices[i * 2 + 1] > tmp ?
+ gr->vertices[i * 2 + 1] : tmp;
+ }
+ }
+
+ /* Avoid setting it lower than the initial starting height. */
+ tmp = tmp > pane->initial_max_value ? tmp : pane->initial_max_value;
+ hud_pane_set_max_value(pane, tmp);
+ }
+
+ /*
+ * Mark this adjustment run so we could avoid repeating a full update
+ * again needlessly in case the pane has more than one graph.
+ */
+ pane->dyn_ceil_last_ran = gr->index;
+}
+
static struct hud_pane *
hud_pane_create(unsigned x1, unsigned y1, unsigned x2, unsigned y2,
- unsigned period, uint64_t max_value)
+ unsigned period, uint64_t max_value, uint64_t ceiling,
+ boolean dyn_ceiling)
{
struct hud_pane *pane = CALLOC_STRUCT(hud_pane);
@@ -590,6 +617,10 @@ hud_pane_create(unsigned x1, unsigned y1, unsigned x2, unsigned y2,
pane->inner_height = pane->inner_y2 - pane->inner_y1;
pane->period = period;
pane->max_num_vertices = (x2 - x1 + 2) / 2;
+ pane->ceiling = ceiling;
+ pane->dyn_ceiling = dyn_ceiling;
+ pane->dyn_ceil_last_ran = 0;
+ pane->initial_max_value = max_value;
hud_pane_set_max_value(pane, max_value);
LIST_INITHEAD(&pane->graph_list);
return pane;
@@ -633,6 +664,9 @@ hud_pane_add_graph(struct hud_pane *pane, struct hud_graph *gr)
void
hud_graph_add_value(struct hud_graph *gr, uint64_t value)
{
+ gr->current_value = value;
+ value = value > gr->pane->ceiling ? gr->pane->ceiling : value;
+
if (gr->index == gr->pane->max_num_vertices) {
gr->vertices[0] = 0;
gr->vertices[1] = gr->vertices[(gr->index-1)*2+1];
@@ -646,7 +680,9 @@ hud_graph_add_value(struct hud_graph *gr, uint64_t value)
gr->num_vertices++;
}
- gr->current_value = value;
+ if (gr->pane->dyn_ceiling == true) {
+ hud_pane_update_dyn_ceiling(gr, gr->pane);
+ }
if (value > gr->pane->max_value) {
hud_pane_set_max_value(gr->pane, value);
}
@@ -683,6 +719,69 @@ parse_string(const char *s, char *out)
return i;
}
+static char *
+read_pane_settings(char *str, unsigned * const x, unsigned * const y,
+ unsigned * const width, unsigned * const height,
+ uint64_t * const ceiling, boolean * const dyn_ceiling)
+{
+ char *ret = str;
+ unsigned tmp;
+
+ while (*str == '.') {
+ ++str;
+ switch (*str) {
+ case 'x':
+ ++str;
+ *x = strtoul(str, &ret, 10);
+ str = ret;
+ break;
+
+ case 'y':
+ ++str;
+ *y = strtoul(str, &ret, 10);
+ str = ret;
+ break;
+
+ case 'w':
+ ++str;
+ tmp = strtoul(str, &ret, 10);
+ *width = tmp > 80 ? tmp : 80; /* 80 is chosen arbitrarily */
+ str = ret;
+ break;
+
+ /*
+ * Prevent setting height to less than 50. If the height is set to less,
+ * the text of the Y axis labels on the graph will start overlapping.
+ */
+ case 'h':
+ ++str;
+ tmp = strtoul(str, &ret, 10);
+ *height = tmp > 50 ? tmp : 50;
+ str = ret;
+ break;
+
+ case 'c':
+ ++str;
+ tmp = strtoul(str, &ret, 10);
+ *ceiling = tmp > 10 ? tmp : 10;
+ str = ret;
+ break;
+
+ case 'd':
+ ++str;
+ ret = str;
+ *dyn_ceiling = true;
+ break;
+
+ default:
+ fprintf(stderr, "gallium_hud: syntax error: unexpected '%c'\n", *str);
+ }
+
+ }
+
+ return ret;
+}
+
static boolean
has_occlusion_query(struct pipe_screen *screen)
{
@@ -705,11 +804,15 @@ static void
hud_parse_env_var(struct hud_context *hud, const char *env)
{
unsigned num, i;
- char name[256], s[256];
+ char name_a[256], s[256];
+ char *name;
struct hud_pane *pane = NULL;
unsigned x = 10, y = 10;
unsigned width = 251, height = 100;
unsigned period = 500 * 1000; /* default period (1/2 second) */
+ uint64_t ceiling = UINT64_MAX;
+ unsigned column_width = 251;
+ boolean dyn_ceiling = false;
const char *period_env;
/*
@@ -725,11 +828,23 @@ hud_parse_env_var(struct hud_context *hud, const char *env)
}
}
- while ((num = parse_string(env, name)) != 0) {
+ while ((num = parse_string(env, name_a)) != 0) {
env += num;
+ /* check for explicit location, size and etc. settings */
+ name = read_pane_settings(name_a, &x, &y, &width, &height, &ceiling,
+ &dyn_ceiling);
+
+ /*
+ * Keep track of overall column width to avoid pane overlapping in case
+ * later we create a new column while the bottom pane in the current
+ * column is less wide than the rest of the panes in it.
+ */
+ column_width = width > column_width ? width : column_width;
+
if (!pane) {
- pane = hud_pane_create(x, y, x + width, y + height, period, 10);
+ pane = hud_pane_create(x, y, x + width, y + height, period, 10,
+ ceiling, dyn_ceiling);
if (!pane)
return;
}
@@ -807,6 +922,7 @@ hud_parse_env_var(struct hud_context *hud, const char *env)
if (num && sscanf(s, "%u", &i) == 1) {
hud_pane_set_max_value(pane, i);
+ pane->initial_max_value = i;
}
else {
fprintf(stderr, "gallium_hud: syntax error: unexpected '%c' (%i) "
@@ -826,6 +942,7 @@ hud_parse_env_var(struct hud_context *hud, const char *env)
case ',':
env++;
y += height + hud->font.glyph_height * (pane->num_graphs + 2);
+ height = 100;
if (pane && pane->num_graphs) {
LIST_ADDTAIL(&pane->head, &hud->pane_list);
@@ -836,17 +953,27 @@ hud_parse_env_var(struct hud_context *hud, const char *env)
case ';':
env++;
y = 10;
- x += width + hud->font.glyph_width * 7;
+ x += column_width + hud->font.glyph_width * 7;
+ height = 100;
if (pane && pane->num_graphs) {
LIST_ADDTAIL(&pane->head, &hud->pane_list);
pane = NULL;
}
+
+ /* Starting a new column; reset column width. */
+ column_width = 251;
break;
default:
fprintf(stderr, "gallium_hud: syntax error: unexpected '%c'\n", *env);
}
+
+ /* Reset to defaults for the next pane in case these were modified. */
+ width = 251;
+ ceiling = UINT64_MAX;
+ dyn_ceiling = false;
+
}
if (pane) {
@@ -878,6 +1005,30 @@ print_help(struct pipe_screen *screen)
puts("");
puts(" Example: GALLIUM_HUD=\"cpu,fps;primitives-generated\"");
puts("");
+ puts(" Additionally, by prepending '.[identifier][value]' modifiers to");
+ puts(" a name, it is possible to explicitly set the location and size");
+ puts(" of a pane, along with limiting overall maximum value of the");
+ puts(" Y axis and activating dynamic readjustment of the Y axis.");
+ puts(" Several modifiers may be applied to the same pane simultaneously.");
+ puts("");
+ puts(" 'x[value]' sets the location of the pane on the x axis relative");
+ puts(" to the upper-left corner of the viewport, in pixels.");
+ puts(" 'y[value]' sets the location of the pane on the y axis relative");
+ puts(" to the upper-left corner of the viewport, in pixels.");
+ puts(" 'w[value]' sets width of the graph pixels.");
+ puts(" 'h[value]' sets height of the graph in pixels.");
+ puts(" 'c[value]' sets the ceiling of the value of the Y axis.");
+ puts(" If the graph needs to draw values higher than");
+ puts(" the ceiling allows, the value is clamped.");
+ puts(" 'd' activates dynamic Y axis readjustment to set the value of");
+ puts(" the Y axis to match the highest value still visible in the graph.");
+ puts("");
+ puts(" If 'c' and 'd' modifiers are used simultaneously, both are in effect:");
+ puts(" the Y axis does not go above the restriction imposed by 'c' while");
+ puts(" still adjusting the value of the Y axis down when appropriate.");
+ puts("");
+ puts(" Example: GALLIUM_HUD=\".w256.h64.x1600.y520.d.c1000fps+cpu,.datom-count\"");
+ puts("");
puts(" Available names:");
puts(" fps");
puts(" cpu");
diff --git a/mesalib/src/gallium/auxiliary/hud/hud_private.h b/mesalib/src/gallium/auxiliary/hud/hud_private.h
index 1606ada4a..230f02664 100644
--- a/mesalib/src/gallium/auxiliary/hud/hud_private.h
+++ b/mesalib/src/gallium/auxiliary/hud/hud_private.h
@@ -62,6 +62,10 @@ struct hud_pane {
float yscale;
unsigned max_num_vertices;
uint64_t max_value;
+ uint64_t initial_max_value;
+ uint64_t ceiling;
+ unsigned dyn_ceil_last_ran;
+ boolean dyn_ceiling;
boolean uses_byte_units;
uint64_t period; /* in microseconds */
diff --git a/mesalib/src/gallium/auxiliary/util/u_tile.c b/mesalib/src/gallium/auxiliary/util/u_tile.c
index 8e199200f..b91bb413a 100644
--- a/mesalib/src/gallium/auxiliary/util/u_tile.c
+++ b/mesalib/src/gallium/auxiliary/util/u_tile.c
@@ -341,13 +341,13 @@ x32_s8_get_tile_rgba(const unsigned *src,
unsigned i, j;
for (i = 0; i < h; i++) {
- float *pRow = p;
+ uint32_t *pRow = (uint32_t *)p;
for (j = 0; j < w; j++, pRow += 4) {
src++;
pRow[0] =
pRow[1] =
pRow[2] =
- pRow[3] = (float)(*src++ & 0xff);
+ pRow[3] = (*src++ & 0xff);
}
p += dst_stride;
}
diff --git a/mesalib/src/gallium/auxiliary/util/u_video.h b/mesalib/src/gallium/auxiliary/util/u_video.h
index 45b2d6e76..b4743d13f 100644
--- a/mesalib/src/gallium/auxiliary/util/u_video.h
+++ b/mesalib/src/gallium/auxiliary/util/u_video.h
@@ -38,6 +38,7 @@ extern "C" {
/* u_reduce_video_profile() needs these */
#include "pipe/p_compiler.h"
#include "util/u_debug.h"
+#include "util/u_math.h"
static INLINE enum pipe_video_format
u_reduce_video_profile(enum pipe_video_profile profile)
@@ -146,6 +147,41 @@ u_copy_swap422_packed(void *const *destination_data,
}
}
+static INLINE uint32_t
+u_get_h264_level(uint32_t width, uint32_t height, uint32_t *max_reference)
+{
+ uint32_t max_dpb_mbs;
+
+ width = align(width, 16);
+ height = align(height, 16);
+
+ /* Max references will be used for caculation of number of DPB buffers
+ in the UVD driver, limitation of max references is 16. Some client
+ like mpv application for VA-API, it requires references more than that,
+ so we have to set max of references to 16 here. */
+ *max_reference = MIN2(*max_reference, 16);
+ max_dpb_mbs = (width / 16) * (height / 16) * *max_reference;
+
+ /* The calculation is based on "Decoded picture buffering" section
+ from http://en.wikipedia.org/wiki/H.264/MPEG-4_AVC */
+ if (max_dpb_mbs <= 8100)
+ return 30;
+ else if (max_dpb_mbs <= 18000)
+ return 31;
+ else if (max_dpb_mbs <= 20480)
+ return 32;
+ else if (max_dpb_mbs <= 32768)
+ return 41;
+ else if (max_dpb_mbs <= 34816)
+ return 42;
+ else if (max_dpb_mbs <= 110400)
+ return 50;
+ else if (max_dpb_mbs <= 184320)
+ return 51;
+ else
+ return 52;
+}
+
#ifdef __cplusplus
}
#endif
diff --git a/mesalib/src/glsl/Android.gen.mk b/mesalib/src/glsl/Android.gen.mk
index 7ec56d4f2..0835871f9 100644
--- a/mesalib/src/glsl/Android.gen.mk
+++ b/mesalib/src/glsl/Android.gen.mk
@@ -27,17 +27,29 @@ ifeq ($(LOCAL_MODULE_CLASS),)
LOCAL_MODULE_CLASS := STATIC_LIBRARIES
endif
-intermediates := $(call local-intermediates-dir)
+intermediates := $(call local-generated-sources-dir)
sources := \
glsl_lexer.cpp \
glsl_parser.cpp \
glcpp/glcpp-lex.c \
- glcpp/glcpp-parse.c
+ glcpp/glcpp-parse.c \
+ nir/nir_builder_opcodes.h \
+ nir/nir_constant_expressions.c \
+ nir/nir_opcodes.c \
+ nir/nir_opcodes.h \
+ nir/nir_opt_algebraic.c
LOCAL_SRC_FILES := $(filter-out $(sources), $(LOCAL_SRC_FILES))
-LOCAL_C_INCLUDES += $(intermediates) $(intermediates)/glcpp $(MESA_TOP)/src/glsl/glcpp
+LOCAL_C_INCLUDES += \
+ $(intermediates)/glcpp \
+ $(intermediates)/nir \
+ $(MESA_TOP)/src/glsl/glcpp \
+ $(MESA_TOP)/src/glsl/nir
+
+LOCAL_EXPORT_C_INCLUDE_DIRS += \
+ $(intermediates)/nir
sources := $(addprefix $(intermediates)/, $(sources))
LOCAL_GENERATED_SOURCES += $(sources)
@@ -77,3 +89,51 @@ $(intermediates)/glcpp/glcpp-lex.c: $(LOCAL_PATH)/glcpp/glcpp-lex.l
$(intermediates)/glcpp/glcpp-parse.c: $(LOCAL_PATH)/glcpp/glcpp-parse.y
$(call glsl_local-y-to-c-and-h)
+
+nir_builder_opcodes_gen := $(LOCAL_PATH)/nir/nir_builder_opcodes_h.py
+nir_builder_opcodes_deps := \
+ $(LOCAL_PATH)/nir/nir_opcodes.py \
+ $(LOCAL_PATH)/nir/nir_builder_opcodes_h.py
+
+$(intermediates)/nir/nir_builder_opcodes.h: $(nir_builder_opcodes_deps)
+ @mkdir -p $(dir $@)
+ $(hide) $(MESA_PYTHON2) $(nir_builder_opcodes_gen) $< > $@
+
+nir_constant_expressions_gen := $(LOCAL_PATH)/nir/nir_constant_expressions.py
+nir_constant_expressions_deps := \
+ $(LOCAL_PATH)/nir/nir_opcodes.py \
+ $(LOCAL_PATH)/nir/nir_constant_expressions.py \
+ $(LOCAL_PATH)/nir/nir_constant_expressions.h
+
+$(intermediates)/nir/nir_constant_expressions.c: $(nir_constant_expressions_deps)
+ @mkdir -p $(dir $@)
+ $(hide) $(MESA_PYTHON2) $(nir_constant_expressions_gen) $< > $@
+
+nir_opcodes_h_gen := $(LOCAL_PATH)/nir/nir_opcodes_h.py
+nir_opcodes_h_deps := \
+ $(LOCAL_PATH)/nir/nir_opcodes.py \
+ $(LOCAL_PATH)/nir/nir_opcodes_h.py
+
+$(intermediates)/nir/nir_opcodes.h: $(nir_opcodes_h_deps)
+ @mkdir -p $(dir $@)
+ $(hide) $(MESA_PYTHON2) $(nir_opcodes_h_gen) $< > $@
+
+$(LOCAL_PATH)/nir/nir.h: $(intermediates)/nir/nir_opcodes.h
+
+nir_opcodes_c_gen := $(LOCAL_PATH)/nir/nir_opcodes_c.py
+nir_opcodes_c_deps := \
+ $(LOCAL_PATH)/nir/nir_opcodes.py \
+ $(LOCAL_PATH)/nir/nir_opcodes_c.py
+
+$(intermediates)/nir/nir_opcodes.c: $(nir_opcodes_c_deps)
+ @mkdir -p $(dir $@)
+ $(hide) $(MESA_PYTHON2) $(nir_opcodes_c_gen) $< > $@
+
+nir_opt_algebraic_gen := $(LOCAL_PATH)/nir/nir_opt_algebraic.py
+nir_opt_algebraic_deps := \
+ $(LOCAL_PATH)/nir/nir_opt_algebraic.py \
+ $(LOCAL_PATH)/nir/nir_algebraic.py
+
+$(intermediates)/nir/nir_opt_algebraic.c: $(nir_opt_algebraic_deps)
+ @mkdir -p $(dir $@)
+ $(hide) $(MESA_PYTHON2) $(nir_opt_algebraic_gen) $< > $@
diff --git a/mesalib/src/glsl/Android.mk b/mesalib/src/glsl/Android.mk
index 38c2087a4..f20741e0d 100644
--- a/mesalib/src/glsl/Android.mk
+++ b/mesalib/src/glsl/Android.mk
@@ -35,12 +35,14 @@ include $(CLEAR_VARS)
LOCAL_SRC_FILES := \
$(LIBGLCPP_FILES) \
- $(LIBGLSL_FILES)
+ $(LIBGLSL_FILES) \
+ $(NIR_FILES)
LOCAL_C_INCLUDES := \
- $(MESA_TOP)/src \
$(MESA_TOP)/src/mapi \
- $(MESA_TOP)/src/mesa
+ $(MESA_TOP)/src/mesa \
+ $(MESA_TOP)/src/gallium/include \
+ $(MESA_TOP)/src/gallium/auxiliary
LOCAL_MODULE := libmesa_glsl
@@ -59,9 +61,10 @@ LOCAL_SRC_FILES := \
$(GLSL_COMPILER_CXX_FILES)
LOCAL_C_INCLUDES := \
- $(MESA_TOP)/src \
$(MESA_TOP)/src/mapi \
- $(MESA_TOP)/src/mesa
+ $(MESA_TOP)/src/mesa \
+ $(MESA_TOP)/src/gallium/include \
+ $(MESA_TOP)/src/gallium/auxiliary
LOCAL_STATIC_LIBRARIES := libmesa_glsl libmesa_glsl_utils libmesa_util
diff --git a/mesalib/src/glsl/ast_function.cpp b/mesalib/src/glsl/ast_function.cpp
index 87df93e68..758361324 100644
--- a/mesalib/src/glsl/ast_function.cpp
+++ b/mesalib/src/glsl/ast_function.cpp
@@ -1191,7 +1191,7 @@ emit_inline_matrix_constructor(const glsl_type *type,
*
* - Construct a matrix from an arbirary combination of vectors and
* scalars. The components of the constructor parameters are assigned
- * to the matrix in colum-major order until the matrix is full.
+ * to the matrix in column-major order until the matrix is full.
*
* - Construct a matrix from a single matrix. The source matrix is copied
* to the upper left portion of the constructed matrix, and the remaining
diff --git a/mesalib/src/glsl/ast_to_hir.cpp b/mesalib/src/glsl/ast_to_hir.cpp
index 78369360f..18b82e3be 100644
--- a/mesalib/src/glsl/ast_to_hir.cpp
+++ b/mesalib/src/glsl/ast_to_hir.cpp
@@ -3532,9 +3532,7 @@ ast_declarator_list::hir(exec_list *instructions,
* vectors. Vertex shader inputs cannot be arrays or
* structures."
*/
- const glsl_type *check_type = var->type;
- while (check_type->is_array())
- check_type = check_type->element_type();
+ const glsl_type *check_type = var->type->without_array();
switch (check_type->base_type) {
case GLSL_TYPE_FLOAT:
diff --git a/mesalib/src/glsl/glcpp/glcpp-parse.y b/mesalib/src/glsl/glcpp/glcpp-parse.y
index c2f5223a9..cfceca66b 100644
--- a/mesalib/src/glsl/glcpp/glcpp-parse.y
+++ b/mesalib/src/glsl/glcpp/glcpp-parse.y
@@ -1463,7 +1463,7 @@ _arguments_parse (argument_list_t *arguments,
else {
if (argument->head == NULL) {
/* Don't treat initial whitespace as
- * part of the arguement. */
+ * part of the argument. */
if (node->token->type == SPACE)
continue;
}
diff --git a/mesalib/src/glsl/glsl_types.cpp b/mesalib/src/glsl/glsl_types.cpp
index 4aa36a794..9c9b7efcb 100644
--- a/mesalib/src/glsl/glsl_types.cpp
+++ b/mesalib/src/glsl/glsl_types.cpp
@@ -738,24 +738,27 @@ glsl_type::record_key_compare(const void *a, const void *b)
}
+/**
+ * Generate an integer hash value for a glsl_type structure type.
+ */
unsigned
glsl_type::record_key_hash(const void *a)
{
const glsl_type *const key = (glsl_type *) a;
- char hash_key[128];
- unsigned size = 0;
-
- size = snprintf(hash_key, sizeof(hash_key), "%08x", key->length);
+ uintptr_t hash = key->length;
+ unsigned retval;
for (unsigned i = 0; i < key->length; i++) {
- if (size >= sizeof(hash_key))
- break;
-
- size += snprintf(& hash_key[size], sizeof(hash_key) - size,
- "%p", (void *) key->fields.structure[i].type);
+ /* casting pointer to uintptr_t */
+ hash = (hash * 13 ) + (uintptr_t) key->fields.structure[i].type;
}
- return hash_table_string_hash(& hash_key);
+ if (sizeof(hash) == 8)
+ retval = (hash & 0xffffffff) ^ ((uint64_t) hash >> 32);
+ else
+ retval = hash;
+
+ return retval;
}
diff --git a/mesalib/src/glsl/glsl_types.h b/mesalib/src/glsl/glsl_types.h
index d383dd5be..5645dcd50 100644
--- a/mesalib/src/glsl/glsl_types.h
+++ b/mesalib/src/glsl/glsl_types.h
@@ -540,7 +540,12 @@ struct glsl_type {
*/
const glsl_type *without_array() const
{
- return this->is_array() ? this->fields.array : this;
+ const glsl_type *t = this;
+
+ while (t->is_array())
+ t = t->fields.array;
+
+ return t;
}
/**
diff --git a/mesalib/src/glsl/link_uniforms.cpp b/mesalib/src/glsl/link_uniforms.cpp
index 59adc298b..d5ca23a38 100644
--- a/mesalib/src/glsl/link_uniforms.cpp
+++ b/mesalib/src/glsl/link_uniforms.cpp
@@ -274,7 +274,7 @@ namespace {
*
* As uniforms are added to the active set the number of active uniforms and
* the storage requirements for those uniforms are accumulated. The active
- * uniforms are added the the hash table supplied to the constructor.
+ * uniforms are added to the hash table supplied to the constructor.
*
* If the same uniform is added multiple times (i.e., once for each shader
* target), it will only be accounted once.
diff --git a/mesalib/src/glsl/linker.cpp b/mesalib/src/glsl/linker.cpp
index b6baa5d36..21fde9444 100644
--- a/mesalib/src/glsl/linker.cpp
+++ b/mesalib/src/glsl/linker.cpp
@@ -2570,7 +2570,8 @@ add_interface_variables(struct gl_shader_program *shProg,
if (var->data.location != SYSTEM_VALUE_VERTEX_ID &&
var->data.location != SYSTEM_VALUE_VERTEX_ID_ZERO_BASE &&
var->data.location != SYSTEM_VALUE_INSTANCE_ID)
- continue;
+ continue;
+ /* FALLTHROUGH */
case ir_var_shader_in:
if (programInterface != GL_PROGRAM_INPUT)
continue;
diff --git a/mesalib/src/glsl/lower_packed_varyings.cpp b/mesalib/src/glsl/lower_packed_varyings.cpp
index 2c9a1c495..d8bebb522 100644
--- a/mesalib/src/glsl/lower_packed_varyings.cpp
+++ b/mesalib/src/glsl/lower_packed_varyings.cpp
@@ -645,13 +645,7 @@ lower_packed_varyings_visitor::needs_lowering(ir_variable *var)
if (var->data.explicit_location)
return false;
- const glsl_type *type = var->type;
- if (this->gs_input_vertices != 0) {
- assert(type->is_array());
- type = type->element_type();
- }
- if (type->is_array())
- type = type->fields.array;
+ const glsl_type *type = var->type->without_array();
if (type->vector_elements == 4 && !type->is_double())
return false;
return true;
diff --git a/mesalib/src/glsl/lower_packing_builtins.cpp b/mesalib/src/glsl/lower_packing_builtins.cpp
index db73c7b0f..a6fb8a883 100644
--- a/mesalib/src/glsl/lower_packing_builtins.cpp
+++ b/mesalib/src/glsl/lower_packing_builtins.cpp
@@ -569,8 +569,8 @@ private:
* return pack_uvec2_to_uint(uvec2(
* round(clamp(VEC2_RVALUE, 0.0f, 1.0f) * 65535.0f)));
*
- * Here it is safe to directly convert the vec2 to uvec2 because the the
- * vec2 has been clamped to a non-negative range.
+ * Here it is safe to directly convert the vec2 to uvec2 because the vec2
+ * has been clamped to a non-negative range.
*/
assert(vec2_rval->type == glsl_type::vec2_type);
@@ -613,8 +613,8 @@ private:
* return pack_uvec4_to_uint(uvec4(
* round(clamp(VEC2_RVALUE, 0.0f, 1.0f) * 255.0f)));
*
- * Here it is safe to directly convert the vec4 to uvec4 because the the
- * vec4 has been clamped to a non-negative range.
+ * Here it is safe to directly convert the vec4 to uvec4 because the vec4
+ * has been clamped to a non-negative range.
*/
assert(vec4_rval->type == glsl_type::vec4_type);
diff --git a/mesalib/src/glsl/nir/nir.c b/mesalib/src/glsl/nir/nir.c
index c6e53612b..4cc074b80 100644
--- a/mesalib/src/glsl/nir/nir.c
+++ b/mesalib/src/glsl/nir/nir.c
@@ -589,6 +589,66 @@ nir_copy_deref(void *mem_ctx, nir_deref *deref)
return NULL;
}
+/* Returns a load_const instruction that represents the constant
+ * initializer for the given deref chain. The caller is responsible for
+ * ensuring that there actually is a constant initializer.
+ */
+nir_load_const_instr *
+nir_deref_get_const_initializer_load(nir_shader *shader, nir_deref_var *deref)
+{
+ nir_constant *constant = deref->var->constant_initializer;
+ assert(constant);
+
+ const nir_deref *tail = &deref->deref;
+ unsigned matrix_offset = 0;
+ while (tail->child) {
+ switch (tail->child->deref_type) {
+ case nir_deref_type_array: {
+ nir_deref_array *arr = nir_deref_as_array(tail->child);
+ assert(arr->deref_array_type == nir_deref_array_type_direct);
+ if (glsl_type_is_matrix(tail->type)) {
+ assert(arr->deref.child == NULL);
+ matrix_offset = arr->base_offset;
+ } else {
+ constant = constant->elements[arr->base_offset];
+ }
+ break;
+ }
+
+ case nir_deref_type_struct: {
+ constant = constant->elements[nir_deref_as_struct(tail->child)->index];
+ break;
+ }
+
+ default:
+ unreachable("Invalid deref child type");
+ }
+
+ tail = tail->child;
+ }
+
+ nir_load_const_instr *load =
+ nir_load_const_instr_create(shader, glsl_get_vector_elements(tail->type));
+
+ matrix_offset *= load->def.num_components;
+ for (unsigned i = 0; i < load->def.num_components; i++) {
+ switch (glsl_get_base_type(tail->type)) {
+ case GLSL_TYPE_FLOAT:
+ case GLSL_TYPE_INT:
+ case GLSL_TYPE_UINT:
+ load->value.u[i] = constant->value.u[matrix_offset + i];
+ break;
+ case GLSL_TYPE_BOOL:
+ load->value.u[i] = constant->value.b[matrix_offset + i] ?
+ NIR_TRUE : NIR_FALSE;
+ break;
+ default:
+ unreachable("Invalid immediate type");
+ }
+ }
+
+ return load;
+}
/**
* \name Control flow modification
@@ -1800,33 +1860,37 @@ src_does_not_use_reg(nir_src *src, void *void_reg)
void
nir_instr_rewrite_src(nir_instr *instr, nir_src *src, nir_src new_src)
{
- if (src->is_ssa) {
- nir_ssa_def *old_ssa = src->ssa;
- *src = new_src;
- if (old_ssa && nir_foreach_src(instr, src_does_not_use_def, old_ssa)) {
- struct set_entry *entry = _mesa_set_search(old_ssa->uses, instr);
- assert(entry);
- _mesa_set_remove(old_ssa->uses, entry);
- }
- } else {
- if (src->reg.indirect)
- nir_instr_rewrite_src(instr, src->reg.indirect, new_src);
-
- nir_register *old_reg = src->reg.reg;
- *src = new_src;
- if (old_reg && nir_foreach_src(instr, src_does_not_use_reg, old_reg)) {
- struct set_entry *entry = _mesa_set_search(old_reg->uses, instr);
- assert(entry);
- _mesa_set_remove(old_reg->uses, entry);
+ nir_src old_src = *src;
+ *src = new_src;
+
+ for (nir_src *iter_src = &old_src; iter_src;
+ iter_src = iter_src->is_ssa ? NULL : iter_src->reg.indirect) {
+ if (iter_src->is_ssa) {
+ nir_ssa_def *ssa = iter_src->ssa;
+ if (ssa && nir_foreach_src(instr, src_does_not_use_def, ssa)) {
+ struct set_entry *entry = _mesa_set_search(ssa->uses, instr);
+ assert(entry);
+ _mesa_set_remove(ssa->uses, entry);
+ }
+ } else {
+ nir_register *reg = iter_src->reg.reg;
+ if (reg && nir_foreach_src(instr, src_does_not_use_reg, reg)) {
+ struct set_entry *entry = _mesa_set_search(reg->uses, instr);
+ assert(entry);
+ _mesa_set_remove(reg->uses, entry);
+ }
}
}
- if (new_src.is_ssa) {
- if (new_src.ssa)
- _mesa_set_add(new_src.ssa->uses, instr);
- } else {
- if (new_src.reg.reg)
- _mesa_set_add(new_src.reg.reg->uses, instr);
+ for (nir_src *iter_src = &new_src; iter_src;
+ iter_src = iter_src->is_ssa ? NULL : iter_src->reg.indirect) {
+ if (iter_src->is_ssa) {
+ if (iter_src->ssa)
+ _mesa_set_add(iter_src->ssa->uses, instr);
+ } else {
+ if (iter_src->reg.reg)
+ _mesa_set_add(iter_src->reg.reg->uses, instr);
+ }
}
}
diff --git a/mesalib/src/glsl/nir/nir.h b/mesalib/src/glsl/nir/nir.h
index 74772c798..98b0ec328 100644
--- a/mesalib/src/glsl/nir/nir.h
+++ b/mesalib/src/glsl/nir/nir.h
@@ -960,7 +960,8 @@ typedef struct {
static inline unsigned
nir_tex_instr_dest_size(nir_tex_instr *instr)
{
- if (instr->op == nir_texop_txs) {
+ switch (instr->op) {
+ case nir_texop_txs: {
unsigned ret;
switch (instr->sampler_dim) {
case GLSL_SAMPLER_DIM_1D:
@@ -985,13 +986,18 @@ nir_tex_instr_dest_size(nir_tex_instr *instr)
return ret;
}
- if (instr->op == nir_texop_query_levels)
+ case nir_texop_lod:
return 2;
- if (instr->is_shadow && instr->is_new_style_shadow)
+ case nir_texop_query_levels:
return 1;
- return 4;
+ default:
+ if (instr->is_shadow && instr->is_new_style_shadow)
+ return 1;
+
+ return 4;
+ }
}
static inline unsigned
@@ -1514,6 +1520,9 @@ nir_deref_struct *nir_deref_struct_create(void *mem_ctx, unsigned field_index);
nir_deref *nir_copy_deref(void *mem_ctx, nir_deref *deref);
+nir_load_const_instr *
+nir_deref_get_const_initializer_load(nir_shader *shader, nir_deref_var *deref);
+
void nir_instr_insert_before(nir_instr *instr, nir_instr *before);
void nir_instr_insert_after(nir_instr *instr, nir_instr *after);
diff --git a/mesalib/src/glsl/nir/nir_array.h b/mesalib/src/glsl/nir/nir_array.h
new file mode 100644
index 000000000..1db4e8cea
--- /dev/null
+++ b/mesalib/src/glsl/nir/nir_array.h
@@ -0,0 +1,96 @@
+/*
+ * Copyright © 2015 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ * Authors:
+ * Jason Ekstrand (jason@jlekstrand.net)
+ *
+ */
+
+#pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct {
+ void *mem_ctx;
+ size_t size;
+ size_t alloc;
+ void *data;
+} nir_array;
+
+static inline void
+nir_array_init(nir_array *arr, void *mem_ctx)
+{
+ arr->mem_ctx = mem_ctx;
+ arr->size = 0;
+ arr->alloc = 0;
+ arr->data = NULL;
+}
+
+static inline void
+nir_array_fini(nir_array *arr)
+{
+ if (arr->mem_ctx)
+ ralloc_free(arr->data);
+ else
+ free(arr->data);
+}
+
+#define NIR_ARRAY_INITIAL_SIZE 64
+
+/* Increments the size of the array by the given ammount and returns a
+ * pointer to the beginning of the newly added space.
+ */
+static inline void *
+nir_array_grow(nir_array *arr, size_t additional)
+{
+ size_t new_size = arr->size + additional;
+ if (new_size > arr->alloc) {
+ if (arr->alloc == 0)
+ arr->alloc = NIR_ARRAY_INITIAL_SIZE;
+
+ while (new_size > arr->alloc)
+ arr->alloc *= 2;
+
+ if (arr->mem_ctx)
+ arr->data = reralloc_size(arr->mem_ctx, arr->data, arr->alloc);
+ else
+ arr->data = realloc(arr->data, arr->alloc);
+ }
+
+ void *ptr = (void *)((char *)arr->data + arr->size);
+ arr->size = new_size;
+
+ return ptr;
+}
+
+#define nir_array_add(arr, type, elem) \
+ *(type *)nir_array_grow(arr, sizeof(type)) = (elem)
+
+#define nir_array_foreach(arr, type, elem) \
+ for (type *elem = (type *)(arr)->data; \
+ elem < (type *)((char *)(arr)->data + (arr)->size); elem++)
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
diff --git a/mesalib/src/glsl/nir/nir_from_ssa.c b/mesalib/src/glsl/nir/nir_from_ssa.c
index 184698abd..6a3b141bd 100644
--- a/mesalib/src/glsl/nir/nir_from_ssa.c
+++ b/mesalib/src/glsl/nir/nir_from_ssa.c
@@ -642,7 +642,7 @@ emit_copy(nir_parallel_copy_instr *pcopy, nir_src src, nir_src dest_src,
*
* The algorithm works by playing this little shell game with the values.
* We start by recording where every source value is and which source value
- * each destination value should recieve. We then grab any copy whose
+ * each destination value should receive. We then grab any copy whose
* destination is "empty", i.e. not used as a source, and do the following:
* - Find where its source value currently lives
* - Emit the move instruction
diff --git a/mesalib/src/glsl/nir/nir_lower_locals_to_regs.c b/mesalib/src/glsl/nir/nir_lower_locals_to_regs.c
index 8c5df7be6..bc6a3d320 100644
--- a/mesalib/src/glsl/nir/nir_lower_locals_to_regs.c
+++ b/mesalib/src/glsl/nir/nir_lower_locals_to_regs.c
@@ -26,13 +26,20 @@
*/
#include "nir.h"
+#include "nir_array.h"
struct locals_to_regs_state {
- void *mem_ctx;
+ nir_shader *shader;
nir_function_impl *impl;
/* A hash table mapping derefs to registers */
struct hash_table *regs_table;
+
+ /* A growing array of derefs that we have encountered. There is exactly
+ * one element of this array per element in the hash table. This is
+ * used to make adding register initialization code deterministic.
+ */
+ nir_array derefs_array;
};
/* The following two functions implement a hash and equality check for
@@ -100,15 +107,8 @@ get_reg_for_deref(nir_deref_var *deref, struct locals_to_regs_state *state)
unsigned array_size = 1;
nir_deref *tail = &deref->deref;
while (tail->child) {
- if (tail->child->deref_type == nir_deref_type_array) {
- /* Multiply by the parent's type. */
- if (glsl_type_is_matrix(tail->type)) {
- array_size *= glsl_get_matrix_columns(tail->type);
- } else {
- assert(glsl_get_length(tail->type) > 0);
- array_size *= glsl_get_length(tail->type);
- }
- }
+ if (tail->child->deref_type == nir_deref_type_array)
+ array_size *= glsl_get_length(tail->type);
tail = tail->child;
}
@@ -119,6 +119,7 @@ get_reg_for_deref(nir_deref_var *deref, struct locals_to_regs_state *state)
reg->num_array_elems = array_size > 1 ? array_size : 0;
_mesa_hash_table_insert_pre_hashed(state->regs_table, hash, deref, reg);
+ nir_array_add(&state->derefs_array, nir_deref_var *, deref);
return reg;
}
@@ -134,6 +135,14 @@ get_deref_reg_src(nir_deref_var *deref, nir_instr *instr,
src.reg.base_offset = 0;
src.reg.indirect = NULL;
+ /* It is possible for a user to create a shader that has an array with a
+ * single element and then proceed to access it indirectly. Indirectly
+ * accessing a non-array register is not allowed in NIR. In order to
+ * handle this case we just convert it to a direct reference.
+ */
+ if (src.reg.reg->num_array_elems == 0)
+ return src;
+
nir_deref *tail = &deref->deref;
while (tail->child != NULL) {
const struct glsl_type *parent_type = tail->type;
@@ -149,11 +158,11 @@ get_deref_reg_src(nir_deref_var *deref, nir_instr *instr,
if (src.reg.indirect) {
nir_load_const_instr *load_const =
- nir_load_const_instr_create(state->mem_ctx, 1);
+ nir_load_const_instr_create(state->shader, 1);
load_const->value.u[0] = glsl_get_length(parent_type);
nir_instr_insert_before(instr, &load_const->instr);
- nir_alu_instr *mul = nir_alu_instr_create(state->mem_ctx, nir_op_imul);
+ nir_alu_instr *mul = nir_alu_instr_create(state->shader, nir_op_imul);
mul->src[0].src = *src.reg.indirect;
mul->src[1].src.is_ssa = true;
mul->src[1].src.ssa = &load_const->def;
@@ -167,15 +176,15 @@ get_deref_reg_src(nir_deref_var *deref, nir_instr *instr,
if (deref_array->deref_array_type == nir_deref_array_type_indirect) {
if (src.reg.indirect == NULL) {
- src.reg.indirect = ralloc(state->mem_ctx, nir_src);
+ src.reg.indirect = ralloc(state->shader, nir_src);
nir_src_copy(src.reg.indirect, &deref_array->indirect,
- state->mem_ctx);
+ state->shader);
} else {
- nir_alu_instr *add = nir_alu_instr_create(state->mem_ctx,
+ nir_alu_instr *add = nir_alu_instr_create(state->shader,
nir_op_iadd);
add->src[0].src = *src.reg.indirect;
nir_src_copy(&add->src[1].src, &deref_array->indirect,
- state->mem_ctx);
+ state->shader);
add->dest.write_mask = 1;
nir_ssa_dest_init(&add->instr, &add->dest.dest, 1, NULL);
nir_instr_insert_before(instr, &add->instr);
@@ -205,7 +214,7 @@ lower_locals_to_regs_block(nir_block *block, void *void_state)
if (intrin->variables[0]->var->data.mode != nir_var_local)
continue;
- nir_alu_instr *mov = nir_alu_instr_create(state->mem_ctx, nir_op_imov);
+ nir_alu_instr *mov = nir_alu_instr_create(state->shader, nir_op_imov);
mov->src[0].src = get_deref_reg_src(intrin->variables[0],
&intrin->instr, state);
mov->dest.write_mask = (1 << intrin->num_components) - 1;
@@ -214,9 +223,9 @@ lower_locals_to_regs_block(nir_block *block, void *void_state)
intrin->num_components, NULL);
nir_ssa_def_rewrite_uses(&intrin->dest.ssa,
nir_src_for_ssa(&mov->dest.dest.ssa),
- state->mem_ctx);
+ state->shader);
} else {
- nir_dest_copy(&mov->dest.dest, &intrin->dest, state->mem_ctx);
+ nir_dest_copy(&mov->dest.dest, &intrin->dest, state->shader);
}
nir_instr_insert_before(&intrin->instr, &mov->instr);
@@ -231,8 +240,8 @@ lower_locals_to_regs_block(nir_block *block, void *void_state)
nir_src reg_src = get_deref_reg_src(intrin->variables[0],
&intrin->instr, state);
- nir_alu_instr *mov = nir_alu_instr_create(state->mem_ctx, nir_op_imov);
- nir_src_copy(&mov->src[0].src, &intrin->src[0], state->mem_ctx);
+ nir_alu_instr *mov = nir_alu_instr_create(state->shader, nir_op_imov);
+ nir_src_copy(&mov->src[0].src, &intrin->src[0], state->shader);
mov->dest.write_mask = (1 << intrin->num_components) - 1;
mov->dest.dest.is_ssa = false;
mov->dest.dest.reg.reg = reg_src.reg.reg;
@@ -257,20 +266,115 @@ lower_locals_to_regs_block(nir_block *block, void *void_state)
return true;
}
+static nir_block *
+compute_reg_usedef_lca(nir_register *reg)
+{
+ struct set_entry *entry;
+ nir_block *lca = NULL;
+
+ set_foreach(reg->defs, entry)
+ lca = nir_dominance_lca(lca, ((nir_instr *)entry->key)->block);
+
+ set_foreach(reg->uses, entry)
+ lca = nir_dominance_lca(lca, ((nir_instr *)entry->key)->block);
+
+ set_foreach(reg->if_uses, entry) {
+ nir_if *if_stmt = (nir_if *)entry->key;
+ nir_cf_node *prev_node = nir_cf_node_prev(&if_stmt->cf_node);
+ assert(prev_node->type == nir_cf_node_block);
+ lca = nir_dominance_lca(lca, nir_cf_node_as_block(prev_node));
+ }
+
+ return lca;
+}
+
+static void
+insert_constant_initializer(nir_deref_var *deref_head, nir_deref *deref_tail,
+ nir_block *block,
+ struct locals_to_regs_state *state)
+{
+ if (deref_tail->child) {
+ switch (deref_tail->child->deref_type) {
+ case nir_deref_type_array: {
+ unsigned array_elems = glsl_get_length(deref_tail->type);
+
+ nir_deref_array arr_deref;
+ arr_deref.deref = *deref_tail->child;
+ arr_deref.deref_array_type = nir_deref_array_type_direct;
+
+ nir_deref *old_child = deref_tail->child;
+ deref_tail->child = &arr_deref.deref;
+ for (unsigned i = 0; i < array_elems; i++) {
+ arr_deref.base_offset = i;
+ insert_constant_initializer(deref_head, &arr_deref.deref,
+ block, state);
+ }
+ deref_tail->child = old_child;
+ return;
+ }
+
+ case nir_deref_type_struct:
+ insert_constant_initializer(deref_head, deref_tail->child,
+ block, state);
+ return;
+
+ default:
+ unreachable("Invalid deref child type");
+ }
+ }
+
+ assert(deref_tail->child == NULL);
+
+ nir_load_const_instr *load =
+ nir_deref_get_const_initializer_load(state->shader, deref_head);
+ nir_instr_insert_before_block(block, &load->instr);
+
+ nir_src reg_src = get_deref_reg_src(deref_head, &load->instr, state);
+
+ nir_alu_instr *mov = nir_alu_instr_create(state->shader, nir_op_imov);
+ mov->src[0].src = nir_src_for_ssa(&load->def);
+ mov->dest.write_mask = (1 << load->def.num_components) - 1;
+ mov->dest.dest.is_ssa = false;
+ mov->dest.dest.reg.reg = reg_src.reg.reg;
+ mov->dest.dest.reg.base_offset = reg_src.reg.base_offset;
+ mov->dest.dest.reg.indirect = reg_src.reg.indirect;
+
+ nir_instr_insert_after(&load->instr, &mov->instr);
+}
+
static void
nir_lower_locals_to_regs_impl(nir_function_impl *impl)
{
struct locals_to_regs_state state;
- state.mem_ctx = ralloc_parent(impl);
+ state.shader = impl->overload->function->shader;
state.impl = impl;
state.regs_table = _mesa_hash_table_create(NULL, hash_deref, derefs_equal);
+ nir_array_init(&state.derefs_array, NULL);
+
+ nir_metadata_require(impl, nir_metadata_dominance);
nir_foreach_block(impl, lower_locals_to_regs_block, &state);
+ nir_array_foreach(&state.derefs_array, nir_deref_var *, deref_ptr) {
+ nir_deref_var *deref = *deref_ptr;
+ struct hash_entry *deref_entry =
+ _mesa_hash_table_search(state.regs_table, deref);
+ assert(deref_entry && deref_entry->key == deref);
+ nir_register *reg = (nir_register *)deref_entry->data;
+
+ if (deref->var->constant_initializer == NULL)
+ continue;
+
+ nir_block *usedef_lca = compute_reg_usedef_lca(reg);
+
+ insert_constant_initializer(deref, &deref->deref, usedef_lca, &state);
+ }
+
nir_metadata_preserve(impl, nir_metadata_block_index |
nir_metadata_dominance);
+ nir_array_fini(&state.derefs_array);
_mesa_hash_table_destroy(state.regs_table, NULL);
}
diff --git a/mesalib/src/glsl/nir/nir_lower_to_source_mods.c b/mesalib/src/glsl/nir/nir_lower_to_source_mods.c
index d6bf77f17..7b4a0f657 100644
--- a/mesalib/src/glsl/nir/nir_lower_to_source_mods.c
+++ b/mesalib/src/glsl/nir/nir_lower_to_source_mods.c
@@ -67,6 +67,13 @@ nir_lower_to_source_mods_block(nir_block *block, void *state)
continue;
}
+ /* We can only do a rewrite if the source we are copying is SSA.
+ * Otherwise, moving the read might invalidly reorder reads/writes
+ * on a register.
+ */
+ if (!parent->src[0].src.is_ssa)
+ continue;
+
nir_instr_rewrite_src(instr, &alu->src[i].src, parent->src[0].src);
if (alu->src[i].abs) {
/* abs trumps both neg and abs, do nothing */
diff --git a/mesalib/src/glsl/nir/nir_lower_var_copies.c b/mesalib/src/glsl/nir/nir_lower_var_copies.c
index 58389a7c7..21672901f 100644
--- a/mesalib/src/glsl/nir/nir_lower_var_copies.c
+++ b/mesalib/src/glsl/nir/nir_lower_var_copies.c
@@ -64,26 +64,6 @@ get_deref_tail(nir_deref *deref)
return deref;
}
-static int
-type_get_length(const struct glsl_type *type)
-{
- switch (glsl_get_base_type(type)) {
- case GLSL_TYPE_STRUCT:
- case GLSL_TYPE_ARRAY:
- return glsl_get_length(type);
- case GLSL_TYPE_FLOAT:
- case GLSL_TYPE_INT:
- case GLSL_TYPE_UINT:
- case GLSL_TYPE_BOOL:
- if (glsl_type_is_matrix(type))
- return glsl_get_matrix_columns(type);
- else
- return glsl_get_vector_elements(type);
- default:
- unreachable("Invalid deref base type");
- }
-}
-
/* This function recursively walks the given deref chain and replaces the
* given copy instruction with an equivalent sequence load/store
* operations.
@@ -121,9 +101,9 @@ emit_copy_load_store(nir_intrinsic_instr *copy_instr,
nir_deref_array *src_arr = nir_deref_as_array(src_arr_parent->child);
nir_deref_array *dest_arr = nir_deref_as_array(dest_arr_parent->child);
- unsigned length = type_get_length(src_arr_parent->type);
+ unsigned length = glsl_get_length(src_arr_parent->type);
/* The wildcards should represent the same number of elements */
- assert(length == type_get_length(dest_arr_parent->type));
+ assert(length == glsl_get_length(dest_arr_parent->type));
assert(length > 0);
/* Walk over all of the elements that this wildcard refers to and
diff --git a/mesalib/src/glsl/nir/nir_lower_vars_to_ssa.c b/mesalib/src/glsl/nir/nir_lower_vars_to_ssa.c
index 2ca74d71b..bb60f4601 100644
--- a/mesalib/src/glsl/nir/nir_lower_vars_to_ssa.c
+++ b/mesalib/src/glsl/nir/nir_lower_vars_to_ssa.c
@@ -55,7 +55,7 @@ struct deref_node {
};
struct lower_variables_state {
- void *mem_ctx;
+ nir_shader *shader;
void *dead_ctx;
nir_function_impl *impl;
@@ -90,34 +90,14 @@ struct lower_variables_state {
struct hash_table *phi_table;
};
-static int
-type_get_length(const struct glsl_type *type)
-{
- switch (glsl_get_base_type(type)) {
- case GLSL_TYPE_STRUCT:
- case GLSL_TYPE_ARRAY:
- return glsl_get_length(type);
- case GLSL_TYPE_FLOAT:
- case GLSL_TYPE_INT:
- case GLSL_TYPE_UINT:
- case GLSL_TYPE_BOOL:
- if (glsl_type_is_matrix(type))
- return glsl_get_matrix_columns(type);
- else
- return glsl_get_vector_elements(type);
- default:
- unreachable("Invalid deref base type");
- }
-}
-
static struct deref_node *
deref_node_create(struct deref_node *parent,
- const struct glsl_type *type, void *mem_ctx)
+ const struct glsl_type *type, nir_shader *shader)
{
size_t size = sizeof(struct deref_node) +
- type_get_length(type) * sizeof(struct deref_node *);
+ glsl_get_length(type) * sizeof(struct deref_node *);
- struct deref_node *node = rzalloc_size(mem_ctx, size);
+ struct deref_node *node = rzalloc_size(shader, size);
node->type = type;
node->parent = parent;
node->deref = NULL;
@@ -165,7 +145,7 @@ get_deref_node(nir_deref_var *deref, struct lower_variables_state *state)
case nir_deref_type_struct: {
nir_deref_struct *deref_struct = nir_deref_as_struct(tail);
- assert(deref_struct->index < type_get_length(node->type));
+ assert(deref_struct->index < glsl_get_length(node->type));
if (node->children[deref_struct->index] == NULL)
node->children[deref_struct->index] =
@@ -184,7 +164,7 @@ get_deref_node(nir_deref_var *deref, struct lower_variables_state *state)
* out-of-bounds offset. We need to handle this at least
* somewhat gracefully.
*/
- if (arr->base_offset >= type_get_length(node->type))
+ if (arr->base_offset >= glsl_get_length(node->type))
return NULL;
if (node->children[arr->base_offset] == NULL)
@@ -317,6 +297,10 @@ deref_may_be_aliased_node(struct deref_node *node, nir_deref *deref,
if (arr->deref_array_type == nir_deref_array_type_indirect)
return true;
+ /* If there is an indirect at this level, we're aliased. */
+ if (node->indirect)
+ return true;
+
assert(arr->deref_array_type == nir_deref_array_type_direct);
if (node->children[arr->base_offset] &&
@@ -465,7 +449,7 @@ lower_copies_to_load_store(struct deref_node *node,
set_foreach(node->copies, copy_entry) {
nir_intrinsic_instr *copy = (void *)copy_entry->key;
- nir_lower_var_copy_instr(copy, state->mem_ctx);
+ nir_lower_var_copy_instr(copy, state->shader);
for (unsigned i = 0; i < 2; ++i) {
struct deref_node *arg_node =
@@ -485,67 +469,6 @@ lower_copies_to_load_store(struct deref_node *node,
return true;
}
-/* Returns a load_const instruction that represents the constant
- * initializer for the given deref chain. The caller is responsible for
- * ensuring that there actually is a constant initializer.
- */
-static nir_load_const_instr *
-get_const_initializer_load(const nir_deref_var *deref,
- struct lower_variables_state *state)
-{
- nir_constant *constant = deref->var->constant_initializer;
- const nir_deref *tail = &deref->deref;
- unsigned matrix_offset = 0;
- while (tail->child) {
- switch (tail->child->deref_type) {
- case nir_deref_type_array: {
- nir_deref_array *arr = nir_deref_as_array(tail->child);
- assert(arr->deref_array_type == nir_deref_array_type_direct);
- if (glsl_type_is_matrix(tail->type)) {
- assert(arr->deref.child == NULL);
- matrix_offset = arr->base_offset;
- } else {
- constant = constant->elements[arr->base_offset];
- }
- break;
- }
-
- case nir_deref_type_struct: {
- constant = constant->elements[nir_deref_as_struct(tail->child)->index];
- break;
- }
-
- default:
- unreachable("Invalid deref child type");
- }
-
- tail = tail->child;
- }
-
- nir_load_const_instr *load =
- nir_load_const_instr_create(state->mem_ctx,
- glsl_get_vector_elements(tail->type));
-
- matrix_offset *= load->def.num_components;
- for (unsigned i = 0; i < load->def.num_components; i++) {
- switch (glsl_get_base_type(tail->type)) {
- case GLSL_TYPE_FLOAT:
- case GLSL_TYPE_INT:
- case GLSL_TYPE_UINT:
- load->value.u[i] = constant->value.u[matrix_offset + i];
- break;
- case GLSL_TYPE_BOOL:
- load->value.u[i] = constant->value.b[matrix_offset + i] ?
- NIR_TRUE : NIR_FALSE;
- break;
- default:
- unreachable("Invalid immediate type");
- }
- }
-
- return load;
-}
-
/** Pushes an SSA def onto the def stack for the given node
*
* Each node is potentially associated with a stack of SSA definitions.
@@ -614,7 +537,7 @@ get_ssa_def_for_block(struct deref_node *node, nir_block *block,
* given block. This means that we need to add an undef and use that.
*/
nir_ssa_undef_instr *undef =
- nir_ssa_undef_instr_create(state->mem_ctx,
+ nir_ssa_undef_instr_create(state->shader,
glsl_get_vector_elements(node->type));
nir_instr_insert_before_cf_list(&state->impl->body, &undef->instr);
def_stack_push(node, &undef->def, state);
@@ -694,7 +617,7 @@ rename_variables_block(nir_block *block, struct lower_variables_state *state)
* should result in an undefined value.
*/
nir_ssa_undef_instr *undef =
- nir_ssa_undef_instr_create(state->mem_ctx,
+ nir_ssa_undef_instr_create(state->shader,
intrin->num_components);
nir_instr_insert_before(&intrin->instr, &undef->instr);
@@ -702,14 +625,14 @@ rename_variables_block(nir_block *block, struct lower_variables_state *state)
nir_ssa_def_rewrite_uses(&intrin->dest.ssa,
nir_src_for_ssa(&undef->def),
- state->mem_ctx);
+ state->shader);
continue;
}
if (!node->lower_to_ssa)
continue;
- nir_alu_instr *mov = nir_alu_instr_create(state->mem_ctx,
+ nir_alu_instr *mov = nir_alu_instr_create(state->shader,
nir_op_imov);
mov->src[0].src.is_ssa = true;
mov->src[0].src.ssa = get_ssa_def_for_block(node, block, state);
@@ -727,7 +650,7 @@ rename_variables_block(nir_block *block, struct lower_variables_state *state)
nir_ssa_def_rewrite_uses(&intrin->dest.ssa,
nir_src_for_ssa(&mov->dest.dest.ssa),
- state->mem_ctx);
+ state->shader);
break;
}
@@ -750,7 +673,7 @@ rename_variables_block(nir_block *block, struct lower_variables_state *state)
assert(intrin->src[0].is_ssa);
- nir_alu_instr *mov = nir_alu_instr_create(state->mem_ctx,
+ nir_alu_instr *mov = nir_alu_instr_create(state->shader,
nir_op_imov);
mov->src[0].src.is_ssa = true;
mov->src[0].src.ssa = intrin->src[0].ssa;
@@ -887,7 +810,7 @@ insert_phi_nodes(struct lower_variables_state *state)
continue;
if (has_already[next->index] < iter_count) {
- nir_phi_instr *phi = nir_phi_instr_create(state->mem_ctx);
+ nir_phi_instr *phi = nir_phi_instr_create(state->shader);
nir_ssa_dest_init(&phi->instr, &phi->dest,
glsl_get_vector_elements(node->type), NULL);
nir_instr_insert_before_block(next, &phi->instr);
@@ -938,8 +861,8 @@ nir_lower_vars_to_ssa_impl(nir_function_impl *impl)
{
struct lower_variables_state state;
- state.mem_ctx = ralloc_parent(impl);
- state.dead_ctx = ralloc_context(state.mem_ctx);
+ state.shader = impl->overload->function->shader;
+ state.dead_ctx = ralloc_context(state.shader);
state.impl = impl;
state.deref_var_nodes = _mesa_hash_table_create(state.dead_ctx,
@@ -983,7 +906,8 @@ nir_lower_vars_to_ssa_impl(nir_function_impl *impl)
progress = true;
if (deref->var->constant_initializer) {
- nir_load_const_instr *load = get_const_initializer_load(deref, &state);
+ nir_load_const_instr *load =
+ nir_deref_get_const_initializer_load(state.shader, deref);
nir_ssa_def_init(&load->instr, &load->def,
glsl_get_vector_elements(node->type), NULL);
nir_instr_insert_before_cf_list(&impl->body, &load->instr);
diff --git a/mesalib/src/glsl/nir/nir_opt_algebraic.py b/mesalib/src/glsl/nir/nir_opt_algebraic.py
index cdb19241c..2a2b9561e 100644
--- a/mesalib/src/glsl/nir/nir_opt_algebraic.py
+++ b/mesalib/src/glsl/nir/nir_opt_algebraic.py
@@ -144,6 +144,7 @@ optimizations = [
(('fexp', ('fmul', ('flog', a), b)), ('fpow', a, b), '!options->lower_fpow'), # e^(ln(a)*b) = a^b
(('fpow', a, 1.0), a),
(('fpow', a, 2.0), ('fmul', a, a)),
+ (('fpow', a, 4.0), ('fmul', ('fmul', a, a), ('fmul', a, a))),
(('fpow', 2.0, a), ('fexp2', a)),
(('fsqrt', ('fexp2', a)), ('fexp2', ('fmul', 0.5, a))),
(('fsqrt', ('fexp', a)), ('fexp', ('fmul', 0.5, a))),
diff --git a/mesalib/src/glsl/nir/nir_print.c b/mesalib/src/glsl/nir/nir_print.c
index fb8c9344c..eb4045cec 100644
--- a/mesalib/src/glsl/nir/nir_print.c
+++ b/mesalib/src/glsl/nir/nir_print.c
@@ -533,6 +533,8 @@ print_load_const_instr(nir_load_const_instr *instr, unsigned tabs, FILE *fp)
fprintf(fp, "0x%08x /* %f */", instr->value.u[i], instr->value.f[i]);
}
+
+ fprintf(fp, ")");
}
static void
diff --git a/mesalib/src/glsl/nir/nir_types.cpp b/mesalib/src/glsl/nir/nir_types.cpp
index f0d0b46d2..62176f508 100644
--- a/mesalib/src/glsl/nir/nir_types.cpp
+++ b/mesalib/src/glsl/nir/nir_types.cpp
@@ -103,7 +103,7 @@ glsl_get_matrix_columns(const struct glsl_type *type)
unsigned
glsl_get_length(const struct glsl_type *type)
{
- return type->length;
+ return type->is_matrix() ? type->matrix_columns : type->length;
}
const char *
diff --git a/mesalib/src/glsl/opt_algebraic.cpp b/mesalib/src/glsl/opt_algebraic.cpp
index 3d2f2ca0b..fa5db70f2 100644
--- a/mesalib/src/glsl/opt_algebraic.cpp
+++ b/mesalib/src/glsl/opt_algebraic.cpp
@@ -99,6 +99,12 @@ is_vec_two(ir_constant *ir)
}
static inline bool
+is_vec_four(ir_constant *ir)
+{
+ return (ir == NULL) ? false : ir->is_value(4.0, 4);
+}
+
+static inline bool
is_vec_negative_one(ir_constant *ir)
{
return (ir == NULL) ? false : ir->is_negative_one();
@@ -774,6 +780,20 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir)
return mul(x, x);
}
+ if (is_vec_four(op_const[1])) {
+ ir_variable *x = new(ir) ir_variable(ir->operands[1]->type, "x",
+ ir_var_temporary);
+ base_ir->insert_before(x);
+ base_ir->insert_before(assign(x, ir->operands[0]));
+
+ ir_variable *squared = new(ir) ir_variable(ir->operands[1]->type,
+ "squared",
+ ir_var_temporary);
+ base_ir->insert_before(squared);
+ base_ir->insert_before(assign(squared, mul(x, x)));
+ return mul(squared, squared);
+ }
+
break;
case ir_binop_min:
diff --git a/mesalib/src/glsl/opt_dead_builtin_varyings.cpp b/mesalib/src/glsl/opt_dead_builtin_varyings.cpp
index 50c8aa763..92f20c71d 100644
--- a/mesalib/src/glsl/opt_dead_builtin_varyings.cpp
+++ b/mesalib/src/glsl/opt_dead_builtin_varyings.cpp
@@ -35,7 +35,7 @@
* the built-in varyings have pre-assigned locations. Also, the elimination
* of unused gl_TexCoord elements requires its own lowering pass anyway.
*
- * It's implemented by replacing all occurences of dead varyings with
+ * It's implemented by replacing all occurrences of dead varyings with
* temporary variables, which creates dead code. It is recommended to run
* a dead-code elimination pass after this.
*
@@ -280,7 +280,7 @@ public:
*
* We're going to break down the gl_TexCoord array into separate
* variables. First, add declarations of the new variables all
- * occurences of gl_TexCoord will be replaced with.
+ * occurrences of gl_TexCoord will be replaced with.
*/
if (info->lower_texcoord_array) {
prepare_array(ir, this->new_texcoord, ARRAY_SIZE(this->new_texcoord),
@@ -411,7 +411,7 @@ public:
* variable dereference representing gl_TexCoord[i].
*/
if (this->info->lower_texcoord_array) {
- /* gl_TexCoord[i] occurence */
+ /* gl_TexCoord[i] occurrence */
ir_dereference_array *const da = (*rvalue)->as_dereference_array();
if (da && da->variable_referenced() ==
@@ -425,7 +425,7 @@ public:
/* Same for gl_FragData. */
if (this->info->lower_fragdata_array) {
- /* gl_FragData[i] occurence */
+ /* gl_FragData[i] occurrence */
ir_dereference_array *const da = (*rvalue)->as_dereference_array();
if (da && da->variable_referenced() == this->info->fragdata_array) {
diff --git a/mesalib/src/glsl/opt_function_inlining.cpp b/mesalib/src/glsl/opt_function_inlining.cpp
index 64b4907ba..84a9e4fa0 100644
--- a/mesalib/src/glsl/opt_function_inlining.cpp
+++ b/mesalib/src/glsl/opt_function_inlining.cpp
@@ -130,7 +130,7 @@ ir_call::generate_inline(ir_instruction *next_ir)
parameters[i] = sig_param->clone(ctx, ht);
parameters[i]->data.mode = ir_var_auto;
- /* Remove the read-only decoration becuase we're going to write
+ /* Remove the read-only decoration because we're going to write
* directly to this variable. If the cloned variable is left
* read-only and the inlined function is inside a loop, the loop
* analysis code will get confused.
diff --git a/mesalib/src/glsl/standalone_scaffolding.cpp b/mesalib/src/glsl/standalone_scaffolding.cpp
index 6f5a27f85..a109c4e92 100644
--- a/mesalib/src/glsl/standalone_scaffolding.cpp
+++ b/mesalib/src/glsl/standalone_scaffolding.cpp
@@ -189,9 +189,6 @@ void initialize_context_to_defaults(struct gl_context *ctx, gl_api api)
options.MaxUnrollIterations = 32;
options.MaxIfDepth = UINT_MAX;
- /* Default pragma settings */
- options.DefaultPragmas.Optimize = true;
-
for (int sh = 0; sh < MESA_SHADER_STAGES; ++sh)
memcpy(&ctx->Const.ShaderCompilerOptions[sh], &options, sizeof(options));
}
diff --git a/mesalib/src/loader/Android.mk b/mesalib/src/loader/Android.mk
index 8daeedf5d..8e215de3c 100644
--- a/mesalib/src/loader/Android.mk
+++ b/mesalib/src/loader/Android.mk
@@ -37,7 +37,7 @@ LOCAL_SRC_FILES := \
ifeq ($(MESA_GPU_DRIVERS),swrast)
LOCAL_CFLAGS += -D__NOT_HAVE_DRM_H
else
-LOCAL_C_INCLUDES += $(TARGET_OUT_HEADERS)/libdrm
+LOCAL_SHARED_LIBRARIES := libdrm
endif
LOCAL_MODULE := libmesa_loader
diff --git a/mesalib/src/loader/loader.h b/mesalib/src/loader/loader.h
index fa57950de..810e7da7f 100644
--- a/mesalib/src/loader/loader.h
+++ b/mesalib/src/loader/loader.h
@@ -43,7 +43,7 @@ loader_get_device_name_for_fd(int fd);
/* Function to get a different device than the one we are to use by default,
* if the user requests so and it is possible. The initial fd will be closed
- * if neccessary. The returned fd is potentially a render-node.
+ * if necessary. The returned fd is potentially a render-node.
*/
int
diff --git a/mesalib/src/mapi/Android.mk b/mesalib/src/mapi/Android.mk
index f10437874..44452181e 100644
--- a/mesalib/src/mapi/Android.mk
+++ b/mesalib/src/mapi/Android.mk
@@ -53,7 +53,7 @@ LOCAL_C_INCLUDES := \
LOCAL_MODULE := libglapi
LOCAL_MODULE_CLASS := SHARED_LIBRARIES
-intermediates := $(call local-intermediates-dir)
+intermediates := $(call local-generated-sources-dir)
abi_header := $(intermediates)/$(abi_header)
LOCAL_GENERATED_SOURCES := $(abi_header)
diff --git a/mesalib/src/mapi/glapi/gen/glX_proto_send.py b/mesalib/src/mapi/glapi/gen/glX_proto_send.py
index 1419a7cc1..b93989f75 100644
--- a/mesalib/src/mapi/glapi/gen/glX_proto_send.py
+++ b/mesalib/src/mapi/glapi/gen/glX_proto_send.py
@@ -574,7 +574,7 @@ generic_%u_byte( GLint rop, const void * ptr )
print ' struct glx_context * const gc = __glXGetCurrentContext();'
# The only reason that single and vendor private commands need
- # a variable called 'dpy' is becuase they use the SyncHandle
+ # a variable called 'dpy' is because they use the SyncHandle
# macro. For whatever brain-dead reason, that macro is hard-
# coded to use a variable called 'dpy' instead of taking a
# parameter.
diff --git a/mesalib/src/mapi/glapi/gen/glX_proto_size.py b/mesalib/src/mapi/glapi/gen/glX_proto_size.py
index fdb355d4d..4737fbf71 100644
--- a/mesalib/src/mapi/glapi/gen/glX_proto_size.py
+++ b/mesalib/src/mapi/glapi/gen/glX_proto_size.py
@@ -57,7 +57,7 @@ class glx_enum_function(object):
# Fill self.count and self.enums using the dictionary of enums
# that was passed in. The generic Get functions (e.g.,
# GetBooleanv and friends) are handled specially here. In
- # the data the generic Get functions are refered to as "Get".
+ # the data the generic Get functions are referred to as "Get".
if func_name in ["GetIntegerv", "GetBooleanv", "GetFloatv", "GetDoublev"]:
match_name = "Get"
diff --git a/mesalib/src/mapi/glapi/gen/gl_x86-64_asm.py b/mesalib/src/mapi/glapi/gen/gl_x86-64_asm.py
index 5a69e0343..7afc2b108 100644
--- a/mesalib/src/mapi/glapi/gen/gl_x86-64_asm.py
+++ b/mesalib/src/mapi/glapi/gen/gl_x86-64_asm.py
@@ -187,7 +187,7 @@ class PrintGenericStubs(gl_XML.gl_print_base):
# The x86-64 ABI divides function parameters into a couple
# classes. For the OpenGL interface, the only ones that are
- # relevent are INTEGER and SSE. Basically, the first 8
+ # relevant are INTEGER and SSE. Basically, the first 8
# GLfloat or GLdouble parameters are placed in %xmm0 - %xmm7,
# the first 6 non-GLfloat / non-GLdouble parameters are placed
# in registers listed in int_parameters.
diff --git a/mesalib/src/mapi/glapi/glapi_entrypoint.c b/mesalib/src/mapi/glapi/glapi_entrypoint.c
index 7facd8aca..f1f7f5e59 100644
--- a/mesalib/src/mapi/glapi/glapi_entrypoint.c
+++ b/mesalib/src/mapi/glapi/glapi_entrypoint.c
@@ -29,6 +29,8 @@
*/
+#include <string.h>
+
#include "c11/threads.h"
#include "glapi/glapi_priv.h"
#include "u_execmem.h"
diff --git a/mesalib/src/mesa/Android.gen.mk b/mesalib/src/mesa/Android.gen.mk
index caae2c107..cc979547e 100644
--- a/mesalib/src/mesa/Android.gen.mk
+++ b/mesalib/src/mesa/Android.gen.mk
@@ -27,13 +27,16 @@ ifeq ($(LOCAL_MODULE_CLASS),)
LOCAL_MODULE_CLASS := STATIC_LIBRARIES
endif
-intermediates := $(call local-intermediates-dir)
+intermediates := $(call local-generated-sources-dir)
# This is the list of auto-generated files: sources and headers
sources := \
main/enums.c \
main/api_exec.c \
main/dispatch.h \
+ main/format_pack.c \
+ main/format_unpack.c \
+ main/format_info.h \
main/remap_helper.h \
main/get_hash.h
@@ -124,3 +127,21 @@ format_info_deps := \
$(intermediates)/main/format_info.h: $(format_info_deps)
@$(MESA_PYTHON2) $(FORMAT_INFO) $< > $@
+
+FORMAT_PACK := $(LOCAL_PATH)/main/format_pack.py
+format_pack_deps := \
+ $(LOCAL_PATH)/main/formats.csv \
+ $(LOCAL_PATH)/main/format_parser.py \
+ $(FORMAT_PACK)
+
+$(intermediates)/main/format_pack.c: $(format_pack_deps)
+ $(hide) $(MESA_PYTHON2) $(FORMAT_PACK) $< > $@
+
+FORMAT_UNPACK := $(LOCAL_PATH)/main/format_unpack.py
+format_unpack_deps := \
+ $(LOCAL_PATH)/main/formats.csv \
+ $(LOCAL_PATH)/main/format_parser.py \
+ $(FORMAT_UNPACK)
+
+$(intermediates)/main/format_unpack.c: $(format_unpack_deps)
+ $(hide) $(MESA_PYTHON2) $(FORMAT_UNPACK) $< > $@
diff --git a/mesalib/src/mesa/Android.libmesa_dricore.mk b/mesalib/src/mesa/Android.libmesa_dricore.mk
index e4a52677c..2e308b837 100644
--- a/mesalib/src/mesa/Android.libmesa_dricore.mk
+++ b/mesalib/src/mesa/Android.libmesa_dricore.mk
@@ -49,21 +49,18 @@ endif # MESA_ENABLE_ASM
ifeq ($(ARCH_X86_HAVE_SSE4_1),true)
LOCAL_SRC_FILES += \
- $(SRCDIR)main/streaming-load-memcpy.c \
- $(SRCDIR)main/sse_minmax.c
-LOCAL_CFLAGS := -msse4.1
-endif
-
-ifeq ($(ARCH_X86_HAVE_SSE4_1),true)
-LOCAL_CFLAGS += \
+ main/streaming-load-memcpy.c \
+ mesa/main/sse_minmax.c
+LOCAL_CFLAGS := \
+ -msse4.1 \
-DUSE_SSE41
endif
LOCAL_C_INCLUDES := \
- $(call intermediates-dir-for STATIC_LIBRARIES,libmesa_program,,) \
- $(MESA_TOP)/src \
$(MESA_TOP)/src/mapi \
+ $(MESA_TOP)/src/mesa/main \
$(MESA_TOP)/src/glsl \
+ $(MESA_TOP)/src/gallium/include \
$(MESA_TOP)/src/gallium/auxiliary
LOCAL_WHOLE_STATIC_LIBRARIES := \
diff --git a/mesalib/src/mesa/Android.libmesa_glsl_utils.mk b/mesalib/src/mesa/Android.libmesa_glsl_utils.mk
index a9f6ff59a..3497377af 100644
--- a/mesalib/src/mesa/Android.libmesa_glsl_utils.mk
+++ b/mesalib/src/mesa/Android.libmesa_glsl_utils.mk
@@ -36,9 +36,10 @@ include $(CLEAR_VARS)
LOCAL_MODULE := libmesa_glsl_utils
LOCAL_C_INCLUDES := \
- $(MESA_TOP)/src \
$(MESA_TOP)/src/glsl \
- $(MESA_TOP)/src/mapi
+ $(MESA_TOP)/src/mapi \
+ $(MESA_TOP)/src/gallium/include \
+ $(MESA_TOP)/src/gallium/auxiliary
LOCAL_SRC_FILES := \
main/imports.c \
@@ -59,9 +60,10 @@ LOCAL_IS_HOST_MODULE := true
LOCAL_CFLAGS := -D_POSIX_C_SOURCE=199309L
LOCAL_C_INCLUDES := \
- $(MESA_TOP)/src \
$(MESA_TOP)/src/glsl \
- $(MESA_TOP)/src/mapi
+ $(MESA_TOP)/src/mapi \
+ $(MESA_TOP)/src/gallium/include \
+ $(MESA_TOP)/src/gallium/auxiliary
LOCAL_SRC_FILES := \
main/imports.c \
diff --git a/mesalib/src/mesa/Android.libmesa_st_mesa.mk b/mesalib/src/mesa/Android.libmesa_st_mesa.mk
index a08366d53..b4b7fd977 100644
--- a/mesalib/src/mesa/Android.libmesa_st_mesa.mk
+++ b/mesalib/src/mesa/Android.libmesa_st_mesa.mk
@@ -52,12 +52,11 @@ LOCAL_CFLAGS := \
endif
LOCAL_C_INCLUDES := \
- $(call intermediates-dir-for STATIC_LIBRARIES,libmesa_program,,) \
- $(MESA_TOP)/src/gallium/auxiliary \
- $(MESA_TOP)/src/gallium/include \
- $(MESA_TOP)/src \
+ $(MESA_TOP)/src/mapi \
+ $(MESA_TOP)/src/mesa/main \
$(MESA_TOP)/src/glsl \
- $(MESA_TOP)/src/mapi
+ $(MESA_TOP)/src/gallium/auxiliary \
+ $(MESA_TOP)/src/gallium/include
LOCAL_WHOLE_STATIC_LIBRARIES := \
libmesa_program
diff --git a/mesalib/src/mesa/Android.mesa_gen_matypes.mk b/mesalib/src/mesa/Android.mesa_gen_matypes.mk
index 5521087c4..6e301f904 100644
--- a/mesalib/src/mesa/Android.mesa_gen_matypes.mk
+++ b/mesalib/src/mesa/Android.mesa_gen_matypes.mk
@@ -33,7 +33,6 @@ include $(CLEAR_VARS)
LOCAL_MODULE := mesa_gen_matypes
LOCAL_IS_HOST_MODULE := true
-LOCAL_CFLAGS := -D_POSIX_C_SOURCE=199309L
LOCAL_C_INCLUDES := \
$(MESA_TOP)/src/mapi \
diff --git a/mesalib/src/mesa/drivers/common/meta.c b/mesalib/src/mesa/drivers/common/meta.c
index cf99d9563..d2ab7b8de 100644
--- a/mesalib/src/mesa/drivers/common/meta.c
+++ b/mesalib/src/mesa/drivers/common/meta.c
@@ -41,7 +41,6 @@
#include "main/bufferobj.h"
#include "main/buffers.h"
#include "main/clear.h"
-#include "main/colortab.h"
#include "main/condrender.h"
#include "main/depth.h"
#include "main/enable.h"
diff --git a/mesalib/src/mesa/drivers/dri/Android.mk b/mesalib/src/mesa/drivers/dri/Android.mk
index 935722c53..42bfd77d4 100644
--- a/mesalib/src/mesa/drivers/dri/Android.mk
+++ b/mesalib/src/mesa/drivers/dri/Android.mk
@@ -35,17 +35,17 @@ MESA_DRI_CFLAGS := \
-DHAVE_ANDROID_PLATFORM
MESA_DRI_C_INCLUDES := \
- $(MESA_TOP)/src \
- $(call intermediates-dir-for,STATIC_LIBRARIES,libmesa_dri_common) \
$(addprefix $(MESA_TOP)/, $(mesa_dri_common_INCLUDES)) \
- $(TARGET_OUT_HEADERS)/libdrm \
+ $(MESA_TOP)/src/gallium/include \
+ $(MESA_TOP)/src/gallium/auxiliary \
external/expat/lib
MESA_DRI_WHOLE_STATIC_LIBRARIES := \
libmesa_glsl \
libmesa_megadriver_stub \
libmesa_dri_common \
- libmesa_dricore
+ libmesa_dricore \
+ libmesa_util
MESA_DRI_SHARED_LIBRARIES := \
libcutils \
@@ -55,9 +55,6 @@ MESA_DRI_SHARED_LIBRARIES := \
libglapi \
liblog
-# All DRI modules must add this to LOCAL_GENERATED_SOURCES.
-MESA_DRI_OPTIONS_H := $(call intermediates-dir-for,STATIC_LIBRARIES,libmesa_dri_common)/xmlpool/options.h
-
#-----------------------------------------------
# Build drivers and libmesa_dri_common
diff --git a/mesalib/src/mesa/drivers/dri/common/Android.mk b/mesalib/src/mesa/drivers/dri/common/Android.mk
index b95feb679..a7fcd6d57 100644
--- a/mesalib/src/mesa/drivers/dri/common/Android.mk
+++ b/mesalib/src/mesa/drivers/dri/common/Android.mk
@@ -34,16 +34,24 @@ include $(LOCAL_PATH)/Makefile.sources
LOCAL_MODULE := libmesa_dri_common
LOCAL_MODULE_CLASS := STATIC_LIBRARIES
-intermediates := $(call local-intermediates-dir)
+intermediates := $(call local-generated-sources-dir)
LOCAL_C_INCLUDES := \
- $(intermediates) \
$(MESA_DRI_C_INCLUDES)
+LOCAL_EXPORT_C_INCLUDE_DIRS := $(intermediates)
+
+# swrast only
+ifeq ($(MESA_GPU_DRIVERS),swrast)
+LOCAL_CFLAGS := -D__NOT_HAVE_DRM_H
+else
+LOCAL_SHARED_LIBRARIES := libdrm
+endif
+
LOCAL_SRC_FILES := $(DRI_COMMON_FILES)
-LOCAL_GENERATED_SOURCES := \
- $(intermediates)/xmlpool/options.h
+MESA_DRI_OPTIONS_H := $(intermediates)/xmlpool/options.h
+LOCAL_GENERATED_SOURCES := $(MESA_DRI_OPTIONS_H)
#
# Generate options.h from gettext translations.
@@ -73,15 +81,14 @@ $(intermediates)/xmlpool/%/LC_MESSAGES/options.mo: $(intermediates)/xmlpool/%.po
mkdir -p $(dir $@)
msgfmt -o $@ $<
-$(intermediates)/xmlpool/options.h: PRIVATE_SCRIPT := $(LOCAL_PATH)/xmlpool/gen_xmlpool.py
-$(intermediates)/xmlpool/options.h: PRIVATE_LOCALEDIR := $(intermediates)/xmlpool
-$(intermediates)/xmlpool/options.h: PRIVATE_TEMPLATE_HEADER := $(LOCAL_PATH)/xmlpool/t_options.h
-$(intermediates)/xmlpool/options.h: PRIVATE_MO_FILES := $(MESA_DRI_OPTIONS_LANGS:%=$(intermediates)/xmlpool/%/LC_MESSAGES/options.mo)
+$(MESA_DRI_OPTIONS_H): PRIVATE_SCRIPT := $(LOCAL_PATH)/xmlpool/gen_xmlpool.py
+$(MESA_DRI_OPTIONS_H): PRIVATE_LOCALEDIR := $(intermediates)/xmlpool
+$(MESA_DRI_OPTIONS_H): PRIVATE_TEMPLATE_HEADER := $(LOCAL_PATH)/xmlpool/t_options.h
+$(MESA_DRI_OPTIONS_H): PRIVATE_MO_FILES := $(MESA_DRI_OPTIONS_LANGS:%=$(intermediates)/xmlpool/%/LC_MESSAGES/options.mo)
.SECONDEXPANSION:
-$(intermediates)/xmlpool/options.h: $$(PRIVATE_SCRIPT) $$(PRIVATE_TEMPLATE_HEADER) $$(PRIVATE_MO_FILES)
- mkdir -p $(dir $@)
- mkdir -p $(PRIVATE_LOCALEDIR)
- $(MESA_PYTHON2) $(PRIVATE_SCRIPT) $(PRIVATE_TEMPLATE_HEADER) \
+$(MESA_DRI_OPTIONS_H): $$(PRIVATE_SCRIPT) $$(PRIVATE_TEMPLATE_HEADER) $$(PRIVATE_MO_FILES)
+ @mkdir -p $(dir $@)
+ $(hide) $(MESA_PYTHON2) $(PRIVATE_SCRIPT) $(PRIVATE_TEMPLATE_HEADER) \
$(PRIVATE_LOCALEDIR) $(MESA_DRI_OPTIONS_LANGS) > $@
include $(MESA_COMMON_MK)
@@ -99,6 +106,13 @@ LOCAL_MODULE_CLASS := STATIC_LIBRARIES
LOCAL_C_INCLUDES := \
$(MESA_DRI_C_INCLUDES)
+# swrast only
+ifeq ($(MESA_GPU_DRIVERS),swrast)
+LOCAL_CFLAGS := -D__NOT_HAVE_DRM_H
+else
+LOCAL_SHARED_LIBRARIES := libdrm
+endif
+
LOCAL_SRC_FILES := $(megadriver_stub_FILES)
include $(MESA_COMMON_MK)
diff --git a/mesalib/src/mesa/drivers/dri/common/drirc b/mesalib/src/mesa/drivers/dri/common/drirc
index cecd6a953..145e707a6 100644
--- a/mesalib/src/mesa/drivers/dri/common/drirc
+++ b/mesalib/src/mesa/drivers/dri/common/drirc
@@ -91,5 +91,9 @@ TODO: document the other workarounds.
<application name="Dead Island" executable="DeadIslandGame">
<option name="allow_glsl_extension_directive_midshader" value="true" />
</application>
+
+ <application name="Second Life" executable="do-not-directly-run-secondlife-bin">
+ <option name="allow_glsl_extension_directive_midshader" value="true" />
+ </application>
</device>
</driconf>
diff --git a/mesalib/src/mesa/main/compiler.h b/mesalib/src/mesa/main/compiler.h
index 55152fdef..93b4e6f12 100644
--- a/mesalib/src/mesa/main/compiler.h
+++ b/mesalib/src/mesa/main/compiler.h
@@ -60,11 +60,6 @@ extern "C" {
#endif
-/* XXX: Use standard `__func__` instead */
-#ifndef __FUNCTION__
-# define __FUNCTION__ __func__
-#endif
-
/**
* Either define MESA_BIG_ENDIAN or MESA_LITTLE_ENDIAN, and CPU_TO_LE32.
* Do not use these unless absolutely necessary!
diff --git a/mesalib/src/mesa/main/context.c b/mesalib/src/mesa/main/context.c
index adf64976e..4aaf8b1af 100644
--- a/mesalib/src/mesa/main/context.c
+++ b/mesalib/src/mesa/main/context.c
@@ -894,14 +894,14 @@ update_default_objects(struct gl_context *ctx)
* If there's no current OpenGL context for the calling thread, we can
* print a message to stderr.
*
- * \param name the name of the OpenGL function, without the "gl" prefix
+ * \param name the name of the OpenGL function
*/
static void
nop_handler(const char *name)
{
GET_CURRENT_CONTEXT(ctx);
if (ctx) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "gl%s(invalid call)", name);
+ _mesa_error(ctx, GL_INVALID_OPERATION, "%s(invalid call)", name);
}
#if defined(DEBUG)
else if (getenv("MESA_DEBUG") || getenv("LIBGL_DEBUG")) {
@@ -936,7 +936,7 @@ alloc_dispatch_table(void)
{
/* Find the larger of Mesa's dispatch table and libGL's dispatch table.
* In practice, this'll be the same for stand-alone Mesa. But for DRI
- * Mesa we do this to accomodate different versions of libGL and various
+ * Mesa we do this to accommodate different versions of libGL and various
* DRI drivers.
*/
GLint numEntries = MAX2(_glapi_get_dispatch_table_size(), _gloffset_COUNT);
diff --git a/mesalib/src/mesa/main/extensions.c b/mesalib/src/mesa/main/extensions.c
index 861b15006..9be8993b0 100644
--- a/mesalib/src/mesa/main/extensions.c
+++ b/mesalib/src/mesa/main/extensions.c
@@ -186,6 +186,7 @@ static const struct extension extension_table[] = {
{ "GL_ARB_texture_rectangle", o(NV_texture_rectangle), GL, 2004 },
{ "GL_ARB_texture_rgb10_a2ui", o(ARB_texture_rgb10_a2ui), GL, 2009 },
{ "GL_ARB_texture_rg", o(ARB_texture_rg), GL, 2008 },
+ { "GL_ARB_texture_stencil8", o(ARB_texture_stencil8), GL, 2013 },
{ "GL_ARB_texture_storage", o(dummy_true), GL, 2011 },
{ "GL_ARB_texture_storage_multisample", o(ARB_texture_multisample), GL, 2012 },
{ "GL_ARB_texture_view", o(ARB_texture_view), GL, 2012 },
@@ -297,6 +298,7 @@ static const struct extension extension_table[] = {
{ "GL_OES_depth_texture", o(ARB_depth_texture), ES2, 2006 },
{ "GL_OES_depth_texture_cube_map", o(OES_depth_texture_cube_map), ES2, 2012 },
{ "GL_OES_draw_texture", o(OES_draw_texture), ES1, 2004 },
+ { "GL_OES_EGL_sync", o(dummy_true), ES1 | ES2, 2010 },
/* FIXME: Mesa expects GL_OES_EGL_image to be available in OpenGL contexts. */
{ "GL_OES_EGL_image", o(OES_EGL_image), GL | ES1 | ES2, 2006 },
{ "GL_OES_EGL_image_external", o(OES_EGL_image_external), ES1 | ES2, 2010 },
diff --git a/mesalib/src/mesa/main/fbobject.c b/mesalib/src/mesa/main/fbobject.c
index 8032585ab..27cf97f17 100644
--- a/mesalib/src/mesa/main/fbobject.c
+++ b/mesalib/src/mesa/main/fbobject.c
@@ -813,8 +813,10 @@ test_attachment_completeness(const struct gl_context *ctx, GLenum format,
if (ctx->Extensions.ARB_depth_texture &&
baseFormat == GL_DEPTH_STENCIL) {
/* OK */
- }
- else {
+ } else if (ctx->Extensions.ARB_texture_stencil8 &&
+ baseFormat == GL_STENCIL_INDEX) {
+ /* OK */
+ } else {
/* no such thing as stencil-only textures */
att_incomplete("illegal stencil texture");
att->Complete = GL_FALSE;
@@ -978,7 +980,8 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx,
if (!is_format_color_renderable(ctx, attFormat,
texImg->InternalFormat) &&
- !is_legal_depth_format(ctx, f)) {
+ !is_legal_depth_format(ctx, f) &&
+ f != GL_STENCIL_INDEX) {
fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
fbo_incomplete(ctx, "texture attachment incomplete", -1);
return;
diff --git a/mesalib/src/mesa/main/ffvertex_prog.c b/mesalib/src/mesa/main/ffvertex_prog.c
index edf7e3390..7fdd9bab6 100644
--- a/mesalib/src/mesa/main/ffvertex_prog.c
+++ b/mesalib/src/mesa/main/ffvertex_prog.c
@@ -1657,7 +1657,7 @@ _mesa_get_fixed_func_vertex_program(struct gl_context *ctx)
struct gl_vertex_program *prog;
struct state_key key;
- /* Grab all the relevent state and put it in a single structure:
+ /* Grab all the relevant state and put it in a single structure:
*/
make_state_key(ctx, &key);
diff --git a/mesalib/src/mesa/main/formats.c b/mesalib/src/mesa/main/formats.c
index 2bc8bcad9..8af44e905 100644
--- a/mesalib/src/mesa/main/formats.c
+++ b/mesalib/src/mesa/main/formats.c
@@ -811,7 +811,7 @@ _mesa_format_image_size(mesa_format format, GLsizei width,
/**
* Same as _mesa_format_image_size() but returns a 64-bit value to
- * accomodate very large textures.
+ * accommodate very large textures.
*/
uint64_t
_mesa_format_image_size64(mesa_format format, GLsizei width,
diff --git a/mesalib/src/mesa/main/macros.h b/mesalib/src/mesa/main/macros.h
index 3344ec841..0608650ae 100644
--- a/mesalib/src/mesa/main/macros.h
+++ b/mesalib/src/mesa/main/macros.h
@@ -31,6 +31,7 @@
#ifndef MACROS_H
#define MACROS_H
+#include "util/macros.h"
#include "util/u_math.h"
#include "imports.h"
@@ -800,10 +801,6 @@ DIFFERENT_SIGNS(GLfloat x, GLfloat y)
}
-/** Compute ceiling of integer quotient of A divided by B. */
-#define DIV_ROUND_UP( A, B ) ( (A) % (B) == 0 ? (A)/(B) : (A)/(B)+1 )
-
-
/** casts to silence warnings with some compilers */
#define ENUM_TO_INT(E) ((GLint)(E))
#define ENUM_TO_FLOAT(E) ((GLfloat)(GLint)(E))
diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h
index 1c751cfff..fb4143086 100644
--- a/mesalib/src/mesa/main/mtypes.h
+++ b/mesalib/src/mesa/main/mtypes.h
@@ -2365,16 +2365,6 @@ struct gl_ati_fragment_shader_state
};
-/** Set by #pragma directives */
-struct gl_sl_pragmas
-{
- GLboolean IgnoreOptimize; /**< ignore #pragma optimize(on/off) ? */
- GLboolean IgnoreDebug; /**< ignore #pragma debug(on/off) ? */
- GLboolean Optimize; /**< defaults on */
- GLboolean Debug; /**< defaults off */
-};
-
-
/**
* A GLSL vertex or fragment shader object.
*/
@@ -2397,7 +2387,6 @@ struct gl_shader
struct gl_program *Program; /**< Post-compile assembly code */
GLchar *InfoLog;
- struct gl_sl_pragmas Pragmas;
unsigned Version; /**< GLSL version used for linking */
@@ -2903,8 +2892,6 @@ struct gl_shader_compiler_options
*/
GLboolean OptimizeForAOS;
- struct gl_sl_pragmas DefaultPragmas; /**< Default #pragma settings */
-
const struct nir_shader_compiler_options *NirOptions;
};
diff --git a/mesalib/src/mesa/main/shader_query.cpp b/mesalib/src/mesa/main/shader_query.cpp
index b5f1d082c..d2ca49b43 100644
--- a/mesalib/src/mesa/main/shader_query.cpp
+++ b/mesalib/src/mesa/main/shader_query.cpp
@@ -291,7 +291,6 @@ _mesa_GetAttribLocation(GLhandleARB program, const GLcharARB * name)
return (loc >= 0) ? loc : -1;
}
-
unsigned
_mesa_count_active_attribs(struct gl_shader_program *shProg)
{
@@ -300,19 +299,15 @@ _mesa_count_active_attribs(struct gl_shader_program *shProg)
return 0;
}
- exec_list *const ir = shProg->_LinkedShaders[MESA_SHADER_VERTEX]->ir;
- unsigned i = 0;
-
- foreach_in_list(ir_instruction, node, ir) {
- const ir_variable *const var = node->as_variable();
-
- if (!is_active_attrib(var))
- continue;
-
- i++;
+ struct gl_program_resource *res = shProg->ProgramResourceList;
+ unsigned count = 0;
+ for (unsigned j = 0; j < shProg->NumProgramResourceList; j++, res++) {
+ if (res->Type == GL_PROGRAM_INPUT &&
+ res->StageReferences & (1 << MESA_SHADER_VERTEX) &&
+ is_active_attrib(RESOURCE_VAR(res)))
+ count++;
}
-
- return i;
+ return count;
}
@@ -324,20 +319,16 @@ _mesa_longest_attribute_name_length(struct gl_shader_program *shProg)
return 0;
}
- exec_list *const ir = shProg->_LinkedShaders[MESA_SHADER_VERTEX]->ir;
+ struct gl_program_resource *res = shProg->ProgramResourceList;
size_t longest = 0;
+ for (unsigned j = 0; j < shProg->NumProgramResourceList; j++, res++) {
+ if (res->Type == GL_PROGRAM_INPUT &&
+ res->StageReferences & (1 << MESA_SHADER_VERTEX)) {
- foreach_in_list(ir_instruction, node, ir) {
- const ir_variable *const var = node->as_variable();
-
- if (var == NULL
- || var->data.mode != ir_var_shader_in
- || var->data.location == -1)
- continue;
-
- const size_t len = strlen(var->name);
- if (len >= longest)
- longest = len + 1;
+ const size_t length = strlen(RESOURCE_VAR(res)->name);
+ if (length >= longest)
+ longest = length + 1;
+ }
}
return longest;
@@ -537,6 +528,7 @@ array_index_of_resource(struct gl_program_resource *res,
return get_matching_index(RESOURCE_VAR(res), name);
default:
assert(!"support for resource type not implemented");
+ return -1;
}
}
@@ -634,7 +626,7 @@ _mesa_program_resource_find_index(struct gl_shader_program *shProg,
case GL_ATOMIC_COUNTER_BUFFER:
if (_mesa_program_resource_index(shProg, res) == index)
return res;
-
+ break;
case GL_TRANSFORM_FEEDBACK_VARYING:
case GL_PROGRAM_INPUT:
case GL_PROGRAM_OUTPUT:
@@ -860,13 +852,23 @@ get_buffer_property(struct gl_shader_program *shProg,
*val = RESOURCE_UBO(res)->UniformBufferSize;
return 1;
case GL_NUM_ACTIVE_VARIABLES:
- *val = RESOURCE_UBO(res)->NumUniforms;
+ *val = 0;
+ for (unsigned i = 0; i < RESOURCE_UBO(res)->NumUniforms; i++) {
+ const char *iname = RESOURCE_UBO(res)->Uniforms[i].IndexName;
+ struct gl_program_resource *uni =
+ _mesa_program_resource_find_name(shProg, GL_UNIFORM, iname);
+ if (!uni)
+ continue;
+ (*val)++;
+ }
return 1;
case GL_ACTIVE_VARIABLES:
for (unsigned i = 0; i < RESOURCE_UBO(res)->NumUniforms; i++) {
const char *iname = RESOURCE_UBO(res)->Uniforms[i].IndexName;
struct gl_program_resource *uni =
_mesa_program_resource_find_name(shProg, GL_UNIFORM, iname);
+ if (!uni)
+ continue;
*val++ =
_mesa_program_resource_index(shProg, uni);
}
diff --git a/mesalib/src/mesa/main/shaderapi.c b/mesalib/src/mesa/main/shaderapi.c
index 77e2b8745..a04b28711 100644
--- a/mesalib/src/mesa/main/shaderapi.c
+++ b/mesalib/src/mesa/main/shaderapi.c
@@ -115,9 +115,6 @@ _mesa_init_shader_state(struct gl_context *ctx)
options.MaxUnrollIterations = 32;
options.MaxIfDepth = UINT_MAX;
- /* Default pragma settings */
- options.DefaultPragmas.Optimize = GL_TRUE;
-
for (sh = 0; sh < MESA_SHADER_STAGES; ++sh)
memcpy(&ctx->Const.ShaderCompilerOptions[sh], &options, sizeof(options));
@@ -864,17 +861,11 @@ static void
compile_shader(struct gl_context *ctx, GLuint shaderObj)
{
struct gl_shader *sh;
- struct gl_shader_compiler_options *options;
sh = _mesa_lookup_shader_err(ctx, shaderObj, "glCompileShader");
if (!sh)
return;
- options = &ctx->Const.ShaderCompilerOptions[sh->Stage];
-
- /* set default pragma state for shader */
- sh->Pragmas = options->DefaultPragmas;
-
if (!sh->Source) {
/* If the user called glCompileShader without first calling
* glShaderSource, we should fail to compile, but not raise a GL_ERROR.
diff --git a/mesalib/src/mesa/main/texgetimage.c b/mesalib/src/mesa/main/texgetimage.c
index 255d36559..92b4d6795 100644
--- a/mesalib/src/mesa/main/texgetimage.c
+++ b/mesalib/src/mesa/main/texgetimage.c
@@ -175,6 +175,51 @@ get_tex_depth_stencil(struct gl_context *ctx, GLuint dimensions,
}
}
+/**
+ * glGetTexImage for stencil pixels.
+ */
+static void
+get_tex_stencil(struct gl_context *ctx, GLuint dimensions,
+ GLenum format, GLenum type, GLvoid *pixels,
+ struct gl_texture_image *texImage)
+{
+ const GLint width = texImage->Width;
+ const GLint height = texImage->Height;
+ const GLint depth = texImage->Depth;
+ GLint img, row;
+
+ assert(format == GL_STENCIL_INDEX);
+
+ for (img = 0; img < depth; img++) {
+ GLubyte *srcMap;
+ GLint rowstride;
+
+ /* map src texture buffer */
+ ctx->Driver.MapTextureImage(ctx, texImage, img,
+ 0, 0, width, height, GL_MAP_READ_BIT,
+ &srcMap, &rowstride);
+
+ if (srcMap) {
+ for (row = 0; row < height; row++) {
+ const GLubyte *src = srcMap + row * rowstride;
+ void *dest = _mesa_image_address(dimensions, &ctx->Pack, pixels,
+ width, height, format, type,
+ img, row, 0);
+ _mesa_unpack_ubyte_stencil_row(texImage->TexFormat,
+ width,
+ (const GLuint *) src,
+ dest);
+ }
+
+ ctx->Driver.UnmapTextureImage(ctx, texImage, img);
+ }
+ else {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGetTexImage");
+ break;
+ }
+ }
+}
+
/**
* glGetTexImage for YCbCr pixels.
@@ -285,7 +330,7 @@ get_tex_rgba_compressed(struct gl_context *ctx, GLuint dimensions,
}
/* Depending on the base format involved we may need to apply a rebase
- * tranaform (for example: if we download to a Luminance format we want
+ * transform (for example: if we download to a Luminance format we want
* G=0 and B=0).
*/
if (baseFormat == GL_LUMINANCE ||
@@ -388,7 +433,7 @@ get_tex_rgba_uncompressed(struct gl_context *ctx, GLuint dimensions,
}
/* Depending on the base format involved we may need to apply a rebase
- * tranaform (for example: if we download to a Luminance format we want
+ * transform (for example: if we download to a Luminance format we want
* G=0 and B=0).
*/
if (texImage->_BaseFormat == GL_LUMINANCE ||
@@ -684,6 +729,9 @@ _mesa_GetTexImage_sw(struct gl_context *ctx,
else if (format == GL_DEPTH_STENCIL_EXT) {
get_tex_depth_stencil(ctx, dimensions, format, type, pixels, texImage);
}
+ else if (format == GL_STENCIL_INDEX) {
+ get_tex_stencil(ctx, dimensions, format, type, pixels, texImage);
+ }
else if (format == GL_YCBCR_MESA) {
get_tex_ycbcr(ctx, dimensions, format, type, pixels, texImage);
}
@@ -879,7 +927,7 @@ getteximage_error_check(struct gl_context *ctx,
"glGetTex%sImage(format mismatch)", suffix);
return GL_TRUE;
}
- else if (_mesa_is_enum_format_integer(format) !=
+ else if (!_mesa_is_stencil_format(format) && _mesa_is_enum_format_integer(format) !=
_mesa_is_format_integer(texImage->TexFormat)) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glGetTex%sImage(format mismatch)", suffix);
diff --git a/mesalib/src/mesa/main/teximage.c b/mesalib/src/mesa/main/teximage.c
index 8d9d7cfc1..7bc1da7f8 100644
--- a/mesalib/src/mesa/main/teximage.c
+++ b/mesalib/src/mesa/main/teximage.c
@@ -1997,7 +1997,8 @@ _mesa_legal_texture_base_format_for_target(struct gl_context *ctx,
const char *caller)
{
if (_mesa_base_tex_format(ctx, internalFormat) == GL_DEPTH_COMPONENT
- || _mesa_base_tex_format(ctx, internalFormat) == GL_DEPTH_STENCIL) {
+ || _mesa_base_tex_format(ctx, internalFormat) == GL_DEPTH_STENCIL
+ || _mesa_base_tex_format(ctx, internalFormat) == GL_STENCIL_INDEX) {
/* Section 3.8.3 (Texture Image Specification) of the OpenGL 3.3 Core
* Profile spec says:
*
@@ -3319,7 +3320,9 @@ teximage(struct gl_context *ctx, GLboolean compressed, GLuint dims,
if (!sizeOK) {
_mesa_error(ctx, GL_OUT_OF_MEMORY,
- "glTexImage%uD(image too large)", dims);
+ "glTexImage%uD(image too large: %d x %d x %d, %s format)",
+ dims, width, height, depth,
+ _mesa_lookup_enum_by_nr(internalFormat));
return;
}
diff --git a/mesalib/src/mesa/main/texobj.c b/mesalib/src/mesa/main/texobj.c
index e018ab910..c563f1e74 100644
--- a/mesalib/src/mesa/main/texobj.c
+++ b/mesalib/src/mesa/main/texobj.c
@@ -30,7 +30,6 @@
#include <stdio.h>
#include "bufferobj.h"
-#include "colortab.h"
#include "context.h"
#include "enums.h"
#include "fbobject.h"
diff --git a/mesalib/src/mesa/main/texturebarrier.c b/mesalib/src/mesa/main/texturebarrier.c
index 08ff56150..d879eed57 100644
--- a/mesalib/src/mesa/main/texturebarrier.c
+++ b/mesalib/src/mesa/main/texturebarrier.c
@@ -49,5 +49,11 @@ _mesa_TextureBarrierNV(void)
{
GET_CURRENT_CONTEXT(ctx);
+ if (!ctx->Extensions.NV_texture_barrier) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glTextureBarrier(not supported)");
+ return;
+ }
+
ctx->Driver.TextureBarrier(ctx);
}
diff --git a/mesalib/src/mesa/main/uniform_query.cpp b/mesalib/src/mesa/main/uniform_query.cpp
index 4e77b3284..3e857ed10 100644
--- a/mesalib/src/mesa/main/uniform_query.cpp
+++ b/mesalib/src/mesa/main/uniform_query.cpp
@@ -129,14 +129,26 @@ _mesa_GetActiveUniformsiv(GLuint program,
res_prop = resource_prop_from_uniform_prop(pname);
+ /* We need to first verify that each entry exists as active uniform. If
+ * not, generate error and do not cause any other side effects.
+ *
+ * In the case of and error condition, Page 16 (section 2.3.1 Errors)
+ * of the OpenGL 4.5 spec says:
+ *
+ * "If the generating command modifies values through a pointer argu-
+ * ment, no change is made to these values."
+ */
for (int i = 0; i < uniformCount; i++) {
- res = _mesa_program_resource_find_index(shProg, GL_UNIFORM,
- uniformIndices[i]);
- if (!res) {
+ if (!_mesa_program_resource_find_index(shProg, GL_UNIFORM,
+ uniformIndices[i])) {
_mesa_error(ctx, GL_INVALID_VALUE, "glGetActiveUniformsiv(index)");
- break;
+ return;
}
+ }
+ for (int i = 0; i < uniformCount; i++) {
+ res = _mesa_program_resource_find_index(shProg, GL_UNIFORM,
+ uniformIndices[i]);
if (!_mesa_program_resource_prop(shProg, res, uniformIndices[i],
res_prop, &params[i],
"glGetActiveUniformsiv"))
diff --git a/mesalib/src/mesa/main/version.c b/mesalib/src/mesa/main/version.c
index 7c6d99418..5b8ac0a5c 100644
--- a/mesalib/src/mesa/main/version.c
+++ b/mesalib/src/mesa/main/version.c
@@ -295,7 +295,51 @@ compute_version(const struct gl_extensions *extensions,
extensions->EXT_texture_swizzle);
/* ARB_sampler_objects is always enabled in mesa */
- if (ver_3_3) {
+ const GLboolean ver_4_0 = (ver_3_3 &&
+ consts->GLSLVersion >= 400 &&
+ extensions->ARB_draw_buffers_blend &&
+ extensions->ARB_draw_indirect &&
+ extensions->ARB_gpu_shader5 &&
+ extensions->ARB_gpu_shader_fp64 &&
+ extensions->ARB_sample_shading &&
+ 0/*extensions->ARB_shader_subroutine*/ &&
+ extensions->ARB_tessellation_shader &&
+ extensions->ARB_texture_buffer_object_rgb32 &&
+ extensions->ARB_texture_cube_map_array &&
+ extensions->ARB_texture_query_lod &&
+ extensions->ARB_transform_feedback2 &&
+ extensions->ARB_transform_feedback3);
+ const GLboolean ver_4_1 = (ver_4_0 &&
+ consts->GLSLVersion >= 410 &&
+ extensions->ARB_ES2_compatibility &&
+ extensions->ARB_shader_precision &&
+ 0/*extensions->ARB_vertex_attrib_64bit*/ &&
+ extensions->ARB_viewport_array);
+ const GLboolean ver_4_2 = (ver_4_1 &&
+ consts->GLSLVersion >= 420 &&
+ extensions->ARB_base_instance &&
+ extensions->ARB_conservative_depth &&
+ extensions->ARB_internalformat_query &&
+ extensions->ARB_shader_atomic_counters &&
+ extensions->ARB_shader_image_load_store &&
+ extensions->ARB_shading_language_420pack &&
+ extensions->ARB_shading_language_packing &&
+ extensions->ARB_texture_compression_bptc &&
+ extensions->ARB_transform_feedback_instanced);
+
+ if (ver_4_2) {
+ major = 4;
+ minor = 2;
+ }
+ else if (ver_4_1) {
+ major = 4;
+ minor = 1;
+ }
+ else if (ver_4_0) {
+ major = 4;
+ minor = 0;
+ }
+ else if (ver_3_3) {
major = 3;
minor = 3;
}
@@ -439,6 +483,23 @@ _mesa_compute_version(struct gl_context *ctx)
ctx->Version = _mesa_get_version(&ctx->Extensions, &ctx->Const, ctx->API);
+ /* Make sure that the GLSL version lines up with the GL version. In some
+ * cases it can be too high, e.g. if an extension is missing.
+ */
+ if (ctx->API == API_OPENGL_CORE) {
+ switch (ctx->Version) {
+ case 31:
+ ctx->Const.GLSLVersion = 140;
+ break;
+ case 32:
+ ctx->Const.GLSLVersion = 150;
+ break;
+ default:
+ ctx->Const.GLSLVersion = ctx->Version * 10;
+ break;
+ }
+ }
+
switch (ctx->API) {
case API_OPENGL_COMPAT:
case API_OPENGL_CORE:
diff --git a/mesalib/src/mesa/math/m_matrix.c b/mesalib/src/mesa/math/m_matrix.c
index 0475a7ab2..ecf564c00 100644
--- a/mesalib/src/mesa/math/m_matrix.c
+++ b/mesalib/src/mesa/math/m_matrix.c
@@ -50,7 +50,7 @@
/*@{*/
#define MAT_FLAG_IDENTITY 0 /**< is an identity matrix flag.
* (Not actually used - the identity
- * matrix is identified by the absense
+ * matrix is identified by the absence
* of all other flags.)
*/
#define MAT_FLAG_GENERAL 0x1 /**< is a general matrix flag */
diff --git a/mesalib/src/mesa/program/Android.mk b/mesalib/src/mesa/program/Android.mk
index a237b65bc..ccb0fa5f3 100644
--- a/mesalib/src/mesa/program/Android.mk
+++ b/mesalib/src/mesa/program/Android.mk
@@ -44,8 +44,9 @@ include $(CLEAR_VARS)
LOCAL_MODULE := libmesa_program
LOCAL_MODULE_CLASS := STATIC_LIBRARIES
+LOCAL_STATIC_LIBRARIES := libmesa_glsl
-intermediates := $(call local-intermediates-dir)
+intermediates := $(call local-generated-sources-dir)
# TODO(chadv): In Makefile.sources, move these vars to a different list so we can
# remove this kludge.
@@ -55,7 +56,8 @@ generated_sources_basenames := \
program_parse.tab.h
LOCAL_SRC_FILES := \
- $(filter-out $(generated_sources_basenames),$(subst program/,,$(PROGRAM_FILES)))
+ $(filter-out $(generated_sources_basenames),$(subst program/,,$(PROGRAM_FILES))) \
+ $(subst program/,,$(PROGRAM_NIR_FILES))
LOCAL_GENERATED_SOURCES := \
$(addprefix $(intermediates)/program/,$(generated_sources_basenames))
@@ -70,11 +72,13 @@ $(intermediates)/program/lex.yy.c: $(LOCAL_PATH)/program_lexer.l
$(local-l-to-c)
LOCAL_C_INCLUDES := \
- $(intermediates) \
- $(MESA_TOP)/src \
$(MESA_TOP)/src/mapi \
$(MESA_TOP)/src/mesa \
- $(MESA_TOP)/src/glsl
+ $(MESA_TOP)/src/glsl \
+ $(MESA_TOP)/src/gallium/auxiliary \
+ $(MESA_TOP)/src/gallium/include
+
+LOCAL_EXPORT_C_INCLUDE_DIRS := $(intermediates)
include $(MESA_COMMON_MK)
include $(BUILD_STATIC_LIBRARY)
diff --git a/mesalib/src/mesa/program/hash_table.h b/mesalib/src/mesa/program/hash_table.h
index eed2e55dc..e85a836a0 100644
--- a/mesalib/src/mesa/program/hash_table.h
+++ b/mesalib/src/mesa/program/hash_table.h
@@ -116,8 +116,8 @@ extern void hash_table_insert(struct hash_table *ht, void *data,
* Add an element to a hash table with replacement
*
* \return
- * 1 if it did replace the the value (in which case the old key is kept), 0 if
- * it did not replace the value (in which case the new key is kept).
+ * 1 if it did replace the value (in which case the old key is kept), 0 if it
+ * did not replace the value (in which case the new key is kept).
*
* \warning
* If \c key is already in the hash table, \c data will \b replace the most
diff --git a/mesalib/src/mesa/program/prog_cache.c b/mesalib/src/mesa/program/prog_cache.c
index 34609f056..ed93af7f1 100644
--- a/mesalib/src/mesa/program/prog_cache.c
+++ b/mesalib/src/mesa/program/prog_cache.c
@@ -77,7 +77,7 @@ hash_key(const void *key, GLuint key_size)
/**
- * Rebuild/expand the hash table to accomodate more entries
+ * Rebuild/expand the hash table to accommodate more entries
*/
static void
rehash(struct gl_program_cache *cache)
diff --git a/mesalib/src/mesa/program/prog_to_nir.c b/mesalib/src/mesa/program/prog_to_nir.c
index c738f5073..ff3d9f3be 100644
--- a/mesalib/src/mesa/program/prog_to_nir.c
+++ b/mesalib/src/mesa/program/prog_to_nir.c
@@ -222,12 +222,23 @@ ptn_get_src(struct ptn_compile *c, const struct prog_src_register *prog_src)
}
nir_ssa_def *def;
- if (!HAS_EXTENDED_SWIZZLE(prog_src->Swizzle)) {
+ if (!HAS_EXTENDED_SWIZZLE(prog_src->Swizzle) &&
+ (prog_src->Negate == NEGATE_NONE || prog_src->Negate == NEGATE_XYZW)) {
+ /* The simple non-SWZ case. */
for (int i = 0; i < 4; i++)
src.swizzle[i] = GET_SWZ(prog_src->Swizzle, i);
def = nir_fmov_alu(b, src, 4);
+
+ if (prog_src->Abs)
+ def = nir_fabs(b, def);
+
+ if (prog_src->Negate)
+ def = nir_fneg(b, def);
} else {
+ /* The SWZ instruction allows per-component zero/one swizzles, and also
+ * per-component negation.
+ */
nir_ssa_def *chans[4];
for (int i = 0; i < 4; i++) {
int swizzle = GET_SWZ(prog_src->Swizzle, i);
@@ -246,16 +257,16 @@ ptn_get_src(struct ptn_compile *c, const struct prog_src_register *prog_src)
chans[i] = &mov->dest.dest.ssa;
}
+
+ if (prog_src->Abs)
+ chans[i] = nir_fabs(b, chans[i]);
+
+ if (prog_src->Negate & (1 << i))
+ chans[i] = nir_fneg(b, chans[i]);
}
def = nir_vec4(b, chans[0], chans[1], chans[2], chans[3]);
}
- if (prog_src->Abs)
- def = nir_fabs(b, def);
-
- if (prog_src->Negate)
- def = nir_fneg(b, def);
-
return def;
}
diff --git a/mesalib/src/mesa/state_tracker/st_atom_texture.c b/mesalib/src/mesa/state_tracker/st_atom_texture.c
index eff28fc6f..04ba86448 100644
--- a/mesalib/src/mesa/state_tracker/st_atom_texture.c
+++ b/mesalib/src/mesa/state_tracker/st_atom_texture.c
@@ -287,16 +287,22 @@ st_get_texture_sampler_view_from_stobj(struct st_context *st,
enum pipe_format format)
{
struct pipe_sampler_view **sv;
-
+ const struct st_texture_image *firstImage;
if (!stObj || !stObj->pt) {
return NULL;
}
sv = st_texture_get_sampler_view(st, stObj);
- if (stObj->base.StencilSampling &&
- util_format_is_depth_and_stencil(format))
- format = util_format_stencil_only(format);
+ if (util_format_is_depth_and_stencil(format)) {
+ if (stObj->base.StencilSampling)
+ format = util_format_stencil_only(format);
+ else {
+ firstImage = st_texture_image_const(_mesa_base_tex_image(&stObj->base));
+ if (firstImage->base._BaseFormat == GL_STENCIL_INDEX)
+ format = util_format_stencil_only(format);
+ }
+ }
/* if sampler view has changed dereference it */
if (*sv) {
diff --git a/mesalib/src/mesa/state_tracker/st_cb_flush.c b/mesalib/src/mesa/state_tracker/st_cb_flush.c
index 6df430049..ca51eeee3 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_flush.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_flush.c
@@ -152,7 +152,7 @@ void st_init_flush_functions(struct dd_function_table *functions)
* Finish() is identical to Flush() in all cases - no differences in
* rendering or ReadPixels are visible if we opt not to wait here.
*
- * Only set this up on windows to avoid suprise elsewhere.
+ * Only set this up on Windows to avoid surprise elsewhere.
*/
#ifdef PIPE_OS_WINDOWS
functions->Finish = st_glFlush;
diff --git a/mesalib/src/mesa/state_tracker/st_cb_texture.c b/mesalib/src/mesa/state_tracker/st_cb_texture.c
index bdf236e82..7ea3846ff 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_texture.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_texture.c
@@ -950,7 +950,7 @@ st_GetTexImage(struct gl_context * ctx,
/* XXX Fallback to _mesa_GetTexImage_sw for depth-stencil formats
* due to an incomplete stencil blit implementation in some drivers. */
- if (format == GL_DEPTH_STENCIL) {
+ if (format == GL_DEPTH_STENCIL || format == GL_STENCIL_INDEX) {
goto fallback;
}
diff --git a/mesalib/src/mesa/state_tracker/st_extensions.c b/mesalib/src/mesa/state_tracker/st_extensions.c
index bc20f7323..82e4a3009 100644
--- a/mesalib/src/mesa/state_tracker/st_extensions.c
+++ b/mesalib/src/mesa/state_tracker/st_extensions.c
@@ -650,12 +650,15 @@ void st_init_extensions(struct pipe_screen *screen,
ARRAY_SIZE(vertex_mapping), PIPE_BUFFER,
PIPE_BIND_VERTEX_BUFFER);
+ if (extensions->ARB_stencil_texturing)
+ extensions->ARB_texture_stencil8 = GL_TRUE;
+
/* Figure out GLSL support. */
glsl_feature_level = screen->get_param(screen, PIPE_CAP_GLSL_FEATURE_LEVEL);
consts->GLSLVersion = glsl_feature_level;
- if (glsl_feature_level >= 330)
- consts->GLSLVersion = 330;
+ if (glsl_feature_level >= 410)
+ consts->GLSLVersion = 410;
_mesa_override_glsl_version(consts);
@@ -666,6 +669,8 @@ void st_init_extensions(struct pipe_screen *screen,
if (glsl_feature_level >= 400)
extensions->ARB_gpu_shader5 = GL_TRUE;
+ if (glsl_feature_level >= 410)
+ extensions->ARB_shader_precision = GL_TRUE;
/* This extension needs full OpenGL 3.2, but we don't know if that's
* supported at this point. Only check the GLSL version. */
diff --git a/mesalib/src/mesa/state_tracker/st_format.c b/mesalib/src/mesa/state_tracker/st_format.c
index 72dbf3bd4..181465dd8 100644
--- a/mesalib/src/mesa/state_tracker/st_format.c
+++ b/mesalib/src/mesa/state_tracker/st_format.c
@@ -1942,11 +1942,6 @@ st_ChooseTextureFormat(struct gl_context *ctx, GLenum target,
GLint internalFormat,
GLenum format, GLenum type)
{
- const boolean want_renderable =
- internalFormat == 3 || internalFormat == 4 ||
- internalFormat == GL_RGB || internalFormat == GL_RGBA ||
- internalFormat == GL_RGB8 || internalFormat == GL_RGBA8 ||
- internalFormat == GL_BGRA;
struct st_context *st = st_context(ctx);
enum pipe_format pFormat;
unsigned bindings;
@@ -1962,15 +1957,17 @@ st_ChooseTextureFormat(struct gl_context *ctx, GLenum target,
}
/* GL textures may wind up being render targets, but we don't know
- * that in advance. Specify potential render target flags now.
+ * that in advance. Specify potential render target flags now for formats
+ * that we know should always be renderable.
*/
bindings = PIPE_BIND_SAMPLER_VIEW;
- if (want_renderable) {
- if (_mesa_is_depth_or_stencil_format(internalFormat))
- bindings |= PIPE_BIND_DEPTH_STENCIL;
- else
+ if (_mesa_is_depth_or_stencil_format(internalFormat))
+ bindings |= PIPE_BIND_DEPTH_STENCIL;
+ else if (internalFormat == 3 || internalFormat == 4 ||
+ internalFormat == GL_RGB || internalFormat == GL_RGBA ||
+ internalFormat == GL_RGB8 || internalFormat == GL_RGBA8 ||
+ internalFormat == GL_BGRA)
bindings |= PIPE_BIND_RENDER_TARGET;
- }
/* GLES allows the driver to choose any format which matches
* the format+type combo, because GLES only supports unsized internal
diff --git a/mesalib/src/mesa/swrast/s_texcombine.c b/mesalib/src/mesa/swrast/s_texcombine.c
index 0adb8e5ba..453bd3636 100644
--- a/mesalib/src/mesa/swrast/s_texcombine.c
+++ b/mesalib/src/mesa/swrast/s_texcombine.c
@@ -645,7 +645,7 @@ _swrast_texture_span( struct gl_context *ctx, SWspan *span )
/*
* Must do all texture sampling before combining in order to
- * accomodate GL_ARB_texture_env_crossbar.
+ * accommodate GL_ARB_texture_env_crossbar.
*/
for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) {
const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
diff --git a/mesalib/src/mesa/tnl/t_vertex.h b/mesalib/src/mesa/tnl/t_vertex.h
index 36d8a969e..a84b299e5 100644
--- a/mesalib/src/mesa/tnl/t_vertex.h
+++ b/mesalib/src/mesa/tnl/t_vertex.h
@@ -40,7 +40,7 @@ struct tnl_clipspace;
/* It will probably be necessary to allow drivers to specify new
- * emit-styles to cover all the wierd and wacky things out there.
+ * emit-styles to cover all the weird and wacky things out there.
*/
enum tnl_attr_format {
EMIT_1F,
diff --git a/mesalib/src/mesa/vbo/vbo_exec_api.c b/mesalib/src/mesa/vbo/vbo_exec_api.c
index 859078f12..48680ec88 100644
--- a/mesalib/src/mesa/vbo/vbo_exec_api.c
+++ b/mesalib/src/mesa/vbo/vbo_exec_api.c
@@ -685,7 +685,7 @@ static void GLAPIENTRY vbo_exec_Begin( GLenum mode )
return;
}
- /* Heuristic: attempt to isolate attributes occuring outside
+ /* Heuristic: attempt to isolate attributes occurring outside
* begin/end pairs.
*/
if (exec->vtx.vertex_size && !exec->vtx.attrsz[0])
diff --git a/mesalib/src/mesa/vbo/vbo_save_draw.c b/mesalib/src/mesa/vbo/vbo_save_draw.c
index 74e266d19..de744e0c7 100644
--- a/mesalib/src/mesa/vbo/vbo_save_draw.c
+++ b/mesalib/src/mesa/vbo/vbo_save_draw.c
@@ -278,7 +278,7 @@ vbo_save_playback_vertex_list(struct gl_context *ctx, void *data)
goto end;
}
else if (save->replay_flags) {
- /* Various degnerate cases: translate into immediate mode
+ /* Various degenerate cases: translate into immediate mode
* calls rather than trying to execute in place.
*/
vbo_save_loopback_vertex_list( ctx, node );
diff --git a/mesalib/src/util/Android.mk b/mesalib/src/util/Android.mk
index 6b38cf9af..a39185ae4 100644
--- a/mesalib/src/util/Android.mk
+++ b/mesalib/src/util/Android.mk
@@ -36,27 +36,22 @@ LOCAL_SRC_FILES := \
LOCAL_C_INCLUDES := \
$(MESA_TOP)/src/mesa \
$(MESA_TOP)/src/mapi \
- $(MESA_TOP)/src
+ $(MESA_TOP)/src/gallium/include \
+ $(MESA_TOP)/src/gallium/auxiliary
LOCAL_MODULE := libmesa_util
# Generated sources
-ifeq ($(LOCAL_MODULE_CLASS),)
LOCAL_MODULE_CLASS := STATIC_LIBRARIES
-endif
-intermediates := $(call local-intermediates-dir)
+intermediates := $(call local-generated-sources-dir)
+LOCAL_GENERATED_SOURCES := $(addprefix $(intermediates)/,$(MESA_UTIL_GENERATED_FILES))
-# This is the list of auto-generated files: sources and headers
-sources := $(addprefix $(intermediates)/, $(MESA_UTIL_GENERATED_FILES))
-
-LOCAL_GENERATED_SOURCES += $(sources)
-
-FORMAT_SRGB := $(LOCAL_PATH)/format_srgb.py
-
-$(intermediates)/format_srgb.c: $(FORMAT_SRGB)
- @$(MESA_PYTHON2) $(FORMAT_SRGB) $< > $@
+$(LOCAL_GENERATED_SOURCES): PRIVATE_PYTHON := $(MESA_PYTHON2)
+$(LOCAL_GENERATED_SOURCES): PRIVATE_CUSTOM_TOOL = $(PRIVATE_PYTHON) $^ > $@
+$(LOCAL_GENERATED_SOURCES): $(intermediates)/%.c: $(LOCAL_PATH)/%.py
+ $(transform-generated-source)
include $(MESA_COMMON_MK)
include $(BUILD_STATIC_LIBRARY)
@@ -76,27 +71,22 @@ LOCAL_SRC_FILES := \
LOCAL_C_INCLUDES := \
$(MESA_TOP)/src/mesa \
$(MESA_TOP)/src/mapi \
- $(MESA_TOP)/src
+ $(MESA_TOP)/src/gallium/include \
+ $(MESA_TOP)/src/gallium/auxiliary
LOCAL_MODULE := libmesa_util
# Generated sources
-ifeq ($(LOCAL_MODULE_CLASS),)
LOCAL_MODULE_CLASS := STATIC_LIBRARIES
-endif
-
-intermediates := $(call local-intermediates-dir)
-
-# This is the list of auto-generated files: sources and headers
-sources := $(addprefix $(intermediates)/, $(MESA_UTIL_GENERATED_FILES))
-
-LOCAL_GENERATED_SOURCES += $(sources)
-FORMAT_SRGB := $(LOCAL_PATH)/format_srgb.py
+intermediates := $(call local-generated-sources-dir)
+LOCAL_GENERATED_SOURCES := $(addprefix $(intermediates)/,$(MESA_UTIL_GENERATED_FILES))
-$(intermediates)/format_srgb.c: $(FORMAT_SRGB)
- @$(MESA_PYTHON2) $(FORMAT_SRGB) $< > $@
+$(LOCAL_GENERATED_SOURCES): PRIVATE_PYTHON := $(MESA_PYTHON2)
+$(LOCAL_GENERATED_SOURCES): PRIVATE_CUSTOM_TOOL = $(PRIVATE_PYTHON) $^ > $@
+$(LOCAL_GENERATED_SOURCES): $(intermediates)/%.c: $(LOCAL_PATH)/%.py
+ $(transform-generated-source)
include $(MESA_COMMON_MK)
include $(BUILD_HOST_STATIC_LIBRARY)
diff --git a/mesalib/src/util/macros.h b/mesalib/src/util/macros.h
index 6c7bda7ae..3b708ed6a 100644
--- a/mesalib/src/util/macros.h
+++ b/mesalib/src/util/macros.h
@@ -182,5 +182,7 @@ do { \
#define UNUSED
#endif
+/** Compute ceiling of integer quotient of A divided by B. */
+#define DIV_ROUND_UP( A, B ) ( (A) % (B) == 0 ? (A)/(B) : (A)/(B)+1 )
#endif /* UTIL_MACROS_H */
diff --git a/pixman/.gitignore b/pixman/.gitignore
index 0f114966c..7da6b6f79 100644
--- a/pixman/.gitignore
+++ b/pixman/.gitignore
@@ -46,6 +46,7 @@ demos/tri-test
pixman/pixman-srgb.c
pixman/pixman-version.h
test/a1-trap-test
+test/affine-bench
test/affine-test
test/alpha-loop
test/alphamap
diff --git a/pixman/test/Makefile.sources b/pixman/test/Makefile.sources
index c20c34b17..8b0e855e2 100644
--- a/pixman/test/Makefile.sources
+++ b/pixman/test/Makefile.sources
@@ -37,6 +37,7 @@ OTHERPROGRAMS = \
radial-perf-test \
check-formats \
scaling-bench \
+ affine-bench \
$(NULL)
# Utility functions
diff --git a/pixman/test/affine-bench.c b/pixman/test/affine-bench.c
new file mode 100644
index 000000000..9e0121e77
--- /dev/null
+++ b/pixman/test/affine-bench.c
@@ -0,0 +1,436 @@
+/*
+ * Copyright © 2014 RISC OS Open Ltd
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of the copyright holders not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. The copyright holders make no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
+ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ *
+ * Author: Ben Avison (bavison@riscosopen.org)
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <stdint.h>
+#include "utils.h"
+
+#ifdef HAVE_GETTIMEOFDAY
+#include <sys/time.h>
+#else
+#include <time.h>
+#endif
+
+#define WIDTH 1920
+#define HEIGHT 1080
+
+/* How much data to read to flush all cached data to RAM */
+#define MAX_L2CACHE_SIZE (8 * 1024 * 1024)
+
+#define PAGE_SIZE (4 * 1024)
+
+struct bench_info
+{
+ pixman_op_t op;
+ pixman_transform_t transform;
+ pixman_image_t *src_image;
+ pixman_image_t *mask_image;
+ pixman_image_t *dest_image;
+ int32_t src_x;
+ int32_t src_y;
+};
+
+typedef struct bench_info bench_info_t;
+
+struct box_48_16
+{
+ pixman_fixed_48_16_t x1;
+ pixman_fixed_48_16_t y1;
+ pixman_fixed_48_16_t x2;
+ pixman_fixed_48_16_t y2;
+};
+
+typedef struct box_48_16 box_48_16_t;
+
+/* This function is copied verbatim from pixman.c. */
+static pixman_bool_t
+compute_transformed_extents (pixman_transform_t *transform,
+ const pixman_box32_t *extents,
+ box_48_16_t *transformed)
+{
+ pixman_fixed_48_16_t tx1, ty1, tx2, ty2;
+ pixman_fixed_t x1, y1, x2, y2;
+ int i;
+
+ x1 = pixman_int_to_fixed (extents->x1) + pixman_fixed_1 / 2;
+ y1 = pixman_int_to_fixed (extents->y1) + pixman_fixed_1 / 2;
+ x2 = pixman_int_to_fixed (extents->x2) - pixman_fixed_1 / 2;
+ y2 = pixman_int_to_fixed (extents->y2) - pixman_fixed_1 / 2;
+
+ if (!transform)
+ {
+ transformed->x1 = x1;
+ transformed->y1 = y1;
+ transformed->x2 = x2;
+ transformed->y2 = y2;
+
+ return TRUE;
+ }
+
+ tx1 = ty1 = INT64_MAX;
+ tx2 = ty2 = INT64_MIN;
+
+ for (i = 0; i < 4; ++i)
+ {
+ pixman_fixed_48_16_t tx, ty;
+ pixman_vector_t v;
+
+ v.vector[0] = (i & 0x01)? x1 : x2;
+ v.vector[1] = (i & 0x02)? y1 : y2;
+ v.vector[2] = pixman_fixed_1;
+
+ if (!pixman_transform_point (transform, &v))
+ return FALSE;
+
+ tx = (pixman_fixed_48_16_t)v.vector[0];
+ ty = (pixman_fixed_48_16_t)v.vector[1];
+
+ if (tx < tx1)
+ tx1 = tx;
+ if (ty < ty1)
+ ty1 = ty;
+ if (tx > tx2)
+ tx2 = tx;
+ if (ty > ty2)
+ ty2 = ty;
+ }
+
+ transformed->x1 = tx1;
+ transformed->y1 = ty1;
+ transformed->x2 = tx2;
+ transformed->y2 = ty2;
+
+ return TRUE;
+}
+
+static void
+create_image (uint32_t width,
+ uint32_t height,
+ pixman_format_code_t format,
+ pixman_filter_t filter,
+ uint32_t **bits,
+ pixman_image_t **image)
+{
+ uint32_t stride = (width * PIXMAN_FORMAT_BPP (format) + 31) / 32 * 4;
+
+ *bits = aligned_malloc (PAGE_SIZE, stride * height);
+ memset (*bits, 0xCC, stride * height);
+ *image = pixman_image_create_bits (format, width, height, *bits, stride);
+ pixman_image_set_repeat (*image, PIXMAN_REPEAT_NORMAL);
+ pixman_image_set_filter (*image, filter, NULL, 0);
+}
+
+/* This needs to match the shortest cacheline length we expect to encounter */
+#define CACHE_CLEAN_INCREMENT 32
+
+static void
+flush_cache (void)
+{
+ static const char clean_space[MAX_L2CACHE_SIZE];
+ volatile const char *x = clean_space;
+ const char *clean_end = clean_space + sizeof clean_space;
+
+ while (x < clean_end)
+ {
+ (void) *x;
+ x += CACHE_CLEAN_INCREMENT;
+ }
+}
+
+/* Obtain current time in microseconds modulo 2^32 */
+uint32_t
+gettimei (void)
+{
+#ifdef HAVE_GETTIMEOFDAY
+ struct timeval tv;
+
+ gettimeofday (&tv, NULL);
+ return tv.tv_sec * 1000000 + tv.tv_usec;
+#else
+ return (uint64_t) clock () * 1000000 / CLOCKS_PER_SEC;
+#endif
+}
+
+static void
+pixman_image_composite_wrapper (const pixman_composite_info_t *info)
+{
+ pixman_image_composite (info->op,
+ info->src_image, info->mask_image, info->dest_image,
+ info->src_x, info->src_y,
+ info->mask_x, info->mask_y,
+ info->dest_x, info->dest_y,
+ info->width, info->height);
+}
+
+static void
+pixman_image_composite_empty (const pixman_composite_info_t *info)
+{
+ pixman_image_composite (info->op,
+ info->src_image, info->mask_image, info->dest_image,
+ info->src_x, info->src_y,
+ info->mask_x, info->mask_y,
+ info->dest_x, info->dest_y,
+ 1, 1);
+}
+
+static void
+bench (const bench_info_t *bi,
+ uint32_t max_n,
+ uint32_t max_time,
+ uint32_t *ret_n,
+ uint32_t *ret_time,
+ void (*func) (const pixman_composite_info_t *info))
+{
+ uint32_t n = 0;
+ uint32_t t0;
+ uint32_t t1;
+ uint32_t x = 0;
+ pixman_transform_t t;
+ pixman_composite_info_t info;
+
+ t = bi->transform;
+ info.op = bi->op;
+ info.src_image = bi->src_image;
+ info.mask_image = bi->mask_image;
+ info.dest_image = bi->dest_image;
+ info.src_x = 0;
+ info.src_y = 0;
+ info.mask_x = 0;
+ info.mask_y = 0;
+ /* info.dest_x set below */
+ info.dest_y = 0;
+ info.width = WIDTH;
+ info.height = HEIGHT;
+
+ t0 = gettimei ();
+
+ do
+ {
+
+ if (++x >= 64)
+ x = 0;
+
+ info.dest_x = 63 - x;
+
+ t.matrix[0][2] = pixman_int_to_fixed (bi->src_x + x);
+ t.matrix[1][2] = pixman_int_to_fixed (bi->src_y);
+ pixman_image_set_transform (bi->src_image, &t);
+
+ if (bi->mask_image)
+ pixman_image_set_transform (bi->mask_image, &t);
+
+ func (&info);
+ t1 = gettimei ();
+ }
+ while (++n < max_n && (t1 - t0) < max_time);
+
+ if (ret_n)
+ *ret_n = n;
+
+ *ret_time = t1 - t0;
+}
+
+int
+parse_fixed_argument (char *arg, pixman_fixed_t *value)
+{
+ char *tailptr;
+
+ *value = pixman_double_to_fixed (strtod (arg, &tailptr));
+
+ return *tailptr == '\0';
+}
+
+int
+parse_arguments (int argc,
+ char *argv[],
+ pixman_transform_t *t,
+ pixman_op_t *op,
+ pixman_format_code_t *src_format,
+ pixman_format_code_t *mask_format,
+ pixman_format_code_t *dest_format)
+{
+ if (!parse_fixed_argument (*argv, &t->matrix[0][0]))
+ return 0;
+
+ if (*++argv == NULL)
+ return 1;
+
+ if (!parse_fixed_argument (*argv, &t->matrix[0][1]))
+ return 0;
+
+ if (*++argv == NULL)
+ return 1;
+
+ if (!parse_fixed_argument (*argv, &t->matrix[1][0]))
+ return 0;
+
+ if (*++argv == NULL)
+ return 1;
+
+ if (!parse_fixed_argument (*argv, &t->matrix[1][1]))
+ return 0;
+
+ if (*++argv == NULL)
+ return 1;
+
+ *op = operator_from_string (*argv);
+ if (*op == PIXMAN_OP_NONE)
+ return 0;
+
+ if (*++argv == NULL)
+ return 1;
+
+ *src_format = format_from_string (*argv);
+ if (*src_format == PIXMAN_null)
+ return 0;
+
+ ++argv;
+ if (argv[0] && argv[1])
+ {
+ *mask_format = format_from_string (*argv);
+ if (*mask_format == PIXMAN_null)
+ return 0;
+ ++argv;
+ }
+ if (*argv)
+ {
+ *dest_format = format_from_string (*argv);
+ if (*dest_format == PIXMAN_null)
+ return 0;
+ }
+ return 1;
+}
+
+static void
+run_benchmark (const bench_info_t *bi)
+{
+ uint32_t n; /* number of iterations in at least 5 seconds */
+ uint32_t t1; /* time taken to do n iterations, microseconds */
+ uint32_t t2; /* calling overhead for n iterations, microseconds */
+
+ flush_cache ();
+ bench (bi, UINT32_MAX, 5000000, &n, &t1, pixman_image_composite_wrapper);
+ bench (bi, n, UINT32_MAX, NULL, &t2, pixman_image_composite_empty);
+
+ /* The result indicates the output rate in megapixels/second */
+ printf ("%6.2f\n", (double) n * WIDTH * HEIGHT / (t1 - t2));
+}
+
+
+int
+main (int argc, char *argv[])
+{
+ bench_info_t binfo;
+ pixman_filter_t filter = PIXMAN_FILTER_NEAREST;
+ pixman_format_code_t src_format = PIXMAN_a8r8g8b8;
+ pixman_format_code_t mask_format = 0;
+ pixman_format_code_t dest_format = PIXMAN_a8r8g8b8;
+ pixman_box32_t dest_box = { 0, 0, WIDTH, HEIGHT };
+ box_48_16_t transformed = { 0 };
+ int32_t xmin, ymin, xmax, ymax;
+ uint32_t *src, *mask, *dest;
+
+ binfo.op = PIXMAN_OP_SRC;
+ binfo.mask_image = NULL;
+ pixman_transform_init_identity (&binfo.transform);
+
+ ++argv;
+ if (*argv && (*argv)[0] == '-' && (*argv)[1] == 'n')
+ {
+ filter = PIXMAN_FILTER_NEAREST;
+ ++argv;
+ --argc;
+ }
+
+ if (*argv && (*argv)[0] == '-' && (*argv)[1] == 'b')
+ {
+ filter = PIXMAN_FILTER_BILINEAR;
+ ++argv;
+ --argc;
+ }
+
+ if (argc == 1 ||
+ !parse_arguments (argc, argv, &binfo.transform, &binfo.op,
+ &src_format, &mask_format, &dest_format))
+ {
+ printf ("Usage: affine-bench [-n] [-b] axx [axy] [ayx] [ayy] [combine type]\n");
+ printf (" [src format] [mask format] [dest format]\n");
+ printf (" -n : nearest scaling (default)\n");
+ printf (" -b : bilinear scaling\n");
+ printf (" axx : x_out:x_in factor\n");
+ printf (" axy : x_out:y_in factor (default 0)\n");
+ printf (" ayx : y_out:x_in factor (default 0)\n");
+ printf (" ayy : y_out:y_in factor (default 1)\n");
+ printf (" combine type : src, over, in etc (default src)\n");
+ printf (" src format : a8r8g8b8, r5g6b5 etc (default a8r8g8b8)\n");
+ printf (" mask format : as for src format, but no mask used if omitted\n");
+ printf (" dest format : as for src format (default a8r8g8b8)\n");
+ printf ("The output is a single number in megapixels/second.\n");
+
+ return EXIT_FAILURE;
+ }
+
+ compute_transformed_extents (&binfo.transform, &dest_box, &transformed);
+ /* The source area is expanded by a tiny bit (8/65536th pixel)
+ * to match the calculation of the COVER_CLIP flags in analyze_extent()
+ */
+ xmin = pixman_fixed_to_int (transformed.x1 - 8 * pixman_fixed_e - pixman_fixed_1 / 2);
+ ymin = pixman_fixed_to_int (transformed.y1 - 8 * pixman_fixed_e - pixman_fixed_1 / 2);
+ xmax = pixman_fixed_to_int (transformed.x2 + 8 * pixman_fixed_e + pixman_fixed_1 / 2);
+ ymax = pixman_fixed_to_int (transformed.y2 + 8 * pixman_fixed_e + pixman_fixed_1 / 2);
+ binfo.src_x = -xmin;
+ binfo.src_y = -ymin;
+
+ /* Always over-allocate width by 64 pixels for all src, mask and dst,
+ * so that we can iterate over an x-offset 0..63 in bench ().
+ * This is similar to lowlevel-blt-bench, which uses the same method
+ * to hit different cacheline misalignments.
+ */
+ create_image (xmax - xmin + 64, ymax - ymin + 1, src_format, filter,
+ &src, &binfo.src_image);
+
+ if (mask_format)
+ {
+ create_image (xmax - xmin + 64, ymax - ymin + 1, mask_format, filter,
+ &mask, &binfo.mask_image);
+
+ if ((PIXMAN_FORMAT_R(mask_format) ||
+ PIXMAN_FORMAT_G(mask_format) ||
+ PIXMAN_FORMAT_B(mask_format)))
+ {
+ pixman_image_set_component_alpha (binfo.mask_image, 1);
+ }
+ }
+
+ create_image (WIDTH + 64, HEIGHT, dest_format, filter,
+ &dest, &binfo.dest_image);
+
+ run_benchmark (&binfo);
+
+ return EXIT_SUCCESS;
+}