Merge remote-tracking branch 'origin/5.4' into dev
Change-Id: I05fcd8dc66d9ad0dc76bb7f5bae05c9876bfba14
This commit is contained in:
commit
881ceeff42
45
configure
vendored
45
configure
vendored
@ -627,6 +627,7 @@ CFG_PPS=auto
|
||||
CFG_QNX_IMF=auto
|
||||
CFG_LGMON=auto
|
||||
CFG_SYSTEM_PROXIES=no
|
||||
CFG_ANDROID_STYLE_ASSETS=yes
|
||||
|
||||
# Target architecture
|
||||
CFG_ARCH=
|
||||
@ -699,8 +700,8 @@ RPATH_FLAGS=
|
||||
W_FLAGS=
|
||||
QCONFIG_FLAGS=
|
||||
XPLATFORM= # This seems to be the QMAKESPEC, like "linux-g++"
|
||||
XPLATFORM_MAC=no
|
||||
XPLATFORM_IOS=no
|
||||
XPLATFORM_MAC=no # Whether target platform is OS X or iOS
|
||||
XPLATFORM_IOS=no # Whether target platform is iOS
|
||||
XPLATFORM_ANDROID=no
|
||||
XPLATFORM_MINGW=no # Whether target platform is MinGW (win32-g++*)
|
||||
XPLATFORM_QNX=no
|
||||
@ -2169,6 +2170,13 @@ while [ "$#" -gt 0 ]; do
|
||||
android-toolchain-version)
|
||||
CFG_DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION="$VAL"
|
||||
;;
|
||||
android-style-assets)
|
||||
if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
|
||||
CFG_ANDROID_STYLE_ASSETS="$VAL"
|
||||
else
|
||||
UNKNOWN_OPT=yes
|
||||
fi
|
||||
;;
|
||||
l*) # -lfoo
|
||||
if [ "$VAL" = "yes" ]; then
|
||||
L_FLAGS="$L_FLAGS -l\"${VAR#l}\""
|
||||
@ -2592,6 +2600,14 @@ Android options:
|
||||
|
||||
-android-toolchain-version ..... Sets the android toolchain version
|
||||
(default $CFG_DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION)
|
||||
|
||||
-no-android-style-assets ....... Do not compile in the code which automatically extracts
|
||||
style assets from the run-time device. Setting this will
|
||||
make the Android style behave incorrectly, but will enable
|
||||
compatibility with the LGPL2.1 license.
|
||||
* -android-style-assets .......... Compile the code which automatically extracts style assets
|
||||
from the run-time device. This option will make the
|
||||
Android platform plugin incompatible with the LGPL2.1.
|
||||
EOF
|
||||
|
||||
exit 0
|
||||
@ -2853,15 +2869,20 @@ fi
|
||||
|
||||
if [ "$Edition" = "OpenSource" ]; then
|
||||
while true; do
|
||||
echo "You are licensed to use this software under the terms of"
|
||||
echo "the Lesser GNU General Public License (LGPL) versions 2.1."
|
||||
if [ -f "$relpath/LICENSE.LGPLv3" ]; then
|
||||
if [ "$CFG_ANDROID_STYLE_ASSETS" = "no" ] || [ "$XPLATFORM_ANDROID" = "no" ]; then
|
||||
echo "You are licensed to use this software under the terms of"
|
||||
echo "the Lesser GNU General Public License (LGPL) versions 2.1."
|
||||
echo "You are also licensed to use this software under the terms of"
|
||||
echo "the GNU Lesser General Public License (LGPL) versions 3."
|
||||
affix="either"
|
||||
showLGPL2="yes"
|
||||
else
|
||||
echo "You are licensed to use this software under the terms of"
|
||||
echo "the GNU Lesser General Public License (LGPL) versions 3."
|
||||
showLGPL2="no"
|
||||
affix="the"
|
||||
fi
|
||||
|
||||
echo
|
||||
if [ "$OPT_CONFIRM_LICENSE" = "yes" ]; then
|
||||
echo "You have already accepted the terms of the $EditionString license."
|
||||
@ -2870,7 +2891,9 @@ if [ "$Edition" = "OpenSource" ]; then
|
||||
if [ -f "$relpath/LICENSE.LGPLv3" ]; then
|
||||
echo "Type '3' to view the GNU Lesser General Public License version 3."
|
||||
fi
|
||||
echo "Type 'L' to view the Lesser GNU General Public License version 2.1."
|
||||
if [ "$showLGPL2" = "yes" ]; then
|
||||
echo "Type 'L' to view the Lesser GNU General Public License version 2.1."
|
||||
fi
|
||||
echo "Type 'yes' to accept this license offer."
|
||||
echo "Type 'no' to decline this license offer."
|
||||
echo
|
||||
@ -2886,7 +2909,7 @@ if [ "$Edition" = "OpenSource" ]; then
|
||||
exit 1
|
||||
elif [ "$acceptance" = "3" ]; then
|
||||
more "$relpath/LICENSE.LGPLv3"
|
||||
elif [ "$acceptance" = "L" ]; then
|
||||
elif [ "$acceptance" = "L" ] && [ "$showLGPL2" = "yes" ]; then
|
||||
more "$relpath/LICENSE.LGPLv21"
|
||||
fi
|
||||
done
|
||||
@ -3147,9 +3170,12 @@ if [ "$CFG_FORCEDEBUGINFO" = "yes" ]; then
|
||||
QMAKE_CONFIG="$QMAKE_CONFIG force_debug_info"
|
||||
fi
|
||||
|
||||
if [ "$XPLATFORM_MAC" = "yes" ]; then
|
||||
[ "$CFG_PKGCONFIG" = "auto" ] && CFG_PKGCONFIG="no"
|
||||
fi
|
||||
|
||||
if [ "$XPLATFORM_IOS" = "yes" ]; then
|
||||
CFG_RPATH="no"
|
||||
CFG_PKGCONFIG="no"
|
||||
CFG_NOBUILD_PARTS="$CFG_NOBUILD_PARTS examples"
|
||||
CFG_SHARED="no" # iOS builds should be static to be able to submit to the App Store
|
||||
CFG_SKIP_MODULES="$CFG_SKIP_MODULES qtconnectivity qtdoc qtmacextras qtserialport qtwebkit qtwebkit-examples"
|
||||
@ -3195,6 +3221,9 @@ if [ "$XPLATFORM_ANDROID" = "yes" ] ; then
|
||||
esac
|
||||
QMAKE_CONF_COMPILER=$CFG_DEFAULT_ANDROID_NDK_ROOT/toolchains/$ANDROID_NDK_TOOLS_PREFIX-$CFG_DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION/prebuilt/$CFG_DEFAULT_ANDROID_NDK_HOST/bin/$ANDROID_NDK_TOOLS_PREFIX-g++
|
||||
TEST_COMPILER="$QMAKE_CONF_COMPILER --sysroot=$CFG_DEFAULT_ANDROID_NDK_ROOT/platforms/$CFG_DEFAULT_ANDROID_PLATFORM/$ANDROID_PLATFORM_ARCH/"
|
||||
if [ "$CFG_ANDROID_STYLE_ASSETS" = "yes" ]; then
|
||||
QMAKE_CONFIG="$QMAKE_CONFIG android-style-assets"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$XPLATFORM_SYMBIAN_SBSV2" = "no" ]; then
|
||||
|
7
dist/changes-5.4.0
vendored
7
dist/changes-5.4.0
vendored
@ -24,3 +24,10 @@ QtCore
|
||||
|
||||
- Added QEnableSharedFromThis, a class that allows obtaining a
|
||||
QSharedPointer for an object already managed by a shared pointer.
|
||||
|
||||
|
||||
QtSql
|
||||
-----
|
||||
|
||||
- qsql ibase: fix memory corruption due to LONG being 4 bytes in firebird.
|
||||
- QSqlDriver::dbmsType(): New method reports DBMS type. Especially useful when using ODBC.
|
||||
|
@ -25,7 +25,7 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
/*!
|
||||
\externalpage http://qt-project.org/
|
||||
\externalpage http://qt.io/
|
||||
\title Qt Homepage
|
||||
*/
|
||||
/*!
|
||||
@ -33,11 +33,11 @@
|
||||
\title Qt Bug Tracker
|
||||
*/
|
||||
/*!
|
||||
\externalpage http://qt-project.org/downloads
|
||||
\externalpage http://qt.io/download
|
||||
\title Downloads
|
||||
*/
|
||||
/*!
|
||||
\externalpage http://qt.digia.com/licensing/
|
||||
\externalpage http://qt.io/licensing/
|
||||
\title Qt Licensing Overview
|
||||
*/
|
||||
/*!
|
||||
|
@ -34,7 +34,7 @@
|
||||
|
||||
\image openglwindow-example.png Screenshot of the OpenGLWindow example
|
||||
|
||||
\section1 OpenGLWindow super class
|
||||
\section1 OpenGLWindow Super Class
|
||||
|
||||
Our OpenGLWindow class acts as an API which is then subclassed to do the
|
||||
actual rendering. It has functions to make a request for render() to be
|
||||
@ -118,7 +118,7 @@
|
||||
|
||||
\snippet openglwindow/openglwindow.cpp 5
|
||||
|
||||
\section1 Example OpenGL rendering sub class
|
||||
\section1 Example OpenGL Rendering Sub Class
|
||||
|
||||
Here we sub class OpenGLWindow to show how to do OpenGL to render a
|
||||
rotating triangle. By indirectly sub classing QOpenGLFunctions we gain
|
||||
|
@ -43,7 +43,7 @@
|
||||
In this example, we'll demonstrate how to save and load a simple game to
|
||||
and from JSON and binary formats.
|
||||
|
||||
\section1 The Character class
|
||||
\section1 The Character Class
|
||||
|
||||
The Character class represents a non-player character (NPC) in our game, and
|
||||
stores the player's name, level, and class type.
|
||||
|
@ -90,7 +90,7 @@
|
||||
|
||||
\snippet cube/mainwidget.cpp 2
|
||||
|
||||
\section1 Loading textures from Qt Resource files
|
||||
\section1 Loading Textures from Qt Resource Files
|
||||
|
||||
\c QGLWidget interface implements methods for loading textures from QImage to GL
|
||||
texture memory. We still need to use OpenGL provided functions for specifying
|
||||
@ -133,14 +133,14 @@
|
||||
|
||||
\snippet cube/geometryengine.cpp 2
|
||||
|
||||
\section1 Perspective projection
|
||||
\section1 Perspective Projection
|
||||
|
||||
Using \c QMatrix4x4 helper methods it's really easy to calculate perpective
|
||||
projection matrix. This matrix is used to project vertices to screen space.
|
||||
|
||||
\snippet cube/mainwidget.cpp 5
|
||||
|
||||
\section1 Orientation of the 3D object
|
||||
\section1 Orientation of the 3D Object
|
||||
|
||||
Quaternions are handy way to represent orientation of the 3D object. Quaternions
|
||||
involve quite complex mathematics but fortunately all the necessary mathematics
|
||||
|
@ -394,6 +394,11 @@ void GLWidget::paintGL()
|
||||
}
|
||||
m_fAngle += 1.0f;
|
||||
++m_frames;
|
||||
|
||||
// When requested, follow the ideal way to animate: Rely on
|
||||
// blocking swap and just schedule updates continuously.
|
||||
if (!m_mainWindow->timerEnabled())
|
||||
update();
|
||||
}
|
||||
|
||||
void GLWidget::createBubbles(int number)
|
||||
|
@ -54,6 +54,7 @@ MainWindow::MainWindow()
|
||||
: m_nextX(1), m_nextY(1)
|
||||
{
|
||||
GLWidget *glwidget = new GLWidget(this, true, qRgb(20, 20, 50));
|
||||
m_glWidgets << glwidget;
|
||||
QLabel *label = new QLabel(this);
|
||||
m_timer = new QTimer(this);
|
||||
QSlider *slider = new QSlider(this);
|
||||
@ -67,12 +68,19 @@ MainWindow::MainWindow()
|
||||
"Note that on most systems the swap will block to wait for vsync\n"
|
||||
"and therefore an interval < 16 ms will likely lead to a 60 FPS update rate.");
|
||||
QGroupBox *updateGroupBox = new QGroupBox(this);
|
||||
QCheckBox *timerBased = new QCheckBox("Use timer", this);
|
||||
timerBased->setChecked(true);
|
||||
timerBased->setToolTip("Toggles using a timer to trigger update().\n"
|
||||
"When not set, each paintGL() schedules the next update immediately,\n"
|
||||
"expecting the blocking swap to throttle the thread.\n"
|
||||
"This shows how unnecessary the timer is in most cases.");
|
||||
QCheckBox *transparent = new QCheckBox("Transparent background", this);
|
||||
transparent->setToolTip("Toggles Qt::WA_AlwaysStackOnTop and transparent clear color for glClear().\n"
|
||||
"Note how the button on top stacks incorrectly when enabling this.");
|
||||
QHBoxLayout *updateLayout = new QHBoxLayout;
|
||||
updateLayout->addWidget(updateLabel);
|
||||
updateLayout->addWidget(updateInterval);
|
||||
updateLayout->addWidget(timerBased);
|
||||
updateLayout->addWidget(transparent);
|
||||
updateGroupBox->setLayout(updateLayout);
|
||||
|
||||
@ -123,6 +131,8 @@ MainWindow::MainWindow()
|
||||
connect(transparent, &QCheckBox::toggled, glwidget, &GLWidget::setTransparent);
|
||||
|
||||
connect(updateInterval, SIGNAL(valueChanged(int)), this, SLOT(updateIntervalChanged(int)));
|
||||
connect(timerBased, &QCheckBox::toggled, this, &MainWindow::timerUsageChanged);
|
||||
connect(timerBased, &QCheckBox::toggled, updateInterval, &QWidget::setEnabled);
|
||||
|
||||
m_timer->start();
|
||||
}
|
||||
@ -130,7 +140,8 @@ MainWindow::MainWindow()
|
||||
void MainWindow::updateIntervalChanged(int value)
|
||||
{
|
||||
m_timer->setInterval(value);
|
||||
m_timer->start();
|
||||
if (m_timer->isActive())
|
||||
m_timer->start();
|
||||
}
|
||||
|
||||
void MainWindow::addNew()
|
||||
@ -138,6 +149,7 @@ void MainWindow::addNew()
|
||||
if (m_nextY == 4)
|
||||
return;
|
||||
GLWidget *w = new GLWidget(this, false, qRgb(qrand() % 256, qrand() % 256, qrand() % 256));
|
||||
m_glWidgets << w;
|
||||
connect(m_timer, SIGNAL(timeout()), w, SLOT(update()));
|
||||
m_layout->addWidget(w, m_nextY, m_nextX, 1, 1);
|
||||
if (m_nextX == 3) {
|
||||
@ -147,3 +159,14 @@ void MainWindow::addNew()
|
||||
++m_nextX;
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::timerUsageChanged(bool enabled)
|
||||
{
|
||||
if (enabled) {
|
||||
m_timer->start();
|
||||
} else {
|
||||
m_timer->stop();
|
||||
foreach (QOpenGLWidget *w, m_glWidgets)
|
||||
w->update();
|
||||
}
|
||||
}
|
||||
|
@ -45,6 +45,8 @@
|
||||
#include <QTimer>
|
||||
#include <QGridLayout>
|
||||
|
||||
QT_FORWARD_DECLARE_CLASS(QOpenGLWidget)
|
||||
|
||||
class MainWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -52,15 +54,18 @@ class MainWindow : public QMainWindow
|
||||
public:
|
||||
MainWindow();
|
||||
void addNew();
|
||||
bool timerEnabled() const { return m_timer->isActive(); }
|
||||
|
||||
private slots:
|
||||
void updateIntervalChanged(int value);
|
||||
void timerUsageChanged(bool enabled);
|
||||
|
||||
private:
|
||||
QTimer *m_timer;
|
||||
QGridLayout *m_layout;
|
||||
int m_nextX;
|
||||
int m_nextY;
|
||||
QVector<QOpenGLWidget *> m_glWidgets;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -192,7 +192,7 @@
|
||||
the platform. By convention the target should have the same name
|
||||
as the plugin (set with Q_EXPORT_PLUGIN2)
|
||||
|
||||
\section1 Further reading and examples
|
||||
\section1 Further Reading and Examples
|
||||
|
||||
The \l {qtplugin-defining-plugins}{Defining Plugins} page presents an overview of the macros needed to
|
||||
create plugins.
|
||||
|
@ -123,7 +123,7 @@
|
||||
styles folder under stylewindow because this is a path in which Qt
|
||||
will search for style plugins.
|
||||
|
||||
\section1 Related articles and examples
|
||||
\section1 Related Articles and Examples
|
||||
|
||||
In addition to the plugin \l{How to Create Qt Plugins}{overview
|
||||
document}, we have other examples and articles that concern
|
||||
|
@ -61,7 +61,7 @@
|
||||
First we will review the \c SortingBox class, then we will take a
|
||||
look at the \c ShapeItem class.
|
||||
|
||||
\section1 SortingBox Class Definition
|
||||
\section1 SortingBox Class Definition
|
||||
|
||||
\snippet widgets/tooltips/sortingbox.h 0
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
TEMPLATE = app
|
||||
|
||||
TARGET = buttontester
|
||||
TARGET = mousebuttons
|
||||
TEMPLATE = app
|
||||
|
||||
SOURCES += \
|
||||
|
28
header.LGPL3
Normal file
28
header.LGPL3
Normal file
@ -0,0 +1,28 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of the FOO module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL3$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPLv3 included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 3 requirements
|
||||
** will be met: https://www.gnu.org/licenses/lgpl.html.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
@ -133,11 +133,16 @@ contains(CONFIG, plugin) {
|
||||
CMAKE_PLUGIN_NAME = $$PLUGIN_CLASS_NAME
|
||||
|
||||
win32 {
|
||||
isEmpty(CMAKE_STATIC_TYPE): CMAKE_PlUGIN_EXT = .dll
|
||||
else: CMAKE_PlUGIN_EXT = .lib
|
||||
|
||||
CMAKE_PLUGIN_LOCATION_RELEASE = $$PLUGIN_TYPE/$${TARGET}$${CMAKE_PlUGIN_EXT}
|
||||
CMAKE_PLUGIN_LOCATION_DEBUG = $$PLUGIN_TYPE/$${TARGET}d$${CMAKE_PlUGIN_EXT}
|
||||
isEmpty(CMAKE_STATIC_TYPE) {
|
||||
CMAKE_PLUGIN_LOCATION_RELEASE = $$PLUGIN_TYPE/$${TARGET}.dll
|
||||
CMAKE_PLUGIN_LOCATION_DEBUG = $$PLUGIN_TYPE/$${TARGET}d.dll
|
||||
} else:mingw {
|
||||
CMAKE_PLUGIN_LOCATION_RELEASE = $$PLUGIN_TYPE/lib$${TARGET}.a
|
||||
CMAKE_PLUGIN_LOCATION_DEBUG = $$PLUGIN_TYPE/lib$${TARGET}d.a
|
||||
} else { # MSVC static
|
||||
CMAKE_PLUGIN_LOCATION_RELEASE = $$PLUGIN_TYPE/$${TARGET}.lib
|
||||
CMAKE_PLUGIN_LOCATION_DEBUG = $$PLUGIN_TYPE/$${TARGET}d.lib
|
||||
}
|
||||
} else {
|
||||
mac {
|
||||
isEmpty(CMAKE_STATIC_TYPE): CMAKE_PlUGIN_EXT = .dylib
|
||||
|
@ -30,7 +30,7 @@ CONFIG += plugin no_plugin_name_prefix
|
||||
javac.input = JAVASOURCES
|
||||
javac.output = $$CLASS_DIR
|
||||
javac.CONFIG += combine
|
||||
javac.commands = javac -source 6 -target 6 -Xlint:unchecked -bootclasspath $$ANDROID_JAR_FILE -cp $$shell_quote($$system_path($$join(JAVACLASSPATH, $$DIRLIST_SEP))) -d $$shell_quote($$CLASS_DIR) ${QMAKE_FILE_IN}
|
||||
javac.commands = javac -source 6 -target 6 -Xlint:unchecked -bootclasspath $$ANDROID_JAR_FILE -cp $$shell_quote($$system_path($$join(JAVACLASSPATH, $$DIRLIST_SEPARATOR))) -d $$shell_quote($$CLASS_DIR) ${QMAKE_FILE_IN}
|
||||
# Force rebuild every time, because we don't know the paths of the destination files
|
||||
# as they depend on the code.
|
||||
javac.depends = FORCE
|
||||
|
@ -89,12 +89,12 @@ contains(qt_module_deps, qml): \
|
||||
}
|
||||
|
||||
# run qmlimportscanner
|
||||
qtPrepareTool(QMLIMPORTSCANNER, qmlimportscanner, _SYS)
|
||||
qtPrepareTool(QMLIMPORTSCANNER, qmlimportscanner, , system)
|
||||
for (QMLPATH, QMLPATHS): \
|
||||
IMPORTPATHS += -importPath $$QMLPATH
|
||||
|
||||
#message(run $$QMLIMPORTSCANNER_SYS $$_PRO_FILE_PWD_ $$IMPORTPATHS)
|
||||
JSON = $$system($$QMLIMPORTSCANNER_SYS $$_PRO_FILE_PWD_ $$IMPORTPATHS)
|
||||
#message(run $$QMLIMPORTSCANNER $$_PRO_FILE_PWD_ $$IMPORTPATHS)
|
||||
JSON = $$system($$QMLIMPORTSCANNER $$_PRO_FILE_PWD_ $$IMPORTPATHS)
|
||||
|
||||
parseJson(JSON, IMPORTS)| error("Failed to parse qmlimportscanner output.")
|
||||
|
||||
|
@ -187,7 +187,7 @@ defineTest(qtAddRpathLink) {
|
||||
export(QMAKE_RPATHLINKDIR)
|
||||
}
|
||||
|
||||
# variable, default, [suffix for variable for system() use]
|
||||
# variable, default, [suffix for variable for system() use], [prepare primary variable for system() use]
|
||||
defineTest(qtPrepareTool) {
|
||||
cmd = $$eval(QT_TOOL.$${2}.binary)
|
||||
isEmpty(cmd) {
|
||||
@ -204,16 +204,18 @@ defineTest(qtPrepareTool) {
|
||||
}
|
||||
}
|
||||
QT_TOOL_ENV += $$eval(QT_TOOL.$${2}.envvars)
|
||||
!isEmpty(3) {
|
||||
!isEmpty(3)|!isEmpty(4) {
|
||||
$$1$$3 =
|
||||
for (arg, cmd): \
|
||||
$$1$$3 += $$system_quote($$arg)
|
||||
qtAddTargetEnv($$1$$3, QT_TOOL.$${2}.depends, system)
|
||||
}
|
||||
$$1 =
|
||||
for (arg, cmd): \
|
||||
$$1 += $$shell_quote($$arg)
|
||||
qtAddTargetEnv($$1, QT_TOOL.$${2}.depends, )
|
||||
isEmpty(4) {
|
||||
$$1 =
|
||||
for (arg, cmd): \
|
||||
$$1 += $$shell_quote($$arg)
|
||||
qtAddTargetEnv($$1, QT_TOOL.$${2}.depends, )
|
||||
}
|
||||
}
|
||||
|
||||
# target variable, list of env var names, [non-empty: prepare for system(), not make]
|
||||
|
@ -101,8 +101,10 @@ mac:CONFIG(shared, static|shared):contains(QT_CONFIG, qt_framework) {
|
||||
FRAMEWORK_HEADERS.version = Versions
|
||||
FRAMEWORK_HEADERS.files = $$SYNCQT.HEADER_FILES $$SYNCQT.HEADER_CLASSES
|
||||
FRAMEWORK_HEADERS.path = Headers
|
||||
FRAMEWORK_PRIVATE_HEADERS.version = Versions
|
||||
FRAMEWORK_PRIVATE_HEADERS.files = $$SYNCQT.PRIVATE_HEADER_FILES
|
||||
FRAMEWORK_PRIVATE_HEADERS.path = Headers/$$VERSION/$$MODULE_INCNAME/private
|
||||
FRAMEWORK_QPA_HEADERS.version = Versions
|
||||
FRAMEWORK_QPA_HEADERS.files = $$SYNCQT.QPA_HEADER_FILES
|
||||
FRAMEWORK_QPA_HEADERS.path = Headers/$$VERSION/$$MODULE_INCNAME/qpa
|
||||
QMAKE_BUNDLE_DATA += FRAMEWORK_HEADERS FRAMEWORK_PRIVATE_HEADERS FRAMEWORK_QPA_HEADERS
|
||||
|
@ -12,7 +12,7 @@
|
||||
load(qt_build_paths)
|
||||
|
||||
!build_pass:git_build {
|
||||
qtPrepareTool(QMAKE_SYNCQT, syncqt)
|
||||
qtPrepareTool(QMAKE_SYNCQT, syncqt, , system)
|
||||
minimal_syncqt {
|
||||
QMAKE_SYNCQT += -minimal $$QMAKE_SYNCQT_OPTIONS
|
||||
} else {
|
||||
|
@ -25,10 +25,13 @@ CONFIG(static, static|shared) {
|
||||
!macx-xcode: \
|
||||
addExclusiveBuilds(shared, static)
|
||||
|
||||
CONFIG(debug, debug|release): \
|
||||
CONFIG(debug, debug|release) {
|
||||
CONFIG -= release
|
||||
else: \
|
||||
!force_debug_plist:debug_and_release: \
|
||||
CONFIG += no_plist
|
||||
} else {
|
||||
CONFIG -= debug
|
||||
}
|
||||
|
||||
!macx-xcode {
|
||||
addExclusiveBuilds(debug, release)
|
||||
|
@ -1,6 +1,6 @@
|
||||
CONFIG -= windows
|
||||
QMAKE_LFLAGS += $$replace(QMAKE_LFLAGS_CONSOLE, @QMAKE_SUBSYSTEM_SUFFIX@, $$QMAKE_SUBSYSTEM_SUFFIX)
|
||||
contains(TEMPLATE, ".*app") {
|
||||
QMAKE_LFLAGS += \
|
||||
$$replace(QMAKE_LFLAGS_CONSOLE, @QMAKE_SUBSYSTEM_SUFFIX@, $$QMAKE_SUBSYSTEM_SUFFIX) \
|
||||
$$QMAKE_LFLAGS_EXE
|
||||
wince: QMAKE_LFLAGS += /ENTRY:mainACRTStartup
|
||||
QMAKE_LFLAGS += $$QMAKE_LFLAGS_EXE
|
||||
}
|
||||
|
@ -1,8 +1,7 @@
|
||||
CONFIG -= console
|
||||
contains(TEMPLATE, ".*app"){
|
||||
QMAKE_LFLAGS += \
|
||||
$$replace(QMAKE_LFLAGS_WINDOWS, @QMAKE_SUBSYSTEM_SUFFIX@, $$QMAKE_SUBSYSTEM_SUFFIX) \
|
||||
$$QMAKE_LFLAGS_EXE
|
||||
QMAKE_LFLAGS += $$replace(QMAKE_LFLAGS_WINDOWS, @QMAKE_SUBSYSTEM_SUFFIX@, $$QMAKE_SUBSYSTEM_SUFFIX)
|
||||
contains(TEMPLATE, ".*app") {
|
||||
QMAKE_LFLAGS += $$QMAKE_LFLAGS_EXE
|
||||
mingw:DEFINES += QT_NEEDS_QMAIN
|
||||
|
||||
qt:for(entryLib, $$list($$unique(QMAKE_LIBS_QT_ENTRY))) {
|
||||
|
@ -6,6 +6,8 @@
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>@SHORT_VERSION@</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>@FULL_VERSION@</string>
|
||||
<key>CFBundleGetInfoString</key>
|
||||
<string>Created by Qt/QMake</string>
|
||||
<key>CFBundleSignature</key>
|
||||
|
@ -6,6 +6,8 @@
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>@SHORT_VERSION@</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>@FULL_VERSION@</string>
|
||||
<key>CFBundleGetInfoString</key>
|
||||
<string>Created by Qt/QMake</string>
|
||||
<key>CFBundleSignature</key>
|
||||
|
@ -6,6 +6,8 @@
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>@SHORT_VERSION@</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>@FULL_VERSION@</string>
|
||||
<key>CFBundleGetInfoString</key>
|
||||
<string>Created by Qt/QMake</string>
|
||||
<key>CFBundleSignature</key>
|
||||
|
@ -6,6 +6,8 @@
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>@SHORT_VERSION@</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>@FULL_VERSION@</string>
|
||||
<key>CFBundleGetInfoString</key>
|
||||
<string>Created by Qt/QMake</string>
|
||||
<key>CFBundleSignature</key>
|
||||
|
@ -6,6 +6,8 @@
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>@SHORT_VERSION@</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>@FULL_VERSION@</string>
|
||||
<key>CFBundleGetInfoString</key>
|
||||
<string>Created by Qt/QMake</string>
|
||||
<key>CFBundleSignature</key>
|
||||
|
@ -6,6 +6,8 @@
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>@SHORT_VERSION@</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>@FULL_VERSION@</string>
|
||||
<key>CFBundleGetInfoString</key>
|
||||
<string>Created by Qt/QMake</string>
|
||||
<key>CFBundleSignature</key>
|
||||
|
@ -6,6 +6,8 @@
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>@SHORT_VERSION@</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>@FULL_VERSION@</string>
|
||||
<key>CFBundleGetInfoString</key>
|
||||
<string>Created by Qt/QMake</string>
|
||||
<key>CFBundleSignature</key>
|
||||
|
@ -24,6 +24,13 @@
|
||||
<string>1.0</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>UISupportedInterfaceOrientations</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>NOTE</key>
|
||||
<string>This file was generated by Qt/QMake.</string>
|
||||
</dict>
|
||||
|
@ -6,6 +6,8 @@
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>@SHORT_VERSION@</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>@FULL_VERSION@</string>
|
||||
<key>CFBundleGetInfoString</key>
|
||||
<string>Created by Qt/QMake</string>
|
||||
<key>CFBundleSignature</key>
|
||||
|
@ -6,6 +6,8 @@
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>@SHORT_VERSION@</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>@FULL_VERSION@</string>
|
||||
<key>CFBundleGetInfoString</key>
|
||||
<string>Created by Qt/QMake</string>
|
||||
<key>CFBundleSignature</key>
|
||||
|
@ -12,7 +12,7 @@ CE_ARCH = ARMV4I
|
||||
|
||||
DEFINES += STANDARDSHELL_UI_MODEL _WIN32_WCE=0x600 $$CE_ARCH _ARMV4I_ armv4i _ARM_ ARM _M_ARM ARM _WIN32 __arm__
|
||||
|
||||
QMAKE_LFLAGS_CONSOLE = /SUBSYSTEM:WINDOWSCE,6.00 /MACHINE:THUMB /ENTRY:mainACRTStartup
|
||||
QMAKE_LFLAGS_CONSOLE = /SUBSYSTEM:WINDOWSCE,6.00 /MACHINE:THUMB
|
||||
QMAKE_LFLAGS_WINDOWS = /SUBSYSTEM:WINDOWSCE,6.00 /MACHINE:THUMB
|
||||
QMAKE_LFLAGS_DLL = /SUBSYSTEM:WINDOWSCE,6.00 /MACHINE:THUMB /DLL /SAFESEH:NO
|
||||
QMAKE_LIBFLAGS_RELEASE = /LTCG
|
||||
|
@ -12,7 +12,7 @@ CE_ARCH = x86
|
||||
|
||||
DEFINES += STANDARDSHELL_UI_MODEL _WIN32_WCE=0x600 $$CE_ARCH _X86_ _M_IX86
|
||||
|
||||
QMAKE_LFLAGS_CONSOLE = /SUBSYSTEM:WINDOWSCE,6.00 /MACHINE:X86 /ENTRY:mainACRTStartup
|
||||
QMAKE_LFLAGS_CONSOLE = /SUBSYSTEM:WINDOWSCE,6.00 /MACHINE:X86
|
||||
QMAKE_LFLAGS_WINDOWS = /SUBSYSTEM:WINDOWSCE,6.00 /MACHINE:X86
|
||||
QMAKE_LFLAGS_DLL = /SUBSYSTEM:WINDOWSCE,6.00 /MACHINE:X86 /DLL /SAFESEH:NO
|
||||
QMAKE_LIBFLAGS_RELEASE = /LTCG
|
||||
|
@ -10,7 +10,7 @@ CE_ARCH = armv4i
|
||||
|
||||
DEFINES += QT_NO_CLIPBOARD QT_NO_ACCESSIBILITY QT_NO_NATIVE_GESTURES QT_NOSTANDARDSHELL_UI_MODEL _CRT_SECURE_NO_DEPRECATE _WIN32_WCE=0x700 $$CE_ARCH _AMRV7_ armv7 _ARM_
|
||||
|
||||
QMAKE_LFLAGS_CONSOLE = /SUBSYSTEM:WINDOWSCE,7.00 /MACHINE:THUMB /ENTRY:mainACRTStartup
|
||||
QMAKE_LFLAGS_CONSOLE = /SUBSYSTEM:WINDOWSCE,7.00 /MACHINE:THUMB
|
||||
QMAKE_LFLAGS_WINDOWS = /SUBSYSTEM:WINDOWSCE,7.00 /MACHINE:THUMB
|
||||
QMAKE_LFLAGS_DLL = /SUBSYSTEM:WINDOWSCE,7.00 /MACHINE:THUMB /DLL /SAFESEH:NO
|
||||
QMAKE_LIBFLAGS_RELEASE = /LTCG
|
||||
|
@ -9,7 +9,7 @@ CE_ARCH = _TGTCPU
|
||||
|
||||
DEFINES += QT_NO_NATIVE_GESTURES QT_NOSTANDARDSHELL_UI_MODEL _CRT_SECURE_NO_DEPRECATE _WIN32_WCE=0x700 $$CE_ARCH _X86_ _M_IX86
|
||||
|
||||
QMAKE_LFLAGS_CONSOLE = /SUBSYSTEM:WINDOWSCE,7.00 /MACHINE:X86 /ENTRY:mainACRTStartup
|
||||
QMAKE_LFLAGS_CONSOLE = /SUBSYSTEM:WINDOWSCE,7.00 /MACHINE:X86
|
||||
QMAKE_LFLAGS_WINDOWS = /SUBSYSTEM:WINDOWSCE,7.00 /MACHINE:X86
|
||||
QMAKE_LFLAGS_DLL = /SUBSYSTEM:WINDOWSCE,7.00 /MACHINE:X86 /DLL /SAFESEH:NO
|
||||
QMAKE_LIBFLAGS_RELEASE = /LTCG
|
||||
|
@ -4328,7 +4328,7 @@
|
||||
This tutorial teaches you the basics of qmake. The other topics in this
|
||||
manual contain more detailed information about using qmake.
|
||||
|
||||
\section1 Starting off Simple
|
||||
\section1 Starting Off Simple
|
||||
|
||||
Let's assume that you have just finished a basic implementation of
|
||||
your application, and you have created the following files:
|
||||
|
@ -306,8 +306,6 @@ UnixMakefileGenerator::init()
|
||||
}
|
||||
if(!bundle.isEmpty()) {
|
||||
project->values("QMAKE_BUNDLE") = ProStringList(bundle);
|
||||
project->values("ALL_DEPS") += project->first("QMAKE_PKGINFO");
|
||||
project->values("ALL_DEPS") += project->first("QMAKE_BUNDLE_RESOURCE_FILE");
|
||||
} else {
|
||||
project->values("QMAKE_BUNDLE").clear();
|
||||
project->values("QMAKE_BUNDLE_LOCATION").clear();
|
||||
|
@ -430,6 +430,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
|
||||
}
|
||||
}
|
||||
}
|
||||
QString allDeps;
|
||||
if (!project->values("QMAKE_APP_FLAG").isEmpty() || project->first("TEMPLATE") == "aux") {
|
||||
QString destdir = project->first("DESTDIR").toQString();
|
||||
if(!project->isEmpty("QMAKE_BUNDLE")) {
|
||||
@ -490,8 +491,6 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
|
||||
deps.prepend(incr_target_dir + " ");
|
||||
incr_deps = "$(OBJECTS)";
|
||||
}
|
||||
t << "all: " << escapeDependencyPath(deps) << " " << valGlue(escapeDependencyPaths(project->values("ALL_DEPS")),""," "," ") << "$(TARGET)"
|
||||
<< endl << endl;
|
||||
|
||||
//real target
|
||||
t << var("TARGET") << ": " << var("PRE_TARGETDEPS") << " " << incr_deps << " " << target_deps
|
||||
@ -505,9 +504,6 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
|
||||
t << "\n\t" << var("QMAKE_POST_LINK");
|
||||
t << endl << endl;
|
||||
} else {
|
||||
t << "all: " << escapeDependencyPath(deps) << " " << valGlue(escapeDependencyPaths(project->values("ALL_DEPS")),""," "," ") << "$(TARGET)"
|
||||
<< endl << endl;
|
||||
|
||||
t << "$(TARGET): " << var("PRE_TARGETDEPS") << " $(OBJECTS) "
|
||||
<< target_deps << " " << var("POST_TARGETDEPS") << "\n\t";
|
||||
if (project->first("TEMPLATE") != "aux") {
|
||||
@ -521,6 +517,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
|
||||
}
|
||||
t << endl << endl;
|
||||
}
|
||||
allDeps = " $(TARGET)";
|
||||
} else if(!project->isActiveConfig("staticlib")) {
|
||||
QString destdir = unescapeFilePath(project->first("DESTDIR").toQString()), incr_deps;
|
||||
if(!project->isEmpty("QMAKE_BUNDLE")) {
|
||||
@ -580,19 +577,15 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
|
||||
incr_deps = "$(OBJECTS)";
|
||||
}
|
||||
|
||||
t << "all: " << escapeDependencyPath(deps) << " " << valGlue(escapeDependencyPaths(project->values("ALL_DEPS")),""," "," ")
|
||||
<< " " << destdir << "$(TARGET)\n\n";
|
||||
|
||||
//real target
|
||||
t << destdir << "$(TARGET): " << var("PRE_TARGETDEPS") << " "
|
||||
<< incr_deps << " $(SUBLIBS) " << target_deps << " " << var("POST_TARGETDEPS");
|
||||
} else {
|
||||
t << "all: " << escapeDependencyPath(deps) << " " << valGlue(escapeDependencyPaths(project->values("ALL_DEPS")),""," "," ") << " " <<
|
||||
destdir << "$(TARGET)\n\n";
|
||||
t << destdir << "$(TARGET): " << var("PRE_TARGETDEPS")
|
||||
<< " $(OBJECTS) $(SUBLIBS) $(OBJCOMP) " << target_deps
|
||||
<< " " << var("POST_TARGETDEPS");
|
||||
}
|
||||
allDeps = ' ' + destdir + "$(TARGET)";
|
||||
if(!destdir.isEmpty())
|
||||
t << "\n\t" << mkdir_p_asstring(destdir, false);
|
||||
if(!project->isEmpty("QMAKE_PRE_LINK"))
|
||||
@ -695,9 +688,9 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
|
||||
}
|
||||
} else {
|
||||
QString destdir = project->first("DESTDIR").toQString();
|
||||
t << "all: " << escapeDependencyPath(deps) << " " << valGlue(escapeDependencyPaths(project->values("ALL_DEPS")),""," "," ") << destdir << "$(TARGET) "
|
||||
<< varGlue("QMAKE_AR_SUBLIBS", destdir, " " + destdir, "") << "\n\n"
|
||||
<< "staticlib: " << destdir << "$(TARGET)\n\n";
|
||||
allDeps = ' ' + destdir + "$(TARGET)"
|
||||
+ varGlue("QMAKE_AR_SUBLIBS", ' ' + destdir, ' ' + destdir, "");
|
||||
t << "staticlib: " << destdir << "$(TARGET)\n\n";
|
||||
if(project->isEmpty("QMAKE_AR_SUBLIBS")) {
|
||||
t << destdir << "$(TARGET): " << var("PRE_TARGETDEPS")
|
||||
<< " $(OBJECTS) $(OBJCOMP) " << var("POST_TARGETDEPS") << "\n\t";
|
||||
@ -763,85 +756,111 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
|
||||
<< "@$(QMAKE) -prl " << buildArgs() << " " << project->projectFile() << endl;
|
||||
}
|
||||
|
||||
if(!project->first("QMAKE_PKGINFO").isEmpty()) {
|
||||
ProString pkginfo = escapeFilePath(project->first("QMAKE_PKGINFO"));
|
||||
QString destdir = project->first("DESTDIR") + project->first("QMAKE_BUNDLE") + "/Contents";
|
||||
t << pkginfo << ": \n\t";
|
||||
if(!destdir.isEmpty())
|
||||
t << mkdir_p_asstring(destdir) << "\n\t";
|
||||
t << "@$(DEL_FILE) " << pkginfo << "\n\t"
|
||||
<< "@echo \"APPL"
|
||||
<< (project->isEmpty("QMAKE_PKGINFO_TYPEINFO") ? QString::fromLatin1("????") : project->first("QMAKE_PKGINFO_TYPEINFO").left(4))
|
||||
<< "\" >" << pkginfo << endl;
|
||||
}
|
||||
if(!project->first("QMAKE_BUNDLE_RESOURCE_FILE").isEmpty()) {
|
||||
ProString resources = escapeFilePath(project->first("QMAKE_BUNDLE_RESOURCE_FILE"));
|
||||
bundledFiles << resources;
|
||||
QString destdir = project->first("DESTDIR") + project->first("QMAKE_BUNDLE") + "/Contents/Resources";
|
||||
t << resources << ": \n\t";
|
||||
t << mkdir_p_asstring(destdir) << "\n\t";
|
||||
t << "@touch " << resources << "\n\t\n";
|
||||
}
|
||||
if(!project->isEmpty("QMAKE_BUNDLE")) {
|
||||
//copy the plist
|
||||
QString info_plist = escapeFilePath(fileFixify(project->first("QMAKE_INFO_PLIST").toQString())),
|
||||
info_plist_out = escapeFilePath(project->first("QMAKE_INFO_PLIST_OUT").toQString());
|
||||
if (info_plist.isEmpty())
|
||||
info_plist = specdir() + QDir::separator() + "Info.plist." + project->first("TEMPLATE");
|
||||
bundledFiles << info_plist_out;
|
||||
QString destdir = info_plist_out.section(Option::dir_sep, 0, -2);
|
||||
t << info_plist_out << ": \n\t";
|
||||
if(!destdir.isEmpty())
|
||||
t << mkdir_p_asstring(destdir, false) << "\n\t";
|
||||
ProStringList commonSedArgs;
|
||||
if (!project->values("VERSION").isEmpty())
|
||||
commonSedArgs << "-e \"s,@SHORT_VERSION@," << project->first("VER_MAJ") << "." << project->first("VER_MIN") << ",g\" ";
|
||||
commonSedArgs << "-e \"s,@TYPEINFO@,"<< (project->isEmpty("QMAKE_PKGINFO_TYPEINFO") ?
|
||||
QString::fromLatin1("????") : project->first("QMAKE_PKGINFO_TYPEINFO").left(4)) << ",g\" ";
|
||||
if(project->first("TEMPLATE") == "app") {
|
||||
QString icon = fileFixify(var("ICON"));
|
||||
QString bundlePrefix = project->first("QMAKE_TARGET_BUNDLE_PREFIX").toQString();
|
||||
if (bundlePrefix.isEmpty())
|
||||
bundlePrefix = "com.yourcompany";
|
||||
if (bundlePrefix.endsWith("."))
|
||||
bundlePrefix.chop(1);
|
||||
QString bundleIdentifier = bundlePrefix + "." + var("QMAKE_BUNDLE");
|
||||
if (bundleIdentifier.endsWith(".app"))
|
||||
bundleIdentifier.chop(4);
|
||||
t << "@$(DEL_FILE) " << info_plist_out << "\n\t"
|
||||
<< "@sed ";
|
||||
foreach (const ProString &arg, commonSedArgs)
|
||||
t << arg;
|
||||
t << "-e \"s,@ICON@," << icon.section(Option::dir_sep, -1) << ",g\" "
|
||||
<< "-e \"s,@BUNDLEIDENTIFIER@," << bundleIdentifier << ",g\" "
|
||||
<< "-e \"s,@EXECUTABLE@," << var("QMAKE_ORIG_TARGET") << ",g\" "
|
||||
<< "-e \"s,@TYPEINFO@,"<< (project->isEmpty("QMAKE_PKGINFO_TYPEINFO") ?
|
||||
QString::fromLatin1("????") : project->first("QMAKE_PKGINFO_TYPEINFO").left(4)) << ",g\" "
|
||||
<< "" << info_plist << " >" << info_plist_out << endl;
|
||||
//copy the icon
|
||||
if(!project->isEmpty("ICON")) {
|
||||
QString dir = project->first("DESTDIR") + project->first("QMAKE_BUNDLE") + "/Contents/Resources/";
|
||||
const QString icon_path = escapeFilePath(dir + icon.section(Option::dir_sep, -1));
|
||||
bundledFiles << icon_path;
|
||||
t << icon_path << ": " << icon << "\n\t"
|
||||
<< mkdir_p_asstring(dir) << "\n\t"
|
||||
<< "@$(DEL_FILE) " << icon_path << "\n\t"
|
||||
<< "@$(COPY_FILE) " << escapeFilePath(icon) << " " << icon_path << endl;
|
||||
}
|
||||
} else {
|
||||
t << "@$(DEL_FILE) " << info_plist_out << "\n\t"
|
||||
<< "@sed ";
|
||||
foreach (const ProString &arg, commonSedArgs)
|
||||
t << arg;
|
||||
t << "-e \"s,@LIBRARY@," << var("QMAKE_ORIG_TARGET") << ",g\" "
|
||||
<< "-e \"s,@TYPEINFO@,"
|
||||
<< (project->isEmpty("QMAKE_PKGINFO_TYPEINFO") ?
|
||||
QString::fromLatin1("????") : project->first("QMAKE_PKGINFO_TYPEINFO").left(4)) << ",g\" "
|
||||
<< "" << info_plist << " >" << info_plist_out << endl;
|
||||
if (!project->isEmpty("QMAKE_BUNDLE")) {
|
||||
QHash<QString, QString> symlinks;
|
||||
ProStringList &alldeps = project->values("ALL_DEPS");
|
||||
QString bundle_dir = project->first("DESTDIR") + project->first("QMAKE_BUNDLE") + "/";
|
||||
if (!project->first("QMAKE_PKGINFO").isEmpty()) {
|
||||
ProString pkginfo = escapeFilePath(project->first("QMAKE_PKGINFO"));
|
||||
bundledFiles << pkginfo;
|
||||
alldeps << pkginfo;
|
||||
QString destdir = bundle_dir + "Contents";
|
||||
t << pkginfo << ": \n\t";
|
||||
if (!destdir.isEmpty())
|
||||
t << mkdir_p_asstring(destdir) << "\n\t";
|
||||
t << "@$(DEL_FILE) " << pkginfo << "\n\t"
|
||||
<< "@echo \"APPL"
|
||||
<< (project->isEmpty("QMAKE_PKGINFO_TYPEINFO")
|
||||
? QString::fromLatin1("????") : project->first("QMAKE_PKGINFO_TYPEINFO").left(4))
|
||||
<< "\" >" << pkginfo << endl;
|
||||
}
|
||||
if (!project->first("QMAKE_BUNDLE_RESOURCE_FILE").isEmpty()) {
|
||||
ProString resources = escapeFilePath(project->first("QMAKE_BUNDLE_RESOURCE_FILE"));
|
||||
bundledFiles << resources;
|
||||
alldeps << resources;
|
||||
QString destdir = bundle_dir + "Contents/Resources";
|
||||
t << resources << ": \n\t";
|
||||
t << mkdir_p_asstring(destdir) << "\n\t";
|
||||
t << "@touch " << resources << "\n\t\n";
|
||||
}
|
||||
//copy the plist
|
||||
while (!project->isActiveConfig("no_plist")) { // 'while' just to be able to 'break'
|
||||
QString info_plist = escapeFilePath(fileFixify(project->first("QMAKE_INFO_PLIST").toQString()));
|
||||
if (info_plist.isEmpty())
|
||||
info_plist = specdir() + QDir::separator() + "Info.plist." + project->first("TEMPLATE");
|
||||
if (!exists(Option::fixPathToLocalOS(info_plist))) {
|
||||
warn_msg(WarnLogic, "Could not resolve Info.plist: '%s'. Check if QMAKE_INFO_PLIST points to a valid file.",
|
||||
info_plist.toLatin1().constData());
|
||||
break;
|
||||
}
|
||||
bool isApp = (project->first("TEMPLATE") == "app");
|
||||
QString info_plist_out = escapeFilePath(
|
||||
bundle_dir + (isApp ? "Contents/Info.plist"
|
||||
: "Versions/" + project->first("QMAKE_FRAMEWORK_VERSION")
|
||||
+ "/Resources/Info.plist"));
|
||||
bundledFiles << info_plist_out;
|
||||
alldeps << info_plist_out;
|
||||
QString destdir = info_plist_out.section(Option::dir_sep, 0, -2);
|
||||
t << info_plist_out << ": \n\t";
|
||||
if (!destdir.isEmpty())
|
||||
t << mkdir_p_asstring(destdir, false) << "\n\t";
|
||||
ProStringList commonSedArgs;
|
||||
if (!project->values("VERSION").isEmpty()) {
|
||||
commonSedArgs << "-e \"s,@SHORT_VERSION@," << project->first("VER_MAJ") << "."
|
||||
<< project->first("VER_MIN") << ",g\" ";
|
||||
commonSedArgs << "-e \"s,@FULL_VERSION@," << project->first("VER_MAJ") << "."
|
||||
<< project->first("VER_MIN") << "."
|
||||
<< project->first("VER_PAT") << ",g\" ";
|
||||
}
|
||||
commonSedArgs << "-e \"s,@TYPEINFO@,"<< (project->isEmpty("QMAKE_PKGINFO_TYPEINFO") ?
|
||||
QString::fromLatin1("????") : project->first("QMAKE_PKGINFO_TYPEINFO").left(4)) << ",g\" ";
|
||||
if (isApp) {
|
||||
QString icon = fileFixify(var("ICON"));
|
||||
QString bundlePrefix = project->first("QMAKE_TARGET_BUNDLE_PREFIX").toQString();
|
||||
if (bundlePrefix.isEmpty())
|
||||
bundlePrefix = "com.yourcompany";
|
||||
if (bundlePrefix.endsWith("."))
|
||||
bundlePrefix.chop(1);
|
||||
QString bundleIdentifier = bundlePrefix + "." + var("QMAKE_BUNDLE");
|
||||
if (bundleIdentifier.endsWith(".app"))
|
||||
bundleIdentifier.chop(4);
|
||||
t << "@$(DEL_FILE) " << info_plist_out << "\n\t"
|
||||
<< "@sed ";
|
||||
foreach (const ProString &arg, commonSedArgs)
|
||||
t << arg;
|
||||
t << "-e \"s,@ICON@," << icon.section(Option::dir_sep, -1) << ",g\" "
|
||||
<< "-e \"s,@BUNDLEIDENTIFIER@," << bundleIdentifier << ",g\" "
|
||||
<< "-e \"s,@EXECUTABLE@," << var("QMAKE_ORIG_TARGET") << ",g\" "
|
||||
<< "-e \"s,@TYPEINFO@,"<< (project->isEmpty("QMAKE_PKGINFO_TYPEINFO") ?
|
||||
QString::fromLatin1("????") : project->first("QMAKE_PKGINFO_TYPEINFO").left(4)) << ",g\" "
|
||||
<< "" << info_plist << " >" << info_plist_out << endl;
|
||||
//copy the icon
|
||||
if (!project->isEmpty("ICON")) {
|
||||
QString dir = bundle_dir + "Contents/Resources/";
|
||||
const QString icon_path = escapeFilePath(dir + icon.section(Option::dir_sep, -1));
|
||||
bundledFiles << icon_path;
|
||||
alldeps << icon_path;
|
||||
t << icon_path << ": " << icon << "\n\t"
|
||||
<< mkdir_p_asstring(dir) << "\n\t"
|
||||
<< "@$(DEL_FILE) " << icon_path << "\n\t"
|
||||
<< "@$(COPY_FILE) " << escapeFilePath(icon) << " " << icon_path << endl;
|
||||
}
|
||||
} else {
|
||||
symlinks[bundle_dir + "Resources"] = "Versions/Current/Resources";
|
||||
t << "@$(DEL_FILE) " << info_plist_out << "\n\t"
|
||||
<< "@sed ";
|
||||
foreach (const ProString &arg, commonSedArgs)
|
||||
t << arg;
|
||||
t << "-e \"s,@LIBRARY@," << var("QMAKE_ORIG_TARGET") << ",g\" "
|
||||
<< "-e \"s,@TYPEINFO@,"
|
||||
<< (project->isEmpty("QMAKE_PKGINFO_TYPEINFO") ?
|
||||
QString::fromLatin1("????") : project->first("QMAKE_PKGINFO_TYPEINFO").left(4)) << ",g\" "
|
||||
<< "" << info_plist << " >" << info_plist_out << endl;
|
||||
}
|
||||
break;
|
||||
} // project->isActiveConfig("no_plist")
|
||||
//copy other data
|
||||
if(!project->isEmpty("QMAKE_BUNDLE_DATA")) {
|
||||
QString bundle_dir = project->first("DESTDIR") + project->first("QMAKE_BUNDLE") + "/";
|
||||
const ProStringList &bundle_data = project->values("QMAKE_BUNDLE_DATA");
|
||||
for(int i = 0; i < bundle_data.count(); i++) {
|
||||
const ProStringList &files = project->values(ProKey(bundle_data[i] + ".files"));
|
||||
@ -851,11 +870,12 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
|
||||
if (!project->isEmpty(vkey)) {
|
||||
QString version = project->first(vkey) + "/" +
|
||||
project->first("QMAKE_FRAMEWORK_VERSION") + "/";
|
||||
QString link = Option::fixPathToLocalOS(path + project->first(pkey));
|
||||
bundledFiles << link;
|
||||
t << link << ": \n\t"
|
||||
<< mkdir_p_asstring(path) << "\n\t"
|
||||
<< "@$(SYMLINK) " << version << project->first(pkey) << " " << path << endl;
|
||||
ProString name = project->first(pkey);
|
||||
int pos = name.indexOf('/');
|
||||
if (pos > 0)
|
||||
name = name.mid(0, pos);
|
||||
symlinks[Option::fixPathToLocalOS(path + name)] =
|
||||
project->first(vkey) + "/Current/" + name;
|
||||
path += version;
|
||||
}
|
||||
path += project->first(pkey).toQString();
|
||||
@ -868,6 +888,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
|
||||
src = escapeFilePath(src);
|
||||
const QString dst = escapeFilePath(path + Option::dir_sep + fileInfo(fn).fileName());
|
||||
bundledFiles << dst;
|
||||
alldeps << dst;
|
||||
t << dst << ": " << src << "\n\t"
|
||||
<< mkdir_p_asstring(path) << "\n\t";
|
||||
QFileInfo fi(fileInfo(fn));
|
||||
@ -880,8 +901,21 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
|
||||
}
|
||||
}
|
||||
}
|
||||
QHash<QString, QString>::ConstIterator symIt = symlinks.constBegin(),
|
||||
symEnd = symlinks.constEnd();
|
||||
for (; symIt != symEnd; ++symIt) {
|
||||
bundledFiles << symIt.key();
|
||||
alldeps << symIt.key();
|
||||
t << symIt.key() << ":\n\t"
|
||||
<< mkdir_p_asstring(bundle_dir) << "\n\t"
|
||||
<< "@$(SYMLINK) " << symIt.value() << " " << bundle_dir << endl;
|
||||
}
|
||||
}
|
||||
|
||||
t << endl << "all: " << escapeDependencyPath(deps)
|
||||
<< valGlue(escapeDependencyPaths(project->values("ALL_DEPS")), " \\\n\t\t", " \\\n\t\t", "")
|
||||
<< allDeps << endl << endl;
|
||||
|
||||
t << "dist: distdir FORCE\n\t";
|
||||
t << "(cd `dirname $(DISTDIR)` && $(TAR) $(DISTNAME).tar $(DISTNAME) && $(COMPRESS) $(DISTNAME).tar)"
|
||||
" && $(MOVE) `dirname $(DISTDIR)`" << Option::dir_sep << "$(DISTNAME).tar.gz ."
|
||||
@ -1315,44 +1349,6 @@ void UnixMakefileGenerator::init2()
|
||||
project->values("QMAKE_CFLAGS") += MD_flag;
|
||||
project->values("QMAKE_CXXFLAGS") += MD_flag;
|
||||
}
|
||||
|
||||
if(!project->isEmpty("QMAKE_BUNDLE")) {
|
||||
QString plist = fileFixify(project->first("QMAKE_INFO_PLIST").toQString(), qmake_getpwd());
|
||||
if(plist.isEmpty())
|
||||
plist = specdir() + QDir::separator() + "Info.plist." + project->first("TEMPLATE");
|
||||
if(exists(Option::fixPathToLocalOS(plist))) {
|
||||
project->values("QMAKE_INFO_PLIST_OUT").append(project->first("DESTDIR") +
|
||||
project->first("QMAKE_BUNDLE") +
|
||||
"/Contents/Info.plist");
|
||||
project->values("ALL_DEPS") += project->first("QMAKE_INFO_PLIST_OUT");
|
||||
if(!project->isEmpty("ICON") && project->first("TEMPLATE") == "app")
|
||||
project->values("ALL_DEPS") += project->first("DESTDIR") +
|
||||
project->first("QMAKE_BUNDLE") +
|
||||
"/Contents/Resources/" + project->first("ICON").toQString().section('/', -1);
|
||||
if(!project->isEmpty("QMAKE_BUNDLE_DATA")) {
|
||||
QString bundle_dir = project->first("DESTDIR") + project->first("QMAKE_BUNDLE") + "/";
|
||||
ProStringList &alldeps = project->values("ALL_DEPS");
|
||||
const ProStringList &bundle_data = project->values("QMAKE_BUNDLE_DATA");
|
||||
for(int i = 0; i < bundle_data.count(); i++) {
|
||||
const ProStringList &files = project->values(ProKey(bundle_data[i] + ".files"));
|
||||
QString path = bundle_dir;
|
||||
const ProKey vkey(bundle_data[i] + ".version");
|
||||
const ProKey pkey(bundle_data[i] + ".path");
|
||||
if (!project->isEmpty(vkey)) {
|
||||
alldeps += Option::fixPathToLocalOS(path + Option::dir_sep + project->first(pkey));
|
||||
path += project->first(vkey) + "/" +
|
||||
project->first("QMAKE_FRAMEWORK_VERSION") + "/";
|
||||
}
|
||||
path += project->first(pkey);
|
||||
path = Option::fixPathToLocalOS(path);
|
||||
for(int file = 0; file < files.count(); file++)
|
||||
alldeps += path + Option::dir_sep + fileInfo(files[file].toQString()).fileName();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
warn_msg(WarnLogic, "Could not resolve Info.plist: '%s'. Check if QMAKE_INFO_PLIST points to a valid file.", plist.toLatin1().constData());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QString
|
||||
|
@ -97,7 +97,7 @@ bool CeSdkHandler::parse()
|
||||
return false;
|
||||
}
|
||||
|
||||
return m_list.size() > 0 ? true : false;
|
||||
return m_list.size() > 0;
|
||||
}
|
||||
|
||||
QString CeSdkHandler::fixPaths(QString path) const
|
||||
|
@ -341,7 +341,8 @@ static QStringList unquote(const QStringList &values)
|
||||
}
|
||||
|
||||
// Tree file generation ---------------------------------------------
|
||||
void XTreeNode::generateXML(XmlOutput &xml, XmlOutput &xmlFilter, const QString &tagName, VCProject &tool, const QString &filter) {
|
||||
void XTreeNode::generateXML(XmlOutput &xml, XmlOutput &xmlFilter, const QString &tagName,
|
||||
VCProject &tool, const QString &filter, const QString &filterId) {
|
||||
|
||||
if (children.size()) {
|
||||
// Filter
|
||||
@ -362,38 +363,39 @@ void XTreeNode::generateXML(XmlOutput &xml, XmlOutput &xmlFilter, const QString
|
||||
if ((*it)->children.size())
|
||||
{
|
||||
if ( !tempFilterName.isEmpty() )
|
||||
(*it)->generateXML(xml, xmlFilter, it.key(), tool, tempFilterName);
|
||||
(*it)->generateXML(xml, xmlFilter, it.key(), tool, tempFilterName, filterId);
|
||||
else
|
||||
(*it)->generateXML(xml, xmlFilter, it.key(), tool, filter);
|
||||
(*it)->generateXML(xml, xmlFilter, it.key(), tool, filter, filterId);
|
||||
}
|
||||
// Second round, do leafs
|
||||
for (it = children.constBegin(); it != end; ++it)
|
||||
if (!(*it)->children.size())
|
||||
{
|
||||
if ( !tempFilterName.isEmpty() )
|
||||
(*it)->generateXML(xml, xmlFilter, it.key(), tool, tempFilterName);
|
||||
(*it)->generateXML(xml, xmlFilter, it.key(), tool, tempFilterName, filterId);
|
||||
else
|
||||
(*it)->generateXML(xml, xmlFilter, it.key(), tool, filter);
|
||||
(*it)->generateXML(xml, xmlFilter, it.key(), tool, filter, filterId);
|
||||
}
|
||||
} else {
|
||||
// Leaf
|
||||
xml << tag(_ItemGroup);
|
||||
xmlFilter << tag(_ItemGroup);
|
||||
VCXProjectWriter::outputFileConfigs(tool, xml, xmlFilter, info, filter);
|
||||
VCXProjectWriter::outputFileConfigs(tool, xml, xmlFilter, info, filter, filterId);
|
||||
xmlFilter << closetag();
|
||||
xml << closetag();
|
||||
}
|
||||
}
|
||||
|
||||
// Flat file generation ---------------------------------------------
|
||||
void XFlatNode::generateXML(XmlOutput &xml, XmlOutput &xmlFilter, const QString &/*tagName*/, VCProject &tool, const QString &filter) {
|
||||
void XFlatNode::generateXML(XmlOutput &xml, XmlOutput &xmlFilter, const QString &/*tagName*/,
|
||||
VCProject &tool, const QString &filter, const QString &filterId) {
|
||||
if (children.size()) {
|
||||
ChildrenMapFlat::ConstIterator it = children.constBegin();
|
||||
ChildrenMapFlat::ConstIterator end = children.constEnd();
|
||||
xml << tag(_ItemGroup);
|
||||
xmlFilter << tag(_ItemGroup);
|
||||
for (; it != end; ++it) {
|
||||
VCXProjectWriter::outputFileConfigs(tool, xml, xmlFilter, (*it), filter);
|
||||
VCXProjectWriter::outputFileConfigs(tool, xml, xmlFilter, (*it), filter, filterId);
|
||||
}
|
||||
xml << closetag();
|
||||
xmlFilter << closetag();
|
||||
@ -1836,22 +1838,47 @@ void VCXProjectWriter::outputFilter(VCProject &project, XmlOutput &xml, XmlOutpu
|
||||
if (!root->hasElements())
|
||||
return;
|
||||
|
||||
root->generateXML(xml, xmlFilter, "", project, filtername); // output root tree
|
||||
root->generateXML(xml, xmlFilter, "", project, filtername, filtername); // output root tree
|
||||
}
|
||||
|
||||
// Output all configurations (by filtername) for a file (by info)
|
||||
// A filters config output is in VCFilter.outputFileConfig()
|
||||
void VCXProjectWriter::outputFileConfigs(VCProject &project, XmlOutput &xml, XmlOutput &xmlFilter, const VCFilterFile &info, const QString &filtername)
|
||||
void VCXProjectWriter::outputFileConfigs(VCProject &project, XmlOutput &xml, XmlOutput &xmlFilter,
|
||||
const VCFilterFile &info, const QString &filtername,
|
||||
const QString &filterId)
|
||||
{
|
||||
// We need to check if the file has any custom build step.
|
||||
// If there is one then it has to be included with "CustomBuild Include"
|
||||
bool fileAdded = false;
|
||||
|
||||
bool hasCustomBuildStep = false;
|
||||
QVarLengthArray<OutputFilterData> data(project.SingleProjects.count());
|
||||
for (int i = 0; i < project.SingleProjects.count(); ++i) {
|
||||
const VCFilter &filter = project.SingleProjects.at(i).filterByName(filtername);
|
||||
if (filter.Config) // only if the filter is not empty
|
||||
if (outputFileConfig(filter, xml, xmlFilter, info.file, fileAdded)) // only add it once.
|
||||
fileAdded = true;
|
||||
data[i].filter = project.SingleProjects.at(i).filterByName(filterId);
|
||||
if (!data[i].filter.Config) // only if the filter is not empty
|
||||
continue;
|
||||
VCFilter &filter = data[i].filter;
|
||||
|
||||
// Clearing each filter tool
|
||||
filter.useCustomBuildTool = false;
|
||||
filter.useCompilerTool = false;
|
||||
filter.CustomBuildTool = VCCustomBuildTool();
|
||||
filter.CustomBuildTool.config = filter.Config;
|
||||
filter.CompilerTool = VCCLCompilerTool();
|
||||
filter.CompilerTool.config = filter.Config;
|
||||
|
||||
VCFilterFile fileInFilter = filter.findFile(info.file, &data[i].inBuild);
|
||||
data[i].inBuild &= !fileInFilter.excludeFromBuild;
|
||||
if (data[i].inBuild && filter.addExtraCompiler(fileInFilter))
|
||||
hasCustomBuildStep = true;
|
||||
}
|
||||
|
||||
bool fileAdded = false;
|
||||
for (int i = 0; i < project.SingleProjects.count(); ++i) {
|
||||
const VCFilter &filter = project.SingleProjects.at(i).filterByName(filterId);
|
||||
if (!filter.Config) // only if the filter is not empty
|
||||
continue;
|
||||
if (outputFileConfig(&data[i], xml, xmlFilter, info.file, fileAdded,
|
||||
hasCustomBuildStep))
|
||||
fileAdded = true;
|
||||
}
|
||||
|
||||
if ( !fileAdded )
|
||||
@ -1861,42 +1888,25 @@ void VCXProjectWriter::outputFileConfigs(VCProject &project, XmlOutput &xml, Xml
|
||||
xmlFilter << closetag();
|
||||
}
|
||||
|
||||
bool VCXProjectWriter::outputFileConfig(VCFilter filter, XmlOutput &xml, XmlOutput &xmlFilter,
|
||||
const QString &filename, bool fileAdded)
|
||||
bool VCXProjectWriter::outputFileConfig(OutputFilterData *d, XmlOutput &xml, XmlOutput &xmlFilter,
|
||||
const QString &filename, bool fileAdded,
|
||||
bool hasCustomBuildStep)
|
||||
{
|
||||
// Clearing each filter tool
|
||||
filter.useCustomBuildTool = false;
|
||||
filter.useCompilerTool = false;
|
||||
filter.CustomBuildTool = VCCustomBuildTool();
|
||||
filter.CustomBuildTool.config = filter.Config;
|
||||
filter.CompilerTool = VCCLCompilerTool();
|
||||
filter.CompilerTool.config = filter.Config;
|
||||
|
||||
bool inBuild = false;
|
||||
VCFilterFile info;
|
||||
for (int i = 0; i < filter.Files.count(); ++i) {
|
||||
if (filter.Files.at(i).file == filename) {
|
||||
info = filter.Files.at(i);
|
||||
inBuild = true;
|
||||
}
|
||||
}
|
||||
inBuild &= !info.excludeFromBuild;
|
||||
|
||||
if (inBuild) {
|
||||
filter.addExtraCompiler(info);
|
||||
VCFilter &filter = d->filter;
|
||||
if (d->inBuild) {
|
||||
if (filter.Project->usePCH)
|
||||
filter.modifyPCHstage(info.file);
|
||||
filter.modifyPCHstage(filename);
|
||||
} else {
|
||||
// Excluded files uses an empty compiler stage
|
||||
if(info.excludeFromBuild)
|
||||
if (d->info.excludeFromBuild)
|
||||
filter.useCompilerTool = true;
|
||||
}
|
||||
|
||||
// Actual XML output ----------------------------------
|
||||
if (filter.useCustomBuildTool || filter.useCompilerTool
|
||||
|| !inBuild || filter.Name.startsWith("Deployment Files")) {
|
||||
if (hasCustomBuildStep || filter.useCompilerTool
|
||||
|| !d->inBuild || filter.Name.startsWith("Deployment Files")) {
|
||||
|
||||
if (filter.useCustomBuildTool)
|
||||
if (hasCustomBuildStep)
|
||||
{
|
||||
if (!fileAdded) {
|
||||
fileAdded = true;
|
||||
@ -1925,13 +1935,13 @@ bool VCXProjectWriter::outputFileConfig(VCFilter filter, XmlOutput &xml, XmlOutp
|
||||
}
|
||||
|
||||
const QString condition = generateCondition(*filter.Config);
|
||||
if(!inBuild) {
|
||||
if (!d->inBuild) {
|
||||
xml << tag("ExcludedFromBuild")
|
||||
<< attrTag("Condition", condition)
|
||||
<< valueTag("true");
|
||||
}
|
||||
|
||||
if (filter.Name.startsWith("Deployment Files") && inBuild) {
|
||||
if (filter.Name.startsWith("Deployment Files") && d->inBuild) {
|
||||
xml << tag("DeploymentContent")
|
||||
<< attrTag("Condition", condition)
|
||||
<< valueTag("true");
|
||||
|
@ -56,7 +56,8 @@ public:
|
||||
}
|
||||
virtual void addElement(const QString &filepath, const VCFilterFile &allInfo) = 0;
|
||||
virtual void removeElements()= 0;
|
||||
virtual void generateXML(XmlOutput &xml, XmlOutput &xmlFilter, const QString &tagName, VCProject &tool, const QString &filter) = 0;
|
||||
virtual void generateXML(XmlOutput &xml, XmlOutput &xmlFilter, const QString &tagName,
|
||||
VCProject &tool, const QString &filter, const QString &filterId) = 0;
|
||||
virtual bool hasElements() = 0;
|
||||
};
|
||||
|
||||
@ -106,7 +107,8 @@ public:
|
||||
children.clear();
|
||||
}
|
||||
|
||||
void generateXML(XmlOutput &xml, XmlOutput &xmlFilter, const QString &tagName, VCProject &tool, const QString &filter);
|
||||
void generateXML(XmlOutput &xml, XmlOutput &xmlFilter, const QString &tagName, VCProject &tool,
|
||||
const QString &filter, const QString &filterId);
|
||||
bool hasElements() {
|
||||
return children.size() != 0;
|
||||
}
|
||||
@ -146,7 +148,8 @@ public:
|
||||
children.clear();
|
||||
}
|
||||
|
||||
void generateXML(XmlOutput &xml, XmlOutput &xmlFilter, const QString &tagName, VCProject &proj, const QString &filter);
|
||||
void generateXML(XmlOutput &xml, XmlOutput &xmlFilter, const QString &tagName, VCProject &proj,
|
||||
const QString &filter, const QString &filterId);
|
||||
bool hasElements() {
|
||||
return children.size() != 0;
|
||||
}
|
||||
@ -171,10 +174,17 @@ public:
|
||||
void write(XmlOutput &, VCFilter &);
|
||||
|
||||
private:
|
||||
struct OutputFilterData
|
||||
{
|
||||
VCFilter filter;
|
||||
VCFilterFile info;
|
||||
bool inBuild;
|
||||
};
|
||||
|
||||
static void addFilters(VCProject &project, XmlOutput &xmlFilter, const QString &filterName);
|
||||
static void outputFilter(VCProject &project, XmlOutput &xml, XmlOutput &xmlFilter, const QString &filtername);
|
||||
static void outputFileConfigs(VCProject &project, XmlOutput &xml, XmlOutput &xmlFilter, const VCFilterFile &info, const QString &filtername);
|
||||
static bool outputFileConfig(VCFilter filter, XmlOutput &xml, XmlOutput &xmlFilter, const QString &filename, bool fileAdded);
|
||||
static void outputFileConfigs(VCProject &project, XmlOutput &xml, XmlOutput &xmlFilter, const VCFilterFile &info, const QString &filtername, const QString &filterId);
|
||||
static bool outputFileConfig(OutputFilterData *d, XmlOutput &xml, XmlOutput &xmlFilter, const QString &filename, bool fileAdded, bool hasCustomBuildStep);
|
||||
static void outputFileConfig(XmlOutput &xml, XmlOutput &xmlFilter, const QString &fileName, const QString &filterName);
|
||||
static QString generateCondition(const VCConfiguration &config);
|
||||
|
||||
|
@ -2241,6 +2241,19 @@ void VCFilter::modifyPCHstage(QString str)
|
||||
CompilerTool.ForcedIncludeFiles = QStringList("$(NOINHERIT)");
|
||||
}
|
||||
|
||||
VCFilterFile VCFilter::findFile(const QString &filePath, bool *found) const
|
||||
{
|
||||
for (int i = 0; i < Files.count(); ++i) {
|
||||
const VCFilterFile &f = Files.at(i);
|
||||
if (f.file == filePath) {
|
||||
*found = true;
|
||||
return f;
|
||||
}
|
||||
}
|
||||
*found = false;
|
||||
return VCFilterFile();
|
||||
}
|
||||
|
||||
bool VCFilter::addExtraCompiler(const VCFilterFile &info)
|
||||
{
|
||||
const QStringList &extraCompilers = Project->extraCompilerSources.value(info.file);
|
||||
@ -2508,14 +2521,14 @@ void VCProjectWriter::write(XmlOutput &xml, VCProjectSingleConfig &tool)
|
||||
// XML output functionality
|
||||
VCProject tempProj;
|
||||
tempProj.SingleProjects += tool;
|
||||
outputFilter(tempProj, xml, "Sources");
|
||||
outputFilter(tempProj, xml, "Headers");
|
||||
outputFilter(tempProj, xml, "GeneratedFiles");
|
||||
outputFilter(tempProj, xml, "LexYaccFiles");
|
||||
outputFilter(tempProj, xml, "TranslationFiles");
|
||||
outputFilter(tempProj, xml, "FormFiles");
|
||||
outputFilter(tempProj, xml, "ResourceFiles");
|
||||
outputFilter(tempProj, xml, "DeploymentFiles");
|
||||
outputFilter(tempProj, xml, "Source Files");
|
||||
outputFilter(tempProj, xml, "Header Files");
|
||||
outputFilter(tempProj, xml, "Generated Files");
|
||||
outputFilter(tempProj, xml, "LexYacc Files");
|
||||
outputFilter(tempProj, xml, "Translation Files");
|
||||
outputFilter(tempProj, xml, "Form Files");
|
||||
outputFilter(tempProj, xml, "Resource Files");
|
||||
outputFilter(tempProj, xml, "Deployment Files");
|
||||
|
||||
QSet<QString> extraCompilersInProject;
|
||||
for (int i = 0; i < tool.ExtraCompilersFiles.count(); ++i) {
|
||||
@ -2529,7 +2542,7 @@ void VCProjectWriter::write(XmlOutput &xml, VCProjectSingleConfig &tool)
|
||||
for (int x = 0; x < tempProj.ExtraCompilers.count(); ++x) {
|
||||
outputFilter(tempProj, xml, tempProj.ExtraCompilers.at(x));
|
||||
}
|
||||
outputFilter(tempProj, xml, "RootFiles");
|
||||
outputFilter(tempProj, xml, "Root Files");
|
||||
xml << closetag(q_Files)
|
||||
<< tag(_Globals)
|
||||
<< data(); // No "/>" end tag
|
||||
@ -2561,18 +2574,18 @@ void VCProjectWriter::write(XmlOutput &xml, VCProject &tool)
|
||||
write(xml, tool.SingleProjects.at(i).Configuration);
|
||||
xml << closetag(_Configurations)
|
||||
<< tag(q_Files);
|
||||
outputFilter(tool, xml, "Sources");
|
||||
outputFilter(tool, xml, "Headers");
|
||||
outputFilter(tool, xml, "GeneratedFiles");
|
||||
outputFilter(tool, xml, "LexYaccFiles");
|
||||
outputFilter(tool, xml, "TranslationFiles");
|
||||
outputFilter(tool, xml, "FormFiles");
|
||||
outputFilter(tool, xml, "ResourceFiles");
|
||||
outputFilter(tool, xml, "DeploymentFiles");
|
||||
outputFilter(tool, xml, "Source Files");
|
||||
outputFilter(tool, xml, "Header Files");
|
||||
outputFilter(tool, xml, "Generated Files");
|
||||
outputFilter(tool, xml, "LexYacc Files");
|
||||
outputFilter(tool, xml, "Translation Files");
|
||||
outputFilter(tool, xml, "Form Files");
|
||||
outputFilter(tool, xml, "Resource Files");
|
||||
outputFilter(tool, xml, "Deployment Files");
|
||||
for (int x = 0; x < tool.ExtraCompilers.count(); ++x) {
|
||||
outputFilter(tool, xml, tool.ExtraCompilers.at(x));
|
||||
}
|
||||
outputFilter(tool, xml, "RootFiles");
|
||||
outputFilter(tool, xml, "Root Files");
|
||||
xml << closetag(q_Files)
|
||||
<< tag(_Globals)
|
||||
<< data(); // No "/>" end tag
|
||||
@ -2974,14 +2987,8 @@ void VCProjectWriter::outputFileConfig(VCFilter &filter, XmlOutput &xml, const Q
|
||||
filter.CompilerTool.WarningLevel = warningLevelUnknown;
|
||||
filter.CompilerTool.config = filter.Config;
|
||||
|
||||
bool inBuild = false;
|
||||
VCFilterFile info;
|
||||
for (int i = 0; i < filter.Files.count(); ++i) {
|
||||
if (filter.Files.at(i).file == filename) {
|
||||
info = filter.Files.at(i);
|
||||
inBuild = true;
|
||||
}
|
||||
}
|
||||
bool inBuild;
|
||||
VCFilterFile info = filter.findFile(filename, &inBuild);
|
||||
inBuild &= !info.excludeFromBuild;
|
||||
|
||||
if (inBuild) {
|
||||
|
@ -72,12 +72,6 @@ enum DotNET {
|
||||
forcing the tool to utilize default values.
|
||||
False/True values will be in the output...
|
||||
*/
|
||||
enum customBuildCheck {
|
||||
none,
|
||||
mocSrc,
|
||||
mocHdr,
|
||||
lexyacc
|
||||
};
|
||||
enum triState {
|
||||
unset = -1,
|
||||
_False = 0,
|
||||
@ -958,6 +952,7 @@ public:
|
||||
void addFiles(const ProStringList& fileList);
|
||||
bool addExtraCompiler(const VCFilterFile &info);
|
||||
void modifyPCHstage(QString str);
|
||||
VCFilterFile findFile(const QString &filePath, bool *found) const;
|
||||
|
||||
// Variables
|
||||
QString Name;
|
||||
@ -968,8 +963,6 @@ public:
|
||||
VCConfiguration* Config;
|
||||
QList<VCFilterFile> Files;
|
||||
|
||||
customBuildCheck CustomBuild;
|
||||
|
||||
bool useCustomBuildTool;
|
||||
VCCustomBuildTool CustomBuildTool;
|
||||
|
||||
|
@ -1346,7 +1346,6 @@ void VcprojGenerator::initDeploymentTool()
|
||||
if (conf.WinRT) {
|
||||
vcProject.DeploymentFiles.Project = this;
|
||||
vcProject.DeploymentFiles.Config = &(vcProject.Configuration);
|
||||
vcProject.DeploymentFiles.CustomBuild = none;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1385,7 +1384,6 @@ void VcprojGenerator::initRootFiles()
|
||||
|
||||
vcProject.RootFiles.Project = this;
|
||||
vcProject.RootFiles.Config = &(vcProject.Configuration);
|
||||
vcProject.RootFiles.CustomBuild = none;
|
||||
}
|
||||
|
||||
void VcprojGenerator::initSourceFiles()
|
||||
@ -1398,7 +1396,6 @@ void VcprojGenerator::initSourceFiles()
|
||||
|
||||
vcProject.SourceFiles.Project = this;
|
||||
vcProject.SourceFiles.Config = &(vcProject.Configuration);
|
||||
vcProject.SourceFiles.CustomBuild = none;
|
||||
}
|
||||
|
||||
void VcprojGenerator::initHeaderFiles()
|
||||
@ -1450,7 +1447,6 @@ void VcprojGenerator::initLexYaccFiles()
|
||||
|
||||
vcProject.LexYaccFiles.Project = this;
|
||||
vcProject.LexYaccFiles.Config = &(vcProject.Configuration);
|
||||
vcProject.LexYaccFiles.CustomBuild = lexyacc;
|
||||
}
|
||||
|
||||
void VcprojGenerator::initTranslationFiles()
|
||||
@ -1464,7 +1460,6 @@ void VcprojGenerator::initTranslationFiles()
|
||||
|
||||
vcProject.TranslationFiles.Project = this;
|
||||
vcProject.TranslationFiles.Config = &(vcProject.Configuration);
|
||||
vcProject.TranslationFiles.CustomBuild = none;
|
||||
}
|
||||
|
||||
void VcprojGenerator::initFormFiles()
|
||||
@ -1476,7 +1471,6 @@ void VcprojGenerator::initFormFiles()
|
||||
vcProject.FormFiles.addFiles(project->values("FORMS"));
|
||||
vcProject.FormFiles.Project = this;
|
||||
vcProject.FormFiles.Config = &(vcProject.Configuration);
|
||||
vcProject.FormFiles.CustomBuild = none;
|
||||
}
|
||||
|
||||
void VcprojGenerator::initResourceFiles()
|
||||
@ -1526,7 +1520,6 @@ void VcprojGenerator::initResourceFiles()
|
||||
|
||||
vcProject.ResourceFiles.Project = this;
|
||||
vcProject.ResourceFiles.Config = &(vcProject.Configuration);
|
||||
vcProject.ResourceFiles.CustomBuild = none;
|
||||
}
|
||||
|
||||
void VcprojGenerator::initExtraCompilerOutputs()
|
||||
@ -1603,7 +1596,6 @@ void VcprojGenerator::initExtraCompilerOutputs()
|
||||
}
|
||||
extraCompile.Project = this;
|
||||
extraCompile.Config = &(vcProject.Configuration);
|
||||
extraCompile.CustomBuild = none;
|
||||
|
||||
vcProject.ExtraCompilersFiles.append(extraCompile);
|
||||
}
|
||||
|
1
src/3rdparty/angle/AUTHORS
vendored
1
src/3rdparty/angle/AUTHORS
vendored
@ -20,6 +20,7 @@ Intel Corporation
|
||||
Mozilla Corporation
|
||||
Turbulenz
|
||||
Klarälvdalens Datakonsult AB
|
||||
Microsoft Open Technologies, Inc.
|
||||
|
||||
Jacek Caban
|
||||
Mark Callow
|
||||
|
4
src/3rdparty/angle/CONTRIBUTORS
vendored
4
src/3rdparty/angle/CONTRIBUTORS
vendored
@ -59,6 +59,7 @@ Intel Corporation
|
||||
Jin Yang
|
||||
Andy Chen
|
||||
Josh Triplett
|
||||
Sudarsana Nagineni
|
||||
|
||||
Klarälvdalens Datakonsult AB
|
||||
Milian Wolff
|
||||
@ -78,3 +79,6 @@ Ulrik Persson (ddefrostt)
|
||||
Mark Banner (standard8mbp)
|
||||
David Kilzer
|
||||
|
||||
Microsoft Open Technologies, Inc.
|
||||
Cooper Partin
|
||||
Austin Kinross
|
||||
|
43
src/3rdparty/angle/include/GLSLANG/ShaderLang.h
vendored
43
src/3rdparty/angle/include/GLSLANG/ShaderLang.h
vendored
@ -23,9 +23,10 @@
|
||||
#define COMPILER_EXPORT
|
||||
#endif
|
||||
|
||||
#include "KHR/khrplatform.h"
|
||||
#include <stddef.h>
|
||||
|
||||
#include "KHR/khrplatform.h"
|
||||
|
||||
//
|
||||
// This is the platform independent interface between an OGL driver
|
||||
// and the shading language compiler.
|
||||
@ -37,13 +38,17 @@ namespace sh
|
||||
typedef unsigned int GLenum;
|
||||
}
|
||||
|
||||
// Must be included after GLenum proxy typedef
|
||||
// Note: make sure to increment ANGLE_SH_VERSION when changing ShaderVars.h
|
||||
#include "ShaderVars.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Version number for shader translation API.
|
||||
// It is incremented every time the API changes.
|
||||
#define ANGLE_SH_VERSION 128
|
||||
#define ANGLE_SH_VERSION 130
|
||||
|
||||
typedef enum {
|
||||
SH_GLES2_SPEC = 0x8B40,
|
||||
@ -100,14 +105,9 @@ typedef enum {
|
||||
SH_NAME_MAX_LENGTH = 0x6001,
|
||||
SH_HASHED_NAME_MAX_LENGTH = 0x6002,
|
||||
SH_HASHED_NAMES_COUNT = 0x6003,
|
||||
SH_ACTIVE_UNIFORMS_ARRAY = 0x6004,
|
||||
SH_SHADER_VERSION = 0x6005,
|
||||
SH_ACTIVE_INTERFACE_BLOCKS_ARRAY = 0x6006,
|
||||
SH_ACTIVE_OUTPUT_VARIABLES_ARRAY = 0x6007,
|
||||
SH_ACTIVE_ATTRIBUTES_ARRAY = 0x6008,
|
||||
SH_ACTIVE_VARYINGS_ARRAY = 0x6009,
|
||||
SH_RESOURCES_STRING_LENGTH = 0x600A,
|
||||
SH_OUTPUT_TYPE = 0x600B
|
||||
SH_SHADER_VERSION = 0x6004,
|
||||
SH_RESOURCES_STRING_LENGTH = 0x6005,
|
||||
SH_OUTPUT_TYPE = 0x6006
|
||||
} ShShaderInfo;
|
||||
|
||||
// Compile options.
|
||||
@ -189,6 +189,11 @@ typedef enum {
|
||||
// This flag scalarizes vec/ivec/bvec/mat constructor args.
|
||||
// It is intended as a workaround for Linux/Mac driver bugs.
|
||||
SH_SCALARIZE_VEC_AND_MAT_CONSTRUCTOR_ARGS = 0x40000,
|
||||
|
||||
// This flag overwrites a struct name with a unique prefix.
|
||||
// It is intended as a workaround for drivers that do not handle
|
||||
// struct scopes correctly, including all Mac drivers and Linux AMD.
|
||||
SH_REGENERATE_STRUCT_NAMES = 0x80000,
|
||||
} ShCompileOptions;
|
||||
|
||||
// Defines alternate strategies for implementing array index clamping.
|
||||
@ -453,17 +458,17 @@ COMPILER_EXPORT void ShGetNameHashingEntry(const ShHandle handle,
|
||||
char* name,
|
||||
char* hashedName);
|
||||
|
||||
// Returns a parameter from a compiled shader.
|
||||
// Shader variable inspection.
|
||||
// Returns a pointer to a list of variables of the designated type.
|
||||
// (See ShaderVars.h for type definitions, included above)
|
||||
// Returns NULL on failure.
|
||||
// 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);
|
||||
COMPILER_EXPORT const std::vector<sh::Uniform> *ShGetUniforms(const ShHandle handle);
|
||||
COMPILER_EXPORT const std::vector<sh::Varying> *ShGetVaryings(const ShHandle handle);
|
||||
COMPILER_EXPORT const std::vector<sh::Attribute> *ShGetAttributes(const ShHandle handle);
|
||||
COMPILER_EXPORT const std::vector<sh::Attribute> *ShGetOutputVariables(const ShHandle handle);
|
||||
COMPILER_EXPORT const std::vector<sh::InterfaceBlock> *ShGetInterfaceBlocks(const ShHandle handle);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
123
src/3rdparty/angle/include/GLSLANG/ShaderVars.h
vendored
Normal file
123
src/3rdparty/angle/include/GLSLANG/ShaderVars.h
vendored
Normal file
@ -0,0 +1,123 @@
|
||||
//
|
||||
// Copyright (c) 2013-2014 The ANGLE Project Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
//
|
||||
// ShaderVars.h:
|
||||
// Types to represent GL variables (varyings, uniforms, etc)
|
||||
//
|
||||
|
||||
#ifndef _COMPILER_INTERFACE_VARIABLES_
|
||||
#define _COMPILER_INTERFACE_VARIABLES_
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
|
||||
// Assume ShaderLang.h is included before ShaderVars.h, for sh::GLenum
|
||||
// Note: make sure to increment ANGLE_SH_VERSION when changing ShaderVars.h
|
||||
|
||||
namespace sh
|
||||
{
|
||||
|
||||
// Varying interpolation qualifier, see section 4.3.9 of the ESSL 3.00.4 spec
|
||||
enum InterpolationType
|
||||
{
|
||||
INTERPOLATION_SMOOTH,
|
||||
INTERPOLATION_CENTROID,
|
||||
INTERPOLATION_FLAT
|
||||
};
|
||||
|
||||
// Uniform block layout qualifier, see section 4.3.8.3 of the ESSL 3.00.4 spec
|
||||
enum BlockLayoutType
|
||||
{
|
||||
BLOCKLAYOUT_STANDARD,
|
||||
BLOCKLAYOUT_PACKED,
|
||||
BLOCKLAYOUT_SHARED
|
||||
};
|
||||
|
||||
// Base class for all variables defined in shaders, including Varyings, Uniforms, etc
|
||||
// Note: we must override the copy constructor and assignment operator so we can
|
||||
// work around excessive GCC binary bloating:
|
||||
// See https://code.google.com/p/angleproject/issues/detail?id=697
|
||||
struct COMPILER_EXPORT ShaderVariable
|
||||
{
|
||||
ShaderVariable();
|
||||
ShaderVariable(GLenum typeIn, unsigned int arraySizeIn);
|
||||
~ShaderVariable();
|
||||
ShaderVariable(const ShaderVariable &other);
|
||||
ShaderVariable &operator=(const ShaderVariable &other);
|
||||
|
||||
bool isArray() const { return arraySize > 0; }
|
||||
unsigned int elementCount() const { return std::max(1u, arraySize); }
|
||||
bool isStruct() const { return !fields.empty(); }
|
||||
|
||||
GLenum type;
|
||||
GLenum precision;
|
||||
std::string name;
|
||||
std::string mappedName;
|
||||
unsigned int arraySize;
|
||||
bool staticUse;
|
||||
std::vector<ShaderVariable> fields;
|
||||
std::string structName;
|
||||
};
|
||||
|
||||
struct COMPILER_EXPORT Uniform : public ShaderVariable
|
||||
{
|
||||
Uniform();
|
||||
~Uniform();
|
||||
Uniform(const Uniform &other);
|
||||
Uniform &operator=(const Uniform &other);
|
||||
};
|
||||
|
||||
struct COMPILER_EXPORT Attribute : public ShaderVariable
|
||||
{
|
||||
Attribute();
|
||||
~Attribute();
|
||||
Attribute(const Attribute &other);
|
||||
Attribute &operator=(const Attribute &other);
|
||||
|
||||
int location;
|
||||
};
|
||||
|
||||
struct COMPILER_EXPORT InterfaceBlockField : public ShaderVariable
|
||||
{
|
||||
InterfaceBlockField();
|
||||
~InterfaceBlockField();
|
||||
InterfaceBlockField(const InterfaceBlockField &other);
|
||||
InterfaceBlockField &operator=(const InterfaceBlockField &other);
|
||||
|
||||
bool isRowMajorLayout;
|
||||
};
|
||||
|
||||
struct COMPILER_EXPORT Varying : public ShaderVariable
|
||||
{
|
||||
Varying();
|
||||
~Varying();
|
||||
Varying(const Varying &other);
|
||||
Varying &operator=(const Varying &other);
|
||||
|
||||
InterpolationType interpolation;
|
||||
bool isInvariant;
|
||||
};
|
||||
|
||||
struct COMPILER_EXPORT InterfaceBlock
|
||||
{
|
||||
InterfaceBlock();
|
||||
~InterfaceBlock();
|
||||
InterfaceBlock(const InterfaceBlock &other);
|
||||
InterfaceBlock &operator=(const InterfaceBlock &other);
|
||||
|
||||
std::string name;
|
||||
std::string mappedName;
|
||||
std::string instanceName;
|
||||
unsigned int arraySize;
|
||||
BlockLayoutType layout;
|
||||
bool isRowMajorLayout;
|
||||
bool staticUse;
|
||||
std::vector<InterfaceBlockField> fields;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // _COMPILER_INTERFACE_VARIABLES_
|
3
src/3rdparty/angle/include/angle_gl.h
vendored
3
src/3rdparty/angle/include/angle_gl.h
vendored
@ -10,9 +10,6 @@
|
||||
#ifndef ANGLE_GL_H_
|
||||
#define ANGLE_GL_H_
|
||||
|
||||
#define GL_GLEXT_PROTOTYPES
|
||||
#define GL_APICALL
|
||||
|
||||
#include "GLES2/gl2.h"
|
||||
#include "GLES2/gl2ext.h"
|
||||
#include "GLES3/gl3.h"
|
||||
|
4
src/3rdparty/angle/src/commit.h
vendored
4
src/3rdparty/angle/src/commit.h
vendored
@ -7,6 +7,6 @@
|
||||
// This is a default commit hash header, when git is not available.
|
||||
//
|
||||
|
||||
#define ANGLE_COMMIT_HASH "07d49ef5350a"
|
||||
#define ANGLE_COMMIT_HASH "abce76206141"
|
||||
#define ANGLE_COMMIT_HASH_SIZE 12
|
||||
#define ANGLE_COMMIT_DATE "2014-07-25 16:01:42 +0000"
|
||||
#define ANGLE_COMMIT_DATE "2014-09-23 19:37:05 +0000"
|
||||
|
@ -12,11 +12,11 @@
|
||||
#ifndef COMMON_REFCOUNTOBJECT_H_
|
||||
#define COMMON_REFCOUNTOBJECT_H_
|
||||
|
||||
#include <cstddef>
|
||||
#include "common/debug.h"
|
||||
|
||||
#include "angle_gl.h"
|
||||
|
||||
#include "common/debug.h"
|
||||
#include <cstddef>
|
||||
|
||||
class RefCountObject
|
||||
{
|
||||
|
37
src/3rdparty/angle/src/common/angleutils.cpp
vendored
Normal file
37
src/3rdparty/angle/src/common/angleutils.cpp
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
//
|
||||
// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
//
|
||||
|
||||
#include "common/angleutils.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
std::string FormatString(const char *fmt, va_list vararg)
|
||||
{
|
||||
static std::vector<char> buffer(512);
|
||||
|
||||
// Attempt to just print to the current buffer
|
||||
int len = vsnprintf(&buffer[0], buffer.size(), fmt, vararg);
|
||||
if (len < 0 || static_cast<size_t>(len) >= buffer.size())
|
||||
{
|
||||
// Buffer was not large enough, calculate the required size and resize the buffer
|
||||
len = vsnprintf(NULL, 0, fmt, vararg);
|
||||
buffer.resize(len + 1);
|
||||
|
||||
// Print again
|
||||
vsnprintf(&buffer[0], buffer.size(), fmt, vararg);
|
||||
}
|
||||
|
||||
return std::string(buffer.data(), len);
|
||||
}
|
||||
|
||||
std::string FormatString(const char *fmt, ...)
|
||||
{
|
||||
va_list vararg;
|
||||
va_start(vararg, fmt);
|
||||
std::string result = FormatString(fmt, vararg);
|
||||
va_end(vararg);
|
||||
return result;
|
||||
}
|
8
src/3rdparty/angle/src/common/angleutils.h
vendored
8
src/3rdparty/angle/src/common/angleutils.h
vendored
@ -16,6 +16,7 @@
|
||||
#include <string>
|
||||
#include <set>
|
||||
#include <sstream>
|
||||
#include <cstdarg>
|
||||
|
||||
// A macro to disallow the copy constructor and operator= functions
|
||||
// This must be used in the private: declarations for a class
|
||||
@ -23,8 +24,8 @@
|
||||
TypeName(const TypeName&); \
|
||||
void operator=(const TypeName&)
|
||||
|
||||
template <typename T, unsigned int N>
|
||||
inline unsigned int ArraySize(T(&)[N])
|
||||
template <typename T, size_t N>
|
||||
inline size_t ArraySize(T(&)[N])
|
||||
{
|
||||
return N;
|
||||
}
|
||||
@ -131,6 +132,9 @@ inline std::string Str(int i)
|
||||
return strstr.str();
|
||||
}
|
||||
|
||||
std::string FormatString(const char *fmt, va_list vararg);
|
||||
std::string FormatString(const char *fmt, ...);
|
||||
|
||||
#if defined(_MSC_VER) && _MSC_VER < 1900
|
||||
#define snprintf _snprintf
|
||||
#endif
|
||||
|
44
src/3rdparty/angle/src/common/blocklayout.cpp
vendored
44
src/3rdparty/angle/src/common/blocklayout.cpp
vendored
@ -8,7 +8,6 @@
|
||||
//
|
||||
|
||||
#include "common/blocklayout.h"
|
||||
#include "common/shadervars.h"
|
||||
#include "common/mathutil.h"
|
||||
#include "common/utilities.h"
|
||||
|
||||
@ -20,46 +19,7 @@ BlockLayoutEncoder::BlockLayoutEncoder()
|
||||
{
|
||||
}
|
||||
|
||||
void BlockLayoutEncoder::encodeInterfaceBlockFields(const std::vector<InterfaceBlockField> &fields)
|
||||
{
|
||||
for (unsigned int fieldIndex = 0; fieldIndex < fields.size(); fieldIndex++)
|
||||
{
|
||||
const InterfaceBlockField &variable = fields[fieldIndex];
|
||||
|
||||
if (variable.fields.size() > 0)
|
||||
{
|
||||
const unsigned int elementCount = std::max(1u, variable.arraySize);
|
||||
|
||||
for (unsigned int elementIndex = 0; elementIndex < elementCount; elementIndex++)
|
||||
{
|
||||
enterAggregateType();
|
||||
encodeInterfaceBlockFields(variable.fields);
|
||||
exitAggregateType();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
encodeInterfaceBlockField(variable);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BlockMemberInfo BlockLayoutEncoder::encodeInterfaceBlockField(const InterfaceBlockField &field)
|
||||
{
|
||||
int arrayStride;
|
||||
int matrixStride;
|
||||
|
||||
ASSERT(field.fields.empty());
|
||||
getBlockLayoutInfo(field.type, field.arraySize, field.isRowMajorMatrix, &arrayStride, &matrixStride);
|
||||
|
||||
const BlockMemberInfo memberInfo(mCurrentOffset * BytesPerComponent, arrayStride * BytesPerComponent, matrixStride * BytesPerComponent, field.isRowMajorMatrix);
|
||||
|
||||
advanceOffset(field.type, field.arraySize, field.isRowMajorMatrix, arrayStride, matrixStride);
|
||||
|
||||
return memberInfo;
|
||||
}
|
||||
|
||||
void BlockLayoutEncoder::encodeType(GLenum type, unsigned int arraySize, bool isRowMajorMatrix)
|
||||
BlockMemberInfo BlockLayoutEncoder::encodeType(GLenum type, unsigned int arraySize, bool isRowMajorMatrix)
|
||||
{
|
||||
int arrayStride;
|
||||
int matrixStride;
|
||||
@ -69,6 +29,8 @@ void BlockLayoutEncoder::encodeType(GLenum type, unsigned int arraySize, bool is
|
||||
const BlockMemberInfo memberInfo(mCurrentOffset * BytesPerComponent, arrayStride * BytesPerComponent, matrixStride * BytesPerComponent, isRowMajorMatrix);
|
||||
|
||||
advanceOffset(type, arraySize, isRowMajorMatrix, arrayStride, matrixStride);
|
||||
|
||||
return memberInfo;
|
||||
}
|
||||
|
||||
void BlockLayoutEncoder::nextRegister()
|
||||
|
7
src/3rdparty/angle/src/common/blocklayout.h
vendored
7
src/3rdparty/angle/src/common/blocklayout.h
vendored
@ -10,10 +10,11 @@
|
||||
#ifndef COMMON_BLOCKLAYOUT_H_
|
||||
#define COMMON_BLOCKLAYOUT_H_
|
||||
|
||||
#include <cstddef>
|
||||
#include <vector>
|
||||
|
||||
#include "angle_gl.h"
|
||||
#include <GLSLANG/ShaderLang.h>
|
||||
#include <cstddef>
|
||||
|
||||
namespace sh
|
||||
{
|
||||
@ -48,9 +49,7 @@ class BlockLayoutEncoder
|
||||
public:
|
||||
BlockLayoutEncoder();
|
||||
|
||||
void encodeInterfaceBlockFields(const std::vector<InterfaceBlockField> &fields);
|
||||
BlockMemberInfo encodeInterfaceBlockField(const InterfaceBlockField &field);
|
||||
void encodeType(GLenum type, unsigned int arraySize, bool isRowMajorMatrix);
|
||||
BlockMemberInfo encodeType(GLenum type, unsigned int arraySize, bool isRowMajorMatrix);
|
||||
|
||||
size_t getBlockSize() const { return mCurrentOffset * BytesPerComponent; }
|
||||
size_t getCurrentRegister() const { return mCurrentOffset / ComponentsPerRegister; }
|
||||
|
26
src/3rdparty/angle/src/common/debug.cpp
vendored
26
src/3rdparty/angle/src/common/debug.cpp
vendored
@ -8,6 +8,7 @@
|
||||
|
||||
#include "common/debug.h"
|
||||
#include "common/platform.h"
|
||||
#include "common/angleutils.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <vector>
|
||||
@ -25,22 +26,7 @@ typedef void (*PerfOutputFunction)(unsigned int, const wchar_t*);
|
||||
static void output(bool traceFileDebugOnly, PerfOutputFunction perfFunc, const char *format, va_list vararg)
|
||||
{
|
||||
#if defined(ANGLE_ENABLE_PERF) || defined(ANGLE_ENABLE_TRACE)
|
||||
static std::vector<char> asciiMessageBuffer(512);
|
||||
|
||||
// Attempt to just print to the current buffer
|
||||
int len = vsnprintf(&asciiMessageBuffer[0], asciiMessageBuffer.size(), format, vararg);
|
||||
if (len < 0 || static_cast<size_t>(len) >= asciiMessageBuffer.size())
|
||||
{
|
||||
// Buffer was not large enough, calculate the required size and resize the buffer
|
||||
len = vsnprintf(NULL, 0, format, vararg);
|
||||
asciiMessageBuffer.resize(len + 1);
|
||||
|
||||
// Print again
|
||||
vsnprintf(&asciiMessageBuffer[0], asciiMessageBuffer.size(), format, vararg);
|
||||
}
|
||||
|
||||
// NULL terminate the buffer to be safe
|
||||
asciiMessageBuffer[len] = '\0';
|
||||
std::string formattedMessage = FormatString(format, vararg);
|
||||
#endif
|
||||
|
||||
#if defined(ANGLE_ENABLE_PERF)
|
||||
@ -48,12 +34,12 @@ static void output(bool traceFileDebugOnly, PerfOutputFunction perfFunc, const c
|
||||
{
|
||||
// The perf function only accepts wide strings, widen the ascii message
|
||||
static std::wstring wideMessage;
|
||||
if (wideMessage.capacity() < asciiMessageBuffer.size())
|
||||
if (wideMessage.capacity() < formattedMessage.length())
|
||||
{
|
||||
wideMessage.reserve(asciiMessageBuffer.size());
|
||||
wideMessage.reserve(formattedMessage.size());
|
||||
}
|
||||
|
||||
wideMessage.assign(asciiMessageBuffer.begin(), asciiMessageBuffer.begin() + len);
|
||||
wideMessage.assign(formattedMessage.begin(), formattedMessage.end());
|
||||
|
||||
perfFunc(0, wideMessage.c_str());
|
||||
}
|
||||
@ -70,7 +56,7 @@ static void output(bool traceFileDebugOnly, PerfOutputFunction perfFunc, const c
|
||||
static std::ofstream file(TRACE_OUTPUT_FILE, std::ofstream::app);
|
||||
if (file)
|
||||
{
|
||||
file.write(&asciiMessageBuffer[0], len);
|
||||
file.write(formattedMessage.c_str(), formattedMessage.length());
|
||||
file.flush();
|
||||
}
|
||||
|
||||
|
4
src/3rdparty/angle/src/common/debug.h
vendored
4
src/3rdparty/angle/src/common/debug.h
vendored
@ -91,6 +91,10 @@ namespace gl
|
||||
|
||||
// A macro to indicate unimplemented functionality
|
||||
|
||||
#if defined (ANGLE_TEST_CONFIG)
|
||||
#define NOASSERT_UNIMPLEMENTED 1
|
||||
#endif
|
||||
|
||||
// Define NOASSERT_UNIMPLEMENTED to non zero to skip the assert fail in the unimplemented checks
|
||||
// This will allow us to test with some automated test suites (eg dEQP) without crashing
|
||||
#ifndef NOASSERT_UNIMPLEMENTED
|
||||
|
49
src/3rdparty/angle/src/common/event_tracer.cpp
vendored
49
src/3rdparty/angle/src/common/event_tracer.cpp
vendored
@ -1,49 +0,0 @@
|
||||
// Copyright (c) 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.
|
||||
|
||||
#include "common/event_tracer.h"
|
||||
|
||||
namespace gl
|
||||
{
|
||||
|
||||
GetCategoryEnabledFlagFunc g_getCategoryEnabledFlag;
|
||||
AddTraceEventFunc g_addTraceEvent;
|
||||
|
||||
} // namespace gl
|
||||
|
||||
extern "C" {
|
||||
|
||||
void TRACE_ENTRY SetTraceFunctionPointers(GetCategoryEnabledFlagFunc getCategoryEnabledFlag,
|
||||
AddTraceEventFunc addTraceEvent)
|
||||
{
|
||||
gl::g_getCategoryEnabledFlag = getCategoryEnabledFlag;
|
||||
gl::g_addTraceEvent = addTraceEvent;
|
||||
}
|
||||
|
||||
} // extern "C"
|
||||
|
||||
namespace gl
|
||||
{
|
||||
|
||||
const unsigned char* TraceGetTraceCategoryEnabledFlag(const char* name)
|
||||
{
|
||||
if (g_getCategoryEnabledFlag)
|
||||
{
|
||||
return g_getCategoryEnabledFlag(name);
|
||||
}
|
||||
static unsigned char disabled = 0;
|
||||
return &disabled;
|
||||
}
|
||||
|
||||
void TraceAddTraceEvent(char phase, const unsigned char* categoryGroupEnabled, const char* name, unsigned long long id,
|
||||
int numArgs, const char** argNames, const unsigned char* argTypes,
|
||||
const unsigned long long* argValues, unsigned char flags)
|
||||
{
|
||||
if (g_addTraceEvent)
|
||||
{
|
||||
g_addTraceEvent(phase, categoryGroupEnabled, name, id, numArgs, argNames, argTypes, argValues, flags);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace gl
|
43
src/3rdparty/angle/src/common/event_tracer.h
vendored
43
src/3rdparty/angle/src/common/event_tracer.h
vendored
@ -1,43 +0,0 @@
|
||||
// Copyright (c) 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 COMMON_EVENT_TRACER_H_
|
||||
#define COMMON_EVENT_TRACER_H_
|
||||
|
||||
#include "common/platform.h"
|
||||
|
||||
#if !defined(TRACE_ENTRY)
|
||||
# ifdef ANGLE_PLATFORM_WINDOWS
|
||||
# define TRACE_ENTRY __stdcall
|
||||
# else
|
||||
# define TRACE_ENTRY
|
||||
# endif // ANGLE_PLATFORM_WINDOWS
|
||||
#endif //TRACE_ENTRY
|
||||
|
||||
extern "C" {
|
||||
|
||||
typedef const unsigned char* (*GetCategoryEnabledFlagFunc)(const char* name);
|
||||
typedef void (*AddTraceEventFunc)(char phase, const unsigned char* categoryGroupEnabled, const char* name,
|
||||
unsigned long long id, int numArgs, const char** argNames,
|
||||
const unsigned char* argTypes, const unsigned long long* argValues,
|
||||
unsigned char flags);
|
||||
|
||||
// extern "C" so that it has a reasonable name for GetProcAddress.
|
||||
void TRACE_ENTRY SetTraceFunctionPointers(GetCategoryEnabledFlagFunc get_category_enabled_flag,
|
||||
AddTraceEventFunc add_trace_event_func);
|
||||
|
||||
}
|
||||
|
||||
namespace gl
|
||||
{
|
||||
|
||||
const unsigned char* TraceGetTraceCategoryEnabledFlag(const char* name);
|
||||
|
||||
void TraceAddTraceEvent(char phase, const unsigned char* categoryGroupEnabled, const char* name, unsigned long long id,
|
||||
int numArgs, const char** argNames, const unsigned char* argTypes,
|
||||
const unsigned long long* argValues, unsigned char flags);
|
||||
|
||||
}
|
||||
|
||||
#endif // COMMON_EVENT_TRACER_H_
|
1
src/3rdparty/angle/src/common/mathutil.cpp
vendored
1
src/3rdparty/angle/src/common/mathutil.cpp
vendored
@ -7,6 +7,7 @@
|
||||
// mathutil.cpp: Math and bit manipulation functions.
|
||||
|
||||
#include "common/mathutil.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <math.h>
|
||||
|
||||
|
18
src/3rdparty/angle/src/common/mathutil.h
vendored
18
src/3rdparty/angle/src/common/mathutil.h
vendored
@ -505,21 +505,33 @@ inline unsigned int averageFloat10(unsigned int a, unsigned int b)
|
||||
namespace rx
|
||||
{
|
||||
|
||||
template <typename T>
|
||||
struct Range
|
||||
{
|
||||
Range() {}
|
||||
Range(int lo, int hi) : start(lo), end(hi) { ASSERT(lo <= hi); }
|
||||
Range(T lo, T hi) : start(lo), end(hi) { ASSERT(lo <= hi); }
|
||||
|
||||
int start;
|
||||
int end;
|
||||
T start;
|
||||
T end;
|
||||
|
||||
T length() const { return end - start; }
|
||||
};
|
||||
|
||||
typedef Range<int> RangeI;
|
||||
typedef Range<unsigned int> RangeUI;
|
||||
|
||||
template <typename T>
|
||||
T roundUp(const T value, const T alignment)
|
||||
{
|
||||
return value + alignment - 1 - (value - 1) % alignment;
|
||||
}
|
||||
|
||||
inline unsigned int UnsignedCeilDivide(unsigned int value, unsigned int divisor)
|
||||
{
|
||||
unsigned int divided = value / divisor;
|
||||
return (divided + ((value % divisor == 0) ? 0 : 1));
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline bool IsUnsignedAdditionSafe(T lhs, T rhs)
|
||||
{
|
||||
|
20
src/3rdparty/angle/src/common/platform.h
vendored
20
src/3rdparty/angle/src/common/platform.h
vendored
@ -52,6 +52,9 @@
|
||||
|
||||
# if defined(ANGLE_ENABLE_D3D9) || defined(ANGLE_ENABLE_PERF)
|
||||
# include <d3d9.h>
|
||||
# if !defined(COMPILER_IMPLEMENTATION)
|
||||
# include <d3dcompiler.h>
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# if defined(ANGLE_ENABLE_D3D11)
|
||||
@ -61,16 +64,25 @@
|
||||
# include <dxgi.h>
|
||||
# if _MSC_VER >= 1700
|
||||
# include <dxgi1_2.h>
|
||||
# endif
|
||||
# if !defined(COMPILER_IMPLEMENTATION)
|
||||
# include <d3dcompiler.h>
|
||||
# endif
|
||||
# if defined(__MINGW32__)
|
||||
typedef enum D3D11_MAP_FLAG
|
||||
{
|
||||
D3D11_MAP_FLAG_DO_NOT_WAIT = 0x100000L
|
||||
} D3D11_MAP_FLAG;
|
||||
typedef struct D3D11_QUERY_DATA_SO_STATISTICS
|
||||
{
|
||||
UINT64 NumPrimitivesWritten;
|
||||
UINT64 PrimitivesStorageNeeded;
|
||||
} D3D11_QUERY_DATA_SO_STATISTICS;
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# undef near
|
||||
# undef far
|
||||
# undef NEAR
|
||||
# define NEAR
|
||||
# undef FAR
|
||||
# define FAR
|
||||
#endif
|
||||
|
||||
#endif // COMMON_PLATFORM_H_
|
||||
|
157
src/3rdparty/angle/src/common/shadervars.h
vendored
157
src/3rdparty/angle/src/common/shadervars.h
vendored
@ -1,157 +0,0 @@
|
||||
//
|
||||
// Copyright (c) 2013-2014 The ANGLE Project Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
//
|
||||
// shadervars.h:
|
||||
// Types to represent GL variables (varyings, uniforms, etc)
|
||||
//
|
||||
|
||||
#ifndef COMMON_SHADERVARIABLE_H_
|
||||
#define COMMON_SHADERVARIABLE_H_
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
#include "GLSLANG/ShaderLang.h"
|
||||
|
||||
namespace sh
|
||||
{
|
||||
|
||||
// Varying interpolation qualifier, see section 4.3.9 of the ESSL 3.00.4 spec
|
||||
enum InterpolationType
|
||||
{
|
||||
INTERPOLATION_SMOOTH,
|
||||
INTERPOLATION_CENTROID,
|
||||
INTERPOLATION_FLAT
|
||||
};
|
||||
|
||||
// Uniform block layout qualifier, see section 4.3.8.3 of the ESSL 3.00.4 spec
|
||||
enum BlockLayoutType
|
||||
{
|
||||
BLOCKLAYOUT_STANDARD,
|
||||
BLOCKLAYOUT_PACKED,
|
||||
BLOCKLAYOUT_SHARED
|
||||
};
|
||||
|
||||
// Base class for all variables defined in shaders, including Varyings, Uniforms, etc
|
||||
struct ShaderVariable
|
||||
{
|
||||
ShaderVariable()
|
||||
: type(0),
|
||||
precision(0),
|
||||
arraySize(0),
|
||||
staticUse(false)
|
||||
{}
|
||||
|
||||
ShaderVariable(GLenum typeIn, GLenum precisionIn, const char *nameIn, unsigned int arraySizeIn)
|
||||
: type(typeIn),
|
||||
precision(precisionIn),
|
||||
name(nameIn),
|
||||
arraySize(arraySizeIn),
|
||||
staticUse(false)
|
||||
{}
|
||||
|
||||
bool isArray() const { return arraySize > 0; }
|
||||
unsigned int elementCount() const { return std::max(1u, arraySize); }
|
||||
|
||||
GLenum type;
|
||||
GLenum precision;
|
||||
std::string name;
|
||||
std::string mappedName;
|
||||
unsigned int arraySize;
|
||||
bool staticUse;
|
||||
};
|
||||
|
||||
struct Uniform : public ShaderVariable
|
||||
{
|
||||
Uniform()
|
||||
{}
|
||||
|
||||
Uniform(GLenum typeIn, GLenum precisionIn, const char *nameIn, unsigned int arraySizeIn)
|
||||
: ShaderVariable(typeIn, precisionIn, nameIn, arraySizeIn)
|
||||
{}
|
||||
|
||||
bool isStruct() const { return !fields.empty(); }
|
||||
|
||||
std::vector<Uniform> fields;
|
||||
};
|
||||
|
||||
struct Attribute : public ShaderVariable
|
||||
{
|
||||
Attribute()
|
||||
: location(-1)
|
||||
{}
|
||||
|
||||
Attribute(GLenum typeIn, GLenum precisionIn, const char *nameIn, unsigned int arraySizeIn, int locationIn)
|
||||
: ShaderVariable(typeIn, precisionIn, nameIn, arraySizeIn),
|
||||
location(locationIn)
|
||||
{}
|
||||
|
||||
int location;
|
||||
};
|
||||
|
||||
struct InterfaceBlockField : public ShaderVariable
|
||||
{
|
||||
InterfaceBlockField()
|
||||
: isRowMajorMatrix(false)
|
||||
{}
|
||||
|
||||
InterfaceBlockField(GLenum typeIn, GLenum precisionIn, const char *nameIn, unsigned int arraySizeIn, bool isRowMajorMatrix)
|
||||
: ShaderVariable(typeIn, precisionIn, nameIn, arraySizeIn),
|
||||
isRowMajorMatrix(isRowMajorMatrix)
|
||||
{}
|
||||
|
||||
bool isStruct() const { return !fields.empty(); }
|
||||
|
||||
bool isRowMajorMatrix;
|
||||
std::vector<InterfaceBlockField> fields;
|
||||
};
|
||||
|
||||
struct Varying : public ShaderVariable
|
||||
{
|
||||
Varying()
|
||||
: interpolation(INTERPOLATION_SMOOTH)
|
||||
{}
|
||||
|
||||
Varying(GLenum typeIn, GLenum precisionIn, const char *nameIn, unsigned int arraySizeIn, InterpolationType interpolationIn)
|
||||
: ShaderVariable(typeIn, precisionIn, nameIn, arraySizeIn),
|
||||
interpolation(interpolationIn)
|
||||
{}
|
||||
|
||||
bool isStruct() const { return !fields.empty(); }
|
||||
|
||||
InterpolationType interpolation;
|
||||
std::vector<Varying> fields;
|
||||
std::string structName;
|
||||
};
|
||||
|
||||
struct InterfaceBlock
|
||||
{
|
||||
InterfaceBlock()
|
||||
: arraySize(0),
|
||||
layout(BLOCKLAYOUT_PACKED),
|
||||
isRowMajorLayout(false),
|
||||
staticUse(false)
|
||||
{}
|
||||
|
||||
InterfaceBlock(const char *name, unsigned int arraySize)
|
||||
: name(name),
|
||||
arraySize(arraySize),
|
||||
layout(BLOCKLAYOUT_SHARED),
|
||||
isRowMajorLayout(false),
|
||||
staticUse(false)
|
||||
{}
|
||||
|
||||
std::string name;
|
||||
std::string mappedName;
|
||||
unsigned int arraySize;
|
||||
BlockLayoutType layout;
|
||||
bool isRowMajorLayout;
|
||||
bool staticUse;
|
||||
std::vector<InterfaceBlockField> fields;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // COMMON_SHADERVARIABLE_H_
|
@ -69,40 +69,9 @@ enum TBasicType
|
||||
EbtStruct,
|
||||
EbtInterfaceBlock,
|
||||
EbtAddress, // should be deprecated??
|
||||
EbtInvariant // used as a type when qualifying a previously declared variable as being invariant
|
||||
};
|
||||
|
||||
inline const char* getBasicString(TBasicType t)
|
||||
{
|
||||
switch (t)
|
||||
{
|
||||
case EbtVoid: return "void"; break;
|
||||
case EbtFloat: return "float"; break;
|
||||
case EbtInt: return "int"; break;
|
||||
case EbtUInt: return "uint"; break;
|
||||
case EbtBool: return "bool"; break;
|
||||
case EbtSampler2D: return "sampler2D"; break;
|
||||
case EbtSampler3D: return "sampler3D"; break;
|
||||
case EbtSamplerCube: return "samplerCube"; break;
|
||||
case EbtSamplerExternalOES: return "samplerExternalOES"; break;
|
||||
case EbtSampler2DRect: return "sampler2DRect"; break;
|
||||
case EbtSampler2DArray: return "sampler2DArray"; break;
|
||||
case EbtISampler2D: return "isampler2D"; break;
|
||||
case EbtISampler3D: return "isampler3D"; break;
|
||||
case EbtISamplerCube: return "isamplerCube"; break;
|
||||
case EbtISampler2DArray: return "isampler2DArray"; break;
|
||||
case EbtUSampler2D: return "usampler2D"; break;
|
||||
case EbtUSampler3D: return "usampler3D"; break;
|
||||
case EbtUSamplerCube: return "usamplerCube"; break;
|
||||
case EbtUSampler2DArray: return "usampler2DArray"; break;
|
||||
case EbtSampler2DShadow: return "sampler2DShadow"; break;
|
||||
case EbtSamplerCubeShadow: return "samplerCubeShadow"; break;
|
||||
case EbtSampler2DArrayShadow: return "sampler2DArrayShadow"; break;
|
||||
case EbtStruct: return "structure"; break;
|
||||
case EbtInterfaceBlock: return "interface block"; break;
|
||||
default: return "unknown type";
|
||||
}
|
||||
}
|
||||
const char* getBasicString(TBasicType t);
|
||||
|
||||
inline bool IsSampler(TBasicType type)
|
||||
{
|
||||
|
@ -8,7 +8,7 @@
|
||||
#define COMPILIER_BUILT_IN_FUNCTION_EMULATOR_H_
|
||||
|
||||
#include "compiler/translator/InfoSink.h"
|
||||
#include "compiler/translator/intermediate.h"
|
||||
#include "compiler/translator/IntermNode.h"
|
||||
|
||||
//
|
||||
// This class decides which built-in functions need to be replaced with the
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "compiler/translator/InitializeParseContext.h"
|
||||
#include "compiler/translator/InitializeVariables.h"
|
||||
#include "compiler/translator/ParseContext.h"
|
||||
#include "compiler/translator/RegenerateStructNames.h"
|
||||
#include "compiler/translator/RenameFunction.h"
|
||||
#include "compiler/translator/ScalarizeVecAndMatConstructorArgs.h"
|
||||
#include "compiler/translator/UnfoldShortCircuitAST.h"
|
||||
@ -257,10 +258,17 @@ bool TCompiler::compile(const char* const shaderStrings[],
|
||||
|
||||
if (success && (compileOptions & SH_SCALARIZE_VEC_AND_MAT_CONSTRUCTOR_ARGS))
|
||||
{
|
||||
ScalarizeVecAndMatConstructorArgs scalarizer;
|
||||
ScalarizeVecAndMatConstructorArgs scalarizer(
|
||||
shaderType, fragmentPrecisionHigh);
|
||||
root->traverse(&scalarizer);
|
||||
}
|
||||
|
||||
if (success && (compileOptions & SH_REGENERATE_STRUCT_NAMES))
|
||||
{
|
||||
RegenerateStructNames gen(symbolTable, shaderVersion);
|
||||
root->traverse(&gen);
|
||||
}
|
||||
|
||||
if (success && (compileOptions & SH_INTERMEDIATE_TREE))
|
||||
intermediate.outputTree(root);
|
||||
|
||||
@ -494,18 +502,18 @@ bool TCompiler::enforceVertexShaderTimingRestrictions(TIntermNode* root)
|
||||
|
||||
void TCompiler::collectVariables(TIntermNode* root)
|
||||
{
|
||||
CollectVariables collect(&attributes,
|
||||
&outputVariables,
|
||||
&uniforms,
|
||||
&varyings,
|
||||
&interfaceBlocks,
|
||||
hashFunction);
|
||||
sh::CollectVariables collect(&attributes,
|
||||
&outputVariables,
|
||||
&uniforms,
|
||||
&varyings,
|
||||
&interfaceBlocks,
|
||||
hashFunction);
|
||||
root->traverse(&collect);
|
||||
|
||||
// For backwards compatiblity with ShGetVariableInfo, expand struct
|
||||
// uniforms and varyings into separate variables for each field.
|
||||
ExpandVariables(uniforms, &expandedUniforms);
|
||||
ExpandVariables(varyings, &expandedVaryings);
|
||||
sh::ExpandVariables(uniforms, &expandedUniforms);
|
||||
sh::ExpandVariables(varyings, &expandedVaryings);
|
||||
}
|
||||
|
||||
bool TCompiler::enforcePackingRestrictions()
|
||||
|
@ -71,9 +71,9 @@ class TCompiler : public TShHandleBase
|
||||
const std::vector<sh::Attribute> &getAttributes() const { return attributes; }
|
||||
const std::vector<sh::Attribute> &getOutputVariables() const { return outputVariables; }
|
||||
const std::vector<sh::Uniform> &getUniforms() const { return uniforms; }
|
||||
const std::vector<sh::Uniform> &getExpandedUniforms() const { return expandedUniforms; }
|
||||
const std::vector<sh::ShaderVariable> &getExpandedUniforms() const { return expandedUniforms; }
|
||||
const std::vector<sh::Varying> &getVaryings() const { return varyings; }
|
||||
const std::vector<sh::Varying> &getExpandedVaryings() const { return expandedVaryings; }
|
||||
const std::vector<sh::ShaderVariable> &getExpandedVaryings() const { return expandedVaryings; }
|
||||
const std::vector<sh::InterfaceBlock> &getInterfaceBlocks() const { return interfaceBlocks; }
|
||||
|
||||
ShHashFunction64 getHashFunction() const { return hashFunction; }
|
||||
@ -83,6 +83,9 @@ class TCompiler : public TShHandleBase
|
||||
ShShaderOutput getOutputType() const { return outputType; }
|
||||
std::string getBuiltInResourcesString() const { return builtInResourcesString; }
|
||||
|
||||
// Get the resources set by InitBuiltInSymbolTable
|
||||
const ShBuiltInResources& getResources() const;
|
||||
|
||||
protected:
|
||||
sh::GLenum getShaderType() const { return shaderType; }
|
||||
// Initialize symbol-table with built-in symbols.
|
||||
@ -128,8 +131,6 @@ class TCompiler : public TShHandleBase
|
||||
bool limitExpressionComplexity(TIntermNode* root);
|
||||
// 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;
|
||||
@ -138,9 +139,9 @@ class TCompiler : public TShHandleBase
|
||||
std::vector<sh::Attribute> attributes;
|
||||
std::vector<sh::Attribute> outputVariables;
|
||||
std::vector<sh::Uniform> uniforms;
|
||||
std::vector<sh::Uniform> expandedUniforms;
|
||||
std::vector<sh::ShaderVariable> expandedUniforms;
|
||||
std::vector<sh::Varying> varyings;
|
||||
std::vector<sh::Varying> expandedVaryings;
|
||||
std::vector<sh::ShaderVariable> expandedVaryings;
|
||||
std::vector<sh::InterfaceBlock> interfaceBlocks;
|
||||
|
||||
private:
|
||||
|
@ -8,7 +8,7 @@
|
||||
#define COMPILER_DETECT_RECURSION_H_
|
||||
|
||||
#include <limits.h>
|
||||
#include "compiler/translator/intermediate.h"
|
||||
#include "compiler/translator/IntermNode.h"
|
||||
#include "compiler/translator/VariableInfo.h"
|
||||
|
||||
class TInfoSink;
|
||||
|
@ -11,7 +11,7 @@
|
||||
#ifndef COMPILER_DETECTDISCONTINUITY_H_
|
||||
#define COMPILER_DETECTDISCONTINUITY_H_
|
||||
|
||||
#include "compiler/translator/intermediate.h"
|
||||
#include "compiler/translator/IntermNode.h"
|
||||
|
||||
namespace sh
|
||||
{
|
||||
|
@ -7,7 +7,7 @@
|
||||
#ifndef COMPILER_FLAGSTD140STRUCTS_H_
|
||||
#define COMPILER_FLAGSTD140STRUCTS_H_
|
||||
|
||||
#include "compiler/translator/intermediate.h"
|
||||
#include "compiler/translator/IntermNode.h"
|
||||
|
||||
namespace sh
|
||||
{
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
#include <map>
|
||||
|
||||
#include "compiler/translator/intermediate.h"
|
||||
#include "compiler/translator/IntermNode.h"
|
||||
|
||||
#define HASHED_NAME_PREFIX "webgl_"
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
#include "compiler/translator/Initialize.h"
|
||||
|
||||
#include "compiler/translator/intermediate.h"
|
||||
#include "compiler/translator/IntermNode.h"
|
||||
#include "angle_gl.h"
|
||||
|
||||
void InsertBuiltInFunctions(sh::GLenum type, ShShaderSpec spec, const ShBuiltInResources &resources, TSymbolTable &symbolTable)
|
||||
|
@ -7,7 +7,7 @@
|
||||
#ifndef COMPILER_INITIALIZE_VARIABLES_H_
|
||||
#define COMPILER_INITIALIZE_VARIABLES_H_
|
||||
|
||||
#include "compiler/translator/intermediate.h"
|
||||
#include "compiler/translator/IntermNode.h"
|
||||
|
||||
class InitializeVariables : public TIntermTraverser
|
||||
{
|
||||
|
1107
src/3rdparty/angle/src/compiler/translator/IntermNode.cpp
vendored
Normal file
1107
src/3rdparty/angle/src/compiler/translator/IntermNode.cpp
vendored
Normal file
File diff suppressed because it is too large
Load Diff
772
src/3rdparty/angle/src/compiler/translator/IntermNode.h
vendored
Normal file
772
src/3rdparty/angle/src/compiler/translator/IntermNode.h
vendored
Normal file
@ -0,0 +1,772 @@
|
||||
//
|
||||
// Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
//
|
||||
|
||||
//
|
||||
// Definition of the in-memory high-level intermediate representation
|
||||
// of shaders. This is a tree that parser creates.
|
||||
//
|
||||
// Nodes in the tree are defined as a hierarchy of classes derived from
|
||||
// TIntermNode. Each is a node in a tree. There is no preset branching factor;
|
||||
// each node can have it's own type of list of children.
|
||||
//
|
||||
|
||||
#ifndef COMPILER_TRANSLATOR_INTERMEDIATE_H_
|
||||
#define COMPILER_TRANSLATOR_INTERMEDIATE_H_
|
||||
|
||||
#include "GLSLANG/ShaderLang.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <queue>
|
||||
|
||||
#include "compiler/translator/Common.h"
|
||||
#include "compiler/translator/Types.h"
|
||||
#include "compiler/translator/ConstantUnion.h"
|
||||
|
||||
//
|
||||
// Operators used by the high-level (parse tree) representation.
|
||||
//
|
||||
enum TOperator
|
||||
{
|
||||
EOpNull, // if in a node, should only mean a node is still being built
|
||||
EOpSequence, // denotes a list of statements, or parameters, etc.
|
||||
EOpFunctionCall,
|
||||
EOpFunction, // For function definition
|
||||
EOpParameters, // an aggregate listing the parameters to a function
|
||||
|
||||
EOpDeclaration,
|
||||
EOpInvariantDeclaration, // Specialized declarations for attributing invariance
|
||||
EOpPrototype,
|
||||
|
||||
//
|
||||
// Unary operators
|
||||
//
|
||||
|
||||
EOpNegative,
|
||||
EOpLogicalNot,
|
||||
EOpVectorLogicalNot,
|
||||
|
||||
EOpPostIncrement,
|
||||
EOpPostDecrement,
|
||||
EOpPreIncrement,
|
||||
EOpPreDecrement,
|
||||
|
||||
//
|
||||
// binary operations
|
||||
//
|
||||
|
||||
EOpAdd,
|
||||
EOpSub,
|
||||
EOpMul,
|
||||
EOpDiv,
|
||||
EOpEqual,
|
||||
EOpNotEqual,
|
||||
EOpVectorEqual,
|
||||
EOpVectorNotEqual,
|
||||
EOpLessThan,
|
||||
EOpGreaterThan,
|
||||
EOpLessThanEqual,
|
||||
EOpGreaterThanEqual,
|
||||
EOpComma,
|
||||
|
||||
EOpVectorTimesScalar,
|
||||
EOpVectorTimesMatrix,
|
||||
EOpMatrixTimesVector,
|
||||
EOpMatrixTimesScalar,
|
||||
|
||||
EOpLogicalOr,
|
||||
EOpLogicalXor,
|
||||
EOpLogicalAnd,
|
||||
|
||||
EOpIndexDirect,
|
||||
EOpIndexIndirect,
|
||||
EOpIndexDirectStruct,
|
||||
EOpIndexDirectInterfaceBlock,
|
||||
|
||||
EOpVectorSwizzle,
|
||||
|
||||
//
|
||||
// Built-in functions potentially mapped to operators
|
||||
//
|
||||
|
||||
EOpRadians,
|
||||
EOpDegrees,
|
||||
EOpSin,
|
||||
EOpCos,
|
||||
EOpTan,
|
||||
EOpAsin,
|
||||
EOpAcos,
|
||||
EOpAtan,
|
||||
|
||||
EOpPow,
|
||||
EOpExp,
|
||||
EOpLog,
|
||||
EOpExp2,
|
||||
EOpLog2,
|
||||
EOpSqrt,
|
||||
EOpInverseSqrt,
|
||||
|
||||
EOpAbs,
|
||||
EOpSign,
|
||||
EOpFloor,
|
||||
EOpCeil,
|
||||
EOpFract,
|
||||
EOpMod,
|
||||
EOpMin,
|
||||
EOpMax,
|
||||
EOpClamp,
|
||||
EOpMix,
|
||||
EOpStep,
|
||||
EOpSmoothStep,
|
||||
|
||||
EOpLength,
|
||||
EOpDistance,
|
||||
EOpDot,
|
||||
EOpCross,
|
||||
EOpNormalize,
|
||||
EOpFaceForward,
|
||||
EOpReflect,
|
||||
EOpRefract,
|
||||
|
||||
EOpDFdx, // Fragment only, OES_standard_derivatives extension
|
||||
EOpDFdy, // Fragment only, OES_standard_derivatives extension
|
||||
EOpFwidth, // Fragment only, OES_standard_derivatives extension
|
||||
|
||||
EOpMatrixTimesMatrix,
|
||||
|
||||
EOpAny,
|
||||
EOpAll,
|
||||
|
||||
//
|
||||
// Branch
|
||||
//
|
||||
|
||||
EOpKill, // Fragment only
|
||||
EOpReturn,
|
||||
EOpBreak,
|
||||
EOpContinue,
|
||||
|
||||
//
|
||||
// Constructors
|
||||
//
|
||||
|
||||
EOpConstructInt,
|
||||
EOpConstructUInt,
|
||||
EOpConstructBool,
|
||||
EOpConstructFloat,
|
||||
EOpConstructVec2,
|
||||
EOpConstructVec3,
|
||||
EOpConstructVec4,
|
||||
EOpConstructBVec2,
|
||||
EOpConstructBVec3,
|
||||
EOpConstructBVec4,
|
||||
EOpConstructIVec2,
|
||||
EOpConstructIVec3,
|
||||
EOpConstructIVec4,
|
||||
EOpConstructUVec2,
|
||||
EOpConstructUVec3,
|
||||
EOpConstructUVec4,
|
||||
EOpConstructMat2,
|
||||
EOpConstructMat3,
|
||||
EOpConstructMat4,
|
||||
EOpConstructStruct,
|
||||
|
||||
//
|
||||
// moves
|
||||
//
|
||||
|
||||
EOpAssign,
|
||||
EOpInitialize,
|
||||
EOpAddAssign,
|
||||
EOpSubAssign,
|
||||
EOpMulAssign,
|
||||
EOpVectorTimesMatrixAssign,
|
||||
EOpVectorTimesScalarAssign,
|
||||
EOpMatrixTimesScalarAssign,
|
||||
EOpMatrixTimesMatrixAssign,
|
||||
EOpDivAssign
|
||||
};
|
||||
|
||||
class TIntermTraverser;
|
||||
class TIntermAggregate;
|
||||
class TIntermBinary;
|
||||
class TIntermUnary;
|
||||
class TIntermConstantUnion;
|
||||
class TIntermSelection;
|
||||
class TIntermTyped;
|
||||
class TIntermSymbol;
|
||||
class TIntermLoop;
|
||||
class TInfoSink;
|
||||
class TIntermRaw;
|
||||
|
||||
//
|
||||
// Base class for the tree nodes
|
||||
//
|
||||
class TIntermNode
|
||||
{
|
||||
public:
|
||||
POOL_ALLOCATOR_NEW_DELETE();
|
||||
TIntermNode()
|
||||
{
|
||||
// TODO: Move this to TSourceLoc constructor
|
||||
// after getting rid of TPublicType.
|
||||
mLine.first_file = mLine.last_file = 0;
|
||||
mLine.first_line = mLine.last_line = 0;
|
||||
}
|
||||
virtual ~TIntermNode() { }
|
||||
|
||||
const TSourceLoc &getLine() const { return mLine; }
|
||||
void setLine(const TSourceLoc &l) { mLine = l; }
|
||||
|
||||
virtual void traverse(TIntermTraverser *) = 0;
|
||||
virtual TIntermTyped *getAsTyped() { return 0; }
|
||||
virtual TIntermConstantUnion *getAsConstantUnion() { return 0; }
|
||||
virtual TIntermAggregate *getAsAggregate() { return 0; }
|
||||
virtual TIntermBinary *getAsBinaryNode() { return 0; }
|
||||
virtual TIntermUnary *getAsUnaryNode() { return 0; }
|
||||
virtual TIntermSelection *getAsSelectionNode() { return 0; }
|
||||
virtual TIntermSymbol *getAsSymbolNode() { return 0; }
|
||||
virtual TIntermLoop *getAsLoopNode() { return 0; }
|
||||
virtual TIntermRaw *getAsRawNode() { return 0; }
|
||||
|
||||
// Replace a child node. Return true if |original| is a child
|
||||
// node and it is replaced; otherwise, return false.
|
||||
virtual bool replaceChildNode(
|
||||
TIntermNode *original, TIntermNode *replacement) = 0;
|
||||
|
||||
// For traversing a tree in no particular order, but using
|
||||
// heap memory.
|
||||
virtual void enqueueChildren(std::queue<TIntermNode *> *nodeQueue) const = 0;
|
||||
|
||||
protected:
|
||||
TSourceLoc mLine;
|
||||
};
|
||||
|
||||
//
|
||||
// This is just to help yacc.
|
||||
//
|
||||
struct TIntermNodePair
|
||||
{
|
||||
TIntermNode *node1;
|
||||
TIntermNode *node2;
|
||||
};
|
||||
|
||||
//
|
||||
// Intermediate class for nodes that have a type.
|
||||
//
|
||||
class TIntermTyped : public TIntermNode
|
||||
{
|
||||
public:
|
||||
TIntermTyped(const TType &t) : mType(t) { }
|
||||
virtual TIntermTyped *getAsTyped() { return this; }
|
||||
|
||||
virtual bool hasSideEffects() const = 0;
|
||||
|
||||
void setType(const TType &t) { mType = t; }
|
||||
const TType &getType() const { return mType; }
|
||||
TType *getTypePointer() { return &mType; }
|
||||
|
||||
TBasicType getBasicType() const { return mType.getBasicType(); }
|
||||
TQualifier getQualifier() const { return mType.getQualifier(); }
|
||||
TPrecision getPrecision() const { return mType.getPrecision(); }
|
||||
int getCols() const { return mType.getCols(); }
|
||||
int getRows() const { return mType.getRows(); }
|
||||
int getNominalSize() const { return mType.getNominalSize(); }
|
||||
int getSecondarySize() const { return mType.getSecondarySize(); }
|
||||
|
||||
bool isInterfaceBlock() const { return mType.isInterfaceBlock(); }
|
||||
bool isMatrix() const { return mType.isMatrix(); }
|
||||
bool isArray() const { return mType.isArray(); }
|
||||
bool isVector() const { return mType.isVector(); }
|
||||
bool isScalar() const { return mType.isScalar(); }
|
||||
bool isScalarInt() const { return mType.isScalarInt(); }
|
||||
const char *getBasicString() const { return mType.getBasicString(); }
|
||||
const char *getQualifierString() const { return mType.getQualifierString(); }
|
||||
TString getCompleteString() const { return mType.getCompleteString(); }
|
||||
|
||||
int getArraySize() const { return mType.getArraySize(); }
|
||||
|
||||
protected:
|
||||
TType mType;
|
||||
};
|
||||
|
||||
//
|
||||
// Handle for, do-while, and while loops.
|
||||
//
|
||||
enum TLoopType
|
||||
{
|
||||
ELoopFor,
|
||||
ELoopWhile,
|
||||
ELoopDoWhile
|
||||
};
|
||||
|
||||
class TIntermLoop : public TIntermNode
|
||||
{
|
||||
public:
|
||||
TIntermLoop(TLoopType type,
|
||||
TIntermNode *init, TIntermTyped *cond, TIntermTyped *expr,
|
||||
TIntermNode *body)
|
||||
: mType(type),
|
||||
mInit(init),
|
||||
mCond(cond),
|
||||
mExpr(expr),
|
||||
mBody(body),
|
||||
mUnrollFlag(false) { }
|
||||
|
||||
virtual TIntermLoop *getAsLoopNode() { return this; }
|
||||
virtual void traverse(TIntermTraverser *);
|
||||
virtual bool replaceChildNode(
|
||||
TIntermNode *original, TIntermNode *replacement);
|
||||
|
||||
TLoopType getType() const { return mType; }
|
||||
TIntermNode *getInit() { return mInit; }
|
||||
TIntermTyped *getCondition() { return mCond; }
|
||||
TIntermTyped *getExpression() { return mExpr; }
|
||||
TIntermNode *getBody() { return mBody; }
|
||||
|
||||
void setUnrollFlag(bool flag) { mUnrollFlag = flag; }
|
||||
bool getUnrollFlag() const { return mUnrollFlag; }
|
||||
|
||||
virtual void enqueueChildren(std::queue<TIntermNode *> *nodeQueue) const;
|
||||
|
||||
protected:
|
||||
TLoopType mType;
|
||||
TIntermNode *mInit; // for-loop initialization
|
||||
TIntermTyped *mCond; // loop exit condition
|
||||
TIntermTyped *mExpr; // for-loop expression
|
||||
TIntermNode *mBody; // loop body
|
||||
|
||||
bool mUnrollFlag; // Whether the loop should be unrolled or not.
|
||||
};
|
||||
|
||||
//
|
||||
// Handle break, continue, return, and kill.
|
||||
//
|
||||
class TIntermBranch : public TIntermNode
|
||||
{
|
||||
public:
|
||||
TIntermBranch(TOperator op, TIntermTyped *e)
|
||||
: mFlowOp(op),
|
||||
mExpression(e) { }
|
||||
|
||||
virtual void traverse(TIntermTraverser *);
|
||||
virtual bool replaceChildNode(
|
||||
TIntermNode *original, TIntermNode *replacement);
|
||||
|
||||
TOperator getFlowOp() { return mFlowOp; }
|
||||
TIntermTyped* getExpression() { return mExpression; }
|
||||
|
||||
virtual void enqueueChildren(std::queue<TIntermNode *> *nodeQueue) const;
|
||||
|
||||
protected:
|
||||
TOperator mFlowOp;
|
||||
TIntermTyped *mExpression; // non-zero except for "return exp;" statements
|
||||
};
|
||||
|
||||
//
|
||||
// Nodes that correspond to symbols or constants in the source code.
|
||||
//
|
||||
class TIntermSymbol : public TIntermTyped
|
||||
{
|
||||
public:
|
||||
// if symbol is initialized as symbol(sym), the memory comes from the poolallocator of sym.
|
||||
// If sym comes from per process globalpoolallocator, then it causes increased memory usage
|
||||
// per compile it is essential to use "symbol = sym" to assign to symbol
|
||||
TIntermSymbol(int id, const TString &symbol, const TType &type)
|
||||
: TIntermTyped(type),
|
||||
mId(id)
|
||||
{
|
||||
mSymbol = symbol;
|
||||
}
|
||||
|
||||
virtual bool hasSideEffects() const { return false; }
|
||||
|
||||
int getId() const { return mId; }
|
||||
const TString &getSymbol() const { return mSymbol; }
|
||||
|
||||
void setId(int newId) { mId = newId; }
|
||||
|
||||
virtual void traverse(TIntermTraverser *);
|
||||
virtual TIntermSymbol *getAsSymbolNode() { return this; }
|
||||
virtual bool replaceChildNode(TIntermNode *, TIntermNode *) { return false; }
|
||||
|
||||
virtual void enqueueChildren(std::queue<TIntermNode *> *nodeQueue) const {}
|
||||
|
||||
protected:
|
||||
int mId;
|
||||
TString mSymbol;
|
||||
};
|
||||
|
||||
// A Raw node stores raw code, that the translator will insert verbatim
|
||||
// into the output stream. Useful for transformation operations that make
|
||||
// complex code that might not fit naturally into the GLSL model.
|
||||
class TIntermRaw : public TIntermTyped
|
||||
{
|
||||
public:
|
||||
TIntermRaw(const TType &type, const TString &rawText)
|
||||
: TIntermTyped(type),
|
||||
mRawText(rawText) { }
|
||||
|
||||
virtual bool hasSideEffects() const { return false; }
|
||||
|
||||
TString getRawText() const { return mRawText; }
|
||||
|
||||
virtual void traverse(TIntermTraverser *);
|
||||
|
||||
virtual TIntermRaw *getAsRawNode() { return this; }
|
||||
virtual bool replaceChildNode(TIntermNode *, TIntermNode *) { return false; }
|
||||
virtual void enqueueChildren(std::queue<TIntermNode *> *nodeQueue) const {}
|
||||
|
||||
protected:
|
||||
TString mRawText;
|
||||
};
|
||||
|
||||
class TIntermConstantUnion : public TIntermTyped
|
||||
{
|
||||
public:
|
||||
TIntermConstantUnion(ConstantUnion *unionPointer, const TType &type)
|
||||
: TIntermTyped(type),
|
||||
mUnionArrayPointer(unionPointer) { }
|
||||
|
||||
virtual bool hasSideEffects() const { return false; }
|
||||
|
||||
ConstantUnion *getUnionArrayPointer() const { return mUnionArrayPointer; }
|
||||
|
||||
int getIConst(size_t index) const
|
||||
{
|
||||
return mUnionArrayPointer ? mUnionArrayPointer[index].getIConst() : 0;
|
||||
}
|
||||
unsigned int getUConst(size_t index) const
|
||||
{
|
||||
return mUnionArrayPointer ? mUnionArrayPointer[index].getUConst() : 0;
|
||||
}
|
||||
float getFConst(size_t index) const
|
||||
{
|
||||
return mUnionArrayPointer ? mUnionArrayPointer[index].getFConst() : 0.0f;
|
||||
}
|
||||
bool getBConst(size_t index) const
|
||||
{
|
||||
return mUnionArrayPointer ? mUnionArrayPointer[index].getBConst() : false;
|
||||
}
|
||||
|
||||
virtual TIntermConstantUnion *getAsConstantUnion() { return this; }
|
||||
virtual void traverse(TIntermTraverser *);
|
||||
virtual bool replaceChildNode(TIntermNode *, TIntermNode *) { return false; }
|
||||
|
||||
TIntermTyped *fold(TOperator, TIntermTyped *, TInfoSink &);
|
||||
|
||||
virtual void enqueueChildren(std::queue<TIntermNode *> *nodeQueue) const {}
|
||||
|
||||
protected:
|
||||
ConstantUnion *mUnionArrayPointer;
|
||||
};
|
||||
|
||||
//
|
||||
// Intermediate class for node types that hold operators.
|
||||
//
|
||||
class TIntermOperator : public TIntermTyped
|
||||
{
|
||||
public:
|
||||
TOperator getOp() const { return mOp; }
|
||||
void setOp(TOperator op) { mOp = op; }
|
||||
|
||||
bool isAssignment() const;
|
||||
bool isConstructor() const;
|
||||
|
||||
virtual bool hasSideEffects() const { return isAssignment(); }
|
||||
|
||||
protected:
|
||||
TIntermOperator(TOperator op)
|
||||
: TIntermTyped(TType(EbtFloat, EbpUndefined)),
|
||||
mOp(op) {}
|
||||
TIntermOperator(TOperator op, const TType &type)
|
||||
: TIntermTyped(type),
|
||||
mOp(op) {}
|
||||
|
||||
TOperator mOp;
|
||||
};
|
||||
|
||||
//
|
||||
// Nodes for all the basic binary math operators.
|
||||
//
|
||||
class TIntermBinary : public TIntermOperator
|
||||
{
|
||||
public:
|
||||
TIntermBinary(TOperator op)
|
||||
: TIntermOperator(op),
|
||||
mAddIndexClamp(false) {}
|
||||
|
||||
virtual TIntermBinary *getAsBinaryNode() { return this; }
|
||||
virtual void traverse(TIntermTraverser *);
|
||||
virtual bool replaceChildNode(
|
||||
TIntermNode *original, TIntermNode *replacement);
|
||||
|
||||
virtual bool hasSideEffects() const
|
||||
{
|
||||
return isAssignment() || mLeft->hasSideEffects() || mRight->hasSideEffects();
|
||||
}
|
||||
|
||||
void setLeft(TIntermTyped *node) { mLeft = node; }
|
||||
void setRight(TIntermTyped *node) { mRight = node; }
|
||||
TIntermTyped *getLeft() const { return mLeft; }
|
||||
TIntermTyped *getRight() const { return mRight; }
|
||||
bool promote(TInfoSink &);
|
||||
|
||||
void setAddIndexClamp() { mAddIndexClamp = true; }
|
||||
bool getAddIndexClamp() { return mAddIndexClamp; }
|
||||
|
||||
virtual void enqueueChildren(std::queue<TIntermNode *> *nodeQueue) const;
|
||||
|
||||
protected:
|
||||
TIntermTyped* mLeft;
|
||||
TIntermTyped* mRight;
|
||||
|
||||
// If set to true, wrap any EOpIndexIndirect with a clamp to bounds.
|
||||
bool mAddIndexClamp;
|
||||
};
|
||||
|
||||
//
|
||||
// Nodes for unary math operators.
|
||||
//
|
||||
class TIntermUnary : public TIntermOperator
|
||||
{
|
||||
public:
|
||||
TIntermUnary(TOperator op, const TType &type)
|
||||
: TIntermOperator(op, type),
|
||||
mOperand(NULL),
|
||||
mUseEmulatedFunction(false) {}
|
||||
TIntermUnary(TOperator op)
|
||||
: TIntermOperator(op),
|
||||
mOperand(NULL),
|
||||
mUseEmulatedFunction(false) {}
|
||||
|
||||
virtual void traverse(TIntermTraverser *);
|
||||
virtual TIntermUnary *getAsUnaryNode() { return this; }
|
||||
virtual bool replaceChildNode(
|
||||
TIntermNode *original, TIntermNode *replacement);
|
||||
|
||||
virtual bool hasSideEffects() const
|
||||
{
|
||||
return isAssignment() || mOperand->hasSideEffects();
|
||||
}
|
||||
|
||||
void setOperand(TIntermTyped *operand) { mOperand = operand; }
|
||||
TIntermTyped *getOperand() { return mOperand; }
|
||||
bool promote(TInfoSink &);
|
||||
|
||||
void setUseEmulatedFunction() { mUseEmulatedFunction = true; }
|
||||
bool getUseEmulatedFunction() { return mUseEmulatedFunction; }
|
||||
|
||||
virtual void enqueueChildren(std::queue<TIntermNode *> *nodeQueue) const;
|
||||
|
||||
protected:
|
||||
TIntermTyped *mOperand;
|
||||
|
||||
// If set to true, replace the built-in function call with an emulated one
|
||||
// to work around driver bugs.
|
||||
bool mUseEmulatedFunction;
|
||||
};
|
||||
|
||||
typedef TVector<TIntermNode *> TIntermSequence;
|
||||
typedef TVector<int> TQualifierList;
|
||||
|
||||
//
|
||||
// Nodes that operate on an arbitrary sized set of children.
|
||||
//
|
||||
class TIntermAggregate : public TIntermOperator
|
||||
{
|
||||
public:
|
||||
TIntermAggregate()
|
||||
: TIntermOperator(EOpNull),
|
||||
mUserDefined(false),
|
||||
mUseEmulatedFunction(false) { }
|
||||
TIntermAggregate(TOperator op)
|
||||
: TIntermOperator(op),
|
||||
mUseEmulatedFunction(false) { }
|
||||
~TIntermAggregate() { }
|
||||
|
||||
virtual TIntermAggregate *getAsAggregate() { return this; }
|
||||
virtual void traverse(TIntermTraverser *);
|
||||
virtual bool replaceChildNode(
|
||||
TIntermNode *original, TIntermNode *replacement);
|
||||
|
||||
// Conservatively assume function calls and other aggregate operators have side-effects
|
||||
virtual bool hasSideEffects() const { return true; }
|
||||
|
||||
TIntermSequence *getSequence() { return &mSequence; }
|
||||
|
||||
void setName(const TString &name) { mName = name; }
|
||||
const TString &getName() const { return mName; }
|
||||
|
||||
void setUserDefined() { mUserDefined = true; }
|
||||
bool isUserDefined() const { return mUserDefined; }
|
||||
|
||||
void setOptimize(bool optimize) { mOptimize = optimize; }
|
||||
bool getOptimize() const { return mOptimize; }
|
||||
void setDebug(bool debug) { mDebug = debug; }
|
||||
bool getDebug() const { return mDebug; }
|
||||
|
||||
void setUseEmulatedFunction() { mUseEmulatedFunction = true; }
|
||||
bool getUseEmulatedFunction() { return mUseEmulatedFunction; }
|
||||
|
||||
virtual void enqueueChildren(std::queue<TIntermNode *> *nodeQueue) const;
|
||||
|
||||
protected:
|
||||
TIntermAggregate(const TIntermAggregate &); // disallow copy constructor
|
||||
TIntermAggregate &operator=(const TIntermAggregate &); // disallow assignment operator
|
||||
TIntermSequence mSequence;
|
||||
TString mName;
|
||||
bool mUserDefined; // used for user defined function names
|
||||
|
||||
bool mOptimize;
|
||||
bool mDebug;
|
||||
|
||||
// If set to true, replace the built-in function call with an emulated one
|
||||
// to work around driver bugs.
|
||||
bool mUseEmulatedFunction;
|
||||
};
|
||||
|
||||
//
|
||||
// For if tests. Simplified since there is no switch statement.
|
||||
//
|
||||
class TIntermSelection : public TIntermTyped
|
||||
{
|
||||
public:
|
||||
TIntermSelection(TIntermTyped *cond, TIntermNode *trueB, TIntermNode *falseB)
|
||||
: TIntermTyped(TType(EbtVoid, EbpUndefined)),
|
||||
mCondition(cond),
|
||||
mTrueBlock(trueB),
|
||||
mFalseBlock(falseB) {}
|
||||
TIntermSelection(TIntermTyped *cond, TIntermNode *trueB, TIntermNode *falseB,
|
||||
const TType &type)
|
||||
: TIntermTyped(type),
|
||||
mCondition(cond),
|
||||
mTrueBlock(trueB),
|
||||
mFalseBlock(falseB) {}
|
||||
|
||||
virtual void traverse(TIntermTraverser *);
|
||||
virtual bool replaceChildNode(
|
||||
TIntermNode *original, TIntermNode *replacement);
|
||||
|
||||
// Conservatively assume selections have side-effects
|
||||
virtual bool hasSideEffects() const { return true; }
|
||||
|
||||
bool usesTernaryOperator() const { return getBasicType() != EbtVoid; }
|
||||
TIntermNode *getCondition() const { return mCondition; }
|
||||
TIntermNode *getTrueBlock() const { return mTrueBlock; }
|
||||
TIntermNode *getFalseBlock() const { return mFalseBlock; }
|
||||
TIntermSelection *getAsSelectionNode() { return this; }
|
||||
|
||||
virtual void enqueueChildren(std::queue<TIntermNode *> *nodeQueue) const;
|
||||
|
||||
protected:
|
||||
TIntermTyped *mCondition;
|
||||
TIntermNode *mTrueBlock;
|
||||
TIntermNode *mFalseBlock;
|
||||
};
|
||||
|
||||
enum Visit
|
||||
{
|
||||
PreVisit,
|
||||
InVisit,
|
||||
PostVisit
|
||||
};
|
||||
|
||||
//
|
||||
// For traversing the tree. User should derive from this,
|
||||
// put their traversal specific data in it, and then pass
|
||||
// it to a Traverse method.
|
||||
//
|
||||
// When using this, just fill in the methods for nodes you want visited.
|
||||
// Return false from a pre-visit to skip visiting that node's subtree.
|
||||
//
|
||||
class TIntermTraverser
|
||||
{
|
||||
public:
|
||||
POOL_ALLOCATOR_NEW_DELETE();
|
||||
// TODO(zmo): remove default values.
|
||||
TIntermTraverser(bool preVisit = true, bool inVisit = false, bool postVisit = false,
|
||||
bool rightToLeft = false)
|
||||
: preVisit(preVisit),
|
||||
inVisit(inVisit),
|
||||
postVisit(postVisit),
|
||||
rightToLeft(rightToLeft),
|
||||
mDepth(0),
|
||||
mMaxDepth(0) {}
|
||||
virtual ~TIntermTraverser() {}
|
||||
|
||||
virtual void visitSymbol(TIntermSymbol *) {}
|
||||
virtual void visitRaw(TIntermRaw *) {}
|
||||
virtual void visitConstantUnion(TIntermConstantUnion *) {}
|
||||
virtual bool visitBinary(Visit, TIntermBinary *) { return true; }
|
||||
virtual bool visitUnary(Visit, TIntermUnary *) { return true; }
|
||||
virtual bool visitSelection(Visit, TIntermSelection *) { return true; }
|
||||
virtual bool visitAggregate(Visit, TIntermAggregate *) { return true; }
|
||||
virtual bool visitLoop(Visit, TIntermLoop *) { return true; }
|
||||
virtual bool visitBranch(Visit, TIntermBranch *) { return true; }
|
||||
|
||||
int getMaxDepth() const { return mMaxDepth; }
|
||||
|
||||
void incrementDepth(TIntermNode *current)
|
||||
{
|
||||
mDepth++;
|
||||
mMaxDepth = std::max(mMaxDepth, mDepth);
|
||||
mPath.push_back(current);
|
||||
}
|
||||
|
||||
void decrementDepth()
|
||||
{
|
||||
mDepth--;
|
||||
mPath.pop_back();
|
||||
}
|
||||
|
||||
TIntermNode *getParentNode()
|
||||
{
|
||||
return mPath.size() == 0 ? NULL : mPath.back();
|
||||
}
|
||||
|
||||
// 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;
|
||||
const bool rightToLeft;
|
||||
|
||||
protected:
|
||||
int mDepth;
|
||||
int mMaxDepth;
|
||||
|
||||
// All the nodes from root to the current node's parent during traversing.
|
||||
TVector<TIntermNode *> mPath;
|
||||
};
|
||||
|
||||
//
|
||||
// For traversing the tree, and computing max depth.
|
||||
// Takes a maximum depth limit to prevent stack overflow.
|
||||
//
|
||||
class TMaxDepthTraverser : public TIntermTraverser
|
||||
{
|
||||
public:
|
||||
POOL_ALLOCATOR_NEW_DELETE();
|
||||
TMaxDepthTraverser(int depthLimit)
|
||||
: TIntermTraverser(true, true, false, false),
|
||||
mDepthLimit(depthLimit) { }
|
||||
|
||||
virtual bool visitBinary(Visit, TIntermBinary *) { return depthCheck(); }
|
||||
virtual bool visitUnary(Visit, TIntermUnary *) { return depthCheck(); }
|
||||
virtual bool visitSelection(Visit, TIntermSelection *) { return depthCheck(); }
|
||||
virtual bool visitAggregate(Visit, TIntermAggregate *) { return depthCheck(); }
|
||||
virtual bool visitLoop(Visit, TIntermLoop *) { return depthCheck(); }
|
||||
virtual bool visitBranch(Visit, TIntermBranch *) { return depthCheck(); }
|
||||
|
||||
protected:
|
||||
bool depthCheck() const { return mMaxDepth < mDepthLimit; }
|
||||
|
||||
int mDepthLimit;
|
||||
};
|
||||
|
||||
#endif // COMPILER_TRANSLATOR_INTERMEDIATE_H_
|
@ -4,7 +4,7 @@
|
||||
// found in the LICENSE file.
|
||||
//
|
||||
|
||||
#include "compiler/translator/intermediate.h"
|
||||
#include "compiler/translator/IntermNode.h"
|
||||
|
||||
//
|
||||
// Traverse the intermediate representation tree, and
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -7,7 +7,7 @@
|
||||
#ifndef COMPILER_TRANSLATOR_LOOP_INFO_H_
|
||||
#define COMPILER_TRANSLATOR_LOOP_INFO_H_
|
||||
|
||||
#include "compiler/translator/intermediate.h"
|
||||
#include "compiler/translator/IntermNode.h"
|
||||
|
||||
class TLoopIndexInfo
|
||||
{
|
||||
|
@ -9,7 +9,7 @@
|
||||
#ifndef TRANSLATOR_NODESEARCH_H_
|
||||
#define TRANSLATOR_NODESEARCH_H_
|
||||
|
||||
#include "compiler/translator/intermediate.h"
|
||||
#include "compiler/translator/IntermNode.h"
|
||||
|
||||
namespace sh
|
||||
{
|
||||
|
@ -81,9 +81,10 @@ void TOutputGLSLBase::writeVariableType(const TType &type)
|
||||
{
|
||||
TInfoSinkBase &out = objSink();
|
||||
TQualifier qualifier = type.getQualifier();
|
||||
// TODO(alokp): Validate qualifier for variable declarations.
|
||||
if (qualifier != EvqTemporary && qualifier != EvqGlobal)
|
||||
{
|
||||
out << type.getQualifierString() << " ";
|
||||
}
|
||||
// Declare the struct if we have not done so already.
|
||||
if (type.getBasicType() == EbtStruct && !structDeclared(type.getStruct()))
|
||||
{
|
||||
@ -648,6 +649,17 @@ bool TOutputGLSLBase::visitAggregate(Visit visit, TIntermAggregate *node)
|
||||
mDeclaringVariables = false;
|
||||
}
|
||||
break;
|
||||
case EOpInvariantDeclaration: {
|
||||
// Invariant declaration.
|
||||
ASSERT(visit == PreVisit);
|
||||
const TIntermSequence *sequence = node->getSequence();
|
||||
ASSERT(sequence && sequence->size() == 1);
|
||||
const TIntermSymbol *symbol = sequence->front()->getAsSymbolNode();
|
||||
ASSERT(symbol);
|
||||
out << "invariant " << symbol->getSymbol() << ";";
|
||||
visitChildren = false;
|
||||
break;
|
||||
}
|
||||
case EOpConstructFloat:
|
||||
writeTriplet(visit, "float(", NULL, ")");
|
||||
break;
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
#include <set>
|
||||
|
||||
#include "compiler/translator/intermediate.h"
|
||||
#include "compiler/translator/IntermNode.h"
|
||||
#include "compiler/translator/LoopInfo.h"
|
||||
#include "compiler/translator/ParseContext.h"
|
||||
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "compiler/translator/util.h"
|
||||
#include "compiler/translator/UniformHLSL.h"
|
||||
#include "compiler/translator/StructureHLSL.h"
|
||||
#include "compiler/translator/TranslatorHLSL.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cfloat>
|
||||
@ -93,8 +94,10 @@ bool OutputHLSL::TextureFunction::operator<(const TextureFunction &rhs) const
|
||||
return false;
|
||||
}
|
||||
|
||||
OutputHLSL::OutputHLSL(TParseContext &context, const ShBuiltInResources& resources, ShShaderOutput outputType)
|
||||
: TIntermTraverser(true, true, true), mContext(context), mOutputType(outputType)
|
||||
OutputHLSL::OutputHLSL(TParseContext &context, TranslatorHLSL *parentTranslator)
|
||||
: TIntermTraverser(true, true, true),
|
||||
mContext(context),
|
||||
mOutputType(parentTranslator->getOutputType())
|
||||
{
|
||||
mUnfoldShortCircuit = new UnfoldShortCircuit(context, this);
|
||||
mInsideFunction = false;
|
||||
@ -126,6 +129,7 @@ OutputHLSL::OutputHLSL(TParseContext &context, const ShBuiltInResources& resourc
|
||||
mUsesDiscardRewriting = false;
|
||||
mUsesNestedBreak = false;
|
||||
|
||||
const ShBuiltInResources &resources = parentTranslator->getResources();
|
||||
mNumRenderTargets = resources.EXT_draw_buffers ? resources.MaxDrawBuffers : 1;
|
||||
|
||||
mUniqueIndex = 0;
|
||||
@ -138,7 +142,7 @@ OutputHLSL::OutputHLSL(TParseContext &context, const ShBuiltInResources& resourc
|
||||
mExcessiveLoopIndex = NULL;
|
||||
|
||||
mStructureHLSL = new StructureHLSL;
|
||||
mUniformHLSL = new UniformHLSL(mStructureHLSL, mOutputType);
|
||||
mUniformHLSL = new UniformHLSL(mStructureHLSL, parentTranslator);
|
||||
|
||||
if (mOutputType == SH_HLSL9_OUTPUT)
|
||||
{
|
||||
@ -212,31 +216,6 @@ TInfoSinkBase &OutputHLSL::getBodyStream()
|
||||
return mBody;
|
||||
}
|
||||
|
||||
const std::vector<sh::Uniform> &OutputHLSL::getUniforms()
|
||||
{
|
||||
return mUniformHLSL->getUniforms();
|
||||
}
|
||||
|
||||
const std::vector<sh::InterfaceBlock> &OutputHLSL::getInterfaceBlocks() const
|
||||
{
|
||||
return mUniformHLSL->getInterfaceBlocks();
|
||||
}
|
||||
|
||||
const std::vector<sh::Attribute> &OutputHLSL::getOutputVariables() const
|
||||
{
|
||||
return mActiveOutputVariables;
|
||||
}
|
||||
|
||||
const std::vector<sh::Attribute> &OutputHLSL::getAttributes() const
|
||||
{
|
||||
return mActiveAttributes;
|
||||
}
|
||||
|
||||
const std::vector<sh::Varying> &OutputHLSL::getVaryings() const
|
||||
{
|
||||
return mActiveVaryings;
|
||||
}
|
||||
|
||||
const std::map<std::string, unsigned int> &OutputHLSL::getInterfaceBlockRegisterMap() const
|
||||
{
|
||||
return mUniformHLSL->getInterfaceBlockRegisterMap();
|
||||
@ -324,8 +303,6 @@ void OutputHLSL::header()
|
||||
// Program linking depends on this exact format
|
||||
varyings += "static " + InterpolationString(type.getQualifier()) + " " + TypeString(type) + " " +
|
||||
Decorate(name) + ArrayString(type) + " = " + initializer(type) + ";\n";
|
||||
|
||||
declareVaryingToList(type, type.getQualifier(), name, mActiveVaryings);
|
||||
}
|
||||
|
||||
for (ReferencedSymbols::const_iterator attribute = mReferencedAttributes.begin(); attribute != mReferencedAttributes.end(); attribute++)
|
||||
@ -334,10 +311,6 @@ void OutputHLSL::header()
|
||||
const TString &name = attribute->second->getSymbol();
|
||||
|
||||
attributes += "static " + TypeString(type) + " " + Decorate(name) + ArrayString(type) + " = " + initializer(type) + ";\n";
|
||||
|
||||
sh::Attribute attributeVar(GLVariableType(type), GLVariablePrecision(type), name.c_str(),
|
||||
(unsigned int)type.getArraySize(), type.getLayoutQualifier().location);
|
||||
mActiveAttributes.push_back(attributeVar);
|
||||
}
|
||||
|
||||
out << mStructureHLSL->structsHeader();
|
||||
@ -370,14 +343,9 @@ void OutputHLSL::header()
|
||||
{
|
||||
const TString &variableName = outputVariableIt->first;
|
||||
const TType &variableType = outputVariableIt->second->getType();
|
||||
const TLayoutQualifier &layoutQualifier = variableType.getLayoutQualifier();
|
||||
|
||||
out << "static " + TypeString(variableType) + " out_" + variableName + ArrayString(variableType) +
|
||||
" = " + initializer(variableType) + ";\n";
|
||||
|
||||
sh::Attribute outputVar(GLVariableType(variableType), GLVariablePrecision(variableType), variableName.c_str(),
|
||||
(unsigned int)variableType.getArraySize(), layoutQualifier.location);
|
||||
mActiveOutputVariables.push_back(outputVar);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -1951,6 +1919,9 @@ bool OutputHLSL::visitAggregate(Visit visit, TIntermAggregate *node)
|
||||
out << ", ";
|
||||
}
|
||||
break;
|
||||
case EOpInvariantDeclaration:
|
||||
// Do not do any translation
|
||||
return false;
|
||||
case EOpPrototype:
|
||||
if (visit == PreVisit)
|
||||
{
|
||||
@ -2910,29 +2881,4 @@ const ConstantUnion *OutputHLSL::writeConstantUnion(const TType &type, const Con
|
||||
return constUnion;
|
||||
}
|
||||
|
||||
class DeclareVaryingTraverser : public GetVariableTraverser<Varying>
|
||||
{
|
||||
public:
|
||||
DeclareVaryingTraverser(std::vector<Varying> *output,
|
||||
InterpolationType interpolation)
|
||||
: GetVariableTraverser(output),
|
||||
mInterpolation(interpolation)
|
||||
{}
|
||||
|
||||
private:
|
||||
void visitVariable(Varying *varying)
|
||||
{
|
||||
varying->interpolation = mInterpolation;
|
||||
}
|
||||
|
||||
InterpolationType mInterpolation;
|
||||
};
|
||||
|
||||
void OutputHLSL::declareVaryingToList(const TType &type, TQualifier baseTypeQualifier,
|
||||
const TString &name, std::vector<Varying> &fieldsOut)
|
||||
{
|
||||
DeclareVaryingTraverser traverser(&fieldsOut, GetInterpolationType(baseTypeQualifier));
|
||||
traverser.traverse(type, name);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -12,9 +12,9 @@
|
||||
#include <map>
|
||||
|
||||
#include "angle_gl.h"
|
||||
#include "compiler/translator/intermediate.h"
|
||||
|
||||
#include "compiler/translator/IntermNode.h"
|
||||
#include "compiler/translator/ParseContext.h"
|
||||
#include "common/shadervars.h"
|
||||
|
||||
namespace sh
|
||||
{
|
||||
@ -27,17 +27,12 @@ typedef std::map<TString, TIntermSymbol*> ReferencedSymbols;
|
||||
class OutputHLSL : public TIntermTraverser
|
||||
{
|
||||
public:
|
||||
OutputHLSL(TParseContext &context, const ShBuiltInResources& resources, ShShaderOutput outputType);
|
||||
OutputHLSL(TParseContext &context, TranslatorHLSL *parentTranslator);
|
||||
~OutputHLSL();
|
||||
|
||||
void output();
|
||||
|
||||
TInfoSinkBase &getBodyStream();
|
||||
const std::vector<sh::Uniform> &getUniforms();
|
||||
const std::vector<sh::InterfaceBlock> &getInterfaceBlocks() const;
|
||||
const std::vector<sh::Attribute> &getOutputVariables() const;
|
||||
const std::vector<sh::Attribute> &getAttributes() const;
|
||||
const std::vector<sh::Varying> &getVaryings() const;
|
||||
|
||||
const std::map<std::string, unsigned int> &getInterfaceBlockRegisterMap() const;
|
||||
const std::map<std::string, unsigned int> &getUniformRegisterMap() const;
|
||||
@ -155,13 +150,8 @@ class OutputHLSL : public TIntermTraverser
|
||||
|
||||
TIntermSymbol *mExcessiveLoopIndex;
|
||||
|
||||
void declareVaryingToList(const TType &type, TQualifier baseTypeQualifier, const TString &name, std::vector<sh::Varying>& fieldsOut);
|
||||
|
||||
TString structInitializerString(int indent, const TStructure &structure, const TString &rhsStructName);
|
||||
|
||||
std::vector<sh::Attribute> mActiveOutputVariables;
|
||||
std::vector<sh::Attribute> mActiveAttributes;
|
||||
std::vector<sh::Varying> mActiveVaryings;
|
||||
std::map<TIntermTyped*, TString> mFlaggedStructMappedNames;
|
||||
std::map<TIntermTyped*, TString> mFlaggedStructOriginalNames;
|
||||
|
||||
|
@ -1018,6 +1018,45 @@ void TParseContext::handlePragmaDirective(const TSourceLoc& loc, const char* nam
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
const TVariable *TParseContext::getNamedVariable(const TSourceLoc &location,
|
||||
const TString *name,
|
||||
const TSymbol *symbol)
|
||||
{
|
||||
const TVariable *variable = NULL;
|
||||
|
||||
if (!symbol)
|
||||
{
|
||||
error(location, "undeclared identifier", name->c_str());
|
||||
recover();
|
||||
}
|
||||
else if (!symbol->isVariable())
|
||||
{
|
||||
error(location, "variable expected", name->c_str());
|
||||
recover();
|
||||
}
|
||||
else
|
||||
{
|
||||
variable = static_cast<const TVariable*>(symbol);
|
||||
|
||||
if (symbolTable.findBuiltIn(variable->getName(), shaderVersion) &&
|
||||
!variable->getExtension().empty() &&
|
||||
extensionErrorCheck(location, variable->getExtension()))
|
||||
{
|
||||
recover();
|
||||
}
|
||||
}
|
||||
|
||||
if (!variable)
|
||||
{
|
||||
TType type(EbtFloat, EbpUndefined);
|
||||
TVariable *fakeVariable = new TVariable(name, type);
|
||||
symbolTable.declare(fakeVariable);
|
||||
variable = fakeVariable;
|
||||
}
|
||||
|
||||
return variable;
|
||||
}
|
||||
|
||||
//
|
||||
// Look up a function name in the symbol table, and make sure it is a function.
|
||||
//
|
||||
@ -1050,6 +1089,8 @@ const TFunction* TParseContext::findFunction(const TSourceLoc& line, TFunction*
|
||||
// Initializers show up in several places in the grammar. Have one set of
|
||||
// code to handle them here.
|
||||
//
|
||||
// Returns true on error, false if no error
|
||||
//
|
||||
bool TParseContext::executeInitializer(const TSourceLoc& line, const TString& identifier, TPublicType& pType,
|
||||
TIntermTyped* initializer, TIntermNode*& intermNode, TVariable* variable)
|
||||
{
|
||||
@ -1308,14 +1349,40 @@ TIntermAggregate* TParseContext::parseSingleInitDeclaration(TPublicType &publicT
|
||||
}
|
||||
}
|
||||
|
||||
TIntermAggregate* TParseContext::parseDeclarator(TPublicType &publicType, TIntermAggregate *aggregateDeclaration, TSymbol *identifierSymbol, const TSourceLoc& identifierLocation, const TString &identifier)
|
||||
TIntermAggregate* TParseContext::parseInvariantDeclaration(const TSourceLoc &invariantLoc,
|
||||
const TSourceLoc &identifierLoc,
|
||||
const TString *identifier,
|
||||
const TSymbol *symbol)
|
||||
{
|
||||
if (publicType.type == EbtInvariant && !identifierSymbol)
|
||||
// invariant declaration
|
||||
if (globalErrorCheck(invariantLoc, symbolTable.atGlobalLevel(), "invariant varying"))
|
||||
{
|
||||
error(identifierLocation, "undeclared identifier declared as invariant", identifier.c_str());
|
||||
recover();
|
||||
}
|
||||
|
||||
if (!symbol)
|
||||
{
|
||||
error(identifierLoc, "undeclared identifier declared as invariant", identifier->c_str());
|
||||
recover();
|
||||
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
const TVariable *variable = getNamedVariable(identifierLoc, identifier, symbol);
|
||||
ASSERT(variable);
|
||||
const TType &type = variable->getType();
|
||||
TIntermSymbol *intermSymbol = intermediate.addSymbol(variable->getUniqueId(),
|
||||
*identifier, type, identifierLoc);
|
||||
|
||||
TIntermAggregate *aggregate = intermediate.makeAggregate(intermSymbol, identifierLoc);
|
||||
aggregate->setOp(EOpInvariantDeclaration);
|
||||
return aggregate;
|
||||
}
|
||||
}
|
||||
|
||||
TIntermAggregate* TParseContext::parseDeclarator(TPublicType &publicType, TIntermAggregate *aggregateDeclaration, TSymbol *identifierSymbol, const TSourceLoc& identifierLocation, const TString &identifier)
|
||||
{
|
||||
TIntermSymbol* symbol = intermediate.addSymbol(0, identifier, TType(publicType), identifierLocation);
|
||||
TIntermAggregate* intermAggregate = intermediate.growAggregate(aggregateDeclaration, symbol, identifierLocation);
|
||||
|
||||
@ -1548,7 +1615,7 @@ TIntermTyped *TParseContext::addConstructor(TIntermNode *arguments, const TType
|
||||
|
||||
for (size_t i = 0; i < fields.size(); i++)
|
||||
{
|
||||
if ((*args)[i]->getAsTyped()->getType() != *fields[i]->type())
|
||||
if (i >= args->size() || (*args)[i]->getAsTyped()->getType() != *fields[i]->type())
|
||||
{
|
||||
error(line, "Structure constructor arguments do not match structure fields", "Error");
|
||||
recover();
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include "compiler/translator/Compiler.h"
|
||||
#include "compiler/translator/Diagnostics.h"
|
||||
#include "compiler/translator/DirectiveHandler.h"
|
||||
#include "compiler/translator/localintermediate.h"
|
||||
#include "compiler/translator/Intermediate.h"
|
||||
#include "compiler/translator/SymbolTable.h"
|
||||
#include "compiler/preprocessor/Preprocessor.h"
|
||||
|
||||
@ -77,6 +77,9 @@ struct TParseContext {
|
||||
void trace(const char* str);
|
||||
void recover();
|
||||
|
||||
// This method is guaranteed to succeed, even if no variable with 'name' exists.
|
||||
const TVariable *getNamedVariable(const TSourceLoc &location, const TString *name, const TSymbol *symbol);
|
||||
|
||||
bool parseVectorFields(const TString&, int vecSize, TVectorFields&, const TSourceLoc& line);
|
||||
bool parseMatrixFields(const TString&, int matCols, int matRows, TMatrixFields&, const TSourceLoc& line);
|
||||
|
||||
@ -126,6 +129,8 @@ struct TParseContext {
|
||||
TIntermAggregate* parseSingleDeclaration(TPublicType &publicType, const TSourceLoc& identifierLocation, const TString &identifier);
|
||||
TIntermAggregate* parseSingleArrayDeclaration(TPublicType &publicType, const TSourceLoc& identifierLocation, const TString &identifier, const TSourceLoc& indexLocation, TIntermTyped *indexExpression);
|
||||
TIntermAggregate* parseSingleInitDeclaration(TPublicType &publicType, const TSourceLoc& identifierLocation, const TString &identifier, const TSourceLoc& initLocation, TIntermTyped *initializer);
|
||||
TIntermAggregate* parseInvariantDeclaration(const TSourceLoc &invariantLoc, const TSourceLoc &identifierLoc, const TString *identifier, const TSymbol *symbol);
|
||||
|
||||
TIntermAggregate* parseDeclarator(TPublicType &publicType, TIntermAggregate *aggregateDeclaration, TSymbol *identifierSymbol, const TSourceLoc& identifierLocation, const TString &identifier);
|
||||
TIntermAggregate* parseArrayDeclarator(TPublicType &publicType, const TSourceLoc& identifierLocation, const TString &identifier, const TSourceLoc& arrayLocation, TIntermNode *declaratorList, TIntermTyped *indexExpression);
|
||||
TIntermAggregate* parseInitDeclarator(TPublicType &publicType, TIntermAggregate *declaratorList, const TSourceLoc& identifierLocation, const TString &identifier, const TSourceLoc& initLocation, TIntermTyped *initializer);
|
||||
|
@ -4,7 +4,7 @@
|
||||
// found in the LICENSE file.
|
||||
//
|
||||
|
||||
#include "compiler/translator/intermediate.h"
|
||||
#include "compiler/translator/IntermNode.h"
|
||||
|
||||
class TAliveTraverser : public TIntermTraverser {
|
||||
public:
|
||||
|
82
src/3rdparty/angle/src/compiler/translator/RegenerateStructNames.cpp
vendored
Normal file
82
src/3rdparty/angle/src/compiler/translator/RegenerateStructNames.cpp
vendored
Normal file
@ -0,0 +1,82 @@
|
||||
//
|
||||
// Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
//
|
||||
|
||||
#include "compiler/translator/RegenerateStructNames.h"
|
||||
#include "compiler/translator/compilerdebug.h"
|
||||
|
||||
void RegenerateStructNames::visitSymbol(TIntermSymbol *symbol)
|
||||
{
|
||||
ASSERT(symbol);
|
||||
TType *type = symbol->getTypePointer();
|
||||
ASSERT(type);
|
||||
TStructure *userType = type->getStruct();
|
||||
if (!userType)
|
||||
return;
|
||||
|
||||
if (mSymbolTable.findBuiltIn(userType->name(), mShaderVersion))
|
||||
{
|
||||
// Built-in struct, do not touch it.
|
||||
return;
|
||||
}
|
||||
|
||||
int uniqueId = userType->uniqueId();
|
||||
|
||||
ASSERT(mScopeDepth > 0);
|
||||
if (mScopeDepth == 1)
|
||||
{
|
||||
// If a struct is defined at global scope, we don't map its name.
|
||||
// This is because at global level, the struct might be used to
|
||||
// declare a uniform, so the same name needs to stay the same for
|
||||
// vertex/fragment shaders. However, our mapping uses internal ID,
|
||||
// which will be different for the same struct in vertex/fragment
|
||||
// shaders.
|
||||
// This is OK because names for any structs defined in other scopes
|
||||
// will begin with "_webgl", which is reserved. So there will be
|
||||
// no conflicts among unmapped struct names from global scope and
|
||||
// mapped struct names from other scopes.
|
||||
// However, we need to keep track of these global structs, so if a
|
||||
// variable is used in a local scope, we don't try to modify the
|
||||
// struct name through that variable.
|
||||
mDeclaredGlobalStructs.insert(uniqueId);
|
||||
return;
|
||||
}
|
||||
if (mDeclaredGlobalStructs.count(uniqueId) > 0)
|
||||
return;
|
||||
// Map {name} to _webgl_struct_{uniqueId}_{name}.
|
||||
const char kPrefix[] = "_webgl_struct_";
|
||||
if (userType->name().find(kPrefix) == 0)
|
||||
{
|
||||
// The name has already been regenerated.
|
||||
return;
|
||||
}
|
||||
std::string id = Str(uniqueId);
|
||||
TString tmp = kPrefix + TString(id.c_str());
|
||||
tmp += "_" + userType->name();
|
||||
userType->setName(tmp);
|
||||
}
|
||||
|
||||
bool RegenerateStructNames::visitAggregate(Visit, TIntermAggregate *aggregate)
|
||||
{
|
||||
ASSERT(aggregate);
|
||||
switch (aggregate->getOp())
|
||||
{
|
||||
case EOpSequence:
|
||||
++mScopeDepth;
|
||||
{
|
||||
TIntermSequence &sequence = *(aggregate->getSequence());
|
||||
for (size_t ii = 0; ii < sequence.size(); ++ii)
|
||||
{
|
||||
TIntermNode *node = sequence[ii];
|
||||
ASSERT(node != NULL);
|
||||
node->traverse(this);
|
||||
}
|
||||
}
|
||||
--mScopeDepth;
|
||||
return false;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
40
src/3rdparty/angle/src/compiler/translator/RegenerateStructNames.h
vendored
Normal file
40
src/3rdparty/angle/src/compiler/translator/RegenerateStructNames.h
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
//
|
||||
// Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
//
|
||||
|
||||
#ifndef COMPILER_TRANSLATOR_REGENERATE_STRUCT_NAMES_H_
|
||||
#define COMPILER_TRANSLATOR_REGENERATE_STRUCT_NAMES_H_
|
||||
|
||||
#include "compiler/translator/Intermediate.h"
|
||||
#include "compiler/translator/SymbolTable.h"
|
||||
|
||||
#include <set>
|
||||
|
||||
class RegenerateStructNames : public TIntermTraverser
|
||||
{
|
||||
public:
|
||||
RegenerateStructNames(const TSymbolTable &symbolTable,
|
||||
int shaderVersion)
|
||||
: mSymbolTable(symbolTable),
|
||||
mShaderVersion(shaderVersion),
|
||||
mScopeDepth(0) {}
|
||||
|
||||
protected:
|
||||
virtual void visitSymbol(TIntermSymbol *);
|
||||
virtual bool visitAggregate(Visit, TIntermAggregate *);
|
||||
|
||||
private:
|
||||
const TSymbolTable &mSymbolTable;
|
||||
int mShaderVersion;
|
||||
|
||||
// Indicating the depth of the current scope.
|
||||
// The global scope is 1.
|
||||
int mScopeDepth;
|
||||
|
||||
// If a struct's declared globally, push its ID in this set.
|
||||
std::set<int> mDeclaredGlobalStructs;
|
||||
};
|
||||
|
||||
#endif // COMPILER_TRANSLATOR_REGENERATE_STRUCT_NAMES_H_
|
@ -4,7 +4,7 @@
|
||||
// found in the LICENSE file.
|
||||
//
|
||||
|
||||
#include "compiler/translator/intermediate.h"
|
||||
#include "compiler/translator/IntermNode.h"
|
||||
#include "compiler/translator/RemoveTree.h"
|
||||
|
||||
//
|
||||
|
@ -7,7 +7,7 @@
|
||||
#ifndef COMPILER_RENAME_FUNCTION
|
||||
#define COMPILER_RENAME_FUNCTION
|
||||
|
||||
#include "compiler/translator/intermediate.h"
|
||||
#include "compiler/translator/IntermNode.h"
|
||||
|
||||
//
|
||||
// Renames a function, including its declaration and any calls to it.
|
||||
|
@ -10,7 +10,7 @@
|
||||
#ifndef COMPILER_REWRITE_ELSE_BLOCKS_H_
|
||||
#define COMPILER_REWRITE_ELSE_BLOCKS_H_
|
||||
|
||||
#include "compiler/translator/intermediate.h"
|
||||
#include "compiler/translator/IntermNode.h"
|
||||
|
||||
namespace sh
|
||||
{
|
||||
|
@ -9,6 +9,7 @@
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "angle_gl.h"
|
||||
#include "common/angleutils.h"
|
||||
|
||||
namespace
|
||||
@ -249,6 +250,16 @@ TString ScalarizeVecAndMatConstructorArgs::createTempVariable(TIntermTyped *orig
|
||||
TType type = original->getType();
|
||||
type.setQualifier(EvqTemporary);
|
||||
|
||||
if (mShaderType == GL_FRAGMENT_SHADER &&
|
||||
type.getBasicType() == EbtFloat &&
|
||||
type.getPrecision() == EbpUndefined)
|
||||
{
|
||||
// We use the highest available precision for the temporary variable
|
||||
// to avoid computing the actual precision using the rules defined
|
||||
// in GLSL ES 1.0 Section 4.5.2.
|
||||
type.setPrecision(mFragmentPrecisionHigh ? EbpHigh : EbpMedium);
|
||||
}
|
||||
|
||||
TIntermBinary *init = new TIntermBinary(EOpInitialize);
|
||||
TIntermSymbol *symbolNode = new TIntermSymbol(-1, tempVarName, type);
|
||||
init->setLeft(symbolNode);
|
||||
|
@ -7,13 +7,16 @@
|
||||
#ifndef COMPILER_TRANSLATOR_SCALARIZE_VEC_AND_MAT_CONSTRUCTOR_ARGS_H_
|
||||
#define COMPILER_TRANSLATOR_SCALARIZE_VEC_AND_MAT_CONSTRUCTOR_ARGS_H_
|
||||
|
||||
#include "compiler/translator/intermediate.h"
|
||||
#include "compiler/translator/IntermNode.h"
|
||||
|
||||
class ScalarizeVecAndMatConstructorArgs : public TIntermTraverser
|
||||
{
|
||||
public:
|
||||
ScalarizeVecAndMatConstructorArgs()
|
||||
: mTempVarCount(0) {}
|
||||
ScalarizeVecAndMatConstructorArgs(sh::GLenum shaderType,
|
||||
bool fragmentPrecisionHigh)
|
||||
: mTempVarCount(0),
|
||||
mShaderType(shaderType),
|
||||
mFragmentPrecisionHigh(fragmentPrecisionHigh) {}
|
||||
|
||||
protected:
|
||||
virtual bool visitAggregate(Visit visit, TIntermAggregate *node);
|
||||
@ -36,6 +39,9 @@ class ScalarizeVecAndMatConstructorArgs : public TIntermTraverser
|
||||
|
||||
std::vector<TIntermSequence> mSequenceStack;
|
||||
int mTempVarCount;
|
||||
|
||||
sh::GLenum mShaderType;
|
||||
bool mFragmentPrecisionHigh;
|
||||
};
|
||||
|
||||
#endif // COMPILER_TRANSLATOR_SCALARIZE_VEC_AND_MAT_CONSTRUCTOR_ARGS_H_
|
||||
|
@ -9,7 +9,7 @@
|
||||
#ifndef COMPILER_SEARCHSYMBOL_H_
|
||||
#define COMPILER_SEARCHSYMBOL_H_
|
||||
|
||||
#include "compiler/translator/intermediate.h"
|
||||
#include "compiler/translator/IntermNode.h"
|
||||
#include "compiler/translator/ParseContext.h"
|
||||
|
||||
namespace sh
|
||||
|
@ -18,14 +18,26 @@
|
||||
#include "compiler/translator/VariablePacker.h"
|
||||
#include "angle_gl.h"
|
||||
|
||||
static bool isInitialized = false;
|
||||
namespace
|
||||
{
|
||||
|
||||
enum ShaderVariableType
|
||||
{
|
||||
SHADERVAR_UNIFORM,
|
||||
SHADERVAR_VARYING,
|
||||
SHADERVAR_ATTRIBUTE,
|
||||
SHADERVAR_OUTPUTVARIABLE,
|
||||
SHADERVAR_INTERFACEBLOCK
|
||||
};
|
||||
|
||||
bool isInitialized = false;
|
||||
|
||||
//
|
||||
// This is the platform independent interface between an OGL driver
|
||||
// and the shading language compiler.
|
||||
//
|
||||
|
||||
static bool checkVariableMaxLengths(const ShHandle handle,
|
||||
static bool CheckVariableMaxLengths(const ShHandle handle,
|
||||
size_t expectedValue)
|
||||
{
|
||||
size_t activeUniformLimit = 0;
|
||||
@ -39,7 +51,7 @@ static bool checkVariableMaxLengths(const ShHandle handle,
|
||||
expectedValue == varyingLimit);
|
||||
}
|
||||
|
||||
static bool checkMappedNameMaxLength(const ShHandle handle, size_t expectedValue)
|
||||
bool CheckMappedNameMaxLength(const ShHandle handle, size_t expectedValue)
|
||||
{
|
||||
size_t mappedNameMaxLength = 0;
|
||||
ShGetInfo(handle, SH_MAPPED_NAME_MAX_LENGTH, &mappedNameMaxLength);
|
||||
@ -47,7 +59,7 @@ static bool checkMappedNameMaxLength(const ShHandle handle, size_t expectedValue
|
||||
}
|
||||
|
||||
template <typename VarT>
|
||||
static const sh::ShaderVariable *ReturnVariable(const std::vector<VarT> &infoList, int index)
|
||||
const sh::ShaderVariable *ReturnVariable(const std::vector<VarT> &infoList, int index)
|
||||
{
|
||||
if (index < 0 || static_cast<size_t>(index) >= infoList.size())
|
||||
{
|
||||
@ -57,7 +69,7 @@ static const sh::ShaderVariable *ReturnVariable(const std::vector<VarT> &infoLis
|
||||
return &infoList[index];
|
||||
}
|
||||
|
||||
static const sh::ShaderVariable *GetVariable(const TCompiler *compiler, ShShaderInfo varType, int index)
|
||||
const sh::ShaderVariable *GetVariable(const TCompiler *compiler, ShShaderInfo varType, int index)
|
||||
{
|
||||
switch (varType)
|
||||
{
|
||||
@ -73,7 +85,7 @@ static const sh::ShaderVariable *GetVariable(const TCompiler *compiler, ShShader
|
||||
}
|
||||
}
|
||||
|
||||
static ShPrecisionType ConvertPrecision(sh::GLenum precision)
|
||||
ShPrecisionType ConvertPrecision(sh::GLenum precision)
|
||||
{
|
||||
switch (precision)
|
||||
{
|
||||
@ -91,6 +103,55 @@ static ShPrecisionType ConvertPrecision(sh::GLenum precision)
|
||||
}
|
||||
}
|
||||
|
||||
template <typename VarT>
|
||||
const std::vector<VarT> *GetVariableList(const TCompiler *compiler, ShaderVariableType variableType);
|
||||
|
||||
template <>
|
||||
const std::vector<sh::Uniform> *GetVariableList(const TCompiler *compiler, ShaderVariableType)
|
||||
{
|
||||
return &compiler->getUniforms();
|
||||
}
|
||||
|
||||
template <>
|
||||
const std::vector<sh::Varying> *GetVariableList(const TCompiler *compiler, ShaderVariableType)
|
||||
{
|
||||
return &compiler->getVaryings();
|
||||
}
|
||||
|
||||
template <>
|
||||
const std::vector<sh::Attribute> *GetVariableList(const TCompiler *compiler, ShaderVariableType variableType)
|
||||
{
|
||||
return (variableType == SHADERVAR_ATTRIBUTE ?
|
||||
&compiler->getAttributes() :
|
||||
&compiler->getOutputVariables());
|
||||
}
|
||||
|
||||
template <>
|
||||
const std::vector<sh::InterfaceBlock> *GetVariableList(const TCompiler *compiler, ShaderVariableType)
|
||||
{
|
||||
return &compiler->getInterfaceBlocks();
|
||||
}
|
||||
|
||||
template <typename VarT>
|
||||
const std::vector<VarT> *GetShaderVariables(const ShHandle handle, ShaderVariableType variableType)
|
||||
{
|
||||
if (!handle)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
TShHandleBase* base = static_cast<TShHandleBase*>(handle);
|
||||
TCompiler* compiler = base->getAsCompiler();
|
||||
if (!compiler)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return GetVariableList<VarT>(compiler, variableType);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// Driver must call this first, once, before doing any other compiler operations.
|
||||
// Subsequent calls to this function are no-op.
|
||||
@ -372,7 +433,7 @@ void ShGetVariableInfo(const ShHandle handle,
|
||||
// SH_ACTIVE_UNIFORM_MAX_LENGTH, SH_ACTIVE_ATTRIBUTE_MAX_LENGTH, SH_VARYING_MAX_LENGTH
|
||||
// in ShGetInfo, below.
|
||||
size_t variableLength = 1 + GetGlobalMaxTokenSize(compiler->getShaderSpec());
|
||||
ASSERT(checkVariableMaxLengths(handle, variableLength));
|
||||
ASSERT(CheckVariableMaxLengths(handle, variableLength));
|
||||
strncpy(name, varInfo->name.c_str(), variableLength);
|
||||
name[variableLength - 1] = 0;
|
||||
if (mappedName)
|
||||
@ -380,7 +441,7 @@ void ShGetVariableInfo(const ShHandle handle,
|
||||
// This size must match that queried by
|
||||
// SH_MAPPED_NAME_MAX_LENGTH in ShGetInfo, below.
|
||||
size_t maxMappedNameLength = 1 + GetGlobalMaxTokenSize(compiler->getShaderSpec());
|
||||
ASSERT(checkMappedNameMaxLength(handle, maxMappedNameLength));
|
||||
ASSERT(CheckMappedNameMaxLength(handle, maxMappedNameLength));
|
||||
strncpy(mappedName, varInfo->mappedName.c_str(), maxMappedNameLength);
|
||||
mappedName[maxMappedNameLength - 1] = 0;
|
||||
}
|
||||
@ -429,34 +490,29 @@ void ShGetNameHashingEntry(const ShHandle handle,
|
||||
hashedName[len - 1] = '\0';
|
||||
}
|
||||
|
||||
void ShGetInfoPointer(const ShHandle handle, ShShaderInfo pname, void** params)
|
||||
const std::vector<sh::Uniform> *ShGetUniforms(const ShHandle handle)
|
||||
{
|
||||
if (!handle || !params)
|
||||
return;
|
||||
return GetShaderVariables<sh::Uniform>(handle, SHADERVAR_UNIFORM);
|
||||
}
|
||||
|
||||
TShHandleBase* base = static_cast<TShHandleBase*>(handle);
|
||||
TranslatorHLSL* translator = base->getAsTranslatorHLSL();
|
||||
if (!translator) return;
|
||||
const std::vector<sh::Varying> *ShGetVaryings(const ShHandle handle)
|
||||
{
|
||||
return GetShaderVariables<sh::Varying>(handle, SHADERVAR_VARYING);
|
||||
}
|
||||
|
||||
switch(pname)
|
||||
{
|
||||
case SH_ACTIVE_UNIFORMS_ARRAY:
|
||||
*params = (void*)&translator->getUniforms();
|
||||
break;
|
||||
case SH_ACTIVE_INTERFACE_BLOCKS_ARRAY:
|
||||
*params = (void*)&translator->getInterfaceBlocks();
|
||||
break;
|
||||
case SH_ACTIVE_OUTPUT_VARIABLES_ARRAY:
|
||||
*params = (void*)&translator->getOutputVariables();
|
||||
break;
|
||||
case SH_ACTIVE_ATTRIBUTES_ARRAY:
|
||||
*params = (void*)&translator->getAttributes();
|
||||
break;
|
||||
case SH_ACTIVE_VARYINGS_ARRAY:
|
||||
*params = (void*)&translator->getVaryings();
|
||||
break;
|
||||
default: UNREACHABLE();
|
||||
}
|
||||
const std::vector<sh::Attribute> *ShGetAttributes(const ShHandle handle)
|
||||
{
|
||||
return GetShaderVariables<sh::Attribute>(handle, SHADERVAR_ATTRIBUTE);
|
||||
}
|
||||
|
||||
const std::vector<sh::Attribute> *ShGetOutputVariables(const ShHandle handle)
|
||||
{
|
||||
return GetShaderVariables<sh::Attribute>(handle, SHADERVAR_OUTPUTVARIABLE);
|
||||
}
|
||||
|
||||
const std::vector<sh::InterfaceBlock> *ShGetInterfaceBlocks(const ShHandle handle)
|
||||
{
|
||||
return GetShaderVariables<sh::InterfaceBlock>(handle, SHADERVAR_INTERFACEBLOCK);
|
||||
}
|
||||
|
||||
int ShCheckVariablesWithinPackingLimits(
|
||||
@ -468,7 +524,7 @@ int ShCheckVariablesWithinPackingLimits(
|
||||
std::vector<sh::ShaderVariable> variables;
|
||||
for (size_t ii = 0; ii < varInfoArraySize; ++ii)
|
||||
{
|
||||
sh::ShaderVariable var(varInfoArray[ii].type, (sh::GLenum)0, "", varInfoArray[ii].size);
|
||||
sh::ShaderVariable var(varInfoArray[ii].type, varInfoArray[ii].size);
|
||||
variables.push_back(var);
|
||||
}
|
||||
VariablePacker packer;
|
||||
|
166
src/3rdparty/angle/src/compiler/translator/ShaderVars.cpp
vendored
Normal file
166
src/3rdparty/angle/src/compiler/translator/ShaderVars.cpp
vendored
Normal file
@ -0,0 +1,166 @@
|
||||
//
|
||||
// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
//
|
||||
// ShaderVars.cpp:
|
||||
// Methods for GL variable types (varyings, uniforms, etc)
|
||||
//
|
||||
|
||||
#include <GLSLANG/ShaderLang.h>
|
||||
|
||||
namespace sh
|
||||
{
|
||||
|
||||
ShaderVariable::ShaderVariable()
|
||||
: type(0),
|
||||
precision(0),
|
||||
arraySize(0),
|
||||
staticUse(false)
|
||||
{}
|
||||
|
||||
ShaderVariable::ShaderVariable(GLenum typeIn, unsigned int arraySizeIn)
|
||||
: type(typeIn),
|
||||
precision(0),
|
||||
arraySize(arraySizeIn),
|
||||
staticUse(false)
|
||||
{}
|
||||
|
||||
ShaderVariable::~ShaderVariable()
|
||||
{}
|
||||
|
||||
ShaderVariable::ShaderVariable(const ShaderVariable &other)
|
||||
: type(other.type),
|
||||
precision(other.precision),
|
||||
name(other.name),
|
||||
mappedName(other.mappedName),
|
||||
arraySize(other.arraySize),
|
||||
staticUse(other.staticUse),
|
||||
fields(other.fields),
|
||||
structName(other.structName)
|
||||
{}
|
||||
|
||||
ShaderVariable &ShaderVariable::operator=(const ShaderVariable &other)
|
||||
{
|
||||
type = other.type;
|
||||
precision = other.precision;
|
||||
name = other.name;
|
||||
mappedName = other.mappedName;
|
||||
arraySize = other.arraySize;
|
||||
staticUse = other.staticUse;
|
||||
fields = other.fields;
|
||||
structName = other.structName;
|
||||
return *this;
|
||||
}
|
||||
|
||||
Uniform::Uniform()
|
||||
{}
|
||||
|
||||
Uniform::~Uniform()
|
||||
{}
|
||||
|
||||
Uniform::Uniform(const Uniform &other)
|
||||
: ShaderVariable(other)
|
||||
{}
|
||||
|
||||
Uniform &Uniform::operator=(const Uniform &other)
|
||||
{
|
||||
ShaderVariable::operator=(other);
|
||||
return *this;
|
||||
}
|
||||
|
||||
Attribute::Attribute()
|
||||
: location(-1)
|
||||
{}
|
||||
|
||||
Attribute::~Attribute()
|
||||
{}
|
||||
|
||||
Attribute::Attribute(const Attribute &other)
|
||||
: ShaderVariable(other),
|
||||
location(other.location)
|
||||
{}
|
||||
|
||||
Attribute &Attribute::operator=(const Attribute &other)
|
||||
{
|
||||
ShaderVariable::operator=(other);
|
||||
location = other.location;
|
||||
return *this;
|
||||
}
|
||||
|
||||
InterfaceBlockField::InterfaceBlockField()
|
||||
: isRowMajorLayout(false)
|
||||
{}
|
||||
|
||||
InterfaceBlockField::~InterfaceBlockField()
|
||||
{}
|
||||
|
||||
InterfaceBlockField::InterfaceBlockField(const InterfaceBlockField &other)
|
||||
: ShaderVariable(other),
|
||||
isRowMajorLayout(other.isRowMajorLayout)
|
||||
{}
|
||||
|
||||
InterfaceBlockField &InterfaceBlockField::operator=(const InterfaceBlockField &other)
|
||||
{
|
||||
ShaderVariable::operator=(other);
|
||||
isRowMajorLayout = other.isRowMajorLayout;
|
||||
return *this;
|
||||
}
|
||||
|
||||
Varying::Varying()
|
||||
: interpolation(INTERPOLATION_SMOOTH),
|
||||
isInvariant(false)
|
||||
{}
|
||||
|
||||
Varying::~Varying()
|
||||
{}
|
||||
|
||||
Varying::Varying(const Varying &other)
|
||||
: ShaderVariable(other),
|
||||
interpolation(other.interpolation),
|
||||
isInvariant(other.isInvariant)
|
||||
{}
|
||||
|
||||
Varying &Varying::operator=(const Varying &other)
|
||||
{
|
||||
ShaderVariable::operator=(other);
|
||||
interpolation = other.interpolation;
|
||||
isInvariant = other.isInvariant;
|
||||
return *this;
|
||||
}
|
||||
|
||||
InterfaceBlock::InterfaceBlock()
|
||||
: arraySize(0),
|
||||
layout(BLOCKLAYOUT_PACKED),
|
||||
isRowMajorLayout(false),
|
||||
staticUse(false)
|
||||
{}
|
||||
|
||||
InterfaceBlock::~InterfaceBlock()
|
||||
{}
|
||||
|
||||
InterfaceBlock::InterfaceBlock(const InterfaceBlock &other)
|
||||
: name(other.name),
|
||||
mappedName(other.mappedName),
|
||||
instanceName(other.instanceName),
|
||||
arraySize(other.arraySize),
|
||||
layout(other.layout),
|
||||
isRowMajorLayout(other.isRowMajorLayout),
|
||||
staticUse(other.staticUse),
|
||||
fields(other.fields)
|
||||
{}
|
||||
|
||||
InterfaceBlock &InterfaceBlock::operator=(const InterfaceBlock &other)
|
||||
{
|
||||
name = other.name;
|
||||
mappedName = other.mappedName;
|
||||
instanceName = other.instanceName;
|
||||
arraySize = other.arraySize;
|
||||
layout = other.layout;
|
||||
isRowMajorLayout = other.isRowMajorLayout;
|
||||
staticUse = other.staticUse;
|
||||
fields = other.fields;
|
||||
return *this;
|
||||
}
|
||||
|
||||
}
|
@ -17,12 +17,19 @@
|
||||
namespace sh
|
||||
{
|
||||
|
||||
Std140PaddingHelper::Std140PaddingHelper(const std::map<TString, int> &structElementIndexes)
|
||||
: mPaddingCounter(0),
|
||||
Std140PaddingHelper::Std140PaddingHelper(const std::map<TString, int> &structElementIndexes,
|
||||
unsigned *uniqueCounter)
|
||||
: mPaddingCounter(uniqueCounter),
|
||||
mElementIndex(0),
|
||||
mStructElementIndexes(structElementIndexes)
|
||||
{}
|
||||
|
||||
TString Std140PaddingHelper::next()
|
||||
{
|
||||
unsigned value = (*mPaddingCounter)++;
|
||||
return str(value);
|
||||
}
|
||||
|
||||
int Std140PaddingHelper::prePadding(const TType &type)
|
||||
{
|
||||
if (type.getBasicType() == EbtStruct || type.isMatrix() || type.isArray())
|
||||
@ -68,7 +75,7 @@ TString Std140PaddingHelper::prePaddingString(const TType &type)
|
||||
|
||||
for (int paddingIndex = 0; paddingIndex < paddingCount; paddingIndex++)
|
||||
{
|
||||
padding += " float pad_" + str(mPaddingCounter++) + ";\n";
|
||||
padding += " float pad_" + next() + ";\n";
|
||||
}
|
||||
|
||||
return padding;
|
||||
@ -116,19 +123,25 @@ TString Std140PaddingHelper::postPaddingString(const TType &type, bool useHLSLRo
|
||||
TString padding;
|
||||
for (int paddingOffset = numComponents; paddingOffset < 4; paddingOffset++)
|
||||
{
|
||||
padding += " float pad_" + str(mPaddingCounter++) + ";\n";
|
||||
padding += " float pad_" + next() + ";\n";
|
||||
}
|
||||
return padding;
|
||||
}
|
||||
|
||||
StructureHLSL::StructureHLSL()
|
||||
: mUniquePaddingCounter(0)
|
||||
{}
|
||||
|
||||
Std140PaddingHelper StructureHLSL::getPaddingHelper()
|
||||
{
|
||||
return Std140PaddingHelper(mStd140StructElementIndexes, &mUniquePaddingCounter);
|
||||
}
|
||||
|
||||
TString StructureHLSL::defineQualified(const TStructure &structure, bool useHLSLRowMajorPacking, bool useStd140Packing)
|
||||
{
|
||||
if (useStd140Packing)
|
||||
{
|
||||
Std140PaddingHelper padHelper(mStd140StructElementIndexes);
|
||||
Std140PaddingHelper padHelper = getPaddingHelper();
|
||||
return define(structure, useHLSLRowMajorPacking, useStd140Packing, &padHelper);
|
||||
}
|
||||
else
|
||||
@ -291,9 +304,9 @@ void StructureHLSL::addConstructor(const TType &type, const TString &name, const
|
||||
|
||||
if (parameter.isScalar())
|
||||
{
|
||||
for (int row = 0; row < rows; row++)
|
||||
for (int col = 0; col < cols; col++)
|
||||
{
|
||||
for (int col = 0; col < cols; col++)
|
||||
for (int row = 0; row < rows; row++)
|
||||
{
|
||||
constructor += TString((row == col) ? "x0" : "0.0");
|
||||
|
||||
@ -306,13 +319,13 @@ void StructureHLSL::addConstructor(const TType &type, const TString &name, const
|
||||
}
|
||||
else if (parameter.isMatrix())
|
||||
{
|
||||
for (int row = 0; row < rows; row++)
|
||||
for (int col = 0; col < cols; col++)
|
||||
{
|
||||
for (int col = 0; col < cols; col++)
|
||||
for (int row = 0; row < rows; row++)
|
||||
{
|
||||
if (row < parameter.getRows() && col < parameter.getCols())
|
||||
{
|
||||
constructor += TString("x0") + "[" + str(row) + "][" + str(col) + "]";
|
||||
constructor += TString("x0") + "[" + str(col) + "][" + str(row) + "]";
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -461,7 +474,7 @@ std::string StructureHLSL::structsHeader() const
|
||||
|
||||
void StructureHLSL::storeStd140ElementIndex(const TStructure &structure, bool useHLSLRowMajorPacking)
|
||||
{
|
||||
Std140PaddingHelper padHelper(mStd140StructElementIndexes);
|
||||
Std140PaddingHelper padHelper = getPaddingHelper();
|
||||
const TFieldList &fields = structure.fields();
|
||||
|
||||
for (unsigned int i = 0; i < fields.size(); i++)
|
||||
|
@ -11,7 +11,7 @@
|
||||
#define TRANSLATOR_STRUCTUREHLSL_H_
|
||||
|
||||
#include "compiler/translator/Common.h"
|
||||
#include "compiler/translator/intermediate.h"
|
||||
#include "compiler/translator/IntermNode.h"
|
||||
|
||||
#include <set>
|
||||
|
||||
@ -26,7 +26,8 @@ namespace sh
|
||||
class Std140PaddingHelper
|
||||
{
|
||||
public:
|
||||
explicit Std140PaddingHelper(const std::map<TString, int> &structElementIndexes);
|
||||
explicit Std140PaddingHelper(const std::map<TString, int> &structElementIndexes,
|
||||
unsigned *uniqueCounter);
|
||||
|
||||
int elementIndex() const { return mElementIndex; }
|
||||
int prePadding(const TType &type);
|
||||
@ -34,7 +35,9 @@ class Std140PaddingHelper
|
||||
TString postPaddingString(const TType &type, bool useHLSLRowMajorPacking);
|
||||
|
||||
private:
|
||||
int mPaddingCounter;
|
||||
TString next();
|
||||
|
||||
unsigned *mPaddingCounter;
|
||||
int mElementIndex;
|
||||
const std::map<TString, int> &mStructElementIndexes;
|
||||
};
|
||||
@ -50,9 +53,11 @@ class StructureHLSL
|
||||
TString defineQualified(const TStructure &structure, bool useHLSLRowMajorPacking, bool useStd140Packing);
|
||||
static TString defineNameless(const TStructure &structure);
|
||||
|
||||
Std140PaddingHelper getPaddingHelper() const { return Std140PaddingHelper(mStd140StructElementIndexes); }
|
||||
Std140PaddingHelper getPaddingHelper();
|
||||
|
||||
private:
|
||||
unsigned mUniquePaddingCounter;
|
||||
|
||||
std::map<TString, int> mStd140StructElementIndexes;
|
||||
|
||||
typedef std::set<TString> StructNames;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user