Source

Target

Showing with 268 additions and 206 deletions
...@@ -84,7 +84,7 @@ QMAKE_CXXFLAGS_PRECOMPILE = -c -pch-create ${QMAKE_PCH_OUTPUT} -include ${QMAKE_ ...@@ -84,7 +84,7 @@ QMAKE_CXXFLAGS_PRECOMPILE = -c -pch-create ${QMAKE_PCH_OUTPUT} -include ${QMAKE_
QMAKE_CFLAGS_HIDESYMS += -fvisibility=hidden QMAKE_CFLAGS_HIDESYMS += -fvisibility=hidden
QMAKE_CXXFLAGS_HIDESYMS += $$QMAKE_CFLAGS_HIDESYMS -fvisibility-inlines-hidden QMAKE_CXXFLAGS_HIDESYMS += $$QMAKE_CFLAGS_HIDESYMS -fvisibility-inlines-hidden
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.7 QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.9
include(../common/macx.conf) include(../common/macx.conf)
......
...@@ -24,6 +24,8 @@ ...@@ -24,6 +24,8 @@
<string>1.0</string> <string>1.0</string>
<key>LSRequiresIPhoneOS</key> <key>LSRequiresIPhoneOS</key>
<true/> <true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UISupportedInterfaceOrientations</key> <key>UISupportedInterfaceOrientations</key>
<array> <array>
<string>UIInterfaceOrientationPortrait</string> <string>UIInterfaceOrientationPortrait</string>
......
<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>
<document type=\"com.apple.InterfaceBuilder3.CocoaTouch.XIB\" version=\"3.0\" toolsVersion=\"6250\" systemVersion=\"14A343f\" targetRuntime=\"iOS.CocoaTouch\" propertyAccessControl=\"none\" useAutolayout=\"YES\" launchScreen=\"YES\" useTraitCollections=\"YES\">
<dependencies>
<plugIn identifier=\"com.apple.InterfaceBuilder.IBCocoaTouchPlugin\" version=\"6244\"/>
<capability name=\"Constraints with non-1.0 multipliers\" minToolsVersion=\"5.1\"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier=\"IBFilesOwner\" id=\"-1\" userLabel=\"File\'s Owner\"/>
<placeholder placeholderIdentifier=\"IBFirstResponder\" id=\"-2\" customClass=\"UIResponder\"/>
<view contentMode=\"scaleToFill\" id=\"iN0-l3-epB\">
<rect key=\"frame\" x=\"0.0\" y=\"0.0\" width=\"480\" height=\"480\"/>
<autoresizingMask key=\"autoresizingMask\" widthSizable=\"YES\" heightSizable=\"YES\"/>
<subviews>
<label opaque=\"NO\" clipsSubviews=\"YES\" userInteractionEnabled=\"NO\" contentMode=\"left\" horizontalHuggingPriority=\"251\" verticalHuggingPriority=\"251\" misplaced=\"YES\" text=\"\" textAlignment=\"center\" lineBreakMode=\"tailTruncation\" baselineAdjustment=\"alignBaselines\" minimumFontSize=\"9\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"8ie-xW-0ye\">
<rect key=\"frame\" x=\"20\" y=\"439\" width=\"441\" height=\"21\"/>
<fontDescription key=\"fontDescription\" type=\"system\" pointSize=\"17\"/>
<color key=\"textColor\" cocoaTouchSystemColor=\"darkTextColor\"/>
<nil key=\"highlightedColor\"/>
<variation key=\"widthClass=compact\">
<fontDescription key=\"fontDescription\" type=\"system\" pointSize=\"11\"/>
</variation>
</label>
<label opaque=\"NO\" clipsSubviews=\"YES\" userInteractionEnabled=\"NO\" contentMode=\"left\" horizontalHuggingPriority=\"251\" verticalHuggingPriority=\"251\" text=\"$$TARGET\"
textAlignment=\"center\" lineBreakMode=\"middleTruncation\" baselineAdjustment=\"alignBaselines\" minimumFontSize=\"18\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"kId-c2-rCX\">
<rect key=\"frame\" x=\"20\" y=\"140\" width=\"441\" height=\"43\"/>
<fontDescription key=\"fontDescription\" type=\"boldSystem\" pointSize=\"36\"/>
<color key=\"textColor\" cocoaTouchSystemColor=\"darkTextColor\"/>
<nil key=\"highlightedColor\"/>
</label>
</subviews>
<color key=\"backgroundColor\" white=\"1\" alpha=\"1\" colorSpace=\"custom\" customColorSpace=\"calibratedWhite\"/>
<constraints>
<constraint firstItem=\"kId-c2-rCX\" firstAttribute=\"centerY\" secondItem=\"iN0-l3-epB\" secondAttribute=\"bottom\" multiplier=\"1/3\" constant=\"1\" id=\"Kid-kn-2rF\"/>
<constraint firstAttribute=\"centerX\" secondItem=\"kId-c2-rCX\" secondAttribute=\"centerX\" id=\"Koa-jz-hwk\"/>
<constraint firstAttribute=\"bottom\" secondItem=\"8ie-xW-0ye\" secondAttribute=\"bottom\" constant=\"20\" id=\"Kzo-t9-V3l\"/>
<constraint firstItem=\"8ie-xW-0ye\" firstAttribute=\"leading\" secondItem=\"iN0-l3-epB\" secondAttribute=\"leading\" constant=\"20\" symbolic=\"YES\" id=\"MfP-vx-nX0\"/>
<constraint firstAttribute=\"centerX\" secondItem=\"8ie-xW-0ye\" secondAttribute=\"centerX\" id=\"ZEH-qu-HZ9\"/>
<constraint firstItem=\"kId-c2-rCX\" firstAttribute=\"leading\" secondItem=\"iN0-l3-epB\" secondAttribute=\"leading\" constant=\"20\" symbolic=\"YES\" id=\"fvb-Df-36g\"/>
</constraints>
<nil key=\"simulatedStatusBarMetrics\"/>
<freeformSimulatedSizeMetrics key=\"simulatedDestinationMetrics\"/>
<point key=\"canvasLocation\" x=\"404\" y=\"445\"/>
</view>
</objects>
</document>
...@@ -184,6 +184,18 @@ macx-xcode { ...@@ -184,6 +184,18 @@ macx-xcode {
QMAKE_SUBSTITUTES += copy_image QMAKE_SUBSTITUTES += copy_image
launch_images.files = $$copy_image.output launch_images.files = $$copy_image.output
QMAKE_BUNDLE_DATA += launch_images QMAKE_BUNDLE_DATA += launch_images
lessThan(QMAKE_XCODE_VERSION, "6.0") {
warning("You need to update Xcode to version 6 or newer to fully support iPhone6/6+")
} else {
# Set up default LaunchScreen to support iPhone6/6+
launch_screen = LaunchScreen.xib
copy_launch_screen.input = $$QMAKESPEC/$$launch_screen
copy_launch_screen.output = $$OUT_PWD/$${TARGET}.xcodeproj/$$launch_screen
QMAKE_SUBSTITUTES += copy_launch_screen
launch_screens.files = $$copy_launch_screen.output
QMAKE_BUNDLE_DATA += launch_screens
}
} }
macx-xcode { macx-xcode {
...@@ -193,22 +205,32 @@ macx-xcode { ...@@ -193,22 +205,32 @@ macx-xcode {
arch_iphonesimulator.value = $$QMAKE_IOS_SIMULATOR_ARCHS arch_iphonesimulator.value = $$QMAKE_IOS_SIMULATOR_ARCHS
QMAKE_MAC_XCODE_SETTINGS += arch_iphoneos arch_iphonesimulator QMAKE_MAC_XCODE_SETTINGS += arch_iphoneos arch_iphonesimulator
unset(QMAKE_XCODE_ARCHS) QMAKE_XCODE_ARCHS = $$QMAKE_IOS_DEVICE_ARCHS $$QMAKE_IOS_SIMULATOR_ARCHS
only_active_arch.name = ONLY_ACTIVE_ARCH
only_active_arch.value = YES
only_active_arch.build = debug
QMAKE_MAC_XCODE_SETTINGS += only_active_arch
} else { } else {
# Be more specific about which architecture we're targeting # Be more specific about which architecture we're targeting
contains(QT_ARCH, arm.*): \ contains(QT_ARCH, arm.*): \
actual_archs = $$QMAKE_IOS_DEVICE_ARCHS VALID_ARCHS = $$QMAKE_IOS_DEVICE_ARCHS
else: \ else: \
actual_archs = $$QMAKE_IOS_SIMULATOR_ARCHS VALID_ARCHS = $$QMAKE_IOS_SIMULATOR_ARCHS
single_arch: VALID_ARCHS = $$first(VALID_ARCHS)
ACTIVE_ARCHS = $(filter $(EXPORT_VALID_ARCHS), $(ARCHS))
ARCH_ARGS = $(foreach arch, $(if $(EXPORT_ACTIVE_ARCHS), $(EXPORT_ACTIVE_ARCHS), $(EXPORT_VALID_ARCHS)), -arch $(arch))
QMAKE_EXTRA_VARIABLES += VALID_ARCHS ACTIVE_ARCHS ARCH_ARGS
for(arch, actual_archs): \ arch_flags = $(EXPORT_ARCH_ARGS)
arch_flags += -arch $$arch
QMAKE_CFLAGS += $$arch_flags QMAKE_CFLAGS += $$arch_flags
QMAKE_CXXFLAGS += $$arch_flags QMAKE_CXXFLAGS += $$arch_flags
QMAKE_OBJECTIVE_CFLAGS += $$arch_flags QMAKE_OBJECTIVE_CFLAGS += $$arch_flags
QMAKE_LFLAGS += $$arch_flags QMAKE_LFLAGS += $$arch_flags
} }
unset(actual_archs)
load(default_post) load(default_post)
...@@ -32,17 +32,19 @@ equals(TEMPLATE, app):contains(QT, gui(-private)?) { ...@@ -32,17 +32,19 @@ equals(TEMPLATE, app):contains(QT, gui(-private)?) {
# called 'qt_main' now. # called 'qt_main' now.
macx-xcode { macx-xcode {
objects_dir = "${OBJECT_FILE_DIR}-${CURRENT_VARIANT}/${CURRENT_ARCH}" objects_dir = "${OBJECT_FILE_DIR}-${CURRENT_VARIANT}"
archs = "${ARCHS}"
} else { } else {
objects_dir = $$OBJECTS_DIR objects_dir = $$OBJECTS_DIR
isEmpty(objects_dir): \ isEmpty(objects_dir): \
objects_dir = . objects_dir = .
archs = "$$QMAKE_IOS_DEVICE_ARCHS $$QMAKE_IOS_SIMULATOR_ARCHS"
} }
!isEmpty(QMAKE_PRE_LINK): \ !isEmpty(QMAKE_PRE_LINK): \
QMAKE_PRE_LINK += ";" QMAKE_PRE_LINK += ";"
QMAKE_PRE_LINK += $$QMAKESPEC/rename_main.sh $${objects_dir} QMAKE_PRE_LINK += $$QMAKESPEC/rename_main.sh $${objects_dir} \"$${archs}\"
} }
} }
......
...@@ -9,4 +9,8 @@ isEmpty(QT_ARCH) { ...@@ -9,4 +9,8 @@ isEmpty(QT_ARCH) {
QT_ARCH = arm QT_ARCH = arm
else: \ # Simulator else: \ # Simulator
QT_ARCH = i386 QT_ARCH = i386
# Prevent the arch/config tests from building as multi-arch binaries,
# as we only want the lowest common denominator features.
CONFIG += single_arch
} }
...@@ -15,8 +15,8 @@ DEFINES += DARWIN_NO_CARBON QT_NO_PRINTER QT_NO_PRINTDIALOG ...@@ -15,8 +15,8 @@ DEFINES += DARWIN_NO_CARBON QT_NO_PRINTER QT_NO_PRINTDIALOG
# Universal target (iPhone and iPad) # Universal target (iPhone and iPad)
QMAKE_IOS_TARGETED_DEVICE_FAMILY = 1,2 QMAKE_IOS_TARGETED_DEVICE_FAMILY = 1,2
QMAKE_IOS_DEVICE_ARCHS = armv7 QMAKE_IOS_DEVICE_ARCHS = armv7 arm64
QMAKE_IOS_SIMULATOR_ARCHS = i386 QMAKE_IOS_SIMULATOR_ARCHS = i386 x86_64
include(../common/ios.conf) include(../common/ios.conf)
include(../common/gcc-base-mac.conf) include(../common/gcc-base-mac.conf)
......
...@@ -41,10 +41,14 @@ ...@@ -41,10 +41,14 @@
## ##
############################################################################# #############################################################################
if [ $# -eq 0 ]; then if [ $# -ne 2 ]; then
echo "usage: $0 <path to object files>" echo "$0: wrong number of arguments for internal tool used by iOS mkspec"
else else
for f in $(find $1 -name '*.o'); do arch_paths=""
for a in $2; do
arch_paths="$arch_paths $1/$a"
done
for f in $(find $arch_paths -name '*.o'); do
# Skip object files without the _main symbol # Skip object files without the _main symbol
nm $f 2>/dev/null | grep -q 'T _main$' || continue nm $f 2>/dev/null | grep -q 'T _main$' || continue
......
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
<string>@TYPEINFO@</string> <string>@TYPEINFO@</string>
<key>CFBundleExecutable</key> <key>CFBundleExecutable</key>
<string>@LIBRARY@</string> <string>@LIBRARY@</string>
<key>CFBundleIdentifier</key>
<string>@BUNDLEIDENTIFIER@</string>
<key>NOTE</key> <key>NOTE</key>
<string>Please, do NOT change this file -- It was generated by Qt/QMake.</string> <string>Please, do NOT change this file -- It was generated by Qt/QMake.</string>
</dict> </dict>
......
...@@ -13,6 +13,7 @@ QMAKE_CXXFLAGS_THREAD = $$QMAKE_CFLAGS_THREAD ...@@ -13,6 +13,7 @@ QMAKE_CXXFLAGS_THREAD = $$QMAKE_CFLAGS_THREAD
QMAKE_INCDIR = /usr/local/include QMAKE_INCDIR = /usr/local/include
QMAKE_LIBDIR = /usr/local/lib QMAKE_LIBDIR = /usr/local/lib
QMAKE_LFLAGS_NOUNDEF = -Wl,--no-undefined
QMAKE_LFLAGS_THREAD = -pthread QMAKE_LFLAGS_THREAD = -pthread
QMAKE_LIBS = QMAKE_LIBS =
...@@ -28,6 +29,5 @@ QMAKE_RANLIB = ...@@ -28,6 +29,5 @@ QMAKE_RANLIB =
include(../../common/unix.conf) include(../../common/unix.conf)
include(../../common/gcc-base-unix.conf) include(../../common/gcc-base-unix.conf)
include(../../common/g++-unix.conf)
include(../../common/clang.conf) include(../../common/clang.conf)
load(qt_config) load(qt_config)
...@@ -1029,6 +1029,21 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) ...@@ -1029,6 +1029,21 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
if (!project->isEmpty("QMAKE_PRE_LINK")) { if (!project->isEmpty("QMAKE_PRE_LINK")) {
QString phase_key = keyFor("QMAKE_PBX_PRELINK_BUILDPHASE"); QString phase_key = keyFor("QMAKE_PBX_PRELINK_BUILDPHASE");
project->values("QMAKE_PBX_BUILDPHASES").append(phase_key); project->values("QMAKE_PBX_BUILDPHASES").append(phase_key);
ProStringList inputPaths;
ProStringList outputPaths;
const ProStringList &archs = project->values("QMAKE_XCODE_ARCHS");
if (!archs.isEmpty()) {
for (int i = 0; i < archs.size(); ++i) {
const ProString &arch = archs.at(i);
inputPaths << "$(OBJECT_FILE_DIR_$(CURRENT_VARIANT))/" + arch + "/";
outputPaths << "$(LINK_FILE_LIST_$(CURRENT_VARIANT)_" + arch + ")";
}
} else {
inputPaths << "$(OBJECT_FILE_DIR_$(CURRENT_VARIANT))/$(CURRENT_ARCH)/";
outputPaths << "$(LINK_FILE_LIST_$(CURRENT_VARIANT)_$(CURRENT_ARCH))";
}
t << "\t\t" << phase_key << " = {\n" t << "\t\t" << phase_key << " = {\n"
<< "\t\t\t" << writeSettings("buildActionMask", "2147483647", SettingsNoQuote) << ";\n" << "\t\t\t" << writeSettings("buildActionMask", "2147483647", SettingsNoQuote) << ";\n"
<< "\t\t\t" << writeSettings("files", ProStringList(), SettingsAsList, 4) << ";\n" << "\t\t\t" << writeSettings("files", ProStringList(), SettingsAsList, 4) << ";\n"
...@@ -1036,8 +1051,8 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) ...@@ -1036,8 +1051,8 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
// resolved dependenices, so we have to ensure that this phase is run after the // resolved dependenices, so we have to ensure that this phase is run after the
// compilation phase, and before the link phase. Making the phase depend on the // compilation phase, and before the link phase. Making the phase depend on the
// object file directory, and "write" to the list of files to link achieves that. // object file directory, and "write" to the list of files to link achieves that.
<< "\t\t\t" << writeSettings("inputPaths", ProStringList("$(OBJECT_FILE_DIR_$(CURRENT_VARIANT))/$(CURRENT_ARCH)/"), SettingsAsList, 4) << ";\n" << "\t\t\t" << writeSettings("inputPaths", inputPaths, SettingsAsList, 4) << ";\n"
<< "\t\t\t" << writeSettings("outputPaths", ProStringList("$(LINK_FILE_LIST_$(CURRENT_VARIANT)_$(CURRENT_ARCH))"), SettingsAsList, 4) << ";\n" << "\t\t\t" << writeSettings("outputPaths", outputPaths, SettingsAsList, 4) << ";\n"
<< "\t\t\t" << writeSettings("isa", "PBXShellScriptBuildPhase", SettingsNoQuote) << ";\n" << "\t\t\t" << writeSettings("isa", "PBXShellScriptBuildPhase", SettingsNoQuote) << ";\n"
<< "\t\t\t" << writeSettings("runOnlyForDeploymentPostprocessing", "0", SettingsNoQuote) << ";\n" << "\t\t\t" << writeSettings("runOnlyForDeploymentPostprocessing", "0", SettingsNoQuote) << ";\n"
<< "\t\t\t" << writeSettings("name", "Qt Prelink") << ";\n" << "\t\t\t" << writeSettings("name", "Qt Prelink") << ";\n"
......
...@@ -814,22 +814,26 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) ...@@ -814,22 +814,26 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
} }
commonSedArgs << "-e \"s,@TYPEINFO@,"<< (project->isEmpty("QMAKE_PKGINFO_TYPEINFO") ? commonSedArgs << "-e \"s,@TYPEINFO@,"<< (project->isEmpty("QMAKE_PKGINFO_TYPEINFO") ?
QString::fromLatin1("????") : project->first("QMAKE_PKGINFO_TYPEINFO").left(4)) << ",g\" "; QString::fromLatin1("????") : project->first("QMAKE_PKGINFO_TYPEINFO").left(4)) << ",g\" ";
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);
if (bundleIdentifier.endsWith(".framework"))
bundleIdentifier.chop(10);
commonSedArgs << "-e \"s,@BUNDLEIDENTIFIER@," << bundleIdentifier << ",g\" ";
if (isApp) { if (isApp) {
QString icon = fileFixify(var("ICON")); 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" t << "@$(DEL_FILE) " << info_plist_out << "\n\t"
<< "@sed "; << "@sed ";
foreach (const ProString &arg, commonSedArgs) foreach (const ProString &arg, commonSedArgs)
t << arg; t << arg;
t << "-e \"s,@ICON@," << icon.section(Option::dir_sep, -1) << ",g\" " 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,@EXECUTABLE@," << var("QMAKE_ORIG_TARGET") << ",g\" "
<< "-e \"s,@TYPEINFO@,"<< (project->isEmpty("QMAKE_PKGINFO_TYPEINFO") ? << "-e \"s,@TYPEINFO@,"<< (project->isEmpty("QMAKE_PKGINFO_TYPEINFO") ?
QString::fromLatin1("????") : project->first("QMAKE_PKGINFO_TYPEINFO").left(4)) << ",g\" " QString::fromLatin1("????") : project->first("QMAKE_PKGINFO_TYPEINFO").left(4)) << ",g\" "
......
...@@ -1915,10 +1915,10 @@ bool VCXProjectWriter::outputFileConfig(OutputFilterData *d, XmlOutput &xml, Xml ...@@ -1915,10 +1915,10 @@ bool VCXProjectWriter::outputFileConfig(OutputFilterData *d, XmlOutput &xml, Xml
} }
// Actual XML output ---------------------------------- // Actual XML output ----------------------------------
if (hasCustomBuildStep || filter.useCompilerTool if (hasCustomBuildStep || filter.useCustomBuildTool || filter.useCompilerTool
|| !d->inBuild || filter.Name.startsWith("Deployment Files")) { || !d->inBuild || filter.Name.startsWith("Deployment Files")) {
if (hasCustomBuildStep) if (hasCustomBuildStep || filter.useCustomBuildTool)
{ {
if (!fileAdded) { if (!fileAdded) {
fileAdded = true; fileAdded = true;
......
...@@ -21,10 +21,12 @@ Mozilla Corporation ...@@ -21,10 +21,12 @@ Mozilla Corporation
Turbulenz Turbulenz
Klarälvdalens Datakonsult AB Klarälvdalens Datakonsult AB
Microsoft Open Technologies, Inc. Microsoft Open Technologies, Inc.
NVIDIA Corporation
Jacek Caban Jacek Caban
Mark Callow Mark Callow
Ginn Chen Ginn Chen
Tibor den Ouden
James Hauxwell James Hauxwell
Sam Hocevar Sam Hocevar
Pierre Leveille Pierre Leveille
......
...@@ -78,7 +78,12 @@ Turbulenz ...@@ -78,7 +78,12 @@ Turbulenz
Ulrik Persson (ddefrostt) Ulrik Persson (ddefrostt)
Mark Banner (standard8mbp) Mark Banner (standard8mbp)
David Kilzer David Kilzer
Jacek Caban
Tibor den Ouden
Microsoft Open Technologies, Inc. Microsoft Open Technologies, Inc.
Cooper Partin Cooper Partin
Austin Kinross Austin Kinross
NVIDIA Corporation
Olli Etuaho
...@@ -238,7 +238,7 @@ EGLAPI EGLContext EGLAPIENTRY eglGetCurrentContext (void); ...@@ -238,7 +238,7 @@ EGLAPI EGLContext EGLAPIENTRY eglGetCurrentContext (void);
#ifndef EGL_VERSION_1_5 #ifndef EGL_VERSION_1_5
#define EGL_VERSION_1_5 1 #define EGL_VERSION_1_5 1
typedef void *EGLSync; typedef void *EGLSync;
typedef khronos_intptr_t EGLAttrib; typedef intptr_t EGLAttrib;
typedef khronos_utime_nanoseconds_t EGLTime; typedef khronos_utime_nanoseconds_t EGLTime;
#define EGL_CONTEXT_MAJOR_VERSION 0x3098 #define EGL_CONTEXT_MAJOR_VERSION 0x3098
#define EGL_CONTEXT_MINOR_VERSION 0x30FB #define EGL_CONTEXT_MINOR_VERSION 0x30FB
......
...@@ -59,7 +59,7 @@ extern "C" { ...@@ -59,7 +59,7 @@ extern "C" {
#ifndef EGL_KHR_cl_event2 #ifndef EGL_KHR_cl_event2
#define EGL_KHR_cl_event2 1 #define EGL_KHR_cl_event2 1
typedef void *EGLSyncKHR; typedef void *EGLSyncKHR;
typedef khronos_intptr_t EGLAttribKHR; typedef intptr_t EGLAttribKHR;
typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESYNC64KHRPROC) (EGLDisplay dpy, EGLenum type, const EGLAttribKHR *attrib_list); typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESYNC64KHRPROC) (EGLDisplay dpy, EGLenum type, const EGLAttribKHR *attrib_list);
#ifdef EGL_EGLEXT_PROTOTYPES #ifdef EGL_EGLEXT_PROTOTYPES
EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSync64KHR (EGLDisplay dpy, EGLenum type, const EGLAttribKHR *attrib_list); EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSync64KHR (EGLDisplay dpy, EGLenum type, const EGLAttribKHR *attrib_list);
...@@ -442,20 +442,22 @@ EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurfacePointerANGLE (EGLDisplay dpy, EGLSu ...@@ -442,20 +442,22 @@ EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurfacePointerANGLE (EGLDisplay dpy, EGLSu
#define EGL_ANGLE_platform_angle 1 #define EGL_ANGLE_platform_angle 1
#define EGL_PLATFORM_ANGLE_ANGLE 0x3201 #define EGL_PLATFORM_ANGLE_ANGLE 0x3201
#define EGL_PLATFORM_ANGLE_TYPE_ANGLE 0x3202 #define EGL_PLATFORM_ANGLE_TYPE_ANGLE 0x3202
#define EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE 0x3203 #define EGL_PLATFORM_ANGLE_MAX_VERSION_MAJOR_ANGLE 0x3203
#define EGL_PLATFORM_ANGLE_MAX_VERSION_MINOR_ANGLE 0x3204
#define EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE 0x3205
#endif /* EGL_ANGLE_platform_angle */ #endif /* EGL_ANGLE_platform_angle */
#ifndef EGL_ANGLE_platform_angle_d3d #ifndef EGL_ANGLE_platform_angle_d3d
#define EGL_ANGLE_platform_angle_d3d 1 #define EGL_ANGLE_platform_angle_d3d 1
#define EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE 0x3204 #define EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE 0x3206
#define EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE 0x3205 #define EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE 0x3207
#define EGL_PLATFORM_ANGLE_TYPE_D3D11_WARP_ANGLE 0x3206 #define EGL_PLATFORM_ANGLE_USE_WARP_ANGLE 0x3208
#endif /* EGL_ANGLE_platform_angle_d3d */ #endif /* EGL_ANGLE_platform_angle_d3d */
#ifndef EGL_ANGLE_platform_angle_opengl #ifndef EGL_ANGLE_platform_angle_opengl
#define EGL_ANGLE_platform_angle_opengl 1 #define EGL_ANGLE_platform_angle_opengl 1
#define EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE 0x3207 #define EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE 0x3209
#define EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE 0x3208 #define EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE 0x320A
#endif /* EGL_ANGLE_platform_angle_opengl */ #endif /* EGL_ANGLE_platform_angle_opengl */
#ifndef EGL_ARM_pixmap_multisample_discard #ifndef EGL_ARM_pixmap_multisample_discard
......
...@@ -67,23 +67,22 @@ ...@@ -67,23 +67,22 @@
* implementations. * implementations.
*/ */
#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY==WINAPI_FAMILY_PC_APP || WINAPI_FAMILY==WINAPI_FAMILY_PHONE_APP) /* Windows Runtime */ #if defined(_WIN32) || defined(__VC32__) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) /* Win32 and WinCE */
struct IUnknown;
typedef IUnknown *EGLNativeDisplayType;
typedef void *EGLNativePixmapType;
typedef IUnknown *EGLNativeWindowType;
#elif defined(_WIN32) || defined(__VC32__) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) /* Win32 and WinCE */
#ifndef WIN32_LEAN_AND_MEAN #ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN 1 #define WIN32_LEAN_AND_MEAN 1
#endif #endif
#include <windows.h> #include <windows.h>
typedef HDC EGLNativeDisplayType;
typedef HBITMAP EGLNativePixmapType; typedef HBITMAP EGLNativePixmapType;
#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_PC_APP || WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) /* Windows Store */
#include <inspectable.h>
typedef IInspectable* EGLNativeDisplayType;
typedef IInspectable* EGLNativeWindowType;
#else
typedef HDC EGLNativeDisplayType;
typedef HWND EGLNativeWindowType; typedef HWND EGLNativeWindowType;
#endif
#elif defined(__WINSCW__) || defined(__SYMBIAN32__) /* Symbian */ #elif defined(__WINSCW__) || defined(__SYMBIAN32__) /* Symbian */
......
...@@ -27,6 +27,10 @@ ...@@ -27,6 +27,10 @@
#include "KHR/khrplatform.h" #include "KHR/khrplatform.h"
#include <map>
#include <string>
#include <vector>
// //
// This is the platform independent interface between an OGL driver // This is the platform independent interface between an OGL driver
// and the shading language compiler. // and the shading language compiler.
...@@ -42,18 +46,17 @@ typedef unsigned int GLenum; ...@@ -42,18 +46,17 @@ typedef unsigned int GLenum;
// Note: make sure to increment ANGLE_SH_VERSION when changing ShaderVars.h // Note: make sure to increment ANGLE_SH_VERSION when changing ShaderVars.h
#include "ShaderVars.h" #include "ShaderVars.h"
#ifdef __cplusplus
extern "C" {
#endif
// Version number for shader translation API. // Version number for shader translation API.
// It is incremented every time the API changes. // It is incremented every time the API changes.
#define ANGLE_SH_VERSION 130 #define ANGLE_SH_VERSION 132
typedef enum { typedef enum {
SH_GLES2_SPEC = 0x8B40, SH_GLES2_SPEC = 0x8B40,
SH_WEBGL_SPEC = 0x8B41, SH_WEBGL_SPEC = 0x8B41,
SH_GLES3_SPEC = 0x8B86,
SH_WEBGL2_SPEC = 0x8B87,
// The CSS Shaders spec is a subset of the WebGL spec. // The CSS Shaders spec is a subset of the WebGL spec.
// //
// In both CSS vertex and fragment shaders, ANGLE: // In both CSS vertex and fragment shaders, ANGLE:
...@@ -85,31 +88,6 @@ typedef enum { ...@@ -85,31 +88,6 @@ typedef enum {
SH_HLSL11_OUTPUT = 0x8B48 SH_HLSL11_OUTPUT = 0x8B48
} ShShaderOutput; } ShShaderOutput;
typedef enum {
SH_PRECISION_HIGHP = 0x5001,
SH_PRECISION_MEDIUMP = 0x5002,
SH_PRECISION_LOWP = 0x5003,
SH_PRECISION_UNDEFINED = 0
} ShPrecisionType;
typedef enum {
SH_INFO_LOG_LENGTH = 0x8B84,
SH_OBJECT_CODE_LENGTH = 0x8B88, // GL_SHADER_SOURCE_LENGTH
SH_ACTIVE_UNIFORMS = 0x8B86,
SH_ACTIVE_UNIFORM_MAX_LENGTH = 0x8B87,
SH_ACTIVE_ATTRIBUTES = 0x8B89,
SH_ACTIVE_ATTRIBUTE_MAX_LENGTH = 0x8B8A,
SH_VARYINGS = 0x8BBB,
SH_VARYING_MAX_LENGTH = 0x8BBC,
SH_MAPPED_NAME_MAX_LENGTH = 0x6000,
SH_NAME_MAX_LENGTH = 0x6001,
SH_HASHED_NAME_MAX_LENGTH = 0x6002,
SH_HASHED_NAMES_COUNT = 0x6003,
SH_SHADER_VERSION = 0x6004,
SH_RESOURCES_STRING_LENGTH = 0x6005,
SH_OUTPUT_TYPE = 0x6006
} ShShaderInfo;
// Compile options. // Compile options.
typedef enum { typedef enum {
SH_VALIDATE = 0, SH_VALIDATE = 0,
...@@ -208,14 +186,14 @@ typedef enum { ...@@ -208,14 +186,14 @@ typedef enum {
// //
// Driver must call this first, once, before doing any other // Driver must call this first, once, before doing any other
// compiler operations. // compiler operations.
// If the function succeeds, the return value is nonzero, else zero. // If the function succeeds, the return value is true, else false.
// //
COMPILER_EXPORT int ShInitialize(); COMPILER_EXPORT bool ShInitialize();
// //
// Driver should call this at shutdown. // Driver should call this at shutdown.
// If the function succeeds, the return value is nonzero, else zero. // If the function succeeds, the return value is true, else false.
// //
COMPILER_EXPORT int ShFinalize(); COMPILER_EXPORT bool ShFinalize();
// The 64 bits hash function. The first parameter is the input string; the // The 64 bits hash function. The first parameter is the input string; the
// second parameter is the string length. // second parameter is the string length.
...@@ -246,6 +224,12 @@ typedef struct ...@@ -246,6 +224,12 @@ typedef struct
int EXT_frag_depth; int EXT_frag_depth;
int EXT_shader_texture_lod; int EXT_shader_texture_lod;
// Set to 1 to enable replacing GL_EXT_draw_buffers #extension directives
// with GL_NV_draw_buffers in ESSL output. This flag can be used to emulate
// EXT_draw_buffers by using it in combination with GLES3.0 glDrawBuffers
// function. This applies to Tegra K1 devices.
int NV_draw_buffers;
// Set to 1 if highp precision is supported in the fragment language. // Set to 1 if highp precision is supported in the fragment language.
// Default is 0. // Default is 0.
int FragmentPrecisionHigh; int FragmentPrecisionHigh;
...@@ -274,8 +258,10 @@ typedef struct ...@@ -274,8 +258,10 @@ typedef struct
// //
// Initialize built-in resources with minimum expected values. // Initialize built-in resources with minimum expected values.
// Parameters:
// resources: The object to initialize. Will be comparable with memcmp.
// //
COMPILER_EXPORT void ShInitBuiltInResources(ShBuiltInResources* resources); COMPILER_EXPORT void ShInitBuiltInResources(ShBuiltInResources *resources);
// //
// ShHandle held by but opaque to the driver. It is allocated, // ShHandle held by but opaque to the driver. It is allocated,
...@@ -284,18 +270,15 @@ COMPILER_EXPORT void ShInitBuiltInResources(ShBuiltInResources* resources); ...@@ -284,18 +270,15 @@ COMPILER_EXPORT void ShInitBuiltInResources(ShBuiltInResources* resources);
// //
// If handle creation fails, 0 will be returned. // If handle creation fails, 0 will be returned.
// //
typedef void* ShHandle; typedef void *ShHandle;
// //
// Returns the a concatenated list of the items in ShBuiltInResources as a string. // Returns the a concatenated list of the items in ShBuiltInResources as a
// null-terminated string.
// This function must be updated whenever ShBuiltInResources is changed. // This function must be updated whenever ShBuiltInResources is changed.
// Parameters: // Parameters:
// handle: Specifies the handle of the compiler to be used. // handle: Specifies the handle of the compiler to be used.
// outStringLen: Specifies the size of the buffer, in number of characters. The size COMPILER_EXPORT const std::string &ShGetBuiltInResourcesString(const ShHandle handle);
// of the buffer required to store the resources string can be obtained
// by calling ShGetInfo with SH_RESOURCES_STRING_LENGTH.
// outStr: Returns a null-terminated string representing all the built-in resources.
COMPILER_EXPORT void ShGetBuiltInResourcesString(const ShHandle handle, size_t outStringLen, char *outStr);
// //
// Driver calls these to create and destroy compiler objects. // Driver calls these to create and destroy compiler objects.
...@@ -313,12 +296,12 @@ COMPILER_EXPORT ShHandle ShConstructCompiler( ...@@ -313,12 +296,12 @@ COMPILER_EXPORT ShHandle ShConstructCompiler(
sh::GLenum type, sh::GLenum type,
ShShaderSpec spec, ShShaderSpec spec,
ShShaderOutput output, ShShaderOutput output,
const ShBuiltInResources* resources); const ShBuiltInResources *resources);
COMPILER_EXPORT void ShDestruct(ShHandle handle); COMPILER_EXPORT void ShDestruct(ShHandle handle);
// //
// Compiles the given shader source. // Compiles the given shader source.
// If the function succeeds, the return value is nonzero, else zero. // If the function succeeds, the return value is true, else false.
// Parameters: // Parameters:
// handle: Specifies the handle of compiler to be used. // handle: Specifies the handle of compiler to be used.
// shaderStrings: Specifies an array of pointers to null-terminated strings // shaderStrings: Specifies an array of pointers to null-terminated strings
...@@ -340,123 +323,36 @@ COMPILER_EXPORT void ShDestruct(ShHandle handle); ...@@ -340,123 +323,36 @@ COMPILER_EXPORT void ShDestruct(ShHandle handle);
// SH_VARIABLES: Extracts attributes, uniforms, and varyings. // SH_VARIABLES: Extracts attributes, uniforms, and varyings.
// Can be queried by calling ShGetVariableInfo(). // Can be queried by calling ShGetVariableInfo().
// //
COMPILER_EXPORT int ShCompile( COMPILER_EXPORT bool ShCompile(
const ShHandle handle, const ShHandle handle,
const char* const shaderStrings[], const char * const shaderStrings[],
size_t numStrings, size_t numStrings,
int compileOptions int compileOptions);
);
// Returns a parameter from a compiled shader. // Return the version of the shader language.
// Parameters: COMPILER_EXPORT int ShGetShaderVersion(const ShHandle handle);
// handle: Specifies the compiler
// pname: Specifies the parameter to query.
// The following parameters are defined:
// SH_INFO_LOG_LENGTH: the number of characters in the information log
// including the null termination character.
// SH_OBJECT_CODE_LENGTH: the number of characters in the object code
// including the null termination character.
// SH_ACTIVE_ATTRIBUTES: the number of active attribute variables.
// SH_ACTIVE_ATTRIBUTE_MAX_LENGTH: the length of the longest active attribute
// variable name including the null
// termination character.
// SH_ACTIVE_UNIFORMS: the number of active uniform variables.
// SH_ACTIVE_UNIFORM_MAX_LENGTH: the length of the longest active uniform
// variable name including the null
// termination character.
// SH_VARYINGS: the number of varying variables.
// SH_VARYING_MAX_LENGTH: the length of the longest varying variable name
// including the null termination character.
// SH_MAPPED_NAME_MAX_LENGTH: the length of the mapped variable name including
// the null termination character.
// SH_NAME_MAX_LENGTH: the max length of a user-defined name including the
// null termination character.
// SH_HASHED_NAME_MAX_LENGTH: the max length of a hashed name including the
// null termination character.
// SH_HASHED_NAMES_COUNT: the number of hashed names from the latest compile.
// SH_SHADER_VERSION: the version of the shader language
// SH_OUTPUT_TYPE: the currently set language output type
//
// params: Requested parameter
COMPILER_EXPORT void ShGetInfo(const ShHandle handle,
ShShaderInfo pname,
size_t* params);
// Returns nul-terminated information log for a compiled shader. // Return the currently set language output type.
COMPILER_EXPORT ShShaderOutput ShGetShaderOutputType(
const ShHandle handle);
// Returns null-terminated information log for a compiled shader.
// Parameters: // Parameters:
// handle: Specifies the compiler // handle: Specifies the compiler
// infoLog: Specifies an array of characters that is used to return COMPILER_EXPORT const std::string &ShGetInfoLog(const ShHandle handle);
// the information log. It is assumed that infoLog has enough memory
// to accomodate the information log. The size of the buffer required
// to store the returned information log can be obtained by calling
// ShGetInfo with SH_INFO_LOG_LENGTH.
COMPILER_EXPORT void ShGetInfoLog(const ShHandle handle, char* infoLog);
// Returns null-terminated object code for a compiled shader. // Returns null-terminated object code for a compiled shader.
// Parameters: // Parameters:
// handle: Specifies the compiler // handle: Specifies the compiler
// infoLog: Specifies an array of characters that is used to return COMPILER_EXPORT const std::string &ShGetObjectCode(const ShHandle handle);
// the object code. It is assumed that infoLog has enough memory to
// accomodate the object code. The size of the buffer required to // Returns a (original_name, hash) map containing all the user defined
// store the returned object code can be obtained by calling // names in the shader, including variable names, function names, struct
// ShGetInfo with SH_OBJECT_CODE_LENGTH. // names, and struct field names.
COMPILER_EXPORT void ShGetObjectCode(const ShHandle handle, char* objCode);
// Returns information about a shader variable.
// Parameters:
// handle: Specifies the compiler
// variableType: Specifies the variable type; options include
// SH_ACTIVE_ATTRIBUTES, SH_ACTIVE_UNIFORMS, SH_VARYINGS.
// index: Specifies the index of the variable to be queried.
// length: Returns the number of characters actually written in the string
// indicated by name (excluding the null terminator) if a value other
// than NULL is passed.
// size: Returns the size of the variable.
// type: Returns the data type of the variable.
// precision: Returns the precision of the variable.
// staticUse: Returns 1 if the variable is accessed in a statement after
// pre-processing, whether or not run-time flow of control will
// cause that statement to be executed.
// Returns 0 otherwise.
// name: Returns a null terminated string containing the name of the
// variable. It is assumed that name has enough memory to accormodate
// the variable name. The size of the buffer required to store the
// variable name can be obtained by calling ShGetInfo with
// SH_ACTIVE_ATTRIBUTE_MAX_LENGTH, SH_ACTIVE_UNIFORM_MAX_LENGTH,
// SH_VARYING_MAX_LENGTH.
// mappedName: Returns a null terminated string containing the mapped name of
// the variable, It is assumed that mappedName has enough memory
// (SH_MAPPED_NAME_MAX_LENGTH), or NULL if don't care about the
// mapped name. If the name is not mapped, then name and mappedName
// are the same.
COMPILER_EXPORT void ShGetVariableInfo(const ShHandle handle,
ShShaderInfo variableType,
int index,
size_t* length,
int* size,
sh::GLenum* type,
ShPrecisionType* precision,
int* staticUse,
char* name,
char* mappedName);
// Returns information about a name hashing entry from the latest compile.
// Parameters: // Parameters:
// handle: Specifies the compiler // handle: Specifies the compiler
// index: Specifies the index of the name hashing entry to be queried. COMPILER_EXPORT const std::map<std::string, std::string> *ShGetNameHashingMap(
// name: Returns a null terminated string containing the user defined name. const ShHandle handle);
// It is assumed that name has enough memory to accomodate the name.
// The size of the buffer required to store the user defined name can
// be obtained by calling ShGetInfo with SH_NAME_MAX_LENGTH.
// hashedName: Returns a null terminated string containing the hashed name of
// the uniform variable, It is assumed that hashedName has enough
// memory to accomodate the name. The size of the buffer required
// to store the name can be obtained by calling ShGetInfo with
// SH_HASHED_NAME_MAX_LENGTH.
COMPILER_EXPORT void ShGetNameHashingEntry(const ShHandle handle,
int index,
char* name,
char* hashedName);
// Shader variable inspection. // Shader variable inspection.
// Returns a pointer to a list of variables of the designated type. // Returns a pointer to a list of variables of the designated type.
...@@ -476,17 +372,17 @@ typedef struct ...@@ -476,17 +372,17 @@ typedef struct
int size; int size;
} ShVariableInfo; } ShVariableInfo;
// Returns 1 if the passed in variables pack in maxVectors following // Returns true if the passed in variables pack in maxVectors following
// the packing rules from the GLSL 1.017 spec, Appendix A, section 7. // the packing rules from the GLSL 1.017 spec, Appendix A, section 7.
// Returns 0 otherwise. Also look at the SH_ENFORCE_PACKING_RESTRICTIONS // Returns false otherwise. Also look at the SH_ENFORCE_PACKING_RESTRICTIONS
// flag above. // flag above.
// Parameters: // Parameters:
// maxVectors: the available rows of registers. // maxVectors: the available rows of registers.
// varInfoArray: an array of variable info (types and sizes). // varInfoArray: an array of variable info (types and sizes).
// varInfoArraySize: the size of the variable array. // varInfoArraySize: the size of the variable array.
COMPILER_EXPORT int ShCheckVariablesWithinPackingLimits( COMPILER_EXPORT bool ShCheckVariablesWithinPackingLimits(
int maxVectors, int maxVectors,
ShVariableInfo* varInfoArray, ShVariableInfo *varInfoArray,
size_t varInfoArraySize); size_t varInfoArraySize);
// Gives the compiler-assigned register for an interface block. // Gives the compiler-assigned register for an interface block.
...@@ -497,7 +393,7 @@ COMPILER_EXPORT int ShCheckVariablesWithinPackingLimits( ...@@ -497,7 +393,7 @@ COMPILER_EXPORT int ShCheckVariablesWithinPackingLimits(
// interfaceBlockName: Specifies the interface block // interfaceBlockName: Specifies the interface block
// indexOut: output variable that stores the assigned register // indexOut: output variable that stores the assigned register
COMPILER_EXPORT bool ShGetInterfaceBlockRegister(const ShHandle handle, COMPILER_EXPORT bool ShGetInterfaceBlockRegister(const ShHandle handle,
const char *interfaceBlockName, const std::string &interfaceBlockName,
unsigned int *indexOut); unsigned int *indexOut);
// Gives the compiler-assigned register for uniforms in the default // Gives the compiler-assigned register for uniforms in the default
...@@ -509,11 +405,7 @@ COMPILER_EXPORT bool ShGetInterfaceBlockRegister(const ShHandle handle, ...@@ -509,11 +405,7 @@ COMPILER_EXPORT bool ShGetInterfaceBlockRegister(const ShHandle handle,
// interfaceBlockName: Specifies the uniform // interfaceBlockName: Specifies the uniform
// indexOut: output variable that stores the assigned register // indexOut: output variable that stores the assigned register
COMPILER_EXPORT bool ShGetUniformRegister(const ShHandle handle, COMPILER_EXPORT bool ShGetUniformRegister(const ShHandle handle,
const char *uniformName, const std::string &uniformName,
unsigned int *indexOut); unsigned int *indexOut);
#ifdef __cplusplus
}
#endif
#endif // _COMPILER_INTERFACE_INCLUDED_ #endif // _COMPILER_INTERFACE_INCLUDED_
...@@ -52,6 +52,21 @@ struct COMPILER_EXPORT ShaderVariable ...@@ -52,6 +52,21 @@ struct COMPILER_EXPORT ShaderVariable
unsigned int elementCount() const { return std::max(1u, arraySize); } unsigned int elementCount() const { return std::max(1u, arraySize); }
bool isStruct() const { return !fields.empty(); } bool isStruct() const { return !fields.empty(); }
// All of the shader's variables are described using nested data
// structures. This is needed in order to disambiguate similar looking
// types, such as two structs containing the same fields, but in
// different orders. "findInfoByMappedName" provides an easy query for
// users to dive into the data structure and fetch the unique variable
// instance corresponding to a dereferencing chain of the top-level
// variable.
// Given a mapped name like 'a[0].b.c[0]', return the ShaderVariable
// that defines 'c' in |leafVar|, and the original name 'A[0].B.C[0]'
// in |originalName|, based on the assumption that |this| defines 'a'.
// If no match is found, return false.
bool findInfoByMappedName(const std::string &mappedFullName,
const ShaderVariable **leafVar,
std::string* originalFullName) const;
GLenum type; GLenum type;
GLenum precision; GLenum precision;
std::string name; std::string name;
...@@ -60,6 +75,16 @@ struct COMPILER_EXPORT ShaderVariable ...@@ -60,6 +75,16 @@ struct COMPILER_EXPORT ShaderVariable
bool staticUse; bool staticUse;
std::vector<ShaderVariable> fields; std::vector<ShaderVariable> fields;
std::string structName; std::string structName;
protected:
bool isSameVariableAtLinkTime(const ShaderVariable &other,
bool matchPrecision) const;
bool operator==(const ShaderVariable &other) const;
bool operator!=(const ShaderVariable &other) const
{
return !operator==(other);
}
}; };
struct COMPILER_EXPORT Uniform : public ShaderVariable struct COMPILER_EXPORT Uniform : public ShaderVariable
...@@ -68,6 +93,16 @@ struct COMPILER_EXPORT Uniform : public ShaderVariable ...@@ -68,6 +93,16 @@ struct COMPILER_EXPORT Uniform : public ShaderVariable
~Uniform(); ~Uniform();
Uniform(const Uniform &other); Uniform(const Uniform &other);
Uniform &operator=(const Uniform &other); Uniform &operator=(const Uniform &other);
bool operator==(const Uniform &other) const;
bool operator!=(const Uniform &other) const
{
return !operator==(other);
}
// Decide whether two uniforms are the same at shader link time,
// assuming one from vertex shader and the other from fragment shader.
// See GLSL ES Spec 3.00.3, sec 4.3.5.
bool isSameUniformAtLinkTime(const Uniform &other) const;
}; };
struct COMPILER_EXPORT Attribute : public ShaderVariable struct COMPILER_EXPORT Attribute : public ShaderVariable
...@@ -76,6 +111,11 @@ struct COMPILER_EXPORT Attribute : public ShaderVariable ...@@ -76,6 +111,11 @@ struct COMPILER_EXPORT Attribute : public ShaderVariable
~Attribute(); ~Attribute();
Attribute(const Attribute &other); Attribute(const Attribute &other);
Attribute &operator=(const Attribute &other); Attribute &operator=(const Attribute &other);
bool operator==(const Attribute &other) const;
bool operator!=(const Attribute &other) const
{
return !operator==(other);
}
int location; int location;
}; };
...@@ -86,6 +126,18 @@ struct COMPILER_EXPORT InterfaceBlockField : public ShaderVariable ...@@ -86,6 +126,18 @@ struct COMPILER_EXPORT InterfaceBlockField : public ShaderVariable
~InterfaceBlockField(); ~InterfaceBlockField();
InterfaceBlockField(const InterfaceBlockField &other); InterfaceBlockField(const InterfaceBlockField &other);
InterfaceBlockField &operator=(const InterfaceBlockField &other); InterfaceBlockField &operator=(const InterfaceBlockField &other);
bool operator==(const InterfaceBlockField &other) const;
bool operator!=(const InterfaceBlockField &other) const
{
return !operator==(other);
}
// Decide whether two InterfaceBlock fields are the same at shader
// link time, assuming one from vertex shader and the other from
// fragment shader.
// See GLSL ES Spec 3.00.3, sec 4.3.7.
bool isSameInterfaceBlockFieldAtLinkTime(
const InterfaceBlockField &other) const;
bool isRowMajorLayout; bool isRowMajorLayout;
}; };
...@@ -94,8 +146,18 @@ struct COMPILER_EXPORT Varying : public ShaderVariable ...@@ -94,8 +146,18 @@ struct COMPILER_EXPORT Varying : public ShaderVariable
{ {
Varying(); Varying();
~Varying(); ~Varying();
Varying(const Varying &other); Varying(const Varying &otherg);
Varying &operator=(const Varying &other); Varying &operator=(const Varying &other);
bool operator==(const Varying &other) const;
bool operator!=(const Varying &other) const
{
return !operator==(other);
}
// Decide whether two varyings are the same at shader link time,
// assuming one from vertex shader and the other from fragment shader.
// See GLSL ES Spec 3.00.3, sec 4.3.9.
bool isSameVaryingAtLinkTime(const Varying &other) const;
InterpolationType interpolation; InterpolationType interpolation;
bool isInvariant; bool isInvariant;
......