Merge remote-tracking branch 'origin/stable' into dev
Conflicts: src/network/access/qhttpthreaddelegate.cpp Change-Id: Ia15372687c93cd585967b006c0baaac3a5f29e91
This commit is contained in:
commit
846cc4c75c
@ -84,9 +84,12 @@ our $quoted_basedir;
|
||||
$INPUT_RECORD_SEPARATOR = "\r\n" if ($^O eq "msys");
|
||||
|
||||
# will be defined based on the modules sync.profile
|
||||
our (%modules, %moduleheaders, @allmoduleheadersprivate, %classnames, %explicitheaders, %deprecatedheaders);
|
||||
our (%modules, %moduleheaders, @allmoduleheadersprivate, %classnames, %deprecatedheaders);
|
||||
our @qpa_headers = ();
|
||||
|
||||
# will be derived from sync.profile
|
||||
our %reverse_classnames = ();
|
||||
|
||||
# global variables (modified by options)
|
||||
my $isunix = 0;
|
||||
my $module = 0;
|
||||
@ -206,8 +209,9 @@ sub classNames {
|
||||
my @ret;
|
||||
my ($iheader) = @_;
|
||||
|
||||
my $classname = $classnames{basename($iheader)};
|
||||
push @ret, $classname if ($classname);
|
||||
my $ihdrbase = basename($iheader);
|
||||
my $classname = $classnames{$ihdrbase};
|
||||
push @ret, split(/,/, $classname) if ($classname);
|
||||
|
||||
my $parsable = "";
|
||||
if(open(F, "<$iheader")) {
|
||||
@ -306,6 +310,8 @@ sub classNames {
|
||||
foreach my $symbol (@symbols) {
|
||||
$symbol = (join("::", @namespaces) . "::" . $symbol) if (scalar @namespaces);
|
||||
|
||||
my $revhdr = $reverse_classnames{$symbol};
|
||||
next if (defined($revhdr) and $revhdr ne $ihdrbase);
|
||||
if ($symbol =~ /^Q[^:]*$/) { # no-namespace, starting with Q
|
||||
push @ret, $symbol;
|
||||
} elsif (defined($publicclassregexp)) {
|
||||
@ -580,6 +586,13 @@ sub loadSyncProfile {
|
||||
die "syncqt couldn't parse $syncprofile: $@" if $@;
|
||||
die "syncqt couldn't execute $syncprofile: $!" unless defined $result;
|
||||
}
|
||||
|
||||
for my $fn (keys %classnames) {
|
||||
for my $cn (split(/,/, $classnames{$fn})) {
|
||||
$reverse_classnames{$cn} = $fn;
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
@ -777,7 +790,6 @@ while ( @ARGV ) {
|
||||
# if we have no $basedir we cannot be sure which sources you want, so die
|
||||
die "Could not find any sync.profile for your module!\nPass <module directory> to syncqt to sync your header files.\nsyncqt failed" if (!$basedir);
|
||||
|
||||
my $class_lib_map_contents = "";
|
||||
our @ignore_headers = ();
|
||||
our @ignore_for_master_contents = ();
|
||||
our @ignore_for_include_check = ();
|
||||
@ -821,6 +833,7 @@ foreach my $lib (@modules_to_sync) {
|
||||
my $pri_install_files = "";
|
||||
my $pri_install_pfiles = "";
|
||||
my $pri_install_qpafiles = "";
|
||||
my $pri_injections = "";
|
||||
|
||||
my $libcapitals = uc($lib);
|
||||
my $master_contents =
|
||||
@ -893,8 +906,15 @@ foreach my $lib (@modules_to_sync) {
|
||||
#calc files and "copy" them
|
||||
foreach my $subdir (@subdirs) {
|
||||
my @headers = findFiles($subdir, "^[-a-z0-9_]*\\.h\$" , 0);
|
||||
if (defined $inject_headers{$subdir}) {
|
||||
foreach my $if (@{$inject_headers{$subdir}}) {
|
||||
@headers = grep(!/^\Q$if\E$/, @headers); #in case we configure'd previously
|
||||
push @headers, "*".$if;
|
||||
}
|
||||
}
|
||||
my $header_dirname = "";
|
||||
foreach my $header (@headers) {
|
||||
my $shadow = ($header =~ s/^\*//);
|
||||
$header = 0 if($header =~ /^ui_.*.h/);
|
||||
foreach (@ignore_headers) {
|
||||
$header = 0 if($header eq $_);
|
||||
@ -916,6 +936,7 @@ foreach my $lib (@modules_to_sync) {
|
||||
}
|
||||
|
||||
my $iheader = $subdir . "/" . $header;
|
||||
$iheader =~ s/^\Q$basedir\E/$out_basedir/ if ($shadow);
|
||||
my @classes = $public_header && (!$minimal && $is_qt) ? classNames($iheader) : ();
|
||||
if($showonly) {
|
||||
print "$header [$lib]\n";
|
||||
@ -923,11 +944,11 @@ foreach my $lib (@modules_to_sync) {
|
||||
print "SYMBOL: $_\n";
|
||||
}
|
||||
} else {
|
||||
my $ts = (stat($iheader))[9];
|
||||
my $ts = $shadow ? 0 : (stat($iheader))[9];
|
||||
#find out all the places it goes..
|
||||
my @headers;
|
||||
my $oheader;
|
||||
if ($public_header) {
|
||||
@headers = ( "$out_basedir/include/$lib/$header" );
|
||||
$oheader = "$out_basedir/include/$lib/$header";
|
||||
foreach my $full_class (@classes) {
|
||||
my $header_base = basename($header);
|
||||
# Strip namespaces:
|
||||
@ -937,62 +958,44 @@ foreach my $lib (@modules_to_sync) {
|
||||
# class =~ s,::,/,g;
|
||||
# }
|
||||
|
||||
if (defined $explicitheaders{$lib}{$class}) {
|
||||
$header_copies++ if(syncHeader($lib, "$out_basedir/include/$lib/$class", "$out_basedir/include/$lib/$explicitheaders{$lib}{$class}", 0, $ts));
|
||||
} else {
|
||||
$class_lib_map_contents .= "QT_CLASS_LIB($full_class, $lib, $header_base)\n";
|
||||
$header_copies++ if(syncHeader($lib, "$out_basedir/include/$lib/$class", "$out_basedir/include/$lib/$header", 0, $ts));
|
||||
}
|
||||
$header_copies++ if (!$shadow && syncHeader($lib, "$out_basedir/include/$lib/$class", "$out_basedir/include/$lib/$header", 0, $ts));
|
||||
}
|
||||
|
||||
if ($explicitheaders{$lib}{basename($header)}) {
|
||||
$header_copies++ if(syncHeader($lib, "$out_basedir/include/$lib/$explicitheaders{$lib}{basename($header)}", "$out_basedir/include/$lib/$header", 0, $ts));
|
||||
}
|
||||
|
||||
} elsif ($create_private_headers && !$qpa_header) {
|
||||
@headers = ( "$out_basedir/include/$lib/$module_version/$lib/private/$header" );
|
||||
$oheader = "$out_basedir/include/$lib/$module_version/$lib/private/$header";
|
||||
} elsif ($create_private_headers) {
|
||||
@headers = ( "$out_basedir/include/$lib/$module_version/$lib/qpa/$header" );
|
||||
}
|
||||
|
||||
foreach(@headers) { #sync them
|
||||
$header_copies++ if (syncHeader($lib, $_, $iheader, $copy_headers, $ts));
|
||||
$oheader = "$out_basedir/include/$lib/$module_version/$lib/qpa/$header";
|
||||
}
|
||||
$header_copies++ if (!$shadow && syncHeader($lib, $oheader, $iheader, $copy_headers, $ts));
|
||||
|
||||
my $pri_install_iheader = fixPaths($iheader, $dir);
|
||||
my $injection = "";
|
||||
if($public_header) {
|
||||
#put it into the master file
|
||||
$master_contents .= "#include \"$public_header\"\n" if (shouldMasterInclude($iheader));
|
||||
$master_contents .= "#include \"$public_header\"\n" if (!$shadow && shouldMasterInclude($iheader));
|
||||
|
||||
#deal with the install directives
|
||||
if($public_header) {
|
||||
my $pri_install_iheader = fixPaths($iheader, $dir);
|
||||
foreach my $class (@classes) {
|
||||
# Strip namespaces:
|
||||
$class =~ s/^.*:://;
|
||||
# if ($class =~ m/::/) {
|
||||
# $class =~ s,::,/,g;
|
||||
# }
|
||||
my $class_header = fixPaths("$out_basedir/include/$lib/$class",
|
||||
$dir) . " ";
|
||||
$pri_install_classes .= $class_header
|
||||
unless($pri_install_classes =~ $class_header);
|
||||
}
|
||||
if ($explicitheaders{$lib}{basename($iheader)}) {
|
||||
my $compat_header = fixPaths("$out_basedir/include/$lib/$explicitheaders{$lib}{basename($iheader)}",
|
||||
$dir) . " ";
|
||||
$pri_install_files .= $compat_header unless($pri_install_files =~ $compat_header);
|
||||
}
|
||||
$pri_install_files.= "$pri_install_iheader ";;
|
||||
foreach my $class (@classes) {
|
||||
# Strip namespaces:
|
||||
$class =~ s/^.*:://;
|
||||
# if ($class =~ m/::/) {
|
||||
# $class =~ s,::,/,g;
|
||||
# }
|
||||
my $class_header = fixPaths("$out_basedir/include/$lib/$class", $dir) . " ";
|
||||
$pri_install_classes .= $class_header
|
||||
unless($pri_install_classes =~ $class_header);
|
||||
$injection .= ":$class";
|
||||
}
|
||||
$pri_install_files.= "$pri_install_iheader ";;
|
||||
}
|
||||
elsif ($qpa_header) {
|
||||
my $pri_install_iheader = fixPaths($iheader, $dir);
|
||||
$pri_install_qpafiles.= "$pri_install_iheader ";;
|
||||
}
|
||||
else {
|
||||
my $pri_install_iheader = fixPaths($iheader, $dir);
|
||||
$pri_install_pfiles.= "$pri_install_iheader ";;
|
||||
}
|
||||
$pri_injections .= fixPaths($iheader, "$out_basedir/include/$lib")
|
||||
.":".fixPaths($oheader, "$out_basedir/include/$lib")
|
||||
.$injection." " if ($shadow);
|
||||
}
|
||||
|
||||
if ($verbose_level && $header_copies) {
|
||||
@ -1123,6 +1126,7 @@ foreach my $lib (@modules_to_sync) {
|
||||
$headers_pri_contents .= "SYNCQT.HEADER_CLASSES = $pri_install_classes\n";
|
||||
$headers_pri_contents .= "SYNCQT.PRIVATE_HEADER_FILES = $pri_install_pfiles\n";
|
||||
$headers_pri_contents .= "SYNCQT.QPA_HEADER_FILES = $pri_install_qpafiles\n";
|
||||
$headers_pri_contents .= "SYNCQT.INJECTIONS = $pri_injections\n";
|
||||
my $headers_pri_file = "$out_basedir/include/$lib/headers.pri";
|
||||
writeFile($headers_pri_file, $headers_pri_contents, $lib, "headers.pri file");
|
||||
}
|
||||
|
69
configure
vendored
69
configure
vendored
@ -627,7 +627,6 @@ CFG_COMPILE_EXAMPLES=yes
|
||||
CFG_RELEASE_QMAKE=no
|
||||
CFG_AUDIO_BACKEND=auto
|
||||
CFG_QML_DEBUG=yes
|
||||
CFG_JAVASCRIPTCORE_JIT=auto
|
||||
CFG_PKGCONFIG=auto
|
||||
CFG_STACK_PROTECTOR_STRONG=auto
|
||||
CFG_SLOG2=auto
|
||||
@ -1897,13 +1896,6 @@ while [ "$#" -gt 0 ]; do
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
javascript-jit)
|
||||
if [ "$VAL" = "yes" ] || [ "$VAL" = "auto" ] || [ "$VAL" = "no" ]; then
|
||||
CFG_JAVASCRIPTCORE_JIT="$VAL"
|
||||
else
|
||||
UNKNOWN_OPT=yes
|
||||
fi
|
||||
;;
|
||||
confirm-license)
|
||||
if [ "$VAL" = "yes" ]; then
|
||||
OPT_CONFIRM_LICENSE="$VAL"
|
||||
@ -5737,27 +5729,6 @@ if [ "$CFG_ALSA" = "auto" ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$CFG_JAVASCRIPTCORE_JIT" = "yes" ] || [ "$CFG_JAVASCRIPTCORE_JIT" = "auto" ]; then
|
||||
if [ "$CFG_ARCH" = "arm" ]; then
|
||||
compileTest unix/javascriptcore-jit "javascriptcore-jit"
|
||||
if [ $? != "0" ]; then
|
||||
CFG_JAVASCRIPTCORE_JIT=no
|
||||
fi
|
||||
else
|
||||
case "$XPLATFORM" in
|
||||
linux-icc*)
|
||||
CFG_JAVASCRIPTCORE_JIT=no
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$CFG_JAVASCRIPTCORE_JIT" = "yes" ]; then
|
||||
QMakeVar set JAVASCRIPTCORE_JIT yes
|
||||
elif [ "$CFG_JAVASCRIPTCORE_JIT" = "no" ]; then
|
||||
QMakeVar set JAVASCRIPTCORE_JIT no
|
||||
fi
|
||||
|
||||
if [ "$CFG_AUDIO_BACKEND" = "auto" ]; then
|
||||
CFG_AUDIO_BACKEND=yes
|
||||
fi
|
||||
@ -6467,23 +6438,6 @@ else
|
||||
mv -f "$outpath/src/corelib/global/qconfig.h.new" "$outpath/src/corelib/global/qconfig.h"
|
||||
fi
|
||||
|
||||
# create a forwarding header
|
||||
mkdir -p "$outpath/include/QtCore" || exit
|
||||
echo '#include "../../src/corelib/global/qconfig.h"' > $outpath/include/QtCore/qconfig.h.new
|
||||
if cmp -s "$outpath/include/QtCore/qconfig.h.new" "$outpath/include/QtCore/qconfig.h"; then
|
||||
rm -f "$outpath/include/QtCore/qconfig.h.new"
|
||||
else
|
||||
mv "$outpath/include/QtCore/qconfig.h.new" "$outpath/include/QtCore/qconfig.h" || exit
|
||||
fi
|
||||
|
||||
# create a camelcase forwarding header
|
||||
echo '#include "qconfig.h"' > $outpath/include/QtCore/QtConfig.new
|
||||
if cmp -s "$outpath/include/QtCore/QtConfig.new" "$outpath/include/QtCore/QtConfig"; then
|
||||
rm -f "$outpath/include/QtCore/QtConfig.new"
|
||||
else
|
||||
mv "$outpath/include/QtCore/QtConfig.new" "$outpath/include/QtCore/QtConfig" || exit
|
||||
fi
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# save configuration into qconfig.pri
|
||||
#-------------------------------------------------------------------------------
|
||||
@ -6786,7 +6740,7 @@ report_support " Qt D-Bus ..............." "$CFG_DBUS" yes "loading dbus-1 at r
|
||||
report_support " Qt Concurrent .........." "$CFG_CONCURRENT"
|
||||
report_support " Qt GUI ................." "$CFG_GUI"
|
||||
report_support " Qt Widgets ............." "$CFG_WIDGETS"
|
||||
report_support " JavaScriptCore JIT ....." "$CFG_JAVASCRIPTCORE_JIT" auto "To be decided by JavaScriptCore"
|
||||
report_support " Large File ............." "$CFG_LARGEFILE"
|
||||
report_support " QML debugging .........." "$CFG_QML_DEBUG"
|
||||
report_support " Use system proxies ....." "$CFG_SYSTEM_PROXIES"
|
||||
|
||||
@ -6801,19 +6755,17 @@ report_support " CUPS ..................." "$CFG_CUPS"
|
||||
[ "$XPLATFORM_MINGW" = "yes" ] && \
|
||||
report_support " DirectWrite ............" "$CFG_DIRECTWRITE"
|
||||
report_support " FontConfig ............." "$CFG_FONTCONFIG"
|
||||
report_support " FreeType ..............." "$CFG_FREETYPE"
|
||||
[ "$CFG_HARFBUZZ" != "no" ] && \
|
||||
report_support " HarfBuzz ..............." "$CFG_HARFBUZZ"
|
||||
report_support " FreeType ..............." "$CFG_FREETYPE" system "system library" yes "bundled copy"
|
||||
report_support " Glib ..................." "$CFG_GLIB"
|
||||
report_support " GTK theme .............." "$CFG_QGTKSTYLE"
|
||||
report_support " HarfBuzz ..............." "$CFG_HARFBUZZ"
|
||||
report_support " Iconv .................." "$CFG_ICONV"
|
||||
report_support " ICU ...................." "$CFG_ICU"
|
||||
report_support " Image formats:"
|
||||
report_support_plugin " GIF .................." "$CFG_GIF" qt QtGui
|
||||
report_support_plugin " JPEG ................." "$CFG_JPEG" "$CFG_LIBJPEG" QtGui
|
||||
report_support_plugin " PNG .................." "$CFG_PNG" "$CFG_LIBPNG" QtGui
|
||||
report_support " Glib ..................." "$CFG_GLIB"
|
||||
report_support " GTK theme .............." "$CFG_QGTKSTYLE"
|
||||
report_support " journald ..............." "$CFG_JOURNALD"
|
||||
report_support " Large File ............." "$CFG_LARGEFILE"
|
||||
report_support " mtdev .................." "$CFG_MTDEV" yes "system library"
|
||||
report_support " Networking:"
|
||||
[ "$XPLATFORM_MAC" = "yes" ] && \
|
||||
@ -6823,11 +6775,10 @@ report_support " getifaddrs ..........." "$CFG_GETIFADDRS"
|
||||
report_support " IPv6 ifname .........." "$CFG_IPV6IFNAME"
|
||||
report_support " OpenSSL .............." "$CFG_OPENSSL" yes "loading libraries at run-time" linked "linked to the libraries"
|
||||
report_support " NIS ...................." "$CFG_NIS"
|
||||
report_support " EGL ...................." "$CFG_EGL"
|
||||
report_support " EGL on X ..............." "$CFG_EGL_X"
|
||||
report_support " GLX ...................." "$CFG_XCB_GLX"
|
||||
report_support " OpenGL ................." "$CFG_OPENGL" yes "Desktop OpenGL" es2 "OpenGL ES 2.x"
|
||||
report_support " OpenVG ................." "$CFG_OPENVG-$CFG_OPENVG_SHIVA" yes-yes "ShivaVG" yes-no "native"
|
||||
report_support " OpenGL / OpenVG:"
|
||||
report_support " EGL .................." "$CFG_EGL"
|
||||
report_support " OpenGL ..............." "$CFG_OPENGL" yes "Desktop OpenGL" es2 "OpenGL ES 2.x"
|
||||
report_support " OpenVG ..............." "$CFG_OPENVG-$CFG_OPENVG_SHIVA" yes-yes "ShivaVG" yes-no "native"
|
||||
report_support " PCRE ..................." "$CFG_PCRE" yes "system library" qt "bundled copy"
|
||||
if [ -n "$PKG_CONFIG" ]; then
|
||||
report_support " pkg-config ............. yes"
|
||||
@ -6842,6 +6793,8 @@ report_support " KMS .................." "$CFG_KMS"
|
||||
report_support " LinuxFB .............." "$CFG_LINUXFB"
|
||||
report_support " XCB .................." "$CFG_XCB" system "system library" qt "bundled copy"
|
||||
if [ "$CFG_XCB" != "no" ]; then
|
||||
report_support " EGL on X ..........." "$CFG_EGL_X"
|
||||
report_support " GLX ................" "$CFG_XCB_GLX"
|
||||
report_support " MIT-SHM ............" "$CFG_MITSHM"
|
||||
report_support " Xcb-Xlib ..........." "$CFG_XCB_XLIB"
|
||||
report_support " Xcursor ............" "$CFG_XCURSOR" runtime "loaded at runtime"
|
||||
|
@ -13,10 +13,6 @@ p {
|
||||
}
|
||||
|
||||
img {
|
||||
-moz-box-shadow: 3px 3px 3px #ccc;
|
||||
-webkit-box-shadow: 3px 3px 3px #ccc;
|
||||
box-shadow: 3px 3px 3px #ccc;
|
||||
border: #8E8D8D 2px solid;
|
||||
margin-left: 0px;
|
||||
max-width: 800px;
|
||||
height: auto;
|
||||
@ -36,7 +32,7 @@ img {
|
||||
|
||||
.descr {
|
||||
margin-top: 35px;
|
||||
/*max-width: 75%;*/
|
||||
margin-bottom: 45px;
|
||||
margin-left: 5px;
|
||||
text-align: left;
|
||||
vertical-align: top;
|
||||
@ -51,6 +47,9 @@ tt {
|
||||
text-align: left
|
||||
}
|
||||
|
||||
.main {
|
||||
display: none;
|
||||
}
|
||||
/*
|
||||
-----------
|
||||
links
|
||||
@ -193,17 +192,19 @@ footer and license
|
||||
|
||||
.footer {
|
||||
text-align: left;
|
||||
margin-top: 50px;
|
||||
padding-top: 45px;
|
||||
padding-left: 5px;
|
||||
margin-bottom: 10px;
|
||||
margin-top: 45px;
|
||||
margin-bottom: 45px;
|
||||
font-size: 10px;
|
||||
border-top: 1px solid #999;
|
||||
padding-top: 11px;
|
||||
}
|
||||
|
||||
.footer p {
|
||||
line-height: 14px;
|
||||
font-size: 11px;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.footer a[href*="http://"], a[href*="ftp://"], a[href*="https://"] {
|
||||
@ -221,7 +222,7 @@ footer and license
|
||||
display: block;
|
||||
position: relative;
|
||||
top: -20px;
|
||||
/*border-top: 2px solid #ffffff;*/
|
||||
border-top: 1px solid #cecece;
|
||||
border-bottom: 1px solid #cecece;
|
||||
background-color: #F2F2F2;
|
||||
z-index: 1;
|
||||
@ -288,7 +289,7 @@ headers
|
||||
@media screen {
|
||||
.title {
|
||||
color: #313131;
|
||||
font-size: 18px;
|
||||
font-size: 24px;
|
||||
font-weight: normal;
|
||||
left: 0;
|
||||
padding-bottom: 20px;
|
||||
@ -320,7 +321,6 @@ h2, p.h2 {
|
||||
border-top: #E0E0DE 1px solid;
|
||||
border-bottom: #E0E0DE 1px solid;
|
||||
max-width: 99%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
h3 {
|
||||
@ -625,73 +625,6 @@ Content table
|
||||
clear: both
|
||||
}
|
||||
|
||||
/* start index box */
|
||||
|
||||
.indexbox {
|
||||
width: 100%;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.indexbox .indexIcon {
|
||||
width: 11%
|
||||
}
|
||||
|
||||
.indexbox .indexIcon span {
|
||||
display: block
|
||||
}
|
||||
|
||||
.indexboxcont {
|
||||
display: block
|
||||
}
|
||||
|
||||
.indexboxcont .sectionlist {
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
width: 32.5%;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.indexboxcont .sectionlist ul {
|
||||
margin-bottom: 20px
|
||||
}
|
||||
|
||||
.indexboxcont .sectionlist ul li {
|
||||
line-height: 1.5
|
||||
}
|
||||
|
||||
.indexboxcont .indexIcon {
|
||||
width: 11%;
|
||||
*width: 18%;
|
||||
_width: 18%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.indexboxcont .section {
|
||||
display: inline-block;
|
||||
width: 49%;
|
||||
*width: 42%;
|
||||
_width: 42%;
|
||||
padding: 0 2% 0 1%;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.indexboxcont .section p {
|
||||
padding-top: 20px;
|
||||
padding-bottom: 20px;
|
||||
}
|
||||
|
||||
.indexboxcont .section {
|
||||
float: left
|
||||
}
|
||||
|
||||
.indexboxcont:after {
|
||||
content: ".";
|
||||
display: block;
|
||||
height: 0;
|
||||
clear: both;
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
/*
|
||||
-----------
|
||||
Landing page
|
||||
@ -703,6 +636,19 @@ Landing page
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
|
||||
.landing h2 {
|
||||
background-color: transparent;
|
||||
border: none;
|
||||
margin-bottom: 0px;
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.landing a, .landing li {
|
||||
font-size: 13px;
|
||||
font-weight: bold !important;
|
||||
}
|
||||
|
||||
.col-1 {
|
||||
display: inline-block;
|
||||
white-space: normal;
|
||||
@ -711,17 +657,37 @@ Landing page
|
||||
float: left;
|
||||
}
|
||||
|
||||
.col-1 h1 {
|
||||
margin: 20px 0 0 0
|
||||
}
|
||||
|
||||
.col-2 {
|
||||
display: inline-block;
|
||||
white-space: normal;
|
||||
width: 25%;
|
||||
margin: 0 0 0 50px;
|
||||
width: 20%;
|
||||
margin-left: 5%;
|
||||
position: relative;
|
||||
top: -20px;
|
||||
}
|
||||
|
||||
.sectionlist {
|
||||
width: 100% !important
|
||||
.col-1 h1 {
|
||||
margin: 20px 0 0 0;
|
||||
}
|
||||
|
||||
.col-1 h2 {
|
||||
font-size: 18px;
|
||||
font-weight: bold !important;
|
||||
}
|
||||
|
||||
.landingicons {
|
||||
display: inline-block;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.icons1of3 {
|
||||
display: inline-block;
|
||||
width: 33.3333%;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.icons1of3 h2 {
|
||||
font-size: 15px;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
}
|
||||
|
@ -144,7 +144,7 @@ void TriangleWindow::render()
|
||||
m_program->bind();
|
||||
|
||||
QMatrix4x4 matrix;
|
||||
matrix.perspective(60, 4.0/3.0, 0.1, 100.0);
|
||||
matrix.perspective(60.0f, 4.0f/3.0f, 0.1f, 100.0f);
|
||||
matrix.translate(0, 0, -2);
|
||||
matrix.rotate(100.0f * m_frame / screen()->refreshRate(), 0, 1, 0);
|
||||
|
||||
|
@ -308,12 +308,12 @@ void GLWidget::paintGL()
|
||||
bubble->drawBubble(&painter);
|
||||
}
|
||||
|
||||
QString framesPerSecond;
|
||||
framesPerSecond.setNum(frames /(time.elapsed() / 1000.0), 'f', 2);
|
||||
|
||||
painter.setPen(Qt::white);
|
||||
|
||||
painter.drawText(20, 40, framesPerSecond + " fps");
|
||||
if (const int elapsed = time.elapsed()) {
|
||||
QString framesPerSecond;
|
||||
framesPerSecond.setNum(frames /(elapsed / 1000.0), 'f', 2);
|
||||
painter.setPen(Qt::white);
|
||||
painter.drawText(20, 40, framesPerSecond + " fps");
|
||||
}
|
||||
|
||||
painter.end();
|
||||
|
||||
|
@ -83,7 +83,7 @@
|
||||
\snippet tools/treemodelcompleter/treemodelcompleter.cpp 2
|
||||
|
||||
As mentioned earlier, the \c splitPath() function is reimplemented because
|
||||
the default implementation is more suited to QDirModel or list models. In
|
||||
the default implementation is more suited to QFileSystemModel or list models. In
|
||||
order for QCompleter to split the path into a list of strings that are
|
||||
matched at each level, we split it using QString::split() with \c sep as its
|
||||
separator.
|
||||
|
@ -36,4 +36,4 @@
|
||||
<Capabilities>$${WINRT_MANIFEST.capabilities}</Capabilities>
|
||||
<Dependencies>$${WINRT_MANIFEST.dependencies}</Dependencies>
|
||||
</Package>
|
||||
<!-- Generated by qmake using the $$[QMAKE_XSPEC] mkspec. Remove this line to prevent this file from getting overwritten by qmake. -->
|
||||
<!-- Generated by qmake using the $$[QMAKE_XSPEC] mkspec. -->
|
||||
|
@ -36,4 +36,4 @@
|
||||
</ScreenResolutions>
|
||||
</App>
|
||||
</Deployment>
|
||||
<!-- Generated by qmake using the $$[QMAKE_XSPEC] mkspec. Remove this line to prevent this file from getting overwritten by qmake. -->
|
||||
<!-- Generated by qmake using the $$[QMAKE_XSPEC] mkspec. -->
|
||||
|
@ -41,4 +41,4 @@
|
||||
<Capabilities>$${WINRT_MANIFEST.capabilities}</Capabilities>
|
||||
<Dependencies>$${WINRT_MANIFEST.dependencies}</Dependencies>
|
||||
</Package>
|
||||
<!-- Generated by qmake using the $$[QMAKE_XSPEC] mkspec. Remove this line to prevent this file from getting overwritten by qmake. -->
|
||||
<!-- Generated by qmake using the $$[QMAKE_XSPEC] mkspec. -->
|
||||
|
@ -35,6 +35,20 @@ else: \
|
||||
INC_PATH = $$MODULE_BASE_INDIR
|
||||
include($$INC_PATH/include/$$MODULE_INCNAME/headers.pri, "", true)
|
||||
|
||||
for (injection, SYNCQT.INJECTIONS) {
|
||||
injects = $$split(injection, :)
|
||||
fwd_hdr = $$member(injects, 1)
|
||||
MAIN_FWD = $$INC_PATH/include/$$MODULE_INCNAME/$$fwd_hdr
|
||||
MAIN_FWD_CONT = '$${LITERAL_HASH}include "$$member(injects, 0)"'
|
||||
write_file($$MAIN_FWD, MAIN_FWD_CONT)|error("Aborting.")
|
||||
injects = $$member(injects, 2, -1)
|
||||
for (inject, injects) {
|
||||
CLASS_FWD = $$INC_PATH/include/$$MODULE_INCNAME/$$inject
|
||||
CLASS_FWD_CONT = '$${LITERAL_HASH}include "$$fwd_hdr"'
|
||||
write_file($$CLASS_FWD, CLASS_FWD_CONT)|error("Aborting.")
|
||||
}
|
||||
}
|
||||
|
||||
autogen_warning = \
|
||||
"/* This file was generated by qmake with the info from <root>/$$relative_path($$_PRO_FILE_, $$MODULE_BASE_INDIR). */"
|
||||
|
||||
|
@ -729,7 +729,10 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
|
||||
QString::fromLatin1("????") : project->first("QMAKE_PKGINFO_TYPEINFO").left(4)) << ",g\" ";
|
||||
if(project->first("TEMPLATE") == "app") {
|
||||
QString icon = fileFixify(var("ICON"));
|
||||
QString bundleIdentifier = "com.yourcompany." + var("QMAKE_BUNDLE");
|
||||
QString bundlePrefix = project->first("QMAKE_TARGET_BUNDLE_PREFIX").toQString();
|
||||
if (bundlePrefix.isEmpty())
|
||||
bundlePrefix = "com.yourcompany.";
|
||||
QString bundleIdentifier = bundlePrefix + var("QMAKE_BUNDLE");
|
||||
if (bundleIdentifier.endsWith(".app"))
|
||||
bundleIdentifier.chop(4);
|
||||
t << "@$(DEL_FILE) " << info_plist_out << "\n\t"
|
||||
|
@ -121,7 +121,11 @@ NmakeMakefileGenerator::writeMakefile(QTextStream &t)
|
||||
compiler = QStringLiteral("x86_arm");
|
||||
compilerArch = QStringLiteral("arm");
|
||||
} else if (arch == QStringLiteral("x64")) {
|
||||
compiler = QStringLiteral("x86_amd64");
|
||||
const ProStringList hostArch = project->values("QMAKE_TARGET.arch");
|
||||
if (hostArch.contains("x86_64"))
|
||||
compiler = QStringLiteral("amd64");
|
||||
else
|
||||
compiler = QStringLiteral("x86_amd64");
|
||||
compilerArch = QStringLiteral("amd64");
|
||||
} else {
|
||||
arch = QStringLiteral("x86");
|
||||
|
@ -177,6 +177,14 @@ FEATURES_PRI = \
|
||||
"QT_DISABLED_FEATURES = \$\$unique(QT_DISABLED_FEATURES)"
|
||||
write_file($$OUT_PWD/mkspecs/qfeatures.pri, FEATURES_PRI)|error("Aborting.")
|
||||
|
||||
# Create forwarding headers for qconfig.h
|
||||
FWD_QCONFIG_H = \
|
||||
'$${LITERAL_HASH}include "../../src/corelib/global/qconfig.h"'
|
||||
write_file($$OUT_PWD/include/QtCore/qconfig.h, FWD_QCONFIG_H)|error("Aborting.")
|
||||
FWD_QTCONFIG = \
|
||||
'$${LITERAL_HASH}include "qconfig.h"'
|
||||
write_file($$OUT_PWD/include/QtCore/QtConfig, FWD_QTCONFIG)|error("Aborting.")
|
||||
|
||||
#mkspecs
|
||||
mkspecs.path = $$[QT_HOST_DATA]/mkspecs
|
||||
mkspecs.files = \
|
||||
|
2
src/3rdparty/angle/AUTHORS
vendored
2
src/3rdparty/angle/AUTHORS
vendored
@ -13,6 +13,8 @@ TransGaming Inc.
|
||||
|
||||
Adobe Systems Inc.
|
||||
Autodesk, Inc.
|
||||
BlackBerry Limited
|
||||
Cable Television Laboratories, Inc.
|
||||
Cloud Party, Inc.
|
||||
Intel Corporation
|
||||
Mozilla Corporation
|
||||
|
45
src/3rdparty/angle/LICENSE.preprocessor
vendored
45
src/3rdparty/angle/LICENSE.preprocessor
vendored
@ -1,45 +0,0 @@
|
||||
Files in src/compiler/preprocessor are provided under the following license:
|
||||
|
||||
****************************************************************************
|
||||
Copyright (c) 2002, NVIDIA Corporation.
|
||||
|
||||
NVIDIA Corporation("NVIDIA") supplies this software to you in
|
||||
consideration of your agreement to the following terms, and your use,
|
||||
installation, modification or redistribution of this NVIDIA software
|
||||
constitutes acceptance of these terms. If you do not agree with these
|
||||
terms, please do not use, install, modify or redistribute this NVIDIA
|
||||
software.
|
||||
|
||||
In consideration of your agreement to abide by the following terms, and
|
||||
subject to these terms, NVIDIA grants you a personal, non-exclusive
|
||||
license, under NVIDIA's copyrights in this original NVIDIA software (the
|
||||
"NVIDIA Software"), to use, reproduce, modify and redistribute the
|
||||
NVIDIA Software, with or without modifications, in source and/or binary
|
||||
forms; provided that if you redistribute the NVIDIA Software, you must
|
||||
retain the copyright notice of NVIDIA, this notice and the following
|
||||
text and disclaimers in all such redistributions of the NVIDIA Software.
|
||||
Neither the name, trademarks, service marks nor logos of NVIDIA
|
||||
Corporation may be used to endorse or promote products derived from the
|
||||
NVIDIA Software without specific prior written permission from NVIDIA.
|
||||
Except as expressly stated in this notice, no other rights or licenses
|
||||
express or implied, are granted by NVIDIA herein, including but not
|
||||
limited to any patent rights that may be infringed by your derivative
|
||||
works or by other works in which the NVIDIA Software may be
|
||||
incorporated. No hardware is licensed hereunder.
|
||||
|
||||
THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
|
||||
WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
|
||||
INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,
|
||||
NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
|
||||
ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER
|
||||
PRODUCTS.
|
||||
|
||||
IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,
|
||||
INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
||||
TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||
USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY
|
||||
OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE
|
||||
NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
|
||||
TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
|
||||
NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
****************************************************************************
|
33
src/3rdparty/angle/include/GLSLANG/ShaderLang.h
vendored
33
src/3rdparty/angle/include/GLSLANG/ShaderLang.h
vendored
@ -6,20 +6,20 @@
|
||||
#ifndef _COMPILER_INTERFACE_INCLUDED_
|
||||
#define _COMPILER_INTERFACE_INCLUDED_
|
||||
|
||||
#if defined(COMPONENT_BUILD)
|
||||
#if defined(COMPONENT_BUILD) && !defined(ANGLE_TRANSLATOR_STATIC)
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
|
||||
#if defined(COMPILER_IMPLEMENTATION)
|
||||
#if defined(ANGLE_TRANSLATOR_IMPLEMENTATION)
|
||||
#define COMPILER_EXPORT __declspec(dllexport)
|
||||
#else
|
||||
#define COMPILER_EXPORT __declspec(dllimport)
|
||||
#endif // defined(COMPILER_IMPLEMENTATION)
|
||||
#endif // defined(ANGLE_TRANSLATOR_IMPLEMENTATION)
|
||||
|
||||
#else // defined(WIN32)
|
||||
#else // defined(_WIN32) || defined(_WIN64)
|
||||
#define COMPILER_EXPORT __attribute__((visibility("default")))
|
||||
#endif
|
||||
|
||||
#else // defined(COMPONENT_BUILD)
|
||||
#else // defined(COMPONENT_BUILD) && !defined(ANGLE_TRANSLATOR_STATIC)
|
||||
#define COMPILER_EXPORT
|
||||
#endif
|
||||
|
||||
@ -146,14 +146,14 @@ typedef enum {
|
||||
// This is needed only as a workaround for certain OpenGL driver bugs.
|
||||
SH_EMULATE_BUILT_IN_FUNCTIONS = 0x0100,
|
||||
|
||||
// This is an experimental flag to enforce restrictions that aim to prevent
|
||||
// This is an experimental flag to enforce restrictions that aim to prevent
|
||||
// timing attacks.
|
||||
// It generates compilation errors for shaders that could expose sensitive
|
||||
// texture information via the timing channel.
|
||||
// To use this flag, you must compile the shader under the WebGL spec
|
||||
// (using the SH_WEBGL_SPEC flag).
|
||||
SH_TIMING_RESTRICTIONS = 0x0200,
|
||||
|
||||
|
||||
// This flag prints the dependency graph that is used to enforce timing
|
||||
// restrictions on fragment shaders.
|
||||
// This flag only has an effect if all of the following are true:
|
||||
@ -184,11 +184,24 @@ typedef enum {
|
||||
// This flag limits the depth of the call stack.
|
||||
SH_LIMIT_CALL_STACK_DEPTH = 0x4000,
|
||||
|
||||
// This flag initializes gl_Position to vec4(0.0, 0.0, 0.0, 1.0) at
|
||||
// the beginning of the vertex shader, and has no effect in the
|
||||
// This flag initializes gl_Position to vec4(0,0,0,0) at the
|
||||
// beginning of the vertex shader's main(), and has no effect in the
|
||||
// fragment shader. It is intended as a workaround for drivers which
|
||||
// incorrectly fail to link programs if gl_Position is not written.
|
||||
SH_INIT_GL_POSITION = 0x8000,
|
||||
|
||||
// This flag replaces
|
||||
// "a && b" with "a ? b : false",
|
||||
// "a || b" with "a ? true : b".
|
||||
// This is to work around a MacOSX driver bug that |b| is executed
|
||||
// independent of |a|'s value.
|
||||
SH_UNFOLD_SHORT_CIRCUIT = 0x10000,
|
||||
|
||||
// This flag initializes varyings without static use in vertex shader
|
||||
// at the beginning of main(), and has no effects in the fragment shader.
|
||||
// It is intended as a workaround for drivers which incorrectly optimize
|
||||
// out such varyings and cause a link failure.
|
||||
SH_INIT_VARYINGS_WITHOUT_STATIC_USE = 0x20000,
|
||||
} ShCompileOptions;
|
||||
|
||||
// Defines alternate strategies for implementing array index clamping.
|
||||
@ -267,7 +280,7 @@ COMPILER_EXPORT void ShInitBuiltInResources(ShBuiltInResources* resources);
|
||||
|
||||
//
|
||||
// ShHandle held by but opaque to the driver. It is allocated,
|
||||
// managed, and de-allocated by the compiler. It's contents
|
||||
// managed, and de-allocated by the compiler. It's contents
|
||||
// are defined by and used by the compiler.
|
||||
//
|
||||
// If handle creation fails, 0 will be returned.
|
||||
|
8
src/3rdparty/angle/include/KHR/khrplatform.h
vendored
8
src/3rdparty/angle/include/KHR/khrplatform.h
vendored
@ -26,7 +26,7 @@
|
||||
|
||||
/* Khronos platform-specific types and definitions.
|
||||
*
|
||||
* $Revision: 9356 $ on $Date: 2009-10-21 02:52:25 -0700 (Wed, 21 Oct 2009) $
|
||||
* $Revision: 23298 $ on $Date: 2013-09-30 17:07:13 -0700 (Mon, 30 Sep 2013) $
|
||||
*
|
||||
* Adopters may modify this file to suit their platform. Adopters are
|
||||
* encouraged to submit platform specific modifications to the Khronos
|
||||
@ -221,6 +221,12 @@ typedef signed char khronos_int8_t;
|
||||
typedef unsigned char khronos_uint8_t;
|
||||
typedef signed short int khronos_int16_t;
|
||||
typedef unsigned short int khronos_uint16_t;
|
||||
|
||||
/*
|
||||
* Types that differ between LLP64 and LP64 architectures - in LLP64,
|
||||
* pointers are 64 bits, but 'long' is still 32 bits. Win64 appears
|
||||
* to be the only LLP64 architecture in current use.
|
||||
*/
|
||||
#ifdef _WIN64
|
||||
typedef signed long long int khronos_intptr_t;
|
||||
typedef unsigned long long int khronos_uintptr_t;
|
||||
|
2
src/3rdparty/angle/src/commit.h
vendored
Normal file
2
src/3rdparty/angle/src/commit.h
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
#define ANGLE_COMMIT_HASH "5bb7ec572d0a"
|
||||
#define ANGLE_COMMIT_HASH_SIZE 12
|
14
src/3rdparty/angle/src/common/angleutils.h
vendored
14
src/3rdparty/angle/src/common/angleutils.h
vendored
@ -42,6 +42,20 @@ void SafeRelease(T& resource)
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void SafeDelete(T*& resource)
|
||||
{
|
||||
delete resource;
|
||||
resource = NULL;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void SafeDeleteArray(T*& resource)
|
||||
{
|
||||
delete[] resource;
|
||||
resource = NULL;
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#define snprintf _snprintf
|
||||
#endif
|
||||
|
44
src/3rdparty/angle/src/common/debug.cpp
vendored
44
src/3rdparty/angle/src/common/debug.cpp
vendored
@ -7,21 +7,23 @@
|
||||
// debug.cpp: Debugging utilities.
|
||||
|
||||
#include "common/debug.h"
|
||||
#include "common/system.h"
|
||||
#ifndef ANGLE_ENABLE_D3D11
|
||||
#include <stdarg.h>
|
||||
|
||||
#if defined(ANGLE_ENABLE_PERF)
|
||||
#include <d3d9.h>
|
||||
#else
|
||||
typedef DWORD D3DCOLOR;
|
||||
#endif
|
||||
|
||||
namespace gl
|
||||
{
|
||||
|
||||
#if defined(ANGLE_ENABLE_PERF)
|
||||
typedef void (WINAPI *PerfOutputFunction)(D3DCOLOR, LPCWSTR);
|
||||
#else
|
||||
typedef void (*PerfOutputFunction)(unsigned int, const wchar_t*);
|
||||
#endif
|
||||
|
||||
static void output(bool traceFileDebugOnly, PerfOutputFunction perfFunc, const char *format, va_list vararg)
|
||||
{
|
||||
#if !defined(ANGLE_DISABLE_PERF)
|
||||
#if defined(ANGLE_ENABLE_PERF)
|
||||
if (perfActive())
|
||||
{
|
||||
char message[32768];
|
||||
@ -41,15 +43,15 @@ static void output(bool traceFileDebugOnly, PerfOutputFunction perfFunc, const c
|
||||
|
||||
perfFunc(0, wideMessage);
|
||||
}
|
||||
#endif
|
||||
#endif // ANGLE_ENABLE_PERF
|
||||
|
||||
#if !defined(ANGLE_DISABLE_TRACE)
|
||||
#if defined(ANGLE_ENABLE_TRACE)
|
||||
#if defined(NDEBUG)
|
||||
if (traceFileDebugOnly)
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
#endif // NDEBUG
|
||||
|
||||
FILE* file = fopen(TRACE_OUTPUT_FILE, "a");
|
||||
if (file)
|
||||
@ -57,50 +59,50 @@ static void output(bool traceFileDebugOnly, PerfOutputFunction perfFunc, const c
|
||||
vfprintf(file, format, vararg);
|
||||
fclose(file);
|
||||
}
|
||||
#endif
|
||||
#endif // ANGLE_ENABLE_TRACE
|
||||
}
|
||||
|
||||
void trace(bool traceFileDebugOnly, const char *format, ...)
|
||||
{
|
||||
va_list vararg;
|
||||
va_start(vararg, format);
|
||||
#if defined(ANGLE_DISABLE_PERF)
|
||||
output(traceFileDebugOnly, NULL, format, vararg);
|
||||
#else
|
||||
#if defined(ANGLE_ENABLE_PERF)
|
||||
output(traceFileDebugOnly, D3DPERF_SetMarker, format, vararg);
|
||||
#else
|
||||
output(traceFileDebugOnly, NULL, format, vararg);
|
||||
#endif
|
||||
va_end(vararg);
|
||||
}
|
||||
|
||||
bool perfActive()
|
||||
{
|
||||
#if defined(ANGLE_DISABLE_PERF)
|
||||
return false;
|
||||
#else
|
||||
#if defined(ANGLE_ENABLE_PERF)
|
||||
static bool active = D3DPERF_GetStatus() != 0;
|
||||
return active;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
ScopedPerfEventHelper::ScopedPerfEventHelper(const char* format, ...)
|
||||
{
|
||||
#if !defined(ANGLE_DISABLE_PERF)
|
||||
#if defined(ANGLE_DISABLE_TRACE)
|
||||
#if defined(ANGLE_ENABLE_PERF)
|
||||
#if !defined(ANGLE_ENABLE_TRACE)
|
||||
if (!perfActive())
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
#endif // !ANGLE_ENABLE_TRACE
|
||||
va_list vararg;
|
||||
va_start(vararg, format);
|
||||
output(true, reinterpret_cast<PerfOutputFunction>(D3DPERF_BeginEvent), format, vararg);
|
||||
va_end(vararg);
|
||||
#endif
|
||||
#endif // ANGLE_ENABLE_PERF
|
||||
}
|
||||
|
||||
ScopedPerfEventHelper::~ScopedPerfEventHelper()
|
||||
{
|
||||
#if !defined(ANGLE_DISABLE_PERF)
|
||||
#if defined(ANGLE_ENABLE_PERF)
|
||||
if (perfActive())
|
||||
{
|
||||
D3DPERF_EndEvent();
|
||||
|
32
src/3rdparty/angle/src/common/debug.h
vendored
32
src/3rdparty/angle/src/common/debug.h
vendored
@ -39,33 +39,35 @@ namespace gl
|
||||
}
|
||||
|
||||
// A macro to output a trace of a function call and its arguments to the debugging log
|
||||
#if defined(ANGLE_DISABLE_TRACE) && defined(ANGLE_DISABLE_PERF)
|
||||
#define TRACE(message, ...) (void(0))
|
||||
#else
|
||||
#if defined(ANGLE_ENABLE_TRACE) || defined(ANGLE_ENABLE_PERF)
|
||||
#define TRACE(message, ...) gl::trace(true, "trace: %s(%d): " message "\n", __FUNCTION__, __LINE__, ##__VA_ARGS__)
|
||||
#else
|
||||
#define TRACE(message, ...) (void(0))
|
||||
#endif
|
||||
|
||||
// A macro to output a function call and its arguments to the debugging log, to denote an item in need of fixing.
|
||||
#if defined(ANGLE_DISABLE_TRACE) && defined(ANGLE_DISABLE_PERF)
|
||||
#define FIXME(message, ...) (void(0))
|
||||
#else
|
||||
#if defined(ANGLE_ENABLE_TRACE) || defined(ANGLE_ENABLE_PERF)
|
||||
#define FIXME(message, ...) gl::trace(false, "fixme: %s(%d): " message "\n", __FUNCTION__, __LINE__, ##__VA_ARGS__)
|
||||
#else
|
||||
#define FIXME(message, ...) (void(0))
|
||||
#endif
|
||||
|
||||
// A macro to output a function call and its arguments to the debugging log, in case of error.
|
||||
#if defined(ANGLE_DISABLE_TRACE) && defined(ANGLE_DISABLE_PERF)
|
||||
#define ERR(message, ...) (void(0))
|
||||
#else
|
||||
#if defined(ANGLE_ENABLE_TRACE) || defined(ANGLE_ENABLE_PERF)
|
||||
#define ERR(message, ...) gl::trace(false, "err: %s(%d): " message "\n", __FUNCTION__, __LINE__, ##__VA_ARGS__)
|
||||
#else
|
||||
#define ERR(message, ...) (void(0))
|
||||
#endif
|
||||
|
||||
// A macro to log a performance event around a scope.
|
||||
#if defined(ANGLE_DISABLE_TRACE) && defined(ANGLE_DISABLE_PERF)
|
||||
#define EVENT(message, ...) (void(0))
|
||||
#elif defined(_MSC_VER)
|
||||
#if defined(ANGLE_ENABLE_TRACE) || defined(ANGLE_ENABLE_PERF)
|
||||
#if defined(_MSC_VER)
|
||||
#define EVENT(message, ...) gl::ScopedPerfEventHelper scopedPerfEventHelper ## __LINE__(__FUNCTION__ message "\n", __VA_ARGS__);
|
||||
#else
|
||||
#define EVENT(message, ...) gl::ScopedPerfEventHelper scopedPerfEventHelper(message "\n", ##__VA_ARGS__);
|
||||
#endif // _MSC_VER
|
||||
#else
|
||||
#define EVENT(message, ...) (void(0))
|
||||
#endif
|
||||
|
||||
// A macro asserting a condition and outputting failures to the debug log
|
||||
@ -99,8 +101,10 @@ namespace gl
|
||||
#define UNREACHABLE() ERR("\t! Unreachable reached: %s(%d)\n", __FUNCTION__, __LINE__)
|
||||
#endif
|
||||
|
||||
// A macro that determines whether an object has a given runtime type.
|
||||
#if !defined(NDEBUG) && (!defined(_MSC_VER) || defined(_CPPRTTI))
|
||||
// A macro that determines whether an object has a given runtime type. MSVC uses _CPPRTTI.
|
||||
// GCC uses __GXX_RTTI, but the macro was introduced in version 4.3, so we assume that all older
|
||||
// versions support RTTI.
|
||||
#if !defined(NDEBUG) && (!defined(_MSC_VER) || defined(_CPPRTTI)) && (!defined(__GNUC__) || __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 3) || defined(__GXX_RTTI))
|
||||
#define HAS_DYNAMIC_TYPE(type, obj) (dynamic_cast<type >(obj) != NULL)
|
||||
#else
|
||||
#define HAS_DYNAMIC_TYPE(type, obj) true
|
||||
|
@ -14,7 +14,7 @@ AddTraceEventFunc g_addTraceEvent;
|
||||
|
||||
extern "C" {
|
||||
|
||||
void __stdcall SetTraceFunctionPointers(GetCategoryEnabledFlagFunc getCategoryEnabledFlag,
|
||||
void TRACE_ENTRY SetTraceFunctionPointers(GetCategoryEnabledFlagFunc getCategoryEnabledFlag,
|
||||
AddTraceEventFunc addTraceEvent)
|
||||
{
|
||||
gl::g_getCategoryEnabledFlag = getCategoryEnabledFlag;
|
||||
|
12
src/3rdparty/angle/src/common/event_tracer.h
vendored
12
src/3rdparty/angle/src/common/event_tracer.h
vendored
@ -5,6 +5,14 @@
|
||||
#ifndef COMMON_EVENT_TRACER_H_
|
||||
#define COMMON_EVENT_TRACER_H_
|
||||
|
||||
#if !defined(TRACE_ENTRY)
|
||||
#if defined(_WIN32)
|
||||
#define TRACE_ENTRY __stdcall
|
||||
#else
|
||||
#define TRACE_ENTRY
|
||||
#endif // // _WIN32
|
||||
#endif //TRACE_ENTRY
|
||||
|
||||
extern "C" {
|
||||
|
||||
typedef const unsigned char* (*GetCategoryEnabledFlagFunc)(const char* name);
|
||||
@ -14,8 +22,8 @@ typedef void (*AddTraceEventFunc)(char phase, const unsigned char* categoryGroup
|
||||
unsigned char flags);
|
||||
|
||||
// extern "C" so that it has a reasonable name for GetProcAddress.
|
||||
void __stdcall SetTraceFunctionPointers(GetCategoryEnabledFlagFunc get_category_enabled_flag,
|
||||
AddTraceEventFunc add_trace_event_func);
|
||||
void TRACE_ENTRY SetTraceFunctionPointers(GetCategoryEnabledFlagFunc get_category_enabled_flag,
|
||||
AddTraceEventFunc add_trace_event_func);
|
||||
|
||||
}
|
||||
|
||||
|
26
src/3rdparty/angle/src/common/system.h
vendored
26
src/3rdparty/angle/src/common/system.h
vendored
@ -1,26 +0,0 @@
|
||||
//
|
||||
// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
//
|
||||
|
||||
// system.h: Includes Windows system headers and undefines macros that conflict.
|
||||
|
||||
#ifndef COMMON_SYSTEM_H
|
||||
#define COMMON_SYSTEM_H
|
||||
|
||||
#if !defined(WIN32_LEAN_AND_MEAN)
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#if defined(min)
|
||||
#undef min
|
||||
#endif
|
||||
|
||||
#if defined(max)
|
||||
#undef max
|
||||
#endif
|
||||
|
||||
#endif // COMMON_SYSTEM_H
|
18
src/3rdparty/angle/src/common/version.h
vendored
18
src/3rdparty/angle/src/common/version.h
vendored
@ -1,12 +1,12 @@
|
||||
#define MAJOR_VERSION 1
|
||||
#define MINOR_VERSION 2
|
||||
#define BUILD_VERSION 0
|
||||
#define BUILD_REVISION 2446
|
||||
#include "commit.h"
|
||||
|
||||
#define STRINGIFY(x) #x
|
||||
#define MACRO_STRINGIFY(x) STRINGIFY(x)
|
||||
#define ANGLE_MAJOR_VERSION 1
|
||||
#define ANGLE_MINOR_VERSION 3
|
||||
|
||||
#define REVISION_STRING MACRO_STRINGIFY(BUILD_REVISION)
|
||||
#define VERSION_STRING MACRO_STRINGIFY(MAJOR_VERSION) "." MACRO_STRINGIFY(MINOR_VERSION) "." MACRO_STRINGIFY(BUILD_VERSION) "." MACRO_STRINGIFY(BUILD_REVISION)
|
||||
#define ANGLE_STRINGIFY(x) #x
|
||||
#define ANGLE_MACRO_STRINGIFY(x) ANGLE_STRINGIFY(x)
|
||||
|
||||
#define VERSION_DWORD ((MAJOR_VERSION << 24) | (MINOR_VERSION << 16) | BUILD_REVISION)
|
||||
#define ANGLE_VERSION_STRING \
|
||||
ANGLE_MACRO_STRINGIFY(ANGLE_MAJOR_VERSION) "." \
|
||||
ANGLE_MACRO_STRINGIFY(ANGLE_MINOR_VERSION) "." \
|
||||
ANGLE_COMMIT_HASH
|
||||
|
33
src/3rdparty/angle/src/compiler/CodeGenHLSL.cpp
vendored
33
src/3rdparty/angle/src/compiler/CodeGenHLSL.cpp
vendored
@ -1,33 +0,0 @@
|
||||
//
|
||||
// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
//
|
||||
|
||||
#include "compiler/TranslatorHLSL.h"
|
||||
|
||||
//
|
||||
// This function must be provided to create the actual
|
||||
// compile object used by higher level code. It returns
|
||||
// a subclass of TCompiler.
|
||||
//
|
||||
TCompiler* ConstructCompiler(
|
||||
ShShaderType type, ShShaderSpec spec, ShShaderOutput output)
|
||||
{
|
||||
switch (output)
|
||||
{
|
||||
case SH_HLSL9_OUTPUT:
|
||||
case SH_HLSL11_OUTPUT:
|
||||
return new TranslatorHLSL(type, spec, output);
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Delete the compiler made by ConstructCompiler
|
||||
//
|
||||
void DeleteCompiler(TCompiler* compiler)
|
||||
{
|
||||
delete compiler;
|
||||
}
|
125
src/3rdparty/angle/src/compiler/DetectRecursion.cpp
vendored
125
src/3rdparty/angle/src/compiler/DetectRecursion.cpp
vendored
@ -1,125 +0,0 @@
|
||||
//
|
||||
// Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
//
|
||||
|
||||
#include "compiler/DetectRecursion.h"
|
||||
|
||||
DetectRecursion::FunctionNode::FunctionNode(const TString& fname)
|
||||
: name(fname),
|
||||
visit(PreVisit)
|
||||
{
|
||||
}
|
||||
|
||||
const TString& DetectRecursion::FunctionNode::getName() const
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
void DetectRecursion::FunctionNode::addCallee(
|
||||
DetectRecursion::FunctionNode* callee)
|
||||
{
|
||||
for (size_t i = 0; i < callees.size(); ++i) {
|
||||
if (callees[i] == callee)
|
||||
return;
|
||||
}
|
||||
callees.push_back(callee);
|
||||
}
|
||||
|
||||
bool DetectRecursion::FunctionNode::detectRecursion()
|
||||
{
|
||||
ASSERT(visit == PreVisit);
|
||||
visit = InVisit;
|
||||
for (size_t i = 0; i < callees.size(); ++i) {
|
||||
switch (callees[i]->visit) {
|
||||
case InVisit:
|
||||
// cycle detected, i.e., recursion detected.
|
||||
return true;
|
||||
case PostVisit:
|
||||
break;
|
||||
case PreVisit: {
|
||||
bool recursion = callees[i]->detectRecursion();
|
||||
if (recursion)
|
||||
return true;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
UNREACHABLE();
|
||||
break;
|
||||
}
|
||||
}
|
||||
visit = PostVisit;
|
||||
return false;
|
||||
}
|
||||
|
||||
DetectRecursion::DetectRecursion()
|
||||
: currentFunction(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
DetectRecursion::~DetectRecursion()
|
||||
{
|
||||
for (size_t i = 0; i < functions.size(); ++i)
|
||||
delete functions[i];
|
||||
}
|
||||
|
||||
bool DetectRecursion::visitAggregate(Visit visit, TIntermAggregate* node)
|
||||
{
|
||||
switch (node->getOp())
|
||||
{
|
||||
case EOpPrototype:
|
||||
// Function declaration.
|
||||
// Don't add FunctionNode here because node->getName() is the
|
||||
// unmangled function name.
|
||||
break;
|
||||
case EOpFunction: {
|
||||
// Function definition.
|
||||
if (visit == PreVisit) {
|
||||
currentFunction = findFunctionByName(node->getName());
|
||||
if (currentFunction == NULL) {
|
||||
currentFunction = new FunctionNode(node->getName());
|
||||
functions.push_back(currentFunction);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case EOpFunctionCall: {
|
||||
// Function call.
|
||||
if (visit == PreVisit) {
|
||||
ASSERT(currentFunction != NULL);
|
||||
FunctionNode* func = findFunctionByName(node->getName());
|
||||
if (func == NULL) {
|
||||
func = new FunctionNode(node->getName());
|
||||
functions.push_back(func);
|
||||
}
|
||||
currentFunction->addCallee(func);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
DetectRecursion::ErrorCode DetectRecursion::detectRecursion()
|
||||
{
|
||||
FunctionNode* main = findFunctionByName("main(");
|
||||
if (main == NULL)
|
||||
return kErrorMissingMain;
|
||||
if (main->detectRecursion())
|
||||
return kErrorRecursion;
|
||||
return kErrorNone;
|
||||
}
|
||||
|
||||
DetectRecursion::FunctionNode* DetectRecursion::findFunctionByName(
|
||||
const TString& name)
|
||||
{
|
||||
for (size_t i = 0; i < functions.size(); ++i) {
|
||||
if (functions[i]->getName() == name)
|
||||
return functions[i];
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
@ -1,60 +0,0 @@
|
||||
//
|
||||
// Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
//
|
||||
|
||||
#ifndef COMPILER_DETECT_RECURSION_H_
|
||||
#define COMPILER_DETECT_RECURSION_H_
|
||||
|
||||
#include "GLSLANG/ShaderLang.h"
|
||||
|
||||
#include "compiler/intermediate.h"
|
||||
#include "compiler/VariableInfo.h"
|
||||
|
||||
// Traverses intermediate tree to detect function recursion.
|
||||
class DetectRecursion : public TIntermTraverser {
|
||||
public:
|
||||
enum ErrorCode {
|
||||
kErrorMissingMain,
|
||||
kErrorRecursion,
|
||||
kErrorNone
|
||||
};
|
||||
|
||||
DetectRecursion();
|
||||
~DetectRecursion();
|
||||
|
||||
virtual bool visitAggregate(Visit, TIntermAggregate*);
|
||||
|
||||
ErrorCode detectRecursion();
|
||||
|
||||
private:
|
||||
class FunctionNode {
|
||||
public:
|
||||
FunctionNode(const TString& fname);
|
||||
|
||||
const TString& getName() const;
|
||||
|
||||
// If a function is already in the callee list, this becomes a no-op.
|
||||
void addCallee(FunctionNode* callee);
|
||||
|
||||
// Return true if recursive function calls are detected.
|
||||
bool detectRecursion();
|
||||
|
||||
private:
|
||||
// mangled function name is unique.
|
||||
TString name;
|
||||
|
||||
// functions that are directly called by this function.
|
||||
TVector<FunctionNode*> callees;
|
||||
|
||||
Visit visit;
|
||||
};
|
||||
|
||||
FunctionNode* findFunctionByName(const TString& name);
|
||||
|
||||
TVector<FunctionNode*> functions;
|
||||
FunctionNode* currentFunction;
|
||||
};
|
||||
|
||||
#endif // COMPILER_DETECT_RECURSION_H_
|
@ -1,61 +0,0 @@
|
||||
//
|
||||
// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
//
|
||||
|
||||
#include "compiler/InitializeGLPosition.h"
|
||||
#include "compiler/debug.h"
|
||||
|
||||
bool InitializeGLPosition::visitAggregate(Visit visit, TIntermAggregate* node)
|
||||
{
|
||||
bool visitChildren = !mCodeInserted;
|
||||
switch (node->getOp())
|
||||
{
|
||||
case EOpSequence: break;
|
||||
case EOpFunction:
|
||||
{
|
||||
// Function definition.
|
||||
ASSERT(visit == PreVisit);
|
||||
if (node->getName() == "main(")
|
||||
{
|
||||
TIntermSequence &sequence = node->getSequence();
|
||||
ASSERT((sequence.size() == 1) || (sequence.size() == 2));
|
||||
TIntermAggregate *body = NULL;
|
||||
if (sequence.size() == 1)
|
||||
{
|
||||
body = new TIntermAggregate(EOpSequence);
|
||||
sequence.push_back(body);
|
||||
}
|
||||
else
|
||||
{
|
||||
body = sequence[1]->getAsAggregate();
|
||||
}
|
||||
ASSERT(body);
|
||||
insertCode(body->getSequence());
|
||||
mCodeInserted = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default: visitChildren = false; break;
|
||||
}
|
||||
return visitChildren;
|
||||
}
|
||||
|
||||
void InitializeGLPosition::insertCode(TIntermSequence& sequence)
|
||||
{
|
||||
TIntermBinary *binary = new TIntermBinary(EOpAssign);
|
||||
sequence.insert(sequence.begin(), binary);
|
||||
|
||||
TIntermSymbol *left = new TIntermSymbol(
|
||||
0, "gl_Position", TType(EbtFloat, EbpUndefined, EvqPosition, 4));
|
||||
binary->setLeft(left);
|
||||
|
||||
ConstantUnion *u = new ConstantUnion[4];
|
||||
for (int ii = 0; ii < 3; ++ii)
|
||||
u[ii].setFConst(0.0f);
|
||||
u[3].setFConst(1.0f);
|
||||
TIntermConstantUnion *right = new TIntermConstantUnion(
|
||||
u, TType(EbtFloat, EbpUndefined, EvqConst, 4));
|
||||
binary->setRight(right);
|
||||
}
|
@ -1,33 +0,0 @@
|
||||
//
|
||||
// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
//
|
||||
|
||||
#ifndef COMPILER_INITIALIZE_GL_POSITION_H_
|
||||
#define COMPILER_INITIALIZE_GL_POSITION_H_
|
||||
|
||||
#include "compiler/intermediate.h"
|
||||
|
||||
class InitializeGLPosition : public TIntermTraverser
|
||||
{
|
||||
public:
|
||||
InitializeGLPosition() : mCodeInserted(false) { }
|
||||
|
||||
protected:
|
||||
virtual bool visitBinary(Visit visit, TIntermBinary* node) { return false; }
|
||||
virtual bool visitUnary(Visit visit, TIntermUnary* node) { return false; }
|
||||
virtual bool visitSelection(Visit visit, TIntermSelection* node) { return false; }
|
||||
virtual bool visitLoop(Visit visit, TIntermLoop* node) { return false; }
|
||||
virtual bool visitBranch(Visit visit, TIntermBranch* node) { return false; }
|
||||
|
||||
virtual bool visitAggregate(Visit visit, TIntermAggregate* node);
|
||||
|
||||
private:
|
||||
// Insert AST node in the beginning of main() for "gl_Position = vec4(0.0, 0.0, 0.0, 1.0);".
|
||||
void insertCode(TIntermSequence& sequence);
|
||||
|
||||
bool mCodeInserted;
|
||||
};
|
||||
|
||||
#endif // COMPILER_INITIALIZE_GL_POSITION_H_
|
293
src/3rdparty/angle/src/compiler/IntermTraverse.cpp
vendored
293
src/3rdparty/angle/src/compiler/IntermTraverse.cpp
vendored
@ -1,293 +0,0 @@
|
||||
//
|
||||
// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
//
|
||||
|
||||
#include "compiler/intermediate.h"
|
||||
|
||||
//
|
||||
// Traverse the intermediate representation tree, and
|
||||
// call a node type specific function for each node.
|
||||
// Done recursively through the member function Traverse().
|
||||
// Node types can be skipped if their function to call is 0,
|
||||
// but their subtree will still be traversed.
|
||||
// Nodes with children can have their whole subtree skipped
|
||||
// if preVisit is turned on and the type specific function
|
||||
// returns false.
|
||||
//
|
||||
// preVisit, postVisit, and rightToLeft control what order
|
||||
// nodes are visited in.
|
||||
//
|
||||
|
||||
//
|
||||
// Traversal functions for terminals are straighforward....
|
||||
//
|
||||
void TIntermSymbol::traverse(TIntermTraverser* it)
|
||||
{
|
||||
it->visitSymbol(this);
|
||||
}
|
||||
|
||||
void TIntermConstantUnion::traverse(TIntermTraverser* it)
|
||||
{
|
||||
it->visitConstantUnion(this);
|
||||
}
|
||||
|
||||
//
|
||||
// Traverse a binary node.
|
||||
//
|
||||
void TIntermBinary::traverse(TIntermTraverser* it)
|
||||
{
|
||||
bool visit = true;
|
||||
|
||||
//
|
||||
// visit the node before children if pre-visiting.
|
||||
//
|
||||
if(it->preVisit)
|
||||
{
|
||||
visit = it->visitBinary(PreVisit, this);
|
||||
}
|
||||
|
||||
//
|
||||
// Visit the children, in the right order.
|
||||
//
|
||||
if(visit)
|
||||
{
|
||||
it->incrementDepth();
|
||||
|
||||
if(it->rightToLeft)
|
||||
{
|
||||
if(right)
|
||||
{
|
||||
right->traverse(it);
|
||||
}
|
||||
|
||||
if(it->inVisit)
|
||||
{
|
||||
visit = it->visitBinary(InVisit, this);
|
||||
}
|
||||
|
||||
if(visit && left)
|
||||
{
|
||||
left->traverse(it);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(left)
|
||||
{
|
||||
left->traverse(it);
|
||||
}
|
||||
|
||||
if(it->inVisit)
|
||||
{
|
||||
visit = it->visitBinary(InVisit, this);
|
||||
}
|
||||
|
||||
if(visit && right)
|
||||
{
|
||||
right->traverse(it);
|
||||
}
|
||||
}
|
||||
|
||||
it->decrementDepth();
|
||||
}
|
||||
|
||||
//
|
||||
// Visit the node after the children, if requested and the traversal
|
||||
// hasn't been cancelled yet.
|
||||
//
|
||||
if(visit && it->postVisit)
|
||||
{
|
||||
it->visitBinary(PostVisit, this);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Traverse a unary node. Same comments in binary node apply here.
|
||||
//
|
||||
void TIntermUnary::traverse(TIntermTraverser* it)
|
||||
{
|
||||
bool visit = true;
|
||||
|
||||
if (it->preVisit)
|
||||
visit = it->visitUnary(PreVisit, this);
|
||||
|
||||
if (visit) {
|
||||
it->incrementDepth();
|
||||
operand->traverse(it);
|
||||
it->decrementDepth();
|
||||
}
|
||||
|
||||
if (visit && it->postVisit)
|
||||
it->visitUnary(PostVisit, this);
|
||||
}
|
||||
|
||||
//
|
||||
// Traverse an aggregate node. Same comments in binary node apply here.
|
||||
//
|
||||
void TIntermAggregate::traverse(TIntermTraverser* it)
|
||||
{
|
||||
bool visit = true;
|
||||
|
||||
if(it->preVisit)
|
||||
{
|
||||
visit = it->visitAggregate(PreVisit, this);
|
||||
}
|
||||
|
||||
if(visit)
|
||||
{
|
||||
it->incrementDepth();
|
||||
|
||||
if(it->rightToLeft)
|
||||
{
|
||||
for(TIntermSequence::reverse_iterator sit = sequence.rbegin(); sit != sequence.rend(); sit++)
|
||||
{
|
||||
(*sit)->traverse(it);
|
||||
|
||||
if(visit && it->inVisit)
|
||||
{
|
||||
if(*sit != sequence.front())
|
||||
{
|
||||
visit = it->visitAggregate(InVisit, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for(TIntermSequence::iterator sit = sequence.begin(); sit != sequence.end(); sit++)
|
||||
{
|
||||
(*sit)->traverse(it);
|
||||
|
||||
if(visit && it->inVisit)
|
||||
{
|
||||
if(*sit != sequence.back())
|
||||
{
|
||||
visit = it->visitAggregate(InVisit, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
it->decrementDepth();
|
||||
}
|
||||
|
||||
if(visit && it->postVisit)
|
||||
{
|
||||
it->visitAggregate(PostVisit, this);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Traverse a selection node. Same comments in binary node apply here.
|
||||
//
|
||||
void TIntermSelection::traverse(TIntermTraverser* it)
|
||||
{
|
||||
bool visit = true;
|
||||
|
||||
if (it->preVisit)
|
||||
visit = it->visitSelection(PreVisit, this);
|
||||
|
||||
if (visit) {
|
||||
it->incrementDepth();
|
||||
if (it->rightToLeft) {
|
||||
if (falseBlock)
|
||||
falseBlock->traverse(it);
|
||||
if (trueBlock)
|
||||
trueBlock->traverse(it);
|
||||
condition->traverse(it);
|
||||
} else {
|
||||
condition->traverse(it);
|
||||
if (trueBlock)
|
||||
trueBlock->traverse(it);
|
||||
if (falseBlock)
|
||||
falseBlock->traverse(it);
|
||||
}
|
||||
it->decrementDepth();
|
||||
}
|
||||
|
||||
if (visit && it->postVisit)
|
||||
it->visitSelection(PostVisit, this);
|
||||
}
|
||||
|
||||
//
|
||||
// Traverse a loop node. Same comments in binary node apply here.
|
||||
//
|
||||
void TIntermLoop::traverse(TIntermTraverser* it)
|
||||
{
|
||||
bool visit = true;
|
||||
|
||||
if(it->preVisit)
|
||||
{
|
||||
visit = it->visitLoop(PreVisit, this);
|
||||
}
|
||||
|
||||
if(visit)
|
||||
{
|
||||
it->incrementDepth();
|
||||
|
||||
if(it->rightToLeft)
|
||||
{
|
||||
if(expr)
|
||||
{
|
||||
expr->traverse(it);
|
||||
}
|
||||
|
||||
if(body)
|
||||
{
|
||||
body->traverse(it);
|
||||
}
|
||||
|
||||
if(cond)
|
||||
{
|
||||
cond->traverse(it);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(cond)
|
||||
{
|
||||
cond->traverse(it);
|
||||
}
|
||||
|
||||
if(body)
|
||||
{
|
||||
body->traverse(it);
|
||||
}
|
||||
|
||||
if(expr)
|
||||
{
|
||||
expr->traverse(it);
|
||||
}
|
||||
}
|
||||
|
||||
it->decrementDepth();
|
||||
}
|
||||
|
||||
if(visit && it->postVisit)
|
||||
{
|
||||
it->visitLoop(PostVisit, this);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Traverse a branch node. Same comments in binary node apply here.
|
||||
//
|
||||
void TIntermBranch::traverse(TIntermTraverser* it)
|
||||
{
|
||||
bool visit = true;
|
||||
|
||||
if (it->preVisit)
|
||||
visit = it->visitBranch(PreVisit, this);
|
||||
|
||||
if (visit && expression) {
|
||||
it->incrementDepth();
|
||||
expression->traverse(it);
|
||||
it->decrementDepth();
|
||||
}
|
||||
|
||||
if (visit && it->postVisit)
|
||||
it->visitBranch(PostVisit, this);
|
||||
}
|
||||
|
@ -25,14 +25,14 @@ void Diagnostics::report(ID id,
|
||||
|
||||
Diagnostics::Severity Diagnostics::severity(ID id)
|
||||
{
|
||||
if ((id > ERROR_BEGIN) && (id < ERROR_END))
|
||||
return ERROR;
|
||||
if ((id > PP_ERROR_BEGIN) && (id < PP_ERROR_END))
|
||||
return PP_ERROR;
|
||||
|
||||
if ((id > WARNING_BEGIN) && (id < WARNING_END))
|
||||
return WARNING;
|
||||
if ((id > PP_WARNING_BEGIN) && (id < PP_WARNING_END))
|
||||
return PP_WARNING;
|
||||
|
||||
assert(false);
|
||||
return ERROR;
|
||||
return PP_ERROR;
|
||||
}
|
||||
|
||||
std::string Diagnostics::message(ID id)
|
||||
@ -40,82 +40,82 @@ std::string Diagnostics::message(ID id)
|
||||
switch (id)
|
||||
{
|
||||
// Errors begin.
|
||||
case INTERNAL_ERROR:
|
||||
case PP_INTERNAL_ERROR:
|
||||
return "internal error";
|
||||
case OUT_OF_MEMORY:
|
||||
case PP_OUT_OF_MEMORY:
|
||||
return "out of memory";
|
||||
case INVALID_CHARACTER:
|
||||
case PP_INVALID_CHARACTER:
|
||||
return "invalid character";
|
||||
case INVALID_NUMBER:
|
||||
case PP_INVALID_NUMBER:
|
||||
return "invalid number";
|
||||
case INTEGER_OVERFLOW:
|
||||
case PP_INTEGER_OVERFLOW:
|
||||
return "integer overflow";
|
||||
case FLOAT_OVERFLOW:
|
||||
case PP_FLOAT_OVERFLOW:
|
||||
return "float overflow";
|
||||
case TOKEN_TOO_LONG:
|
||||
case PP_TOKEN_TOO_LONG:
|
||||
return "token too long";
|
||||
case INVALID_EXPRESSION:
|
||||
case PP_INVALID_EXPRESSION:
|
||||
return "invalid expression";
|
||||
case DIVISION_BY_ZERO:
|
||||
case PP_DIVISION_BY_ZERO:
|
||||
return "division by zero";
|
||||
case EOF_IN_COMMENT:
|
||||
case PP_EOF_IN_COMMENT:
|
||||
return "unexpected end of file found in comment";
|
||||
case UNEXPECTED_TOKEN:
|
||||
case PP_UNEXPECTED_TOKEN:
|
||||
return "unexpected token";
|
||||
case DIRECTIVE_INVALID_NAME:
|
||||
case PP_DIRECTIVE_INVALID_NAME:
|
||||
return "invalid directive name";
|
||||
case MACRO_NAME_RESERVED:
|
||||
case PP_MACRO_NAME_RESERVED:
|
||||
return "macro name is reserved";
|
||||
case MACRO_REDEFINED:
|
||||
case PP_MACRO_REDEFINED:
|
||||
return "macro redefined";
|
||||
case MACRO_PREDEFINED_REDEFINED:
|
||||
case PP_MACRO_PREDEFINED_REDEFINED:
|
||||
return "predefined macro redefined";
|
||||
case MACRO_PREDEFINED_UNDEFINED:
|
||||
case PP_MACRO_PREDEFINED_UNDEFINED:
|
||||
return "predefined macro undefined";
|
||||
case MACRO_UNTERMINATED_INVOCATION:
|
||||
case PP_MACRO_UNTERMINATED_INVOCATION:
|
||||
return "unterminated macro invocation";
|
||||
case MACRO_TOO_FEW_ARGS:
|
||||
case PP_MACRO_TOO_FEW_ARGS:
|
||||
return "Not enough arguments for macro";
|
||||
case MACRO_TOO_MANY_ARGS:
|
||||
case PP_MACRO_TOO_MANY_ARGS:
|
||||
return "Too many arguments for macro";
|
||||
case CONDITIONAL_ENDIF_WITHOUT_IF:
|
||||
case PP_CONDITIONAL_ENDIF_WITHOUT_IF:
|
||||
return "unexpected #endif found without a matching #if";
|
||||
case CONDITIONAL_ELSE_WITHOUT_IF:
|
||||
case PP_CONDITIONAL_ELSE_WITHOUT_IF:
|
||||
return "unexpected #else found without a matching #if";
|
||||
case CONDITIONAL_ELSE_AFTER_ELSE:
|
||||
case PP_CONDITIONAL_ELSE_AFTER_ELSE:
|
||||
return "unexpected #else found after another #else";
|
||||
case CONDITIONAL_ELIF_WITHOUT_IF:
|
||||
case PP_CONDITIONAL_ELIF_WITHOUT_IF:
|
||||
return "unexpected #elif found without a matching #if";
|
||||
case CONDITIONAL_ELIF_AFTER_ELSE:
|
||||
case PP_CONDITIONAL_ELIF_AFTER_ELSE:
|
||||
return "unexpected #elif found after #else";
|
||||
case CONDITIONAL_UNTERMINATED:
|
||||
case PP_CONDITIONAL_UNTERMINATED:
|
||||
return "unexpected end of file found in conditional block";
|
||||
case INVALID_EXTENSION_NAME:
|
||||
case PP_INVALID_EXTENSION_NAME:
|
||||
return "invalid extension name";
|
||||
case INVALID_EXTENSION_BEHAVIOR:
|
||||
case PP_INVALID_EXTENSION_BEHAVIOR:
|
||||
return "invalid extension behavior";
|
||||
case INVALID_EXTENSION_DIRECTIVE:
|
||||
case PP_INVALID_EXTENSION_DIRECTIVE:
|
||||
return "invalid extension directive";
|
||||
case INVALID_VERSION_NUMBER:
|
||||
case PP_INVALID_VERSION_NUMBER:
|
||||
return "invalid version number";
|
||||
case INVALID_VERSION_DIRECTIVE:
|
||||
case PP_INVALID_VERSION_DIRECTIVE:
|
||||
return "invalid version directive";
|
||||
case VERSION_NOT_FIRST_STATEMENT:
|
||||
case PP_VERSION_NOT_FIRST_STATEMENT:
|
||||
return "#version directive must occur before anything else, "
|
||||
"except for comments and white space";
|
||||
case INVALID_LINE_NUMBER:
|
||||
case PP_INVALID_LINE_NUMBER:
|
||||
return "invalid line number";
|
||||
case INVALID_FILE_NUMBER:
|
||||
case PP_INVALID_FILE_NUMBER:
|
||||
return "invalid file number";
|
||||
case INVALID_LINE_DIRECTIVE:
|
||||
case PP_INVALID_LINE_DIRECTIVE:
|
||||
return "invalid line directive";
|
||||
// Errors end.
|
||||
// Warnings begin.
|
||||
case EOF_IN_DIRECTIVE:
|
||||
case PP_EOF_IN_DIRECTIVE:
|
||||
return "unexpected end of file found in directive";
|
||||
case CONDITIONAL_UNEXPECTED_TOKEN:
|
||||
case PP_CONDITIONAL_UNEXPECTED_TOKEN:
|
||||
return "unexpected token after conditional expression";
|
||||
case UNRECOGNIZED_PRAGMA:
|
||||
case PP_UNRECOGNIZED_PRAGMA:
|
||||
return "unrecognized pragma";
|
||||
// Warnings end.
|
||||
default:
|
||||
|
@ -21,53 +21,53 @@ class Diagnostics
|
||||
public:
|
||||
enum Severity
|
||||
{
|
||||
ERROR,
|
||||
WARNING
|
||||
PP_ERROR,
|
||||
PP_WARNING
|
||||
};
|
||||
enum ID
|
||||
{
|
||||
ERROR_BEGIN,
|
||||
INTERNAL_ERROR,
|
||||
OUT_OF_MEMORY,
|
||||
INVALID_CHARACTER,
|
||||
INVALID_NUMBER,
|
||||
INTEGER_OVERFLOW,
|
||||
FLOAT_OVERFLOW,
|
||||
TOKEN_TOO_LONG,
|
||||
INVALID_EXPRESSION,
|
||||
DIVISION_BY_ZERO,
|
||||
EOF_IN_COMMENT,
|
||||
UNEXPECTED_TOKEN,
|
||||
DIRECTIVE_INVALID_NAME,
|
||||
MACRO_NAME_RESERVED,
|
||||
MACRO_REDEFINED,
|
||||
MACRO_PREDEFINED_REDEFINED,
|
||||
MACRO_PREDEFINED_UNDEFINED,
|
||||
MACRO_UNTERMINATED_INVOCATION,
|
||||
MACRO_TOO_FEW_ARGS,
|
||||
MACRO_TOO_MANY_ARGS,
|
||||
CONDITIONAL_ENDIF_WITHOUT_IF,
|
||||
CONDITIONAL_ELSE_WITHOUT_IF,
|
||||
CONDITIONAL_ELSE_AFTER_ELSE,
|
||||
CONDITIONAL_ELIF_WITHOUT_IF,
|
||||
CONDITIONAL_ELIF_AFTER_ELSE,
|
||||
CONDITIONAL_UNTERMINATED,
|
||||
INVALID_EXTENSION_NAME,
|
||||
INVALID_EXTENSION_BEHAVIOR,
|
||||
INVALID_EXTENSION_DIRECTIVE,
|
||||
INVALID_VERSION_NUMBER,
|
||||
INVALID_VERSION_DIRECTIVE,
|
||||
VERSION_NOT_FIRST_STATEMENT,
|
||||
INVALID_LINE_NUMBER,
|
||||
INVALID_FILE_NUMBER,
|
||||
INVALID_LINE_DIRECTIVE,
|
||||
ERROR_END,
|
||||
PP_ERROR_BEGIN,
|
||||
PP_INTERNAL_ERROR,
|
||||
PP_OUT_OF_MEMORY,
|
||||
PP_INVALID_CHARACTER,
|
||||
PP_INVALID_NUMBER,
|
||||
PP_INTEGER_OVERFLOW,
|
||||
PP_FLOAT_OVERFLOW,
|
||||
PP_TOKEN_TOO_LONG,
|
||||
PP_INVALID_EXPRESSION,
|
||||
PP_DIVISION_BY_ZERO,
|
||||
PP_EOF_IN_COMMENT,
|
||||
PP_UNEXPECTED_TOKEN,
|
||||
PP_DIRECTIVE_INVALID_NAME,
|
||||
PP_MACRO_NAME_RESERVED,
|
||||
PP_MACRO_REDEFINED,
|
||||
PP_MACRO_PREDEFINED_REDEFINED,
|
||||
PP_MACRO_PREDEFINED_UNDEFINED,
|
||||
PP_MACRO_UNTERMINATED_INVOCATION,
|
||||
PP_MACRO_TOO_FEW_ARGS,
|
||||
PP_MACRO_TOO_MANY_ARGS,
|
||||
PP_CONDITIONAL_ENDIF_WITHOUT_IF,
|
||||
PP_CONDITIONAL_ELSE_WITHOUT_IF,
|
||||
PP_CONDITIONAL_ELSE_AFTER_ELSE,
|
||||
PP_CONDITIONAL_ELIF_WITHOUT_IF,
|
||||
PP_CONDITIONAL_ELIF_AFTER_ELSE,
|
||||
PP_CONDITIONAL_UNTERMINATED,
|
||||
PP_INVALID_EXTENSION_NAME,
|
||||
PP_INVALID_EXTENSION_BEHAVIOR,
|
||||
PP_INVALID_EXTENSION_DIRECTIVE,
|
||||
PP_INVALID_VERSION_NUMBER,
|
||||
PP_INVALID_VERSION_DIRECTIVE,
|
||||
PP_VERSION_NOT_FIRST_STATEMENT,
|
||||
PP_INVALID_LINE_NUMBER,
|
||||
PP_INVALID_FILE_NUMBER,
|
||||
PP_INVALID_LINE_DIRECTIVE,
|
||||
PP_ERROR_END,
|
||||
|
||||
WARNING_BEGIN,
|
||||
EOF_IN_DIRECTIVE,
|
||||
CONDITIONAL_UNEXPECTED_TOKEN,
|
||||
UNRECOGNIZED_PRAGMA,
|
||||
WARNING_END
|
||||
PP_WARNING_BEGIN,
|
||||
PP_EOF_IN_DIRECTIVE,
|
||||
PP_CONDITIONAL_UNEXPECTED_TOKEN,
|
||||
PP_UNRECOGNIZED_PRAGMA,
|
||||
PP_WARNING_END
|
||||
};
|
||||
|
||||
virtual ~Diagnostics();
|
||||
|
@ -172,7 +172,7 @@ class DefinedParser : public Lexer
|
||||
|
||||
if (token->type != Token::IDENTIFIER)
|
||||
{
|
||||
mDiagnostics->report(Diagnostics::UNEXPECTED_TOKEN,
|
||||
mDiagnostics->report(Diagnostics::PP_UNEXPECTED_TOKEN,
|
||||
token->location, token->text);
|
||||
skipUntilEOD(mLexer, token);
|
||||
return;
|
||||
@ -185,7 +185,7 @@ class DefinedParser : public Lexer
|
||||
mLexer->lex(token);
|
||||
if (token->type != ')')
|
||||
{
|
||||
mDiagnostics->report(Diagnostics::UNEXPECTED_TOKEN,
|
||||
mDiagnostics->report(Diagnostics::PP_UNEXPECTED_TOKEN,
|
||||
token->location, token->text);
|
||||
skipUntilEOD(mLexer, token);
|
||||
return;
|
||||
@ -233,7 +233,7 @@ void DirectiveParser::lex(Token* token)
|
||||
if (!mConditionalStack.empty())
|
||||
{
|
||||
const ConditionalBlock& block = mConditionalStack.back();
|
||||
mDiagnostics->report(Diagnostics::CONDITIONAL_UNTERMINATED,
|
||||
mDiagnostics->report(Diagnostics::PP_CONDITIONAL_UNTERMINATED,
|
||||
block.location, block.type);
|
||||
}
|
||||
break;
|
||||
@ -268,7 +268,7 @@ void DirectiveParser::parseDirective(Token* token)
|
||||
switch(directive)
|
||||
{
|
||||
case DIRECTIVE_NONE:
|
||||
mDiagnostics->report(Diagnostics::DIRECTIVE_INVALID_NAME,
|
||||
mDiagnostics->report(Diagnostics::PP_DIRECTIVE_INVALID_NAME,
|
||||
token->location, token->text);
|
||||
skipUntilEOD(mTokenizer, token);
|
||||
break;
|
||||
@ -319,7 +319,7 @@ void DirectiveParser::parseDirective(Token* token)
|
||||
skipUntilEOD(mTokenizer, token);
|
||||
if (token->type == Token::LAST)
|
||||
{
|
||||
mDiagnostics->report(Diagnostics::EOF_IN_DIRECTIVE,
|
||||
mDiagnostics->report(Diagnostics::PP_EOF_IN_DIRECTIVE,
|
||||
token->location, token->text);
|
||||
}
|
||||
}
|
||||
@ -331,19 +331,19 @@ void DirectiveParser::parseDefine(Token* token)
|
||||
mTokenizer->lex(token);
|
||||
if (token->type != Token::IDENTIFIER)
|
||||
{
|
||||
mDiagnostics->report(Diagnostics::UNEXPECTED_TOKEN,
|
||||
mDiagnostics->report(Diagnostics::PP_UNEXPECTED_TOKEN,
|
||||
token->location, token->text);
|
||||
return;
|
||||
}
|
||||
if (isMacroPredefined(token->text, *mMacroSet))
|
||||
{
|
||||
mDiagnostics->report(Diagnostics::MACRO_PREDEFINED_REDEFINED,
|
||||
mDiagnostics->report(Diagnostics::PP_MACRO_PREDEFINED_REDEFINED,
|
||||
token->location, token->text);
|
||||
return;
|
||||
}
|
||||
if (isMacroNameReserved(token->text))
|
||||
{
|
||||
mDiagnostics->report(Diagnostics::MACRO_NAME_RESERVED,
|
||||
mDiagnostics->report(Diagnostics::PP_MACRO_NAME_RESERVED,
|
||||
token->location, token->text);
|
||||
return;
|
||||
}
|
||||
@ -368,7 +368,7 @@ void DirectiveParser::parseDefine(Token* token)
|
||||
|
||||
if (token->type != ')')
|
||||
{
|
||||
mDiagnostics->report(Diagnostics::UNEXPECTED_TOKEN,
|
||||
mDiagnostics->report(Diagnostics::PP_UNEXPECTED_TOKEN,
|
||||
token->location,
|
||||
token->text);
|
||||
return;
|
||||
@ -396,7 +396,7 @@ void DirectiveParser::parseDefine(Token* token)
|
||||
MacroSet::const_iterator iter = mMacroSet->find(macro.name);
|
||||
if (iter != mMacroSet->end() && !macro.equals(iter->second))
|
||||
{
|
||||
mDiagnostics->report(Diagnostics::MACRO_REDEFINED,
|
||||
mDiagnostics->report(Diagnostics::PP_MACRO_REDEFINED,
|
||||
token->location,
|
||||
macro.name);
|
||||
return;
|
||||
@ -411,7 +411,7 @@ void DirectiveParser::parseUndef(Token* token)
|
||||
mTokenizer->lex(token);
|
||||
if (token->type != Token::IDENTIFIER)
|
||||
{
|
||||
mDiagnostics->report(Diagnostics::UNEXPECTED_TOKEN,
|
||||
mDiagnostics->report(Diagnostics::PP_UNEXPECTED_TOKEN,
|
||||
token->location, token->text);
|
||||
return;
|
||||
}
|
||||
@ -421,7 +421,7 @@ void DirectiveParser::parseUndef(Token* token)
|
||||
{
|
||||
if (iter->second.predefined)
|
||||
{
|
||||
mDiagnostics->report(Diagnostics::MACRO_PREDEFINED_UNDEFINED,
|
||||
mDiagnostics->report(Diagnostics::PP_MACRO_PREDEFINED_UNDEFINED,
|
||||
token->location, token->text);
|
||||
}
|
||||
else
|
||||
@ -457,7 +457,7 @@ void DirectiveParser::parseElse(Token* token)
|
||||
|
||||
if (mConditionalStack.empty())
|
||||
{
|
||||
mDiagnostics->report(Diagnostics::CONDITIONAL_ELSE_WITHOUT_IF,
|
||||
mDiagnostics->report(Diagnostics::PP_CONDITIONAL_ELSE_WITHOUT_IF,
|
||||
token->location, token->text);
|
||||
skipUntilEOD(mTokenizer, token);
|
||||
return;
|
||||
@ -472,7 +472,7 @@ void DirectiveParser::parseElse(Token* token)
|
||||
}
|
||||
if (block.foundElseGroup)
|
||||
{
|
||||
mDiagnostics->report(Diagnostics::CONDITIONAL_ELSE_AFTER_ELSE,
|
||||
mDiagnostics->report(Diagnostics::PP_CONDITIONAL_ELSE_AFTER_ELSE,
|
||||
token->location, token->text);
|
||||
skipUntilEOD(mTokenizer, token);
|
||||
return;
|
||||
@ -486,7 +486,7 @@ void DirectiveParser::parseElse(Token* token)
|
||||
mTokenizer->lex(token);
|
||||
if (!isEOD(token))
|
||||
{
|
||||
mDiagnostics->report(Diagnostics::CONDITIONAL_UNEXPECTED_TOKEN,
|
||||
mDiagnostics->report(Diagnostics::PP_CONDITIONAL_UNEXPECTED_TOKEN,
|
||||
token->location, token->text);
|
||||
skipUntilEOD(mTokenizer, token);
|
||||
}
|
||||
@ -498,7 +498,7 @@ void DirectiveParser::parseElif(Token* token)
|
||||
|
||||
if (mConditionalStack.empty())
|
||||
{
|
||||
mDiagnostics->report(Diagnostics::CONDITIONAL_ELIF_WITHOUT_IF,
|
||||
mDiagnostics->report(Diagnostics::PP_CONDITIONAL_ELIF_WITHOUT_IF,
|
||||
token->location, token->text);
|
||||
skipUntilEOD(mTokenizer, token);
|
||||
return;
|
||||
@ -513,7 +513,7 @@ void DirectiveParser::parseElif(Token* token)
|
||||
}
|
||||
if (block.foundElseGroup)
|
||||
{
|
||||
mDiagnostics->report(Diagnostics::CONDITIONAL_ELIF_AFTER_ELSE,
|
||||
mDiagnostics->report(Diagnostics::PP_CONDITIONAL_ELIF_AFTER_ELSE,
|
||||
token->location, token->text);
|
||||
skipUntilEOD(mTokenizer, token);
|
||||
return;
|
||||
@ -538,7 +538,7 @@ void DirectiveParser::parseEndif(Token* token)
|
||||
|
||||
if (mConditionalStack.empty())
|
||||
{
|
||||
mDiagnostics->report(Diagnostics::CONDITIONAL_ENDIF_WITHOUT_IF,
|
||||
mDiagnostics->report(Diagnostics::PP_CONDITIONAL_ENDIF_WITHOUT_IF,
|
||||
token->location, token->text);
|
||||
skipUntilEOD(mTokenizer, token);
|
||||
return;
|
||||
@ -550,7 +550,7 @@ void DirectiveParser::parseEndif(Token* token)
|
||||
mTokenizer->lex(token);
|
||||
if (!isEOD(token))
|
||||
{
|
||||
mDiagnostics->report(Diagnostics::CONDITIONAL_UNEXPECTED_TOKEN,
|
||||
mDiagnostics->report(Diagnostics::PP_CONDITIONAL_UNEXPECTED_TOKEN,
|
||||
token->location, token->text);
|
||||
skipUntilEOD(mTokenizer, token);
|
||||
}
|
||||
@ -618,7 +618,7 @@ void DirectiveParser::parsePragma(Token* token)
|
||||
(state == RIGHT_PAREN + 1)); // With value.
|
||||
if (!valid)
|
||||
{
|
||||
mDiagnostics->report(Diagnostics::UNRECOGNIZED_PRAGMA,
|
||||
mDiagnostics->report(Diagnostics::PP_UNRECOGNIZED_PRAGMA,
|
||||
token->location, name);
|
||||
}
|
||||
else if (state > PRAGMA_NAME) // Do not notify for empty pragma.
|
||||
@ -650,7 +650,7 @@ void DirectiveParser::parseExtension(Token* token)
|
||||
case EXT_NAME:
|
||||
if (valid && (token->type != Token::IDENTIFIER))
|
||||
{
|
||||
mDiagnostics->report(Diagnostics::INVALID_EXTENSION_NAME,
|
||||
mDiagnostics->report(Diagnostics::PP_INVALID_EXTENSION_NAME,
|
||||
token->location, token->text);
|
||||
valid = false;
|
||||
}
|
||||
@ -659,7 +659,7 @@ void DirectiveParser::parseExtension(Token* token)
|
||||
case COLON:
|
||||
if (valid && (token->type != ':'))
|
||||
{
|
||||
mDiagnostics->report(Diagnostics::UNEXPECTED_TOKEN,
|
||||
mDiagnostics->report(Diagnostics::PP_UNEXPECTED_TOKEN,
|
||||
token->location, token->text);
|
||||
valid = false;
|
||||
}
|
||||
@ -667,7 +667,7 @@ void DirectiveParser::parseExtension(Token* token)
|
||||
case EXT_BEHAVIOR:
|
||||
if (valid && (token->type != Token::IDENTIFIER))
|
||||
{
|
||||
mDiagnostics->report(Diagnostics::INVALID_EXTENSION_BEHAVIOR,
|
||||
mDiagnostics->report(Diagnostics::PP_INVALID_EXTENSION_BEHAVIOR,
|
||||
token->location, token->text);
|
||||
valid = false;
|
||||
}
|
||||
@ -676,7 +676,7 @@ void DirectiveParser::parseExtension(Token* token)
|
||||
default:
|
||||
if (valid)
|
||||
{
|
||||
mDiagnostics->report(Diagnostics::UNEXPECTED_TOKEN,
|
||||
mDiagnostics->report(Diagnostics::PP_UNEXPECTED_TOKEN,
|
||||
token->location, token->text);
|
||||
valid = false;
|
||||
}
|
||||
@ -686,7 +686,7 @@ void DirectiveParser::parseExtension(Token* token)
|
||||
}
|
||||
if (valid && (state != EXT_BEHAVIOR + 1))
|
||||
{
|
||||
mDiagnostics->report(Diagnostics::INVALID_EXTENSION_DIRECTIVE,
|
||||
mDiagnostics->report(Diagnostics::PP_INVALID_EXTENSION_DIRECTIVE,
|
||||
token->location, token->text);
|
||||
valid = false;
|
||||
}
|
||||
@ -700,7 +700,7 @@ void DirectiveParser::parseVersion(Token* token)
|
||||
|
||||
if (mPastFirstStatement)
|
||||
{
|
||||
mDiagnostics->report(Diagnostics::VERSION_NOT_FIRST_STATEMENT,
|
||||
mDiagnostics->report(Diagnostics::PP_VERSION_NOT_FIRST_STATEMENT,
|
||||
token->location, token->text);
|
||||
skipUntilEOD(mTokenizer, token);
|
||||
return;
|
||||
@ -723,13 +723,13 @@ void DirectiveParser::parseVersion(Token* token)
|
||||
case VERSION_NUMBER:
|
||||
if (valid && (token->type != Token::CONST_INT))
|
||||
{
|
||||
mDiagnostics->report(Diagnostics::INVALID_VERSION_NUMBER,
|
||||
mDiagnostics->report(Diagnostics::PP_INVALID_VERSION_NUMBER,
|
||||
token->location, token->text);
|
||||
valid = false;
|
||||
}
|
||||
if (valid && !token->iValue(&version))
|
||||
{
|
||||
mDiagnostics->report(Diagnostics::INTEGER_OVERFLOW,
|
||||
mDiagnostics->report(Diagnostics::PP_INTEGER_OVERFLOW,
|
||||
token->location, token->text);
|
||||
valid = false;
|
||||
}
|
||||
@ -737,7 +737,7 @@ void DirectiveParser::parseVersion(Token* token)
|
||||
default:
|
||||
if (valid)
|
||||
{
|
||||
mDiagnostics->report(Diagnostics::UNEXPECTED_TOKEN,
|
||||
mDiagnostics->report(Diagnostics::PP_UNEXPECTED_TOKEN,
|
||||
token->location, token->text);
|
||||
valid = false;
|
||||
}
|
||||
@ -747,7 +747,7 @@ void DirectiveParser::parseVersion(Token* token)
|
||||
}
|
||||
if (valid && (state != VERSION_NUMBER + 1))
|
||||
{
|
||||
mDiagnostics->report(Diagnostics::INVALID_VERSION_DIRECTIVE,
|
||||
mDiagnostics->report(Diagnostics::PP_INVALID_VERSION_DIRECTIVE,
|
||||
token->location, token->text);
|
||||
valid = false;
|
||||
}
|
||||
@ -778,13 +778,13 @@ void DirectiveParser::parseLine(Token* token)
|
||||
case LINE_NUMBER:
|
||||
if (valid && (token->type != Token::CONST_INT))
|
||||
{
|
||||
mDiagnostics->report(Diagnostics::INVALID_LINE_NUMBER,
|
||||
mDiagnostics->report(Diagnostics::PP_INVALID_LINE_NUMBER,
|
||||
token->location, token->text);
|
||||
valid = false;
|
||||
}
|
||||
if (valid && !token->iValue(&line))
|
||||
{
|
||||
mDiagnostics->report(Diagnostics::INTEGER_OVERFLOW,
|
||||
mDiagnostics->report(Diagnostics::PP_INTEGER_OVERFLOW,
|
||||
token->location, token->text);
|
||||
valid = false;
|
||||
}
|
||||
@ -792,13 +792,13 @@ void DirectiveParser::parseLine(Token* token)
|
||||
case FILE_NUMBER:
|
||||
if (valid && (token->type != Token::CONST_INT))
|
||||
{
|
||||
mDiagnostics->report(Diagnostics::INVALID_FILE_NUMBER,
|
||||
mDiagnostics->report(Diagnostics::PP_INVALID_FILE_NUMBER,
|
||||
token->location, token->text);
|
||||
valid = false;
|
||||
}
|
||||
if (valid && !token->iValue(&file))
|
||||
{
|
||||
mDiagnostics->report(Diagnostics::INTEGER_OVERFLOW,
|
||||
mDiagnostics->report(Diagnostics::PP_INTEGER_OVERFLOW,
|
||||
token->location, token->text);
|
||||
valid = false;
|
||||
}
|
||||
@ -806,7 +806,7 @@ void DirectiveParser::parseLine(Token* token)
|
||||
default:
|
||||
if (valid)
|
||||
{
|
||||
mDiagnostics->report(Diagnostics::UNEXPECTED_TOKEN,
|
||||
mDiagnostics->report(Diagnostics::PP_UNEXPECTED_TOKEN,
|
||||
token->location, token->text);
|
||||
valid = false;
|
||||
}
|
||||
@ -817,7 +817,7 @@ void DirectiveParser::parseLine(Token* token)
|
||||
|
||||
if (valid && (state != FILE_NUMBER) && (state != FILE_NUMBER + 1))
|
||||
{
|
||||
mDiagnostics->report(Diagnostics::INVALID_LINE_DIRECTIVE,
|
||||
mDiagnostics->report(Diagnostics::PP_INVALID_LINE_DIRECTIVE,
|
||||
token->location, token->text);
|
||||
valid = false;
|
||||
}
|
||||
@ -893,7 +893,7 @@ int DirectiveParser::parseExpressionIf(Token* token)
|
||||
// Warn if there are tokens after #if expression.
|
||||
if (!isEOD(token))
|
||||
{
|
||||
mDiagnostics->report(Diagnostics::CONDITIONAL_UNEXPECTED_TOKEN,
|
||||
mDiagnostics->report(Diagnostics::PP_CONDITIONAL_UNEXPECTED_TOKEN,
|
||||
token->location, token->text);
|
||||
skipUntilEOD(mTokenizer, token);
|
||||
}
|
||||
@ -909,7 +909,7 @@ int DirectiveParser::parseExpressionIfdef(Token* token)
|
||||
mTokenizer->lex(token);
|
||||
if (token->type != Token::IDENTIFIER)
|
||||
{
|
||||
mDiagnostics->report(Diagnostics::UNEXPECTED_TOKEN,
|
||||
mDiagnostics->report(Diagnostics::PP_UNEXPECTED_TOKEN,
|
||||
token->location, token->text);
|
||||
skipUntilEOD(mTokenizer, token);
|
||||
return 0;
|
||||
@ -922,7 +922,7 @@ int DirectiveParser::parseExpressionIfdef(Token* token)
|
||||
mTokenizer->lex(token);
|
||||
if (!isEOD(token))
|
||||
{
|
||||
mDiagnostics->report(Diagnostics::CONDITIONAL_UNEXPECTED_TOKEN,
|
||||
mDiagnostics->report(Diagnostics::PP_CONDITIONAL_UNEXPECTED_TOKEN,
|
||||
token->location, token->text);
|
||||
skipUntilEOD(mTokenizer, token);
|
||||
}
|
||||
|
@ -33,6 +33,12 @@ WHICH GENERATES THE GLSL ES preprocessor expression parser.
|
||||
|
||||
#include "ExpressionParser.h"
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#include <malloc.h>
|
||||
#else
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#include <cassert>
|
||||
#include <sstream>
|
||||
|
||||
@ -146,7 +152,7 @@ expression
|
||||
std::ostringstream stream;
|
||||
stream << $1 << " % " << $3;
|
||||
std::string text = stream.str();
|
||||
context->diagnostics->report(pp::Diagnostics::DIVISION_BY_ZERO,
|
||||
context->diagnostics->report(pp::Diagnostics::PP_DIVISION_BY_ZERO,
|
||||
context->token->location,
|
||||
text.c_str());
|
||||
YYABORT;
|
||||
@ -159,7 +165,7 @@ expression
|
||||
std::ostringstream stream;
|
||||
stream << $1 << " / " << $3;
|
||||
std::string text = stream.str();
|
||||
context->diagnostics->report(pp::Diagnostics::DIVISION_BY_ZERO,
|
||||
context->diagnostics->report(pp::Diagnostics::PP_DIVISION_BY_ZERO,
|
||||
context->token->location,
|
||||
text.c_str());
|
||||
YYABORT;
|
||||
@ -201,7 +207,7 @@ int yylex(YYSTYPE* lvalp, Context* context)
|
||||
unsigned int val = 0;
|
||||
if (!token->uValue(&val))
|
||||
{
|
||||
context->diagnostics->report(pp::Diagnostics::INTEGER_OVERFLOW,
|
||||
context->diagnostics->report(pp::Diagnostics::PP_INTEGER_OVERFLOW,
|
||||
token->location, token->text);
|
||||
}
|
||||
*lvalp = static_cast<YYSTYPE>(val);
|
||||
@ -242,7 +248,7 @@ int yylex(YYSTYPE* lvalp, Context* context)
|
||||
|
||||
void yyerror(Context* context, const char* reason)
|
||||
{
|
||||
context->diagnostics->report(pp::Diagnostics::INVALID_EXPRESSION,
|
||||
context->diagnostics->report(pp::Diagnostics::PP_INVALID_EXPRESSION,
|
||||
context->token->location,
|
||||
reason);
|
||||
}
|
||||
@ -270,12 +276,12 @@ bool ExpressionParser::parse(Token* token, int* result)
|
||||
break;
|
||||
|
||||
case 2:
|
||||
mDiagnostics->report(Diagnostics::OUT_OF_MEMORY, token->location, "");
|
||||
mDiagnostics->report(Diagnostics::PP_OUT_OF_MEMORY, token->location, "");
|
||||
break;
|
||||
|
||||
default:
|
||||
assert(false);
|
||||
mDiagnostics->report(Diagnostics::INTERNAL_ERROR, token->location, "");
|
||||
mDiagnostics->report(Diagnostics::PP_INTERNAL_ERROR, token->location, "");
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -254,7 +254,7 @@ bool MacroExpander::collectMacroArgs(const Macro& macro,
|
||||
|
||||
if (token.type == Token::LAST)
|
||||
{
|
||||
mDiagnostics->report(Diagnostics::MACRO_UNTERMINATED_INVOCATION,
|
||||
mDiagnostics->report(Diagnostics::PP_MACRO_UNTERMINATED_INVOCATION,
|
||||
identifier.location, identifier.text);
|
||||
// Do not lose EOF token.
|
||||
ungetToken(token);
|
||||
@ -302,8 +302,8 @@ bool MacroExpander::collectMacroArgs(const Macro& macro,
|
||||
if (args->size() != params.size())
|
||||
{
|
||||
Diagnostics::ID id = args->size() < macro.parameters.size() ?
|
||||
Diagnostics::MACRO_TOO_FEW_ARGS :
|
||||
Diagnostics::MACRO_TOO_MANY_ARGS;
|
||||
Diagnostics::PP_MACRO_TOO_FEW_ARGS :
|
||||
Diagnostics::PP_MACRO_TOO_MANY_ARGS;
|
||||
mDiagnostics->report(id, identifier.location, identifier.text);
|
||||
return false;
|
||||
}
|
||||
|
@ -101,11 +101,11 @@ void Preprocessor::lex(Token* token)
|
||||
assert(false);
|
||||
break;
|
||||
case Token::PP_NUMBER:
|
||||
mImpl->diagnostics->report(Diagnostics::INVALID_NUMBER,
|
||||
mImpl->diagnostics->report(Diagnostics::PP_INVALID_NUMBER,
|
||||
token->location, token->text);
|
||||
break;
|
||||
case Token::PP_OTHER:
|
||||
mImpl->diagnostics->report(Diagnostics::INVALID_CHARACTER,
|
||||
mImpl->diagnostics->report(Diagnostics::PP_INVALID_CHARACTER,
|
||||
token->location, token->text);
|
||||
break;
|
||||
default:
|
||||
|
@ -256,7 +256,7 @@ FRACTIONAL_CONSTANT ({DIGIT}*"."{DIGIT}+)|({DIGIT}+".")
|
||||
|
||||
if (YY_START == COMMENT)
|
||||
{
|
||||
yyextra->diagnostics->report(pp::Diagnostics::EOF_IN_COMMENT,
|
||||
yyextra->diagnostics->report(pp::Diagnostics::PP_EOF_IN_COMMENT,
|
||||
pp::SourceLocation(yyfileno, yylineno),
|
||||
"");
|
||||
}
|
||||
@ -304,7 +304,7 @@ void Tokenizer::lex(Token* token)
|
||||
token->type = yylex(&token->text, &token->location, mHandle);
|
||||
if (token->text.size() > mMaxTokenLength)
|
||||
{
|
||||
mContext.diagnostics->report(Diagnostics::TOKEN_TOO_LONG,
|
||||
mContext.diagnostics->report(Diagnostics::PP_TOKEN_TOO_LONG,
|
||||
token->location, token->text);
|
||||
token->text.erase(mMaxTokenLength);
|
||||
}
|
||||
|
@ -82,6 +82,7 @@ enum TQualifier
|
||||
{
|
||||
EvqTemporary, // For temporaries (within a function), read/write
|
||||
EvqGlobal, // For globals read/write
|
||||
EvqInternal, // For internal use, not visible to the user
|
||||
EvqConst, // User defined constants and non-output parameters in functions
|
||||
EvqAttribute, // Readonly
|
||||
EvqVaryingIn, // readonly, fragment shaders only
|
@ -4,9 +4,9 @@
|
||||
// found in the LICENSE file.
|
||||
//
|
||||
|
||||
#include "compiler/BuiltInFunctionEmulator.h"
|
||||
#include "compiler/translator/BuiltInFunctionEmulator.h"
|
||||
|
||||
#include "compiler/SymbolTable.h"
|
||||
#include "compiler/translator/SymbolTable.h"
|
||||
|
||||
namespace {
|
||||
|
@ -9,8 +9,8 @@
|
||||
|
||||
#include "GLSLANG/ShaderLang.h"
|
||||
|
||||
#include "compiler/InfoSink.h"
|
||||
#include "compiler/intermediate.h"
|
||||
#include "compiler/translator/InfoSink.h"
|
||||
#include "compiler/translator/intermediate.h"
|
||||
|
||||
//
|
||||
// This class decides which built-in functions need to be replaced with the
|
@ -4,8 +4,9 @@
|
||||
// found in the LICENSE file.
|
||||
//
|
||||
|
||||
#include "compiler/TranslatorGLSL.h"
|
||||
#include "compiler/TranslatorESSL.h"
|
||||
#include "compiler/translator/TranslatorESSL.h"
|
||||
#include "compiler/translator/TranslatorGLSL.h"
|
||||
#include "compiler/translator/TranslatorHLSL.h"
|
||||
|
||||
//
|
||||
// This function must be provided to create the actual
|
||||
@ -16,10 +17,13 @@ TCompiler* ConstructCompiler(
|
||||
ShShaderType type, ShShaderSpec spec, ShShaderOutput output)
|
||||
{
|
||||
switch (output) {
|
||||
case SH_GLSL_OUTPUT:
|
||||
return new TranslatorGLSL(type, spec);
|
||||
case SH_ESSL_OUTPUT:
|
||||
return new TranslatorESSL(type, spec);
|
||||
case SH_GLSL_OUTPUT:
|
||||
return new TranslatorGLSL(type, spec);
|
||||
case SH_HLSL9_OUTPUT:
|
||||
case SH_HLSL11_OUTPUT:
|
||||
return new TranslatorHLSL(type, spec, output);
|
||||
default:
|
||||
return NULL;
|
||||
}
|
@ -11,8 +11,12 @@
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <limits>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "compiler/PoolAlloc.h"
|
||||
#include "compiler/translator/PoolAlloc.h"
|
||||
#include "compiler/translator/compilerdebug.h"
|
||||
#include "common/angleutils.h"
|
||||
|
||||
struct TSourceLoc {
|
||||
int first_file;
|
||||
@ -74,4 +78,15 @@ public:
|
||||
TMap(const tAllocator& a) : std::map<K, D, CMP, tAllocator>(std::map<K, D, CMP, tAllocator>::key_compare(), a) {}
|
||||
};
|
||||
|
||||
// Integer to TString conversion
|
||||
template <typename T>
|
||||
inline TString str(T i)
|
||||
{
|
||||
ASSERT(std::numeric_limits<T>::is_integer);
|
||||
char buffer[((8 * sizeof(T)) / 3) + 3];
|
||||
const char *formatStr = std::numeric_limits<T>::is_signed ? "%d" : "%u";
|
||||
snprintf(buffer, sizeof(buffer), formatStr, i);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
#endif // _COMMON_INCLUDED_
|
@ -4,22 +4,23 @@
|
||||
// found in the LICENSE file.
|
||||
//
|
||||
|
||||
#include "compiler/BuiltInFunctionEmulator.h"
|
||||
#include "compiler/DetectCallDepth.h"
|
||||
#include "compiler/ForLoopUnroll.h"
|
||||
#include "compiler/Initialize.h"
|
||||
#include "compiler/InitializeGLPosition.h"
|
||||
#include "compiler/InitializeParseContext.h"
|
||||
#include "compiler/MapLongVariableNames.h"
|
||||
#include "compiler/ParseHelper.h"
|
||||
#include "compiler/RenameFunction.h"
|
||||
#include "compiler/ShHandle.h"
|
||||
#include "compiler/ValidateLimitations.h"
|
||||
#include "compiler/VariablePacker.h"
|
||||
#include "compiler/depgraph/DependencyGraph.h"
|
||||
#include "compiler/depgraph/DependencyGraphOutput.h"
|
||||
#include "compiler/timing/RestrictFragmentShaderTiming.h"
|
||||
#include "compiler/timing/RestrictVertexShaderTiming.h"
|
||||
#include "compiler/translator/BuiltInFunctionEmulator.h"
|
||||
#include "compiler/translator/DetectCallDepth.h"
|
||||
#include "compiler/translator/ForLoopUnroll.h"
|
||||
#include "compiler/translator/Initialize.h"
|
||||
#include "compiler/translator/InitializeParseContext.h"
|
||||
#include "compiler/translator/InitializeVariables.h"
|
||||
#include "compiler/translator/MapLongVariableNames.h"
|
||||
#include "compiler/translator/ParseContext.h"
|
||||
#include "compiler/translator/RenameFunction.h"
|
||||
#include "compiler/translator/ShHandle.h"
|
||||
#include "compiler/translator/UnfoldShortCircuitAST.h"
|
||||
#include "compiler/translator/ValidateLimitations.h"
|
||||
#include "compiler/translator/VariablePacker.h"
|
||||
#include "compiler/translator/depgraph/DependencyGraph.h"
|
||||
#include "compiler/translator/depgraph/DependencyGraphOutput.h"
|
||||
#include "compiler/translator/timing/RestrictFragmentShaderTiming.h"
|
||||
#include "compiler/translator/timing/RestrictVertexShaderTiming.h"
|
||||
#include "third_party/compiler/ArrayBoundsClamper.h"
|
||||
|
||||
bool isWebGLBasedSpec(ShShaderSpec spec)
|
||||
@ -28,43 +29,51 @@ bool isWebGLBasedSpec(ShShaderSpec spec)
|
||||
}
|
||||
|
||||
namespace {
|
||||
class TScopedPoolAllocator {
|
||||
public:
|
||||
TScopedPoolAllocator(TPoolAllocator* allocator) : mAllocator(allocator) {
|
||||
class TScopedPoolAllocator
|
||||
{
|
||||
public:
|
||||
TScopedPoolAllocator(TPoolAllocator* allocator) : mAllocator(allocator)
|
||||
{
|
||||
mAllocator->push();
|
||||
SetGlobalPoolAllocator(mAllocator);
|
||||
}
|
||||
~TScopedPoolAllocator() {
|
||||
~TScopedPoolAllocator()
|
||||
{
|
||||
SetGlobalPoolAllocator(NULL);
|
||||
mAllocator->pop();
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
TPoolAllocator* mAllocator;
|
||||
};
|
||||
|
||||
class TScopedSymbolTableLevel {
|
||||
public:
|
||||
TScopedSymbolTableLevel(TSymbolTable* table) : mTable(table) {
|
||||
class TScopedSymbolTableLevel
|
||||
{
|
||||
public:
|
||||
TScopedSymbolTableLevel(TSymbolTable* table) : mTable(table)
|
||||
{
|
||||
ASSERT(mTable->atBuiltInLevel());
|
||||
mTable->push();
|
||||
}
|
||||
~TScopedSymbolTableLevel() {
|
||||
~TScopedSymbolTableLevel()
|
||||
{
|
||||
while (!mTable->atBuiltInLevel())
|
||||
mTable->pop();
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
TSymbolTable* mTable;
|
||||
};
|
||||
} // namespace
|
||||
|
||||
TShHandleBase::TShHandleBase() {
|
||||
TShHandleBase::TShHandleBase()
|
||||
{
|
||||
allocator.push();
|
||||
SetGlobalPoolAllocator(&allocator);
|
||||
}
|
||||
|
||||
TShHandleBase::~TShHandleBase() {
|
||||
TShHandleBase::~TShHandleBase()
|
||||
{
|
||||
SetGlobalPoolAllocator(NULL);
|
||||
allocator.popAll();
|
||||
}
|
||||
@ -150,7 +159,8 @@ bool TCompiler::compile(const char* const shaderStrings[],
|
||||
bool success =
|
||||
(PaParseStrings(numStrings - firstSource, &shaderStrings[firstSource], NULL, &parseContext) == 0) &&
|
||||
(parseContext.treeRoot != NULL);
|
||||
if (success) {
|
||||
if (success)
|
||||
{
|
||||
TIntermNode* root = parseContext.treeRoot;
|
||||
success = intermediate.postProcess(root);
|
||||
|
||||
@ -189,20 +199,31 @@ bool TCompiler::compile(const char* const shaderStrings[],
|
||||
if (success && (compileOptions & SH_MAP_LONG_VARIABLE_NAMES) && hashFunction == NULL)
|
||||
mapLongVariableNames(root);
|
||||
|
||||
if (success && shaderType == SH_VERTEX_SHADER && (compileOptions & SH_INIT_GL_POSITION)) {
|
||||
InitializeGLPosition initGLPosition;
|
||||
root->traverse(&initGLPosition);
|
||||
if (success && shaderType == SH_VERTEX_SHADER && (compileOptions & SH_INIT_GL_POSITION))
|
||||
initializeGLPosition(root);
|
||||
|
||||
if (success && (compileOptions & SH_UNFOLD_SHORT_CIRCUIT))
|
||||
{
|
||||
UnfoldShortCircuitAST unfoldShortCircuit;
|
||||
root->traverse(&unfoldShortCircuit);
|
||||
unfoldShortCircuit.updateTree();
|
||||
}
|
||||
|
||||
if (success && (compileOptions & SH_VARIABLES)) {
|
||||
if (success && (compileOptions & SH_VARIABLES))
|
||||
{
|
||||
collectVariables(root);
|
||||
if (compileOptions & SH_ENFORCE_PACKING_RESTRICTIONS) {
|
||||
if (compileOptions & SH_ENFORCE_PACKING_RESTRICTIONS)
|
||||
{
|
||||
success = enforcePackingRestrictions();
|
||||
if (!success) {
|
||||
if (!success)
|
||||
{
|
||||
infoSink.info.prefix(EPrefixError);
|
||||
infoSink.info << "too many uniforms";
|
||||
}
|
||||
}
|
||||
if (success && shaderType == SH_VERTEX_SHADER &&
|
||||
(compileOptions & SH_INIT_VARYINGS_WITHOUT_STATIC_USE))
|
||||
initializeVaryingsWithoutStaticUse(root);
|
||||
}
|
||||
|
||||
if (success && (compileOptions & SH_INTERMEDIATE_TREE))
|
||||
@ -251,12 +272,14 @@ bool TCompiler::InitBuiltInSymbolTable(const ShBuiltInResources &resources)
|
||||
symbolTable.setDefaultPrecision(integer, EbpHigh);
|
||||
symbolTable.setDefaultPrecision(floatingPoint, EbpHigh);
|
||||
break;
|
||||
default: assert(false && "Language not supported");
|
||||
default:
|
||||
assert(false && "Language not supported");
|
||||
}
|
||||
// We set defaults for all the sampler types, even those that are
|
||||
// only available if an extension exists.
|
||||
for (int samplerType = EbtGuardSamplerBegin + 1;
|
||||
samplerType < EbtGuardSamplerEnd; ++samplerType) {
|
||||
samplerType < EbtGuardSamplerEnd; ++samplerType)
|
||||
{
|
||||
sampler.type = static_cast<TBasicType>(samplerType);
|
||||
symbolTable.setDefaultPrecision(sampler, EbpLow);
|
||||
}
|
||||
@ -288,24 +311,25 @@ bool TCompiler::detectCallDepth(TIntermNode* root, TInfoSink& infoSink, bool lim
|
||||
{
|
||||
DetectCallDepth detect(infoSink, limitCallStackDepth, maxCallStackDepth);
|
||||
root->traverse(&detect);
|
||||
switch (detect.detectCallDepth()) {
|
||||
case DetectCallDepth::kErrorNone:
|
||||
return true;
|
||||
case DetectCallDepth::kErrorMissingMain:
|
||||
infoSink.info.prefix(EPrefixError);
|
||||
infoSink.info << "Missing main()";
|
||||
return false;
|
||||
case DetectCallDepth::kErrorRecursion:
|
||||
infoSink.info.prefix(EPrefixError);
|
||||
infoSink.info << "Function recursion detected";
|
||||
return false;
|
||||
case DetectCallDepth::kErrorMaxDepthExceeded:
|
||||
infoSink.info.prefix(EPrefixError);
|
||||
infoSink.info << "Function call stack too deep";
|
||||
return false;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
return false;
|
||||
switch (detect.detectCallDepth())
|
||||
{
|
||||
case DetectCallDepth::kErrorNone:
|
||||
return true;
|
||||
case DetectCallDepth::kErrorMissingMain:
|
||||
infoSink.info.prefix(EPrefixError);
|
||||
infoSink.info << "Missing main()";
|
||||
return false;
|
||||
case DetectCallDepth::kErrorRecursion:
|
||||
infoSink.info.prefix(EPrefixError);
|
||||
infoSink.info << "Function recursion detected";
|
||||
return false;
|
||||
case DetectCallDepth::kErrorMaxDepthExceeded:
|
||||
infoSink.info.prefix(EPrefixError);
|
||||
infoSink.info << "Function call stack too deep";
|
||||
return false;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -315,7 +339,8 @@ void TCompiler::rewriteCSSShader(TIntermNode* root)
|
||||
root->traverse(&renamer);
|
||||
}
|
||||
|
||||
bool TCompiler::validateLimitations(TIntermNode* root) {
|
||||
bool TCompiler::validateLimitations(TIntermNode* root)
|
||||
{
|
||||
ValidateLimitations validate(shaderType, infoSink.info);
|
||||
root->traverse(&validate);
|
||||
return validate.numErrors() == 0;
|
||||
@ -323,26 +348,30 @@ bool TCompiler::validateLimitations(TIntermNode* root) {
|
||||
|
||||
bool TCompiler::enforceTimingRestrictions(TIntermNode* root, bool outputGraph)
|
||||
{
|
||||
if (shaderSpec != SH_WEBGL_SPEC) {
|
||||
if (shaderSpec != SH_WEBGL_SPEC)
|
||||
{
|
||||
infoSink.info << "Timing restrictions must be enforced under the WebGL spec.";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (shaderType == SH_FRAGMENT_SHADER) {
|
||||
if (shaderType == SH_FRAGMENT_SHADER)
|
||||
{
|
||||
TDependencyGraph graph(root);
|
||||
|
||||
// Output any errors first.
|
||||
bool success = enforceFragmentShaderTimingRestrictions(graph);
|
||||
|
||||
// Then, output the dependency graph.
|
||||
if (outputGraph) {
|
||||
if (outputGraph)
|
||||
{
|
||||
TDependencyGraphOutput output(infoSink.info);
|
||||
output.outputAllSpanningTrees(graph);
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
return enforceVertexShaderTimingRestrictions(root);
|
||||
}
|
||||
}
|
||||
@ -362,7 +391,8 @@ bool TCompiler::limitExpressionComplexity(TIntermNode* root)
|
||||
samplerSymbol->traverse(&graphTraverser);
|
||||
}
|
||||
|
||||
if (traverser.getMaxDepth() > maxExpressionComplexity) {
|
||||
if (traverser.getMaxDepth() > maxExpressionComplexity)
|
||||
{
|
||||
infoSink.info << "Expression too complex.";
|
||||
return false;
|
||||
}
|
||||
@ -395,6 +425,70 @@ bool TCompiler::enforcePackingRestrictions()
|
||||
return packer.CheckVariablesWithinPackingLimits(maxUniformVectors, uniforms);
|
||||
}
|
||||
|
||||
void TCompiler::initializeGLPosition(TIntermNode* root)
|
||||
{
|
||||
InitializeVariables::InitVariableInfoList variables;
|
||||
InitializeVariables::InitVariableInfo var(
|
||||
"gl_Position", TType(EbtFloat, EbpUndefined, EvqPosition, 4));
|
||||
variables.push_back(var);
|
||||
InitializeVariables initializer(variables);
|
||||
root->traverse(&initializer);
|
||||
}
|
||||
|
||||
void TCompiler::initializeVaryingsWithoutStaticUse(TIntermNode* root)
|
||||
{
|
||||
InitializeVariables::InitVariableInfoList variables;
|
||||
for (size_t ii = 0; ii < varyings.size(); ++ii)
|
||||
{
|
||||
const TVariableInfo& varying = varyings[ii];
|
||||
if (varying.staticUse)
|
||||
continue;
|
||||
unsigned char size = 0;
|
||||
bool matrix = false;
|
||||
switch (varying.type)
|
||||
{
|
||||
case SH_FLOAT:
|
||||
size = 1;
|
||||
break;
|
||||
case SH_FLOAT_VEC2:
|
||||
size = 2;
|
||||
break;
|
||||
case SH_FLOAT_VEC3:
|
||||
size = 3;
|
||||
break;
|
||||
case SH_FLOAT_VEC4:
|
||||
size = 4;
|
||||
break;
|
||||
case SH_FLOAT_MAT2:
|
||||
size = 2;
|
||||
matrix = true;
|
||||
break;
|
||||
case SH_FLOAT_MAT3:
|
||||
size = 3;
|
||||
matrix = true;
|
||||
break;
|
||||
case SH_FLOAT_MAT4:
|
||||
size = 4;
|
||||
matrix = true;
|
||||
break;
|
||||
default:
|
||||
ASSERT(false);
|
||||
}
|
||||
TType type(EbtFloat, EbpUndefined, EvqVaryingOut, size, matrix, varying.isArray);
|
||||
TString name = varying.name.c_str();
|
||||
if (varying.isArray)
|
||||
{
|
||||
type.setArraySize(varying.size);
|
||||
name = name.substr(0, name.find_first_of('['));
|
||||
}
|
||||
|
||||
InitializeVariables::InitVariableInfo var(name, type);
|
||||
variables.push_back(var);
|
||||
}
|
||||
InitializeVariables initializer(variables);
|
||||
root->traverse(&initializer);
|
||||
}
|
||||
|
||||
void TCompiler::mapLongVariableNames(TIntermNode* root)
|
||||
{
|
||||
ASSERT(longNameMap);
|
@ -4,8 +4,8 @@
|
||||
// found in the LICENSE file.
|
||||
//
|
||||
|
||||
#include "compiler/DetectCallDepth.h"
|
||||
#include "compiler/InfoSink.h"
|
||||
#include "compiler/translator/DetectCallDepth.h"
|
||||
#include "compiler/translator/InfoSink.h"
|
||||
|
||||
DetectCallDepth::FunctionNode::FunctionNode(const TString& fname)
|
||||
: name(fname),
|
@ -10,8 +10,8 @@
|
||||
#include "GLSLANG/ShaderLang.h"
|
||||
|
||||
#include <limits.h>
|
||||
#include "compiler/intermediate.h"
|
||||
#include "compiler/VariableInfo.h"
|
||||
#include "compiler/translator/intermediate.h"
|
||||
#include "compiler/translator/VariableInfo.h"
|
||||
|
||||
class TInfoSink;
|
||||
|
@ -8,9 +8,9 @@
|
||||
// gradients of functions with discontinuities.
|
||||
//
|
||||
|
||||
#include "compiler/DetectDiscontinuity.h"
|
||||
#include "compiler/translator/DetectDiscontinuity.h"
|
||||
|
||||
#include "compiler/ParseHelper.h"
|
||||
#include "compiler/translator/ParseContext.h"
|
||||
|
||||
namespace sh
|
||||
{
|
@ -11,7 +11,7 @@
|
||||
#ifndef COMPILER_DETECTDISCONTINUITY_H_
|
||||
#define COMPILER_DETECTDISCONTINUITY_H_
|
||||
|
||||
#include "compiler/intermediate.h"
|
||||
#include "compiler/translator/intermediate.h"
|
||||
|
||||
namespace sh
|
||||
{
|
@ -4,10 +4,10 @@
|
||||
// found in the LICENSE file.
|
||||
//
|
||||
|
||||
#include "compiler/Diagnostics.h"
|
||||
#include "compiler/translator/Diagnostics.h"
|
||||
|
||||
#include "compiler/debug.h"
|
||||
#include "compiler/InfoSink.h"
|
||||
#include "compiler/translator/compilerdebug.h"
|
||||
#include "compiler/translator/InfoSink.h"
|
||||
#include "compiler/preprocessor/SourceLocation.h"
|
||||
|
||||
TDiagnostics::TDiagnostics(TInfoSink& infoSink) :
|
||||
@ -30,11 +30,11 @@ void TDiagnostics::writeInfo(Severity severity,
|
||||
TPrefixType prefix = EPrefixNone;
|
||||
switch (severity)
|
||||
{
|
||||
case ERROR:
|
||||
case PP_ERROR:
|
||||
++mNumErrors;
|
||||
prefix = EPrefixError;
|
||||
break;
|
||||
case WARNING:
|
||||
case PP_WARNING:
|
||||
++mNumWarnings;
|
||||
prefix = EPrefixWarning;
|
||||
break;
|
@ -4,12 +4,12 @@
|
||||
// found in the LICENSE file.
|
||||
//
|
||||
|
||||
#include "compiler/DirectiveHandler.h"
|
||||
#include "compiler/translator/DirectiveHandler.h"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
#include "compiler/debug.h"
|
||||
#include "compiler/Diagnostics.h"
|
||||
#include "compiler/translator/compilerdebug.h"
|
||||
#include "compiler/translator/Diagnostics.h"
|
||||
|
||||
static TBehavior getBehavior(const std::string& str)
|
||||
{
|
||||
@ -39,7 +39,7 @@ TDirectiveHandler::~TDirectiveHandler()
|
||||
void TDirectiveHandler::handleError(const pp::SourceLocation& loc,
|
||||
const std::string& msg)
|
||||
{
|
||||
mDiagnostics.writeInfo(pp::Diagnostics::ERROR, loc, msg, "", "");
|
||||
mDiagnostics.writeInfo(pp::Diagnostics::PP_ERROR, loc, msg, "", "");
|
||||
}
|
||||
|
||||
void TDirectiveHandler::handlePragma(const pp::SourceLocation& loc,
|
||||
@ -73,12 +73,12 @@ void TDirectiveHandler::handlePragma(const pp::SourceLocation& loc,
|
||||
}
|
||||
else
|
||||
{
|
||||
mDiagnostics.report(pp::Diagnostics::UNRECOGNIZED_PRAGMA, loc, name);
|
||||
mDiagnostics.report(pp::Diagnostics::PP_UNRECOGNIZED_PRAGMA, loc, name);
|
||||
return;
|
||||
}
|
||||
|
||||
if (invalidValue)
|
||||
mDiagnostics.writeInfo(pp::Diagnostics::ERROR, loc,
|
||||
mDiagnostics.writeInfo(pp::Diagnostics::PP_ERROR, loc,
|
||||
"invalid pragma value", value,
|
||||
"'on' or 'off' expected");
|
||||
}
|
||||
@ -92,7 +92,7 @@ void TDirectiveHandler::handleExtension(const pp::SourceLocation& loc,
|
||||
TBehavior behaviorVal = getBehavior(behavior);
|
||||
if (behaviorVal == EBhUndefined)
|
||||
{
|
||||
mDiagnostics.writeInfo(pp::Diagnostics::ERROR, loc,
|
||||
mDiagnostics.writeInfo(pp::Diagnostics::PP_ERROR, loc,
|
||||
"behavior", name, "invalid");
|
||||
return;
|
||||
}
|
||||
@ -101,13 +101,13 @@ void TDirectiveHandler::handleExtension(const pp::SourceLocation& loc,
|
||||
{
|
||||
if (behaviorVal == EBhRequire)
|
||||
{
|
||||
mDiagnostics.writeInfo(pp::Diagnostics::ERROR, loc,
|
||||
mDiagnostics.writeInfo(pp::Diagnostics::PP_ERROR, loc,
|
||||
"extension", name,
|
||||
"cannot have 'require' behavior");
|
||||
}
|
||||
else if (behaviorVal == EBhEnable)
|
||||
{
|
||||
mDiagnostics.writeInfo(pp::Diagnostics::ERROR, loc,
|
||||
mDiagnostics.writeInfo(pp::Diagnostics::PP_ERROR, loc,
|
||||
"extension", name,
|
||||
"cannot have 'enable' behavior");
|
||||
}
|
||||
@ -127,15 +127,15 @@ void TDirectiveHandler::handleExtension(const pp::SourceLocation& loc,
|
||||
return;
|
||||
}
|
||||
|
||||
pp::Diagnostics::Severity severity = pp::Diagnostics::ERROR;
|
||||
pp::Diagnostics::Severity severity = pp::Diagnostics::PP_ERROR;
|
||||
switch (behaviorVal) {
|
||||
case EBhRequire:
|
||||
severity = pp::Diagnostics::ERROR;
|
||||
severity = pp::Diagnostics::PP_ERROR;
|
||||
break;
|
||||
case EBhEnable:
|
||||
case EBhWarn:
|
||||
case EBhDisable:
|
||||
severity = pp::Diagnostics::WARNING;
|
||||
severity = pp::Diagnostics::PP_WARNING;
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
@ -155,7 +155,7 @@ void TDirectiveHandler::handleVersion(const pp::SourceLocation& loc,
|
||||
std::stringstream stream;
|
||||
stream << version;
|
||||
std::string str = stream.str();
|
||||
mDiagnostics.writeInfo(pp::Diagnostics::ERROR, loc,
|
||||
mDiagnostics.writeInfo(pp::Diagnostics::PP_ERROR, loc,
|
||||
"version number", str, "not supported");
|
||||
}
|
||||
}
|
@ -7,8 +7,8 @@
|
||||
#ifndef COMPILER_DIRECTIVE_HANDLER_H_
|
||||
#define COMPILER_DIRECTIVE_HANDLER_H_
|
||||
|
||||
#include "compiler/ExtensionBehavior.h"
|
||||
#include "compiler/Pragma.h"
|
||||
#include "compiler/translator/ExtensionBehavior.h"
|
||||
#include "compiler/translator/Pragma.h"
|
||||
#include "compiler/preprocessor/DirectiveHandlerBase.h"
|
||||
|
||||
class TDiagnostics;
|
@ -4,7 +4,7 @@
|
||||
// found in the LICENSE file.
|
||||
//
|
||||
|
||||
#include "compiler/ForLoopUnroll.h"
|
||||
#include "compiler/translator/ForLoopUnroll.h"
|
||||
|
||||
namespace {
|
||||
|
@ -4,7 +4,10 @@
|
||||
// found in the LICENSE file.
|
||||
//
|
||||
|
||||
#include "compiler/intermediate.h"
|
||||
#ifndef COMPILER_FORLOOPUNROLL_H_
|
||||
#define COMPILER_FORLOOPUNROLL_H_
|
||||
|
||||
#include "compiler/translator/intermediate.h"
|
||||
|
||||
struct TLoopIndexInfo {
|
||||
int id;
|
||||
@ -46,3 +49,4 @@ private:
|
||||
TVector<TLoopIndexInfo> mLoopIndexStack;
|
||||
};
|
||||
|
||||
#endif
|
@ -9,7 +9,7 @@
|
||||
|
||||
#include <map>
|
||||
|
||||
#include "compiler/intermediate.h"
|
||||
#include "compiler/translator/intermediate.h"
|
||||
#include "GLSLANG/ShaderLang.h"
|
||||
|
||||
#define HASHED_NAME_PREFIX "webgl_"
|
@ -4,7 +4,7 @@
|
||||
// found in the LICENSE file.
|
||||
//
|
||||
|
||||
#include "compiler/InfoSink.h"
|
||||
#include "compiler/translator/InfoSink.h"
|
||||
|
||||
void TInfoSinkBase::prefix(TPrefixType p) {
|
||||
switch(p) {
|
@ -8,7 +8,8 @@
|
||||
#define _INFOSINK_INCLUDED_
|
||||
|
||||
#include <math.h>
|
||||
#include "compiler/Common.h"
|
||||
#include <stdlib.h>
|
||||
#include "compiler/translator/Common.h"
|
||||
|
||||
// Returns the fractional part of the given floating-point number.
|
||||
inline float fractionalPart(float f) {
|
@ -10,9 +10,9 @@
|
||||
// built-in functions and operators.
|
||||
//
|
||||
|
||||
#include "compiler/Initialize.h"
|
||||
#include "compiler/translator/Initialize.h"
|
||||
|
||||
#include "compiler/intermediate.h"
|
||||
#include "compiler/translator/intermediate.h"
|
||||
|
||||
void InsertBuiltInFunctions(ShShaderType type, ShShaderSpec spec, const ShBuiltInResources &resources, TSymbolTable &symbolTable)
|
||||
{
|
||||
@ -363,7 +363,7 @@ void InsertBuiltInFunctions(ShShaderType type, ShShaderSpec spec, const ShBuiltI
|
||||
symbolTable.insertBuiltIn(float2, "dFdx", float2);
|
||||
symbolTable.insertBuiltIn(float3, "dFdx", float3);
|
||||
symbolTable.insertBuiltIn(float4, "dFdx", float4);
|
||||
|
||||
|
||||
symbolTable.insertBuiltIn(float1, "dFdy", float1);
|
||||
symbolTable.insertBuiltIn(float2, "dFdy", float2);
|
||||
symbolTable.insertBuiltIn(float3, "dFdy", float3);
|
@ -7,9 +7,9 @@
|
||||
#ifndef _INITIALIZE_INCLUDED_
|
||||
#define _INITIALIZE_INCLUDED_
|
||||
|
||||
#include "compiler/Common.h"
|
||||
#include "compiler/ShHandle.h"
|
||||
#include "compiler/SymbolTable.h"
|
||||
#include "compiler/translator/Common.h"
|
||||
#include "compiler/translator/ShHandle.h"
|
||||
#include "compiler/translator/SymbolTable.h"
|
||||
|
||||
void InsertBuiltInFunctions(ShShaderType type, ShShaderSpec spec, const ShBuiltInResources &resources, TSymbolTable &table);
|
||||
|
@ -4,11 +4,11 @@
|
||||
// found in the LICENSE file.
|
||||
//
|
||||
|
||||
#include "compiler/InitializeDll.h"
|
||||
#include "compiler/translator/InitializeDll.h"
|
||||
|
||||
#include "compiler/InitializeGlobals.h"
|
||||
#include "compiler/InitializeParseContext.h"
|
||||
#include "compiler/osinclude.h"
|
||||
#include "compiler/translator/InitializeGlobals.h"
|
||||
#include "compiler/translator/InitializeParseContext.h"
|
||||
#include "compiler/translator/osinclude.h"
|
||||
|
||||
bool InitProcess()
|
||||
{
|
@ -4,9 +4,9 @@
|
||||
// found in the LICENSE file.
|
||||
//
|
||||
|
||||
#include "compiler/InitializeParseContext.h"
|
||||
#include "compiler/translator/InitializeParseContext.h"
|
||||
|
||||
#include "compiler/osinclude.h"
|
||||
#include "compiler/translator/osinclude.h"
|
||||
|
||||
OS_TLSIndex GlobalParseContextIndex = OS_INVALID_TLS_INDEX;
|
||||
|
116
src/3rdparty/angle/src/compiler/translator/InitializeVariables.cpp
vendored
Normal file
116
src/3rdparty/angle/src/compiler/translator/InitializeVariables.cpp
vendored
Normal file
@ -0,0 +1,116 @@
|
||||
//
|
||||
// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
//
|
||||
|
||||
#include "compiler/translator/InitializeVariables.h"
|
||||
#include "compiler/translator/compilerdebug.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
TIntermConstantUnion* constructFloatConstUnionNode(const TType& type)
|
||||
{
|
||||
TType myType = type;
|
||||
unsigned char size = myType.getNominalSize();
|
||||
if (myType.isMatrix())
|
||||
size *= size;
|
||||
ConstantUnion *u = new ConstantUnion[size];
|
||||
for (int ii = 0; ii < size; ++ii)
|
||||
u[ii].setFConst(0.0f);
|
||||
|
||||
myType.clearArrayness();
|
||||
myType.setQualifier(EvqConst);
|
||||
TIntermConstantUnion *node = new TIntermConstantUnion(u, myType);
|
||||
return node;
|
||||
}
|
||||
|
||||
TIntermConstantUnion* constructIndexNode(int index)
|
||||
{
|
||||
ConstantUnion *u = new ConstantUnion[1];
|
||||
u[0].setIConst(index);
|
||||
|
||||
TType type(EbtInt, EbpUndefined, EvqConst, 1);
|
||||
TIntermConstantUnion *node = new TIntermConstantUnion(u, type);
|
||||
return node;
|
||||
}
|
||||
|
||||
} // namespace anonymous
|
||||
|
||||
bool InitializeVariables::visitAggregate(Visit visit, TIntermAggregate* node)
|
||||
{
|
||||
bool visitChildren = !mCodeInserted;
|
||||
switch (node->getOp())
|
||||
{
|
||||
case EOpSequence:
|
||||
break;
|
||||
case EOpFunction:
|
||||
{
|
||||
// Function definition.
|
||||
ASSERT(visit == PreVisit);
|
||||
if (node->getName() == "main(")
|
||||
{
|
||||
TIntermSequence &sequence = node->getSequence();
|
||||
ASSERT((sequence.size() == 1) || (sequence.size() == 2));
|
||||
TIntermAggregate *body = NULL;
|
||||
if (sequence.size() == 1)
|
||||
{
|
||||
body = new TIntermAggregate(EOpSequence);
|
||||
sequence.push_back(body);
|
||||
}
|
||||
else
|
||||
{
|
||||
body = sequence[1]->getAsAggregate();
|
||||
}
|
||||
ASSERT(body);
|
||||
insertInitCode(body->getSequence());
|
||||
mCodeInserted = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
visitChildren = false;
|
||||
break;
|
||||
}
|
||||
return visitChildren;
|
||||
}
|
||||
|
||||
void InitializeVariables::insertInitCode(TIntermSequence& sequence)
|
||||
{
|
||||
for (size_t ii = 0; ii < mVariables.size(); ++ii)
|
||||
{
|
||||
const InitVariableInfo& varInfo = mVariables[ii];
|
||||
|
||||
if (varInfo.type.isArray())
|
||||
{
|
||||
for (int index = varInfo.type.getArraySize() - 1; index >= 0; --index)
|
||||
{
|
||||
TIntermBinary *assign = new TIntermBinary(EOpAssign);
|
||||
sequence.insert(sequence.begin(), assign);
|
||||
|
||||
TIntermBinary *indexDirect = new TIntermBinary(EOpIndexDirect);
|
||||
TIntermSymbol *symbol = new TIntermSymbol(0, varInfo.name, varInfo.type);
|
||||
indexDirect->setLeft(symbol);
|
||||
TIntermConstantUnion *indexNode = constructIndexNode(index);
|
||||
indexDirect->setRight(indexNode);
|
||||
|
||||
assign->setLeft(indexDirect);
|
||||
|
||||
TIntermConstantUnion *zeroConst = constructFloatConstUnionNode(varInfo.type);
|
||||
assign->setRight(zeroConst);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
TIntermBinary *assign = new TIntermBinary(EOpAssign);
|
||||
sequence.insert(sequence.begin(), assign);
|
||||
TIntermSymbol *symbol = new TIntermSymbol(0, varInfo.name, varInfo.type);
|
||||
assign->setLeft(symbol);
|
||||
TIntermConstantUnion *zeroConst = constructFloatConstUnionNode(varInfo.type);
|
||||
assign->setRight(zeroConst);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
50
src/3rdparty/angle/src/compiler/translator/InitializeVariables.h
vendored
Normal file
50
src/3rdparty/angle/src/compiler/translator/InitializeVariables.h
vendored
Normal file
@ -0,0 +1,50 @@
|
||||
//
|
||||
// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
//
|
||||
|
||||
#ifndef COMPILER_INITIALIZE_VARIABLES_H_
|
||||
#define COMPILER_INITIALIZE_VARIABLES_H_
|
||||
|
||||
#include "compiler/translator/intermediate.h"
|
||||
|
||||
class InitializeVariables : public TIntermTraverser
|
||||
{
|
||||
public:
|
||||
struct InitVariableInfo
|
||||
{
|
||||
TString name;
|
||||
TType type;
|
||||
|
||||
InitVariableInfo(const TString& _name, const TType& _type)
|
||||
: name(_name),
|
||||
type(_type)
|
||||
{
|
||||
}
|
||||
};
|
||||
typedef TVector<InitVariableInfo> InitVariableInfoList;
|
||||
|
||||
InitializeVariables(const InitVariableInfoList& vars)
|
||||
: mCodeInserted(false),
|
||||
mVariables(vars)
|
||||
{
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual bool visitBinary(Visit visit, TIntermBinary* node) { return false; }
|
||||
virtual bool visitUnary(Visit visit, TIntermUnary* node) { return false; }
|
||||
virtual bool visitSelection(Visit visit, TIntermSelection* node) { return false; }
|
||||
virtual bool visitLoop(Visit visit, TIntermLoop* node) { return false; }
|
||||
virtual bool visitBranch(Visit visit, TIntermBranch* node) { return false; }
|
||||
|
||||
virtual bool visitAggregate(Visit visit, TIntermAggregate* node);
|
||||
|
||||
private:
|
||||
void insertInitCode(TIntermSequence& sequence);
|
||||
|
||||
InitVariableInfoList mVariables;
|
||||
bool mCodeInserted;
|
||||
};
|
||||
|
||||
#endif // COMPILER_INITIALIZE_VARIABLES_H_
|
259
src/3rdparty/angle/src/compiler/translator/IntermTraverse.cpp
vendored
Normal file
259
src/3rdparty/angle/src/compiler/translator/IntermTraverse.cpp
vendored
Normal file
@ -0,0 +1,259 @@
|
||||
//
|
||||
// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
//
|
||||
|
||||
#include "compiler/translator/intermediate.h"
|
||||
|
||||
//
|
||||
// Traverse the intermediate representation tree, and
|
||||
// call a node type specific function for each node.
|
||||
// Done recursively through the member function Traverse().
|
||||
// Node types can be skipped if their function to call is 0,
|
||||
// but their subtree will still be traversed.
|
||||
// Nodes with children can have their whole subtree skipped
|
||||
// if preVisit is turned on and the type specific function
|
||||
// returns false.
|
||||
//
|
||||
// preVisit, postVisit, and rightToLeft control what order
|
||||
// nodes are visited in.
|
||||
//
|
||||
|
||||
//
|
||||
// Traversal functions for terminals are straighforward....
|
||||
//
|
||||
void TIntermSymbol::traverse(TIntermTraverser *it)
|
||||
{
|
||||
it->visitSymbol(this);
|
||||
}
|
||||
|
||||
void TIntermConstantUnion::traverse(TIntermTraverser *it)
|
||||
{
|
||||
it->visitConstantUnion(this);
|
||||
}
|
||||
|
||||
//
|
||||
// Traverse a binary node.
|
||||
//
|
||||
void TIntermBinary::traverse(TIntermTraverser *it)
|
||||
{
|
||||
bool visit = true;
|
||||
|
||||
//
|
||||
// visit the node before children if pre-visiting.
|
||||
//
|
||||
if (it->preVisit)
|
||||
visit = it->visitBinary(PreVisit, this);
|
||||
|
||||
//
|
||||
// Visit the children, in the right order.
|
||||
//
|
||||
if (visit)
|
||||
{
|
||||
it->incrementDepth(this);
|
||||
|
||||
if (it->rightToLeft)
|
||||
{
|
||||
if (right)
|
||||
right->traverse(it);
|
||||
|
||||
if (it->inVisit)
|
||||
visit = it->visitBinary(InVisit, this);
|
||||
|
||||
if (visit && left)
|
||||
left->traverse(it);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (left)
|
||||
left->traverse(it);
|
||||
|
||||
if (it->inVisit)
|
||||
visit = it->visitBinary(InVisit, this);
|
||||
|
||||
if (visit && right)
|
||||
right->traverse(it);
|
||||
}
|
||||
|
||||
it->decrementDepth();
|
||||
}
|
||||
|
||||
//
|
||||
// Visit the node after the children, if requested and the traversal
|
||||
// hasn't been cancelled yet.
|
||||
//
|
||||
if (visit && it->postVisit)
|
||||
it->visitBinary(PostVisit, this);
|
||||
}
|
||||
|
||||
//
|
||||
// Traverse a unary node. Same comments in binary node apply here.
|
||||
//
|
||||
void TIntermUnary::traverse(TIntermTraverser *it)
|
||||
{
|
||||
bool visit = true;
|
||||
|
||||
if (it->preVisit)
|
||||
visit = it->visitUnary(PreVisit, this);
|
||||
|
||||
if (visit) {
|
||||
it->incrementDepth(this);
|
||||
operand->traverse(it);
|
||||
it->decrementDepth();
|
||||
}
|
||||
|
||||
if (visit && it->postVisit)
|
||||
it->visitUnary(PostVisit, this);
|
||||
}
|
||||
|
||||
//
|
||||
// Traverse an aggregate node. Same comments in binary node apply here.
|
||||
//
|
||||
void TIntermAggregate::traverse(TIntermTraverser *it)
|
||||
{
|
||||
bool visit = true;
|
||||
|
||||
if (it->preVisit)
|
||||
visit = it->visitAggregate(PreVisit, this);
|
||||
|
||||
if (visit)
|
||||
{
|
||||
it->incrementDepth(this);
|
||||
|
||||
if (it->rightToLeft)
|
||||
{
|
||||
for (TIntermSequence::reverse_iterator sit = sequence.rbegin(); sit != sequence.rend(); sit++)
|
||||
{
|
||||
(*sit)->traverse(it);
|
||||
|
||||
if (visit && it->inVisit)
|
||||
{
|
||||
if (*sit != sequence.front())
|
||||
visit = it->visitAggregate(InVisit, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (TIntermSequence::iterator sit = sequence.begin(); sit != sequence.end(); sit++)
|
||||
{
|
||||
(*sit)->traverse(it);
|
||||
|
||||
if (visit && it->inVisit)
|
||||
{
|
||||
if (*sit != sequence.back())
|
||||
visit = it->visitAggregate(InVisit, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
it->decrementDepth();
|
||||
}
|
||||
|
||||
if (visit && it->postVisit)
|
||||
it->visitAggregate(PostVisit, this);
|
||||
}
|
||||
|
||||
//
|
||||
// Traverse a selection node. Same comments in binary node apply here.
|
||||
//
|
||||
void TIntermSelection::traverse(TIntermTraverser *it)
|
||||
{
|
||||
bool visit = true;
|
||||
|
||||
if (it->preVisit)
|
||||
visit = it->visitSelection(PreVisit, this);
|
||||
|
||||
if (visit) {
|
||||
it->incrementDepth(this);
|
||||
if (it->rightToLeft) {
|
||||
if (falseBlock)
|
||||
falseBlock->traverse(it);
|
||||
if (trueBlock)
|
||||
trueBlock->traverse(it);
|
||||
condition->traverse(it);
|
||||
} else {
|
||||
condition->traverse(it);
|
||||
if (trueBlock)
|
||||
trueBlock->traverse(it);
|
||||
if (falseBlock)
|
||||
falseBlock->traverse(it);
|
||||
}
|
||||
it->decrementDepth();
|
||||
}
|
||||
|
||||
if (visit && it->postVisit)
|
||||
it->visitSelection(PostVisit, this);
|
||||
}
|
||||
|
||||
//
|
||||
// Traverse a loop node. Same comments in binary node apply here.
|
||||
//
|
||||
void TIntermLoop::traverse(TIntermTraverser *it)
|
||||
{
|
||||
bool visit = true;
|
||||
|
||||
if (it->preVisit)
|
||||
visit = it->visitLoop(PreVisit, this);
|
||||
|
||||
if (visit)
|
||||
{
|
||||
it->incrementDepth(this);
|
||||
|
||||
if (it->rightToLeft)
|
||||
{
|
||||
if (expr)
|
||||
expr->traverse(it);
|
||||
|
||||
if (body)
|
||||
body->traverse(it);
|
||||
|
||||
if (cond)
|
||||
cond->traverse(it);
|
||||
|
||||
if (init)
|
||||
init->traverse(it);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (init)
|
||||
init->traverse(it);
|
||||
|
||||
if (cond)
|
||||
cond->traverse(it);
|
||||
|
||||
if (body)
|
||||
body->traverse(it);
|
||||
|
||||
if (expr)
|
||||
expr->traverse(it);
|
||||
}
|
||||
|
||||
it->decrementDepth();
|
||||
}
|
||||
|
||||
if (visit && it->postVisit)
|
||||
it->visitLoop(PostVisit, this);
|
||||
}
|
||||
|
||||
//
|
||||
// Traverse a branch node. Same comments in binary node apply here.
|
||||
//
|
||||
void TIntermBranch::traverse(TIntermTraverser *it)
|
||||
{
|
||||
bool visit = true;
|
||||
|
||||
if (it->preVisit)
|
||||
visit = it->visitBranch(PreVisit, this);
|
||||
|
||||
if (visit && expression) {
|
||||
it->incrementDepth(this);
|
||||
expression->traverse(it);
|
||||
it->decrementDepth();
|
||||
}
|
||||
|
||||
if (visit && it->postVisit)
|
||||
it->visitBranch(PostVisit, this);
|
||||
}
|
||||
|
@ -12,18 +12,20 @@
|
||||
#include <limits.h>
|
||||
#include <algorithm>
|
||||
|
||||
#include "compiler/HashNames.h"
|
||||
#include "compiler/localintermediate.h"
|
||||
#include "compiler/QualifierAlive.h"
|
||||
#include "compiler/RemoveTree.h"
|
||||
#include "compiler/translator/HashNames.h"
|
||||
#include "compiler/translator/localintermediate.h"
|
||||
#include "compiler/translator/QualifierAlive.h"
|
||||
#include "compiler/translator/RemoveTree.h"
|
||||
|
||||
bool CompareStructure(const TType& leftNodeType, ConstantUnion* rightUnionArray, ConstantUnion* leftUnionArray);
|
||||
|
||||
static TPrecision GetHigherPrecision( TPrecision left, TPrecision right ){
|
||||
static TPrecision GetHigherPrecision(TPrecision left, TPrecision right)
|
||||
{
|
||||
return left > right ? left : right;
|
||||
}
|
||||
|
||||
const char* getOperatorString(TOperator op) {
|
||||
const char* getOperatorString(TOperator op)
|
||||
{
|
||||
switch (op) {
|
||||
case EOpInitialize: return "=";
|
||||
case EOpAssign: return "=";
|
||||
@ -742,12 +744,67 @@ void TIntermediate::remove(TIntermNode* root)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
#define REPLACE_IF_IS(node, type, original, replacement) \
|
||||
if (node == original) { \
|
||||
node = static_cast<type *>(replacement); \
|
||||
return true; \
|
||||
}
|
||||
|
||||
bool TIntermLoop::replaceChildNode(
|
||||
TIntermNode *original, TIntermNode *replacement)
|
||||
{
|
||||
REPLACE_IF_IS(init, TIntermNode, original, replacement);
|
||||
REPLACE_IF_IS(cond, TIntermTyped, original, replacement);
|
||||
REPLACE_IF_IS(expr, TIntermTyped, original, replacement);
|
||||
REPLACE_IF_IS(body, TIntermNode, original, replacement);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool TIntermBranch::replaceChildNode(
|
||||
TIntermNode *original, TIntermNode *replacement)
|
||||
{
|
||||
REPLACE_IF_IS(expression, TIntermTyped, original, replacement);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool TIntermBinary::replaceChildNode(
|
||||
TIntermNode *original, TIntermNode *replacement)
|
||||
{
|
||||
REPLACE_IF_IS(left, TIntermTyped, original, replacement);
|
||||
REPLACE_IF_IS(right, TIntermTyped, original, replacement);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool TIntermUnary::replaceChildNode(
|
||||
TIntermNode *original, TIntermNode *replacement)
|
||||
{
|
||||
REPLACE_IF_IS(operand, TIntermTyped, original, replacement);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool TIntermAggregate::replaceChildNode(
|
||||
TIntermNode *original, TIntermNode *replacement)
|
||||
{
|
||||
for (size_t ii = 0; ii < sequence.size(); ++ii)
|
||||
{
|
||||
REPLACE_IF_IS(sequence[ii], TIntermNode, original, replacement);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool TIntermSelection::replaceChildNode(
|
||||
TIntermNode *original, TIntermNode *replacement)
|
||||
{
|
||||
REPLACE_IF_IS(condition, TIntermTyped, original, replacement);
|
||||
REPLACE_IF_IS(trueBlock, TIntermNode, original, replacement);
|
||||
REPLACE_IF_IS(falseBlock, TIntermNode, original, replacement);
|
||||
return false;
|
||||
}
|
||||
|
||||
//
|
||||
// Say whether or not an operation node changes the value of a variable.
|
||||
//
|
||||
// Returns true if state is modified.
|
||||
//
|
||||
bool TIntermOperator::modifiesState() const
|
||||
bool TIntermOperator::isAssignment() const
|
||||
{
|
||||
switch (op) {
|
||||
case EOpPostIncrement:
|
||||
@ -796,6 +853,7 @@ bool TIntermOperator::isConstructor() const
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Make sure the type of a unary operator is appropriate for its
|
||||
// combination of operation and operand type.
|
@ -4,7 +4,7 @@
|
||||
// found in the LICENSE file.
|
||||
//
|
||||
|
||||
#include "compiler/MapLongVariableNames.h"
|
||||
#include "compiler/translator/MapLongVariableNames.h"
|
||||
|
||||
namespace {
|
||||
|
||||
@ -102,13 +102,6 @@ void MapLongVariableNames::visitSymbol(TIntermSymbol* symbol)
|
||||
}
|
||||
}
|
||||
|
||||
bool MapLongVariableNames::visitLoop(Visit, TIntermLoop* node)
|
||||
{
|
||||
if (node->getInit())
|
||||
node->getInit()->traverse(this);
|
||||
return true;
|
||||
}
|
||||
|
||||
TString MapLongVariableNames::mapGlobalLongName(const TString& name)
|
||||
{
|
||||
ASSERT(mGlobalMap);
|
@ -9,8 +9,8 @@
|
||||
|
||||
#include "GLSLANG/ShaderLang.h"
|
||||
|
||||
#include "compiler/intermediate.h"
|
||||
#include "compiler/VariableInfo.h"
|
||||
#include "compiler/translator/intermediate.h"
|
||||
#include "compiler/translator/VariableInfo.h"
|
||||
|
||||
// This size does not include '\0' in the end.
|
||||
#define MAX_SHORTENED_IDENTIFIER_SIZE 32
|
||||
@ -48,7 +48,6 @@ public:
|
||||
MapLongVariableNames(LongNameMap* globalMap);
|
||||
|
||||
virtual void visitSymbol(TIntermSymbol*);
|
||||
virtual bool visitLoop(Visit, TIntermLoop*);
|
||||
|
||||
private:
|
||||
TString mapGlobalLongName(const TString& name);
|
80
src/3rdparty/angle/src/compiler/translator/NodeSearch.h
vendored
Normal file
80
src/3rdparty/angle/src/compiler/translator/NodeSearch.h
vendored
Normal file
@ -0,0 +1,80 @@
|
||||
//
|
||||
// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
//
|
||||
// NodeSearch.h: Utilities for searching translator node graphs
|
||||
//
|
||||
|
||||
#ifndef TRANSLATOR_NODESEARCH_H_
|
||||
#define TRANSLATOR_NODESEARCH_H_
|
||||
|
||||
#include "compiler/translator/intermediate.h"
|
||||
|
||||
namespace sh
|
||||
{
|
||||
|
||||
template <class Parent>
|
||||
class NodeSearchTraverser : public TIntermTraverser
|
||||
{
|
||||
public:
|
||||
NodeSearchTraverser()
|
||||
: mFound(false)
|
||||
{}
|
||||
|
||||
bool found() const { return mFound; }
|
||||
|
||||
static bool search(TIntermNode *node)
|
||||
{
|
||||
Parent searchTraverser;
|
||||
node->traverse(&searchTraverser);
|
||||
return searchTraverser.found();
|
||||
}
|
||||
|
||||
protected:
|
||||
bool mFound;
|
||||
};
|
||||
|
||||
class FindDiscard : public NodeSearchTraverser<FindDiscard>
|
||||
{
|
||||
public:
|
||||
virtual bool visitBranch(Visit visit, TIntermBranch *node)
|
||||
{
|
||||
switch (node->getFlowOp())
|
||||
{
|
||||
case EOpKill:
|
||||
mFound = true;
|
||||
break;
|
||||
|
||||
default: break;
|
||||
}
|
||||
|
||||
return !mFound;
|
||||
}
|
||||
};
|
||||
|
||||
class FindSideEffectRewriting : public NodeSearchTraverser<FindSideEffectRewriting>
|
||||
{
|
||||
public:
|
||||
virtual bool visitBinary(Visit visit, TIntermBinary *node)
|
||||
{
|
||||
switch (node->getOp())
|
||||
{
|
||||
case EOpLogicalOr:
|
||||
case EOpLogicalAnd:
|
||||
if (node->getRight()->hasSideEffects())
|
||||
{
|
||||
mFound = true;
|
||||
}
|
||||
break;
|
||||
|
||||
default: break;
|
||||
}
|
||||
|
||||
return !mFound;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // TRANSLATOR_NODESEARCH_H_
|
@ -4,7 +4,7 @@
|
||||
// found in the LICENSE file.
|
||||
//
|
||||
|
||||
#include "compiler/OutputESSL.h"
|
||||
#include "compiler/translator/OutputESSL.h"
|
||||
|
||||
TOutputESSL::TOutputESSL(TInfoSinkBase& objSink,
|
||||
ShArrayIndexClampingStrategy clampingStrategy,
|
@ -7,7 +7,7 @@
|
||||
#ifndef CROSSCOMPILERGLSL_OUTPUTESSL_H_
|
||||
#define CROSSCOMPILERGLSL_OUTPUTESSL_H_
|
||||
|
||||
#include "compiler/OutputGLSLBase.h"
|
||||
#include "compiler/translator/OutputGLSLBase.h"
|
||||
|
||||
class TOutputESSL : public TOutputGLSLBase
|
||||
{
|
@ -4,7 +4,7 @@
|
||||
// found in the LICENSE file.
|
||||
//
|
||||
|
||||
#include "compiler/OutputGLSL.h"
|
||||
#include "compiler/translator/OutputGLSL.h"
|
||||
|
||||
TOutputGLSL::TOutputGLSL(TInfoSinkBase& objSink,
|
||||
ShArrayIndexClampingStrategy clampingStrategy,
|
@ -7,7 +7,7 @@
|
||||
#ifndef CROSSCOMPILERGLSL_OUTPUTGLSL_H_
|
||||
#define CROSSCOMPILERGLSL_OUTPUTGLSL_H_
|
||||
|
||||
#include "compiler/OutputGLSLBase.h"
|
||||
#include "compiler/translator/OutputGLSLBase.h"
|
||||
|
||||
class TOutputGLSL : public TOutputGLSLBase
|
||||
{
|
@ -4,8 +4,8 @@
|
||||
// found in the LICENSE file.
|
||||
//
|
||||
|
||||
#include "compiler/OutputGLSLBase.h"
|
||||
#include "compiler/debug.h"
|
||||
#include "compiler/translator/OutputGLSLBase.h"
|
||||
#include "compiler/translator/compilerdebug.h"
|
||||
|
||||
#include <cfloat>
|
||||
|
||||
@ -435,7 +435,7 @@ bool TOutputGLSLBase::visitSelection(Visit visit, TIntermSelection* node)
|
||||
node->getCondition()->traverse(this);
|
||||
out << ")\n";
|
||||
|
||||
incrementDepth();
|
||||
incrementDepth(node);
|
||||
visitCodeBlock(node->getTrueBlock());
|
||||
|
||||
if (node->getFalseBlock())
|
||||
@ -460,7 +460,7 @@ bool TOutputGLSLBase::visitAggregate(Visit visit, TIntermAggregate* node)
|
||||
// Scope the sequences except when at the global scope.
|
||||
if (depth > 0) out << "{\n";
|
||||
|
||||
incrementDepth();
|
||||
incrementDepth(node);
|
||||
const TIntermSequence& sequence = node->getSequence();
|
||||
for (TIntermSequence::const_iterator iter = sequence.begin();
|
||||
iter != sequence.end(); ++iter)
|
||||
@ -498,7 +498,7 @@ bool TOutputGLSLBase::visitAggregate(Visit visit, TIntermAggregate* node)
|
||||
writeVariableType(node->getType());
|
||||
out << " " << hashFunctionName(node->getName());
|
||||
|
||||
incrementDepth();
|
||||
incrementDepth(node);
|
||||
// Function definition node contains one or two children nodes
|
||||
// representing function parameters and function body. The latter
|
||||
// is not present in case of empty function bodies.
|
||||
@ -638,7 +638,7 @@ bool TOutputGLSLBase::visitLoop(Visit visit, TIntermLoop* node)
|
||||
{
|
||||
TInfoSinkBase& out = objSink();
|
||||
|
||||
incrementDepth();
|
||||
incrementDepth(node);
|
||||
// Loop header.
|
||||
TLoopType loopType = node->getType();
|
||||
if (loopType == ELoopFor) // for loop
|
@ -9,9 +9,9 @@
|
||||
|
||||
#include <set>
|
||||
|
||||
#include "compiler/ForLoopUnroll.h"
|
||||
#include "compiler/intermediate.h"
|
||||
#include "compiler/ParseHelper.h"
|
||||
#include "compiler/translator/ForLoopUnroll.h"
|
||||
#include "compiler/translator/intermediate.h"
|
||||
#include "compiler/translator/ParseContext.h"
|
||||
|
||||
class TOutputGLSLBase : public TIntermTraverser
|
||||
{
|
@ -4,14 +4,16 @@
|
||||
// found in the LICENSE file.
|
||||
//
|
||||
|
||||
#include "compiler/OutputHLSL.h"
|
||||
#include "compiler/translator/OutputHLSL.h"
|
||||
|
||||
#include "common/angleutils.h"
|
||||
#include "compiler/debug.h"
|
||||
#include "compiler/DetectDiscontinuity.h"
|
||||
#include "compiler/InfoSink.h"
|
||||
#include "compiler/SearchSymbol.h"
|
||||
#include "compiler/UnfoldShortCircuit.h"
|
||||
#include "compiler/translator/compilerdebug.h"
|
||||
#include "compiler/translator/DetectDiscontinuity.h"
|
||||
#include "compiler/translator/InfoSink.h"
|
||||
#include "compiler/translator/SearchSymbol.h"
|
||||
#include "compiler/translator/UnfoldShortCircuit.h"
|
||||
#include "compiler/translator/NodeSearch.h"
|
||||
#include "compiler/translator/RewriteElseBlocks.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cfloat>
|
||||
@ -19,13 +21,6 @@
|
||||
|
||||
namespace sh
|
||||
{
|
||||
// Integer to TString conversion
|
||||
TString str(int i)
|
||||
{
|
||||
char buffer[20];
|
||||
snprintf(buffer, sizeof(buffer), "%d", i);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
OutputHLSL::OutputHLSL(TParseContext &context, const ShBuiltInResources& resources, ShShaderOutput outputType)
|
||||
: TIntermTraverser(true, true, true), mContext(context), mOutputType(outputType)
|
||||
@ -72,6 +67,7 @@ OutputHLSL::OutputHLSL(TParseContext &context, const ShBuiltInResources& resourc
|
||||
mUsesAtan2_2 = false;
|
||||
mUsesAtan2_3 = false;
|
||||
mUsesAtan2_4 = false;
|
||||
mUsesDiscardRewriting = false;
|
||||
|
||||
mNumRenderTargets = resources.EXT_draw_buffers ? resources.MaxDrawBuffers : 1;
|
||||
|
||||
@ -113,6 +109,13 @@ void OutputHLSL::output()
|
||||
{
|
||||
mContainsLoopDiscontinuity = mContext.shaderType == SH_FRAGMENT_SHADER && containsLoopDiscontinuity(mContext.treeRoot);
|
||||
|
||||
// Work around D3D9 bug that would manifest in vertex shaders with selection blocks which
|
||||
// use a vertex attribute as a condition, and some related computation in the else block.
|
||||
if (mOutputType == SH_HLSL9_OUTPUT && mContext.shaderType == SH_VERTEX_SHADER)
|
||||
{
|
||||
RewriteElseBlocks(mContext.treeRoot);
|
||||
}
|
||||
|
||||
mContext.treeRoot->traverse(this); // Output the body first to determine what has to go in the header
|
||||
header();
|
||||
|
||||
@ -196,6 +199,11 @@ void OutputHLSL::header()
|
||||
attributes += "static " + typeString(type) + " " + decorate(name) + arrayString(type) + " = " + initializer(type) + ";\n";
|
||||
}
|
||||
|
||||
if (mUsesDiscardRewriting)
|
||||
{
|
||||
out << "#define ANGLE_USES_DISCARD_REWRITING" << "\n";
|
||||
}
|
||||
|
||||
if (shaderType == SH_FRAGMENT_SHADER)
|
||||
{
|
||||
TExtensionBehavior::const_iterator iter = mContext.extensionBehavior().find("GL_EXT_draw_buffers");
|
||||
@ -761,12 +769,12 @@ void OutputHLSL::header()
|
||||
}
|
||||
else if (mOutputType == SH_HLSL11_OUTPUT)
|
||||
{
|
||||
out << "float4 gl_texture2DProj(Texture2D t, SamplerState s, float3 uvw, float lod)\n"
|
||||
out << "float4 gl_texture2DProjLod(Texture2D t, SamplerState s, float3 uvw, float lod)\n"
|
||||
"{\n"
|
||||
" return t.SampleLevel(s, float2(uvw.x / uvw.z, uvw.y / uvw.z), lod);\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"float4 gl_texture2DProj(Texture2D t, SamplerState s, float4 uvw)\n"
|
||||
"float4 gl_texture2DProjLod(Texture2D t, SamplerState s, float4 uvw, float lod)\n"
|
||||
"{\n"
|
||||
" return t.SampleLevel(s, float2(uvw.x / uvw.w, uvw.y / uvw.w), lod);\n"
|
||||
"}\n"
|
||||
@ -1092,6 +1100,10 @@ void OutputHLSL::visitSymbol(TIntermSymbol *node)
|
||||
mReferencedVaryings[name] = node;
|
||||
out << decorate(name);
|
||||
}
|
||||
else if (qualifier == EvqInternal)
|
||||
{
|
||||
out << name;
|
||||
}
|
||||
else
|
||||
{
|
||||
out << decorate(name);
|
||||
@ -1299,15 +1311,31 @@ bool OutputHLSL::visitBinary(Visit visit, TIntermBinary *node)
|
||||
case EOpMatrixTimesVector: outputTriplet(visit, "mul(transpose(", "), ", ")"); break;
|
||||
case EOpMatrixTimesMatrix: outputTriplet(visit, "transpose(mul(transpose(", "), transpose(", ")))"); break;
|
||||
case EOpLogicalOr:
|
||||
out << "s" << mUnfoldShortCircuit->getNextTemporaryIndex();
|
||||
return false;
|
||||
if (node->getRight()->hasSideEffects())
|
||||
{
|
||||
out << "s" << mUnfoldShortCircuit->getNextTemporaryIndex();
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
outputTriplet(visit, "(", " || ", ")");
|
||||
return true;
|
||||
}
|
||||
case EOpLogicalXor:
|
||||
mUsesXor = true;
|
||||
outputTriplet(visit, "xor(", ", ", ")");
|
||||
break;
|
||||
case EOpLogicalAnd:
|
||||
out << "s" << mUnfoldShortCircuit->getNextTemporaryIndex();
|
||||
return false;
|
||||
if (node->getRight()->hasSideEffects())
|
||||
{
|
||||
out << "s" << mUnfoldShortCircuit->getNextTemporaryIndex();
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
outputTriplet(visit, "(", " && ", ")");
|
||||
return true;
|
||||
}
|
||||
default: UNREACHABLE();
|
||||
}
|
||||
|
||||
@ -1491,7 +1519,7 @@ bool OutputHLSL::visitAggregate(Visit visit, TIntermAggregate *node)
|
||||
{
|
||||
symbol->traverse(this);
|
||||
out << arrayString(symbol->getType());
|
||||
out << " = " + initializer(variable->getType());
|
||||
out << " = " + initializer(symbol->getType());
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1944,7 +1972,7 @@ bool OutputHLSL::visitSelection(Visit visit, TIntermSelection *node)
|
||||
{
|
||||
mUnfoldShortCircuit->traverse(node->getCondition());
|
||||
|
||||
out << "if(";
|
||||
out << "if (";
|
||||
|
||||
node->getCondition()->traverse(this);
|
||||
|
||||
@ -1953,9 +1981,14 @@ bool OutputHLSL::visitSelection(Visit visit, TIntermSelection *node)
|
||||
outputLineDirective(node->getLine().first_line);
|
||||
out << "{\n";
|
||||
|
||||
bool discard = false;
|
||||
|
||||
if (node->getTrueBlock())
|
||||
{
|
||||
traverseStatements(node->getTrueBlock());
|
||||
|
||||
// Detect true discard
|
||||
discard = (discard || FindDiscard::search(node->getTrueBlock()));
|
||||
}
|
||||
|
||||
outputLineDirective(node->getLine().first_line);
|
||||
@ -1973,6 +2006,15 @@ bool OutputHLSL::visitSelection(Visit visit, TIntermSelection *node)
|
||||
|
||||
outputLineDirective(node->getFalseBlock()->getLine().first_line);
|
||||
out << ";\n}\n";
|
||||
|
||||
// Detect false discard
|
||||
discard = (discard || FindDiscard::search(node->getFalseBlock()));
|
||||
}
|
||||
|
||||
// ANGLE issue 486: Detect problematic conditional discard
|
||||
if (discard && FindSideEffectRewriting::search(node))
|
||||
{
|
||||
mUsesDiscardRewriting = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2070,7 +2112,9 @@ bool OutputHLSL::visitBranch(Visit visit, TIntermBranch *node)
|
||||
|
||||
switch (node->getFlowOp())
|
||||
{
|
||||
case EOpKill: outputTriplet(visit, "discard;\n", "", ""); break;
|
||||
case EOpKill:
|
||||
outputTriplet(visit, "discard;\n", "", "");
|
||||
break;
|
||||
case EOpBreak:
|
||||
if (visit == PreVisit)
|
||||
{
|
||||
@ -2293,7 +2337,7 @@ bool OutputHLSL::handleExcessiveLoop(TIntermLoop *node)
|
||||
|
||||
if (!firstLoopFragment)
|
||||
{
|
||||
out << "if(!Break";
|
||||
out << "if (!Break";
|
||||
index->traverse(this);
|
||||
out << ") {\n";
|
||||
}
|
@ -14,9 +14,9 @@
|
||||
#define GL_APICALL
|
||||
#include <GLES2/gl2.h>
|
||||
|
||||
#include "compiler/intermediate.h"
|
||||
#include "compiler/ParseHelper.h"
|
||||
#include "compiler/Uniform.h"
|
||||
#include "compiler/translator/intermediate.h"
|
||||
#include "compiler/translator/ParseContext.h"
|
||||
#include "compiler/translator/Uniform.h"
|
||||
|
||||
namespace sh
|
||||
{
|
||||
@ -125,6 +125,7 @@ class OutputHLSL : public TIntermTraverser
|
||||
bool mUsesAtan2_2;
|
||||
bool mUsesAtan2_3;
|
||||
bool mUsesAtan2_4;
|
||||
bool mUsesDiscardRewriting;
|
||||
|
||||
int mNumRenderTargets;
|
||||
|
@ -4,12 +4,12 @@
|
||||
// found in the LICENSE file.
|
||||
//
|
||||
|
||||
#include "compiler/ParseHelper.h"
|
||||
#include "compiler/translator/ParseContext.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "compiler/glslang.h"
|
||||
#include "compiler/translator/glslang.h"
|
||||
#include "compiler/preprocessor/SourceLocation.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
@ -182,7 +182,7 @@ void TParseContext::error(const TSourceLoc& loc,
|
||||
pp::SourceLocation srcLoc;
|
||||
srcLoc.file = loc.first_file;
|
||||
srcLoc.line = loc.first_line;
|
||||
diagnostics.writeInfo(pp::Diagnostics::ERROR,
|
||||
diagnostics.writeInfo(pp::Diagnostics::PP_ERROR,
|
||||
srcLoc, reason, token, extraInfo);
|
||||
|
||||
}
|
||||
@ -193,7 +193,7 @@ void TParseContext::warning(const TSourceLoc& loc,
|
||||
pp::SourceLocation srcLoc;
|
||||
srcLoc.file = loc.first_file;
|
||||
srcLoc.line = loc.first_line;
|
||||
diagnostics.writeInfo(pp::Diagnostics::WARNING,
|
||||
diagnostics.writeInfo(pp::Diagnostics::PP_WARNING,
|
||||
srcLoc, reason, token, extraInfo);
|
||||
}
|
||||
|
||||
@ -535,7 +535,7 @@ bool TParseContext::constructorErrorCheck(const TSourceLoc& line, TIntermNode* n
|
||||
return true;
|
||||
}
|
||||
|
||||
if (op == EOpConstructStruct && !type->isArray() && int(type->getStruct()->fields().size()) != function.getParamCount()) {
|
||||
if (op == EOpConstructStruct && !type->isArray() && type->getStruct()->fields().size() != function.getParamCount()) {
|
||||
error(line, "Number of constructor parameters does not match the number of structure fields", "constructor");
|
||||
return true;
|
||||
}
|
@ -6,12 +6,12 @@
|
||||
#ifndef _PARSER_HELPER_INCLUDED_
|
||||
#define _PARSER_HELPER_INCLUDED_
|
||||
|
||||
#include "compiler/Diagnostics.h"
|
||||
#include "compiler/DirectiveHandler.h"
|
||||
#include "compiler/localintermediate.h"
|
||||
#include "compiler/translator/Diagnostics.h"
|
||||
#include "compiler/translator/DirectiveHandler.h"
|
||||
#include "compiler/translator/localintermediate.h"
|
||||
#include "compiler/preprocessor/Preprocessor.h"
|
||||
#include "compiler/ShHandle.h"
|
||||
#include "compiler/SymbolTable.h"
|
||||
#include "compiler/translator/ShHandle.h"
|
||||
#include "compiler/translator/SymbolTable.h"
|
||||
|
||||
struct TMatrixFields {
|
||||
bool wholeRow;
|
@ -4,7 +4,7 @@
|
||||
// found in the LICENSE file.
|
||||
//
|
||||
|
||||
#include "compiler/PoolAlloc.h"
|
||||
#include "compiler/translator/PoolAlloc.h"
|
||||
|
||||
#ifndef _MSC_VER
|
||||
#include <stdint.h>
|
||||
@ -12,8 +12,8 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include "common/angleutils.h"
|
||||
#include "compiler/InitializeGlobals.h"
|
||||
#include "compiler/osinclude.h"
|
||||
#include "compiler/translator/InitializeGlobals.h"
|
||||
#include "compiler/translator/osinclude.h"
|
||||
|
||||
OS_TLSIndex PoolIndex = OS_INVALID_TLS_INDEX;
|
||||
|
@ -4,7 +4,7 @@
|
||||
// found in the LICENSE file.
|
||||
//
|
||||
|
||||
#include "compiler/intermediate.h"
|
||||
#include "compiler/translator/intermediate.h"
|
||||
|
||||
class TAliveTraverser : public TIntermTraverser {
|
||||
public:
|
@ -4,8 +4,8 @@
|
||||
// found in the LICENSE file.
|
||||
//
|
||||
|
||||
#include "compiler/intermediate.h"
|
||||
#include "compiler/RemoveTree.h"
|
||||
#include "compiler/translator/intermediate.h"
|
||||
#include "compiler/translator/RemoveTree.h"
|
||||
|
||||
//
|
||||
// Code to recursively delete the intermediate tree.
|
@ -7,7 +7,7 @@
|
||||
#ifndef COMPILER_RENAME_FUNCTION
|
||||
#define COMPILER_RENAME_FUNCTION
|
||||
|
||||
#include "compiler/intermediate.h"
|
||||
#include "compiler/translator/intermediate.h"
|
||||
|
||||
//
|
||||
// Renames a function, including its declaration and any calls to it.
|
98
src/3rdparty/angle/src/compiler/translator/RewriteElseBlocks.cpp
vendored
Normal file
98
src/3rdparty/angle/src/compiler/translator/RewriteElseBlocks.cpp
vendored
Normal file
@ -0,0 +1,98 @@
|
||||
//
|
||||
// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
//
|
||||
// RewriteElseBlocks.cpp: Implementation for tree transform to change
|
||||
// all if-else blocks to if-if blocks.
|
||||
//
|
||||
|
||||
#include "compiler/translator/RewriteElseBlocks.h"
|
||||
#include "compiler/translator/NodeSearch.h"
|
||||
#include "compiler/translator/SymbolTable.h"
|
||||
|
||||
namespace sh
|
||||
{
|
||||
|
||||
TIntermSymbol *MakeNewTemporary(const TString &name, TBasicType type)
|
||||
{
|
||||
TType variableType(type, EbpHigh, EvqInternal);
|
||||
return new TIntermSymbol(-1, name, variableType);
|
||||
}
|
||||
|
||||
TIntermBinary *MakeNewBinary(TOperator op, TIntermTyped *left, TIntermTyped *right, const TType &resultType)
|
||||
{
|
||||
TIntermBinary *binary = new TIntermBinary(op);
|
||||
binary->setLeft(left);
|
||||
binary->setRight(right);
|
||||
binary->setType(resultType);
|
||||
return binary;
|
||||
}
|
||||
|
||||
TIntermUnary *MakeNewUnary(TOperator op, TIntermTyped *operand)
|
||||
{
|
||||
TIntermUnary *unary = new TIntermUnary(op, operand->getType());
|
||||
unary->setOperand(operand);
|
||||
return unary;
|
||||
}
|
||||
|
||||
bool ElseBlockRewriter::visitAggregate(Visit visit, TIntermAggregate *node)
|
||||
{
|
||||
switch (node->getOp())
|
||||
{
|
||||
case EOpSequence:
|
||||
{
|
||||
for (size_t statementIndex = 0; statementIndex != node->getSequence().size(); statementIndex++)
|
||||
{
|
||||
TIntermNode *statement = node->getSequence()[statementIndex];
|
||||
TIntermSelection *selection = statement->getAsSelectionNode();
|
||||
if (selection && selection->getFalseBlock() != NULL)
|
||||
{
|
||||
node->getSequence()[statementIndex] = rewriteSelection(selection);
|
||||
delete selection;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default: break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
TIntermNode *ElseBlockRewriter::rewriteSelection(TIntermSelection *selection)
|
||||
{
|
||||
ASSERT(selection->getFalseBlock() != NULL);
|
||||
|
||||
TString temporaryName = "cond_" + str(mTemporaryIndex++);
|
||||
TIntermTyped *typedCondition = selection->getCondition()->getAsTyped();
|
||||
TType resultType(EbtBool, EbpUndefined);
|
||||
TIntermSymbol *conditionSymbolA = MakeNewTemporary(temporaryName, EbtBool);
|
||||
TIntermSymbol *conditionSymbolB = MakeNewTemporary(temporaryName, EbtBool);
|
||||
TIntermSymbol *conditionSymbolC = MakeNewTemporary(temporaryName, EbtBool);
|
||||
TIntermBinary *storeCondition = MakeNewBinary(EOpInitialize, conditionSymbolA,
|
||||
typedCondition, resultType);
|
||||
TIntermUnary *negatedCondition = MakeNewUnary(EOpLogicalNot, conditionSymbolB);
|
||||
TIntermSelection *falseBlock = new TIntermSelection(negatedCondition,
|
||||
selection->getFalseBlock(), NULL);
|
||||
TIntermSelection *newIfElse = new TIntermSelection(conditionSymbolC,
|
||||
selection->getTrueBlock(), falseBlock);
|
||||
|
||||
TIntermAggregate *declaration = new TIntermAggregate(EOpDeclaration);
|
||||
declaration->getSequence().push_back(storeCondition);
|
||||
|
||||
TIntermAggregate *block = new TIntermAggregate(EOpSequence);
|
||||
block->getSequence().push_back(declaration);
|
||||
block->getSequence().push_back(newIfElse);
|
||||
|
||||
return block;
|
||||
}
|
||||
|
||||
void RewriteElseBlocks(TIntermNode *node)
|
||||
{
|
||||
ElseBlockRewriter rewriter;
|
||||
node->traverse(&rewriter);
|
||||
}
|
||||
|
||||
}
|
39
src/3rdparty/angle/src/compiler/translator/RewriteElseBlocks.h
vendored
Normal file
39
src/3rdparty/angle/src/compiler/translator/RewriteElseBlocks.h
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
//
|
||||
// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
//
|
||||
// RewriteElseBlocks.h: Prototype for tree transform to change
|
||||
// all if-else blocks to if-if blocks.
|
||||
//
|
||||
|
||||
#ifndef COMPILER_REWRITE_ELSE_BLOCKS_H_
|
||||
#define COMPILER_REWRITE_ELSE_BLOCKS_H_
|
||||
|
||||
#include "compiler/translator/intermediate.h"
|
||||
|
||||
namespace sh
|
||||
{
|
||||
|
||||
class ElseBlockRewriter : public TIntermTraverser
|
||||
{
|
||||
public:
|
||||
ElseBlockRewriter()
|
||||
: TIntermTraverser(false, false, true, false)
|
||||
, mTemporaryIndex(0)
|
||||
{}
|
||||
|
||||
protected:
|
||||
bool visitAggregate(Visit visit, TIntermAggregate *aggregate);
|
||||
|
||||
private:
|
||||
int mTemporaryIndex;
|
||||
|
||||
TIntermNode *rewriteSelection(TIntermSelection *selection);
|
||||
};
|
||||
|
||||
void RewriteElseBlocks(TIntermNode *node);
|
||||
|
||||
}
|
||||
|
||||
#endif // COMPILER_REWRITE_ELSE_BLOCKS_H_
|
@ -6,10 +6,10 @@
|
||||
// SearchSymbol is an AST traverser to detect the use of a given symbol name
|
||||
//
|
||||
|
||||
#include "compiler/SearchSymbol.h"
|
||||
#include "compiler/translator/SearchSymbol.h"
|
||||
|
||||
#include "compiler/InfoSink.h"
|
||||
#include "compiler/OutputHLSL.h"
|
||||
#include "compiler/translator/InfoSink.h"
|
||||
#include "compiler/translator/OutputHLSL.h"
|
||||
|
||||
namespace sh
|
||||
{
|
@ -9,8 +9,8 @@
|
||||
#ifndef COMPILER_SEARCHSYMBOL_H_
|
||||
#define COMPILER_SEARCHSYMBOL_H_
|
||||
|
||||
#include "compiler/intermediate.h"
|
||||
#include "compiler/ParseHelper.h"
|
||||
#include "compiler/translator/intermediate.h"
|
||||
#include "compiler/translator/ParseContext.h"
|
||||
|
||||
namespace sh
|
||||
{
|
@ -16,12 +16,12 @@
|
||||
|
||||
#include "GLSLANG/ShaderLang.h"
|
||||
|
||||
#include "compiler/BuiltInFunctionEmulator.h"
|
||||
#include "compiler/ExtensionBehavior.h"
|
||||
#include "compiler/HashNames.h"
|
||||
#include "compiler/InfoSink.h"
|
||||
#include "compiler/SymbolTable.h"
|
||||
#include "compiler/VariableInfo.h"
|
||||
#include "compiler/translator/BuiltInFunctionEmulator.h"
|
||||
#include "compiler/translator/ExtensionBehavior.h"
|
||||
#include "compiler/translator/HashNames.h"
|
||||
#include "compiler/translator/InfoSink.h"
|
||||
#include "compiler/translator/SymbolTable.h"
|
||||
#include "compiler/translator/VariableInfo.h"
|
||||
#include "third_party/compiler/ArrayBoundsClamper.h"
|
||||
|
||||
class LongNameMap;
|
||||
@ -100,6 +100,16 @@ protected:
|
||||
// Returns true if, after applying the packing rules in the GLSL 1.017 spec
|
||||
// Appendix A, section 7, the shader does not use too many uniforms.
|
||||
bool enforcePackingRestrictions();
|
||||
// Insert statements to initialize varyings without static use in the beginning
|
||||
// of main(). It is to work around a Mac driver where such varyings in a vertex
|
||||
// shader may be optimized out incorrectly at compile time, causing a link failure.
|
||||
// This function should only be applied to vertex shaders.
|
||||
void initializeVaryingsWithoutStaticUse(TIntermNode* root);
|
||||
// Insert gl_Position = vec4(0,0,0,0) to the beginning of main().
|
||||
// It is to work around a Linux driver bug where missing this causes compile failure
|
||||
// while spec says it is allowed.
|
||||
// This function should only be applied to vertex shaders.
|
||||
void initializeGLPosition(TIntermNode* root);
|
||||
// Returns true if the shader passes the restrictions that aim to prevent timing attacks.
|
||||
bool enforceTimingRestrictions(TIntermNode* root, bool outputGraph);
|
||||
// Returns true if the shader does not use samplers.
|
@ -11,11 +11,11 @@
|
||||
|
||||
#include "GLSLANG/ShaderLang.h"
|
||||
|
||||
#include "compiler/InitializeDll.h"
|
||||
#include "compiler/translator/InitializeDll.h"
|
||||
#include "compiler/preprocessor/length_limits.h"
|
||||
#include "compiler/ShHandle.h"
|
||||
#include "compiler/TranslatorHLSL.h"
|
||||
#include "compiler/VariablePacker.h"
|
||||
#include "compiler/translator/ShHandle.h"
|
||||
#include "compiler/translator/TranslatorHLSL.h"
|
||||
#include "compiler/translator/VariablePacker.h"
|
||||
|
||||
//
|
||||
// This is the platform independent interface between an OGL driver
|
||||
@ -91,6 +91,9 @@ void ShInitBuiltInResources(ShBuiltInResources* resources)
|
||||
resources->HashFunction = NULL;
|
||||
|
||||
resources->ArrayIndexClampingStrategy = SH_CLAMP_WITH_CLAMP_INTRINSIC;
|
||||
|
||||
resources->MaxExpressionComplexity = 256;
|
||||
resources->MaxCallStackDepth = 256;
|
||||
}
|
||||
|
||||
//
|
@ -13,7 +13,7 @@
|
||||
#pragma warning(disable: 4718)
|
||||
#endif
|
||||
|
||||
#include "compiler/SymbolTable.h"
|
||||
#include "compiler/translator/SymbolTable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <algorithm>
|
@ -33,8 +33,8 @@
|
||||
#include <assert.h>
|
||||
|
||||
#include "common/angleutils.h"
|
||||
#include "compiler/InfoSink.h"
|
||||
#include "compiler/intermediate.h"
|
||||
#include "compiler/translator/InfoSink.h"
|
||||
#include "compiler/translator/intermediate.h"
|
||||
|
||||
//
|
||||
// Symbol base class. (Can build functions or variables out of these...)
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user