Merge branch 'stable' into dev
Change-Id: Icff019d74ae04c628a80f66aa478e4db40fae464
This commit is contained in:
commit
90297a64f2
35
configure
vendored
35
configure
vendored
@ -233,7 +233,7 @@ macSDKify()
|
||||
|
||||
sdk=$(getSingleQMakeVariable "QMAKE_MAC_SDK" "$1")
|
||||
if [ -z "$sdk" ]; then echo "QMAKE_MAC_SDK must be set when building on Mac" >&2; exit 1; fi
|
||||
sysroot=$(xcodebuild -sdk $sdk -version Path 2>/dev/null)
|
||||
sysroot=$(/usr/bin/xcodebuild -sdk $sdk -version Path 2>/dev/null)
|
||||
if [ -z "$sysroot" ]; then echo "Failed to resolve SDK path for '$sdk'" >&2; exit 1; fi
|
||||
|
||||
case "$sdk" in
|
||||
@ -256,7 +256,7 @@ macSDKify()
|
||||
# Prefix tool with toolchain path
|
||||
var=$(echo "$line" | cut -d '=' -f 1)
|
||||
val=$(echo "$line" | cut -d '=' -f 2-)
|
||||
sdk_val=$(xcrun -sdk $sdk -find $(echo $val | cut -d ' ' -f 1))
|
||||
sdk_val=$(/usr/bin/xcrun -sdk $sdk -find $(echo $val | cut -d ' ' -f 1))
|
||||
val=$(echo $sdk_val $(echo $val | cut -s -d ' ' -f 2-))
|
||||
echo "$var=$val"
|
||||
;;
|
||||
@ -445,6 +445,28 @@ if [ "$OSTYPE" = "msys" ]; then
|
||||
BUILD_ON_MSYS=yes
|
||||
fi
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Verify Xcode installation on Mac OS
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
if [ "$BUILD_ON_MAC" = "yes" ]; then
|
||||
if ! /usr/bin/xcode-select --print-path >/dev/null 2>&1; then
|
||||
echo >&2
|
||||
echo " No Xcode is selected. Use xcode-select -switch to choose an Xcode" >&2
|
||||
echo " version. See the xcode-select man page for more information." >&2
|
||||
echo >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
if ! /usr/bin/xcrun -find xcrun >/dev/null 2>&1; then
|
||||
echo >&2
|
||||
echo " Xcode not set up properly. You may need to confirm the license" >&2
|
||||
echo " agreement by running /usr/bin/xcodebuild without arguments." >&2
|
||||
echo >&2
|
||||
exit 2
|
||||
fi
|
||||
fi
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Qt version detection
|
||||
#-----------------------------------------------------------------------------
|
||||
@ -2459,7 +2481,7 @@ if [ -z "$PLATFORM" ]; then
|
||||
# about the OS version, since we're not using the clang version that comes
|
||||
# with the system. We use 'xcrun' to check the clang version that's part of
|
||||
# the Xcode installation.
|
||||
if [ "$(xcrun -sdk macosx clang -v 2>&1 | sed -n 's/.*version \([0-9]\).*/\1/p')" -ge 3 ]; then
|
||||
if [ "$(/usr/bin/xcrun -sdk macosx clang -v 2>&1 | sed -n 's/.*version \([0-9]\).*/\1/p')" -ge 3 ]; then
|
||||
PLATFORM=macx-clang
|
||||
|
||||
# Advertise g++ as an alternative on Lion and below
|
||||
@ -2814,9 +2836,10 @@ if [ "$CFG_FORCEDEBUGINFO" = "yes" ]; then
|
||||
QMAKE_CONFIG="$QMAKE_CONFIG force_debug_info"
|
||||
fi
|
||||
|
||||
# iOS builds should be static to be able to submit to the App Store
|
||||
if [ "$XPLATFORM_IOS" = "yes" ]; then
|
||||
CFG_SHARED="no"
|
||||
CFG_SHARED="no" # iOS builds should be static to be able to submit to the App Store
|
||||
CFG_CXX11="no" # C++11 support disabled for now
|
||||
CFG_SKIP_MODULES="$CFG_SKIP_MODULES qtdeclarative qtquickcontrols qtwebkit qtgraphicaleffects qtdoc qtmultimedia qtwebkit-examples-and-demos qttools"
|
||||
fi
|
||||
|
||||
# disable GTK style support auto-detection on Mac
|
||||
@ -3040,7 +3063,7 @@ fi
|
||||
QT_INSTALL_BINS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_BINS"`
|
||||
|
||||
if [ "$XPLATFORM_MINGW" = "yes" ]; then
|
||||
QT_INSTALL_LIBEXECS_DIRNAME="lib"
|
||||
QT_INSTALL_LIBEXECS_DIRNAME="bin"
|
||||
else
|
||||
QT_INSTALL_LIBEXECS_DIRNAME="libexec"
|
||||
fi
|
||||
|
49
dist/changes-5.0.2
vendored
49
dist/changes-5.0.2
vendored
@ -22,9 +22,6 @@ information about a particular change.
|
||||
General Improvements
|
||||
--------------------
|
||||
|
||||
- [QTBUG-26697] The -skip option was added to configure, which enables not
|
||||
building particular modules. Typical use case: -skip webkit.
|
||||
|
||||
Third party components
|
||||
----------------------
|
||||
|
||||
@ -50,6 +47,8 @@ QtGui
|
||||
QtWidgets
|
||||
---------
|
||||
|
||||
- [QTBUG-28817] Fixed QColorDialog::setOption(), QFontDialog::setOption().
|
||||
|
||||
QtNetwork
|
||||
---------
|
||||
|
||||
@ -88,6 +87,10 @@ Qt for Linux/X11
|
||||
Qt for Windows
|
||||
--------------
|
||||
|
||||
- [QTBUG-30185] Fixed adding of suffixes in Window native file save dialog.
|
||||
- [QTBUG-29010, QTBUG-28531] Fixed handling of layered windows required for
|
||||
translucent or non-opaque windows.
|
||||
|
||||
Qt for Mac OS X
|
||||
---------------
|
||||
|
||||
@ -110,12 +113,52 @@ Qt for Windows CE
|
||||
* Tools *
|
||||
****************************************************************************
|
||||
|
||||
Build System & configure
|
||||
------------------------
|
||||
|
||||
- [QTBUG-26697] The -skip option was added to configure, which enables not
|
||||
building particular modules. Typical use case: -skip webkit.
|
||||
- [QTBUG-28769, ...] Assorted build fixes
|
||||
- [QTBUG-28902] Fixed contents of installed .prl files
|
||||
- [QTBUG-29110, QTBUG-29186, ...] Assorted fixes to CMake config files
|
||||
- [QTBUG-29174] Fixed numerous configure options which start with -l
|
||||
- [QTBUG-29400] Fixed configure -fully-process not creating .vcproj files
|
||||
- [QTBUG-29453, ...] Fixed generation of pkg-config .pc files
|
||||
- [QTBUG-29478] Fixed static builds with ICU
|
||||
- [QTBUG-29661] Fixed QtWebProcess.exe not finding Qt DLLs. -libexec
|
||||
now defaults to bin/ on Windows.
|
||||
- [QTBUG-29838] Fixed module versioning when mixing releases
|
||||
- [QTBUG-30102] Fixed passing of values with spaces to -device-option
|
||||
- Production builds do not build examples any more. 'make install' will
|
||||
copy only the example sources.
|
||||
- pkg-config: qt_config is now contained only in Qt5Core.pc, and it reflects
|
||||
QT_CONFIG, not the module build's CONFIG.
|
||||
|
||||
qmake
|
||||
-----
|
||||
|
||||
- [QTBUG-28132] Fixed parallelized 'jom install'
|
||||
- [QTBUG-29143] MSVC: Fixed parsing of /openmp
|
||||
- [QTBUG-29286] MSVC: Fixed use of VERSION breaking MSVC2010 projects
|
||||
- [QTBUG-29329] MSVC: Fixed misparsing of /Gs as /GS
|
||||
- [QTBUG-29329] MSVC: Stopped disabling buffer security check by default
|
||||
- [QTBUG-29371] Fixed generation of XCode projects for XCode 4.6
|
||||
- [QTBUG-29698] MSVC: Fixed incremental linking with non-standard shells
|
||||
- [QTBUG-29700] Fixed pkg-config file generation when cross-compiling
|
||||
- Qt modules are now enumerated in QT_MODULES, not QT_CONFIG. For portability,
|
||||
use qtHaveModule() (since 5.0.1) or !isEmpty(QT.<module>.name) instead.
|
||||
- $$(VAR) style environment variable expansions will not split on
|
||||
whitespace any more. Use $$split() if necessary.
|
||||
- Fixed qmake -tp vc (and configure without -no-vcproj)
|
||||
- MSVC: Fixed an empty VERSION causing a garbled version in .rc files
|
||||
- Windows: Added support for specifying application icon (via RC_ICONS)
|
||||
- Added spec for BlackBerry Playbook
|
||||
|
||||
moc
|
||||
---
|
||||
|
||||
- [QTBUG-29759] Fixed infinite recursion in macro substitution which
|
||||
prevented some headers to compile.
|
||||
|
||||
****************************************************************************
|
||||
* Plugins *
|
||||
|
@ -41,6 +41,7 @@ Cpp.ignoretokens += \
|
||||
Q_OPENVG_EXPORT \
|
||||
Q_OUTOFLINE_TEMPLATE \
|
||||
Q_PRINTSUPPORT_EXPORT \
|
||||
Q_QML_EXPORT \
|
||||
Q_SCRIPT_EXPORT \
|
||||
Q_SCRIPTTOOLS_EXPORT \
|
||||
Q_SQL_EXPORT \
|
||||
|
@ -45,7 +45,6 @@
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication app(argc, argv);
|
||||
qWarning("The usage of QHttp is not recommended anymore, please use QNetworkAccessManager.");
|
||||
qsrand(QTime(0,0,0).secsTo(QTime::currentTime()));
|
||||
|
||||
Q_INIT_RESOURCE(icons);
|
||||
|
@ -386,15 +386,15 @@ bool PeerWireClient::canTransferMore() const
|
||||
|| !outgoingBuffer.isEmpty() || !pendingBlocks.isEmpty();
|
||||
}
|
||||
|
||||
void PeerWireClient::connectToHostImplementation(const QString &hostName,
|
||||
quint16 port, OpenMode openMode)
|
||||
void PeerWireClient::connectToHost(const QHostAddress &address,
|
||||
quint16 port, OpenMode openMode)
|
||||
|
||||
{
|
||||
setOpenMode(openMode);
|
||||
socket.connectToHost(hostName, port, openMode);
|
||||
socket.connectToHost(address, port, openMode);
|
||||
}
|
||||
|
||||
void PeerWireClient::diconnectFromHostImplementation()
|
||||
void PeerWireClient::diconnectFromHost()
|
||||
{
|
||||
socket.disconnectFromHost();
|
||||
}
|
||||
|
@ -118,6 +118,10 @@ public:
|
||||
|
||||
void setReadBufferSize(qint64 size);
|
||||
|
||||
void connectToHost(const QHostAddress &address,
|
||||
quint16 port, OpenMode openMode = ReadWrite);
|
||||
void diconnectFromHost();
|
||||
|
||||
signals:
|
||||
void infoHashReceived(const QByteArray &infoHash);
|
||||
void readyToTransfer();
|
||||
@ -133,11 +137,6 @@ signals:
|
||||
|
||||
void bytesReceived(qint64 size);
|
||||
|
||||
protected slots:
|
||||
void connectToHostImplementation(const QString &hostName,
|
||||
quint16 port, OpenMode openMode = ReadWrite);
|
||||
void diconnectFromHostImplementation();
|
||||
|
||||
protected:
|
||||
void timerEvent(QTimerEvent *event);
|
||||
|
||||
|
@ -97,14 +97,10 @@ void TrackerClient::timerEvent(QTimerEvent *event)
|
||||
|
||||
void TrackerClient::fetchPeerList()
|
||||
{
|
||||
// Prepare connection details
|
||||
QString fullUrl = metaInfo.announceUrl();
|
||||
QUrl url(fullUrl);
|
||||
QString passkey = "?";
|
||||
if (fullUrl.contains("?passkey")) {
|
||||
passkey = metaInfo.announceUrl().mid(fullUrl.indexOf("?passkey"), -1);
|
||||
passkey += '&';
|
||||
}
|
||||
QUrl url(metaInfo.announceUrl());
|
||||
|
||||
// Base the query on announce url to include a passkey (if any)
|
||||
QUrlQuery query(url);
|
||||
|
||||
// Percent encode the hash
|
||||
QByteArray infoHash = torrentDownloader->infoHash();
|
||||
@ -115,43 +111,44 @@ void TrackerClient::fetchPeerList()
|
||||
}
|
||||
|
||||
bool seeding = (torrentDownloader->state() == TorrentClient::Seeding);
|
||||
QByteArray query;
|
||||
query += url.path().toLatin1();
|
||||
query += passkey;
|
||||
query += "info_hash=" + encodedSum;
|
||||
query += "&peer_id=" + ConnectionManager::instance()->clientId();
|
||||
query += "&port=" + QByteArray::number(TorrentServer::instance()->serverPort());
|
||||
query += "&compact=1";
|
||||
query += "&uploaded=" + QByteArray::number(torrentDownloader->uploadedBytes());
|
||||
|
||||
query.addQueryItem("info_hash", encodedSum);
|
||||
query.addQueryItem("peer_id", ConnectionManager::instance()->clientId());
|
||||
query.addQueryItem("port", QByteArray::number(TorrentServer::instance()->serverPort()));
|
||||
query.addQueryItem("compact", "1");
|
||||
query.addQueryItem("uploaded", QByteArray::number(torrentDownloader->uploadedBytes()));
|
||||
|
||||
if (!firstSeeding) {
|
||||
query += "&downloaded=0";
|
||||
query += "&left=0";
|
||||
query.addQueryItem("downloaded", "0");
|
||||
query.addQueryItem("left", "0");
|
||||
} else {
|
||||
query += "&downloaded=" + QByteArray::number(
|
||||
torrentDownloader->downloadedBytes());
|
||||
query.addQueryItem("downloaded",
|
||||
QByteArray::number(torrentDownloader->downloadedBytes()));
|
||||
int left = qMax<int>(0, metaInfo.totalSize() - torrentDownloader->downloadedBytes());
|
||||
query += "&left=" + QByteArray::number(seeding ? 0 : left);
|
||||
query.addQueryItem("left", QByteArray::number(seeding ? 0 : left));
|
||||
}
|
||||
|
||||
if (seeding && firstSeeding) {
|
||||
query += "&event=completed";
|
||||
query.addQueryItem("event", "completed");
|
||||
firstSeeding = false;
|
||||
} else if (firstTrackerRequest) {
|
||||
firstTrackerRequest = false;
|
||||
query += "&event=started";
|
||||
query.addQueryItem("event", "started");
|
||||
} else if(lastTrackerRequest) {
|
||||
query += "&event=stopped";
|
||||
query.addQueryItem("event", "stopped");
|
||||
}
|
||||
|
||||
if (!trackerId.isEmpty())
|
||||
query += "&trackerid=" + trackerId;
|
||||
query.addQueryItem("trackerid", trackerId);
|
||||
|
||||
url.setQuery(query);
|
||||
|
||||
QNetworkRequest req(url);
|
||||
if (!url.userName().isEmpty()) {
|
||||
uname = url.userName();
|
||||
pwd = url.password();
|
||||
connect(&http, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)), this, SLOT(provideAuthentication(QNetworkReply*,QAuthenticator*)));
|
||||
connect(&http, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)),
|
||||
this, SLOT(provideAuthentication(QNetworkReply*,QAuthenticator*)));
|
||||
}
|
||||
http.get(req);
|
||||
}
|
||||
|
@ -1,5 +1,11 @@
|
||||
QT += opengl widgets
|
||||
|
||||
contains(QT_CONFIG, opengles.) {
|
||||
contains(QT_CONFIG, angle): \
|
||||
warning("Qt was built with ANGLE, which provides only OpenGL ES 2.0 on top of DirectX 9.0c")
|
||||
error("This example requires Qt to be configured with -opengl desktop")
|
||||
}
|
||||
|
||||
HEADERS += 3rdparty/fbm.h \
|
||||
glbuffers.h \
|
||||
glextensions.h \
|
||||
|
@ -5,3 +5,6 @@ QMAKE_OBJCXXFLAGS_PRECOMPILE = -x objective-c++-header -c ${QMAKE_PCH_INPUT}
|
||||
QMAKE_OBJCXXFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE
|
||||
|
||||
QMAKE_XCODE_GCC_VERSION = com.apple.compilers.llvm.clang.1_0
|
||||
|
||||
QMAKE_CXXFLAGS_CXX11 += -stdlib=libc++
|
||||
QMAKE_LFLAGS_CXX11 += -stdlib=libc++
|
||||
|
@ -26,4 +26,7 @@ QMAKE_LIBS_THREAD =
|
||||
QMAKE_AR = ar cq
|
||||
QMAKE_RANLIB = ranlib -s
|
||||
|
||||
# We rely on Xcode to build
|
||||
include(xcode.conf)
|
||||
|
||||
include(unix.conf)
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
|
||||
# Get path of Xcode's Developer directory
|
||||
QMAKE_XCODE_DEVELOPER_PATH = $$system("xcode-select --print-path")
|
||||
QMAKE_XCODE_DEVELOPER_PATH = $$system("/usr/bin/xcode-select --print-path 2>/dev/null")
|
||||
isEmpty(QMAKE_XCODE_DEVELOPER_PATH): \
|
||||
error("Xcode path is not set. Please use xcode-select to choose Xcode installation path.")
|
||||
|
||||
@ -11,7 +11,11 @@ isEmpty(QMAKE_XCODE_DEVELOPER_PATH): \
|
||||
!exists($$QMAKE_XCODE_DEVELOPER_PATH): \
|
||||
error("Xcode is not installed in $${QMAKE_XCODE_DEVELOPER_PATH}. Please use xcode-select to choose Xcode installation path.")
|
||||
|
||||
# Make sure Xcode is set up properly
|
||||
isEmpty($$list($$system("/usr/bin/xcrun -find xcrun 2>/dev/null"))): \
|
||||
error("Xcode not set up properly. You may need to confirm the license agreement by running /usr/bin/xcodebuild.")
|
||||
|
||||
# Extract Xcode version using xcodebuild
|
||||
xcode_version = $$system("xcodebuild -version")
|
||||
xcode_version = $$system("/usr/bin/xcodebuild -version")
|
||||
QMAKE_XCODE_VERSION = $$member(xcode_version, 1)
|
||||
unset(xcode_version)
|
||||
|
@ -1,3 +1,10 @@
|
||||
QMAKE_CXXFLAGS += $$QMAKE_CXXFLAGS_CXX11
|
||||
QMAKE_OBJECTIVE_CFLAGS += $$QMAKE_CXXFLAGS_CXX11
|
||||
QMAKE_LFLAGS += $$QMAKE_LFLAGS_CXX11
|
||||
|
||||
contains(QMAKE_LFLAGS, -stdlib=libc++) {
|
||||
equals(QMAKE_MACOSX_DEPLOYMENT_TARGET, 10.6): \
|
||||
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.7
|
||||
contains(QMAKE_IOS_DEPLOYMENT_TARGET, ^4.*): \
|
||||
QMAKE_IOS_DEPLOYMENT_TARGET = 5.0
|
||||
}
|
||||
|
@ -55,10 +55,10 @@ CMAKE_BIN_DIR = $$cmakeRelativePath($$[QT_HOST_BINS], $$[QT_INSTALL_PREFIX])
|
||||
CMAKE_BIN_DIR_IS_ABSOLUTE = True
|
||||
}
|
||||
|
||||
CMAKE_ARCHDATA_DIR = $$cmakeRelativePath($$[QT_INSTALL_ARCHDATA], $$[QT_INSTALL_PREFIX])
|
||||
!isEmpty(CMAKE_FORCE_ABSOLUTE_PATHS)|contains(CMAKE_ARCHDATA_DIR, "^\\.\\./.*") { # For the mkspecs
|
||||
CMAKE_ARCHDATA_DIR = $$[QT_INSTALL_ARCHDATA]/
|
||||
CMAKE_ARCHDATA_DIR_IS_ABSOLUTE = True
|
||||
CMAKE_HOST_DATA_DIR = $$cmakeRelativePath($$[QT_HOST_DATA], $$[QT_INSTALL_PREFIX])
|
||||
!isEmpty(CMAKE_FORCE_ABSOLUTE_PATHS)|contains(CMAKE_HOST_DATA_DIR, "^\\.\\./.*") {
|
||||
CMAKE_HOST_DATA_DIR = $$[QT_HOST_DATA]/
|
||||
CMAKE_HOST_DATA_DIR_IS_ABSOLUTE = True
|
||||
}
|
||||
|
||||
static|staticlib:CMAKE_STATIC_TYPE = true
|
||||
|
@ -56,9 +56,27 @@ isEmpty(CMAKE_VERSION) {
|
||||
SET = set
|
||||
equals(QMAKE_DIR_SEP, "/"):SET = export
|
||||
|
||||
CMAKE_MODULE_VERSIONS =
|
||||
CMAKE_MODULES_UNDER_TEST =
|
||||
for (MODULE_UNDER_TEST, CMAKE_QT_MODULES_UNDER_TEST) {
|
||||
CMAKE_NAME = $$cmakeModuleName($$MODULE_UNDER_TEST)
|
||||
CMAKE_MODULE_VERSIONS += \
|
||||
-DCMAKE_$${CMAKE_NAME}_MODULE_MAJOR_VERSION=$$eval(QT.$${MODULE_UNDER_TEST}.MAJOR_VERSION) \
|
||||
-DCMAKE_$${CMAKE_NAME}_MODULE_MINOR_VERSION=$$eval(QT.$${MODULE_UNDER_TEST}.MINOR_VERSION) \
|
||||
-DCMAKE_$${CMAKE_NAME}_MODULE_PATCH_VERSION=$$eval(QT.$${MODULE_UNDER_TEST}.PATCH_VERSION)
|
||||
CMAKE_MODULES_UNDER_TEST += $$CMAKE_NAME
|
||||
}
|
||||
CMAKE_MODULES_UNDER_TEST = $$join(CMAKE_MODULES_UNDER_TEST, ;)
|
||||
|
||||
check.commands = \
|
||||
$(MKDIR) $$BUILD_DIR && cd $$BUILD_DIR && $$SET VERBOSE=1 && \
|
||||
cmake $$_PRO_FILE_PWD_ $$CMAKE_GENERATOR $$CMAKE_MODULE_DEFINES -DCMAKE_BUILD_TYPE=$${CMAKE_BUILD_TYPE} -DCMAKE_PREFIX_PATH=$$CMAKE_PREFIX_PATH -DQt5_MODULE_TEST_DEPENDS=\"$${dependentmodules}\" && \
|
||||
cmake $$_PRO_FILE_PWD_ $$CMAKE_GENERATOR \
|
||||
$$CMAKE_MODULE_DEFINES \
|
||||
-DCMAKE_BUILD_TYPE=$${CMAKE_BUILD_TYPE} \
|
||||
-DCMAKE_PREFIX_PATH=$$CMAKE_PREFIX_PATH \
|
||||
-DQt5_MODULE_TEST_DEPENDS=\"$${dependentmodules}\" \
|
||||
$${CMAKE_MODULE_VERSIONS} \
|
||||
-DCMAKE_MODULES_UNDER_TEST=\"$$CMAKE_MODULES_UNDER_TEST\" && \
|
||||
$(TESTRUNNER) ctest --output-on-failure
|
||||
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ set jarfile=dx.jar
|
||||
set "frameworkdir=%androidsdk%\platform-tools"
|
||||
|
||||
if exist "%frameworkdir%\%jarfile%" goto JarFileOk
|
||||
set "frameworkdir=%androidsdk%\lib"
|
||||
set "frameworkdir=%frameworkdir%\lib"
|
||||
|
||||
if exist "%frameworkdir%\%jarfile%" goto JarFileOk
|
||||
set "frameworkdir=%androidsdk%\framework"
|
||||
|
@ -9,9 +9,7 @@ get_filename_component(_qt5$${CMAKE_MODULE_NAME}_install_prefix \"${CMAKE_CURREN
|
||||
set(_qt5$${CMAKE_MODULE_NAME}_install_prefix \"$$[QT_INSTALL_PREFIX]\")
|
||||
!!ENDIF
|
||||
|
||||
set(Qt5$${CMAKE_MODULE_NAME}_VERSION_MAJOR "$$eval(QT.$${MODULE}.MAJOR_VERSION)")
|
||||
set(Qt5$${CMAKE_MODULE_NAME}_VERSION_MINOR "$$eval(QT.$${MODULE}.MINOR_VERSION)")
|
||||
set(Qt5$${CMAKE_MODULE_NAME}_VERSION_PATCH "$$eval(QT.$${MODULE}.PATCH_VERSION)")
|
||||
# For backwards compatibility only. Use Qt5$${CMAKE_MODULE_NAME}_VERSION instead.
|
||||
set(Qt5$${CMAKE_MODULE_NAME}_VERSION_STRING "$$eval(QT.$${MODULE}.MAJOR_VERSION).$$eval(QT.$${MODULE}.MINOR_VERSION).$$eval(QT.$${MODULE}.PATCH_VERSION)")
|
||||
|
||||
set(Qt5$${CMAKE_MODULE_NAME}_LIBRARIES Qt5::$${CMAKE_MODULE_NAME})
|
||||
@ -88,7 +86,7 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
|
||||
${Qt5$${CMAKE_MODULE_NAME}_VERSION_STRING} ${_Qt5$${CMAKE_MODULE_NAME}_FIND_VERSION_EXACT}
|
||||
${_Qt5$${CMAKE_MODULE_NAME}_DEPENDENCIES_FIND_QUIET}
|
||||
${_Qt5$${CMAKE_MODULE_NAME}_FIND_DEPENDENCIES_REQUIRED}
|
||||
PATHS \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}\" NO_DEFAULT_PATH
|
||||
PATHS \"${CMAKE_CURRENT_LIST_DIR}/..\" NO_DEFAULT_PATH
|
||||
)
|
||||
endif()
|
||||
|
||||
|
@ -6,7 +6,7 @@ defineTest(fixExclusiveOutputDirs) {
|
||||
count(ARGS, 2, greaterThan):isEqual($$list($$lower($$3)), false):appendFirstBuild = false
|
||||
else:appendFirstBuild = true
|
||||
|
||||
isEmpty(QMAKE_DIR_REPLACE):QMAKE_DIR_REPLACE += OBJECTS_DIR MOC_DIR RCC_DIR
|
||||
isEmpty(QMAKE_DIR_REPLACE):QMAKE_DIR_REPLACE += OBJECTS_DIR MOC_DIR RCC_DIR PRECOMPILED_DIR
|
||||
lessThan(firstBuild, $$secondBuild):eval($${firstBuild}_and_$${secondBuild}_target:QMAKE_DIR_REPLACE += DESTDIR)
|
||||
else:eval($${secondBuild}_and_$${firstBuild}_target:QMAKE_DIR_REPLACE += DESTDIR)
|
||||
for(fix, QMAKE_DIR_REPLACE) {
|
||||
|
@ -15,3 +15,7 @@ qt:!isEmpty(QT_CONFIG) {
|
||||
contains(QT_CONFIG, x86_64):!contains(QT_CONFIG, x86):CONFIG += x86_64
|
||||
}
|
||||
}
|
||||
|
||||
# Ensure that we process sdk.prf first, as it will update QMAKE_CXX
|
||||
# and friends that other features/extra compilers may depend on.
|
||||
sdk: load(sdk)
|
||||
|
@ -5,7 +5,7 @@ isEmpty(QMAKE_MAC_SDK): \
|
||||
contains(QMAKE_MAC_SDK, .*/.*): \
|
||||
error("QMAKE_MAC_SDK can only contain short-form SDK names (eg. macosx, iphoneos)")
|
||||
|
||||
QMAKE_MAC_SDK_PATH = $$system("xcodebuild -sdk $$QMAKE_MAC_SDK -version Path 2>/dev/null")
|
||||
QMAKE_MAC_SDK_PATH = $$system("/usr/bin/xcodebuild -sdk $$QMAKE_MAC_SDK -version Path 2>/dev/null")
|
||||
isEmpty(QMAKE_MAC_SDK_PATH): error("Could not resolve SDK path for \'$$QMAKE_MAC_SDK\'")
|
||||
|
||||
!equals(MAKEFILE_GENERATOR, XCODE) {
|
||||
@ -24,7 +24,9 @@ for(tool, $$list(QMAKE_CC QMAKE_CXX QMAKE_FIX_RPATH QMAKE_AR QMAKE_RANLIB QMAKE_
|
||||
value = $$eval($$tool)
|
||||
isEmpty(value): next()
|
||||
|
||||
sysrooted = $$system("xcrun -sdk $$QMAKE_MAC_SDK -find $$first(value)")
|
||||
sysrooted = $$system("/usr/bin/xcrun -sdk $$QMAKE_MAC_SDK -find $$first(value) 2>/dev/null")
|
||||
isEmpty(sysrooted): next()
|
||||
|
||||
$$tool = $$sysrooted $$member(value, 1, -1)
|
||||
}
|
||||
|
||||
@ -40,6 +42,9 @@ isEmpty(QMAKE_MAC_PLATFORM_NAME): error("Could not resolve platform name for SDK
|
||||
# FIXME: Get the version_min_flag out of the platform's 'Native Build System.xcspec'
|
||||
version_identifier = $$replace(QMAKE_MAC_PLATFORM_NAME, iphonesimulator, ios-simulator)
|
||||
|
||||
# C++11 support may affect the deployment target
|
||||
c++11: load(c++11)
|
||||
|
||||
ios:!host_build: \
|
||||
deployment_target = $$QMAKE_IOS_DEPLOYMENT_TARGET
|
||||
else: \
|
||||
|
@ -9,6 +9,9 @@
|
||||
# We mean it.
|
||||
#
|
||||
|
||||
# Ensure that each module has a .qmake.cache when properly qmake'd.
|
||||
cache()
|
||||
|
||||
load(qt_build_config)
|
||||
|
||||
TEMPLATE = subdirs
|
||||
|
@ -14,6 +14,14 @@
|
||||
<string>@EXECUTABLE@</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.yourcompany.@BUNDLEIDENTIFIER@</string>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>${PRODUCT_NAME}</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>${PRODUCT_NAME}</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.0</string>
|
||||
<key>NOTE</key>
|
||||
<string>This file was generated by Qt/QMake.</string>
|
||||
</dict>
|
||||
|
@ -15,9 +15,6 @@ DEFINES += DARWIN_NO_CARBON QT_NO_CORESERVICES QT_NO_PRINTER QT_N
|
||||
# Universal target (iPhone and iPad)
|
||||
QMAKE_IOS_TARGETED_DEVICE_FAMILY = 1,2
|
||||
|
||||
include(../../common/xcode.conf)
|
||||
lessThan(QMAKE_XCODE_VERSION, "4.3"): error("This mkspec requires Xcode 4.3 or later")
|
||||
|
||||
include(../../common/ios.conf)
|
||||
include(../../common/gcc-base-mac.conf)
|
||||
include(../../common/clang.conf)
|
||||
@ -25,4 +22,6 @@ include(../../common/clang-mac.conf)
|
||||
include(../../common/ios/clang.conf)
|
||||
include(../../common/ios/qmake.conf)
|
||||
|
||||
lessThan(QMAKE_XCODE_VERSION, "4.3"): error("This mkspec requires Xcode 4.3 or later")
|
||||
|
||||
load(qt_config)
|
||||
|
@ -3271,10 +3271,10 @@ MakefileGenerator::writePkgConfigFile()
|
||||
t << "Cflags: "
|
||||
// << var("QMAKE_CXXFLAGS") << " "
|
||||
<< varGlue("PRL_EXPORT_DEFINES","-D"," -D"," ")
|
||||
<< project->values("PRL_EXPORT_CXXFLAGS").join(' ')
|
||||
<< project->values("QMAKE_PKGCONFIG_CFLAGS").join(' ')
|
||||
<< varGlue("PRL_EXPORT_CXXFLAGS", "", " ", " ")
|
||||
<< varGlue("QMAKE_PKGCONFIG_CFLAGS", "", " ", " ")
|
||||
// << varGlue("DEFINES","-D"," -D"," ")
|
||||
<< " -I${includedir}" << endl;
|
||||
<< "-I${includedir}" << endl;
|
||||
|
||||
// requires
|
||||
const QString requires = project->values("QMAKE_PKGCONFIG_REQUIRES").join(' ');
|
||||
|
@ -579,7 +579,10 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
|
||||
<< "-$(DEL_FILE) " << destdir << "$(TARGET0)\n\t"
|
||||
<< "-$(DEL_FILE) " << destdir << "$(TARGET1)\n\t"
|
||||
<< "-$(DEL_FILE) " << destdir << "$(TARGET2)\n\t"
|
||||
<< "-$(MOVE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) " << destdir;
|
||||
<< "-$(MOVE) $(TARGET) " << destdir << "\n\t"
|
||||
<< "-$(MOVE) $(TARGET0) " << destdir << "\n\t"
|
||||
<< "-$(MOVE) $(TARGET1) " << destdir << "\n\t"
|
||||
<< "-$(MOVE) $(TARGET2) " << destdir << "\n\t";
|
||||
if(!project->isEmpty("QMAKE_POST_LINK"))
|
||||
t << "\n\t" << var("QMAKE_POST_LINK");
|
||||
t << endl << endl;
|
||||
@ -592,7 +595,8 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
|
||||
t << "\n\t"
|
||||
<< "-$(DEL_FILE) " << destdir << "$(TARGET)\n\t"
|
||||
<< "-$(DEL_FILE) " << destdir << "$(TARGET0)\n\t"
|
||||
<< "-$(MOVE) $(TARGET) $(TARGET0) " << destdir;
|
||||
<< "-$(MOVE) $(TARGET) " << destdir << "\n\t"
|
||||
<< "-$(MOVE) $(TARGET0) " << destdir << "\n\t";
|
||||
if(!project->isEmpty("QMAKE_POST_LINK"))
|
||||
t << "\n\t" << var("QMAKE_POST_LINK");
|
||||
t << endl << endl;
|
||||
|
@ -307,7 +307,6 @@ void NmakeMakefileGenerator::init()
|
||||
project->values("QMAKE_CLEAN").append(project->first("DESTDIR") + project->first("TARGET") + version + ".ilk");
|
||||
project->values("QMAKE_CLEAN").append("vc*.pdb");
|
||||
project->values("QMAKE_CLEAN").append("vc*.idb");
|
||||
project->values("DEFINES").removeAll("NDEBUG");
|
||||
} else {
|
||||
ProStringList &defines = project->values("DEFINES");
|
||||
if (!defines.contains("NDEBUG"))
|
||||
|
@ -981,12 +981,8 @@ void VcprojGenerator::initConfiguration()
|
||||
initDeploymentTool();
|
||||
initPreLinkEventTools();
|
||||
|
||||
// Set definite values in both configurations
|
||||
if (isDebug) {
|
||||
conf.compiler.PreprocessorDefinitions.removeAll("NDEBUG");
|
||||
} else {
|
||||
if (!isDebug)
|
||||
conf.compiler.PreprocessorDefinitions += "NDEBUG";
|
||||
}
|
||||
}
|
||||
|
||||
void VcprojGenerator::initCompilerTool()
|
||||
|
21
src/3rdparty/angle/.gitignore
vendored
21
src/3rdparty/angle/.gitignore
vendored
@ -19,17 +19,24 @@ DEPS
|
||||
codereview.settings
|
||||
|
||||
# Generated by flex/bison
|
||||
src/compiler/preprocessor/new/Tokenizer.cpp
|
||||
src/compiler/preprocessor/new/ExpressionParser.cpp
|
||||
src/compiler/preprocessor/Tokenizer.cpp
|
||||
src/compiler/preprocessor/ExpressionParser.cpp
|
||||
src/compiler/glslang_lex.cpp
|
||||
src/compiler/glslang_tab.cpp
|
||||
src/compiler/glslang_tab.h
|
||||
|
||||
# Generated by FXC
|
||||
src/libGLESv2/shaders/standardvs.h
|
||||
src/libGLESv2/shaders/flipyvs.h
|
||||
src/libGLESv2/shaders/luminanceps.h
|
||||
src/libGLESv2/shaders/componentmaskps.h
|
||||
src/libGLESv2/shaders/passthroughps.h
|
||||
src/libGLESv2/renderer/shaders/compiled/standardvs.h
|
||||
src/libGLESv2/renderer/shaders/compiled/flipyvs.h
|
||||
src/libGLESv2/renderer/shaders/compiled/luminanceps.h
|
||||
src/libGLESv2/renderer/shaders/compiled/componentmaskps.h
|
||||
src/libGLESv2/renderer/shaders/compiled/passthroughps.h
|
||||
src/libGLESv2/renderer/shaders/compiled/PassthroughRGBA11ps.h
|
||||
src/libGLESv2/renderer/shaders/compiled/PassthroughRGB11ps.h
|
||||
src/libGLESv2/renderer/shaders/compiled/PassthroughLumAlpha11ps.h
|
||||
src/libGLESv2/renderer/shaders/compiled/PassthroughLum11ps.h
|
||||
src/libGLESv2/renderer/shaders/compiled/Passthrough11vs.h
|
||||
src/libGLESv2/renderer/shaders/compiled/Clear11ps.h
|
||||
src/libGLESv2/renderer/shaders/compiled/Clear11vs.h
|
||||
|
||||
|
||||
|
46
src/3rdparty/angle/include/GLES2/gl2ext.h
vendored
46
src/3rdparty/angle/include/GLES2/gl2ext.h
vendored
@ -556,6 +556,44 @@ typedef void* GLeglImageOES;
|
||||
#define GL_COLOR_ATTACHMENT15_NV 0x8CEF
|
||||
#endif
|
||||
|
||||
/* GL_EXT_draw_buffers */
|
||||
#ifndef GL_EXT_draw_buffers
|
||||
#define GL_MAX_DRAW_BUFFERS_EXT 0x8824
|
||||
#define GL_DRAW_BUFFER0_EXT 0x8825
|
||||
#define GL_DRAW_BUFFER1_EXT 0x8826
|
||||
#define GL_DRAW_BUFFER2_EXT 0x8827
|
||||
#define GL_DRAW_BUFFER3_EXT 0x8828
|
||||
#define GL_DRAW_BUFFER4_EXT 0x8829
|
||||
#define GL_DRAW_BUFFER5_EXT 0x882A
|
||||
#define GL_DRAW_BUFFER6_EXT 0x882B
|
||||
#define GL_DRAW_BUFFER7_EXT 0x882C
|
||||
#define GL_DRAW_BUFFER8_EXT 0x882D
|
||||
#define GL_DRAW_BUFFER9_EXT 0x882E
|
||||
#define GL_DRAW_BUFFER10_EXT 0x882F
|
||||
#define GL_DRAW_BUFFER11_EXT 0x8830
|
||||
#define GL_DRAW_BUFFER12_EXT 0x8831
|
||||
#define GL_DRAW_BUFFER13_EXT 0x8832
|
||||
#define GL_DRAW_BUFFER14_EXT 0x8833
|
||||
#define GL_DRAW_BUFFER15_EXT 0x8834
|
||||
#define GL_COLOR_ATTACHMENT0_EXT 0x8CE0
|
||||
#define GL_COLOR_ATTACHMENT1_EXT 0x8CE1
|
||||
#define GL_COLOR_ATTACHMENT2_EXT 0x8CE2
|
||||
#define GL_COLOR_ATTACHMENT3_EXT 0x8CE3
|
||||
#define GL_COLOR_ATTACHMENT4_EXT 0x8CE4
|
||||
#define GL_COLOR_ATTACHMENT5_EXT 0x8CE5
|
||||
#define GL_COLOR_ATTACHMENT6_EXT 0x8CE6
|
||||
#define GL_COLOR_ATTACHMENT7_EXT 0x8CE7
|
||||
#define GL_COLOR_ATTACHMENT8_EXT 0x8CE8
|
||||
#define GL_COLOR_ATTACHMENT9_EXT 0x8CE9
|
||||
#define GL_COLOR_ATTACHMENT10_EXT 0x8CEA
|
||||
#define GL_COLOR_ATTACHMENT11_EXT 0x8CEB
|
||||
#define GL_COLOR_ATTACHMENT12_EXT 0x8CEC
|
||||
#define GL_COLOR_ATTACHMENT13_EXT 0x8CED
|
||||
#define GL_COLOR_ATTACHMENT14_EXT 0x8CEE
|
||||
#define GL_COLOR_ATTACHMENT15_EXT 0x8CEF
|
||||
#define GL_MAX_COLOR_ATTACHMENTS_EXT 0x8CDF
|
||||
#endif
|
||||
|
||||
/* GL_NV_fbo_color_attachments */
|
||||
#ifndef GL_NV_fbo_color_attachments
|
||||
#define GL_MAX_COLOR_ATTACHMENTS_NV 0x8CDF
|
||||
@ -1331,6 +1369,14 @@ GL_APICALL void GL_APIENTRY glDrawBuffersNV (GLsizei n, const GLenum *bufs);
|
||||
typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSNVPROC) (GLsizei n, const GLenum *bufs);
|
||||
#endif
|
||||
|
||||
#ifndef GL_EXT_draw_buffers
|
||||
#define GL_EXT_draw_buffers 1
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_APICALL void GL_APIENTRY glDrawBuffersEXT (GLsizei n, const GLenum *bufs);
|
||||
#endif
|
||||
typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSEXTPROC) (GLsizei n, const GLenum *bufs);
|
||||
#endif
|
||||
|
||||
/* GL_NV_fbo_color_attachments */
|
||||
#ifndef GL_NV_fbo_color_attachments
|
||||
#define GL_NV_fbo_color_attachments 1
|
||||
|
103
src/3rdparty/angle/include/GLSLANG/ShaderLang.h
vendored
103
src/3rdparty/angle/include/GLSLANG/ShaderLang.h
vendored
@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
|
||||
// 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.
|
||||
//
|
||||
@ -23,6 +23,9 @@
|
||||
#define COMPILER_EXPORT
|
||||
#endif
|
||||
|
||||
#include "KHR/khrplatform.h"
|
||||
#include <stddef.h>
|
||||
|
||||
//
|
||||
// This is the platform independent interface between an OGL driver
|
||||
// and the shading language compiler.
|
||||
@ -34,7 +37,7 @@ extern "C" {
|
||||
|
||||
// Version number for shader translation API.
|
||||
// It is incremented everytime the API changes.
|
||||
#define SH_VERSION 107
|
||||
#define ANGLE_SH_VERSION 110
|
||||
|
||||
//
|
||||
// The names of the following enums have been derived by replacing GL prefix
|
||||
@ -75,9 +78,11 @@ typedef enum {
|
||||
} ShShaderSpec;
|
||||
|
||||
typedef enum {
|
||||
SH_ESSL_OUTPUT = 0x8B45,
|
||||
SH_GLSL_OUTPUT = 0x8B46,
|
||||
SH_HLSL_OUTPUT = 0x8B47
|
||||
SH_ESSL_OUTPUT = 0x8B45,
|
||||
SH_GLSL_OUTPUT = 0x8B46,
|
||||
SH_HLSL_OUTPUT = 0x8B47,
|
||||
SH_HLSL9_OUTPUT = 0x8B47,
|
||||
SH_HLSL11_OUTPUT = 0x8B48
|
||||
} ShShaderOutput;
|
||||
|
||||
typedef enum {
|
||||
@ -110,7 +115,11 @@ typedef enum {
|
||||
SH_ACTIVE_UNIFORM_MAX_LENGTH = 0x8B87,
|
||||
SH_ACTIVE_ATTRIBUTES = 0x8B89,
|
||||
SH_ACTIVE_ATTRIBUTE_MAX_LENGTH = 0x8B8A,
|
||||
SH_MAPPED_NAME_MAX_LENGTH = 0x8B8B
|
||||
SH_MAPPED_NAME_MAX_LENGTH = 0x6000,
|
||||
SH_NAME_MAX_LENGTH = 0x6001,
|
||||
SH_HASHED_NAME_MAX_LENGTH = 0x6002,
|
||||
SH_HASHED_NAMES_COUNT = 0x6003,
|
||||
SH_ACTIVE_UNIFORMS_ARRAY = 0x6004
|
||||
} ShShaderInfo;
|
||||
|
||||
// Compile options.
|
||||
@ -146,8 +155,25 @@ typedef enum {
|
||||
|
||||
// Enforce the GLSL 1.017 Appendix A section 7 packing restrictions.
|
||||
SH_ENFORCE_PACKING_RESTRICTIONS = 0x0800,
|
||||
|
||||
// This flag ensures all indirect (expression-based) array indexing
|
||||
// is clamped to the bounds of the array. This ensures, for example,
|
||||
// that you cannot read off the end of a uniform, whether an array
|
||||
// vec234, or mat234 type. The ShArrayIndexClampingStrategy enum,
|
||||
// specified in the ShBuiltInResources when constructing the
|
||||
// compiler, selects the strategy for the clamping implementation.
|
||||
SH_CLAMP_INDIRECT_ARRAY_BOUNDS = 0x1000
|
||||
} ShCompileOptions;
|
||||
|
||||
// Defines alternate strategies for implementing array index clamping.
|
||||
typedef enum {
|
||||
// Use the clamp intrinsic for array index clamping.
|
||||
SH_CLAMP_WITH_CLAMP_INTRINSIC = 1,
|
||||
|
||||
// Use a user-defined function for array index clamping.
|
||||
SH_CLAMP_WITH_USER_DEFINED_INT_CLAMP_FUNCTION
|
||||
} ShArrayIndexClampingStrategy;
|
||||
|
||||
//
|
||||
// Driver must call this first, once, before doing any other
|
||||
// compiler operations.
|
||||
@ -160,6 +186,10 @@ COMPILER_EXPORT int ShInitialize();
|
||||
//
|
||||
COMPILER_EXPORT int ShFinalize();
|
||||
|
||||
// The 64 bits hash function. The first parameter is the input string; the
|
||||
// second parameter is the string length.
|
||||
typedef khronos_uint64_t (*ShHashFunction64)(const char*, size_t);
|
||||
|
||||
//
|
||||
// Implementation dependent built-in resources (constants and extensions).
|
||||
// The names for these resources has been obtained by stripping gl_/GL_.
|
||||
@ -181,6 +211,20 @@ typedef struct
|
||||
int OES_standard_derivatives;
|
||||
int OES_EGL_image_external;
|
||||
int ARB_texture_rectangle;
|
||||
int EXT_draw_buffers;
|
||||
|
||||
// Set to 1 if highp precision is supported in the fragment language.
|
||||
// Default is 0.
|
||||
int FragmentPrecisionHigh;
|
||||
|
||||
// Name Hashing.
|
||||
// Set a 64 bit hash function to enable user-defined name hashing.
|
||||
// Default is NULL.
|
||||
ShHashFunction64 HashFunction;
|
||||
|
||||
// Selects a strategy to use when implementing array index clamping.
|
||||
// Default is SH_CLAMP_WITH_CLAMP_INTRINSIC.
|
||||
ShArrayIndexClampingStrategy ArrayIndexClampingStrategy;
|
||||
} ShBuiltInResources;
|
||||
|
||||
//
|
||||
@ -207,7 +251,7 @@ typedef void* ShHandle;
|
||||
// spec: Specifies the language spec the compiler must conform to -
|
||||
// SH_GLES2_SPEC or SH_WEBGL_SPEC.
|
||||
// output: Specifies the output code type - SH_ESSL_OUTPUT, SH_GLSL_OUTPUT,
|
||||
// or SH_HLSL_OUTPUT.
|
||||
// SH_HLSL9_OUTPUT or SH_HLSL11_OUTPUT.
|
||||
// resources: Specifies the built-in resources.
|
||||
COMPILER_EXPORT ShHandle ShConstructCompiler(
|
||||
ShShaderType type,
|
||||
@ -244,7 +288,7 @@ COMPILER_EXPORT void ShDestruct(ShHandle handle);
|
||||
COMPILER_EXPORT int ShCompile(
|
||||
const ShHandle handle,
|
||||
const char* const shaderStrings[],
|
||||
const int numStrings,
|
||||
size_t numStrings,
|
||||
int compileOptions
|
||||
);
|
||||
|
||||
@ -267,11 +311,16 @@ COMPILER_EXPORT int ShCompile(
|
||||
// termination character.
|
||||
// SH_MAPPED_NAME_MAX_LENGTH: the length of the mapped variable name including
|
||||
// the null termination character.
|
||||
//
|
||||
// SH_NAME_MAX_LENGTH: the max length of a user-defined name including the
|
||||
// null termination character.
|
||||
// SH_HASHED_NAME_MAX_LENGTH: the max length of a hashed name including the
|
||||
// null termination character.
|
||||
// SH_HASHED_NAMES_COUNT: the number of hashed names from the latest compile.
|
||||
//
|
||||
// params: Requested parameter
|
||||
COMPILER_EXPORT void ShGetInfo(const ShHandle handle,
|
||||
ShShaderInfo pname,
|
||||
int* params);
|
||||
size_t* params);
|
||||
|
||||
// Returns nul-terminated information log for a compiled shader.
|
||||
// Parameters:
|
||||
@ -314,7 +363,7 @@ COMPILER_EXPORT void ShGetObjectCode(const ShHandle handle, char* objCode);
|
||||
// mappedName are the same.
|
||||
COMPILER_EXPORT void ShGetActiveAttrib(const ShHandle handle,
|
||||
int index,
|
||||
int* length,
|
||||
size_t* length,
|
||||
int* size,
|
||||
ShDataType* type,
|
||||
char* name,
|
||||
@ -341,12 +390,42 @@ COMPILER_EXPORT void ShGetActiveAttrib(const ShHandle handle,
|
||||
// mappedName are the same.
|
||||
COMPILER_EXPORT void ShGetActiveUniform(const ShHandle handle,
|
||||
int index,
|
||||
int* length,
|
||||
size_t* length,
|
||||
int* size,
|
||||
ShDataType* type,
|
||||
char* name,
|
||||
char* mappedName);
|
||||
|
||||
// Returns information about a name hashing entry from the latest compile.
|
||||
// Parameters:
|
||||
// handle: Specifies the compiler
|
||||
// index: Specifies the index of the name hashing entry to be queried.
|
||||
// name: Returns a null terminated string containing the user defined name.
|
||||
// It is assumed that name has enough memory to accomodate the name.
|
||||
// The size of the buffer required to store the user defined name can
|
||||
// be obtained by calling ShGetInfo with SH_NAME_MAX_LENGTH.
|
||||
// hashedName: Returns a null terminated string containing the hashed name of
|
||||
// the uniform variable, It is assumed that hashedName has enough
|
||||
// memory to accomodate the name. The size of the buffer required
|
||||
// to store the name can be obtained by calling ShGetInfo with
|
||||
// SH_HASHED_NAME_MAX_LENGTH.
|
||||
COMPILER_EXPORT void ShGetNameHashingEntry(const ShHandle handle,
|
||||
int index,
|
||||
char* name,
|
||||
char* hashedName);
|
||||
|
||||
// Returns a parameter from a compiled shader.
|
||||
// Parameters:
|
||||
// handle: Specifies the compiler
|
||||
// pname: Specifies the parameter to query.
|
||||
// The following parameters are defined:
|
||||
// SH_ACTIVE_UNIFORMS_ARRAY: an STL vector of active uniforms. Valid only for
|
||||
// HLSL output.
|
||||
// params: Requested parameter
|
||||
COMPILER_EXPORT void ShGetInfoPointer(const ShHandle handle,
|
||||
ShShaderInfo pname,
|
||||
void** params);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
28
src/3rdparty/angle/src/common/angleutils.h
vendored
28
src/3rdparty/angle/src/common/angleutils.h
vendored
@ -15,6 +15,31 @@
|
||||
TypeName(const TypeName&); \
|
||||
void operator=(const TypeName&)
|
||||
|
||||
template <typename T, unsigned int N>
|
||||
inline unsigned int ArraySize(T(&)[N])
|
||||
{
|
||||
return N;
|
||||
}
|
||||
|
||||
template <typename T, unsigned int N>
|
||||
void SafeRelease(T (&resourceBlock)[N])
|
||||
{
|
||||
for (unsigned int i = 0; i < N; i++)
|
||||
{
|
||||
SafeRelease(resourceBlock[i]);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void SafeRelease(T& resource)
|
||||
{
|
||||
if (resource)
|
||||
{
|
||||
resource->Release();
|
||||
resource = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#define snprintf _snprintf
|
||||
#endif
|
||||
@ -23,4 +48,7 @@
|
||||
#define VENDOR_ID_INTEL 0x8086
|
||||
#define VENDOR_ID_NVIDIA 0x10DE
|
||||
|
||||
#define GL_BGRA4_ANGLEX 0x6ABC
|
||||
#define GL_BGR5_A1_ANGLEX 0x6ABD
|
||||
|
||||
#endif // COMMON_ANGLEUTILS_H_
|
||||
|
15
src/3rdparty/angle/src/common/debug.cpp
vendored
15
src/3rdparty/angle/src/common/debug.cpp
vendored
@ -7,11 +7,12 @@
|
||||
// debug.cpp: Debugging utilities.
|
||||
|
||||
#include "common/debug.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include "common/system.h"
|
||||
#ifdef ANGLE_ENABLE_D3D11
|
||||
typedef DWORD D3DCOLOR;
|
||||
#else
|
||||
#include <d3d9.h>
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
namespace gl
|
||||
{
|
||||
@ -84,6 +85,12 @@ bool perfActive()
|
||||
ScopedPerfEventHelper::ScopedPerfEventHelper(const char* format, ...)
|
||||
{
|
||||
#if !defined(ANGLE_DISABLE_PERF)
|
||||
#if defined(ANGLE_DISABLE_TRACE)
|
||||
if (!perfActive())
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
va_list vararg;
|
||||
va_start(vararg, format);
|
||||
output(true, reinterpret_cast<PerfOutputFunction>(D3DPERF_BeginEvent), format, vararg);
|
||||
|
7
src/3rdparty/angle/src/common/debug.h
vendored
7
src/3rdparty/angle/src/common/debug.h
vendored
@ -99,6 +99,13 @@ 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))
|
||||
#define HAS_DYNAMIC_TYPE(type, obj) (dynamic_cast<type >(obj) != NULL)
|
||||
#else
|
||||
#define HAS_DYNAMIC_TYPE(type, obj) true
|
||||
#endif
|
||||
|
||||
// A macro functioning as a compile-time assert to validate constant conditions
|
||||
#define META_ASSERT(condition) typedef int COMPILE_TIME_ASSERT_##__LINE__[static_cast<bool>(condition)?1:-1]
|
||||
|
||||
|
26
src/3rdparty/angle/src/common/system.h
vendored
Normal file
26
src/3rdparty/angle/src/common/system.h
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
//
|
||||
// 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
|
6
src/3rdparty/angle/src/common/version.h
vendored
6
src/3rdparty/angle/src/common/version.h
vendored
@ -1,10 +1,12 @@
|
||||
#define MAJOR_VERSION 1
|
||||
#define MINOR_VERSION 0
|
||||
#define MINOR_VERSION 1
|
||||
#define BUILD_VERSION 0
|
||||
#define BUILD_REVISION 1318
|
||||
#define BUILD_REVISION 2037
|
||||
|
||||
#define STRINGIFY(x) #x
|
||||
#define MACRO_STRINGIFY(x) STRINGIFY(x)
|
||||
|
||||
#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 VERSION_DWORD ((MAJOR_VERSION << 24) | (MINOR_VERSION << 16) | BUILD_REVISION)
|
||||
|
6
src/3rdparty/angle/src/compiler/BaseTypes.h
vendored
6
src/3rdparty/angle/src/compiler/BaseTypes.h
vendored
@ -16,7 +16,7 @@ enum TPrecision
|
||||
EbpUndefined,
|
||||
EbpLow,
|
||||
EbpMedium,
|
||||
EbpHigh,
|
||||
EbpHigh
|
||||
};
|
||||
|
||||
inline const char* getPrecisionString(TPrecision p)
|
||||
@ -47,7 +47,7 @@ enum TBasicType
|
||||
EbtGuardSamplerEnd, // non type: see implementation of IsSampler()
|
||||
EbtStruct,
|
||||
EbtAddress, // should be deprecated??
|
||||
EbtInvariant, // used as a type when qualifying a previously declared variable as being invariant
|
||||
EbtInvariant // used as a type when qualifying a previously declared variable as being invariant
|
||||
};
|
||||
|
||||
inline const char* getBasicString(TBasicType t)
|
||||
@ -114,7 +114,7 @@ enum TQualifier
|
||||
EvqFragData,
|
||||
|
||||
// end of list
|
||||
EvqLast,
|
||||
EvqLast
|
||||
};
|
||||
|
||||
//
|
||||
|
10
src/3rdparty/angle/src/compiler/CodeGenHLSL.cpp
vendored
10
src/3rdparty/angle/src/compiler/CodeGenHLSL.cpp
vendored
@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
|
||||
// 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.
|
||||
//
|
||||
@ -14,9 +14,11 @@
|
||||
TCompiler* ConstructCompiler(
|
||||
ShShaderType type, ShShaderSpec spec, ShShaderOutput output)
|
||||
{
|
||||
switch (output) {
|
||||
case SH_HLSL_OUTPUT:
|
||||
return new TranslatorHLSL(type, spec);
|
||||
switch (output)
|
||||
{
|
||||
case SH_HLSL9_OUTPUT:
|
||||
case SH_HLSL11_OUTPUT:
|
||||
return new TranslatorHLSL(type, spec, output);
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
|
43
src/3rdparty/angle/src/compiler/Compiler.cpp
vendored
43
src/3rdparty/angle/src/compiler/Compiler.cpp
vendored
@ -19,6 +19,7 @@
|
||||
#include "compiler/depgraph/DependencyGraphOutput.h"
|
||||
#include "compiler/timing/RestrictFragmentShaderTiming.h"
|
||||
#include "compiler/timing/RestrictVertexShaderTiming.h"
|
||||
#include "third_party/compiler/ArrayBoundsClamper.h"
|
||||
|
||||
bool isWebGLBasedSpec(ShShaderSpec spec)
|
||||
{
|
||||
@ -37,6 +38,7 @@ bool InitializeSymbolTable(
|
||||
// The builtins deliberately don't specify precisions for the function
|
||||
// arguments and return types. For that reason we don't try to check them.
|
||||
TParseContext parseContext(symbolTable, extBehavior, intermediate, type, spec, 0, false, NULL, infoSink);
|
||||
parseContext.fragmentPrecisionHigh = resources.FragmentPrecisionHigh == 1;
|
||||
|
||||
GlobalParseContext = &parseContext;
|
||||
|
||||
@ -101,6 +103,8 @@ TShHandleBase::~TShHandleBase() {
|
||||
TCompiler::TCompiler(ShShaderType type, ShShaderSpec spec)
|
||||
: shaderType(type),
|
||||
shaderSpec(spec),
|
||||
fragmentPrecisionHigh(false),
|
||||
clampingStrategy(SH_CLAMP_WITH_CLAMP_INTRINSIC),
|
||||
builtInFunctionEmulator(type)
|
||||
{
|
||||
longNameMap = LongNameMap::GetInstance();
|
||||
@ -123,12 +127,18 @@ bool TCompiler::Init(const ShBuiltInResources& resources)
|
||||
if (!InitBuiltInSymbolTable(resources))
|
||||
return false;
|
||||
InitExtensionBehavior(resources, extensionBehavior);
|
||||
fragmentPrecisionHigh = resources.FragmentPrecisionHigh == 1;
|
||||
|
||||
arrayBoundsClamper.SetClampingStrategy(resources.ArrayIndexClampingStrategy);
|
||||
clampingStrategy = resources.ArrayIndexClampingStrategy;
|
||||
|
||||
hashFunction = resources.HashFunction;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TCompiler::compile(const char* const shaderStrings[],
|
||||
const int numStrings,
|
||||
size_t numStrings,
|
||||
int compileOptions)
|
||||
{
|
||||
TScopedPoolAllocator scopedAlloc(&allocator, true);
|
||||
@ -143,7 +153,7 @@ bool TCompiler::compile(const char* const shaderStrings[],
|
||||
|
||||
// First string is path of source file if flag is set. The actual source follows.
|
||||
const char* sourcePath = NULL;
|
||||
int firstSource = 0;
|
||||
size_t firstSource = 0;
|
||||
if (compileOptions & SH_SOURCE_PATH)
|
||||
{
|
||||
sourcePath = shaderStrings[0];
|
||||
@ -154,6 +164,7 @@ bool TCompiler::compile(const char* const shaderStrings[],
|
||||
TParseContext parseContext(symbolTable, extensionBehavior, intermediate,
|
||||
shaderType, shaderSpec, compileOptions, true,
|
||||
sourcePath, infoSink);
|
||||
parseContext.fragmentPrecisionHigh = fragmentPrecisionHigh;
|
||||
GlobalParseContext = &parseContext;
|
||||
|
||||
// We preserve symbols at the built-in level from compile-to-compile.
|
||||
@ -190,10 +201,15 @@ bool TCompiler::compile(const char* const shaderStrings[],
|
||||
if (success && (compileOptions & SH_EMULATE_BUILT_IN_FUNCTIONS))
|
||||
builtInFunctionEmulator.MarkBuiltInFunctionsForEmulation(root);
|
||||
|
||||
// Clamping uniform array bounds needs to happen after validateLimitations pass.
|
||||
if (success && (compileOptions & SH_CLAMP_INDIRECT_ARRAY_BOUNDS))
|
||||
arrayBoundsClamper.MarkIndirectArrayBoundsForClamping(root);
|
||||
|
||||
// Call mapLongVariableNames() before collectAttribsUniforms() so in
|
||||
// collectAttribsUniforms() we already have the mapped symbol names and
|
||||
// we could composite mapped and original variable names.
|
||||
if (success && (compileOptions & SH_MAP_LONG_VARIABLE_NAMES))
|
||||
// Also, if we hash all the names, then no need to do this for long names.
|
||||
if (success && (compileOptions & SH_MAP_LONG_VARIABLE_NAMES) && hashFunction == NULL)
|
||||
mapLongVariableNames(root);
|
||||
|
||||
if (success && (compileOptions & SH_ATTRIBUTES_UNIFORMS)) {
|
||||
@ -227,6 +243,7 @@ bool TCompiler::InitBuiltInSymbolTable(const ShBuiltInResources& resources)
|
||||
{
|
||||
TBuiltIns builtIns;
|
||||
|
||||
compileResources = resources;
|
||||
builtIns.initialize(shaderType, shaderSpec, resources);
|
||||
return InitializeSymbolTable(builtIns.getBuiltInStrings(),
|
||||
shaderType, shaderSpec, resources, infoSink, symbolTable);
|
||||
@ -234,6 +251,7 @@ bool TCompiler::InitBuiltInSymbolTable(const ShBuiltInResources& resources)
|
||||
|
||||
void TCompiler::clearResults()
|
||||
{
|
||||
arrayBoundsClamper.Cleanup();
|
||||
infoSink.info.erase();
|
||||
infoSink.obj.erase();
|
||||
infoSink.debug.erase();
|
||||
@ -242,6 +260,8 @@ void TCompiler::clearResults()
|
||||
uniforms.clear();
|
||||
|
||||
builtInFunctionEmulator.Cleanup();
|
||||
|
||||
nameMap.clear();
|
||||
}
|
||||
|
||||
bool TCompiler::detectRecursion(TIntermNode* root)
|
||||
@ -317,7 +337,7 @@ bool TCompiler::enforceVertexShaderTimingRestrictions(TIntermNode* root)
|
||||
|
||||
void TCompiler::collectAttribsUniforms(TIntermNode* root)
|
||||
{
|
||||
CollectAttribsUniforms collect(attribs, uniforms);
|
||||
CollectAttribsUniforms collect(attribs, uniforms, hashFunction);
|
||||
root->traverse(&collect);
|
||||
}
|
||||
|
||||
@ -344,6 +364,21 @@ const TExtensionBehavior& TCompiler::getExtensionBehavior() const
|
||||
return extensionBehavior;
|
||||
}
|
||||
|
||||
const ShBuiltInResources& TCompiler::getResources() const
|
||||
{
|
||||
return compileResources;
|
||||
}
|
||||
|
||||
const ArrayBoundsClamper& TCompiler::getArrayBoundsClamper() const
|
||||
{
|
||||
return arrayBoundsClamper;
|
||||
}
|
||||
|
||||
ShArrayIndexClampingStrategy TCompiler::getArrayIndexClampingStrategy() const
|
||||
{
|
||||
return clampingStrategy;
|
||||
}
|
||||
|
||||
const BuiltInFunctionEmulator& TCompiler::getBuiltInFunctionEmulator() const
|
||||
{
|
||||
return builtInFunctionEmulator;
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
|
||||
// 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.
|
||||
//
|
||||
@ -14,6 +14,7 @@ public:
|
||||
ConstantUnion()
|
||||
{
|
||||
iConst = 0;
|
||||
type = EbtVoid;
|
||||
}
|
||||
|
||||
POOL_ALLOCATOR_NEW_DELETE(GlobalPoolAllocator)
|
||||
|
@ -16,11 +16,26 @@ namespace sh
|
||||
{
|
||||
bool DetectLoopDiscontinuity::traverse(TIntermNode *node)
|
||||
{
|
||||
mLoopDepth = 0;
|
||||
mLoopDiscontinuity = false;
|
||||
node->traverse(this);
|
||||
return mLoopDiscontinuity;
|
||||
}
|
||||
|
||||
bool DetectLoopDiscontinuity::visitLoop(Visit visit, TIntermLoop *loop)
|
||||
{
|
||||
if (visit == PreVisit)
|
||||
{
|
||||
++mLoopDepth;
|
||||
}
|
||||
else if (visit == PostVisit)
|
||||
{
|
||||
--mLoopDepth;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DetectLoopDiscontinuity::visitBranch(Visit visit, TIntermBranch *node)
|
||||
{
|
||||
if (mLoopDiscontinuity)
|
||||
@ -28,14 +43,19 @@ bool DetectLoopDiscontinuity::visitBranch(Visit visit, TIntermBranch *node)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!mLoopDepth)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (node->getFlowOp())
|
||||
{
|
||||
case EOpKill:
|
||||
break;
|
||||
case EOpBreak:
|
||||
case EOpContinue:
|
||||
mLoopDiscontinuity = true;
|
||||
case EOpReturn:
|
||||
mLoopDiscontinuity = true;
|
||||
break;
|
||||
default: UNREACHABLE();
|
||||
}
|
||||
|
@ -23,8 +23,10 @@ class DetectLoopDiscontinuity : public TIntermTraverser
|
||||
|
||||
protected:
|
||||
bool visitBranch(Visit visit, TIntermBranch *node);
|
||||
bool visitLoop(Visit visit, TIntermLoop *loop);
|
||||
bool visitAggregate(Visit visit, TIntermAggregate *node);
|
||||
|
||||
int mLoopDepth;
|
||||
bool mLoopDiscontinuity;
|
||||
};
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
#include "compiler/debug.h"
|
||||
#include "compiler/InfoSink.h"
|
||||
#include "compiler/preprocessor/new/SourceLocation.h"
|
||||
#include "compiler/preprocessor/SourceLocation.h"
|
||||
|
||||
TDiagnostics::TDiagnostics(TInfoSink& infoSink) :
|
||||
mInfoSink(infoSink),
|
||||
|
@ -7,7 +7,7 @@
|
||||
#ifndef COMPILER_DIAGNOSTICS_H_
|
||||
#define COMPILER_DIAGNOSTICS_H_
|
||||
|
||||
#include "compiler/preprocessor/new/Diagnostics.h"
|
||||
#include "compiler/preprocessor/DiagnosticsBase.h"
|
||||
|
||||
class TInfoSink;
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
#include "compiler/ExtensionBehavior.h"
|
||||
#include "compiler/Pragma.h"
|
||||
#include "compiler/preprocessor/new/DirectiveHandler.h"
|
||||
#include "compiler/preprocessor/DirectiveHandlerBase.h"
|
||||
|
||||
class TDiagnostics;
|
||||
|
||||
|
@ -16,7 +16,7 @@ typedef enum
|
||||
EBhEnable,
|
||||
EBhWarn,
|
||||
EBhDisable,
|
||||
EBhUndefined,
|
||||
EBhUndefined
|
||||
} TBehavior;
|
||||
|
||||
inline const char* getBehaviorString(TBehavior b)
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved.
|
||||
// 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.
|
||||
//
|
||||
@ -210,6 +210,6 @@ int ForLoopUnroll::getLoopIncrement(TIntermLoop* node)
|
||||
int ForLoopUnroll::evaluateIntConstant(TIntermConstantUnion* node)
|
||||
{
|
||||
ASSERT((node != NULL) && (node->getUnionArrayPointer() != NULL));
|
||||
return node->getUnionArrayPointer()->getIConst();
|
||||
return node->getIConst(0);
|
||||
}
|
||||
|
||||
|
19
src/3rdparty/angle/src/compiler/HashNames.h
vendored
Normal file
19
src/3rdparty/angle/src/compiler/HashNames.h
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
|
||||
#ifndef COMPILER_HASH_NAMES_H_
|
||||
#define COMPILER_HASH_NAMES_H_
|
||||
|
||||
#include <map>
|
||||
|
||||
#include "compiler/intermediate.h"
|
||||
#include "GLSLANG/ShaderLang.h"
|
||||
|
||||
#define HASHED_NAME_PREFIX "webgl_"
|
||||
|
||||
typedef std::map<TPersistString, TPersistString> NameMap;
|
||||
|
||||
#endif // COMPILER_HASH_NAMES_H_
|
@ -654,4 +654,6 @@ void InitExtensionBehavior(const ShBuiltInResources& resources,
|
||||
extBehavior["GL_OES_EGL_image_external"] = EBhUndefined;
|
||||
if (resources.ARB_texture_rectangle)
|
||||
extBehavior["GL_ARB_texture_rectangle"] = EBhUndefined;
|
||||
if (resources.EXT_draw_buffers)
|
||||
extBehavior["GL_EXT_draw_buffers"] = EBhUndefined;
|
||||
}
|
||||
|
40
src/3rdparty/angle/src/compiler/Intermediate.cpp
vendored
40
src/3rdparty/angle/src/compiler/Intermediate.cpp
vendored
@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
|
||||
// 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.
|
||||
//
|
||||
@ -12,6 +12,7 @@
|
||||
#include <limits.h>
|
||||
#include <algorithm>
|
||||
|
||||
#include "compiler/HashNames.h"
|
||||
#include "compiler/localintermediate.h"
|
||||
#include "compiler/QualifierAlive.h"
|
||||
#include "compiler/RemoveTree.h"
|
||||
@ -592,7 +593,7 @@ TIntermNode* TIntermediate::addSelection(TIntermTyped* cond, TIntermNodePair nod
|
||||
//
|
||||
|
||||
if (cond->getAsTyped() && cond->getAsTyped()->getAsConstantUnion()) {
|
||||
if (cond->getAsTyped()->getAsConstantUnion()->getUnionArrayPointer()->getBConst() == true)
|
||||
if (cond->getAsConstantUnion()->getBConst(0) == true)
|
||||
return nodePair.node1 ? setAggregateOperator(nodePair.node1, EOpSequence, nodePair.node1->getLine()) : NULL;
|
||||
else
|
||||
return nodePair.node2 ? setAggregateOperator(nodePair.node2, EOpSequence, nodePair.node2->getLine()) : NULL;
|
||||
@ -646,7 +647,7 @@ TIntermTyped* TIntermediate::addSelection(TIntermTyped* cond, TIntermTyped* true
|
||||
//
|
||||
|
||||
if (cond->getAsConstantUnion() && trueBlock->getAsConstantUnion() && falseBlock->getAsConstantUnion()) {
|
||||
if (cond->getAsConstantUnion()->getUnionArrayPointer()->getBConst())
|
||||
if (cond->getAsConstantUnion()->getBConst(0))
|
||||
return trueBlock;
|
||||
else
|
||||
return falseBlock;
|
||||
@ -845,6 +846,7 @@ bool TIntermUnary::promote(TInfoSink&)
|
||||
}
|
||||
|
||||
setType(operand->getType());
|
||||
type.setQualifier(EvqTemporary);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -1161,7 +1163,7 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, TIntermTyped* constantNod
|
||||
case EbtFloat:
|
||||
if (rightUnionArray[i] == 0.0f) {
|
||||
infoSink.info.message(EPrefixWarning, "Divide by zero error during constant folding", getLine());
|
||||
tempConstArray[i].setFConst(FLT_MAX);
|
||||
tempConstArray[i].setFConst(unionArray[i].getFConst() < 0 ? -FLT_MAX : FLT_MAX);
|
||||
} else
|
||||
tempConstArray[i].setFConst(unionArray[i].getFConst() / rightUnionArray[i].getFConst());
|
||||
break;
|
||||
@ -1376,7 +1378,6 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, TIntermTyped* constantNod
|
||||
|
||||
TIntermTyped* TIntermediate::promoteConstantUnion(TBasicType promoteTo, TIntermConstantUnion* node)
|
||||
{
|
||||
ConstantUnion *rightUnionArray = node->getUnionArrayPointer();
|
||||
int size = node->getType().getObjectSize();
|
||||
|
||||
ConstantUnion *leftUnionArray = new ConstantUnion[size];
|
||||
@ -1387,13 +1388,13 @@ TIntermTyped* TIntermediate::promoteConstantUnion(TBasicType promoteTo, TIntermC
|
||||
case EbtFloat:
|
||||
switch (node->getType().getBasicType()) {
|
||||
case EbtInt:
|
||||
leftUnionArray[i].setFConst(static_cast<float>(rightUnionArray[i].getIConst()));
|
||||
leftUnionArray[i].setFConst(static_cast<float>(node->getIConst(i)));
|
||||
break;
|
||||
case EbtBool:
|
||||
leftUnionArray[i].setFConst(static_cast<float>(rightUnionArray[i].getBConst()));
|
||||
leftUnionArray[i].setFConst(static_cast<float>(node->getBConst(i)));
|
||||
break;
|
||||
case EbtFloat:
|
||||
leftUnionArray[i] = rightUnionArray[i];
|
||||
leftUnionArray[i].setFConst(static_cast<float>(node->getFConst(i)));
|
||||
break;
|
||||
default:
|
||||
infoSink.info.message(EPrefixInternalError, "Cannot promote", node->getLine());
|
||||
@ -1403,13 +1404,13 @@ TIntermTyped* TIntermediate::promoteConstantUnion(TBasicType promoteTo, TIntermC
|
||||
case EbtInt:
|
||||
switch (node->getType().getBasicType()) {
|
||||
case EbtInt:
|
||||
leftUnionArray[i] = rightUnionArray[i];
|
||||
leftUnionArray[i].setIConst(static_cast<int>(node->getIConst(i)));
|
||||
break;
|
||||
case EbtBool:
|
||||
leftUnionArray[i].setIConst(static_cast<int>(rightUnionArray[i].getBConst()));
|
||||
leftUnionArray[i].setIConst(static_cast<int>(node->getBConst(i)));
|
||||
break;
|
||||
case EbtFloat:
|
||||
leftUnionArray[i].setIConst(static_cast<int>(rightUnionArray[i].getFConst()));
|
||||
leftUnionArray[i].setIConst(static_cast<int>(node->getFConst(i)));
|
||||
break;
|
||||
default:
|
||||
infoSink.info.message(EPrefixInternalError, "Cannot promote", node->getLine());
|
||||
@ -1419,13 +1420,13 @@ TIntermTyped* TIntermediate::promoteConstantUnion(TBasicType promoteTo, TIntermC
|
||||
case EbtBool:
|
||||
switch (node->getType().getBasicType()) {
|
||||
case EbtInt:
|
||||
leftUnionArray[i].setBConst(rightUnionArray[i].getIConst() != 0);
|
||||
leftUnionArray[i].setBConst(node->getIConst(i) != 0);
|
||||
break;
|
||||
case EbtBool:
|
||||
leftUnionArray[i] = rightUnionArray[i];
|
||||
leftUnionArray[i].setBConst(node->getBConst(i));
|
||||
break;
|
||||
case EbtFloat:
|
||||
leftUnionArray[i].setBConst(rightUnionArray[i].getFConst() != 0.0f);
|
||||
leftUnionArray[i].setBConst(node->getFConst(i) != 0.0f);
|
||||
break;
|
||||
default:
|
||||
infoSink.info.message(EPrefixInternalError, "Cannot promote", node->getLine());
|
||||
@ -1445,3 +1446,14 @@ TIntermTyped* TIntermediate::promoteConstantUnion(TBasicType promoteTo, TIntermC
|
||||
return addConstantUnion(leftUnionArray, TType(promoteTo, t.getPrecision(), t.getQualifier(), t.getNominalSize(), t.isMatrix(), t.isArray()), node->getLine());
|
||||
}
|
||||
|
||||
// static
|
||||
TString TIntermTraverser::hash(const TString& name, ShHashFunction64 hashFunction)
|
||||
{
|
||||
if (hashFunction == NULL || name.empty())
|
||||
return name;
|
||||
khronos_uint64_t number = (*hashFunction)(name.c_str(), name.length());
|
||||
TStringStream stream;
|
||||
stream << HASHED_NAME_PREFIX << std::hex << number;
|
||||
TString hashedName = stream.str();
|
||||
return hashedName;
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
namespace {
|
||||
|
||||
TString mapLongName(int id, const TString& name, bool isGlobal)
|
||||
TString mapLongName(size_t id, const TString& name, bool isGlobal)
|
||||
{
|
||||
ASSERT(name.size() > MAX_SHORTENED_IDENTIFIER_SIZE);
|
||||
TStringStream stream;
|
||||
@ -70,7 +70,7 @@ void LongNameMap::Insert(const char* originalName, const char* mappedName)
|
||||
originalName, mappedName));
|
||||
}
|
||||
|
||||
int LongNameMap::Size() const
|
||||
size_t LongNameMap::Size() const
|
||||
{
|
||||
return mLongNameMap.size();
|
||||
}
|
||||
@ -115,7 +115,7 @@ TString MapLongVariableNames::mapGlobalLongName(const TString& name)
|
||||
const char* mappedName = mGlobalMap->Find(name.c_str());
|
||||
if (mappedName != NULL)
|
||||
return mappedName;
|
||||
int id = mGlobalMap->Size();
|
||||
size_t id = mGlobalMap->Size();
|
||||
TString rt = mapLongName(id, name, true);
|
||||
mGlobalMap->Insert(name.c_str(), rt.c_str());
|
||||
return rt;
|
||||
|
@ -31,7 +31,7 @@ public:
|
||||
void Insert(const char* originalName, const char* mappedName);
|
||||
|
||||
// Return the number of entries in the map.
|
||||
int Size() const;
|
||||
size_t Size() const;
|
||||
|
||||
private:
|
||||
LongNameMap();
|
||||
|
@ -6,8 +6,12 @@
|
||||
|
||||
#include "compiler/OutputESSL.h"
|
||||
|
||||
TOutputESSL::TOutputESSL(TInfoSinkBase& objSink)
|
||||
: TOutputGLSLBase(objSink)
|
||||
TOutputESSL::TOutputESSL(TInfoSinkBase& objSink,
|
||||
ShArrayIndexClampingStrategy clampingStrategy,
|
||||
ShHashFunction64 hashFunction,
|
||||
NameMap& nameMap,
|
||||
TSymbolTable& symbolTable)
|
||||
: TOutputGLSLBase(objSink, clampingStrategy, hashFunction, nameMap, symbolTable)
|
||||
{
|
||||
}
|
||||
|
||||
|
6
src/3rdparty/angle/src/compiler/OutputESSL.h
vendored
6
src/3rdparty/angle/src/compiler/OutputESSL.h
vendored
@ -12,7 +12,11 @@
|
||||
class TOutputESSL : public TOutputGLSLBase
|
||||
{
|
||||
public:
|
||||
TOutputESSL(TInfoSinkBase& objSink);
|
||||
TOutputESSL(TInfoSinkBase& objSink,
|
||||
ShArrayIndexClampingStrategy clampingStrategy,
|
||||
ShHashFunction64 hashFunction,
|
||||
NameMap& nameMap,
|
||||
TSymbolTable& symbolTable);
|
||||
|
||||
protected:
|
||||
virtual bool writeVariablePrecision(TPrecision precision);
|
||||
|
@ -6,8 +6,12 @@
|
||||
|
||||
#include "compiler/OutputGLSL.h"
|
||||
|
||||
TOutputGLSL::TOutputGLSL(TInfoSinkBase& objSink)
|
||||
: TOutputGLSLBase(objSink)
|
||||
TOutputGLSL::TOutputGLSL(TInfoSinkBase& objSink,
|
||||
ShArrayIndexClampingStrategy clampingStrategy,
|
||||
ShHashFunction64 hashFunction,
|
||||
NameMap& nameMap,
|
||||
TSymbolTable& symbolTable)
|
||||
: TOutputGLSLBase(objSink, clampingStrategy, hashFunction, nameMap, symbolTable)
|
||||
{
|
||||
}
|
||||
|
||||
|
6
src/3rdparty/angle/src/compiler/OutputGLSL.h
vendored
6
src/3rdparty/angle/src/compiler/OutputGLSL.h
vendored
@ -12,7 +12,11 @@
|
||||
class TOutputGLSL : public TOutputGLSLBase
|
||||
{
|
||||
public:
|
||||
TOutputGLSL(TInfoSinkBase& objSink);
|
||||
TOutputGLSL(TInfoSinkBase& objSink,
|
||||
ShArrayIndexClampingStrategy clampingStrategy,
|
||||
ShHashFunction64 hashFunction,
|
||||
NameMap& nameMap,
|
||||
TSymbolTable& symbolTable);
|
||||
|
||||
protected:
|
||||
virtual bool writeVariablePrecision(TPrecision);
|
||||
|
168
src/3rdparty/angle/src/compiler/OutputGLSLBase.cpp
vendored
168
src/3rdparty/angle/src/compiler/OutputGLSLBase.cpp
vendored
@ -7,37 +7,10 @@
|
||||
#include "compiler/OutputGLSLBase.h"
|
||||
#include "compiler/debug.h"
|
||||
|
||||
#include <cfloat>
|
||||
|
||||
namespace
|
||||
{
|
||||
TString getTypeName(const TType& type)
|
||||
{
|
||||
TInfoSinkBase out;
|
||||
if (type.isMatrix())
|
||||
{
|
||||
out << "mat";
|
||||
out << type.getNominalSize();
|
||||
}
|
||||
else if (type.isVector())
|
||||
{
|
||||
switch (type.getBasicType())
|
||||
{
|
||||
case EbtFloat: out << "vec"; break;
|
||||
case EbtInt: out << "ivec"; break;
|
||||
case EbtBool: out << "bvec"; break;
|
||||
default: UNREACHABLE(); break;
|
||||
}
|
||||
out << type.getNominalSize();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (type.getBasicType() == EbtStruct)
|
||||
out << type.getTypeName();
|
||||
else
|
||||
out << type.getBasicString();
|
||||
}
|
||||
return TString(out.c_str());
|
||||
}
|
||||
|
||||
TString arrayBrackets(const TType& type)
|
||||
{
|
||||
ASSERT(type.isArray());
|
||||
@ -66,10 +39,18 @@ bool isSingleStatement(TIntermNode* node) {
|
||||
}
|
||||
} // namespace
|
||||
|
||||
TOutputGLSLBase::TOutputGLSLBase(TInfoSinkBase& objSink)
|
||||
TOutputGLSLBase::TOutputGLSLBase(TInfoSinkBase& objSink,
|
||||
ShArrayIndexClampingStrategy clampingStrategy,
|
||||
ShHashFunction64 hashFunction,
|
||||
NameMap& nameMap,
|
||||
TSymbolTable& symbolTable)
|
||||
: TIntermTraverser(true, true, true),
|
||||
mObjSink(objSink),
|
||||
mDeclaringVariables(false)
|
||||
mDeclaringVariables(false),
|
||||
mClampingStrategy(clampingStrategy),
|
||||
mHashFunction(hashFunction),
|
||||
mNameMap(nameMap),
|
||||
mSymbolTable(symbolTable)
|
||||
{
|
||||
}
|
||||
|
||||
@ -101,7 +82,7 @@ void TOutputGLSLBase::writeVariableType(const TType& type)
|
||||
if ((type.getBasicType() == EbtStruct) &&
|
||||
(mDeclaredStructs.find(type.getTypeName()) == mDeclaredStructs.end()))
|
||||
{
|
||||
out << "struct " << type.getTypeName() << "{\n";
|
||||
out << "struct " << hashName(type.getTypeName()) << "{\n";
|
||||
const TTypeList* structure = type.getStruct();
|
||||
ASSERT(structure != NULL);
|
||||
for (size_t i = 0; i < structure->size(); ++i)
|
||||
@ -110,7 +91,7 @@ void TOutputGLSLBase::writeVariableType(const TType& type)
|
||||
ASSERT(fieldType != NULL);
|
||||
if (writeVariablePrecision(fieldType->getPrecision()))
|
||||
out << " ";
|
||||
out << getTypeName(*fieldType) << " " << fieldType->getFieldName();
|
||||
out << getTypeName(*fieldType) << " " << hashName(fieldType->getFieldName());
|
||||
if (fieldType->isArray())
|
||||
out << arrayBrackets(*fieldType);
|
||||
out << ";\n";
|
||||
@ -140,7 +121,7 @@ void TOutputGLSLBase::writeFunctionParameters(const TIntermSequence& args)
|
||||
|
||||
const TString& name = arg->getSymbol();
|
||||
if (!name.empty())
|
||||
out << " " << name;
|
||||
out << " " << hashName(name);
|
||||
if (type.isArray())
|
||||
out << arrayBrackets(type);
|
||||
|
||||
@ -157,7 +138,7 @@ const ConstantUnion* TOutputGLSLBase::writeConstantUnion(const TType& type,
|
||||
|
||||
if (type.getBasicType() == EbtStruct)
|
||||
{
|
||||
out << type.getTypeName() << "(";
|
||||
out << hashName(type.getTypeName()) << "(";
|
||||
const TTypeList* structure = type.getStruct();
|
||||
ASSERT(structure != NULL);
|
||||
for (size_t i = 0; i < structure->size(); ++i)
|
||||
@ -178,7 +159,7 @@ const ConstantUnion* TOutputGLSLBase::writeConstantUnion(const TType& type,
|
||||
{
|
||||
switch (pConstUnion->getType())
|
||||
{
|
||||
case EbtFloat: out << pConstUnion->getFConst(); break;
|
||||
case EbtFloat: out << std::min(FLT_MAX, std::max(-FLT_MAX, pConstUnion->getFConst())); break;
|
||||
case EbtInt: out << pConstUnion->getIConst(); break;
|
||||
case EbtBool: out << pConstUnion->getBConst(); break;
|
||||
default: UNREACHABLE();
|
||||
@ -196,7 +177,7 @@ void TOutputGLSLBase::visitSymbol(TIntermSymbol* node)
|
||||
if (mLoopUnroll.NeedsToReplaceSymbolWithValue(node))
|
||||
out << mLoopUnroll.GetLoopIndexValue(node);
|
||||
else
|
||||
out << node->getSymbol();
|
||||
out << hashVariableName(node->getSymbol());
|
||||
|
||||
if (mDeclaringVariables && node->getType().isArray())
|
||||
out << arrayBrackets(node->getType());
|
||||
@ -235,15 +216,59 @@ bool TOutputGLSLBase::visitBinary(Visit visit, TIntermBinary* node)
|
||||
break;
|
||||
|
||||
case EOpIndexDirect:
|
||||
case EOpIndexIndirect:
|
||||
writeTriplet(visit, NULL, "[", "]");
|
||||
break;
|
||||
case EOpIndexIndirect:
|
||||
if (node->getAddIndexClamp())
|
||||
{
|
||||
if (visit == InVisit)
|
||||
{
|
||||
if (mClampingStrategy == SH_CLAMP_WITH_CLAMP_INTRINSIC) {
|
||||
out << "[int(clamp(float(";
|
||||
} else {
|
||||
out << "[webgl_int_clamp(";
|
||||
}
|
||||
}
|
||||
else if (visit == PostVisit)
|
||||
{
|
||||
int maxSize;
|
||||
TIntermTyped *left = node->getLeft();
|
||||
TType leftType = left->getType();
|
||||
|
||||
if (left->isArray())
|
||||
{
|
||||
// The shader will fail validation if the array length is not > 0.
|
||||
maxSize = leftType.getArraySize() - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
maxSize = leftType.getNominalSize() - 1;
|
||||
}
|
||||
|
||||
if (mClampingStrategy == SH_CLAMP_WITH_CLAMP_INTRINSIC) {
|
||||
out << "), 0.0, float(" << maxSize << ")))]";
|
||||
} else {
|
||||
out << ", 0, " << maxSize << ")]";
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
writeTriplet(visit, NULL, "[", "]");
|
||||
}
|
||||
break;
|
||||
case EOpIndexDirectStruct:
|
||||
if (visit == InVisit)
|
||||
{
|
||||
out << ".";
|
||||
// TODO(alokp): ASSERT
|
||||
out << node->getType().getFieldName();
|
||||
TString fieldName = node->getType().getFieldName();
|
||||
|
||||
const TType& structType = node->getLeft()->getType();
|
||||
if (!mSymbolTable.findBuiltIn(structType.getTypeName()))
|
||||
fieldName = hashName(fieldName);
|
||||
|
||||
out << fieldName;
|
||||
visitChildren = false;
|
||||
}
|
||||
break;
|
||||
@ -467,7 +492,7 @@ bool TOutputGLSLBase::visitAggregate(Visit visit, TIntermAggregate* node)
|
||||
// Function declaration.
|
||||
ASSERT(visit == PreVisit);
|
||||
writeVariableType(node->getType());
|
||||
out << " " << node->getName();
|
||||
out << " " << hashName(node->getName());
|
||||
|
||||
out << "(";
|
||||
writeFunctionParameters(node->getSequence());
|
||||
@ -480,7 +505,7 @@ bool TOutputGLSLBase::visitAggregate(Visit visit, TIntermAggregate* node)
|
||||
// Function definition.
|
||||
ASSERT(visit == PreVisit);
|
||||
writeVariableType(node->getType());
|
||||
out << " " << TFunction::unmangleName(node->getName());
|
||||
out << " " << hashFunctionName(node->getName());
|
||||
|
||||
incrementDepth();
|
||||
// Function definition node contains one or two children nodes
|
||||
@ -510,8 +535,7 @@ bool TOutputGLSLBase::visitAggregate(Visit visit, TIntermAggregate* node)
|
||||
// Function call.
|
||||
if (visit == PreVisit)
|
||||
{
|
||||
TString functionName = TFunction::unmangleName(node->getName());
|
||||
out << functionName << "(";
|
||||
out << hashFunctionName(node->getName()) << "(";
|
||||
}
|
||||
else if (visit == InVisit)
|
||||
{
|
||||
@ -572,7 +596,7 @@ bool TOutputGLSLBase::visitAggregate(Visit visit, TIntermAggregate* node)
|
||||
{
|
||||
const TType& type = node->getType();
|
||||
ASSERT(type.getBasicType() == EbtStruct);
|
||||
out << type.getTypeName() << "(";
|
||||
out << hashName(type.getTypeName()) << "(";
|
||||
}
|
||||
else if (visit == InVisit)
|
||||
{
|
||||
@ -718,3 +742,59 @@ void TOutputGLSLBase::visitCodeBlock(TIntermNode* node) {
|
||||
out << "{\n}\n"; // Empty code block.
|
||||
}
|
||||
}
|
||||
|
||||
TString TOutputGLSLBase::getTypeName(const TType& type)
|
||||
{
|
||||
TInfoSinkBase out;
|
||||
if (type.isMatrix())
|
||||
{
|
||||
out << "mat";
|
||||
out << type.getNominalSize();
|
||||
}
|
||||
else if (type.isVector())
|
||||
{
|
||||
switch (type.getBasicType())
|
||||
{
|
||||
case EbtFloat: out << "vec"; break;
|
||||
case EbtInt: out << "ivec"; break;
|
||||
case EbtBool: out << "bvec"; break;
|
||||
default: UNREACHABLE(); break;
|
||||
}
|
||||
out << type.getNominalSize();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (type.getBasicType() == EbtStruct)
|
||||
out << hashName(type.getTypeName());
|
||||
else
|
||||
out << type.getBasicString();
|
||||
}
|
||||
return TString(out.c_str());
|
||||
}
|
||||
|
||||
TString TOutputGLSLBase::hashName(const TString& name)
|
||||
{
|
||||
if (mHashFunction == NULL || name.empty())
|
||||
return name;
|
||||
NameMap::const_iterator it = mNameMap.find(name.c_str());
|
||||
if (it != mNameMap.end())
|
||||
return it->second.c_str();
|
||||
TString hashedName = TIntermTraverser::hash(name, mHashFunction);
|
||||
mNameMap[name.c_str()] = hashedName.c_str();
|
||||
return hashedName;
|
||||
}
|
||||
|
||||
TString TOutputGLSLBase::hashVariableName(const TString& name)
|
||||
{
|
||||
if (mSymbolTable.findBuiltIn(name) != NULL)
|
||||
return name;
|
||||
return hashName(name);
|
||||
}
|
||||
|
||||
TString TOutputGLSLBase::hashFunctionName(const TString& mangled_name)
|
||||
{
|
||||
TString name = TFunction::unmangleName(mangled_name);
|
||||
if (mSymbolTable.findBuiltIn(mangled_name) != NULL || name == "main")
|
||||
return name;
|
||||
return hashName(name);
|
||||
}
|
||||
|
25
src/3rdparty/angle/src/compiler/OutputGLSLBase.h
vendored
25
src/3rdparty/angle/src/compiler/OutputGLSLBase.h
vendored
@ -16,7 +16,11 @@
|
||||
class TOutputGLSLBase : public TIntermTraverser
|
||||
{
|
||||
public:
|
||||
TOutputGLSLBase(TInfoSinkBase& objSink);
|
||||
TOutputGLSLBase(TInfoSinkBase& objSink,
|
||||
ShArrayIndexClampingStrategy clampingStrategy,
|
||||
ShHashFunction64 hashFunction,
|
||||
NameMap& nameMap,
|
||||
TSymbolTable& symbolTable);
|
||||
|
||||
protected:
|
||||
TInfoSinkBase& objSink() { return mObjSink; }
|
||||
@ -25,6 +29,7 @@ protected:
|
||||
virtual bool writeVariablePrecision(TPrecision precision) = 0;
|
||||
void writeFunctionParameters(const TIntermSequence& args);
|
||||
const ConstantUnion* writeConstantUnion(const TType& type, const ConstantUnion* pConstUnion);
|
||||
TString getTypeName(const TType& type);
|
||||
|
||||
virtual void visitSymbol(TIntermSymbol* node);
|
||||
virtual void visitConstantUnion(TIntermConstantUnion* node);
|
||||
@ -37,6 +42,15 @@ protected:
|
||||
|
||||
void visitCodeBlock(TIntermNode* node);
|
||||
|
||||
|
||||
// Return the original name if hash function pointer is NULL;
|
||||
// otherwise return the hashed name.
|
||||
TString hashName(const TString& name);
|
||||
// Same as hashName(), but without hashing built-in variables.
|
||||
TString hashVariableName(const TString& name);
|
||||
// Same as hashName(), but without hashing built-in functions.
|
||||
TString hashFunctionName(const TString& mangled_name);
|
||||
|
||||
private:
|
||||
TInfoSinkBase& mObjSink;
|
||||
bool mDeclaringVariables;
|
||||
@ -48,6 +62,15 @@ private:
|
||||
DeclaredStructs mDeclaredStructs;
|
||||
|
||||
ForLoopUnroll mLoopUnroll;
|
||||
|
||||
ShArrayIndexClampingStrategy mClampingStrategy;
|
||||
|
||||
// name hashing.
|
||||
ShHashFunction64 mHashFunction;
|
||||
|
||||
NameMap& mNameMap;
|
||||
|
||||
TSymbolTable& mSymbolTable;
|
||||
};
|
||||
|
||||
#endif // CROSSCOMPILERGLSL_OUTPUTGLSLBASE_H_
|
||||
|
1394
src/3rdparty/angle/src/compiler/OutputHLSL.cpp
vendored
1394
src/3rdparty/angle/src/compiler/OutputHLSL.cpp
vendored
File diff suppressed because it is too large
Load Diff
35
src/3rdparty/angle/src/compiler/OutputHLSL.h
vendored
35
src/3rdparty/angle/src/compiler/OutputHLSL.h
vendored
@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
|
||||
// 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.
|
||||
//
|
||||
@ -9,9 +9,14 @@
|
||||
|
||||
#include <list>
|
||||
#include <set>
|
||||
#include <map>
|
||||
|
||||
#define GL_APICALL
|
||||
#include <GLES2/gl2.h>
|
||||
|
||||
#include "compiler/intermediate.h"
|
||||
#include "compiler/ParseHelper.h"
|
||||
#include "compiler/Uniform.h"
|
||||
|
||||
namespace sh
|
||||
{
|
||||
@ -20,14 +25,16 @@ class UnfoldShortCircuit;
|
||||
class OutputHLSL : public TIntermTraverser
|
||||
{
|
||||
public:
|
||||
explicit OutputHLSL(TParseContext &context);
|
||||
OutputHLSL(TParseContext &context, const ShBuiltInResources& resources, ShShaderOutput outputType);
|
||||
~OutputHLSL();
|
||||
|
||||
void output();
|
||||
|
||||
TInfoSinkBase &getBodyStream();
|
||||
const ActiveUniforms &getUniforms();
|
||||
|
||||
TString typeString(const TType &type);
|
||||
TString textureString(const TType &type);
|
||||
static TString qualifierString(TQualifier qualifier);
|
||||
static TString arrayString(const TType &type);
|
||||
static TString initializer(const TType &type);
|
||||
@ -64,6 +71,7 @@ class OutputHLSL : public TIntermTraverser
|
||||
TString structLookup(const TString &typeName);
|
||||
|
||||
TParseContext &mContext;
|
||||
const ShShaderOutput mOutputType;
|
||||
UnfoldShortCircuit *mUnfoldShortCircuit;
|
||||
bool mInsideFunction;
|
||||
|
||||
@ -72,9 +80,10 @@ class OutputHLSL : public TIntermTraverser
|
||||
TInfoSinkBase mBody;
|
||||
TInfoSinkBase mFooter;
|
||||
|
||||
std::set<std::string> mReferencedUniforms;
|
||||
std::set<std::string> mReferencedAttributes;
|
||||
std::set<std::string> mReferencedVaryings;
|
||||
typedef std::map<TString, TIntermSymbol*> ReferencedSymbols;
|
||||
ReferencedSymbols mReferencedUniforms;
|
||||
ReferencedSymbols mReferencedAttributes;
|
||||
ReferencedSymbols mReferencedVaryings;
|
||||
|
||||
// Parameters determining what goes in the header output
|
||||
bool mUsesTexture2D;
|
||||
@ -92,6 +101,8 @@ class OutputHLSL : public TIntermTraverser
|
||||
bool mUsesTexture2DProjLod0_bias;
|
||||
bool mUsesTextureCubeLod0;
|
||||
bool mUsesTextureCubeLod0_bias;
|
||||
bool mUsesFragColor;
|
||||
bool mUsesFragData;
|
||||
bool mUsesDepthRange;
|
||||
bool mUsesFragCoord;
|
||||
bool mUsesPointCoord;
|
||||
@ -126,6 +137,8 @@ class OutputHLSL : public TIntermTraverser
|
||||
bool mUsesAtan2_3;
|
||||
bool mUsesAtan2_4;
|
||||
|
||||
int mNumRenderTargets;
|
||||
|
||||
typedef std::set<TString> Constructors;
|
||||
Constructors mConstructors;
|
||||
|
||||
@ -146,6 +159,18 @@ class OutputHLSL : public TIntermTraverser
|
||||
bool mInsideDiscontinuousLoop;
|
||||
|
||||
TIntermSymbol *mExcessiveLoopIndex;
|
||||
|
||||
int mUniformRegister;
|
||||
int mSamplerRegister;
|
||||
|
||||
TString registerString(TIntermSymbol *operand);
|
||||
int samplerRegister(TIntermSymbol *sampler);
|
||||
int uniformRegister(TIntermSymbol *uniform);
|
||||
void declareUniform(const TType &type, const TString &name, int index);
|
||||
static GLenum glVariableType(const TType &type);
|
||||
static GLenum glVariablePrecision(const TType &type);
|
||||
|
||||
ActiveUniforms mActiveUniforms;
|
||||
};
|
||||
}
|
||||
|
||||
|
17
src/3rdparty/angle/src/compiler/ParseHelper.cpp
vendored
17
src/3rdparty/angle/src/compiler/ParseHelper.cpp
vendored
@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
|
||||
// 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.
|
||||
//
|
||||
@ -10,7 +10,7 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include "compiler/glslang.h"
|
||||
#include "compiler/preprocessor/new/SourceLocation.h"
|
||||
#include "compiler/preprocessor/SourceLocation.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@ -33,7 +33,7 @@ bool TParseContext::parseVectorFields(const TString& compString, int vecSize, TV
|
||||
enum {
|
||||
exyzw,
|
||||
ergba,
|
||||
estpq,
|
||||
estpq
|
||||
} fieldSet[4];
|
||||
|
||||
for (int i = 0; i < fields.num; ++i) {
|
||||
@ -286,7 +286,7 @@ bool TParseContext::lValueErrorCheck(int line, const char* op, TIntermTyped* nod
|
||||
|
||||
for (TIntermSequence::iterator p = aggrNode->getSequence().begin();
|
||||
p != aggrNode->getSequence().end(); p++) {
|
||||
int value = (*p)->getAsTyped()->getAsConstantUnion()->getUnionArrayPointer()->getIConst();
|
||||
int value = (*p)->getAsTyped()->getAsConstantUnion()->getIConst(0);
|
||||
offset[value]++;
|
||||
if (offset[value] > 1) {
|
||||
error(line, " l-value of swizzle cannot have duplicate components", op);
|
||||
@ -493,7 +493,7 @@ bool TParseContext::constructorErrorCheck(int line, TIntermNode* node, TFunction
|
||||
bool overFull = false;
|
||||
bool matrixInMatrix = false;
|
||||
bool arrayArg = false;
|
||||
for (int i = 0; i < function.getParamCount(); ++i) {
|
||||
for (size_t i = 0; i < function.getParamCount(); ++i) {
|
||||
const TParameter& param = function.getParam(i);
|
||||
size += param.type->getObjectSize();
|
||||
|
||||
@ -512,7 +512,7 @@ bool TParseContext::constructorErrorCheck(int line, TIntermNode* node, TFunction
|
||||
if (constType)
|
||||
type->setQualifier(EvqConst);
|
||||
|
||||
if (type->isArray() && type->getArraySize() != function.getParamCount()) {
|
||||
if (type->isArray() && static_cast<size_t>(type->getArraySize()) != function.getParamCount()) {
|
||||
error(line, "array constructor needs one argument per array element", "constructor");
|
||||
return true;
|
||||
}
|
||||
@ -680,7 +680,7 @@ bool TParseContext::arraySizeErrorCheck(int line, TIntermTyped* expr, int& size)
|
||||
return true;
|
||||
}
|
||||
|
||||
size = constant->getUnionArrayPointer()->getIConst();
|
||||
size = constant->getIConst(0);
|
||||
|
||||
if (size <= 0) {
|
||||
error(line, "array size must be a positive integer", "");
|
||||
@ -1313,7 +1313,6 @@ TIntermTyped* TParseContext::addConstVectorNode(TVectorFields& fields, TIntermTy
|
||||
ConstantUnion *unionArray;
|
||||
if (tempConstantNode) {
|
||||
unionArray = tempConstantNode->getUnionArrayPointer();
|
||||
ASSERT(unionArray);
|
||||
|
||||
if (!unionArray) {
|
||||
return node;
|
||||
@ -1507,7 +1506,7 @@ bool TParseContext::structNestingErrorCheck(TSourceLoc line, const TType& fieldT
|
||||
//
|
||||
// Returns 0 for success.
|
||||
//
|
||||
int PaParseStrings(int count, const char* const string[], const int length[],
|
||||
int PaParseStrings(size_t count, const char* const string[], const int length[],
|
||||
TParseContext* context) {
|
||||
if ((count == 0) || (string == NULL))
|
||||
return 1;
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include "compiler/Diagnostics.h"
|
||||
#include "compiler/DirectiveHandler.h"
|
||||
#include "compiler/localintermediate.h"
|
||||
#include "compiler/preprocessor/new/Preprocessor.h"
|
||||
#include "compiler/preprocessor/Preprocessor.h"
|
||||
#include "compiler/ShHandle.h"
|
||||
#include "compiler/SymbolTable.h"
|
||||
|
||||
@ -58,6 +58,7 @@ struct TParseContext {
|
||||
const TType* currentFunctionType; // the return type of the function that's currently being parsed
|
||||
bool functionReturnsValue; // true if a non-void function has a return
|
||||
bool checksPrecisionErrors; // true if an error will be generated when a variable is declared without precision, explicit or implicit.
|
||||
bool fragmentPrecisionHigh; // true if highp precision is supported in the fragment language.
|
||||
TString HashErrMsg;
|
||||
bool AfterEOF;
|
||||
TDiagnostics diagnostics;
|
||||
@ -134,7 +135,7 @@ struct TParseContext {
|
||||
bool structNestingErrorCheck(TSourceLoc line, const TType& fieldType);
|
||||
};
|
||||
|
||||
int PaParseStrings(int count, const char* const string[], const int length[],
|
||||
int PaParseStrings(size_t count, const char* const string[], const int length[],
|
||||
TParseContext* context);
|
||||
|
||||
#endif // _PARSER_HELPER_INCLUDED_
|
||||
|
23
src/3rdparty/angle/src/compiler/ShHandle.h
vendored
23
src/3rdparty/angle/src/compiler/ShHandle.h
vendored
@ -18,13 +18,16 @@
|
||||
|
||||
#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 "third_party/compiler/ArrayBoundsClamper.h"
|
||||
|
||||
class LongNameMap;
|
||||
class TCompiler;
|
||||
class TDependencyGraph;
|
||||
class TranslatorHLSL;
|
||||
|
||||
//
|
||||
// Helper function to identify specs that are based on the WebGL spec,
|
||||
@ -40,6 +43,7 @@ public:
|
||||
TShHandleBase();
|
||||
virtual ~TShHandleBase();
|
||||
virtual TCompiler* getAsCompiler() { return 0; }
|
||||
virtual TranslatorHLSL* getAsTranslatorHLSL() { return 0; }
|
||||
|
||||
protected:
|
||||
// Memory allocator. Allocates and tracks memory required by the compiler.
|
||||
@ -59,7 +63,7 @@ public:
|
||||
|
||||
bool Init(const ShBuiltInResources& resources);
|
||||
bool compile(const char* const shaderStrings[],
|
||||
const int numStrings,
|
||||
size_t numStrings,
|
||||
int compileOptions);
|
||||
|
||||
// Get results of the last compilation.
|
||||
@ -68,6 +72,10 @@ public:
|
||||
const TVariableInfoList& getUniforms() const { return uniforms; }
|
||||
int getMappedNameMaxLength() const;
|
||||
|
||||
ShHashFunction64 getHashFunction() const { return hashFunction; }
|
||||
NameMap& getNameMap() { return nameMap; }
|
||||
TSymbolTable& getSymbolTable() { return symbolTable; }
|
||||
|
||||
protected:
|
||||
ShShaderType getShaderType() const { return shaderType; }
|
||||
ShShaderSpec getShaderSpec() const { return shaderSpec; }
|
||||
@ -100,7 +108,11 @@ protected:
|
||||
bool enforceFragmentShaderTimingRestrictions(const TDependencyGraph& graph);
|
||||
// Get built-in extensions with default behavior.
|
||||
const TExtensionBehavior& getExtensionBehavior() const;
|
||||
// Get the resources set by InitBuiltInSymbolTable
|
||||
const ShBuiltInResources& getResources() const;
|
||||
|
||||
const ArrayBoundsClamper& getArrayBoundsClamper() const;
|
||||
ShArrayIndexClampingStrategy getArrayIndexClampingStrategy() const;
|
||||
const BuiltInFunctionEmulator& getBuiltInFunctionEmulator() const;
|
||||
|
||||
private:
|
||||
@ -109,12 +121,17 @@ private:
|
||||
|
||||
int maxUniformVectors;
|
||||
|
||||
ShBuiltInResources compileResources;
|
||||
|
||||
// Built-in symbol table for the given language, spec, and resources.
|
||||
// It is preserved from compile-to-compile.
|
||||
TSymbolTable symbolTable;
|
||||
// Built-in extensions with default behavior.
|
||||
TExtensionBehavior extensionBehavior;
|
||||
bool fragmentPrecisionHigh;
|
||||
|
||||
ArrayBoundsClamper arrayBoundsClamper;
|
||||
ShArrayIndexClampingStrategy clampingStrategy;
|
||||
BuiltInFunctionEmulator builtInFunctionEmulator;
|
||||
|
||||
// Results of compilation.
|
||||
@ -124,6 +141,10 @@ private:
|
||||
|
||||
// Cached copy of the ref-counted singleton.
|
||||
LongNameMap* longNameMap;
|
||||
|
||||
// name hashing.
|
||||
ShHashFunction64 hashFunction;
|
||||
NameMap nameMap;
|
||||
};
|
||||
|
||||
//
|
||||
|
113
src/3rdparty/angle/src/compiler/ShaderLang.cpp
vendored
113
src/3rdparty/angle/src/compiler/ShaderLang.cpp
vendored
@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved.
|
||||
// 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.
|
||||
//
|
||||
@ -14,6 +14,7 @@
|
||||
#include "compiler/InitializeDll.h"
|
||||
#include "compiler/preprocessor/length_limits.h"
|
||||
#include "compiler/ShHandle.h"
|
||||
#include "compiler/TranslatorHLSL.h"
|
||||
|
||||
//
|
||||
// This is the platform independent interface between an OGL driver
|
||||
@ -21,18 +22,18 @@
|
||||
//
|
||||
|
||||
static bool checkActiveUniformAndAttribMaxLengths(const ShHandle handle,
|
||||
int expectedValue)
|
||||
size_t expectedValue)
|
||||
{
|
||||
int activeUniformLimit = 0;
|
||||
size_t activeUniformLimit = 0;
|
||||
ShGetInfo(handle, SH_ACTIVE_UNIFORM_MAX_LENGTH, &activeUniformLimit);
|
||||
int activeAttribLimit = 0;
|
||||
size_t activeAttribLimit = 0;
|
||||
ShGetInfo(handle, SH_ACTIVE_ATTRIBUTE_MAX_LENGTH, &activeAttribLimit);
|
||||
return (expectedValue == activeUniformLimit && expectedValue == activeAttribLimit);
|
||||
}
|
||||
|
||||
static bool checkMappedNameMaxLength(const ShHandle handle, int expectedValue)
|
||||
static bool checkMappedNameMaxLength(const ShHandle handle, size_t expectedValue)
|
||||
{
|
||||
int mappedNameMaxLength = 0;
|
||||
size_t mappedNameMaxLength = 0;
|
||||
ShGetInfo(handle, SH_MAPPED_NAME_MAX_LENGTH, &mappedNameMaxLength);
|
||||
return (expectedValue == mappedNameMaxLength);
|
||||
}
|
||||
@ -40,7 +41,7 @@ static bool checkMappedNameMaxLength(const ShHandle handle, int expectedValue)
|
||||
static void getVariableInfo(ShShaderInfo varType,
|
||||
const ShHandle handle,
|
||||
int index,
|
||||
int* length,
|
||||
size_t* length,
|
||||
int* size,
|
||||
ShDataType* type,
|
||||
char* name,
|
||||
@ -69,14 +70,14 @@ static void getVariableInfo(ShShaderInfo varType,
|
||||
// This size must match that queried by
|
||||
// SH_ACTIVE_UNIFORM_MAX_LENGTH and SH_ACTIVE_ATTRIBUTE_MAX_LENGTH
|
||||
// in ShGetInfo, below.
|
||||
int activeUniformAndAttribLength = 1 + MAX_SYMBOL_NAME_LEN;
|
||||
size_t activeUniformAndAttribLength = 1 + MAX_SYMBOL_NAME_LEN;
|
||||
ASSERT(checkActiveUniformAndAttribMaxLengths(handle, activeUniformAndAttribLength));
|
||||
strncpy(name, varInfo.name.c_str(), activeUniformAndAttribLength);
|
||||
name[activeUniformAndAttribLength - 1] = 0;
|
||||
if (mappedName) {
|
||||
// This size must match that queried by
|
||||
// SH_MAPPED_NAME_MAX_LENGTH in ShGetInfo, below.
|
||||
int maxMappedNameLength = 1 + MAX_SYMBOL_NAME_LEN;
|
||||
size_t maxMappedNameLength = 1 + MAX_SYMBOL_NAME_LEN;
|
||||
ASSERT(checkMappedNameMaxLength(handle, maxMappedNameLength));
|
||||
strncpy(mappedName, varInfo.mappedName.c_str(), maxMappedNameLength);
|
||||
mappedName[maxMappedNameLength - 1] = 0;
|
||||
@ -125,6 +126,15 @@ void ShInitBuiltInResources(ShBuiltInResources* resources)
|
||||
resources->OES_standard_derivatives = 0;
|
||||
resources->OES_EGL_image_external = 0;
|
||||
resources->ARB_texture_rectangle = 0;
|
||||
resources->EXT_draw_buffers = 0;
|
||||
|
||||
// Disable highp precision in fragment shader by default.
|
||||
resources->FragmentPrecisionHigh = 0;
|
||||
|
||||
// Disable name hashing by default.
|
||||
resources->HashFunction = NULL;
|
||||
|
||||
resources->ArrayIndexClampingStrategy = SH_CLAMP_WITH_CLAMP_INTRINSIC;
|
||||
}
|
||||
|
||||
//
|
||||
@ -172,7 +182,7 @@ void ShDestruct(ShHandle handle)
|
||||
int ShCompile(
|
||||
const ShHandle handle,
|
||||
const char* const shaderStrings[],
|
||||
const int numStrings,
|
||||
size_t numStrings,
|
||||
int compileOptions)
|
||||
{
|
||||
if (!InitThread())
|
||||
@ -190,7 +200,7 @@ int ShCompile(
|
||||
return success ? 1 : 0;
|
||||
}
|
||||
|
||||
void ShGetInfo(const ShHandle handle, ShShaderInfo pname, int* params)
|
||||
void ShGetInfo(const ShHandle handle, ShShaderInfo pname, size_t* params)
|
||||
{
|
||||
if (!handle || !params)
|
||||
return;
|
||||
@ -224,6 +234,22 @@ void ShGetInfo(const ShHandle handle, ShShaderInfo pname, int* params)
|
||||
// handle array and struct dereferences.
|
||||
*params = 1 + MAX_SYMBOL_NAME_LEN;
|
||||
break;
|
||||
case SH_NAME_MAX_LENGTH:
|
||||
*params = 1 + MAX_SYMBOL_NAME_LEN;
|
||||
break;
|
||||
case SH_HASHED_NAME_MAX_LENGTH:
|
||||
if (compiler->getHashFunction() == NULL) {
|
||||
*params = 0;
|
||||
} else {
|
||||
// 64 bits hashing output requires 16 bytes for hex
|
||||
// representation.
|
||||
const char HashedNamePrefix[] = HASHED_NAME_PREFIX;
|
||||
*params = 16 + sizeof(HashedNamePrefix);
|
||||
}
|
||||
break;
|
||||
case SH_HASHED_NAMES_COUNT:
|
||||
*params = compiler->getNameMap().size();
|
||||
break;
|
||||
default: UNREACHABLE();
|
||||
}
|
||||
}
|
||||
@ -262,7 +288,7 @@ void ShGetObjectCode(const ShHandle handle, char* objCode)
|
||||
|
||||
void ShGetActiveAttrib(const ShHandle handle,
|
||||
int index,
|
||||
int* length,
|
||||
size_t* length,
|
||||
int* size,
|
||||
ShDataType* type,
|
||||
char* name,
|
||||
@ -274,7 +300,7 @@ void ShGetActiveAttrib(const ShHandle handle,
|
||||
|
||||
void ShGetActiveUniform(const ShHandle handle,
|
||||
int index,
|
||||
int* length,
|
||||
size_t* length,
|
||||
int* size,
|
||||
ShDataType* type,
|
||||
char* name,
|
||||
@ -283,3 +309,64 @@ void ShGetActiveUniform(const ShHandle handle,
|
||||
getVariableInfo(SH_ACTIVE_UNIFORMS,
|
||||
handle, index, length, size, type, name, mappedName);
|
||||
}
|
||||
|
||||
void ShGetNameHashingEntry(const ShHandle handle,
|
||||
int index,
|
||||
char* name,
|
||||
char* hashedName)
|
||||
{
|
||||
if (!handle || !name || !hashedName || index < 0)
|
||||
return;
|
||||
|
||||
TShHandleBase* base = static_cast<TShHandleBase*>(handle);
|
||||
TCompiler* compiler = base->getAsCompiler();
|
||||
if (!compiler) return;
|
||||
|
||||
const NameMap& nameMap = compiler->getNameMap();
|
||||
if (index >= static_cast<int>(nameMap.size()))
|
||||
return;
|
||||
|
||||
NameMap::const_iterator it = nameMap.begin();
|
||||
for (int i = 0; i < index; ++i)
|
||||
++it;
|
||||
|
||||
size_t len = it->first.length() + 1;
|
||||
size_t max_len = 0;
|
||||
ShGetInfo(handle, SH_NAME_MAX_LENGTH, &max_len);
|
||||
if (len > max_len) {
|
||||
ASSERT(false);
|
||||
len = max_len;
|
||||
}
|
||||
strncpy(name, it->first.c_str(), len);
|
||||
// To be on the safe side in case the source is longer than expected.
|
||||
name[len - 1] = '\0';
|
||||
|
||||
len = it->second.length() + 1;
|
||||
max_len = 0;
|
||||
ShGetInfo(handle, SH_HASHED_NAME_MAX_LENGTH, &max_len);
|
||||
if (len > max_len) {
|
||||
ASSERT(false);
|
||||
len = max_len;
|
||||
}
|
||||
strncpy(hashedName, it->second.c_str(), len);
|
||||
// To be on the safe side in case the source is longer than expected.
|
||||
hashedName[len - 1] = '\0';
|
||||
}
|
||||
|
||||
void ShGetInfoPointer(const ShHandle handle, ShShaderInfo pname, void** params)
|
||||
{
|
||||
if (!handle || !params)
|
||||
return;
|
||||
|
||||
TShHandleBase* base = static_cast<TShHandleBase*>(handle);
|
||||
TranslatorHLSL* translator = base->getAsTranslatorHLSL();
|
||||
if (!translator) return;
|
||||
|
||||
switch(pname)
|
||||
{
|
||||
case SH_ACTIVE_UNIFORMS_ARRAY:
|
||||
*params = (void*)&translator->getUniforms();
|
||||
break;
|
||||
default: UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
16
src/3rdparty/angle/src/compiler/SymbolTable.h
vendored
16
src/3rdparty/angle/src/compiler/SymbolTable.h
vendored
@ -169,8 +169,8 @@ public:
|
||||
void setDefined() { defined = true; }
|
||||
bool isDefined() { return defined; }
|
||||
|
||||
int getParamCount() const { return static_cast<int>(parameters.size()); }
|
||||
const TParameter& getParam(int i) const { return parameters[i]; }
|
||||
size_t getParamCount() const { return parameters.size(); }
|
||||
const TParameter& getParam(size_t i) const { return parameters[i]; }
|
||||
|
||||
virtual void dump(TInfoSink &infoSink) const;
|
||||
TFunction(const TFunction&, TStructureMap& remapper);
|
||||
@ -323,10 +323,16 @@ public:
|
||||
void dump(TInfoSink &infoSink) const;
|
||||
void copyTable(const TSymbolTable& copyOf);
|
||||
|
||||
void setDefaultPrecision( TBasicType type, TPrecision prec ){
|
||||
if( type != EbtFloat && type != EbtInt ) return; // Only set default precision for int/float
|
||||
bool setDefaultPrecision( const TPublicType& type, TPrecision prec ){
|
||||
if (IsSampler(type.type))
|
||||
return true; // Skip sampler types for the time being
|
||||
if (type.type != EbtFloat && type.type != EbtInt)
|
||||
return false; // Only set default precision for int/float
|
||||
if (type.size != 1 || type.matrix || type.array)
|
||||
return false; // Not allowed to set for aggregate types
|
||||
int indexOfLastElement = static_cast<int>(precisionStack.size()) - 1;
|
||||
precisionStack[indexOfLastElement][type] = prec; // Uses map operator [], overwrites the current value
|
||||
precisionStack[indexOfLastElement][type.type] = prec; // Uses map operator [], overwrites the current value
|
||||
return true;
|
||||
}
|
||||
|
||||
// Searches down the precisionStack for a precision qualifier for the specified TBasicType
|
||||
|
@ -22,8 +22,11 @@ void TranslatorESSL::translate(TIntermNode* root) {
|
||||
getBuiltInFunctionEmulator().OutputEmulatedFunctionDefinition(
|
||||
sink, getShaderType() == SH_FRAGMENT_SHADER);
|
||||
|
||||
// Write array bounds clamping emulation if needed.
|
||||
getArrayBoundsClamper().OutputClampingFunctionDefinition(sink);
|
||||
|
||||
// Write translated shader.
|
||||
TOutputESSL outputESSL(sink);
|
||||
TOutputESSL outputESSL(sink, getArrayIndexClampingStrategy(), getHashFunction(), getNameMap(), getSymbolTable());
|
||||
root->traverse(&outputESSL);
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,10 @@ void TranslatorGLSL::translate(TIntermNode* root) {
|
||||
getBuiltInFunctionEmulator().OutputEmulatedFunctionDefinition(
|
||||
sink, false);
|
||||
|
||||
// Write array bounds clamping emulation if needed.
|
||||
getArrayBoundsClamper().OutputClampingFunctionDefinition(sink);
|
||||
|
||||
// Write translated shader.
|
||||
TOutputGLSL outputGLSL(sink);
|
||||
TOutputGLSL outputGLSL(sink, getArrayIndexClampingStrategy(), getHashFunction(), getNameMap(), getSymbolTable());
|
||||
root->traverse(&outputGLSL);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
|
||||
// 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.
|
||||
//
|
||||
@ -9,15 +9,16 @@
|
||||
#include "compiler/InitializeParseContext.h"
|
||||
#include "compiler/OutputHLSL.h"
|
||||
|
||||
TranslatorHLSL::TranslatorHLSL(ShShaderType type, ShShaderSpec spec)
|
||||
: TCompiler(type, spec)
|
||||
TranslatorHLSL::TranslatorHLSL(ShShaderType type, ShShaderSpec spec, ShShaderOutput output)
|
||||
: TCompiler(type, spec), mOutputType(output)
|
||||
{
|
||||
}
|
||||
|
||||
void TranslatorHLSL::translate(TIntermNode *root)
|
||||
{
|
||||
TParseContext& parseContext = *GetGlobalParseContext();
|
||||
sh::OutputHLSL outputHLSL(parseContext);
|
||||
sh::OutputHLSL outputHLSL(parseContext, getResources(), mOutputType);
|
||||
|
||||
outputHLSL.output();
|
||||
mActiveUniforms = outputHLSL.getUniforms();
|
||||
}
|
||||
|
11
src/3rdparty/angle/src/compiler/TranslatorHLSL.h
vendored
11
src/3rdparty/angle/src/compiler/TranslatorHLSL.h
vendored
@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
|
||||
// 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.
|
||||
//
|
||||
@ -8,13 +8,20 @@
|
||||
#define COMPILER_TRANSLATORHLSL_H_
|
||||
|
||||
#include "compiler/ShHandle.h"
|
||||
#include "compiler/Uniform.h"
|
||||
|
||||
class TranslatorHLSL : public TCompiler {
|
||||
public:
|
||||
TranslatorHLSL(ShShaderType type, ShShaderSpec spec);
|
||||
TranslatorHLSL(ShShaderType type, ShShaderSpec spec, ShShaderOutput output);
|
||||
|
||||
virtual TranslatorHLSL *getAsTranslatorHLSL() { return this; }
|
||||
const sh::ActiveUniforms &getUniforms() { return mActiveUniforms; }
|
||||
|
||||
protected:
|
||||
virtual void translate(TIntermNode* root);
|
||||
|
||||
sh::ActiveUniforms mActiveUniforms;
|
||||
ShShaderOutput mOutputType;
|
||||
};
|
||||
|
||||
#endif // COMPILER_TRANSLATORHLSL_H_
|
||||
|
37
src/3rdparty/angle/src/compiler/Types.h
vendored
37
src/3rdparty/angle/src/compiler/Types.h
vendored
@ -136,6 +136,43 @@ public:
|
||||
return totalSize;
|
||||
}
|
||||
|
||||
int elementRegisterCount() const
|
||||
{
|
||||
TTypeList *structure = getStruct();
|
||||
|
||||
if (structure)
|
||||
{
|
||||
int registerCount = 0;
|
||||
|
||||
for (size_t i = 0; i < structure->size(); i++)
|
||||
{
|
||||
registerCount += (*structure)[i].type->totalRegisterCount();
|
||||
}
|
||||
|
||||
return registerCount;
|
||||
}
|
||||
else if (isMatrix())
|
||||
{
|
||||
return getNominalSize();
|
||||
}
|
||||
else
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
int totalRegisterCount() const
|
||||
{
|
||||
if (array)
|
||||
{
|
||||
return arraySize * elementRegisterCount();
|
||||
}
|
||||
else
|
||||
{
|
||||
return elementRegisterCount();
|
||||
}
|
||||
}
|
||||
|
||||
bool isMatrix() const { return matrix ? true : false; }
|
||||
void setMatrix(bool m) { matrix = m; }
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
|
||||
// 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.
|
||||
//
|
||||
@ -95,9 +95,9 @@ bool UnfoldShortCircuit::visitBinary(Visit visit, TIntermBinary *node)
|
||||
mTemporaryIndex = i + 1;
|
||||
}
|
||||
return false;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool UnfoldShortCircuit::visitSelection(Visit visit, TIntermSelection *node)
|
||||
@ -111,6 +111,8 @@ bool UnfoldShortCircuit::visitSelection(Visit visit, TIntermSelection *node)
|
||||
|
||||
out << mOutputHLSL->typeString(node->getType()) << " s" << i << ";\n";
|
||||
|
||||
out << "{\n";
|
||||
|
||||
mTemporaryIndex = i + 1;
|
||||
node->getCondition()->traverse(this);
|
||||
out << "if(";
|
||||
@ -135,6 +137,8 @@ bool UnfoldShortCircuit::visitSelection(Visit visit, TIntermSelection *node)
|
||||
out << ";\n"
|
||||
"}\n";
|
||||
|
||||
out << "}\n";
|
||||
|
||||
mTemporaryIndex = i + 1;
|
||||
}
|
||||
|
||||
|
21
src/3rdparty/angle/src/compiler/Uniform.cpp
vendored
Normal file
21
src/3rdparty/angle/src/compiler/Uniform.cpp
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
//
|
||||
// Copyright (c) 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/Uniform.h"
|
||||
|
||||
namespace sh
|
||||
{
|
||||
|
||||
Uniform::Uniform(GLenum type, GLenum precision, const char *name, int arraySize, int registerIndex)
|
||||
{
|
||||
this->type = type;
|
||||
this->precision = precision;
|
||||
this->name = name;
|
||||
this->arraySize = arraySize;
|
||||
this->registerIndex = registerIndex;
|
||||
}
|
||||
|
||||
}
|
35
src/3rdparty/angle/src/compiler/Uniform.h
vendored
Normal file
35
src/3rdparty/angle/src/compiler/Uniform.h
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
//
|
||||
// Copyright (c) 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_UNIFORM_H_
|
||||
#define COMPILER_UNIFORM_H_
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#define GL_APICALL
|
||||
#include <GLES2/gl2.h>
|
||||
|
||||
namespace sh
|
||||
{
|
||||
|
||||
struct Uniform
|
||||
{
|
||||
Uniform(GLenum type, GLenum precision, const char *name, int arraySize, int registerIndex);
|
||||
|
||||
GLenum type;
|
||||
GLenum precision;
|
||||
std::string name;
|
||||
unsigned int arraySize;
|
||||
|
||||
int registerIndex;
|
||||
};
|
||||
|
||||
typedef std::vector<Uniform> ActiveUniforms;
|
||||
|
||||
}
|
||||
|
||||
#endif // COMPILER_UNIFORM_H_
|
@ -421,7 +421,7 @@ bool ValidateLimitations::validateFunctionCall(TIntermAggregate* node)
|
||||
return true;
|
||||
|
||||
// List of param indices for which loop indices are used as argument.
|
||||
typedef std::vector<int> ParamIndex;
|
||||
typedef std::vector<size_t> ParamIndex;
|
||||
ParamIndex pIndex;
|
||||
TIntermSequence& params = node->getSequence();
|
||||
for (TIntermSequence::size_type i = 0; i < params.size(); ++i) {
|
||||
|
34
src/3rdparty/angle/src/compiler/VariableInfo.cpp
vendored
34
src/3rdparty/angle/src/compiler/VariableInfo.cpp
vendored
@ -77,23 +77,25 @@ static void getBuiltInVariableInfo(const TType& type,
|
||||
static void getUserDefinedVariableInfo(const TType& type,
|
||||
const TString& name,
|
||||
const TString& mappedName,
|
||||
TVariableInfoList& infoList);
|
||||
TVariableInfoList& infoList,
|
||||
ShHashFunction64 hashFunction);
|
||||
|
||||
// Returns info for an attribute or uniform.
|
||||
static void getVariableInfo(const TType& type,
|
||||
const TString& name,
|
||||
const TString& mappedName,
|
||||
TVariableInfoList& infoList)
|
||||
TVariableInfoList& infoList,
|
||||
ShHashFunction64 hashFunction)
|
||||
{
|
||||
if (type.getBasicType() == EbtStruct) {
|
||||
if (type.isArray()) {
|
||||
for (int i = 0; i < type.getArraySize(); ++i) {
|
||||
TString lname = name + arrayBrackets(i);
|
||||
TString lmappedName = mappedName + arrayBrackets(i);
|
||||
getUserDefinedVariableInfo(type, lname, lmappedName, infoList);
|
||||
getUserDefinedVariableInfo(type, lname, lmappedName, infoList, hashFunction);
|
||||
}
|
||||
} else {
|
||||
getUserDefinedVariableInfo(type, name, mappedName, infoList);
|
||||
getUserDefinedVariableInfo(type, name, mappedName, infoList, hashFunction);
|
||||
}
|
||||
} else {
|
||||
getBuiltInVariableInfo(type, name, mappedName, infoList);
|
||||
@ -124,7 +126,8 @@ void getBuiltInVariableInfo(const TType& type,
|
||||
void getUserDefinedVariableInfo(const TType& type,
|
||||
const TString& name,
|
||||
const TString& mappedName,
|
||||
TVariableInfoList& infoList)
|
||||
TVariableInfoList& infoList,
|
||||
ShHashFunction64 hashFunction)
|
||||
{
|
||||
ASSERT(type.getBasicType() == EbtStruct);
|
||||
|
||||
@ -133,8 +136,9 @@ void getUserDefinedVariableInfo(const TType& type,
|
||||
const TType* fieldType = (*structure)[i].type;
|
||||
getVariableInfo(*fieldType,
|
||||
name + "." + fieldType->getFieldName(),
|
||||
mappedName + "." + fieldType->getFieldName(),
|
||||
infoList);
|
||||
mappedName + "." + TIntermTraverser::hash(fieldType->getFieldName(), hashFunction),
|
||||
infoList,
|
||||
hashFunction);
|
||||
}
|
||||
}
|
||||
|
||||
@ -149,9 +153,11 @@ TVariableInfo::TVariableInfo(ShDataType type, int size)
|
||||
}
|
||||
|
||||
CollectAttribsUniforms::CollectAttribsUniforms(TVariableInfoList& attribs,
|
||||
TVariableInfoList& uniforms)
|
||||
TVariableInfoList& uniforms,
|
||||
ShHashFunction64 hashFunction)
|
||||
: mAttribs(attribs),
|
||||
mUniforms(uniforms)
|
||||
mUniforms(uniforms),
|
||||
mHashFunction(hashFunction)
|
||||
{
|
||||
}
|
||||
|
||||
@ -206,10 +212,16 @@ bool CollectAttribsUniforms::visitAggregate(Visit, TIntermAggregate* node)
|
||||
// cannot be initialized in a shader, we must have only
|
||||
// TIntermSymbol nodes in the sequence.
|
||||
ASSERT(variable != NULL);
|
||||
TString processedSymbol;
|
||||
if (mHashFunction == NULL)
|
||||
processedSymbol = variable->getSymbol();
|
||||
else
|
||||
processedSymbol = TIntermTraverser::hash(variable->getOriginalSymbol(), mHashFunction);
|
||||
getVariableInfo(variable->getType(),
|
||||
variable->getOriginalSymbol(),
|
||||
variable->getSymbol(),
|
||||
infoList);
|
||||
processedSymbol,
|
||||
infoList,
|
||||
mHashFunction);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -27,7 +27,8 @@ typedef std::vector<TVariableInfo> TVariableInfoList;
|
||||
class CollectAttribsUniforms : public TIntermTraverser {
|
||||
public:
|
||||
CollectAttribsUniforms(TVariableInfoList& attribs,
|
||||
TVariableInfoList& uniforms);
|
||||
TVariableInfoList& uniforms,
|
||||
ShHashFunction64 hashFunction);
|
||||
|
||||
virtual void visitSymbol(TIntermSymbol*);
|
||||
virtual void visitConstantUnion(TIntermConstantUnion*);
|
||||
@ -41,6 +42,8 @@ public:
|
||||
private:
|
||||
TVariableInfoList& mAttribs;
|
||||
TVariableInfoList& mUniforms;
|
||||
|
||||
ShHashFunction64 mHashFunction;
|
||||
};
|
||||
|
||||
#endif // COMPILER_VARIABLE_INFO_H_
|
||||
|
@ -85,7 +85,7 @@ int VariablePacker::GetNumRows(ShDataType type)
|
||||
case SH_FLOAT_MAT3:
|
||||
return 3;
|
||||
case SH_FLOAT_MAT2:
|
||||
return 1;
|
||||
return 2;
|
||||
case SH_FLOAT_VEC4:
|
||||
case SH_INT_VEC4:
|
||||
case SH_BOOL_VEC4:
|
||||
|
2
src/3rdparty/angle/src/compiler/glslang.h
vendored
2
src/3rdparty/angle/src/compiler/glslang.h
vendored
@ -8,7 +8,7 @@ struct TParseContext;
|
||||
extern int glslang_initialize(TParseContext* context);
|
||||
extern int glslang_finalize(TParseContext* context);
|
||||
|
||||
extern int glslang_scan(int count,
|
||||
extern int glslang_scan(size_t count,
|
||||
const char* const string[],
|
||||
const int length[],
|
||||
TParseContext* context);
|
||||
|
170
src/3rdparty/angle/src/compiler/glslang.l
vendored
170
src/3rdparty/angle/src/compiler/glslang.l
vendored
@ -38,7 +38,7 @@ WHICH GENERATES THE GLSL ES LEXER (glslang_lex.cpp).
|
||||
%{
|
||||
#include "compiler/glslang.h"
|
||||
#include "compiler/ParseHelper.h"
|
||||
#include "compiler/preprocessor/new/Token.h"
|
||||
#include "compiler/preprocessor/Token.h"
|
||||
#include "compiler/util.h"
|
||||
#include "glslang_tab.h"
|
||||
|
||||
@ -51,7 +51,7 @@ WHICH GENERATES THE GLSL ES LEXER (glslang_lex.cpp).
|
||||
#define YY_INPUT(buf, result, max_size) \
|
||||
result = string_input(buf, max_size, yyscanner);
|
||||
|
||||
static int string_input(char* buf, int max_size, yyscan_t yyscanner);
|
||||
static yy_size_t string_input(char* buf, yy_size_t max_size, yyscan_t yyscanner);
|
||||
static int check_type(yyscan_t yyscanner);
|
||||
static int reserved_word(yyscan_t yyscanner);
|
||||
%}
|
||||
@ -203,10 +203,10 @@ O [0-7]
|
||||
return check_type(yyscanner);
|
||||
}
|
||||
|
||||
0[xX]{H}+ { yylval->lex.i = strtol(yytext, 0, 0); return(INTCONSTANT); }
|
||||
0{O}+ { yylval->lex.i = strtol(yytext, 0, 0); return(INTCONSTANT); }
|
||||
0[xX]{H}+ { yylval->lex.i = static_cast<int>(strtol(yytext, 0, 0)); return(INTCONSTANT); }
|
||||
0{O}+ { yylval->lex.i = static_cast<int>(strtol(yytext, 0, 0)); return(INTCONSTANT); }
|
||||
0{D}+ { context->error(yylineno, "Invalid Octal number.", yytext); context->recover(); return 0;}
|
||||
{D}+ { yylval->lex.i = strtol(yytext, 0, 0); return(INTCONSTANT); }
|
||||
{D}+ { yylval->lex.i = static_cast<int>(strtol(yytext, 0, 0)); return(INTCONSTANT); }
|
||||
|
||||
{D}+{E} { yylval->lex.f = static_cast<float>(atof_dot(yytext)); return(FLOATCONSTANT); }
|
||||
{D}+"."{D}*({E})? { yylval->lex.f = static_cast<float>(atof_dot(yytext)); return(FLOATCONSTANT); }
|
||||
@ -272,146 +272,13 @@ O [0-7]
|
||||
|
||||
%%
|
||||
|
||||
// Old preprocessor interface.
|
||||
extern "C" {
|
||||
#include "compiler/preprocessor/preprocess.h"
|
||||
|
||||
extern int InitPreprocessor();
|
||||
extern int FinalizePreprocessor();
|
||||
extern void PredefineIntMacro(const char *name, int value);
|
||||
|
||||
#define SETUP_CONTEXT(pp) \
|
||||
TParseContext* context = (TParseContext*) pp->pC; \
|
||||
struct yyguts_t* yyg = (struct yyguts_t*) context->scanner;
|
||||
|
||||
// Preprocessor callbacks.
|
||||
void CPPDebugLogMsg(const char *msg)
|
||||
{
|
||||
SETUP_CONTEXT(cpp);
|
||||
context->trace(msg);
|
||||
}
|
||||
|
||||
void CPPWarningToInfoLog(const char *msg)
|
||||
{
|
||||
SETUP_CONTEXT(cpp);
|
||||
context->warning(yylineno, msg, "");
|
||||
}
|
||||
|
||||
void CPPShInfoLogMsg(const char *msg)
|
||||
{
|
||||
SETUP_CONTEXT(cpp);
|
||||
context->error(yylineno, msg, "");
|
||||
context->recover();
|
||||
}
|
||||
|
||||
void CPPErrorToInfoLog(const char *msg)
|
||||
{
|
||||
SETUP_CONTEXT(cpp);
|
||||
context->error(yylineno, msg, "");
|
||||
context->recover();
|
||||
}
|
||||
|
||||
void SetLineNumber(int line)
|
||||
{
|
||||
SETUP_CONTEXT(cpp);
|
||||
int string = 0;
|
||||
DecodeSourceLoc(yylineno, &string, NULL);
|
||||
yylineno = EncodeSourceLoc(string, line);
|
||||
}
|
||||
|
||||
void SetStringNumber(int string)
|
||||
{
|
||||
SETUP_CONTEXT(cpp);
|
||||
int line = 0;
|
||||
DecodeSourceLoc(yylineno, NULL, &line);
|
||||
yylineno = EncodeSourceLoc(string, line);
|
||||
}
|
||||
|
||||
int GetStringNumber()
|
||||
{
|
||||
SETUP_CONTEXT(cpp);
|
||||
int string = 0;
|
||||
DecodeSourceLoc(yylineno, &string, NULL);
|
||||
return string;
|
||||
}
|
||||
|
||||
int GetLineNumber()
|
||||
{
|
||||
SETUP_CONTEXT(cpp);
|
||||
int line = 0;
|
||||
DecodeSourceLoc(yylineno, NULL, &line);
|
||||
return line;
|
||||
}
|
||||
|
||||
void IncLineNumber()
|
||||
{
|
||||
SETUP_CONTEXT(cpp);
|
||||
int string = 0, line = 0;
|
||||
DecodeSourceLoc(yylineno, &string, &line);
|
||||
yylineno = EncodeSourceLoc(string, ++line);
|
||||
}
|
||||
|
||||
void DecLineNumber()
|
||||
{
|
||||
SETUP_CONTEXT(cpp);
|
||||
int string = 0, line = 0;
|
||||
DecodeSourceLoc(yylineno, &string, &line);
|
||||
yylineno = EncodeSourceLoc(string, --line);
|
||||
}
|
||||
|
||||
void HandlePragma(const char **tokens, int numTokens)
|
||||
{
|
||||
SETUP_CONTEXT(cpp);
|
||||
|
||||
if (numTokens != 4) return;
|
||||
if (strcmp(tokens[1], "(") != 0) return;
|
||||
if (strcmp(tokens[3], ")") != 0) return;
|
||||
|
||||
context->handlePragmaDirective(yylineno, tokens[0], tokens[2]);
|
||||
}
|
||||
|
||||
void StoreStr(const char *string)
|
||||
{
|
||||
SETUP_CONTEXT(cpp);
|
||||
TString strSrc;
|
||||
strSrc = TString(string);
|
||||
|
||||
context->HashErrMsg = context->HashErrMsg + " " + strSrc;
|
||||
}
|
||||
|
||||
const char* GetStrfromTStr(void)
|
||||
{
|
||||
SETUP_CONTEXT(cpp);
|
||||
cpp->ErrMsg = context->HashErrMsg.c_str();
|
||||
return cpp->ErrMsg;
|
||||
}
|
||||
|
||||
void ResetTString(void)
|
||||
{
|
||||
SETUP_CONTEXT(cpp);
|
||||
context->HashErrMsg = "";
|
||||
}
|
||||
|
||||
void updateExtensionBehavior(const char* extName, const char* behavior)
|
||||
{
|
||||
SETUP_CONTEXT(cpp);
|
||||
context->handleExtensionDirective(yylineno, extName, behavior);
|
||||
}
|
||||
} // extern "C"
|
||||
|
||||
int string_input(char* buf, int max_size, yyscan_t yyscanner) {
|
||||
int len = 0;
|
||||
|
||||
#if ANGLE_USE_NEW_PREPROCESSOR
|
||||
yy_size_t string_input(char* buf, yy_size_t max_size, yyscan_t yyscanner) {
|
||||
pp::Token token;
|
||||
yyget_extra(yyscanner)->preprocessor.lex(&token);
|
||||
len = token.type == pp::Token::LAST ? 0 : token.text.size();
|
||||
if ((len > 0) && (len < max_size))
|
||||
yy_size_t len = token.type == pp::Token::LAST ? 0 : token.text.size();
|
||||
if (len < max_size)
|
||||
memcpy(buf, token.text.c_str(), len);
|
||||
yyset_lineno(EncodeSourceLoc(token.location.file, token.location.line), yyscanner);
|
||||
#else
|
||||
len = yylex_CPP(buf, max_size);
|
||||
#endif // ANGLE_USE_NEW_PREPROCESSOR
|
||||
|
||||
if (len >= max_size)
|
||||
YY_FATAL_ERROR("Input buffer overflow");
|
||||
@ -471,41 +338,28 @@ int glslang_finalize(TParseContext* context) {
|
||||
context->scanner = NULL;
|
||||
yylex_destroy(scanner);
|
||||
|
||||
#if !ANGLE_USE_NEW_PREPROCESSOR
|
||||
FinalizePreprocessor();
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
int glslang_scan(int count, const char* const string[], const int length[],
|
||||
int glslang_scan(size_t count, const char* const string[], const int length[],
|
||||
TParseContext* context) {
|
||||
yyrestart(NULL, context->scanner);
|
||||
yyset_lineno(EncodeSourceLoc(0, 1), context->scanner);
|
||||
context->AfterEOF = false;
|
||||
|
||||
// Initialize preprocessor.
|
||||
#if ANGLE_USE_NEW_PREPROCESSOR
|
||||
if (!context->preprocessor.init(count, string, length))
|
||||
return 1;
|
||||
#else
|
||||
if (InitPreprocessor())
|
||||
return 1;
|
||||
cpp->pC = context;
|
||||
cpp->pastFirstStatement = 0;
|
||||
if (InitScannerInput(cpp, count, string, length))
|
||||
return 1;
|
||||
#endif // ANGLE_USE_NEW_PREPROCESSOR
|
||||
|
||||
// Define extension macros.
|
||||
const TExtensionBehavior& extBehavior = context->extensionBehavior();
|
||||
for (TExtensionBehavior::const_iterator iter = extBehavior.begin();
|
||||
iter != extBehavior.end(); ++iter) {
|
||||
#if ANGLE_USE_NEW_PREPROCESSOR
|
||||
context->preprocessor.predefineMacro(iter->first.c_str(), 1);
|
||||
#else
|
||||
PredefineIntMacro(iter->first.c_str(), 1);
|
||||
#endif
|
||||
}
|
||||
if (context->fragmentPrecisionHigh)
|
||||
context->preprocessor.predefineMacro("GL_FRAGMENT_PRECISION_HIGH", 1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
41
src/3rdparty/angle/src/compiler/glslang.y
vendored
41
src/3rdparty/angle/src/compiler/glslang.y
vendored
@ -1,6 +1,6 @@
|
||||
/*
|
||||
//
|
||||
// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
|
||||
// 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.
|
||||
//
|
||||
@ -38,6 +38,9 @@ WHICH GENERATES THE GLSL ES PARSER (glslang_tab.cpp AND glslang_tab.h).
|
||||
#include "compiler/ParseHelper.h"
|
||||
#include "GLSLANG/ShaderLang.h"
|
||||
|
||||
#define YYENABLE_NLS 0
|
||||
#define YYLTYPE_IS_TRIVIAL 1
|
||||
|
||||
#define YYLEX_PARAM context->scanner
|
||||
%}
|
||||
|
||||
@ -242,36 +245,36 @@ postfix_expression
|
||||
}
|
||||
if ($1->getType().getQualifier() == EvqConst && $3->getQualifier() == EvqConst) {
|
||||
if ($1->isArray()) { // constant folding for arrays
|
||||
$$ = context->addConstArrayNode($3->getAsConstantUnion()->getUnionArrayPointer()->getIConst(), $1, $2.line);
|
||||
$$ = context->addConstArrayNode($3->getAsConstantUnion()->getIConst(0), $1, $2.line);
|
||||
} else if ($1->isVector()) { // constant folding for vectors
|
||||
TVectorFields fields;
|
||||
fields.num = 1;
|
||||
fields.offsets[0] = $3->getAsConstantUnion()->getUnionArrayPointer()->getIConst(); // need to do it this way because v.xy sends fields integer array
|
||||
fields.offsets[0] = $3->getAsConstantUnion()->getIConst(0); // need to do it this way because v.xy sends fields integer array
|
||||
$$ = context->addConstVectorNode(fields, $1, $2.line);
|
||||
} else if ($1->isMatrix()) { // constant folding for matrices
|
||||
$$ = context->addConstMatrixNode($3->getAsConstantUnion()->getUnionArrayPointer()->getIConst(), $1, $2.line);
|
||||
$$ = context->addConstMatrixNode($3->getAsConstantUnion()->getIConst(0), $1, $2.line);
|
||||
}
|
||||
} else {
|
||||
if ($3->getQualifier() == EvqConst) {
|
||||
if (($1->isVector() || $1->isMatrix()) && $1->getType().getNominalSize() <= $3->getAsConstantUnion()->getUnionArrayPointer()->getIConst() && !$1->isArray() ) {
|
||||
if (($1->isVector() || $1->isMatrix()) && $1->getType().getNominalSize() <= $3->getAsConstantUnion()->getIConst(0) && !$1->isArray() ) {
|
||||
std::stringstream extraInfoStream;
|
||||
extraInfoStream << "field selection out of range '" << $3->getAsConstantUnion()->getUnionArrayPointer()->getIConst() << "'";
|
||||
extraInfoStream << "field selection out of range '" << $3->getAsConstantUnion()->getIConst(0) << "'";
|
||||
std::string extraInfo = extraInfoStream.str();
|
||||
context->error($2.line, "", "[", extraInfo.c_str());
|
||||
context->recover();
|
||||
} else {
|
||||
if ($1->isArray()) {
|
||||
if ($1->getType().getArraySize() == 0) {
|
||||
if ($1->getType().getMaxArraySize() <= $3->getAsConstantUnion()->getUnionArrayPointer()->getIConst()) {
|
||||
if (context->arraySetMaxSize($1->getAsSymbolNode(), $1->getTypePointer(), $3->getAsConstantUnion()->getUnionArrayPointer()->getIConst(), true, $2.line))
|
||||
if ($1->getType().getMaxArraySize() <= $3->getAsConstantUnion()->getIConst(0)) {
|
||||
if (context->arraySetMaxSize($1->getAsSymbolNode(), $1->getTypePointer(), $3->getAsConstantUnion()->getIConst(0), true, $2.line))
|
||||
context->recover();
|
||||
} else {
|
||||
if (context->arraySetMaxSize($1->getAsSymbolNode(), $1->getTypePointer(), 0, false, $2.line))
|
||||
context->recover();
|
||||
}
|
||||
} else if ( $3->getAsConstantUnion()->getUnionArrayPointer()->getIConst() >= $1->getType().getArraySize()) {
|
||||
} else if ( $3->getAsConstantUnion()->getIConst(0) >= $1->getType().getArraySize()) {
|
||||
std::stringstream extraInfoStream;
|
||||
extraInfoStream << "array index out of range '" << $3->getAsConstantUnion()->getUnionArrayPointer()->getIConst() << "'";
|
||||
extraInfoStream << "array index out of range '" << $3->getAsConstantUnion()->getIConst(0) << "'";
|
||||
std::string extraInfo = extraInfoStream.str();
|
||||
context->error($2.line, "", "[", extraInfo.c_str());
|
||||
context->recover();
|
||||
@ -521,7 +524,7 @@ function_call
|
||||
$$->getAsAggregate()->setName(fnCandidate->getMangledName());
|
||||
|
||||
TQualifier qual;
|
||||
for (int i = 0; i < fnCandidate->getParamCount(); ++i) {
|
||||
for (size_t i = 0; i < fnCandidate->getParamCount(); ++i) {
|
||||
qual = fnCandidate->getParam(i).type->getQualifier();
|
||||
if (qual == EvqOut || qual == EvqInOut) {
|
||||
if (context->lValueErrorCheck($$->getLine(), "assign", $$->getAsAggregate()->getSequence()[i]->getAsTyped())) {
|
||||
@ -962,7 +965,7 @@ declaration
|
||||
prototype->setType(function.getReturnType());
|
||||
prototype->setName(function.getName());
|
||||
|
||||
for (int i = 0; i < function.getParamCount(); i++)
|
||||
for (size_t i = 0; i < function.getParamCount(); i++)
|
||||
{
|
||||
const TParameter ¶m = function.getParam(i);
|
||||
if (param.name != 0)
|
||||
@ -988,7 +991,14 @@ declaration
|
||||
$$ = $1.intermAggregate;
|
||||
}
|
||||
| PRECISION precision_qualifier type_specifier_no_prec SEMICOLON {
|
||||
context->symbolTable.setDefaultPrecision( $3.type, $2 );
|
||||
if (($2 == EbpHigh) && (context->shaderType == SH_FRAGMENT_SHADER) && !context->fragmentPrecisionHigh) {
|
||||
context->error($1.line, "precision is not supported in fragment shader", "highp");
|
||||
context->recover();
|
||||
}
|
||||
if (!context->symbolTable.setDefaultPrecision( $3, $2 )) {
|
||||
context->error($1.line, "illegal type argument for default precision qualifier", getBasicString($3.type));
|
||||
context->recover();
|
||||
}
|
||||
$$ = 0;
|
||||
}
|
||||
;
|
||||
@ -1009,7 +1019,7 @@ function_prototype
|
||||
context->error($2.line, "overloaded functions must have the same return type", $1->getReturnType().getBasicString());
|
||||
context->recover();
|
||||
}
|
||||
for (int i = 0; i < prevDec->getParamCount(); ++i) {
|
||||
for (size_t i = 0; i < prevDec->getParamCount(); ++i) {
|
||||
if (prevDec->getParam(i).type->getQualifier() != $1->getParam(i).type->getQualifier()) {
|
||||
context->error($2.line, "overloaded functions must have the same parameter qualifiers", $1->getParam(i).type->getQualifierString());
|
||||
context->recover();
|
||||
@ -2079,7 +2089,7 @@ function_definition
|
||||
// knows where to find parameters.
|
||||
//
|
||||
TIntermAggregate* paramNodes = new TIntermAggregate;
|
||||
for (int i = 0; i < function->getParamCount(); i++) {
|
||||
for (size_t i = 0; i < function->getParamCount(); i++) {
|
||||
const TParameter& param = function->getParam(i);
|
||||
if (param.name != 0) {
|
||||
TVariable *variable = new TVariable(param.name, *param.type);
|
||||
@ -2139,4 +2149,3 @@ function_definition
|
||||
int glslang_parse(TParseContext* context) {
|
||||
return yyparse(context);
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,7 @@ TString TType::getCompleteString() const
|
||||
if (qualifier != EvqTemporary && qualifier != EvqGlobal)
|
||||
stream << getQualifierString() << " " << getPrecisionString() << " ";
|
||||
if (array)
|
||||
stream << "array of ";
|
||||
stream << "array[" << getArraySize() << "] of ";
|
||||
if (matrix)
|
||||
stream << size << "X" << size << " matrix of ";
|
||||
else if (size > 1)
|
||||
|
29
src/3rdparty/angle/src/compiler/intermediate.h
vendored
29
src/3rdparty/angle/src/compiler/intermediate.h
vendored
@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
|
||||
// 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.
|
||||
//
|
||||
@ -16,6 +16,8 @@
|
||||
#ifndef __INTERMEDIATE_H
|
||||
#define __INTERMEDIATE_H
|
||||
|
||||
#include "GLSLANG/ShaderLang.h"
|
||||
|
||||
#include "compiler/Common.h"
|
||||
#include "compiler/Types.h"
|
||||
#include "compiler/ConstantUnion.h"
|
||||
@ -181,7 +183,7 @@ enum TOperator {
|
||||
EOpVectorTimesScalarAssign,
|
||||
EOpMatrixTimesScalarAssign,
|
||||
EOpMatrixTimesMatrixAssign,
|
||||
EOpDivAssign,
|
||||
EOpDivAssign
|
||||
};
|
||||
|
||||
extern const char* getOperatorString(TOperator op);
|
||||
@ -257,6 +259,10 @@ public:
|
||||
const char* getQualifierString() const { return type.getQualifierString(); }
|
||||
TString getCompleteString() const { return type.getCompleteString(); }
|
||||
|
||||
int totalRegisterCount() const { return type.totalRegisterCount(); }
|
||||
int elementRegisterCount() const { return type.elementRegisterCount(); }
|
||||
int getArraySize() const { return type.getArraySize(); }
|
||||
|
||||
protected:
|
||||
TType type;
|
||||
};
|
||||
@ -267,7 +273,7 @@ protected:
|
||||
enum TLoopType {
|
||||
ELoopFor,
|
||||
ELoopWhile,
|
||||
ELoopDoWhile,
|
||||
ELoopDoWhile
|
||||
};
|
||||
|
||||
class TIntermLoop : public TIntermNode {
|
||||
@ -356,7 +362,10 @@ public:
|
||||
TIntermConstantUnion(ConstantUnion *unionPointer, const TType& t) : TIntermTyped(t), unionArrayPointer(unionPointer) { }
|
||||
|
||||
ConstantUnion* getUnionArrayPointer() const { return unionArrayPointer; }
|
||||
void setUnionArrayPointer(ConstantUnion *c) { unionArrayPointer = c; }
|
||||
|
||||
int getIConst(int index) const { return unionArrayPointer ? unionArrayPointer[index].getIConst() : 0; }
|
||||
float getFConst(int index) const { return unionArrayPointer ? unionArrayPointer[index].getFConst() : 0.0f; }
|
||||
bool getBConst(int index) const { return unionArrayPointer ? unionArrayPointer[index].getBConst() : false; }
|
||||
|
||||
virtual TIntermConstantUnion* getAsConstantUnion() { return this; }
|
||||
virtual void traverse(TIntermTraverser*);
|
||||
@ -389,7 +398,7 @@ protected:
|
||||
//
|
||||
class TIntermBinary : public TIntermOperator {
|
||||
public:
|
||||
TIntermBinary(TOperator o) : TIntermOperator(o) {}
|
||||
TIntermBinary(TOperator o) : TIntermOperator(o), addIndexClamp(false) {}
|
||||
|
||||
virtual TIntermBinary* getAsBinaryNode() { return this; }
|
||||
virtual void traverse(TIntermTraverser*);
|
||||
@ -400,9 +409,15 @@ public:
|
||||
TIntermTyped* getRight() const { return right; }
|
||||
bool promote(TInfoSink&);
|
||||
|
||||
void setAddIndexClamp() { addIndexClamp = true; }
|
||||
bool getAddIndexClamp() { return addIndexClamp; }
|
||||
|
||||
protected:
|
||||
TIntermTyped* left;
|
||||
TIntermTyped* right;
|
||||
|
||||
// If set to true, wrap any EOpIndexIndirect with a clamp to bounds.
|
||||
bool addIndexClamp;
|
||||
};
|
||||
|
||||
//
|
||||
@ -545,6 +560,10 @@ public:
|
||||
void incrementDepth() {depth++;}
|
||||
void decrementDepth() {depth--;}
|
||||
|
||||
// Return the original name if hash function pointer is NULL;
|
||||
// otherwise return the hashed name.
|
||||
static TString hash(const TString& name, ShHashFunction64 hashFunction);
|
||||
|
||||
const bool preVisit;
|
||||
const bool inVisit;
|
||||
const bool postVisit;
|
||||
|
21
src/3rdparty/angle/src/compiler/osinclude.h
vendored
21
src/3rdparty/angle/src/compiler/osinclude.h
vendored
@ -24,9 +24,7 @@
|
||||
#error Unsupported platform.
|
||||
#endif
|
||||
|
||||
#if defined(ANGLE_USE_NSPR)
|
||||
#include "prthread.h"
|
||||
#elif defined(ANGLE_OS_WIN)
|
||||
#if defined(ANGLE_OS_WIN)
|
||||
#define STRICT
|
||||
#define VC_EXTRALEAN 1
|
||||
#include <windows.h>
|
||||
@ -34,7 +32,7 @@
|
||||
#include <pthread.h>
|
||||
#include <semaphore.h>
|
||||
#include <errno.h>
|
||||
#endif // ANGLE_USE_NSPR
|
||||
#endif // ANGLE_OS_WIN
|
||||
|
||||
|
||||
#include "compiler/debug.h"
|
||||
@ -42,16 +40,13 @@
|
||||
//
|
||||
// Thread Local Storage Operations
|
||||
//
|
||||
#if defined(ANGLE_USE_NSPR)
|
||||
typedef PRUintn OS_TLSIndex;
|
||||
#define OS_INVALID_TLS_INDEX 0xFFFFFFFF
|
||||
#elif defined(ANGLE_OS_WIN)
|
||||
#if defined(ANGLE_OS_WIN)
|
||||
typedef DWORD OS_TLSIndex;
|
||||
#define OS_INVALID_TLS_INDEX (TLS_OUT_OF_INDEXES)
|
||||
#elif defined(ANGLE_OS_POSIX)
|
||||
typedef unsigned int OS_TLSIndex;
|
||||
#define OS_INVALID_TLS_INDEX 0xFFFFFFFF
|
||||
#endif // ANGLE_USE_NSPR
|
||||
typedef pthread_key_t OS_TLSIndex;
|
||||
#define OS_INVALID_TLS_INDEX (static_cast<OS_TLSIndex>(-1))
|
||||
#endif // ANGLE_OS_WIN
|
||||
|
||||
OS_TLSIndex OS_AllocTLSIndex();
|
||||
bool OS_SetTLSValue(OS_TLSIndex nIndex, void *lpvValue);
|
||||
@ -60,9 +55,7 @@ bool OS_FreeTLSIndex(OS_TLSIndex nIndex);
|
||||
inline void* OS_GetTLSValue(OS_TLSIndex nIndex)
|
||||
{
|
||||
ASSERT(nIndex != OS_INVALID_TLS_INDEX);
|
||||
#if defined(ANGLE_USE_NSPR)
|
||||
return PR_GetThreadPrivate(nIndex);
|
||||
#elif defined(ANGLE_OS_WIN)
|
||||
#if defined(ANGLE_OS_WIN)
|
||||
return TlsGetValue(nIndex);
|
||||
#elif defined(ANGLE_OS_POSIX)
|
||||
return pthread_getspecific(nIndex);
|
||||
|
@ -1,43 +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.
|
||||
//
|
||||
|
||||
//
|
||||
// This file contains the nspr specific functions
|
||||
//
|
||||
#include "compiler/osinclude.h"
|
||||
|
||||
//
|
||||
// Thread Local Storage Operations
|
||||
//
|
||||
OS_TLSIndex OS_AllocTLSIndex()
|
||||
{
|
||||
PRUintn index;
|
||||
PRStatus status = PR_NewThreadPrivateIndex(&index, NULL);
|
||||
|
||||
if (status) {
|
||||
assert(0 && "OS_AllocTLSIndex(): Unable to allocate Thread Local Storage");
|
||||
return OS_INVALID_TLS_INDEX;
|
||||
}
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
bool OS_SetTLSValue(OS_TLSIndex nIndex, void *lpvValue)
|
||||
{
|
||||
if (nIndex == OS_INVALID_TLS_INDEX) {
|
||||
assert(0 && "OS_SetTLSValue(): Invalid TLS Index");
|
||||
return false;
|
||||
}
|
||||
|
||||
return PR_SetThreadPrivate(nIndex, lpvValue) == 0;
|
||||
}
|
||||
|
||||
bool OS_FreeTLSIndex(OS_TLSIndex nIndex)
|
||||
{
|
||||
// Can't delete TLS keys with nspr
|
||||
return true;
|
||||
}
|
||||
|
@ -151,6 +151,13 @@ bool TConstTraverser::visitSelection(Visit visit, TIntermSelection* node)
|
||||
|
||||
void TConstTraverser::visitConstantUnion(TIntermConstantUnion* node)
|
||||
{
|
||||
if (!node->getUnionArrayPointer())
|
||||
{
|
||||
// The constant was not initialized, this should already have been logged
|
||||
assert(infoSink.info.size() != 0);
|
||||
return;
|
||||
}
|
||||
|
||||
ConstantUnion* leftUnionArray = unionArray;
|
||||
int instanceSize = type.getObjectSize();
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
// found in the LICENSE file.
|
||||
//
|
||||
|
||||
#include "Diagnostics.h"
|
||||
#include "DiagnosticsBase.h"
|
||||
|
||||
#include <cassert>
|
||||
|
@ -4,7 +4,7 @@
|
||||
// found in the LICENSE file.
|
||||
//
|
||||
|
||||
#include "DirectiveHandler.h"
|
||||
#include "DirectiveHandlerBase.h"
|
||||
|
||||
namespace pp
|
||||
{
|
@ -10,8 +10,8 @@
|
||||
#include <cstdlib>
|
||||
#include <sstream>
|
||||
|
||||
#include "Diagnostics.h"
|
||||
#include "DirectiveHandler.h"
|
||||
#include "DiagnosticsBase.h"
|
||||
#include "DirectiveHandlerBase.h"
|
||||
#include "ExpressionParser.h"
|
||||
#include "MacroExpander.h"
|
||||
#include "Token.h"
|
@ -22,7 +22,11 @@ WHICH GENERATES THE GLSL ES preprocessor expression parser.
|
||||
|
||||
#if defined(__GNUC__)
|
||||
// Triggered by the auto-generated pplval variable.
|
||||
#if !defined(__clang__) && ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7))
|
||||
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
|
||||
#else
|
||||
#pragma GCC diagnostic ignored "-Wuninitialized"
|
||||
#endif
|
||||
#elif defined(_MSC_VER)
|
||||
#pragma warning(disable: 4065 4701)
|
||||
#endif
|
||||
@ -32,7 +36,7 @@ WHICH GENERATES THE GLSL ES preprocessor expression parser.
|
||||
#include <cassert>
|
||||
#include <sstream>
|
||||
|
||||
#include "Diagnostics.h"
|
||||
#include "DiagnosticsBase.h"
|
||||
#include "Lexer.h"
|
||||
#include "Token.h"
|
||||
|
||||
@ -42,6 +46,8 @@ typedef __int64 YYSTYPE;
|
||||
#include <stdint.h>
|
||||
typedef intmax_t YYSTYPE;
|
||||
#endif // _MSC_VER
|
||||
#define YYENABLE_NLS 0
|
||||
#define YYLTYPE_IS_TRIVIAL 1
|
||||
#define YYSTYPE_IS_TRIVIAL 1
|
||||
#define YYSTYPE_IS_DECLARED 1
|
||||
|
@ -17,27 +17,26 @@ Input::Input() : mCount(0), mString(0)
|
||||
{
|
||||
}
|
||||
|
||||
Input::Input(int count, const char* const string[], const int length[]) :
|
||||
Input::Input(size_t count, const char* const string[], const int length[]) :
|
||||
mCount(count),
|
||||
mString(string)
|
||||
{
|
||||
assert(mCount >= 0);
|
||||
mLength.reserve(mCount);
|
||||
for (int i = 0; i < mCount; ++i)
|
||||
for (size_t i = 0; i < mCount; ++i)
|
||||
{
|
||||
int len = length ? length[i] : -1;
|
||||
mLength.push_back(len < 0 ? strlen(mString[i]) : len);
|
||||
mLength.push_back(len < 0 ? std::strlen(mString[i]) : len);
|
||||
}
|
||||
}
|
||||
|
||||
int Input::read(char* buf, int maxSize)
|
||||
size_t Input::read(char* buf, size_t maxSize)
|
||||
{
|
||||
int nRead = 0;
|
||||
size_t nRead = 0;
|
||||
while ((nRead < maxSize) && (mReadLoc.sIndex < mCount))
|
||||
{
|
||||
int size = mLength[mReadLoc.sIndex] - mReadLoc.cIndex;
|
||||
size_t size = mLength[mReadLoc.sIndex] - mReadLoc.cIndex;
|
||||
size = std::min(size, maxSize);
|
||||
memcpy(buf + nRead, mString[mReadLoc.sIndex] + mReadLoc.cIndex, size);
|
||||
std::memcpy(buf + nRead, mString[mReadLoc.sIndex] + mReadLoc.cIndex, size);
|
||||
nRead += size;
|
||||
mReadLoc.cIndex += size;
|
||||
|
@ -7,6 +7,7 @@
|
||||
#ifndef COMPILER_PREPROCESSOR_INPUT_H_
|
||||
#define COMPILER_PREPROCESSOR_INPUT_H_
|
||||
|
||||
#include <stddef.h>
|
||||
#include <vector>
|
||||
|
||||
namespace pp
|
||||
@ -17,18 +18,18 @@ class Input
|
||||
{
|
||||
public:
|
||||
Input();
|
||||
Input(int count, const char* const string[], const int length[]);
|
||||
Input(size_t count, const char* const string[], const int length[]);
|
||||
|
||||
int count() const { return mCount; }
|
||||
const char* string(int index) const { return mString[index]; }
|
||||
int length(int index) const { return mLength[index]; }
|
||||
size_t count() const { return mCount; }
|
||||
const char* string(size_t index) const { return mString[index]; }
|
||||
size_t length(size_t index) const { return mLength[index]; }
|
||||
|
||||
int read(char* buf, int maxSize);
|
||||
size_t read(char* buf, size_t maxSize);
|
||||
|
||||
struct Location
|
||||
{
|
||||
int sIndex; // String index;
|
||||
int cIndex; // Char index.
|
||||
size_t sIndex; // String index;
|
||||
size_t cIndex; // Char index.
|
||||
|
||||
Location() : sIndex(0), cIndex(0) { }
|
||||
};
|
||||
@ -36,9 +37,9 @@ class Input
|
||||
|
||||
private:
|
||||
// Input.
|
||||
int mCount;
|
||||
size_t mCount;
|
||||
const char* const* mString;
|
||||
std::vector<int> mLength;
|
||||
std::vector<size_t> mLength;
|
||||
|
||||
Location mReadLoc;
|
||||
};
|
@ -9,7 +9,7 @@
|
||||
#include <algorithm>
|
||||
#include <sstream>
|
||||
|
||||
#include "Diagnostics.h"
|
||||
#include "DiagnosticsBase.h"
|
||||
#include "Token.h"
|
||||
|
||||
namespace pp
|
||||
@ -57,7 +57,7 @@ MacroExpander::MacroExpander(Lexer* lexer,
|
||||
|
||||
MacroExpander::~MacroExpander()
|
||||
{
|
||||
for (size_t i = 0; i < mContextStack.size(); ++i)
|
||||
for (std::size_t i = 0; i < mContextStack.size(); ++i)
|
||||
{
|
||||
delete mContextStack[i];
|
||||
}
|
||||
@ -224,7 +224,7 @@ bool MacroExpander::expandMacro(const Macro& macro,
|
||||
replaceMacroParams(macro, args, replacements);
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < replacements->size(); ++i)
|
||||
for (std::size_t i = 0; i < replacements->size(); ++i)
|
||||
{
|
||||
Token& repl = replacements->at(i);
|
||||
if (i == 0)
|
||||
@ -311,7 +311,7 @@ bool MacroExpander::collectMacroArgs(const Macro& macro,
|
||||
// Pre-expand each argument before substitution.
|
||||
// This step expands each argument individually before they are
|
||||
// inserted into the macro body.
|
||||
for (size_t i = 0; i < args->size(); ++i)
|
||||
for (std::size_t i = 0; i < args->size(); ++i)
|
||||
{
|
||||
MacroArg& arg = args->at(i);
|
||||
TokenLexer lexer(&arg);
|
||||
@ -332,7 +332,7 @@ void MacroExpander::replaceMacroParams(const Macro& macro,
|
||||
const std::vector<MacroArg>& args,
|
||||
std::vector<Token>* replacements)
|
||||
{
|
||||
for (size_t i = 0; i < macro.replacements.size(); ++i)
|
||||
for (std::size_t i = 0; i < macro.replacements.size(); ++i)
|
||||
{
|
||||
const Token& repl = macro.replacements[i];
|
||||
if (repl.type != Token::IDENTIFIER)
|
||||
@ -352,13 +352,13 @@ void MacroExpander::replaceMacroParams(const Macro& macro,
|
||||
continue;
|
||||
}
|
||||
|
||||
size_t iArg = std::distance(macro.parameters.begin(), iter);
|
||||
std::size_t iArg = std::distance(macro.parameters.begin(), iter);
|
||||
const MacroArg& arg = args[iArg];
|
||||
if (arg.empty())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
size_t iRepl = replacements->size();
|
||||
std::size_t iRepl = replacements->size();
|
||||
replacements->insert(replacements->end(), arg.begin(), arg.end());
|
||||
// The replacement token inherits padding properties from
|
||||
// macro replacement token.
|
@ -53,7 +53,7 @@ class MacroExpander : public Lexer
|
||||
struct MacroContext
|
||||
{
|
||||
const Macro* macro;
|
||||
size_t index;
|
||||
std::size_t index;
|
||||
std::vector<Token> replacements;
|
||||
|
||||
MacroContext() : macro(0), index(0) { }
|
@ -9,7 +9,7 @@
|
||||
#include <cassert>
|
||||
#include <sstream>
|
||||
|
||||
#include "Diagnostics.h"
|
||||
#include "DiagnosticsBase.h"
|
||||
#include "DirectiveParser.h"
|
||||
#include "Macro.h"
|
||||
#include "MacroExpander.h"
|
||||
@ -48,7 +48,7 @@ Preprocessor::~Preprocessor()
|
||||
delete mImpl;
|
||||
}
|
||||
|
||||
bool Preprocessor::init(int count,
|
||||
bool Preprocessor::init(size_t count,
|
||||
const char* const string[],
|
||||
const int length[])
|
||||
{
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user