зеркало из https://github.com/mozilla/pjs.git
Merge mozilla-central and mozilla-inbound
This commit is contained in:
Коммит
6f6d8cb9ab
|
@ -1170,8 +1170,7 @@ nsXULTreeGridCellAccessible::GetAttributesInternal(nsIPersistentProperties *aAtt
|
|||
if (!grandParent)
|
||||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIAccessibleTable> tableAccessible =
|
||||
do_QueryInterface(static_cast<nsIAccessible*>(grandParent));
|
||||
nsCOMPtr<nsIAccessibleTable> tableAccessible = do_QueryObject(grandParent);
|
||||
|
||||
// XXX - temp fix for crash bug 516047
|
||||
if (!tableAccessible)
|
||||
|
|
|
@ -798,12 +798,6 @@ pref("accessibility.blockautorefresh", false);
|
|||
// Whether history is enabled or not.
|
||||
pref("places.history.enabled", true);
|
||||
|
||||
// The percentage of system memory that the Places database can use. Out of the
|
||||
// allowed cache size it will at most use the size of the database file.
|
||||
// Changes to this value are effective after an application restart.
|
||||
// Acceptable values are between 0 and 50.
|
||||
pref("places.database.cache_to_memory_percentage", 6);
|
||||
|
||||
// the (maximum) number of the recent visits to sample
|
||||
// when calculating frecency
|
||||
pref("places.frecency.numVisits", 10);
|
||||
|
|
|
@ -2213,8 +2213,12 @@ var gLastOpenDirectory = {
|
|||
return this._lastDir;
|
||||
},
|
||||
set path(val) {
|
||||
if (!val || !val.exists() || !val.isDirectory())
|
||||
try {
|
||||
if (!val || !val.isDirectory())
|
||||
return;
|
||||
} catch(e) {
|
||||
return;
|
||||
}
|
||||
this._lastDir = val.clone();
|
||||
|
||||
// Don't save the last open directory pref inside the Private Browsing mode
|
||||
|
@ -2239,8 +2243,11 @@ function BrowserOpenFileWindow()
|
|||
fp.displayDirectory = gLastOpenDirectory.path;
|
||||
|
||||
if (fp.show() == nsIFilePicker.returnOK) {
|
||||
if (fp.file && fp.file.exists())
|
||||
gLastOpenDirectory.path = fp.file.parent.QueryInterface(Ci.nsILocalFile);
|
||||
try {
|
||||
if (fp.file)
|
||||
gLastOpenDirectory.path = fp.file.parent.QueryInterface(Ci.nsILocalFile);
|
||||
} catch(e) {
|
||||
}
|
||||
openTopWin(fp.fileURL.spec);
|
||||
}
|
||||
} catch (ex) {
|
||||
|
|
|
@ -75,8 +75,11 @@ function deleteLocalstore() {
|
|||
var directoryService = Components.classes[nsIDirectoryServiceContractID]
|
||||
.getService(nsIProperties);
|
||||
var localstoreFile = directoryService.get("LStoreS", Components.interfaces.nsIFile);
|
||||
if (localstoreFile.exists())
|
||||
try {
|
||||
localstoreFile.remove(false);
|
||||
} catch(e) {
|
||||
Components.utils.reportError(e);
|
||||
}
|
||||
}
|
||||
|
||||
function disableAddons() {
|
||||
|
|
|
@ -16,12 +16,6 @@
|
|||
display: -moz-box;
|
||||
}
|
||||
|
||||
.tab-close-button[selected="true"] {
|
||||
/* Make this button focusable so clicking on it will not focus the tab while
|
||||
it's getting closed */
|
||||
-moz-user-focus: normal;
|
||||
}
|
||||
|
||||
.tab-label[pinned] {
|
||||
width: 0;
|
||||
margin-left: 0 !important;
|
||||
|
|
|
@ -4002,7 +4002,6 @@
|
|||
role="presentation"/>
|
||||
<xul:toolbarbutton anonid="close-button"
|
||||
xbl:inherits="fadein,pinned,selected"
|
||||
tabindex="-1"
|
||||
clickthrough="never"
|
||||
class="tab-close-button"/>
|
||||
</xul:hbox>
|
||||
|
@ -4040,25 +4039,14 @@
|
|||
<handler event="dragstart" phase="capturing">
|
||||
this.style.MozUserFocus = '';
|
||||
</handler>
|
||||
<handler event="mousedown" button="0" phase="capturing">
|
||||
<handler event="mousedown">
|
||||
<![CDATA[
|
||||
if (this.mOverCloseButton) {
|
||||
event.stopPropagation();
|
||||
}
|
||||
else if (this.selected) {
|
||||
if (this.selected) {
|
||||
this.style.MozUserFocus = 'ignore';
|
||||
this.clientTop; // just using this to flush style updates
|
||||
}
|
||||
]]>
|
||||
</handler>
|
||||
<handler event="mousedown" button="1">
|
||||
this.style.MozUserFocus = 'ignore';
|
||||
this.clientTop;
|
||||
</handler>
|
||||
<handler event="mousedown" button="2">
|
||||
this.style.MozUserFocus = 'ignore';
|
||||
this.clientTop;
|
||||
</handler>
|
||||
<handler event="mouseup">
|
||||
this.style.MozUserFocus = '';
|
||||
</handler>
|
||||
|
|
|
@ -344,9 +344,11 @@ nsWindowsShellService::IsDefaultBrowserVista(PRBool* aIsDefaultBrowser)
|
|||
(void**)&pAAR);
|
||||
|
||||
if (SUCCEEDED(hr)) {
|
||||
BOOL res;
|
||||
hr = pAAR->QueryAppIsDefaultAll(AL_EFFECTIVE,
|
||||
APP_REG_NAME,
|
||||
aIsDefaultBrowser);
|
||||
&res);
|
||||
*aIsDefaultBrowser = res;
|
||||
|
||||
pAAR->Release();
|
||||
return PR_TRUE;
|
||||
|
|
|
@ -1868,10 +1868,6 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action-
|
|||
-moz-image-region: rect(0, 16px, 16px, 0);
|
||||
}
|
||||
|
||||
.tab-close-button:focus {
|
||||
outline: none !important;
|
||||
}
|
||||
|
||||
/* Tab scrollbox arrow, tabstrip new tab and all-tabs buttons */
|
||||
|
||||
@media all and (-moz-touch-enabled) {
|
||||
|
|
|
@ -336,6 +336,7 @@ user_pref("browser.console.showInPanel", true);
|
|||
user_pref("browser.dom.window.dump.enabled", true);
|
||||
user_pref("browser.firstrun.show.localepicker", false);
|
||||
user_pref("browser.firstrun.show.uidiscovery", false);
|
||||
user_pref("browser.ui.layout.tablet", 0); // force tablet UI off
|
||||
user_pref("dom.allow_scripts_to_close_windows", true);
|
||||
user_pref("dom.disable_open_during_load", false);
|
||||
user_pref("dom.max_script_run_time", 0); // no slow script dialogs
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
package="com.mozilla.watcher"
|
||||
android:versionCode="1"
|
||||
android:versionName="1.0">
|
||||
<uses-permission android:name="android.permission.WRITE_SETTINGS"></uses-permission>
|
||||
<application android:icon="@drawable/icon" android:label="@string/app_name">
|
||||
<activity android:name=".WatcherMain"
|
||||
android:label="@string/app_name">
|
||||
|
|
|
@ -58,6 +58,7 @@ import android.app.NotificationManager;
|
|||
import android.app.PendingIntent;
|
||||
import android.app.Service;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.content.ContextWrapper;
|
||||
import android.content.Intent;
|
||||
|
@ -65,9 +66,12 @@ import android.content.pm.ActivityInfo;
|
|||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.PackageManager.NameNotFoundException;
|
||||
import android.os.BatteryManager;
|
||||
import android.os.Debug;
|
||||
import android.os.IBinder;
|
||||
import android.os.PowerManager;
|
||||
import android.os.RemoteException;
|
||||
import android.provider.Settings;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.widget.Toast;
|
||||
|
@ -134,11 +138,26 @@ public class WatcherService extends Service
|
|||
|
||||
this.sPingTarget = GetIniData("watcher", "PingTarget", sIniFile, "www.mozilla.org");
|
||||
sHold = GetIniData("watcher", "delay", sIniFile, "60000");
|
||||
this.lDelay = Long.parseLong(sHold.trim());
|
||||
this.lDelay = Long.parseLong(sHold.trim());
|
||||
sHold = GetIniData("watcher", "period", sIniFile,"300000");
|
||||
this.lPeriod = Long.parseLong(sHold.trim());
|
||||
this.lPeriod = Long.parseLong(sHold.trim());
|
||||
sHold = GetIniData("watcher", "strikes", sIniFile,"3");
|
||||
this.nMaxStrikes = Integer.parseInt(sHold.trim());
|
||||
this.nMaxStrikes = Integer.parseInt(sHold.trim());
|
||||
|
||||
sHold = GetIniData("watcher", "stayon", sIniFile,"0");
|
||||
int nStayOn = Integer.parseInt(sHold.trim());
|
||||
|
||||
try {
|
||||
if (nStayOn != 0) {
|
||||
if (!Settings.System.putInt(getContentResolver(), Settings.System.STAY_ON_WHILE_PLUGGED_IN, BatteryManager.BATTERY_PLUGGED_AC | BatteryManager.BATTERY_PLUGGED_USB)) {
|
||||
doToast("Screen couldn't be set to Always On [stay on while plugged in]");
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
String sExcept = e.getMessage();
|
||||
doToast("Screen couldn't be set to Always On [exception " + sExcept + "]");
|
||||
}
|
||||
|
||||
doToast("WatcherService created");
|
||||
}
|
||||
|
|
|
@ -0,0 +1,68 @@
|
|||
# -*- makefile -*-
|
||||
# vim:set ts=8 sw=8 sts=8 noet:
|
||||
#
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# The Mozilla Foundation
|
||||
# Portions created by the Initial Developer are Copyright (C) 2011
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Chase Phillips <chase@mozilla.org>
|
||||
# Benjamin Smedberg <benjamin@smedbergs.us>
|
||||
# Jeff Walden <jwalden+code@mit.edu>
|
||||
# Joey Armstrong <joey@mozilla.com>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
PARALLEL_DIRS_export = $(addsuffix _export,$(PARALLEL_DIRS))
|
||||
|
||||
.PHONY: export $(PARALLEL_DIRS_export)
|
||||
|
||||
###############
|
||||
## TIER targets
|
||||
###############
|
||||
export_tier_%:
|
||||
@$(ECHO) "$@"
|
||||
@$(MAKE_TIER_SUBMAKEFILES)
|
||||
$(foreach dir,$(tier_$*_dirs),$(call SUBMAKE,export,$(dir)))
|
||||
|
||||
#################
|
||||
## Common targets
|
||||
#################
|
||||
ifdef PARALLEL_DIRS
|
||||
export:: $(PARALLEL_DIRS_export)
|
||||
|
||||
$(PARALLEL_DIRS_export): %_export: %/Makefile
|
||||
+@$(call SUBMAKE,export,$*)
|
||||
endif
|
||||
|
||||
export:: $(SUBMAKEFILES) $(MAKE_DIRS) $(if $(XPIDLSRCS),$(IDL_DIR))
|
||||
$(LOOP_OVER_DIRS)
|
||||
$(LOOP_OVER_TOOL_DIRS)
|
|
@ -0,0 +1,141 @@
|
|||
# -*- makefile -*-
|
||||
# vim:set ts=8 sw=8 sts=8 noet:
|
||||
#
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# The Mozilla Foundation
|
||||
# Portions created by the Initial Developer are Copyright (C) 2011
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Chase Phillips <chase@mozilla.org>
|
||||
# Benjamin Smedberg <benjamin@smedbergs.us>
|
||||
# Jeff Walden <jwalden+code@mit.edu>
|
||||
# Joey Armstrong <joey@mozilla.com>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
PARALLEL_DIRS_libs = $(addsuffix _libs,$(PARALLEL_DIRS))
|
||||
|
||||
.PHONY: libs $(PARALLEL_DIRS_libs)
|
||||
|
||||
###############
|
||||
## TIER targets
|
||||
###############
|
||||
libs_tier_%:
|
||||
@$(ECHO) "$@"
|
||||
@$(MAKE_TIER_SUBMAKEFILES)
|
||||
$(foreach dir,$(tier_$*_dirs),$(call SUBMAKE,libs,$(dir)))
|
||||
|
||||
#################
|
||||
## Common targets
|
||||
#################
|
||||
ifdef PARALLEL_DIRS
|
||||
libs:: $(PARALLEL_DIRS_libs)
|
||||
|
||||
$(PARALLEL_DIRS_libs): %_libs: %/Makefile
|
||||
+@$(call SUBMAKE,libs,$*)
|
||||
endif
|
||||
|
||||
|
||||
####################
|
||||
##
|
||||
####################
|
||||
ifdef EXPORT_LIBRARY
|
||||
ifeq ($(EXPORT_LIBRARY),1)
|
||||
ifdef IS_COMPONENT
|
||||
EXPORT_LIBRARY = $(DEPTH)/staticlib/components
|
||||
else
|
||||
EXPORT_LIBRARY = $(DEPTH)/staticlib
|
||||
endif
|
||||
else
|
||||
# If EXPORT_LIBRARY has a value, we'll be installing there. We also need to cleanup there
|
||||
GARBAGE += $(foreach lib,$(LIBRARY),$(EXPORT_LIBRARY)/$(lib))
|
||||
endif
|
||||
endif # EXPORT_LIBRARY
|
||||
|
||||
libs:: $(SUBMAKEFILES) $(MAKE_DIRS) $(HOST_LIBRARY) $(LIBRARY) $(SHARED_LIBRARY) $(IMPORT_LIBRARY) $(HOST_PROGRAM) $(PROGRAM) $(HOST_SIMPLE_PROGRAMS) $(SIMPLE_PROGRAMS) $(JAVA_LIBRARY)
|
||||
ifndef NO_DIST_INSTALL
|
||||
ifdef LIBRARY
|
||||
ifdef EXPORT_LIBRARY # Stage libs that will be linked into a static build
|
||||
$(INSTALL) $(IFLAGS1) $(LIBRARY) $(EXPORT_LIBRARY)
|
||||
endif # EXPORT_LIBRARY
|
||||
ifdef DIST_INSTALL
|
||||
ifdef IS_COMPONENT
|
||||
$(error Shipping static component libs makes no sense.)
|
||||
else
|
||||
$(INSTALL) $(IFLAGS1) $(LIBRARY) $(DIST)/lib
|
||||
endif
|
||||
endif # DIST_INSTALL
|
||||
endif # LIBRARY
|
||||
ifdef SHARED_LIBRARY
|
||||
ifdef IS_COMPONENT
|
||||
$(INSTALL) $(IFLAGS2) $(SHARED_LIBRARY) $(FINAL_TARGET)/components
|
||||
$(ELF_DYNSTR_GC) $(FINAL_TARGET)/components/$(SHARED_LIBRARY)
|
||||
ifndef NO_COMPONENTS_MANIFEST
|
||||
@$(PYTHON) $(MOZILLA_DIR)/config/buildlist.py $(FINAL_TARGET)/chrome.manifest "manifest components/components.manifest"
|
||||
@$(PYTHON) $(MOZILLA_DIR)/config/buildlist.py $(FINAL_TARGET)/components/components.manifest "binary-component $(SHARED_LIBRARY)"
|
||||
endif
|
||||
else # ! IS_COMPONENT
|
||||
ifneq (,$(filter OS2 WINNT,$(OS_ARCH)))
|
||||
ifndef NO_INSTALL_IMPORT_LIBRARY
|
||||
$(INSTALL) $(IFLAGS2) $(IMPORT_LIBRARY) $(DIST)/lib
|
||||
endif
|
||||
else
|
||||
$(INSTALL) $(IFLAGS2) $(SHARED_LIBRARY) $(DIST)/lib
|
||||
endif
|
||||
$(INSTALL) $(IFLAGS2) $(SHARED_LIBRARY) $(FINAL_TARGET)
|
||||
endif # IS_COMPONENT
|
||||
endif # SHARED_LIBRARY
|
||||
ifdef PROGRAM
|
||||
$(INSTALL) $(IFLAGS2) $(PROGRAM) $(FINAL_TARGET)
|
||||
endif
|
||||
ifdef SIMPLE_PROGRAMS
|
||||
$(INSTALL) $(IFLAGS2) $(SIMPLE_PROGRAMS) $(FINAL_TARGET)
|
||||
endif
|
||||
ifdef HOST_PROGRAM
|
||||
$(INSTALL) $(IFLAGS2) $(HOST_PROGRAM) $(DIST)/host/bin
|
||||
endif
|
||||
ifdef HOST_SIMPLE_PROGRAMS
|
||||
$(INSTALL) $(IFLAGS2) $(HOST_SIMPLE_PROGRAMS) $(DIST)/host/bin
|
||||
endif
|
||||
ifdef HOST_LIBRARY
|
||||
$(INSTALL) $(IFLAGS1) $(HOST_LIBRARY) $(DIST)/host/lib
|
||||
endif
|
||||
ifdef JAVA_LIBRARY
|
||||
ifdef IS_COMPONENT
|
||||
$(INSTALL) $(IFLAGS1) $(JAVA_LIBRARY) $(FINAL_TARGET)/components
|
||||
else
|
||||
$(INSTALL) $(IFLAGS1) $(JAVA_LIBRARY) $(FINAL_TARGET)
|
||||
endif
|
||||
endif # JAVA_LIBRARY
|
||||
endif # !NO_DIST_INSTALL
|
||||
$(LOOP_OVER_DIRS)
|
||||
|
||||
# EOF
|
|
@ -0,0 +1,72 @@
|
|||
# -*- makefile -*-
|
||||
# vim:set ts=8 sw=8 sts=8 noet:
|
||||
#
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# The Mozilla Foundation
|
||||
# Portions created by the Initial Developer are Copyright (C) 2011
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Chase Phillips <chase@mozilla.org>
|
||||
# Benjamin Smedberg <benjamin@smedbergs.us>
|
||||
# Jeff Walden <jwalden+code@mit.edu>
|
||||
# Joey Armstrong <joey@mozilla.com>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
PARALLEL_DIRS_tools = $(addsuffix _tools,$(PARALLEL_DIRS))
|
||||
|
||||
.PHONY: tools $(PARALLEL_DIRS_tools)
|
||||
|
||||
###############
|
||||
## TIER targets
|
||||
###############
|
||||
tools_tier_%:
|
||||
@$(ECHO) "$@"
|
||||
@$(MAKE_TIER_SUBMAKEFILES)
|
||||
$(foreach dir,$(tier_$*_dirs),$(call SUBMAKE,tools,$(dir)))
|
||||
|
||||
#################
|
||||
## Common targets
|
||||
#################
|
||||
ifdef PARALLEL_DIRS
|
||||
tools:: $(PARALLEL_DIRS_tools)
|
||||
|
||||
$(PARALLEL_DIRS_tools): %_tools: %/Makefile
|
||||
+@$(call SUBMAKE,tools,$*)
|
||||
endif
|
||||
|
||||
tools:: $(SUBMAKEFILES) $(MAKE_DIRS)
|
||||
$(LOOP_OVER_DIRS)
|
||||
ifneq (,$(strip $(TOOL_DIRS)))
|
||||
$(foreach dir,$(TOOL_DIRS),$(call SUBMAKE,libs,$(dir)))
|
||||
endif
|
||||
|
||||
# EOF
|
130
config/rules.mk
130
config/rules.mk
|
@ -1,3 +1,4 @@
|
|||
# -*- makefile -*-
|
||||
# vim:set ts=8 sw=8 sts=8 noet:
|
||||
#
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
|
@ -24,6 +25,7 @@
|
|||
# Chase Phillips <chase@mozilla.org>
|
||||
# Benjamin Smedberg <benjamin@smedbergs.us>
|
||||
# Jeff Walden <jwalden+code@mit.edu>
|
||||
# Joey Armstrong <joey@mozilla.com>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
|
@ -489,15 +491,6 @@ LOOP_OVER_TOOL_DIRS = \
|
|||
$(foreach dir,$(TOOL_DIRS),$(call SUBMAKE,$@,$(dir)))
|
||||
endif
|
||||
|
||||
ifdef PARALLEL_DIRS
|
||||
# create a bunch of fake targets for order-only processing
|
||||
PARALLEL_DIRS_export = $(addsuffix _export,$(PARALLEL_DIRS))
|
||||
PARALLEL_DIRS_libs = $(addsuffix _libs,$(PARALLEL_DIRS))
|
||||
PARALLEL_DIRS_tools = $(addsuffix _tools,$(PARALLEL_DIRS))
|
||||
|
||||
.PHONY: $(PARALLEL_DIRS_export) $(PARALLEL_DIRS_libs) $(PARALLEL_DIRS_tools)
|
||||
endif
|
||||
|
||||
#
|
||||
# Now we can differentiate between objects used to build a library, and
|
||||
# objects used to build an executable in the same directory.
|
||||
|
@ -736,21 +729,6 @@ endif
|
|||
|
||||
MAKE_TIER_SUBMAKEFILES = +$(if $(tier_$*_dirs),$(MAKE) $(addsuffix /Makefile,$(tier_$*_dirs)))
|
||||
|
||||
export_tier_%:
|
||||
@$(ECHO) "$@"
|
||||
@$(MAKE_TIER_SUBMAKEFILES)
|
||||
$(foreach dir,$(tier_$*_dirs),$(call SUBMAKE,export,$(dir)))
|
||||
|
||||
libs_tier_%:
|
||||
@$(ECHO) "$@"
|
||||
@$(MAKE_TIER_SUBMAKEFILES)
|
||||
$(foreach dir,$(tier_$*_dirs),$(call SUBMAKE,libs,$(dir)))
|
||||
|
||||
tools_tier_%:
|
||||
@$(ECHO) "$@"
|
||||
@$(MAKE_TIER_SUBMAKEFILES)
|
||||
$(foreach dir,$(tier_$*_dirs),$(call SUBMAKE,tools,$(dir)))
|
||||
|
||||
$(foreach tier,$(TIERS),tier_$(tier))::
|
||||
@$(ECHO) "$@: $($@_staticdirs) $($@_dirs)"
|
||||
$(foreach dir,$($@_staticdirs),$(call SUBMAKE,,$(dir)))
|
||||
|
@ -774,29 +752,8 @@ ifneq (,$(DIRS)$(TOOL_DIRS)$(PARALLEL_DIRS))
|
|||
$(LOOP_OVER_TOOL_DIRS)
|
||||
endif
|
||||
|
||||
ifdef PARALLEL_DIRS
|
||||
export:: $(PARALLEL_DIRS_export)
|
||||
|
||||
$(PARALLEL_DIRS_export): %_export: %/Makefile
|
||||
+@$(call SUBMAKE,export,$*)
|
||||
endif
|
||||
|
||||
export:: $(SUBMAKEFILES) $(MAKE_DIRS) $(if $(XPIDLSRCS),$(IDL_DIR))
|
||||
$(LOOP_OVER_DIRS)
|
||||
$(LOOP_OVER_TOOL_DIRS)
|
||||
|
||||
ifdef PARALLEL_DIRS
|
||||
tools:: $(PARALLEL_DIRS_tools)
|
||||
|
||||
$(PARALLEL_DIRS_tools): %_tools: %/Makefile
|
||||
+@$(call SUBMAKE,tools,$*)
|
||||
endif
|
||||
|
||||
tools:: $(SUBMAKEFILES) $(MAKE_DIRS)
|
||||
$(LOOP_OVER_DIRS)
|
||||
ifneq (,$(strip $(TOOL_DIRS)))
|
||||
$(foreach dir,$(TOOL_DIRS),$(call SUBMAKE,libs,$(dir)))
|
||||
endif
|
||||
include $(topsrcdir)/config/makefiles/target_export.mk
|
||||
include $(topsrcdir)/config/makefiles/target_tools.mk
|
||||
|
||||
#
|
||||
# Rule to create list of libraries for final link
|
||||
|
@ -826,86 +783,9 @@ DSO_LDOPTS_DEPS = $(call DO_EXPAND_LIBS,$(EXTRA_DSO_LIBS) $(filter %.$(LIB_SUFFI
|
|||
GLOBAL_DEPS += Makefile Makefile.in $(DEPTH)/config/autoconf.mk $(topsrcdir)/config/config.mk
|
||||
|
||||
##############################################
|
||||
ifdef PARALLEL_DIRS
|
||||
libs:: $(PARALLEL_DIRS_libs)
|
||||
|
||||
$(PARALLEL_DIRS_libs): %_libs: %/Makefile
|
||||
+@$(call SUBMAKE,libs,$*)
|
||||
endif
|
||||
|
||||
ifdef EXPORT_LIBRARY
|
||||
ifeq ($(EXPORT_LIBRARY),1)
|
||||
ifdef IS_COMPONENT
|
||||
EXPORT_LIBRARY = $(DEPTH)/staticlib/components
|
||||
else
|
||||
EXPORT_LIBRARY = $(DEPTH)/staticlib
|
||||
endif
|
||||
else
|
||||
# If EXPORT_LIBRARY has a value, we'll be installing there. We also need to cleanup there
|
||||
GARBAGE += $(foreach lib,$(LIBRARY),$(EXPORT_LIBRARY)/$(lib))
|
||||
endif
|
||||
endif # EXPORT_LIBRARY
|
||||
|
||||
libs:: $(SUBMAKEFILES) $(MAKE_DIRS) $(HOST_LIBRARY) $(LIBRARY) $(SHARED_LIBRARY) $(IMPORT_LIBRARY) $(HOST_PROGRAM) $(PROGRAM) $(HOST_SIMPLE_PROGRAMS) $(SIMPLE_PROGRAMS) $(JAVA_LIBRARY)
|
||||
ifndef NO_DIST_INSTALL
|
||||
ifdef LIBRARY
|
||||
ifdef EXPORT_LIBRARY # Stage libs that will be linked into a static build
|
||||
$(INSTALL) $(IFLAGS1) $(LIBRARY) $(EXPORT_LIBRARY)
|
||||
endif # EXPORT_LIBRARY
|
||||
ifdef DIST_INSTALL
|
||||
ifdef IS_COMPONENT
|
||||
$(error Shipping static component libs makes no sense.)
|
||||
else
|
||||
$(INSTALL) $(IFLAGS1) $(LIBRARY) $(DIST)/lib
|
||||
endif
|
||||
endif # DIST_INSTALL
|
||||
endif # LIBRARY
|
||||
ifdef SHARED_LIBRARY
|
||||
ifdef IS_COMPONENT
|
||||
$(INSTALL) $(IFLAGS2) $(SHARED_LIBRARY) $(FINAL_TARGET)/components
|
||||
$(ELF_DYNSTR_GC) $(FINAL_TARGET)/components/$(SHARED_LIBRARY)
|
||||
ifndef NO_COMPONENTS_MANIFEST
|
||||
@$(PYTHON) $(MOZILLA_DIR)/config/buildlist.py $(FINAL_TARGET)/chrome.manifest "manifest components/components.manifest"
|
||||
@$(PYTHON) $(MOZILLA_DIR)/config/buildlist.py $(FINAL_TARGET)/components/components.manifest "binary-component $(SHARED_LIBRARY)"
|
||||
endif
|
||||
else # ! IS_COMPONENT
|
||||
ifneq (,$(filter OS2 WINNT,$(OS_ARCH)))
|
||||
ifndef NO_INSTALL_IMPORT_LIBRARY
|
||||
$(INSTALL) $(IFLAGS2) $(IMPORT_LIBRARY) $(DIST)/lib
|
||||
endif
|
||||
else
|
||||
$(INSTALL) $(IFLAGS2) $(SHARED_LIBRARY) $(DIST)/lib
|
||||
endif
|
||||
$(INSTALL) $(IFLAGS2) $(SHARED_LIBRARY) $(FINAL_TARGET)
|
||||
endif # IS_COMPONENT
|
||||
endif # SHARED_LIBRARY
|
||||
ifdef PROGRAM
|
||||
$(INSTALL) $(IFLAGS2) $(PROGRAM) $(FINAL_TARGET)
|
||||
endif
|
||||
ifdef SIMPLE_PROGRAMS
|
||||
$(INSTALL) $(IFLAGS2) $(SIMPLE_PROGRAMS) $(FINAL_TARGET)
|
||||
endif
|
||||
ifdef HOST_PROGRAM
|
||||
$(INSTALL) $(IFLAGS2) $(HOST_PROGRAM) $(DIST)/host/bin
|
||||
endif
|
||||
ifdef HOST_SIMPLE_PROGRAMS
|
||||
$(INSTALL) $(IFLAGS2) $(HOST_SIMPLE_PROGRAMS) $(DIST)/host/bin
|
||||
endif
|
||||
ifdef HOST_LIBRARY
|
||||
$(INSTALL) $(IFLAGS1) $(HOST_LIBRARY) $(DIST)/host/lib
|
||||
endif
|
||||
ifdef JAVA_LIBRARY
|
||||
ifdef IS_COMPONENT
|
||||
$(INSTALL) $(IFLAGS1) $(JAVA_LIBRARY) $(FINAL_TARGET)/components
|
||||
else
|
||||
$(INSTALL) $(IFLAGS1) $(JAVA_LIBRARY) $(FINAL_TARGET)
|
||||
endif
|
||||
endif # JAVA_LIBRARY
|
||||
endif # !NO_DIST_INSTALL
|
||||
$(LOOP_OVER_DIRS)
|
||||
include $(topsrcdir)/config/makefiles/target_libs.mk
|
||||
|
||||
##############################################
|
||||
|
||||
ifndef NO_PROFILE_GUIDED_OPTIMIZE
|
||||
ifdef MOZ_PROFILE_USE
|
||||
ifeq ($(OS_ARCH)_$(GNU_CC), WINNT_)
|
||||
|
|
|
@ -2739,8 +2739,7 @@ nsDocument::GetActiveElement(nsIDOMElement **aElement)
|
|||
}
|
||||
|
||||
// No focused element anywhere in this document. Try to get the BODY.
|
||||
nsCOMPtr<nsIDOMHTMLDocument> htmlDoc =
|
||||
do_QueryInterface(static_cast<nsIDocument*>(this));
|
||||
nsCOMPtr<nsIDOMHTMLDocument> htmlDoc = do_QueryObject(this);
|
||||
if (htmlDoc) {
|
||||
nsCOMPtr<nsIDOMHTMLElement> bodyElement;
|
||||
htmlDoc->GetBody(getter_AddRefs(bodyElement));
|
||||
|
|
|
@ -457,8 +457,7 @@ nsFrameMessageManager::ReceiveMessage(nsISupports* aTarget,
|
|||
// messageManager is wrapped in TabChildGlobal.
|
||||
nsCOMPtr<nsISupports> defaultThisValue;
|
||||
if (mChrome) {
|
||||
defaultThisValue =
|
||||
do_QueryInterface(static_cast<nsIContentFrameMessageManager*>(this));
|
||||
defaultThisValue = do_QueryObject(this);
|
||||
} else {
|
||||
defaultThisValue = aTarget;
|
||||
}
|
||||
|
|
|
@ -4874,8 +4874,7 @@ nsGenericElement::UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (hasMutationListeners) {
|
||||
nsCOMPtr<nsIDOMEventTarget> node =
|
||||
do_QueryInterface(static_cast<nsIContent *>(this));
|
||||
nsCOMPtr<nsIDOMEventTarget> node = do_QueryObject(this);
|
||||
nsMutationEvent mutation(PR_TRUE, NS_MUTATION_ATTRMODIFIED);
|
||||
|
||||
mutation.mRelatedNode = attrNode;
|
||||
|
|
|
@ -3969,6 +3969,7 @@ WebGLContext::CompileShader(nsIWebGLShader *sobj)
|
|||
|
||||
compiler = ShConstructCompiler((ShShaderType) shader->ShaderType(),
|
||||
SH_WEBGL_SPEC,
|
||||
gl->IsGLES2() ? SH_ESSL_OUTPUT : SH_GLSL_OUTPUT,
|
||||
&resources);
|
||||
|
||||
nsPromiseFlatCString src(shader->Source());
|
||||
|
|
|
@ -339,7 +339,9 @@ public:
|
|||
// nsICanvasRenderingContextInternal
|
||||
NS_IMETHOD SetCanvasElement(nsHTMLCanvasElement* aParentCanvas);
|
||||
NS_IMETHOD SetDimensions(PRInt32 width, PRInt32 height);
|
||||
void Initialize(nsIDocShell *shell, PRInt32 width, PRInt32 height);
|
||||
NS_IMETHOD InitializeWithSurface(nsIDocShell *shell, gfxASurface *surface, PRInt32 width, PRInt32 height);
|
||||
PRBool EnsureSurface();
|
||||
NS_IMETHOD Render(gfxContext *ctx, gfxPattern::GraphicsFilter aFilter);
|
||||
NS_IMETHOD GetInputStream(const char* aMimeType,
|
||||
const PRUnichar* aEncoderOptions,
|
||||
|
@ -380,7 +382,7 @@ public:
|
|||
{
|
||||
public:
|
||||
PathAutoSaveRestore(nsCanvasRenderingContext2D* aCtx) :
|
||||
mContext(aCtx->mThebes)
|
||||
mContext(aCtx->mThebes)
|
||||
{
|
||||
if (aCtx->mHasPath) {
|
||||
mPath = mContext->CopyPath();
|
||||
|
@ -460,12 +462,16 @@ protected:
|
|||
return static_cast<nsHTMLCanvasElement*>(mCanvasElement.get());
|
||||
}
|
||||
|
||||
// Initialize the Thebes rendering context
|
||||
void CreateThebes();
|
||||
|
||||
// If mCanvasElement is not provided, then a docshell is
|
||||
nsCOMPtr<nsIDocShell> mDocShell;
|
||||
|
||||
// our drawing surfaces, contexts, and layers
|
||||
nsRefPtr<gfxContext> mThebes;
|
||||
nsRefPtr<gfxASurface> mSurface;
|
||||
PRPackedBool mSurfaceCreated;
|
||||
|
||||
PRUint32 mSaveCount;
|
||||
|
||||
|
@ -527,6 +533,11 @@ protected:
|
|||
*/
|
||||
PRBool NeedToUseIntermediateSurface()
|
||||
{
|
||||
if (!mThebes) {
|
||||
// Haven't created a surface yet, default is OVER.
|
||||
return OperatorAffectsUncoveredAreas(gfxContext::OPERATOR_OVER);
|
||||
}
|
||||
|
||||
// certain operators always need an intermediate surface, except
|
||||
// with quartz since quartz does compositing differently than cairo
|
||||
return OperatorAffectsUncoveredAreas(mThebes->CurrentOperator());
|
||||
|
@ -541,6 +552,11 @@ protected:
|
|||
*/
|
||||
void ClearSurfaceForUnboundedSource()
|
||||
{
|
||||
if (!mThebes) {
|
||||
// Haven't created a surface yet, default is OVER.
|
||||
return;
|
||||
}
|
||||
|
||||
gfxContext::GraphicsOperator current = mThebes->CurrentOperator();
|
||||
if (current != gfxContext::OPERATOR_SOURCE)
|
||||
return;
|
||||
|
@ -597,8 +613,7 @@ protected:
|
|||
* Gets the pres shell from either the canvas element or the doc shell
|
||||
*/
|
||||
nsIPresShell *GetPresShell() {
|
||||
nsCOMPtr<nsIContent> content =
|
||||
do_QueryInterface(static_cast<nsIDOMHTMLCanvasElement*>(mCanvasElement));
|
||||
nsCOMPtr<nsIContent> content = do_QueryObject(mCanvasElement);
|
||||
if (content) {
|
||||
nsIDocument* ownerDoc = content->GetOwnerDoc();
|
||||
return ownerDoc ? ownerDoc->GetShell() : nsnull;
|
||||
|
@ -965,6 +980,10 @@ nsCanvasRenderingContext2D::ApplyStyle(Style aWhichStyle,
|
|||
return;
|
||||
}
|
||||
|
||||
if (!EnsureSurface()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// if not using global alpha, don't optimize with dirty bit
|
||||
if (aUseGlobalAlpha)
|
||||
mDirtyStyle[aWhichStyle] = PR_FALSE;
|
||||
|
@ -1059,70 +1078,13 @@ nsCanvasRenderingContext2D::RedrawUser(const gfxRect& r)
|
|||
NS_IMETHODIMP
|
||||
nsCanvasRenderingContext2D::SetDimensions(PRInt32 width, PRInt32 height)
|
||||
{
|
||||
nsRefPtr<gfxASurface> surface;
|
||||
|
||||
// Check that the dimensions are sane
|
||||
gfxIntSize size(width, height);
|
||||
if (gfxASurface::CheckSurfaceSize(size, 0xffff)) {
|
||||
// Zero sized surfaces have problems, so just use a 1 by 1.
|
||||
if (height == 0 || width == 0) {
|
||||
mZero = PR_TRUE;
|
||||
height = 1;
|
||||
width = 1;
|
||||
} else {
|
||||
mZero = PR_FALSE;
|
||||
}
|
||||
|
||||
gfxASurface::gfxImageFormat format = GetImageFormat();
|
||||
|
||||
if (!PR_GetEnv("MOZ_CANVAS_IMAGE_SURFACE")) {
|
||||
nsCOMPtr<nsIContent> content =
|
||||
do_QueryInterface(static_cast<nsIDOMHTMLCanvasElement*>(mCanvasElement));
|
||||
nsIDocument* ownerDoc = nsnull;
|
||||
if (content)
|
||||
ownerDoc = content->GetOwnerDoc();
|
||||
nsRefPtr<LayerManager> layerManager = nsnull;
|
||||
|
||||
if (ownerDoc)
|
||||
layerManager =
|
||||
nsContentUtils::PersistentLayerManagerForDocument(ownerDoc);
|
||||
|
||||
if (layerManager) {
|
||||
surface = layerManager->CreateOptimalSurface(gfxIntSize(width, height), format);
|
||||
} else {
|
||||
surface = gfxPlatform::GetPlatform()->
|
||||
CreateOffscreenSurface(gfxIntSize(width, height), gfxASurface::ContentFromFormat(format));
|
||||
}
|
||||
}
|
||||
|
||||
if (!surface || surface->CairoStatus()) {
|
||||
// If we couldn't create a surface of the type we want, fall back
|
||||
// to an image surface. This lets us handle surface sizes that
|
||||
// the underlying cairo backend might not handle.
|
||||
surface = new gfxImageSurface(gfxIntSize(width, height), format);
|
||||
if (!surface || surface->CairoStatus()) {
|
||||
surface = nsnull;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (surface) {
|
||||
if (gCanvasMemoryReporter == nsnull) {
|
||||
gCanvasMemoryReporter = new NS_MEMORY_REPORTER_NAME(CanvasMemory);
|
||||
NS_RegisterMemoryReporter(gCanvasMemoryReporter);
|
||||
}
|
||||
|
||||
gCanvasMemoryUsed += width * height * 4;
|
||||
JSContext* context = nsContentUtils::GetCurrentJSContext();
|
||||
if (context) {
|
||||
JS_updateMallocCounter(context, width * height * 4);
|
||||
}
|
||||
}
|
||||
|
||||
return InitializeWithSurface(NULL, surface, width, height);
|
||||
Initialize(NULL, width, height);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCanvasRenderingContext2D::InitializeWithSurface(nsIDocShell *docShell, gfxASurface *surface, PRInt32 width, PRInt32 height) {
|
||||
void
|
||||
nsCanvasRenderingContext2D::Initialize(nsIDocShell *docShell, PRInt32 width, PRInt32 height)
|
||||
{
|
||||
Reset();
|
||||
|
||||
NS_ASSERTION(!docShell ^ !mCanvasElement, "Cannot set both docshell and canvas element");
|
||||
|
@ -1131,19 +1093,9 @@ nsCanvasRenderingContext2D::InitializeWithSurface(nsIDocShell *docShell, gfxASur
|
|||
mWidth = width;
|
||||
mHeight = height;
|
||||
|
||||
mSurface = surface;
|
||||
mThebes = surface ? new gfxContext(mSurface) : nsnull;
|
||||
mResetLayer = PR_TRUE;
|
||||
|
||||
/* Create dummy surfaces here */
|
||||
if (mSurface == nsnull || mSurface->CairoStatus() != 0 ||
|
||||
mThebes == nsnull || mThebes->HasError())
|
||||
{
|
||||
mSurface = new gfxImageSurface(gfxIntSize(1,1), gfxASurface::ImageFormatARGB32);
|
||||
mThebes = new gfxContext(mSurface);
|
||||
} else {
|
||||
mValid = PR_TRUE;
|
||||
}
|
||||
mValid = PR_TRUE;
|
||||
mSurfaceCreated = PR_FALSE;
|
||||
|
||||
// set up the initial canvas defaults
|
||||
mStyleStack.Clear();
|
||||
|
@ -1157,6 +1109,19 @@ nsCanvasRenderingContext2D::InitializeWithSurface(nsIDocShell *docShell, gfxASur
|
|||
state->colorStyles[STYLE_SHADOW] = NS_RGBA(0,0,0,0);
|
||||
DirtyAllStyles();
|
||||
|
||||
// always force a redraw, because if the surface dimensions were reset
|
||||
// then the surface became cleared, and we need to redraw everything.
|
||||
Redraw();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
nsCanvasRenderingContext2D::CreateThebes()
|
||||
{
|
||||
mThebes = new gfxContext(mSurface);
|
||||
mSurfaceCreated = PR_TRUE;
|
||||
|
||||
mThebes->SetOperator(gfxContext::OPERATOR_CLEAR);
|
||||
mThebes->NewPath();
|
||||
mThebes->Rectangle(gfxRect(0, 0, mWidth, mHeight));
|
||||
|
@ -1167,17 +1132,105 @@ nsCanvasRenderingContext2D::InitializeWithSurface(nsIDocShell *docShell, gfxASur
|
|||
mThebes->SetMiterLimit(10.0);
|
||||
mThebes->SetLineCap(gfxContext::LINE_CAP_BUTT);
|
||||
mThebes->SetLineJoin(gfxContext::LINE_JOIN_MITER);
|
||||
mThebes->SetFillRule(gfxContext::FILL_RULE_WINDING);
|
||||
|
||||
mThebes->NewPath();
|
||||
}
|
||||
|
||||
// always force a redraw, because if the surface dimensions were reset
|
||||
// then the surface became cleared, and we need to redraw everything.
|
||||
Redraw();
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCanvasRenderingContext2D::InitializeWithSurface(nsIDocShell *docShell,
|
||||
gfxASurface *surface,
|
||||
PRInt32 width,
|
||||
PRInt32 height)
|
||||
{
|
||||
Initialize(docShell, width, height);
|
||||
|
||||
mSurface = surface;
|
||||
CreateThebes();
|
||||
return mValid ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsCanvasRenderingContext2D::EnsureSurface()
|
||||
{
|
||||
if (!mValid) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
if (mSurface && mThebes && mSurfaceCreated) {
|
||||
if (mSurface->CairoStatus()) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
nsRefPtr<gfxASurface> surface;
|
||||
|
||||
// Check that the dimensions are sane
|
||||
if (gfxASurface::CheckSurfaceSize(gfxIntSize(mWidth, mHeight), 0xffff)) {
|
||||
// Zero sized surfaces have problems, so just use a 1 by 1.
|
||||
if (mHeight == 0 || mWidth == 0) {
|
||||
mZero = PR_TRUE;
|
||||
mHeight = 1;
|
||||
mWidth = 1;
|
||||
} else {
|
||||
mZero = PR_FALSE;
|
||||
}
|
||||
|
||||
gfxASurface::gfxImageFormat format = GetImageFormat();
|
||||
|
||||
if (!PR_GetEnv("MOZ_CANVAS_IMAGE_SURFACE")) {
|
||||
nsCOMPtr<nsIContent> content = do_QueryObject(mCanvasElement);
|
||||
nsIDocument* ownerDoc = nsnull;
|
||||
if (content)
|
||||
ownerDoc = content->GetOwnerDoc();
|
||||
nsRefPtr<LayerManager> layerManager = nsnull;
|
||||
|
||||
if (ownerDoc)
|
||||
layerManager =
|
||||
nsContentUtils::PersistentLayerManagerForDocument(ownerDoc);
|
||||
|
||||
if (layerManager) {
|
||||
surface = layerManager->CreateOptimalSurface(gfxIntSize(mWidth, mHeight), format);
|
||||
} else {
|
||||
surface = gfxPlatform::GetPlatform()->
|
||||
CreateOffscreenSurface(gfxIntSize(mWidth, mHeight), gfxASurface::ContentFromFormat(format));
|
||||
}
|
||||
}
|
||||
|
||||
if (!surface || surface->CairoStatus()) {
|
||||
// If we couldn't create a surface of the type we want, fall back
|
||||
// to an image surface. This lets us handle surface sizes that
|
||||
// the underlying cairo backend might not handle.
|
||||
surface = new gfxImageSurface(gfxIntSize(mWidth, mHeight), format);
|
||||
if (!surface || surface->CairoStatus()) {
|
||||
surface = nsnull;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (surface) {
|
||||
if (gCanvasMemoryReporter == nsnull) {
|
||||
gCanvasMemoryReporter = new NS_MEMORY_REPORTER_NAME(CanvasMemory);
|
||||
NS_RegisterMemoryReporter(gCanvasMemoryReporter);
|
||||
}
|
||||
|
||||
gCanvasMemoryUsed += mWidth * mHeight * 4;
|
||||
JSContext* context = nsContentUtils::GetCurrentJSContext();
|
||||
if (context) {
|
||||
JS_updateMallocCounter(context, mWidth * mHeight * 4);
|
||||
}
|
||||
} else {
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
mSurface = surface;
|
||||
CreateThebes();
|
||||
|
||||
if (mSurface->CairoStatus()) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCanvasRenderingContext2D::SetIsOpaque(PRBool isOpaque)
|
||||
{
|
||||
|
@ -1219,9 +1272,7 @@ nsCanvasRenderingContext2D::Render(gfxContext *ctx, gfxPattern::GraphicsFilter a
|
|||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
if (!mValid || !mSurface ||
|
||||
mSurface->CairoStatus() ||
|
||||
mThebes->HasError())
|
||||
if (!EnsureSurface())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsRefPtr<gfxPattern> pat = new gfxPattern(mSurface);
|
||||
|
@ -1250,9 +1301,7 @@ nsCanvasRenderingContext2D::GetInputStream(const char *aMimeType,
|
|||
const PRUnichar *aEncoderOptions,
|
||||
nsIInputStream **aStream)
|
||||
{
|
||||
if (!mValid || !mSurface ||
|
||||
mSurface->CairoStatus() ||
|
||||
mThebes->HasError())
|
||||
if (!EnsureSurface())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsresult rv;
|
||||
|
@ -1337,6 +1386,9 @@ nsCanvasRenderingContext2D::GetCanvas(nsIDOMHTMLCanvasElement **canvas)
|
|||
NS_IMETHODIMP
|
||||
nsCanvasRenderingContext2D::Save()
|
||||
{
|
||||
if (!EnsureSurface())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
ContextState state = CurrentState();
|
||||
mStyleStack.AppendElement(state);
|
||||
mThebes->Save();
|
||||
|
@ -1347,6 +1399,9 @@ nsCanvasRenderingContext2D::Save()
|
|||
NS_IMETHODIMP
|
||||
nsCanvasRenderingContext2D::Restore()
|
||||
{
|
||||
if (!EnsureSurface())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
if (mSaveCount == 0)
|
||||
return NS_OK;
|
||||
|
||||
|
@ -1367,6 +1422,9 @@ nsCanvasRenderingContext2D::Restore()
|
|||
NS_IMETHODIMP
|
||||
nsCanvasRenderingContext2D::Scale(float x, float y)
|
||||
{
|
||||
if (!EnsureSurface())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
if (!FloatValidate(x,y))
|
||||
return NS_OK;
|
||||
|
||||
|
@ -1377,6 +1435,9 @@ nsCanvasRenderingContext2D::Scale(float x, float y)
|
|||
NS_IMETHODIMP
|
||||
nsCanvasRenderingContext2D::Rotate(float angle)
|
||||
{
|
||||
if (!EnsureSurface())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
if (!FloatValidate(angle))
|
||||
return NS_OK;
|
||||
|
||||
|
@ -1387,6 +1448,9 @@ nsCanvasRenderingContext2D::Rotate(float angle)
|
|||
NS_IMETHODIMP
|
||||
nsCanvasRenderingContext2D::Translate(float x, float y)
|
||||
{
|
||||
if (!EnsureSurface())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
if (!FloatValidate(x,y))
|
||||
return NS_OK;
|
||||
|
||||
|
@ -1397,6 +1461,9 @@ nsCanvasRenderingContext2D::Translate(float x, float y)
|
|||
NS_IMETHODIMP
|
||||
nsCanvasRenderingContext2D::Transform(float m11, float m12, float m21, float m22, float dx, float dy)
|
||||
{
|
||||
if (!EnsureSurface())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
if (!FloatValidate(m11,m12,m21,m22,dx,dy))
|
||||
return NS_OK;
|
||||
|
||||
|
@ -1409,6 +1476,9 @@ nsCanvasRenderingContext2D::Transform(float m11, float m12, float m21, float m22
|
|||
NS_IMETHODIMP
|
||||
nsCanvasRenderingContext2D::SetTransform(float m11, float m12, float m21, float m22, float dx, float dy)
|
||||
{
|
||||
if (!EnsureSurface())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
if (!FloatValidate(m11,m12,m21,m22,dx,dy))
|
||||
return NS_OK;
|
||||
|
||||
|
@ -1424,6 +1494,9 @@ nsCanvasRenderingContext2D::SetMozCurrentTransform(JSContext* cx,
|
|||
{
|
||||
nsresult rv;
|
||||
gfxMatrix newCTM;
|
||||
|
||||
if (!EnsureSurface())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
if (!JSValToMatrix(cx, matrix, &newCTM, &rv)) {
|
||||
return rv;
|
||||
|
@ -1438,6 +1511,9 @@ NS_IMETHODIMP
|
|||
nsCanvasRenderingContext2D::GetMozCurrentTransform(JSContext* cx,
|
||||
jsval* matrix)
|
||||
{
|
||||
if (!EnsureSurface())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
return MatrixToJSVal(mThebes->CurrentMatrix(), cx, matrix);
|
||||
}
|
||||
|
||||
|
@ -1447,6 +1523,9 @@ nsCanvasRenderingContext2D::SetMozCurrentTransformInverse(JSContext* cx,
|
|||
{
|
||||
nsresult rv;
|
||||
gfxMatrix newCTMInverse;
|
||||
|
||||
if (!EnsureSurface())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
if (!JSValToMatrix(cx, matrix, &newCTMInverse, &rv)) {
|
||||
return rv;
|
||||
|
@ -1648,6 +1727,9 @@ NS_IMETHODIMP
|
|||
nsCanvasRenderingContext2D::SetMozFillRule(const nsAString& aString)
|
||||
{
|
||||
gfxContext::FillRule rule;
|
||||
|
||||
if (!EnsureSurface())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
if (aString.EqualsLiteral("evenodd"))
|
||||
rule = gfxContext::FILL_RULE_EVEN_ODD;
|
||||
|
@ -1664,6 +1746,9 @@ nsCanvasRenderingContext2D::SetMozFillRule(const nsAString& aString)
|
|||
NS_IMETHODIMP
|
||||
nsCanvasRenderingContext2D::GetMozFillRule(nsAString& aString)
|
||||
{
|
||||
if (!EnsureSurface())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
switch (mThebes->CurrentFillRule()) {
|
||||
case gfxContext::FILL_RULE_WINDING:
|
||||
aString.AssignLiteral("nonzero"); break;
|
||||
|
@ -1888,6 +1973,9 @@ nsCanvasRenderingContext2D::ShadowInitialize(const gfxRect& extents, gfxAlphaBox
|
|||
void
|
||||
nsCanvasRenderingContext2D::ShadowFinalize(gfxAlphaBoxBlur& blur)
|
||||
{
|
||||
if (!EnsureSurface())
|
||||
return;
|
||||
|
||||
ApplyStyle(STYLE_SHADOW);
|
||||
// canvas matrix was already applied, don't apply it twice, but do
|
||||
// apply the shadow offset
|
||||
|
@ -1902,6 +1990,9 @@ nsCanvasRenderingContext2D::ShadowFinalize(gfxAlphaBoxBlur& blur)
|
|||
nsresult
|
||||
nsCanvasRenderingContext2D::DrawPath(Style style, gfxRect *dirtyRect)
|
||||
{
|
||||
if (!EnsureSurface())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
PRBool doUseIntermediateSurface = PR_FALSE;
|
||||
|
||||
if (mSurface->GetType() == gfxASurface::SurfaceTypeD2D) {
|
||||
|
@ -2029,6 +2120,9 @@ nsCanvasRenderingContext2D::DrawPath(Style style, gfxRect *dirtyRect)
|
|||
NS_IMETHODIMP
|
||||
nsCanvasRenderingContext2D::ClearRect(float x, float y, float w, float h)
|
||||
{
|
||||
if (!mSurfaceCreated)
|
||||
return NS_OK;
|
||||
|
||||
if (!FloatValidate(x,y,w,h))
|
||||
return NS_OK;
|
||||
|
||||
|
@ -2046,6 +2140,9 @@ nsCanvasRenderingContext2D::ClearRect(float x, float y, float w, float h)
|
|||
nsresult
|
||||
nsCanvasRenderingContext2D::DrawRect(const gfxRect& rect, Style style)
|
||||
{
|
||||
if (!EnsureSurface())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
if (!FloatValidate(rect.X(), rect.Y(), rect.Width(), rect.Height()))
|
||||
return NS_OK;
|
||||
|
||||
|
@ -2084,6 +2181,9 @@ nsCanvasRenderingContext2D::StrokeRect(float x, float y, float w, float h)
|
|||
NS_IMETHODIMP
|
||||
nsCanvasRenderingContext2D::BeginPath()
|
||||
{
|
||||
if (!EnsureSurface())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
mHasPath = PR_FALSE;
|
||||
mThebes->NewPath();
|
||||
return NS_OK;
|
||||
|
@ -2092,6 +2192,9 @@ nsCanvasRenderingContext2D::BeginPath()
|
|||
NS_IMETHODIMP
|
||||
nsCanvasRenderingContext2D::ClosePath()
|
||||
{
|
||||
if (!EnsureSurface())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
mThebes->ClosePath();
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -2119,6 +2222,9 @@ nsCanvasRenderingContext2D::Stroke()
|
|||
NS_IMETHODIMP
|
||||
nsCanvasRenderingContext2D::Clip()
|
||||
{
|
||||
if (!EnsureSurface())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
mThebes->Clip();
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -2126,6 +2232,9 @@ nsCanvasRenderingContext2D::Clip()
|
|||
NS_IMETHODIMP
|
||||
nsCanvasRenderingContext2D::MoveTo(float x, float y)
|
||||
{
|
||||
if (!EnsureSurface())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
if (!FloatValidate(x,y))
|
||||
return NS_OK;
|
||||
|
||||
|
@ -2137,6 +2246,9 @@ nsCanvasRenderingContext2D::MoveTo(float x, float y)
|
|||
NS_IMETHODIMP
|
||||
nsCanvasRenderingContext2D::LineTo(float x, float y)
|
||||
{
|
||||
if (!EnsureSurface())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
if (!FloatValidate(x,y))
|
||||
return NS_OK;
|
||||
|
||||
|
@ -2148,6 +2260,9 @@ nsCanvasRenderingContext2D::LineTo(float x, float y)
|
|||
NS_IMETHODIMP
|
||||
nsCanvasRenderingContext2D::QuadraticCurveTo(float cpx, float cpy, float x, float y)
|
||||
{
|
||||
if (!EnsureSurface())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
if (!FloatValidate(cpx,cpy,x,y))
|
||||
return NS_OK;
|
||||
|
||||
|
@ -2168,6 +2283,9 @@ nsCanvasRenderingContext2D::BezierCurveTo(float cp1x, float cp1y,
|
|||
float cp2x, float cp2y,
|
||||
float x, float y)
|
||||
{
|
||||
if (!EnsureSurface())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
if (!FloatValidate(cp1x,cp1y,cp2x,cp2y,x,y))
|
||||
return NS_OK;
|
||||
|
||||
|
@ -2182,6 +2300,9 @@ nsCanvasRenderingContext2D::BezierCurveTo(float cp1x, float cp1y,
|
|||
NS_IMETHODIMP
|
||||
nsCanvasRenderingContext2D::ArcTo(float x1, float y1, float x2, float y2, float radius)
|
||||
{
|
||||
if (!EnsureSurface())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
if (!FloatValidate(x1,y1,x2,y2,radius))
|
||||
return NS_OK;
|
||||
|
||||
|
@ -2241,6 +2362,9 @@ nsCanvasRenderingContext2D::ArcTo(float x1, float y1, float x2, float y2, float
|
|||
NS_IMETHODIMP
|
||||
nsCanvasRenderingContext2D::Arc(float x, float y, float r, float startAngle, float endAngle, PRBool ccw)
|
||||
{
|
||||
if (!EnsureSurface())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
if (!FloatValidate(x,y,r,startAngle,endAngle))
|
||||
return NS_OK;
|
||||
|
||||
|
@ -2260,6 +2384,9 @@ nsCanvasRenderingContext2D::Arc(float x, float y, float r, float startAngle, flo
|
|||
NS_IMETHODIMP
|
||||
nsCanvasRenderingContext2D::Rect(float x, float y, float w, float h)
|
||||
{
|
||||
if (!EnsureSurface())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
if (!FloatValidate(x,y,w,h))
|
||||
return NS_OK;
|
||||
|
||||
|
@ -2772,7 +2899,13 @@ nsCanvasRenderingContext2D::DrawOrMeasureText(const nsAString& aRawText,
|
|||
|
||||
GetAppUnitsValues(&processor.mAppUnitsPerDevPixel, NULL);
|
||||
processor.mPt = gfxPoint(aX, aY);
|
||||
processor.mThebes = mThebes;
|
||||
nsRefPtr<nsRenderingContext> ctx;
|
||||
if (mThebes) {
|
||||
processor.mThebes = mThebes;
|
||||
} else {
|
||||
ctx = presShell->GetReferenceRenderingContext();
|
||||
processor.mThebes = ctx->ThebesContext();
|
||||
}
|
||||
processor.mOp = aOp;
|
||||
processor.mBoundingBox = gfxRect(0, 0, 0, 0);
|
||||
processor.mDoMeasureBoundingBox = doDrawShadow || !mIsEntireFrameInvalid;
|
||||
|
@ -2806,6 +2939,11 @@ nsCanvasRenderingContext2D::DrawOrMeasureText(const nsAString& aRawText,
|
|||
if (aOp==TEXT_DRAW_OPERATION_MEASURE)
|
||||
return NS_OK;
|
||||
|
||||
if (!EnsureSurface())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
processor.mThebes = mThebes;
|
||||
|
||||
// offset pt.x based on text align
|
||||
gfxFloat anchorX;
|
||||
|
||||
|
@ -3026,6 +3164,9 @@ nsCanvasRenderingContext2D::MakeTextRun(const PRUnichar* aText,
|
|||
NS_IMETHODIMP
|
||||
nsCanvasRenderingContext2D::SetLineWidth(float width)
|
||||
{
|
||||
if (!EnsureSurface())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
if (!FloatValidate(width) || width <= 0.0)
|
||||
return NS_OK;
|
||||
|
||||
|
@ -3036,6 +3177,9 @@ nsCanvasRenderingContext2D::SetLineWidth(float width)
|
|||
NS_IMETHODIMP
|
||||
nsCanvasRenderingContext2D::GetLineWidth(float *width)
|
||||
{
|
||||
if (!EnsureSurface())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
gfxFloat d = mThebes->CurrentLineWidth();
|
||||
*width = static_cast<float>(d);
|
||||
return NS_OK;
|
||||
|
@ -3044,6 +3188,9 @@ nsCanvasRenderingContext2D::GetLineWidth(float *width)
|
|||
NS_IMETHODIMP
|
||||
nsCanvasRenderingContext2D::SetLineCap(const nsAString& capstyle)
|
||||
{
|
||||
if (!EnsureSurface())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
gfxContext::GraphicsLineCap cap;
|
||||
|
||||
if (capstyle.EqualsLiteral("butt"))
|
||||
|
@ -3063,6 +3210,9 @@ nsCanvasRenderingContext2D::SetLineCap(const nsAString& capstyle)
|
|||
NS_IMETHODIMP
|
||||
nsCanvasRenderingContext2D::GetLineCap(nsAString& capstyle)
|
||||
{
|
||||
if (!EnsureSurface())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
gfxContext::GraphicsLineCap cap = mThebes->CurrentLineCap();
|
||||
|
||||
if (cap == gfxContext::LINE_CAP_BUTT)
|
||||
|
@ -3080,6 +3230,9 @@ nsCanvasRenderingContext2D::GetLineCap(nsAString& capstyle)
|
|||
NS_IMETHODIMP
|
||||
nsCanvasRenderingContext2D::SetLineJoin(const nsAString& joinstyle)
|
||||
{
|
||||
if (!EnsureSurface())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
gfxContext::GraphicsLineJoin j;
|
||||
|
||||
if (joinstyle.EqualsLiteral("round"))
|
||||
|
@ -3099,6 +3252,9 @@ nsCanvasRenderingContext2D::SetLineJoin(const nsAString& joinstyle)
|
|||
NS_IMETHODIMP
|
||||
nsCanvasRenderingContext2D::GetLineJoin(nsAString& joinstyle)
|
||||
{
|
||||
if (!EnsureSurface())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
gfxContext::GraphicsLineJoin j = mThebes->CurrentLineJoin();
|
||||
|
||||
if (j == gfxContext::LINE_JOIN_ROUND)
|
||||
|
@ -3116,6 +3272,9 @@ nsCanvasRenderingContext2D::GetLineJoin(nsAString& joinstyle)
|
|||
NS_IMETHODIMP
|
||||
nsCanvasRenderingContext2D::SetMiterLimit(float miter)
|
||||
{
|
||||
if (!EnsureSurface())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
if (!FloatValidate(miter) || miter <= 0.0)
|
||||
return NS_OK;
|
||||
|
||||
|
@ -3126,6 +3285,9 @@ nsCanvasRenderingContext2D::SetMiterLimit(float miter)
|
|||
NS_IMETHODIMP
|
||||
nsCanvasRenderingContext2D::GetMiterLimit(float *miter)
|
||||
{
|
||||
if (!EnsureSurface())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
gfxFloat d = mThebes->CurrentMiterLimit();
|
||||
*miter = static_cast<float>(d);
|
||||
return NS_OK;
|
||||
|
@ -3134,6 +3296,9 @@ nsCanvasRenderingContext2D::GetMiterLimit(float *miter)
|
|||
NS_IMETHODIMP
|
||||
nsCanvasRenderingContext2D::SetMozDash(JSContext *cx, const jsval& patternArray)
|
||||
{
|
||||
if (!EnsureSurface())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
AutoFallibleTArray<gfxFloat, 10> dashes;
|
||||
nsresult rv = JSValToDashArray(cx, patternArray, dashes);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
|
@ -3146,6 +3311,9 @@ nsCanvasRenderingContext2D::SetMozDash(JSContext *cx, const jsval& patternArray)
|
|||
NS_IMETHODIMP
|
||||
nsCanvasRenderingContext2D::GetMozDash(JSContext* cx, jsval* dashArray)
|
||||
{
|
||||
if (!EnsureSurface())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
AutoFallibleTArray<gfxFloat, 10> dashes;
|
||||
if (!mThebes->CurrentDash(dashes, nsnull)) {
|
||||
dashes.SetLength(0);
|
||||
|
@ -3156,6 +3324,9 @@ nsCanvasRenderingContext2D::GetMozDash(JSContext* cx, jsval* dashArray)
|
|||
NS_IMETHODIMP
|
||||
nsCanvasRenderingContext2D::SetMozDashOffset(float offset)
|
||||
{
|
||||
if (!EnsureSurface())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
if (!FloatValidate(offset)) {
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
}
|
||||
|
@ -3180,6 +3351,9 @@ nsCanvasRenderingContext2D::SetMozDashOffset(float offset)
|
|||
NS_IMETHODIMP
|
||||
nsCanvasRenderingContext2D::GetMozDashOffset(float* offset)
|
||||
{
|
||||
if (!EnsureSurface())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
*offset = float(mThebes->CurrentDashOffset());
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -3187,6 +3361,9 @@ nsCanvasRenderingContext2D::GetMozDashOffset(float* offset)
|
|||
NS_IMETHODIMP
|
||||
nsCanvasRenderingContext2D::IsPointInPath(float x, float y, PRBool *retVal)
|
||||
{
|
||||
if (!EnsureSurface())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
if (!FloatValidate(x,y)) {
|
||||
*retVal = PR_FALSE;
|
||||
return NS_OK;
|
||||
|
@ -3214,6 +3391,9 @@ nsCanvasRenderingContext2D::DrawImage(nsIDOMElement *imgElt, float a1,
|
|||
float a6, float a7, float a8,
|
||||
PRUint8 optional_argc)
|
||||
{
|
||||
if (!EnsureSurface())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
if (!imgElt) {
|
||||
return NS_ERROR_DOM_TYPE_MISMATCH_ERR;
|
||||
}
|
||||
|
@ -3398,6 +3578,9 @@ nsCanvasRenderingContext2D::DrawImage(nsIDOMElement *imgElt, float a1,
|
|||
NS_IMETHODIMP
|
||||
nsCanvasRenderingContext2D::SetGlobalCompositeOperation(const nsAString& op)
|
||||
{
|
||||
if (!EnsureSurface())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
gfxContext::GraphicsOperator thebes_op;
|
||||
|
||||
#define CANVAS_OP_TO_THEBES_OP(cvsop,thebesop) \
|
||||
|
@ -3427,6 +3610,9 @@ nsCanvasRenderingContext2D::SetGlobalCompositeOperation(const nsAString& op)
|
|||
NS_IMETHODIMP
|
||||
nsCanvasRenderingContext2D::GetGlobalCompositeOperation(nsAString& op)
|
||||
{
|
||||
if (!EnsureSurface())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
gfxContext::GraphicsOperator thebes_op = mThebes->CurrentOperator();
|
||||
|
||||
#define CANVAS_OP_TO_THEBES_OP(cvsop,thebesop) \
|
||||
|
@ -3457,6 +3643,9 @@ nsCanvasRenderingContext2D::DrawWindow(nsIDOMWindow* aWindow, float aX, float aY
|
|||
const nsAString& aBGColor,
|
||||
PRUint32 flags)
|
||||
{
|
||||
if (!EnsureSurface())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
NS_ENSURE_ARG(aWindow != nsnull);
|
||||
|
||||
// protect against too-large surfaces that will cause allocation
|
||||
|
@ -3547,6 +3736,9 @@ nsCanvasRenderingContext2D::AsyncDrawXULElement(nsIDOMXULElement* aElem, float a
|
|||
const nsAString& aBGColor,
|
||||
PRUint32 flags)
|
||||
{
|
||||
if (!EnsureSurface())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
NS_ENSURE_ARG(aElem != nsnull);
|
||||
|
||||
// We can't allow web apps to call this until we fix at least the
|
||||
|
@ -3660,7 +3852,7 @@ NS_IMETHODIMP
|
|||
nsCanvasRenderingContext2D::GetImageData_explicit(PRInt32 x, PRInt32 y, PRUint32 w, PRUint32 h,
|
||||
PRUint8 *aData, PRUint32 aDataLen)
|
||||
{
|
||||
if (!mValid)
|
||||
if (!EnsureSurface())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
if (!mCanvasElement && !mDocShell) {
|
||||
|
@ -3792,7 +3984,7 @@ nsCanvasRenderingContext2D::PutImageData_explicit(PRInt32 x, PRInt32 y, PRUint32
|
|||
PRBool hasDirtyRect, PRInt32 dirtyX, PRInt32 dirtyY,
|
||||
PRInt32 dirtyWidth, PRInt32 dirtyHeight)
|
||||
{
|
||||
if (!mValid)
|
||||
if (!EnsureSurface())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
if (w == 0 || h == 0)
|
||||
|
@ -3898,7 +4090,7 @@ nsCanvasRenderingContext2D::PutImageData_explicit(PRInt32 x, PRInt32 y, PRUint32
|
|||
NS_IMETHODIMP
|
||||
nsCanvasRenderingContext2D::GetThebesSurface(gfxASurface **surface)
|
||||
{
|
||||
if (!mSurface) {
|
||||
if (!EnsureSurface()) {
|
||||
*surface = nsnull;
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
@ -3954,7 +4146,7 @@ nsCanvasRenderingContext2D::GetCanvasLayer(nsDisplayListBuilder* aBuilder,
|
|||
CanvasLayer *aOldLayer,
|
||||
LayerManager *aManager)
|
||||
{
|
||||
if (!mValid)
|
||||
if (!EnsureSurface())
|
||||
return nsnull;
|
||||
|
||||
if (!mResetLayer && aOldLayer &&
|
||||
|
|
|
@ -605,8 +605,7 @@ protected:
|
|||
* Gets the pres shell from either the canvas element or the doc shell
|
||||
*/
|
||||
nsIPresShell *GetPresShell() {
|
||||
nsCOMPtr<nsIContent> content =
|
||||
do_QueryInterface(static_cast<nsIDOMHTMLCanvasElement*>(mCanvasElement));
|
||||
nsCOMPtr<nsIContent> content = do_QueryObject(mCanvasElement);
|
||||
if (content) {
|
||||
nsIDocument* ownerDoc = content->GetOwnerDoc();
|
||||
return ownerDoc ? ownerDoc->GetShell() : nsnull;
|
||||
|
@ -1235,8 +1234,7 @@ nsCanvasRenderingContext2DAzure::SetDimensions(PRInt32 width, PRInt32 height)
|
|||
if (size.width <= 0xFFFF && size.height <= 0xFFFF &&
|
||||
size.width >= 0 && size.height >= 0) {
|
||||
SurfaceFormat format = GetSurfaceFormat();
|
||||
nsCOMPtr<nsIContent> content =
|
||||
do_QueryInterface(static_cast<nsIDOMHTMLCanvasElement*>(mCanvasElement));
|
||||
nsCOMPtr<nsIContent> content = do_QueryObject(mCanvasElement);
|
||||
nsIDocument* ownerDoc = nsnull;
|
||||
if (content) {
|
||||
ownerDoc = content->GetOwnerDoc();
|
||||
|
|
|
@ -85,7 +85,8 @@ if (!gl) {
|
|||
testPassed("Successfully enabled OES_texture_float extension");
|
||||
runTextureCreationTest(testProgram, true);
|
||||
runRenderTargetTest(testProgram);
|
||||
runUniqueObjectTest();
|
||||
// bug 683216, see the discussion in bug 630672
|
||||
// runUniqueObjectTest();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
# HG changeset patch
|
||||
# Parent 6c8a909977d32284bbddd60a45e1780e824b5d7c
|
||||
diff --git a/content/canvas/test/webgl/conformance/oes-texture-float.html b/content/canvas/test/webgl/conformance/oes-texture-float.html
|
||||
--- a/content/canvas/test/webgl/conformance/oes-texture-float.html
|
||||
+++ b/content/canvas/test/webgl/conformance/oes-texture-float.html
|
||||
@@ -80,17 +80,18 @@ if (!gl) {
|
||||
runTextureCreationTest(testProgram, false);
|
||||
|
||||
if (!gl.getExtension("OES_texture_float")) {
|
||||
testPassed("No OES_texture_float support -- this is legal");
|
||||
} else {
|
||||
testPassed("Successfully enabled OES_texture_float extension");
|
||||
runTextureCreationTest(testProgram, true);
|
||||
runRenderTargetTest(testProgram);
|
||||
- runUniqueObjectTest();
|
||||
+ // bug 683216, see the discussion in bug 630672
|
||||
+ // runUniqueObjectTest();
|
||||
}
|
||||
}
|
||||
|
||||
// Needs to be global for shouldBe to see it.
|
||||
var pixels;
|
||||
|
||||
function allocateTexture()
|
||||
{
|
|
@ -1214,8 +1214,7 @@ nsHTMLFormElement::AddElement(nsGenericHTMLFormElement* aChild,
|
|||
// If the element is subject to constraint validaton and is invalid, we need
|
||||
// to update our internal counter.
|
||||
if (aUpdateValidity) {
|
||||
nsCOMPtr<nsIConstraintValidation> cvElmt =
|
||||
do_QueryInterface(static_cast<nsGenericHTMLElement*>(aChild));
|
||||
nsCOMPtr<nsIConstraintValidation> cvElmt = do_QueryObject(aChild);
|
||||
if (cvElmt &&
|
||||
cvElmt->IsCandidateForConstraintValidation() && !cvElmt->IsValid()) {
|
||||
UpdateValidity(PR_FALSE);
|
||||
|
@ -1301,8 +1300,7 @@ nsHTMLFormElement::RemoveElement(nsGenericHTMLFormElement* aChild,
|
|||
// If the element was subject to constraint validaton and is invalid, we need
|
||||
// to update our internal counter.
|
||||
if (aUpdateValidity) {
|
||||
nsCOMPtr<nsIConstraintValidation> cvElmt =
|
||||
do_QueryInterface(static_cast<nsGenericHTMLElement*>(aChild));
|
||||
nsCOMPtr<nsIConstraintValidation> cvElmt = do_QueryObject(aChild);
|
||||
if (cvElmt &&
|
||||
cvElmt->IsCandidateForConstraintValidation() && !cvElmt->IsValid()) {
|
||||
UpdateValidity(PR_TRUE);
|
||||
|
@ -2350,8 +2348,7 @@ nsFormControlList::AddElementToTable(nsGenericHTMLFormElement* aChild,
|
|||
list->AppendElement(newFirst ? content : aChild);
|
||||
|
||||
|
||||
nsCOMPtr<nsISupports> listSupports =
|
||||
do_QueryInterface(static_cast<nsIDOMNodeList*>(list));
|
||||
nsCOMPtr<nsISupports> listSupports = do_QueryObject(list);
|
||||
|
||||
// Replace the element with the list.
|
||||
NS_ENSURE_TRUE(mNameLookupTable.Put(aName, listSupports),
|
||||
|
|
|
@ -2255,8 +2255,7 @@ ImageContainer* nsHTMLMediaElement::GetImageContainer()
|
|||
return nsnull;
|
||||
|
||||
// Only video frames need an image container.
|
||||
nsCOMPtr<nsIDOMHTMLVideoElement> video =
|
||||
do_QueryInterface(static_cast<nsIContent*>(this));
|
||||
nsCOMPtr<nsIDOMHTMLVideoElement> video = do_QueryObject(this);
|
||||
if (!video)
|
||||
return nsnull;
|
||||
|
||||
|
@ -2283,7 +2282,7 @@ nsresult nsHTMLMediaElement::DispatchAudioAvailableEvent(float* aFrameBuffer,
|
|||
nsAutoArrayPtr<float> frameBuffer(aFrameBuffer);
|
||||
|
||||
nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(GetOwnerDoc());
|
||||
nsCOMPtr<nsIDOMEventTarget> target(do_QueryInterface(static_cast<nsIContent*>(this)));
|
||||
nsCOMPtr<nsIDOMEventTarget> target(do_QueryObject(this));
|
||||
NS_ENSURE_TRUE(domDoc && target, NS_ERROR_INVALID_ARG);
|
||||
|
||||
nsCOMPtr<nsIDOMEvent> event;
|
||||
|
@ -2496,8 +2495,7 @@ void nsHTMLMediaElement::NotifyAddedSource()
|
|||
nsIContent* nsHTMLMediaElement::GetNextSource()
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
nsCOMPtr<nsIDOMNode> thisDomNode =
|
||||
do_QueryInterface(static_cast<nsGenericElement*>(this));
|
||||
nsCOMPtr<nsIDOMNode> thisDomNode = do_QueryObject(this);
|
||||
|
||||
mSourceLoadCandidate = nsnull;
|
||||
|
||||
|
|
|
@ -330,10 +330,13 @@ function MediaTestManager() {
|
|||
// to start every test, but if you call started() you *must* call finish()
|
||||
// else you'll timeout.
|
||||
this.runTests = function(tests, startTest) {
|
||||
this.startTime = new Date();
|
||||
SimpleTest.info("Started " + this.startTime + " (" + this.startTime.getTime()/1000 + "s)");
|
||||
this.testNum = 0;
|
||||
this.tests = tests;
|
||||
this.startTest = startTest;
|
||||
this.tokens = [];
|
||||
this.isShutdown = false;
|
||||
// Always wait for explicit finish.
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
this.nextTest();
|
||||
|
@ -355,7 +358,7 @@ function MediaTestManager() {
|
|||
// Remove the element from the list of running tests.
|
||||
this.tokens.splice(i, 1);
|
||||
}
|
||||
if (this.tokens.length == 0) {
|
||||
if (this.tokens.length < PARALLEL_TESTS) {
|
||||
this.nextTest();
|
||||
}
|
||||
}
|
||||
|
@ -368,14 +371,7 @@ function MediaTestManager() {
|
|||
// thread stacks' address space.
|
||||
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
||||
Components.utils.forceGC();
|
||||
if (this.testNum == this.tests.length && !DEBUG_TEST_LOOP_FOREVER) {
|
||||
if (this.onFinished) {
|
||||
this.onFinished();
|
||||
}
|
||||
mediaTestCleanup();
|
||||
SimpleTest.finish();
|
||||
return;
|
||||
}
|
||||
|
||||
while (this.testNum < this.tests.length && this.tokens.length < PARALLEL_TESTS) {
|
||||
var test = this.tests[this.testNum];
|
||||
var token = (test.name ? (test.name + "-"): "") + this.testNum;
|
||||
|
@ -391,11 +387,23 @@ function MediaTestManager() {
|
|||
|
||||
// Do the init. This should start the test.
|
||||
this.startTest(test, token);
|
||||
|
||||
}
|
||||
if (this.tokens.length == 0) {
|
||||
// No tests were added, we must have tried everything, exit.
|
||||
|
||||
if (this.testNum == this.tests.length &&
|
||||
!DEBUG_TEST_LOOP_FOREVER &&
|
||||
this.tokens.length == 0 &&
|
||||
!this.isShutdown)
|
||||
{
|
||||
this.isShutdown = true;
|
||||
if (this.onFinished) {
|
||||
this.onFinished();
|
||||
}
|
||||
mediaTestCleanup();
|
||||
var end = new Date();
|
||||
SimpleTest.info("Finished at " + end + " (" + (end.getTime() / 1000) + "s)");
|
||||
SimpleTest.info("Running time: " + (end.getTime() - this.startTime.getTime())/1000 + "s");
|
||||
SimpleTest.finish();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2343,16 +2343,14 @@ nsSVGElement::GetAnimatedAttr(PRInt32 aNamespaceID, nsIAtom* aName)
|
|||
// Transforms:
|
||||
nsCOMPtr<nsIDOMSVGAnimatedTransformList> transformList;
|
||||
if (aName == nsGkAtoms::transform) {
|
||||
nsCOMPtr<nsIDOMSVGTransformable> transformable(
|
||||
do_QueryInterface(static_cast<nsIContent*>(this)));
|
||||
nsCOMPtr<nsIDOMSVGTransformable> transformable(do_QueryObject(this));
|
||||
if (!transformable)
|
||||
return nsnull;
|
||||
nsresult rv = transformable->GetTransform(getter_AddRefs(transformList));
|
||||
NS_ENSURE_SUCCESS(rv, nsnull);
|
||||
}
|
||||
if (aName == nsGkAtoms::gradientTransform) {
|
||||
nsCOMPtr<nsIDOMSVGGradientElement> gradientElement(
|
||||
do_QueryInterface(static_cast<nsIContent*>(this)));
|
||||
nsCOMPtr<nsIDOMSVGGradientElement> gradientElement(do_QueryObject(this));
|
||||
if (!gradientElement)
|
||||
return nsnull;
|
||||
|
||||
|
@ -2360,8 +2358,7 @@ nsSVGElement::GetAnimatedAttr(PRInt32 aNamespaceID, nsIAtom* aName)
|
|||
NS_ENSURE_SUCCESS(rv, nsnull);
|
||||
}
|
||||
if (aName == nsGkAtoms::patternTransform) {
|
||||
nsCOMPtr<nsIDOMSVGPatternElement> patternElement(
|
||||
do_QueryInterface(static_cast<nsIContent*>(this)));
|
||||
nsCOMPtr<nsIDOMSVGPatternElement> patternElement(do_QueryObject(this));
|
||||
if (!patternElement)
|
||||
return nsnull;
|
||||
|
||||
|
|
|
@ -580,8 +580,7 @@ nsXULElement::IsFocusable(PRInt32 *aTabIndex, PRBool aWithMouse)
|
|||
return PR_FALSE;
|
||||
#endif
|
||||
|
||||
nsCOMPtr<nsIDOMXULControlElement> xulControl =
|
||||
do_QueryInterface(static_cast<nsIContent*>(this));
|
||||
nsCOMPtr<nsIDOMXULControlElement> xulControl = do_QueryObject(this);
|
||||
if (xulControl) {
|
||||
// a disabled element cannot be focused and is not part of the tab order
|
||||
PRBool disabled;
|
||||
|
@ -958,7 +957,7 @@ nsXULElement::RemoveChildAt(PRUint32 aIndex, PRBool aNotify)
|
|||
// and cells going away.
|
||||
// First, retrieve the tree.
|
||||
// Check first whether this element IS the tree
|
||||
controlElement = do_QueryInterface(static_cast<nsIContent*>(this));
|
||||
controlElement = do_QueryObject(this);
|
||||
|
||||
// If it's not, look at our parent
|
||||
if (!controlElement)
|
||||
|
@ -2057,7 +2056,7 @@ NS_IMETHODIMP
|
|||
nsXULElement::Focus()
|
||||
{
|
||||
nsIFocusManager* fm = nsFocusManager::GetFocusManager();
|
||||
nsCOMPtr<nsIDOMElement> elem = do_QueryInterface(static_cast<nsIContent*>(this));
|
||||
nsCOMPtr<nsIDOMElement> elem = do_QueryObject(this);
|
||||
return fm ? fm->SetFocus(this, 0) : NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -379,7 +379,7 @@ bool nsDSURIContentListener::CheckFrameOptions(nsIRequest* request)
|
|||
|
||||
// cancel the load and display about:blank
|
||||
httpChannel->Cancel(NS_BINDING_ABORTED);
|
||||
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(static_cast<nsIDocShell*>(mDocShell)));
|
||||
nsCOMPtr<nsIWebNavigation> webNav(do_QueryObject(mDocShell));
|
||||
if (webNav) {
|
||||
webNav->LoadURI(NS_LITERAL_STRING("about:blank").get(),
|
||||
0, nsnull, nsnull, nsnull);
|
||||
|
|
|
@ -103,6 +103,8 @@ nsDOMMemoryReporter::GetAmount(PRInt64* aAmount) {
|
|||
*aAmount = 0;
|
||||
|
||||
nsGlobalWindow::WindowByIdTable* windows = nsGlobalWindow::GetWindowsTable();
|
||||
NS_ENSURE_TRUE(windows, NS_OK);
|
||||
|
||||
windows->Enumerate(GetWindowsMemoryUsage, aAmount);
|
||||
|
||||
return NS_OK;
|
||||
|
|
|
@ -1101,8 +1101,7 @@ nsGlobalWindow::CleanUp(PRBool aIgnoreModalDialog)
|
|||
{
|
||||
if (IsOuterWindow() && !aIgnoreModalDialog) {
|
||||
nsGlobalWindow* inner = GetCurrentInnerWindowInternal();
|
||||
nsCOMPtr<nsIDOMModalContentWindow>
|
||||
dlg(do_QueryInterface(static_cast<nsPIDOMWindow*>(inner)));
|
||||
nsCOMPtr<nsIDOMModalContentWindow> dlg(do_QueryObject(inner));
|
||||
if (dlg) {
|
||||
// The window we're trying to clean up is the outer window of a
|
||||
// modal dialog. Defer cleanup until the window closes, and let
|
||||
|
@ -9779,8 +9778,7 @@ nsGlobalWindow::BuildURIfromBase(const char *aURL, nsIURI **aBuiltURI,
|
|||
if (!scx || !mDocument)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIDOMChromeWindow> chrome_win =
|
||||
do_QueryInterface(static_cast<nsIDOMWindow *>(this));
|
||||
nsCOMPtr<nsIDOMChromeWindow> chrome_win = do_QueryObject(this);
|
||||
|
||||
if (nsContentUtils::IsCallerChrome() && !chrome_win) {
|
||||
// If open() is called from chrome on a non-chrome window, we'll
|
||||
|
|
|
@ -290,8 +290,7 @@ AsyncConnectionHelper::Run()
|
|||
#ifdef DEBUG
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsCOMPtr<nsISupports> handlerSupports(do_QueryInterface(handler));
|
||||
nsCOMPtr<nsISupports> thisSupports =
|
||||
do_QueryInterface(static_cast<nsIRunnable*>(this));
|
||||
nsCOMPtr<nsISupports> thisSupports = do_QueryObject(this);
|
||||
NS_ASSERTION(thisSupports == handlerSupports, "Mismatch!");
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -687,8 +687,10 @@ bool
|
|||
ContentChild::RecvAddPermission(const IPC::Permission& permission)
|
||||
{
|
||||
#if MOZ_PERMISSIONS
|
||||
nsRefPtr<nsPermissionManager> permissionManager =
|
||||
nsPermissionManager::GetSingleton();
|
||||
nsCOMPtr<nsIPermissionManager> permissionManagerIface =
|
||||
do_GetService(NS_PERMISSIONMANAGER_CONTRACTID);
|
||||
nsPermissionManager* permissionManager =
|
||||
static_cast<nsPermissionManager*>(permissionManagerIface.get());
|
||||
NS_ABORT_IF_FALSE(permissionManager,
|
||||
"We have no permissionManager in the Content process !");
|
||||
|
||||
|
|
|
@ -269,6 +269,7 @@ ContentParent::OnChannelConnected(int32 pid)
|
|||
}
|
||||
|
||||
namespace {
|
||||
|
||||
void
|
||||
DelayedDeleteSubprocess(GeckoChildProcessHost* aSubprocess)
|
||||
{
|
||||
|
@ -276,6 +277,20 @@ DelayedDeleteSubprocess(GeckoChildProcessHost* aSubprocess)
|
|||
->PostTask(FROM_HERE,
|
||||
new DeleteTask<GeckoChildProcessHost>(aSubprocess));
|
||||
}
|
||||
|
||||
// This runnable only exists to delegate ownership of the
|
||||
// ContentParent to this runnable, until it's deleted by the event
|
||||
// system.
|
||||
struct DelayedDeleteContentParentTask : public nsRunnable
|
||||
{
|
||||
DelayedDeleteContentParentTask(ContentParent* aObj) : mObj(aObj) { }
|
||||
|
||||
// No-op
|
||||
NS_IMETHODIMP Run() { return NS_OK; }
|
||||
|
||||
nsRefPtr<ContentParent> mObj;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -366,6 +381,15 @@ ContentParent::ActorDestroy(ActorDestroyReason why)
|
|||
PostTask(FROM_HERE,
|
||||
NewRunnableFunction(DelayedDeleteSubprocess, mSubprocess));
|
||||
mSubprocess = NULL;
|
||||
|
||||
// IPDL rules require actors to live on past ActorDestroy, but it
|
||||
// may be that the kungFuDeathGrip above is the last reference to
|
||||
// |this|. If so, when we go out of scope here, we're deleted and
|
||||
// all hell breaks loose.
|
||||
//
|
||||
// This runnable ensures that a reference to |this| lives on at
|
||||
// least until after the current task finishes running.
|
||||
NS_DispatchToCurrentThread(new DelayedDeleteContentParentTask(this));
|
||||
}
|
||||
|
||||
TabParent*
|
||||
|
@ -455,8 +479,10 @@ bool
|
|||
ContentParent::RecvReadPermissions(InfallibleTArray<IPC::Permission>* aPermissions)
|
||||
{
|
||||
#ifdef MOZ_PERMISSIONS
|
||||
nsRefPtr<nsPermissionManager> permissionManager =
|
||||
nsPermissionManager::GetSingleton();
|
||||
nsCOMPtr<nsIPermissionManager> permissionManagerIface =
|
||||
do_GetService(NS_PERMISSIONMANAGER_CONTRACTID);
|
||||
nsPermissionManager* permissionManager =
|
||||
static_cast<nsPermissionManager*>(permissionManagerIface.get());
|
||||
NS_ABORT_IF_FALSE(permissionManager,
|
||||
"We have no permissionManager in the Chrome process !");
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@
|
|||
#endif
|
||||
|
||||
class nsIInputStream;
|
||||
class nsIntRect;
|
||||
struct nsIntRect;
|
||||
class nsPluginDOMContextMenuListener;
|
||||
class nsObjectFrame;
|
||||
class nsDisplayListBuilder;
|
||||
|
|
|
@ -408,7 +408,7 @@ nsEditorEventListener::MouseClick(nsIDOMEvent* aMouseEvent)
|
|||
|
||||
nsCOMPtr<nsIEditorMailSupport> mailEditor;
|
||||
if (ctrlKey)
|
||||
mailEditor = do_QueryInterface(static_cast<nsIEditor*>(mEditor));
|
||||
mailEditor = do_QueryObject(mEditor);
|
||||
|
||||
PRInt32 clipboard;
|
||||
|
||||
|
|
|
@ -67,10 +67,8 @@
|
|||
nsresult
|
||||
nsHTMLEditorEventListener::Connect(nsEditor* aEditor)
|
||||
{
|
||||
nsCOMPtr<nsIHTMLEditor> htmlEditor =
|
||||
do_QueryInterface(static_cast<nsIEditor*>(aEditor));
|
||||
nsCOMPtr<nsIHTMLInlineTableEditor> htmlInlineTableEditor =
|
||||
do_QueryInterface(static_cast<nsIEditor*>(aEditor));
|
||||
nsCOMPtr<nsIHTMLEditor> htmlEditor = do_QueryObject(aEditor);
|
||||
nsCOMPtr<nsIHTMLInlineTableEditor> htmlInlineTableEditor = do_QueryObject(aEditor);
|
||||
NS_PRECONDITION(htmlEditor && htmlInlineTableEditor,
|
||||
"Set nsHTMLEditor or its sub class");
|
||||
return nsEditorEventListener::Connect(aEditor);
|
||||
|
|
|
@ -367,16 +367,18 @@ nsCookiePermission::CanSetCookie(nsIURI *aURI,
|
|||
}
|
||||
|
||||
PRBool rememberDecision = PR_FALSE;
|
||||
PRInt32 dialogRes = nsICookiePromptService::DENY_COOKIE;
|
||||
rv = cookiePromptService->CookieDialog(parent, aCookie, hostPort,
|
||||
countFromHost, foundCookie,
|
||||
&rememberDecision, aResult);
|
||||
&rememberDecision, &dialogRes);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (*aResult == nsICookiePromptService::ACCEPT_SESSION_COOKIE)
|
||||
|
||||
*aResult = !!dialogRes;
|
||||
if (dialogRes == nsICookiePromptService::ACCEPT_SESSION_COOKIE)
|
||||
*aIsSession = PR_TRUE;
|
||||
|
||||
if (rememberDecision) {
|
||||
switch (*aResult) {
|
||||
switch (dialogRes) {
|
||||
case nsICookiePromptService::DENY_COOKIE:
|
||||
mPermMgr->Add(aURI, kPermissionType, (PRUint32) nsIPermissionManager::DENY_ACTION,
|
||||
nsIPermissionManager::EXPIRE_NEVER, 0);
|
||||
|
|
|
@ -114,7 +114,7 @@ nsCookiePromptService::CookieDialog(nsIDOMWindow *aParent,
|
|||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// get back output parameters
|
||||
PRBool tempValue;
|
||||
PRInt32 tempValue;
|
||||
block->GetInt(nsICookieAcceptDialog::ACCEPT_COOKIE, &tempValue);
|
||||
*aAccept = tempValue;
|
||||
|
||||
|
|
|
@ -159,18 +159,12 @@ nsPermissionManager::nsPermissionManager()
|
|||
nsPermissionManager::~nsPermissionManager()
|
||||
{
|
||||
RemoveAllFromMemory();
|
||||
gPermissionManager = nsnull;
|
||||
}
|
||||
|
||||
// static
|
||||
nsIPermissionManager*
|
||||
nsPermissionManager::GetXPCOMSingleton()
|
||||
{
|
||||
return GetSingleton().get();
|
||||
}
|
||||
|
||||
// static
|
||||
already_AddRefed<nsPermissionManager>
|
||||
nsPermissionManager::GetSingleton()
|
||||
{
|
||||
if (gPermissionManager) {
|
||||
NS_ADDREF(gPermissionManager);
|
||||
|
@ -798,7 +792,7 @@ NS_IMETHODIMP nsPermissionManager::Observe(nsISupports *aSubject, const char *aT
|
|||
} else {
|
||||
RemoveAllFromMemory();
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!nsCRT::strcmp(aTopic, "profile-do-change")) {
|
||||
// the profile has already changed; init the db from the new location
|
||||
InitDB(PR_FALSE);
|
||||
|
|
|
@ -168,7 +168,6 @@ public:
|
|||
nsPermissionManager();
|
||||
virtual ~nsPermissionManager();
|
||||
static nsIPermissionManager* GetXPCOMSingleton();
|
||||
static already_AddRefed<nsPermissionManager> GetSingleton();
|
||||
nsresult Init();
|
||||
|
||||
// enums for AddInternal()
|
||||
|
|
|
@ -1,38 +1,42 @@
|
|||
# This is the official list of people who can contribute
|
||||
# (and who have contributed) code to the ANGLE project
|
||||
# repository.
|
||||
# The AUTHORS file lists the copyright holders; this file
|
||||
# lists people. For example, Google employees are listed here
|
||||
# but not in AUTHORS, because Google holds the copyright.
|
||||
#
|
||||
|
||||
TransGaming Inc.
|
||||
Nicolas Capens
|
||||
Daniel Koch
|
||||
Andrew Lewycky
|
||||
Gavriel State
|
||||
Shannon Woods
|
||||
|
||||
Google Inc.
|
||||
Brent Austin
|
||||
John Bauman
|
||||
Henry Bridge
|
||||
Nat Duca
|
||||
Vangelis Kokkevis
|
||||
Alastair Patrick
|
||||
Alok Priyadarshi
|
||||
Kenneth Russell
|
||||
Ben Vanik
|
||||
Adrienne Walker
|
||||
|
||||
Mozilla Corp.
|
||||
Vladimir Vukicevic
|
||||
Benoit Jacob
|
||||
|
||||
Apple Inc.
|
||||
David Kilzer
|
||||
|
||||
Aitor Moreno <aitormoreno at gmail.com>
|
||||
Jim Hauxwell <james at dattrax.co.uk>
|
||||
ddefrostt
|
||||
timeless
|
||||
# This is the official list of people who can contribute
|
||||
# (and who have contributed) code to the ANGLE project
|
||||
# repository.
|
||||
# The AUTHORS file lists the copyright holders; this file
|
||||
# lists people. For example, Google employees are listed here
|
||||
# but not in AUTHORS, because Google holds the copyright.
|
||||
#
|
||||
|
||||
TransGaming Inc.
|
||||
Nicolas Capens
|
||||
Daniel Koch
|
||||
Andrew Lewycky
|
||||
Gavriel State
|
||||
Shannon Woods
|
||||
|
||||
Google Inc.
|
||||
Brent Austin
|
||||
John Bauman
|
||||
Henry Bridge
|
||||
Nat Duca
|
||||
Vangelis Kokkevis
|
||||
Zhenyao Mo
|
||||
Daniel Nicoara
|
||||
Alastair Patrick
|
||||
Alok Priyadarshi
|
||||
Kenneth Russell
|
||||
Ben Vanik
|
||||
Adrienne Walker
|
||||
|
||||
Mozilla Corp.
|
||||
Benoit Jacob
|
||||
Makoto Kato
|
||||
Vladimir Vukicevic
|
||||
|
||||
Apple Inc.
|
||||
David Kilzer
|
||||
|
||||
Aitor Moreno <aitormoreno at gmail.com>
|
||||
Jim Hauxwell <james at dattrax.co.uk>
|
||||
ddefrostt
|
||||
timeless
|
||||
Yore Apex
|
||||
|
|
|
@ -77,27 +77,31 @@ CPPSRCS = \
|
|||
RemoveTree.cpp \
|
||||
ShaderLang.cpp \
|
||||
SymbolTable.cpp \
|
||||
VariableInfo.cpp \
|
||||
compilerdebug.cpp \
|
||||
ossource_nspr.cpp \
|
||||
util.cpp \
|
||||
ValidateLimitations.cpp \
|
||||
ForLoopUnroll.cpp \
|
||||
MapLongVariableNames.cpp \
|
||||
$(NULL)
|
||||
VariableInfo.cpp \
|
||||
compilerdebug.cpp \
|
||||
ossource_nspr.cpp \
|
||||
util.cpp \
|
||||
ValidateLimitations.cpp \
|
||||
ForLoopUnroll.cpp \
|
||||
MapLongVariableNames.cpp \
|
||||
BuiltInFunctionEmulator.cpp \
|
||||
$(NULL)
|
||||
|
||||
# flex/yacc generated files
|
||||
CPPSRCS += \
|
||||
glslang_lex.cpp \
|
||||
glslang_tab.cpp \
|
||||
$(NULL)
|
||||
glslang_lex.cpp \
|
||||
glslang_tab.cpp \
|
||||
$(NULL)
|
||||
|
||||
# GLSL translator backend
|
||||
CPPSRCS += \
|
||||
CodeGenGLSL.cpp \
|
||||
OutputGLSL.cpp \
|
||||
TranslatorGLSL.cpp \
|
||||
VersionGLSL.cpp \
|
||||
CodeGenGLSL.cpp \
|
||||
OutputGLSL.cpp \
|
||||
TranslatorGLSL.cpp \
|
||||
VersionGLSL.cpp \
|
||||
OutputESSL.cpp \
|
||||
OutputGLSLBase.cpp \
|
||||
TranslatorESSL.cpp \
|
||||
$(NULL)
|
||||
|
||||
# Currently, only one or the other
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
This is the ANGLE project, from http://code.google.com/p/angleproject/.
|
||||
|
||||
Current revision: r686
|
||||
Current revision: r740
|
||||
|
||||
== Applied local patches ==
|
||||
|
||||
|
@ -8,15 +8,7 @@ In this order:
|
|||
angle-nspr-misc.patch - don't bother with ANGLE_OS detection with NSPR
|
||||
angle-renaming.patch - rename debug.h to compilerdebug.h to avoid conflict in our makefiles
|
||||
angle-intrinsic-msvc2005.patch - work around a MSVC 2005 compile error
|
||||
angle-amap-arev-fix.patch - plain bug fix, this is ANGLE r699
|
||||
angle-r702.patch - this is ANGLE r702
|
||||
angle-limit-identifiers-to-250-chars.patch - see bug 675625
|
||||
angle-r712.patch - this is ANGLE r712
|
||||
angle-win64.patch - Win64 support. This is ANGLE r697
|
||||
angle-r707.patch - this is ANGLE r707 for Win64 bug fix
|
||||
angle-r719.patch - this is ANGLE r719
|
||||
angle-r711.patch - this is ANGLE r711
|
||||
fix-angle-surface-assert.patch - this is ANGLE r739
|
||||
|
||||
In addition to these patches, the Makefile.in files are ours, they're not present in upsteam ANGLE.
|
||||
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
# HG changeset patch
|
||||
# Parent c88f8e8921fb6399cf95b5899d2acc60951dddd1
|
||||
Bug 665934 - fix bug: arev was meant instead of amap - r=upstream
|
||||
|
||||
This patch has been taken in ANGLE upstream as r699.
|
||||
|
||||
diff --git a/gfx/angle/src/compiler/preprocessor/atom.c b/gfx/angle/src/compiler/preprocessor/atom.c
|
||||
--- a/gfx/angle/src/compiler/preprocessor/atom.c
|
||||
+++ b/gfx/angle/src/compiler/preprocessor/atom.c
|
||||
@@ -330,17 +330,17 @@ static int GrowAtomTable(AtomTable *atab
|
||||
newrev = malloc(sizeof(int)*size);
|
||||
atable->size = 0;
|
||||
}
|
||||
if (!newmap || !newrev) {
|
||||
/* failed to grow -- error */
|
||||
if (newmap)
|
||||
atable->amap = newmap;
|
||||
if (newrev)
|
||||
- atable->amap = newrev;
|
||||
+ atable->arev = newrev;
|
||||
return -1;
|
||||
}
|
||||
memset(&newmap[atable->size], 0, (size - atable->size) * sizeof(int));
|
||||
memset(&newrev[atable->size], 0, (size - atable->size) * sizeof(int));
|
||||
atable->amap = newmap;
|
||||
atable->arev = newrev;
|
||||
atable->size = size;
|
||||
}
|
|
@ -1,84 +0,0 @@
|
|||
# HG changeset patch
|
||||
# Parent b410077eaab7f6f851ebefa26fd9e1df938026bb
|
||||
|
||||
diff --git a/gfx/angle/src/libGLESv2/VertexDataManager.cpp b/gfx/angle/src/libGLESv2/VertexDataManager.cpp
|
||||
--- a/gfx/angle/src/libGLESv2/VertexDataManager.cpp
|
||||
+++ b/gfx/angle/src/libGLESv2/VertexDataManager.cpp
|
||||
@@ -134,19 +134,33 @@ GLenum VertexDataManager::prepareVertexD
|
||||
if (staticBuffer->size() == 0)
|
||||
{
|
||||
int totalCount = buffer->size() / attribs[i].stride();
|
||||
staticBuffer->addRequiredSpace(spaceRequired(attribs[i], totalCount));
|
||||
}
|
||||
else if (staticBuffer->lookupAttribute(attribs[i]) == -1)
|
||||
{
|
||||
// This static buffer doesn't have matching attributes, so fall back to using the streaming buffer
|
||||
- mStreamingBuffer->addRequiredSpaceFor(staticBuffer);
|
||||
buffer->invalidateStaticData();
|
||||
|
||||
+ // Add the space of all previous attributes belonging to the invalidated static buffer to the streaming buffer
|
||||
+ for (int previous = 0; previous < i; previous++)
|
||||
+ {
|
||||
+ if (translated[previous].active && attribs[previous].mArrayEnabled)
|
||||
+ {
|
||||
+ Buffer *previousBuffer = attribs[previous].mBoundBuffer.get();
|
||||
+ StaticVertexBuffer *previousStaticBuffer = previousBuffer ? previousBuffer->getStaticVertexBuffer() : NULL;
|
||||
+
|
||||
+ if (staticBuffer == previousStaticBuffer)
|
||||
+ {
|
||||
+ mStreamingBuffer->addRequiredSpace(spaceRequired(attribs[previous], count));
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
mStreamingBuffer->addRequiredSpace(spaceRequired(attribs[i], count));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
mStreamingBuffer->addRequiredSpace(spaceRequired(attribs[i], count));
|
||||
}
|
||||
}
|
||||
@@ -578,21 +592,16 @@ ArrayVertexBuffer::~ArrayVertexBuffer()
|
||||
{
|
||||
}
|
||||
|
||||
void ArrayVertexBuffer::addRequiredSpace(UINT requiredSpace)
|
||||
{
|
||||
mRequiredSpace += requiredSpace;
|
||||
}
|
||||
|
||||
-void ArrayVertexBuffer::addRequiredSpaceFor(ArrayVertexBuffer *buffer)
|
||||
-{
|
||||
- mRequiredSpace += buffer->mRequiredSpace;
|
||||
-}
|
||||
-
|
||||
StreamingVertexBuffer::StreamingVertexBuffer(IDirect3DDevice9 *device, std::size_t initialSize) : ArrayVertexBuffer(device, initialSize, D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY)
|
||||
{
|
||||
}
|
||||
|
||||
StreamingVertexBuffer::~StreamingVertexBuffer()
|
||||
{
|
||||
}
|
||||
|
||||
diff --git a/gfx/angle/src/libGLESv2/VertexDataManager.h b/gfx/angle/src/libGLESv2/VertexDataManager.h
|
||||
--- a/gfx/angle/src/libGLESv2/VertexDataManager.h
|
||||
+++ b/gfx/angle/src/libGLESv2/VertexDataManager.h
|
||||
@@ -62,17 +62,16 @@ class ArrayVertexBuffer : public VertexB
|
||||
public:
|
||||
ArrayVertexBuffer(IDirect3DDevice9 *device, UINT size, DWORD usageFlags);
|
||||
~ArrayVertexBuffer();
|
||||
|
||||
UINT size() const { return mBufferSize; }
|
||||
virtual void *map(const VertexAttribute &attribute, UINT requiredSpace, UINT *streamOffset) = 0;
|
||||
virtual void reserveRequiredSpace() = 0;
|
||||
void addRequiredSpace(UINT requiredSpace);
|
||||
- void addRequiredSpaceFor(ArrayVertexBuffer *buffer);
|
||||
|
||||
protected:
|
||||
UINT mBufferSize;
|
||||
UINT mWritePosition;
|
||||
UINT mRequiredSpace;
|
||||
};
|
||||
|
||||
class StreamingVertexBuffer : public ArrayVertexBuffer
|
|
@ -1,45 +0,0 @@
|
|||
diff --git a/gfx/angle/src/libGLESv2/VertexDataManager.cpp b/gfx/angle/src/libGLESv2/VertexDataManager.cpp
|
||||
--- a/gfx/angle/src/libGLESv2/VertexDataManager.cpp
|
||||
+++ b/gfx/angle/src/libGLESv2/VertexDataManager.cpp
|
||||
@@ -714,17 +714,17 @@ void StaticVertexBuffer::reserveRequired
|
||||
{
|
||||
// Already allocated
|
||||
}
|
||||
else UNREACHABLE(); // Static vertex buffers can't be resized
|
||||
|
||||
mRequiredSpace = 0;
|
||||
}
|
||||
|
||||
-UINT StaticVertexBuffer::lookupAttribute(const VertexAttribute &attribute)
|
||||
+std::size_t StaticVertexBuffer::lookupAttribute(const VertexAttribute &attribute)
|
||||
{
|
||||
for (unsigned int element = 0; element < mCache.size(); element++)
|
||||
{
|
||||
if (mCache[element].type == attribute.mType && mCache[element].size == attribute.mSize && mCache[element].normalized == attribute.mNormalized)
|
||||
{
|
||||
if (mCache[element].attributeOffset == attribute.mOffset % attribute.stride())
|
||||
{
|
||||
return mCache[element].streamOffset;
|
||||
diff --git a/gfx/angle/src/libGLESv2/VertexDataManager.h b/gfx/angle/src/libGLESv2/VertexDataManager.h
|
||||
--- a/gfx/angle/src/libGLESv2/VertexDataManager.h
|
||||
+++ b/gfx/angle/src/libGLESv2/VertexDataManager.h
|
||||
@@ -88,17 +88,17 @@ class StaticVertexBuffer : public ArrayV
|
||||
{
|
||||
public:
|
||||
explicit StaticVertexBuffer(IDirect3DDevice9 *device);
|
||||
~StaticVertexBuffer();
|
||||
|
||||
void *map(const VertexAttribute &attribute, std::size_t requiredSpace, std::size_t *streamOffset);
|
||||
void reserveRequiredSpace();
|
||||
|
||||
- UINT lookupAttribute(const VertexAttribute &attribute); // Returns the offset into the vertex buffer, or -1 if not found
|
||||
+ std::size_t lookupAttribute(const VertexAttribute &attribute); // Returns the offset into the vertex buffer, or -1 if not found
|
||||
|
||||
private:
|
||||
struct VertexElement
|
||||
{
|
||||
GLenum type;
|
||||
GLint size;
|
||||
bool normalized;
|
||||
int attributeOffset;
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
# HG changeset patch
|
||||
# Parent 88a5c8710f5cffd568bc21226118cb567850ce28
|
||||
diff --git a/gfx/angle/src/libGLESv2/VertexDataManager.cpp b/gfx/angle/src/libGLESv2/VertexDataManager.cpp
|
||||
--- a/gfx/angle/src/libGLESv2/VertexDataManager.cpp
|
||||
+++ b/gfx/angle/src/libGLESv2/VertexDataManager.cpp
|
||||
@@ -134,34 +134,34 @@ GLenum VertexDataManager::prepareVertexD
|
||||
if (staticBuffer->size() == 0)
|
||||
{
|
||||
int totalCount = buffer->size() / attribs[i].stride();
|
||||
staticBuffer->addRequiredSpace(spaceRequired(attribs[i], totalCount));
|
||||
}
|
||||
else if (staticBuffer->lookupAttribute(attribs[i]) == -1)
|
||||
{
|
||||
// This static buffer doesn't have matching attributes, so fall back to using the streaming buffer
|
||||
- buffer->invalidateStaticData();
|
||||
-
|
||||
// Add the space of all previous attributes belonging to the invalidated static buffer to the streaming buffer
|
||||
for (int previous = 0; previous < i; previous++)
|
||||
{
|
||||
if (translated[previous].active && attribs[previous].mArrayEnabled)
|
||||
{
|
||||
Buffer *previousBuffer = attribs[previous].mBoundBuffer.get();
|
||||
StaticVertexBuffer *previousStaticBuffer = previousBuffer ? previousBuffer->getStaticVertexBuffer() : NULL;
|
||||
|
||||
if (staticBuffer == previousStaticBuffer)
|
||||
{
|
||||
mStreamingBuffer->addRequiredSpace(spaceRequired(attribs[previous], count));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mStreamingBuffer->addRequiredSpace(spaceRequired(attribs[i], count));
|
||||
+
|
||||
+ buffer->invalidateStaticData();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
mStreamingBuffer->addRequiredSpace(spaceRequired(attribs[i], count));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,9 +1,10 @@
|
|||
# HG changeset patch
|
||||
# Parent a0dd1332c0e6ebaf429f9a3732b8901f9e46cde0
|
||||
# Parent 96359f46b01fdb37e791f564495e8b2755a05233
|
||||
|
||||
diff --git a/gfx/angle/Makefile.in b/gfx/angle/Makefile.in
|
||||
--- a/gfx/angle/Makefile.in
|
||||
+++ b/gfx/angle/Makefile.in
|
||||
@@ -72,17 +72,17 @@ CPPSRCS = \
|
||||
@@ -73,17 +73,17 @@ CPPSRCS = \
|
||||
parseConst.cpp \
|
||||
ParseHelper.cpp \
|
||||
PoolAlloc.cpp \
|
||||
|
@ -11,44 +12,20 @@ diff --git a/gfx/angle/Makefile.in b/gfx/angle/Makefile.in
|
|||
RemoveTree.cpp \
|
||||
ShaderLang.cpp \
|
||||
SymbolTable.cpp \
|
||||
VariableInfo.cpp \
|
||||
- debug.cpp \
|
||||
+ compilerdebug.cpp \
|
||||
ossource_nspr.cpp \
|
||||
util.cpp \
|
||||
ValidateLimitations.cpp \
|
||||
ForLoopUnroll.cpp \
|
||||
MapLongVariableNames.cpp \
|
||||
$(NULL)
|
||||
VariableInfo.cpp \
|
||||
- debug.cpp \
|
||||
+ compilerdebug.cpp \
|
||||
ossource_nspr.cpp \
|
||||
util.cpp \
|
||||
ValidateLimitations.cpp \
|
||||
ForLoopUnroll.cpp \
|
||||
MapLongVariableNames.cpp \
|
||||
BuiltInFunctionEmulator.cpp \
|
||||
$(NULL)
|
||||
|
||||
# flex/yacc generated files
|
||||
diff --git a/gfx/angle/src/build_angle.gyp b/gfx/angle/src/build_angle.gyp
|
||||
--- a/gfx/angle/src/build_angle.gyp
|
||||
+++ b/gfx/angle/src/build_angle.gyp
|
||||
@@ -17,18 +17,18 @@
|
||||
'.',
|
||||
'../include',
|
||||
],
|
||||
'sources': [
|
||||
'compiler/BaseTypes.h',
|
||||
'compiler/Common.h',
|
||||
'compiler/Compiler.cpp',
|
||||
'compiler/ConstantUnion.h',
|
||||
- 'compiler/debug.cpp',
|
||||
- 'compiler/debug.h',
|
||||
+ 'compiler/compilerdebug.cpp',
|
||||
+ 'compiler/compilerdebug.h',
|
||||
'compiler/glslang.h',
|
||||
'compiler/glslang_lex.cpp',
|
||||
'compiler/glslang_tab.cpp',
|
||||
'compiler/glslang_tab.h',
|
||||
'compiler/InfoSink.cpp',
|
||||
'compiler/InfoSink.h',
|
||||
'compiler/Initialize.cpp',
|
||||
'compiler/Initialize.h',
|
||||
diff --git a/gfx/angle/src/compiler/OutputGLSL.cpp b/gfx/angle/src/compiler/OutputGLSL.cpp
|
||||
--- a/gfx/angle/src/compiler/OutputGLSL.cpp
|
||||
+++ b/gfx/angle/src/compiler/OutputGLSL.cpp
|
||||
diff --git a/gfx/angle/src/compiler/OutputGLSLBase.cpp b/gfx/angle/src/compiler/OutputGLSLBase.cpp
|
||||
--- a/gfx/angle/src/compiler/OutputGLSLBase.cpp
|
||||
+++ b/gfx/angle/src/compiler/OutputGLSLBase.cpp
|
||||
@@ -1,16 +1,16 @@
|
||||
//
|
||||
// Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved.
|
||||
|
@ -56,7 +33,7 @@ diff --git a/gfx/angle/src/compiler/OutputGLSL.cpp b/gfx/angle/src/compiler/Outp
|
|||
// found in the LICENSE file.
|
||||
//
|
||||
|
||||
#include "compiler/OutputGLSL.h"
|
||||
#include "compiler/OutputGLSLBase.h"
|
||||
-#include "compiler/debug.h"
|
||||
+#include "compiler/compilerdebug.h"
|
||||
|
||||
|
@ -157,7 +134,7 @@ diff --git a/gfx/angle/src/compiler/compilerdebug.h b/gfx/angle/src/compiler/com
|
|||
diff --git a/gfx/angle/src/compiler/osinclude.h b/gfx/angle/src/compiler/osinclude.h
|
||||
--- a/gfx/angle/src/compiler/osinclude.h
|
||||
+++ b/gfx/angle/src/compiler/osinclude.h
|
||||
@@ -30,17 +30,17 @@
|
||||
@@ -32,17 +32,17 @@
|
||||
#include <windows.h>
|
||||
#elif defined(ANGLE_OS_POSIX)
|
||||
#include <pthread.h>
|
||||
|
|
|
@ -1,235 +0,0 @@
|
|||
diff --git a/gfx/angle/src/libEGL/Surface.cpp b/gfx/angle/src/libEGL/Surface.cpp
|
||||
--- a/gfx/angle/src/libEGL/Surface.cpp
|
||||
+++ b/gfx/angle/src/libEGL/Surface.cpp
|
||||
@@ -285,17 +285,17 @@ void Surface::subclassWindow()
|
||||
DWORD processId;
|
||||
DWORD threadId = GetWindowThreadProcessId(mWindow, &processId);
|
||||
if (processId != GetCurrentProcessId() || threadId != GetCurrentThreadId())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
SetLastError(0);
|
||||
- LONG oldWndProc = SetWindowLong(mWindow, GWL_WNDPROC, reinterpret_cast<LONG>(SurfaceWindowProc));
|
||||
+ LONG_PTR oldWndProc = SetWindowLongPtr(mWindow, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(SurfaceWindowProc));
|
||||
if(oldWndProc == 0 && GetLastError() != ERROR_SUCCESS)
|
||||
{
|
||||
mWindowSubclassed = false;
|
||||
return;
|
||||
}
|
||||
|
||||
SetProp(mWindow, kSurfaceProperty, reinterpret_cast<HANDLE>(this));
|
||||
SetProp(mWindow, kParentWndProc, reinterpret_cast<HANDLE>(oldWndProc));
|
||||
@@ -305,27 +305,27 @@ void Surface::subclassWindow()
|
||||
void Surface::unsubclassWindow()
|
||||
{
|
||||
if(!mWindowSubclassed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// un-subclass
|
||||
- LONG parentWndFunc = reinterpret_cast<LONG>(GetProp(mWindow, kParentWndProc));
|
||||
+ LONG_PTR parentWndFunc = reinterpret_cast<LONG_PTR>(GetProp(mWindow, kParentWndProc));
|
||||
|
||||
// Check the windowproc is still SurfaceWindowProc.
|
||||
// If this assert fails, then it is likely the application has subclassed the
|
||||
// hwnd as well and did not unsubclass before destroying its EGL context. The
|
||||
// application should be modified to either subclass before initializing the
|
||||
// EGL context, or to unsubclass before destroying the EGL context.
|
||||
if(parentWndFunc)
|
||||
{
|
||||
- LONG prevWndFunc = SetWindowLong(mWindow, GWL_WNDPROC, parentWndFunc);
|
||||
- ASSERT(prevWndFunc == reinterpret_cast<LONG>(SurfaceWindowProc));
|
||||
+ LONG_PTR prevWndFunc = SetWindowLongPtr(mWindow, GWLP_WNDPROC, parentWndFunc);
|
||||
+ ASSERT(prevWndFunc == reinterpret_cast<LONG_PTR>(SurfaceWindowProc));
|
||||
}
|
||||
|
||||
RemoveProp(mWindow, kSurfaceProperty);
|
||||
RemoveProp(mWindow, kParentWndProc);
|
||||
mWindowSubclassed = false;
|
||||
}
|
||||
|
||||
bool Surface::checkForOutOfDateSwapChain()
|
||||
diff --git a/gfx/angle/src/libGLESv2/VertexDataManager.cpp b/gfx/angle/src/libGLESv2/VertexDataManager.cpp
|
||||
--- a/gfx/angle/src/libGLESv2/VertexDataManager.cpp
|
||||
+++ b/gfx/angle/src/libGLESv2/VertexDataManager.cpp
|
||||
@@ -50,24 +50,24 @@ VertexDataManager::~VertexDataManager()
|
||||
delete mStreamingBuffer;
|
||||
|
||||
for (int i = 0; i < MAX_VERTEX_ATTRIBS; i++)
|
||||
{
|
||||
delete mCurrentValueBuffer[i];
|
||||
}
|
||||
}
|
||||
|
||||
-UINT VertexDataManager::writeAttributeData(ArrayVertexBuffer *vertexBuffer, GLint start, GLsizei count, const VertexAttribute &attribute)
|
||||
+std::size_t VertexDataManager::writeAttributeData(ArrayVertexBuffer *vertexBuffer, GLint start, GLsizei count, const VertexAttribute &attribute)
|
||||
{
|
||||
Buffer *buffer = attribute.mBoundBuffer.get();
|
||||
|
||||
int inputStride = attribute.stride();
|
||||
int elementSize = attribute.typeSize();
|
||||
const FormatConverter &converter = formatConverter(attribute);
|
||||
- UINT streamOffset = 0;
|
||||
+ std::size_t streamOffset = 0;
|
||||
|
||||
void *output = NULL;
|
||||
|
||||
if (vertexBuffer)
|
||||
{
|
||||
output = vertexBuffer->map(attribute, spaceRequired(attribute, count), &streamOffset);
|
||||
}
|
||||
|
||||
@@ -198,17 +198,17 @@ GLenum VertexDataManager::prepareVertexD
|
||||
return GL_INVALID_OPERATION;
|
||||
}
|
||||
|
||||
const FormatConverter &converter = formatConverter(attribs[i]);
|
||||
|
||||
StaticVertexBuffer *staticBuffer = buffer ? buffer->getStaticVertexBuffer() : NULL;
|
||||
ArrayVertexBuffer *vertexBuffer = staticBuffer ? staticBuffer : static_cast<ArrayVertexBuffer*>(mStreamingBuffer);
|
||||
|
||||
- UINT streamOffset = -1;
|
||||
+ std::size_t streamOffset = -1;
|
||||
|
||||
if (staticBuffer)
|
||||
{
|
||||
streamOffset = staticBuffer->lookupAttribute(attribs[i]);
|
||||
|
||||
if (streamOffset == -1)
|
||||
{
|
||||
// Convert the entire buffer
|
||||
@@ -666,17 +666,17 @@ void StreamingVertexBuffer::reserveRequi
|
||||
StaticVertexBuffer::StaticVertexBuffer(IDirect3DDevice9 *device) : ArrayVertexBuffer(device, 0, D3DUSAGE_WRITEONLY)
|
||||
{
|
||||
}
|
||||
|
||||
StaticVertexBuffer::~StaticVertexBuffer()
|
||||
{
|
||||
}
|
||||
|
||||
-void *StaticVertexBuffer::map(const VertexAttribute &attribute, std::size_t requiredSpace, UINT *streamOffset)
|
||||
+void *StaticVertexBuffer::map(const VertexAttribute &attribute, std::size_t requiredSpace, std::size_t *streamOffset)
|
||||
{
|
||||
void *mapPtr = NULL;
|
||||
|
||||
if (mVertexBuffer)
|
||||
{
|
||||
HRESULT result = mVertexBuffer->Lock(mWritePosition, requiredSpace, &mapPtr, 0);
|
||||
|
||||
if (FAILED(result))
|
||||
diff --git a/gfx/angle/src/libGLESv2/VertexDataManager.h b/gfx/angle/src/libGLESv2/VertexDataManager.h
|
||||
--- a/gfx/angle/src/libGLESv2/VertexDataManager.h
|
||||
+++ b/gfx/angle/src/libGLESv2/VertexDataManager.h
|
||||
@@ -30,17 +30,17 @@ struct TranslatedAttribute
|
||||
UINT stride; // 0 means not to advance the read pointer at all
|
||||
|
||||
IDirect3DVertexBuffer9 *vertexBuffer;
|
||||
};
|
||||
|
||||
class VertexBuffer
|
||||
{
|
||||
public:
|
||||
- VertexBuffer(IDirect3DDevice9 *device, UINT size, DWORD usageFlags);
|
||||
+ VertexBuffer(IDirect3DDevice9 *device, std::size_t size, DWORD usageFlags);
|
||||
virtual ~VertexBuffer();
|
||||
|
||||
void unmap();
|
||||
|
||||
IDirect3DVertexBuffer9 *getBuffer() const;
|
||||
|
||||
protected:
|
||||
IDirect3DDevice9 *const mDevice;
|
||||
@@ -55,60 +55,60 @@ class ConstantVertexBuffer : public Vert
|
||||
public:
|
||||
ConstantVertexBuffer(IDirect3DDevice9 *device, float x, float y, float z, float w);
|
||||
~ConstantVertexBuffer();
|
||||
};
|
||||
|
||||
class ArrayVertexBuffer : public VertexBuffer
|
||||
{
|
||||
public:
|
||||
- ArrayVertexBuffer(IDirect3DDevice9 *device, UINT size, DWORD usageFlags);
|
||||
+ ArrayVertexBuffer(IDirect3DDevice9 *device, std::size_t size, DWORD usageFlags);
|
||||
~ArrayVertexBuffer();
|
||||
|
||||
- UINT size() const { return mBufferSize; }
|
||||
- virtual void *map(const VertexAttribute &attribute, UINT requiredSpace, UINT *streamOffset) = 0;
|
||||
+ std::size_t size() const { return mBufferSize; }
|
||||
+ virtual void *map(const VertexAttribute &attribute, std::size_t requiredSpace, std::size_t *streamOffset) = 0;
|
||||
virtual void reserveRequiredSpace() = 0;
|
||||
void addRequiredSpace(UINT requiredSpace);
|
||||
|
||||
protected:
|
||||
- UINT mBufferSize;
|
||||
- UINT mWritePosition;
|
||||
- UINT mRequiredSpace;
|
||||
+ std::size_t mBufferSize;
|
||||
+ std::size_t mWritePosition;
|
||||
+ std::size_t mRequiredSpace;
|
||||
};
|
||||
|
||||
class StreamingVertexBuffer : public ArrayVertexBuffer
|
||||
{
|
||||
public:
|
||||
- StreamingVertexBuffer(IDirect3DDevice9 *device, UINT initialSize);
|
||||
+ StreamingVertexBuffer(IDirect3DDevice9 *device, std::size_t initialSize);
|
||||
~StreamingVertexBuffer();
|
||||
|
||||
- void *map(const VertexAttribute &attribute, UINT requiredSpace, UINT *streamOffset);
|
||||
+ void *map(const VertexAttribute &attribute, std::size_t requiredSpace, std::size_t *streamOffset);
|
||||
void reserveRequiredSpace();
|
||||
};
|
||||
|
||||
class StaticVertexBuffer : public ArrayVertexBuffer
|
||||
{
|
||||
public:
|
||||
explicit StaticVertexBuffer(IDirect3DDevice9 *device);
|
||||
~StaticVertexBuffer();
|
||||
|
||||
- void *map(const VertexAttribute &attribute, UINT requiredSpace, UINT *streamOffset);
|
||||
+ void *map(const VertexAttribute &attribute, std::size_t requiredSpace, std::size_t *streamOffset);
|
||||
void reserveRequiredSpace();
|
||||
|
||||
UINT lookupAttribute(const VertexAttribute &attribute); // Returns the offset into the vertex buffer, or -1 if not found
|
||||
|
||||
private:
|
||||
struct VertexElement
|
||||
{
|
||||
GLenum type;
|
||||
GLint size;
|
||||
bool normalized;
|
||||
int attributeOffset;
|
||||
|
||||
- UINT streamOffset;
|
||||
+ std::size_t streamOffset;
|
||||
};
|
||||
|
||||
std::vector<VertexElement> mCache;
|
||||
};
|
||||
|
||||
class VertexDataManager
|
||||
{
|
||||
public:
|
||||
@@ -117,18 +117,18 @@ class VertexDataManager
|
||||
|
||||
void dirtyCurrentValue(int index) { mDirtyCurrentValue[index] = true; }
|
||||
|
||||
GLenum prepareVertexData(GLint start, GLsizei count, TranslatedAttribute *outAttribs);
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(VertexDataManager);
|
||||
|
||||
- UINT spaceRequired(const VertexAttribute &attrib, std::size_t count) const;
|
||||
- UINT writeAttributeData(ArrayVertexBuffer *vertexBuffer, GLint start, GLsizei count, const VertexAttribute &attribute);
|
||||
+ std::size_t spaceRequired(const VertexAttribute &attrib, std::size_t count) const;
|
||||
+ std::size_t writeAttributeData(ArrayVertexBuffer *vertexBuffer, GLint start, GLsizei count, const VertexAttribute &attribute);
|
||||
|
||||
Context *const mContext;
|
||||
IDirect3DDevice9 *const mDevice;
|
||||
|
||||
StreamingVertexBuffer *mStreamingBuffer;
|
||||
|
||||
bool mDirtyCurrentValue[MAX_VERTEX_ATTRIBS];
|
||||
ConstantVertexBuffer *mCurrentValueBuffer[MAX_VERTEX_ATTRIBS];
|
|
@ -0,0 +1,73 @@
|
|||
Name
|
||||
|
||||
ANGLE_texture_compression_dxt
|
||||
|
||||
Name Strings
|
||||
|
||||
GL_ANGLE_texture_compression_dxt3
|
||||
GL_ANGLE_texture_compression_dxt5
|
||||
|
||||
Contributors
|
||||
|
||||
Gregg Tavares, Google Inc.
|
||||
Daniel Koch, TransGaming Inc.
|
||||
Al Patrick, Google Inc.
|
||||
|
||||
Contacts
|
||||
|
||||
Gregg Tavares, Google Inc. (gman 'at' google 'dot' com)
|
||||
|
||||
Status
|
||||
|
||||
Implemented in ANGLE ES2
|
||||
|
||||
Version
|
||||
|
||||
Last Modified Date: Aug 2, 2011
|
||||
|
||||
Number
|
||||
|
||||
OpenGL ES Extension #..
|
||||
|
||||
Dependencies
|
||||
|
||||
Requires OpenGL ES 2.0.
|
||||
|
||||
The extension is written against the OpenGL ES 2.0 specification.
|
||||
|
||||
Overview
|
||||
|
||||
These extensions are exactly the same as EXT_texture_compression_dxt1
|
||||
except they expose the formats COMPRESSED_RGBA_S3TC_DXT3_ANGLE and
|
||||
COMPRESSED_RGBA_S3TC_DXT5_ANGLE respectively.
|
||||
|
||||
See EXT_texture_compression_dxt1 for the full list of changes. Also
|
||||
see EXT_texture_compression_s3tc for a description of the formats.
|
||||
|
||||
New Procedures and Functions
|
||||
|
||||
None.
|
||||
|
||||
New Types
|
||||
|
||||
None.
|
||||
|
||||
New Tokens
|
||||
|
||||
Accepted by the <internalformat> parameter of CompressedTexImage2D
|
||||
and the <format> parameter of CompressedTexSubImage2D:
|
||||
|
||||
COMPRESSED_RGBA_S3TC_DXT3_ANGLE 0x83F2
|
||||
COMPRESSED_RGBA_S3TC_DXT5_ANGLE 0x83F3
|
||||
|
||||
Errors
|
||||
|
||||
None.
|
||||
|
||||
New State
|
||||
|
||||
None.
|
||||
|
||||
Revision History
|
||||
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
Name
|
||||
|
||||
ANGLE_software_display
|
||||
|
||||
Name Strings
|
||||
|
||||
EGL_ANGLE_software_display
|
||||
|
||||
Contributors
|
||||
|
||||
John Bauman
|
||||
Daniel Koch
|
||||
|
||||
Contacts
|
||||
|
||||
John Bauman, Google Inc. (jbauman 'at' chromium.org)
|
||||
|
||||
Status
|
||||
|
||||
In progress
|
||||
|
||||
Version
|
||||
|
||||
Version 1, July 12, 2011
|
||||
|
||||
Number
|
||||
|
||||
EGL Extension #??
|
||||
|
||||
Dependencies
|
||||
|
||||
This extension is written against the wording of the EGL 1.4
|
||||
Specification.
|
||||
|
||||
Overview
|
||||
|
||||
This extension allows for receiving a device that uses software rendering.
|
||||
|
||||
New Types
|
||||
|
||||
None
|
||||
|
||||
New Procedures and Functions
|
||||
|
||||
None
|
||||
|
||||
New Tokens
|
||||
|
||||
None
|
||||
|
||||
Additions to Chapter 3 of the EGL 1.4 Specification (EGL Functions and Errors)
|
||||
|
||||
Add before the last sentence of the first paragraph of section 3.2,
|
||||
"Initialization":
|
||||
|
||||
"If <display_id> is EGL_SOFTWARE_DISPLAY_ANGLE, a display that will render
|
||||
everything in software will be returned."
|
||||
|
||||
Issues
|
||||
|
||||
Revision History
|
||||
|
||||
Version 1, 2011/07/12 - first draft.
|
|
@ -1,42 +0,0 @@
|
|||
# HG changeset patch
|
||||
# Parent 9869d707ee367a9a108b663c71388cdea4abb705
|
||||
|
||||
diff --git a/gfx/angle/src/libEGL/Surface.cpp b/gfx/angle/src/libEGL/Surface.cpp
|
||||
--- a/gfx/angle/src/libEGL/Surface.cpp
|
||||
+++ b/gfx/angle/src/libEGL/Surface.cpp
|
||||
@@ -210,33 +210,33 @@ bool Surface::resetSwapChain(int backbuf
|
||||
}
|
||||
|
||||
result = device->CreateTexture(presentParameters.BackBufferWidth, presentParameters.BackBufferHeight, 1, D3DUSAGE_RENDERTARGET,
|
||||
presentParameters.BackBufferFormat, D3DPOOL_DEFAULT, &mOffscreenTexture, pShareHandle);
|
||||
}
|
||||
|
||||
if (FAILED(result))
|
||||
{
|
||||
- ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
|
||||
+ ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY || result == D3DERR_INVALIDCALL);
|
||||
|
||||
ERR("Could not create additional swap chains or offscreen surfaces: %08lX", result);
|
||||
release();
|
||||
return error(EGL_BAD_ALLOC, false);
|
||||
}
|
||||
|
||||
if (mConfig->mDepthStencilFormat != D3DFMT_UNKNOWN)
|
||||
{
|
||||
result = device->CreateDepthStencilSurface(presentParameters.BackBufferWidth, presentParameters.BackBufferHeight,
|
||||
presentParameters.AutoDepthStencilFormat, presentParameters.MultiSampleType,
|
||||
presentParameters.MultiSampleQuality, FALSE, &mDepthStencil, NULL);
|
||||
}
|
||||
|
||||
if (FAILED(result))
|
||||
{
|
||||
- ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
|
||||
+ ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY || result == D3DERR_INVALIDCALL);
|
||||
|
||||
ERR("Could not create depthstencil surface for new swap chain: %08lX", result);
|
||||
release();
|
||||
return error(EGL_BAD_ALLOC, false);
|
||||
}
|
||||
|
||||
if (mWindow) {
|
||||
mSwapChain->GetBackBuffer(0, D3DBACKBUFFER_TYPE_MONO, &mRenderTarget);
|
|
@ -6,7 +6,7 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
/*
|
||||
** Copyright (c) 2007-2009 The Khronos Group Inc.
|
||||
** Copyright (c) 2007-2010 The Khronos Group Inc.
|
||||
**
|
||||
** Permission is hereby granted, free of charge, to any person obtaining a
|
||||
** copy of this software and/or associated documentation files (the
|
||||
|
@ -34,8 +34,8 @@ extern "C" {
|
|||
|
||||
/* Header file version number */
|
||||
/* Current version at http://www.khronos.org/registry/egl/ */
|
||||
/* $Revision: 10795 $ on $Date: 2010-03-19 17:04:17 -0700 (Fri, 19 Mar 2010) $ */
|
||||
#define EGL_EGLEXT_VERSION 5
|
||||
/* $Revision: 15052 $ on $Date: 2011-07-06 17:43:46 -0700 (Wed, 06 Jul 2011) $ */
|
||||
#define EGL_EGLEXT_VERSION 10
|
||||
|
||||
#ifndef EGL_KHR_config_attribs
|
||||
#define EGL_KHR_config_attribs 1
|
||||
|
@ -120,6 +120,7 @@ typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYIMAGEKHRPROC) (EGLDisplay dpy, EGL
|
|||
#define EGL_GL_RENDERBUFFER_KHR 0x30B9 /* eglCreateImageKHR target */
|
||||
#endif
|
||||
|
||||
#if KHRONOS_SUPPORT_INT64 /* EGLTimeKHR requires 64-bit uint support */
|
||||
#ifndef EGL_KHR_reusable_sync
|
||||
#define EGL_KHR_reusable_sync 1
|
||||
|
||||
|
@ -149,6 +150,7 @@ typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCKHRPROC) (EGLDisplay dpy, EGLSy
|
|||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef EGL_KHR_image_base
|
||||
#define EGL_KHR_image_base 1
|
||||
|
@ -169,6 +171,11 @@ typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBKHRPROC) (EGLDisplay dpy, EG
|
|||
#define EGL_CONTEXT_PRIORITY_LOW_IMG 0x3103
|
||||
#endif
|
||||
|
||||
#ifndef EGL_KHR_lock_surface2
|
||||
#define EGL_KHR_lock_surface2 1
|
||||
#define EGL_BITMAP_PIXEL_SIZE_KHR 0x3110
|
||||
#endif
|
||||
|
||||
#ifndef EGL_NV_coverage_sample
|
||||
#define EGL_NV_coverage_sample 1
|
||||
#define EGL_COVERAGE_BUFFERS_NV 0x30E0
|
||||
|
@ -182,6 +189,7 @@ typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBKHRPROC) (EGLDisplay dpy, EG
|
|||
#define EGL_DEPTH_ENCODING_NONLINEAR_NV 0x30E3
|
||||
#endif
|
||||
|
||||
#if KHRONOS_SUPPORT_INT64 /* EGLTimeNV requires 64-bit uint support */
|
||||
#ifndef EGL_NV_sync
|
||||
#define EGL_NV_sync 1
|
||||
#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_NV 0x30E6
|
||||
|
@ -198,7 +206,7 @@ typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBKHRPROC) (EGLDisplay dpy, EG
|
|||
#define EGL_SYNC_FENCE_NV 0x30EF
|
||||
#define EGL_NO_SYNC_NV ((EGLSyncNV)0)
|
||||
typedef void* EGLSyncNV;
|
||||
typedef unsigned long long EGLTimeNV;
|
||||
typedef khronos_utime_nanoseconds_t EGLTimeNV;
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLSyncNV eglCreateFenceSyncNV (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list);
|
||||
EGLBoolean eglDestroySyncNV (EGLSyncNV sync);
|
||||
|
@ -214,6 +222,76 @@ typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCNVPROC) (EGLSyncNV sync, EGLint
|
|||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCNVPROC) (EGLSyncNV sync, EGLenum mode);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBNVPROC) (EGLSyncNV sync, EGLint attribute, EGLint *value);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if KHRONOS_SUPPORT_INT64 /* Dependent on EGL_KHR_reusable_sync which requires 64-bit uint support */
|
||||
#ifndef EGL_KHR_fence_sync
|
||||
#define EGL_KHR_fence_sync 1
|
||||
/* Reuses most tokens and entry points from EGL_KHR_reusable_sync */
|
||||
#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR 0x30F0
|
||||
#define EGL_SYNC_CONDITION_KHR 0x30F8
|
||||
#define EGL_SYNC_FENCE_KHR 0x30F9
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef EGL_HI_clientpixmap
|
||||
#define EGL_HI_clientpixmap 1
|
||||
|
||||
/* Surface Attribute */
|
||||
#define EGL_CLIENT_PIXMAP_POINTER_HI 0x8F74
|
||||
/*
|
||||
* Structure representing a client pixmap
|
||||
* (pixmap's data is in client-space memory).
|
||||
*/
|
||||
struct EGLClientPixmapHI
|
||||
{
|
||||
void* pData;
|
||||
EGLint iWidth;
|
||||
EGLint iHeight;
|
||||
EGLint iStride;
|
||||
};
|
||||
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurfaceHI(EGLDisplay dpy, EGLConfig config, struct EGLClientPixmapHI* pixmap);
|
||||
#endif /* EGL_EGLEXT_PROTOTYPES */
|
||||
typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPIXMAPSURFACEHIPROC) (EGLDisplay dpy, EGLConfig config, struct EGLClientPixmapHI* pixmap);
|
||||
#endif /* EGL_HI_clientpixmap */
|
||||
|
||||
#ifndef EGL_HI_colorformats
|
||||
#define EGL_HI_colorformats 1
|
||||
/* Config Attribute */
|
||||
#define EGL_COLOR_FORMAT_HI 0x8F70
|
||||
/* Color Formats */
|
||||
#define EGL_COLOR_RGB_HI 0x8F71
|
||||
#define EGL_COLOR_RGBA_HI 0x8F72
|
||||
#define EGL_COLOR_ARGB_HI 0x8F73
|
||||
#endif /* EGL_HI_colorformats */
|
||||
|
||||
#ifndef EGL_MESA_drm_image
|
||||
#define EGL_MESA_drm_image 1
|
||||
#define EGL_DRM_BUFFER_FORMAT_MESA 0x31D0 /* CreateDRMImageMESA attribute */
|
||||
#define EGL_DRM_BUFFER_USE_MESA 0x31D1 /* CreateDRMImageMESA attribute */
|
||||
#define EGL_DRM_BUFFER_FORMAT_ARGB32_MESA 0x31D2 /* EGL_IMAGE_FORMAT_MESA attribute value */
|
||||
#define EGL_DRM_BUFFER_MESA 0x31D3 /* eglCreateImageKHR target */
|
||||
#define EGL_DRM_BUFFER_STRIDE_MESA 0x31D4
|
||||
#define EGL_DRM_BUFFER_USE_SCANOUT_MESA 0x00000001 /* EGL_DRM_BUFFER_USE_MESA bits */
|
||||
#define EGL_DRM_BUFFER_USE_SHARE_MESA 0x00000002 /* EGL_DRM_BUFFER_USE_MESA bits */
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLImageKHR EGLAPIENTRY eglCreateDRMImageMESA (EGLDisplay dpy, const EGLint *attrib_list);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglExportDRMImageMESA (EGLDisplay dpy, EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride);
|
||||
#endif /* EGL_EGLEXT_PROTOTYPES */
|
||||
typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEDRMIMAGEMESAPROC) (EGLDisplay dpy, const EGLint *attrib_list);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLEXPORTDRMIMAGEMESAPROC) (EGLDisplay dpy, EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride);
|
||||
#endif
|
||||
|
||||
#ifndef EGL_NV_post_sub_buffer
|
||||
#define EGL_NV_post_sub_buffer 1
|
||||
#define EGL_POST_SUB_BUFFER_SUPPORTED_NV 0x30BE
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglPostSubBufferNV (EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height);
|
||||
#endif /* EGL_EGLEXT_PROTOTYPES */
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLPOSTSUBBUFFERNVPROC) (EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height);
|
||||
#endif
|
||||
|
||||
#ifndef EGL_ANGLE_query_surface_pointer
|
||||
#define EGL_ANGLE_query_surface_pointer 1
|
||||
|
@ -224,8 +302,35 @@ typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSURFACEPOINTERANGLEPROC) (EGLDisplay
|
|||
#endif
|
||||
|
||||
#ifndef EGL_ANGLE_surface_d3d_texture_2d_share_handle
|
||||
#define EGL_ANGLE_surface_d3d_texture_2d_share_handle
|
||||
#define EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE 0x3200
|
||||
#define EGL_ANGLE_surface_d3d_texture_2d_share_handle 1
|
||||
#define EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE 0x3200
|
||||
#endif
|
||||
|
||||
#ifndef EGL_ANGLE_software_display
|
||||
#define EGL_ANGLE_software_display 1
|
||||
#define EGL_SOFTWARE_DISPLAY_ANGLE ((EGLNativeDisplayType)-1)
|
||||
#endif
|
||||
|
||||
#ifndef EGL_NV_coverage_sample_resolve
|
||||
#define EGL_NV_coverage_sample_resolve 1
|
||||
#define EGL_COVERAGE_SAMPLE_RESOLVE_NV 0x3131
|
||||
#define EGL_COVERAGE_SAMPLE_RESOLVE_DEFAULT_NV 0x3132
|
||||
#define EGL_COVERAGE_SAMPLE_RESOLVE_NONE_NV 0x3133
|
||||
#endif
|
||||
|
||||
#if KHRONOS_SUPPORT_INT64 /* EGLTimeKHR requires 64-bit uint support */
|
||||
#ifndef EGL_NV_system_time
|
||||
#define EGL_NV_system_time 1
|
||||
|
||||
typedef khronos_utime_nanoseconds_t EGLuint64NV;
|
||||
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeFrequencyNV(void);
|
||||
EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeNV(void);
|
||||
#endif /* EGL_EGLEXT_PROTOTYPES */
|
||||
typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMEFREQUENCYNVPROC) (void);
|
||||
typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMENVPROC) (void);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
*/
|
||||
|
||||
/* Platform-specific types and definitions for egl.h
|
||||
* $Revision: 9724 $ on $Date: 2009-12-02 02:05:33 -0800 (Wed, 02 Dec 2009) $
|
||||
* $Revision: 12306 $ on $Date: 2010-08-25 09:51:28 -0700 (Wed, 25 Aug 2010) $
|
||||
*
|
||||
* Adopters may modify khrplatform.h and this file to suit their platform.
|
||||
* You are encouraged to submit all modifications to the Khronos group so that
|
||||
|
@ -60,6 +60,11 @@
|
|||
* Windows Device Context. They must be defined in platform-specific
|
||||
* code below. The EGL-prefixed versions of Native*Type are the same
|
||||
* types, renamed in EGL 1.3 so all types in the API start with "EGL".
|
||||
*
|
||||
* Khronos STRONGLY RECOMMENDS that you use the default definitions
|
||||
* provided below, since these changes affect both binary and source
|
||||
* portability of applications using EGL running on different EGL
|
||||
* implementations.
|
||||
*/
|
||||
|
||||
#if defined(_WIN32) || defined(__VC32__) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) /* Win32 and WinCE */
|
||||
|
@ -78,6 +83,12 @@ typedef int EGLNativeDisplayType;
|
|||
typedef void *EGLNativeWindowType;
|
||||
typedef void *EGLNativePixmapType;
|
||||
|
||||
#elif defined(WL_EGL_PLATFORM)
|
||||
|
||||
typedef struct wl_display *EGLNativeDisplayType;
|
||||
typedef struct wl_egl_pixmap *EGLNativePixmapType;
|
||||
typedef struct wl_egl_window *EGLNativeWindowType;
|
||||
|
||||
#elif defined(__unix__)
|
||||
|
||||
/* X11 (tentative) */
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef __gl2ext_h_
|
||||
#define __gl2ext_h_
|
||||
|
||||
/* $Revision: 10798 $ on $Date:: 2010-03-19 17:34:30 -0700 #$ */
|
||||
/* $Revision: 15049 $ on $Date:: 2011-07-06 17:28:16 -0700 #$ */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -57,6 +57,15 @@ extern "C" {
|
|||
typedef void* GLeglImageOES;
|
||||
#endif
|
||||
|
||||
/* GL_OES_EGL_image_external */
|
||||
#ifndef GL_OES_EGL_image_external
|
||||
/* GLeglImageOES defined in GL_OES_EGL_image already. */
|
||||
#define GL_TEXTURE_EXTERNAL_OES 0x8D65
|
||||
#define GL_SAMPLER_EXTERNAL_OES 0x8D66
|
||||
#define GL_TEXTURE_BINDING_EXTERNAL_OES 0x8D67
|
||||
#define GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES 0x8D68
|
||||
#endif
|
||||
|
||||
/* GL_OES_element_index_uint */
|
||||
#ifndef GL_OES_element_index_uint
|
||||
#define GL_UNSIGNED_INT 0x1405
|
||||
|
@ -179,6 +188,79 @@ typedef void* GLeglImageOES;
|
|||
#define GL_Z400_BINARY_AMD 0x8740
|
||||
#endif
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* ANGLE extension tokens
|
||||
*------------------------------------------------------------------------*/
|
||||
|
||||
/* GL_ANGLE_framebuffer_blit */
|
||||
#ifndef GL_ANGLE_framebuffer_blit
|
||||
#define GL_READ_FRAMEBUFFER_ANGLE 0x8CA8
|
||||
#define GL_DRAW_FRAMEBUFFER_ANGLE 0x8CA9
|
||||
#define GL_DRAW_FRAMEBUFFER_BINDING_ANGLE 0x8CA6
|
||||
#define GL_READ_FRAMEBUFFER_BINDING_ANGLE 0x8CAA
|
||||
#endif
|
||||
|
||||
/* GL_ANGLE_framebuffer_multisample */
|
||||
#ifndef GL_ANGLE_framebuffer_multisample
|
||||
#define GL_RENDERBUFFER_SAMPLES_ANGLE 0x8CAB
|
||||
#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_ANGLE 0x8D56
|
||||
#define GL_MAX_SAMPLES_ANGLE 0x8D57
|
||||
#endif
|
||||
|
||||
/* GL_ANGLE_texture_compression_dxt3 */
|
||||
#ifndef GL_ANGLE_texture_compression_dxt3
|
||||
#define GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE 0x83F2
|
||||
#endif
|
||||
|
||||
/* GL_ANGLE_texture_compression_dxt5 */
|
||||
#ifndef GL_ANGLE_texture_compression_dxt5
|
||||
#define GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE 0x83F3
|
||||
#endif
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* APPLE extension tokens
|
||||
*------------------------------------------------------------------------*/
|
||||
|
||||
/* GL_APPLE_rgb_422 */
|
||||
#ifndef GL_APPLE_rgb_422
|
||||
#define GL_RGB_422_APPLE 0x8A1F
|
||||
#define GL_UNSIGNED_SHORT_8_8_APPLE 0x85BA
|
||||
#define GL_UNSIGNED_SHORT_8_8_REV_APPLE 0x85BB
|
||||
#endif
|
||||
|
||||
/* GL_APPLE_framebuffer_multisample */
|
||||
#ifndef GL_APPLE_framebuffer_multisample
|
||||
#define GL_RENDERBUFFER_SAMPLES_APPLE 0x8CAB
|
||||
#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_APPLE 0x8D56
|
||||
#define GL_MAX_SAMPLES_APPLE 0x8D57
|
||||
#define GL_READ_FRAMEBUFFER_APPLE 0x8CA8
|
||||
#define GL_DRAW_FRAMEBUFFER_APPLE 0x8CA9
|
||||
#define GL_DRAW_FRAMEBUFFER_BINDING_APPLE 0x8CA6
|
||||
#define GL_READ_FRAMEBUFFER_BINDING_APPLE 0x8CAA
|
||||
#endif
|
||||
|
||||
/* GL_APPLE_texture_format_BGRA8888 */
|
||||
#ifndef GL_APPLE_texture_format_BGRA8888
|
||||
#define GL_BGRA_EXT 0x80E1
|
||||
#endif
|
||||
|
||||
/* GL_APPLE_texture_max_level */
|
||||
#ifndef GL_APPLE_texture_max_level
|
||||
#define GL_TEXTURE_MAX_LEVEL_APPLE 0x813D
|
||||
#endif
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* ARM extension tokens
|
||||
*------------------------------------------------------------------------*/
|
||||
|
||||
/* GL_ARM_mali_shader_binary */
|
||||
#ifndef GL_ARM_mali_shader_binary
|
||||
#define GL_MALI_SHADER_BINARY_ARM 0x8F60
|
||||
#endif
|
||||
|
||||
/* GL_ARM_rgba8 */
|
||||
/* No new tokens introduced by this extension. */
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* EXT extension tokens
|
||||
*------------------------------------------------------------------------*/
|
||||
|
@ -206,6 +288,9 @@ typedef void* GLeglImageOES;
|
|||
#define GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT 0x8366
|
||||
#endif
|
||||
|
||||
/* GL_EXT_shader_texture_lod */
|
||||
/* No new tokens introduced by this extension. */
|
||||
|
||||
/* GL_EXT_texture_filter_anisotropic */
|
||||
#ifndef GL_EXT_texture_filter_anisotropic
|
||||
#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE
|
||||
|
@ -228,6 +313,22 @@ typedef void* GLeglImageOES;
|
|||
#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1
|
||||
#endif
|
||||
|
||||
/* GL_EXT_unpack_subimage */
|
||||
#ifndef GL_EXT_unpack_subimage
|
||||
#define GL_UNPACK_ROW_LENGTH 0x0CF2
|
||||
#define GL_UNPACK_SKIP_ROWS 0x0CF3
|
||||
#define GL_UNPACK_SKIP_PIXELS 0x0CF4
|
||||
#endif
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* DMP extension tokens
|
||||
*------------------------------------------------------------------------*/
|
||||
|
||||
/* GL_DMP_shader_binary */
|
||||
#ifndef GL_DMP_shader_binary
|
||||
#define GL_SHADER_BINARY_DMP 0x9250
|
||||
#endif
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* IMG extension tokens
|
||||
*------------------------------------------------------------------------*/
|
||||
|
@ -256,17 +357,18 @@ typedef void* GLeglImageOES;
|
|||
#define GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG 0x8C03
|
||||
#endif
|
||||
|
||||
/* GL_IMG_multisampled_render_to_texture */
|
||||
#ifndef GL_IMG_multisampled_render_to_texture
|
||||
#define GL_RENDERBUFFER_SAMPLES_IMG 0x9133
|
||||
#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_IMG 0x9134
|
||||
#define GL_MAX_SAMPLES_IMG 0x9135
|
||||
#define GL_TEXTURE_SAMPLES_IMG 0x9136
|
||||
#endif
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* NV extension tokens
|
||||
*------------------------------------------------------------------------*/
|
||||
|
||||
/* GL_NV_fence */
|
||||
#ifndef GL_NV_fence
|
||||
#define GL_ALL_COMPLETED_NV 0x84F2
|
||||
#define GL_FENCE_STATUS_NV 0x84F3
|
||||
#define GL_FENCE_CONDITION_NV 0x84F4
|
||||
#endif
|
||||
|
||||
/* GL_NV_coverage_sample */
|
||||
#ifndef GL_NV_coverage_sample
|
||||
#define GL_COVERAGE_COMPONENT_NV 0x8ED0
|
||||
|
@ -285,10 +387,90 @@ typedef void* GLeglImageOES;
|
|||
#define GL_DEPTH_COMPONENT16_NONLINEAR_NV 0x8E2C
|
||||
#endif
|
||||
|
||||
/* GL_NV_draw_buffers */
|
||||
#ifndef GL_NV_draw_buffers
|
||||
#define GL_MAX_DRAW_BUFFERS_NV 0x8824
|
||||
#define GL_DRAW_BUFFER0_NV 0x8825
|
||||
#define GL_DRAW_BUFFER1_NV 0x8826
|
||||
#define GL_DRAW_BUFFER2_NV 0x8827
|
||||
#define GL_DRAW_BUFFER3_NV 0x8828
|
||||
#define GL_DRAW_BUFFER4_NV 0x8829
|
||||
#define GL_DRAW_BUFFER5_NV 0x882A
|
||||
#define GL_DRAW_BUFFER6_NV 0x882B
|
||||
#define GL_DRAW_BUFFER7_NV 0x882C
|
||||
#define GL_DRAW_BUFFER8_NV 0x882D
|
||||
#define GL_DRAW_BUFFER9_NV 0x882E
|
||||
#define GL_DRAW_BUFFER10_NV 0x882F
|
||||
#define GL_DRAW_BUFFER11_NV 0x8830
|
||||
#define GL_DRAW_BUFFER12_NV 0x8831
|
||||
#define GL_DRAW_BUFFER13_NV 0x8832
|
||||
#define GL_DRAW_BUFFER14_NV 0x8833
|
||||
#define GL_DRAW_BUFFER15_NV 0x8834
|
||||
#define GL_COLOR_ATTACHMENT0_NV 0x8CE0
|
||||
#define GL_COLOR_ATTACHMENT1_NV 0x8CE1
|
||||
#define GL_COLOR_ATTACHMENT2_NV 0x8CE2
|
||||
#define GL_COLOR_ATTACHMENT3_NV 0x8CE3
|
||||
#define GL_COLOR_ATTACHMENT4_NV 0x8CE4
|
||||
#define GL_COLOR_ATTACHMENT5_NV 0x8CE5
|
||||
#define GL_COLOR_ATTACHMENT6_NV 0x8CE6
|
||||
#define GL_COLOR_ATTACHMENT7_NV 0x8CE7
|
||||
#define GL_COLOR_ATTACHMENT8_NV 0x8CE8
|
||||
#define GL_COLOR_ATTACHMENT9_NV 0x8CE9
|
||||
#define GL_COLOR_ATTACHMENT10_NV 0x8CEA
|
||||
#define GL_COLOR_ATTACHMENT11_NV 0x8CEB
|
||||
#define GL_COLOR_ATTACHMENT12_NV 0x8CEC
|
||||
#define GL_COLOR_ATTACHMENT13_NV 0x8CED
|
||||
#define GL_COLOR_ATTACHMENT14_NV 0x8CEE
|
||||
#define GL_COLOR_ATTACHMENT15_NV 0x8CEF
|
||||
#endif
|
||||
|
||||
/* GL_NV_fbo_color_attachments */
|
||||
#ifndef GL_NV_fbo_color_attachments
|
||||
#define GL_MAX_COLOR_ATTACHMENTS_NV 0x8CDF
|
||||
/* GL_COLOR_ATTACHMENT{0-15}_NV defined in GL_NV_draw_buffers already. */
|
||||
#endif
|
||||
|
||||
/* GL_NV_fence */
|
||||
#ifndef GL_NV_fence
|
||||
#define GL_ALL_COMPLETED_NV 0x84F2
|
||||
#define GL_FENCE_STATUS_NV 0x84F3
|
||||
#define GL_FENCE_CONDITION_NV 0x84F4
|
||||
#endif
|
||||
|
||||
/* GL_NV_read_buffer */
|
||||
#ifndef GL_NV_read_buffer
|
||||
#define GL_READ_BUFFER_NV 0x0C02
|
||||
#endif
|
||||
|
||||
/* GL_NV_read_buffer_front */
|
||||
/* No new tokens introduced by this extension. */
|
||||
|
||||
/* GL_NV_read_depth */
|
||||
/* No new tokens introduced by this extension. */
|
||||
|
||||
/* GL_NV_read_depth_stencil */
|
||||
/* No new tokens introduced by this extension. */
|
||||
|
||||
/* GL_NV_read_stencil */
|
||||
/* No new tokens introduced by this extension. */
|
||||
|
||||
/* GL_NV_texture_compression_s3tc_update */
|
||||
/* No new tokens introduced by this extension. */
|
||||
|
||||
/* GL_NV_texture_npot_2D_mipmap */
|
||||
/* No new tokens introduced by this extension. */
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* QCOM extension tokens
|
||||
*------------------------------------------------------------------------*/
|
||||
|
||||
/* GL_QCOM_alpha_test */
|
||||
#ifndef GL_QCOM_alpha_test
|
||||
#define GL_ALPHA_TEST_QCOM 0x0BC0
|
||||
#define GL_ALPHA_TEST_FUNC_QCOM 0x0BC1
|
||||
#define GL_ALPHA_TEST_REF_QCOM 0x0BC2
|
||||
#endif
|
||||
|
||||
/* GL_QCOM_driver_control */
|
||||
/* No new tokens introduced by this extension. */
|
||||
|
||||
|
@ -357,22 +539,12 @@ typedef void* GLeglImageOES;
|
|||
#endif
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* ANGLE extension tokens
|
||||
* VIV extension tokens
|
||||
*------------------------------------------------------------------------*/
|
||||
|
||||
/* GL_ANGLE_framebuffer_blit */
|
||||
#ifndef GL_ANGLE_framebuffer_blit
|
||||
#define GL_READ_FRAMEBUFFER_ANGLE 0x8CA8
|
||||
#define GL_DRAW_FRAMEBUFFER_ANGLE 0x8CA9
|
||||
#define GL_DRAW_FRAMEBUFFER_BINDING_ANGLE 0x8CA6 // alias GL_FRAMEBUFFER_BINDING
|
||||
#define GL_READ_FRAMEBUFFER_BINDING_ANGLE 0x8CAA
|
||||
#endif
|
||||
|
||||
/* GL_ANGLE_framebuffer_multisample */
|
||||
#ifndef GL_ANGLE_framebuffer_multisample
|
||||
#define GL_RENDERBUFFER_SAMPLES_ANGLE 0x8CAB
|
||||
#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_ANGLE 0x8D56
|
||||
#define GL_MAX_SAMPLES_ANGLE 0x8D57
|
||||
/* GL_VIV_shader_binary */
|
||||
#ifndef GL_VIV_shader_binary
|
||||
#define GL_SHADER_BINARY_VIV 0x8FC4
|
||||
#endif
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
|
@ -419,6 +591,12 @@ typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETTEXTURE2DOESPROC) (GLenum target,
|
|||
typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC) (GLenum target, GLeglImageOES image);
|
||||
#endif
|
||||
|
||||
/* GL_OES_EGL_image_external */
|
||||
#ifndef GL_OES_EGL_image_external
|
||||
#define GL_OES_EGL_image_external 1
|
||||
/* glEGLImageTargetTexture2DOES defined in GL_OES_EGL_image already. */
|
||||
#endif
|
||||
|
||||
/* GL_OES_element_index_uint */
|
||||
#ifndef GL_OES_element_index_uint
|
||||
#define GL_OES_element_index_uint 1
|
||||
|
@ -600,6 +778,82 @@ typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERDATAAMDPROC) (GLuint monito
|
|||
#define GL_AMD_program_binary_Z400 1
|
||||
#endif
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* ANGLE extension functions
|
||||
*------------------------------------------------------------------------*/
|
||||
|
||||
/* GL_ANGLE_framebuffer_blit */
|
||||
#ifndef GL_ANGLE_framebuffer_blit
|
||||
#define GL_ANGLE_framebuffer_blit 1
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_APICALL void GL_APIENTRY glBlitFramebufferANGLE (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
|
||||
#endif
|
||||
typedef void (GL_APIENTRYP PFNGLBLITFRAMEBUFFERANGLEPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
|
||||
#endif
|
||||
|
||||
/* GL_ANGLE_framebuffer_multisample */
|
||||
#ifndef GL_ANGLE_framebuffer_multisample
|
||||
#define GL_ANGLE_framebuffer_multisample 1
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleANGLE (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
|
||||
#endif
|
||||
typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEANGLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
|
||||
#endif
|
||||
|
||||
/* GL_ANGLE_texture_compression_dxt3 */
|
||||
#ifndef GL_ANGLE_texture_compression_dxt3
|
||||
#define GL_ANGLE_texture_compression_dxt3 1
|
||||
#endif
|
||||
|
||||
/* GL_ANGLE_texture_compression_dxt5 */
|
||||
#ifndef GL_ANGLE_texture_compression_dxt5
|
||||
#define GL_ANGLE_texture_compression_dxt5 1
|
||||
#endif
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* APPLE extension functions
|
||||
*------------------------------------------------------------------------*/
|
||||
|
||||
/* GL_APPLE_rgb_422 */
|
||||
#ifndef GL_APPLE_rgb_422
|
||||
#define GL_APPLE_rgb_422 1
|
||||
#endif
|
||||
|
||||
/* GL_APPLE_framebuffer_multisample */
|
||||
#ifndef GL_APPLE_framebuffer_multisample
|
||||
#define GL_APPLE_framebuffer_multisample 1
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleAPPLE (GLenum, GLsizei, GLenum, GLsizei, GLsizei);
|
||||
GL_APICALL void GL_APIENTRY glResolveMultisampleFramebufferAPPLE (void);
|
||||
#endif /* GL_GLEXT_PROTOTYPES */
|
||||
typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEAPPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
|
||||
typedef void (GL_APIENTRYP PFNGLRESOLVEMULTISAMPLEFRAMEBUFFERAPPLEPROC) (void);
|
||||
#endif
|
||||
|
||||
/* GL_APPLE_texture_format_BGRA8888 */
|
||||
#ifndef GL_APPLE_texture_format_BGRA8888
|
||||
#define GL_APPLE_texture_format_BGRA8888 1
|
||||
#endif
|
||||
|
||||
/* GL_APPLE_texture_max_level */
|
||||
#ifndef GL_APPLE_texture_max_level
|
||||
#define GL_APPLE_texture_max_level 1
|
||||
#endif
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* ARM extension functions
|
||||
*------------------------------------------------------------------------*/
|
||||
|
||||
/* GL_ARM_mali_shader_binary */
|
||||
#ifndef GL_ARM_mali_shader_binary
|
||||
#define GL_ARM_mali_shader_binary 1
|
||||
#endif
|
||||
|
||||
/* GL_ARM_rgba8 */
|
||||
#ifndef GL_ARM_rgba8
|
||||
#define GL_ARM_rgba8 1
|
||||
#endif
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* EXT extension functions
|
||||
*------------------------------------------------------------------------*/
|
||||
|
@ -633,6 +887,11 @@ typedef void (GL_APIENTRYP PFNGLMULTIDRAWELEMENTSEXTPROC) (GLenum mode, const GL
|
|||
#define GL_EXT_read_format_bgra 1
|
||||
#endif
|
||||
|
||||
/* GL_EXT_shader_texture_lod */
|
||||
#ifndef GL_EXT_shader_texture_lod
|
||||
#define GL_EXT_shader_texture_lod 1
|
||||
#endif
|
||||
|
||||
/* GL_EXT_texture_filter_anisotropic */
|
||||
#ifndef GL_EXT_texture_filter_anisotropic
|
||||
#define GL_EXT_texture_filter_anisotropic 1
|
||||
|
@ -653,6 +912,20 @@ typedef void (GL_APIENTRYP PFNGLMULTIDRAWELEMENTSEXTPROC) (GLenum mode, const GL
|
|||
#define GL_EXT_texture_compression_dxt1 1
|
||||
#endif
|
||||
|
||||
/* GL_EXT_unpack_subimage */
|
||||
#ifndef GL_EXT_unpack_subimage
|
||||
#define GL_EXT_unpack_subimage 1
|
||||
#endif
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* DMP extension functions
|
||||
*------------------------------------------------------------------------*/
|
||||
|
||||
/* GL_DMP_shader_binary */
|
||||
#ifndef GL_DMP_shader_binary
|
||||
#define GL_DMP_shader_binary 1
|
||||
#endif
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* IMG extension functions
|
||||
*------------------------------------------------------------------------*/
|
||||
|
@ -677,10 +950,51 @@ typedef void (GL_APIENTRYP PFNGLMULTIDRAWELEMENTSEXTPROC) (GLenum mode, const GL
|
|||
#define GL_IMG_texture_compression_pvrtc 1
|
||||
#endif
|
||||
|
||||
/* GL_IMG_multisampled_render_to_texture */
|
||||
#ifndef GL_IMG_multisampled_render_to_texture
|
||||
#define GL_IMG_multisampled_render_to_texture 1
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleIMG (GLenum, GLsizei, GLenum, GLsizei, GLsizei);
|
||||
GL_APICALL void GL_APIENTRY glFramebufferTexture2DMultisampleIMG (GLenum, GLenum, GLenum, GLuint, GLint, GLsizei);
|
||||
#endif
|
||||
typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEIMG) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
|
||||
typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEIMG) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples);
|
||||
#endif
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* NV extension functions
|
||||
*------------------------------------------------------------------------*/
|
||||
|
||||
/* GL_NV_coverage_sample */
|
||||
#ifndef GL_NV_coverage_sample
|
||||
#define GL_NV_coverage_sample 1
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_APICALL void GL_APIENTRY glCoverageMaskNV (GLboolean mask);
|
||||
GL_APICALL void GL_APIENTRY glCoverageOperationNV (GLenum operation);
|
||||
#endif
|
||||
typedef void (GL_APIENTRYP PFNGLCOVERAGEMASKNVPROC) (GLboolean mask);
|
||||
typedef void (GL_APIENTRYP PFNGLCOVERAGEOPERATIONNVPROC) (GLenum operation);
|
||||
#endif
|
||||
|
||||
/* GL_NV_depth_nonlinear */
|
||||
#ifndef GL_NV_depth_nonlinear
|
||||
#define GL_NV_depth_nonlinear 1
|
||||
#endif
|
||||
|
||||
/* GL_NV_draw_buffers */
|
||||
#ifndef GL_NV_draw_buffers
|
||||
#define GL_NV_draw_buffers 1
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_APICALL void GL_APIENTRY glDrawBuffersNV (GLsizei n, const GLenum *bufs);
|
||||
#endif
|
||||
typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSNVPROC) (GLsizei n, const GLenum *bufs);
|
||||
#endif
|
||||
|
||||
/* GL_NV_fbo_color_attachments */
|
||||
#ifndef GL_NV_fbo_color_attachments
|
||||
#define GL_NV_fbo_color_attachments 1
|
||||
#endif
|
||||
|
||||
/* GL_NV_fence */
|
||||
#ifndef GL_NV_fence
|
||||
#define GL_NV_fence 1
|
||||
|
@ -702,26 +1016,58 @@ typedef void (GL_APIENTRYP PFNGLFINISHFENCENVPROC) (GLuint fence);
|
|||
typedef void (GL_APIENTRYP PFNGLSETFENCENVPROC) (GLuint fence, GLenum condition);
|
||||
#endif
|
||||
|
||||
/* GL_NV_coverage_sample */
|
||||
#ifndef GL_NV_coverage_sample
|
||||
#define GL_NV_coverage_sample 1
|
||||
/* GL_NV_read_buffer */
|
||||
#ifndef GL_NV_read_buffer
|
||||
#define GL_NV_read_buffer 1
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_APICALL void GL_APIENTRY glCoverageMaskNV (GLboolean mask);
|
||||
GL_APICALL void GL_APIENTRY glCoverageOperationNV (GLenum operation);
|
||||
GL_APICALL void GL_APIENTRY glReadBufferNV (GLenum mode);
|
||||
#endif
|
||||
typedef void (GL_APIENTRYP PFNGLCOVERAGEMASKNVPROC) (GLboolean mask);
|
||||
typedef void (GL_APIENTRYP PFNGLCOVERAGEOPERATIONNVPROC) (GLenum operation);
|
||||
typedef void (GL_APIENTRYP PFNGLREADBUFFERNVPROC) (GLenum mode);
|
||||
#endif
|
||||
|
||||
/* GL_NV_depth_nonlinear */
|
||||
#ifndef GL_NV_depth_nonlinear
|
||||
#define GL_NV_depth_nonlinear 1
|
||||
/* GL_NV_read_buffer_front */
|
||||
#ifndef GL_NV_read_buffer_front
|
||||
#define GL_NV_read_buffer_front 1
|
||||
#endif
|
||||
|
||||
/* GL_NV_read_depth */
|
||||
#ifndef GL_NV_read_depth
|
||||
#define GL_NV_read_depth 1
|
||||
#endif
|
||||
|
||||
/* GL_NV_read_depth_stencil */
|
||||
#ifndef GL_NV_read_depth_stencil
|
||||
#define GL_NV_read_depth_stencil 1
|
||||
#endif
|
||||
|
||||
/* GL_NV_read_stencil */
|
||||
#ifndef GL_NV_read_stencil
|
||||
#define GL_NV_read_stencil 1
|
||||
#endif
|
||||
|
||||
/* GL_NV_texture_compression_s3tc_update */
|
||||
#ifndef GL_NV_texture_compression_s3tc_update
|
||||
#define GL_NV_texture_compression_s3tc_update 1
|
||||
#endif
|
||||
|
||||
/* GL_NV_texture_npot_2D_mipmap */
|
||||
#ifndef GL_NV_texture_npot_2D_mipmap
|
||||
#define GL_NV_texture_npot_2D_mipmap 1
|
||||
#endif
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* QCOM extension functions
|
||||
*------------------------------------------------------------------------*/
|
||||
|
||||
/* GL_QCOM_alpha_test */
|
||||
#ifndef GL_QCOM_alpha_test
|
||||
#define GL_QCOM_alpha_test 1
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_APICALL void GL_APIENTRY glAlphaFuncQCOM (GLenum func, GLclampf ref);
|
||||
#endif
|
||||
typedef void (GL_APIENTRYP PFNGLALPHAFUNCQCOMPROC) (GLenum func, GLclampf ref);
|
||||
#endif
|
||||
|
||||
/* GL_QCOM_driver_control */
|
||||
#ifndef GL_QCOM_driver_control
|
||||
#define GL_QCOM_driver_control 1
|
||||
|
@ -797,31 +1143,12 @@ typedef void (GL_APIENTRYP PFNGLENDTILINGQCOMPROC) (GLbitfield preserveMask);
|
|||
#endif
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* ANGLE extension functions
|
||||
* VIV extension tokens
|
||||
*------------------------------------------------------------------------*/
|
||||
|
||||
/* GL_ANGLE_framebuffer_blit */
|
||||
#ifndef GL_ANGLE_framebuffer_blit
|
||||
#define GL_ANGLE_framebuffer_blit 1
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_APICALL void GL_APIENTRY glBlitFramebufferANGLE (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
|
||||
GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
|
||||
GLbitfield mask, GLenum filter);
|
||||
#endif
|
||||
typedef void (GL_APIENTRYP PFNGLBLITFRAMEBUFFERANGLEPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
|
||||
GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
|
||||
GLbitfield mask, GLenum filter);
|
||||
#endif
|
||||
|
||||
/* GL_ANGLE_framebuffer_multisample */
|
||||
#ifndef GL_ANGLE_framebuffer_multisample
|
||||
#define GL_ANGLE_framebuffer_multisample 1
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleANGLE (GLenum target, GLsizei samples, GLenum internalformat,
|
||||
GLsizei width, GLsizei height);
|
||||
#endif
|
||||
typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEANGLEPROC) (GLenum target, GLsizei samples, GLenum internalformat,
|
||||
GLsizei width, GLsizei height);
|
||||
/* GL_VIV_shader_binary */
|
||||
#ifndef GL_VIV_shader_binary
|
||||
#define GL_VIV_shader_binary 1
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -17,7 +17,7 @@ extern "C" {
|
|||
|
||||
// Version number for shader translation API.
|
||||
// It is incremented everytime the API changes.
|
||||
#define SH_VERSION 104
|
||||
#define SH_VERSION 105
|
||||
|
||||
//
|
||||
// The names of the following enums have been derived by replacing GL prefix
|
||||
|
@ -35,6 +35,12 @@ typedef enum {
|
|||
SH_WEBGL_SPEC = 0x8B41
|
||||
} ShShaderSpec;
|
||||
|
||||
typedef enum {
|
||||
SH_ESSL_OUTPUT = 0x8B45,
|
||||
SH_GLSL_OUTPUT = 0x8B46,
|
||||
SH_HLSL_OUTPUT = 0x8B47
|
||||
} ShShaderOutput;
|
||||
|
||||
typedef enum {
|
||||
SH_NONE = 0,
|
||||
SH_INT = 0x1404,
|
||||
|
@ -75,7 +81,11 @@ typedef enum {
|
|||
SH_ATTRIBUTES_UNIFORMS = 0x0008,
|
||||
SH_LINE_DIRECTIVES = 0x0010,
|
||||
SH_SOURCE_PATH = 0x0020,
|
||||
SH_MAP_LONG_VARIABLE_NAMES = 0x0040
|
||||
SH_MAP_LONG_VARIABLE_NAMES = 0x0040,
|
||||
SH_UNROLL_FOR_LOOP_WITH_INTEGER_INDEX = 0x0080,
|
||||
|
||||
// This is needed only as a workaround for certain OpenGL driver bugs.
|
||||
SH_EMULATE_BUILT_IN_FUNCTIONS = 0x0100
|
||||
} ShCompileOptions;
|
||||
|
||||
//
|
||||
|
@ -109,6 +119,7 @@ typedef struct
|
|||
// Extensions.
|
||||
// Set to 1 to enable the extension, else 0.
|
||||
int OES_standard_derivatives;
|
||||
int OES_EGL_image_external;
|
||||
} ShBuiltInResources;
|
||||
|
||||
//
|
||||
|
@ -128,13 +139,17 @@ typedef void* ShHandle;
|
|||
//
|
||||
// Driver calls these to create and destroy compiler objects.
|
||||
//
|
||||
// Returns the handle of constructed compiler.
|
||||
// Returns the handle of constructed compiler, null if the requested compiler is
|
||||
// not supported.
|
||||
// Parameters:
|
||||
// type: Specifies the type of shader - SH_FRAGMENT_SHADER or SH_VERTEX_SHADER.
|
||||
// spec: Specifies the language spec the compiler must conform to -
|
||||
// SH_GLES2_SPEC or SH_WEBGL_SPEC.
|
||||
// output: Specifies the output code type - SH_ESSL_OUTPUT, SH_GLSL_OUTPUT,
|
||||
// or SH_HLSL_OUTPUT.
|
||||
// resources: Specifies the built-in resources.
|
||||
ShHandle ShConstructCompiler(ShShaderType type, ShShaderSpec spec,
|
||||
ShShaderOutput output,
|
||||
const ShBuiltInResources* resources);
|
||||
void ShDestruct(ShHandle handle);
|
||||
|
||||
|
|
|
@ -53,6 +53,7 @@ void GenerateResources(ShBuiltInResources* resources)
|
|||
resources->MaxDrawBuffers = 1;
|
||||
|
||||
resources->OES_standard_derivatives = 0;
|
||||
resources->OES_EGL_image_external = 0;
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
|
@ -66,6 +67,7 @@ int main(int argc, char* argv[])
|
|||
char* buffer = 0;
|
||||
int bufferLen = 0;
|
||||
int numAttribs = 0, numUniforms = 0;
|
||||
ShShaderOutput output = SH_ESSL_OUTPUT;
|
||||
|
||||
ShInitialize();
|
||||
|
||||
|
@ -81,6 +83,21 @@ int main(int argc, char* argv[])
|
|||
case 'm': compileOptions |= SH_MAP_LONG_VARIABLE_NAMES; break;
|
||||
case 'o': compileOptions |= SH_OBJECT_CODE; break;
|
||||
case 'u': compileOptions |= SH_ATTRIBUTES_UNIFORMS; break;
|
||||
case 'l': compileOptions |= SH_UNROLL_FOR_LOOP_WITH_INTEGER_INDEX; break;
|
||||
case 'e': compileOptions |= SH_EMULATE_BUILT_IN_FUNCTIONS; break;
|
||||
case 'b':
|
||||
if (argv[0][2] == '=') {
|
||||
switch (argv[0][3]) {
|
||||
case 'e': output = SH_ESSL_OUTPUT; break;
|
||||
case 'g': output = SH_GLSL_OUTPUT; break;
|
||||
case 'h': output = SH_HLSL_OUTPUT; break;
|
||||
default: failCode = EFailUsage;
|
||||
}
|
||||
} else {
|
||||
failCode = EFailUsage;
|
||||
}
|
||||
break;
|
||||
case 'a': resources.OES_EGL_image_external = 1; break;
|
||||
default: failCode = EFailUsage;
|
||||
}
|
||||
} else {
|
||||
|
@ -88,12 +105,14 @@ int main(int argc, char* argv[])
|
|||
switch (FindShaderType(argv[0])) {
|
||||
case SH_VERTEX_SHADER:
|
||||
if (vertexCompiler == 0)
|
||||
vertexCompiler = ShConstructCompiler(SH_VERTEX_SHADER, SH_GLES2_SPEC, &resources);
|
||||
vertexCompiler = ShConstructCompiler(
|
||||
SH_VERTEX_SHADER, SH_GLES2_SPEC, output, &resources);
|
||||
compiler = vertexCompiler;
|
||||
break;
|
||||
case SH_FRAGMENT_SHADER:
|
||||
if (fragmentCompiler == 0)
|
||||
fragmentCompiler = ShConstructCompiler(SH_FRAGMENT_SHADER, SH_GLES2_SPEC, &resources);
|
||||
fragmentCompiler = ShConstructCompiler(
|
||||
SH_FRAGMENT_SHADER, SH_GLES2_SPEC, output, &resources);
|
||||
compiler = fragmentCompiler;
|
||||
break;
|
||||
default: break;
|
||||
|
@ -159,12 +178,18 @@ int main(int argc, char* argv[])
|
|||
//
|
||||
void usage()
|
||||
{
|
||||
printf("Usage: translate [-i -m -o -u] file1 file2 ...\n"
|
||||
"Where: filename = filename ending in .frag or .vert\n"
|
||||
" -i = print intermediate tree\n"
|
||||
" -m = map long variable names\n"
|
||||
" -o = print translated code\n"
|
||||
" -u = print active attribs and uniforms\n");
|
||||
printf("Usage: translate [-i -m -o -u -l -e -b=e -b=g -b=h -a] file1 file2 ...\n"
|
||||
"Where: filename : filename ending in .frag or .vert\n"
|
||||
" -i : print intermediate tree\n"
|
||||
" -m : map long variable names\n"
|
||||
" -o : print translated code\n"
|
||||
" -u : print active attribs and uniforms\n"
|
||||
" -l : unroll for-loops with integer indices\n"
|
||||
" -e : emulate certain built-in functions (workaround for driver bugs)\n"
|
||||
" -b=e : output GLSL ES code (this is by default)\n"
|
||||
" -b=g : output GLSL code\n"
|
||||
" -b=h : output HLSL code\n"
|
||||
" -a : enable GL_OES_EGL_image_external\n");
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
@ -21,25 +21,43 @@ EndProject
|
|||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Debug|x64 = Debug|x64
|
||||
Release|Win32 = Release|Win32
|
||||
Release|x64 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{E746FCA9-64C3-433E-85E8-9A5A67AB7ED6}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{E746FCA9-64C3-433E-85E8-9A5A67AB7ED6}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{E746FCA9-64C3-433E-85E8-9A5A67AB7ED6}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{E746FCA9-64C3-433E-85E8-9A5A67AB7ED6}.Debug|x64.Build.0 = Debug|x64
|
||||
{E746FCA9-64C3-433E-85E8-9A5A67AB7ED6}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{E746FCA9-64C3-433E-85E8-9A5A67AB7ED6}.Release|Win32.Build.0 = Release|Win32
|
||||
{E746FCA9-64C3-433E-85E8-9A5A67AB7ED6}.Release|x64.ActiveCfg = Release|x64
|
||||
{E746FCA9-64C3-433E-85E8-9A5A67AB7ED6}.Release|x64.Build.0 = Release|x64
|
||||
{B5871A7A-968C-42E3-A33B-981E6F448E78}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{B5871A7A-968C-42E3-A33B-981E6F448E78}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{B5871A7A-968C-42E3-A33B-981E6F448E78}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{B5871A7A-968C-42E3-A33B-981E6F448E78}.Debug|x64.Build.0 = Debug|x64
|
||||
{B5871A7A-968C-42E3-A33B-981E6F448E78}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{B5871A7A-968C-42E3-A33B-981E6F448E78}.Release|Win32.Build.0 = Release|Win32
|
||||
{B5871A7A-968C-42E3-A33B-981E6F448E78}.Release|x64.ActiveCfg = Release|x64
|
||||
{B5871A7A-968C-42E3-A33B-981E6F448E78}.Release|x64.Build.0 = Release|x64
|
||||
{5620F0E4-6C43-49BC-A178-B804E1A0C3A7}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{5620F0E4-6C43-49BC-A178-B804E1A0C3A7}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{5620F0E4-6C43-49BC-A178-B804E1A0C3A7}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{5620F0E4-6C43-49BC-A178-B804E1A0C3A7}.Debug|x64.Build.0 = Debug|x64
|
||||
{5620F0E4-6C43-49BC-A178-B804E1A0C3A7}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{5620F0E4-6C43-49BC-A178-B804E1A0C3A7}.Release|Win32.Build.0 = Release|Win32
|
||||
{5620F0E4-6C43-49BC-A178-B804E1A0C3A7}.Release|x64.ActiveCfg = Release|x64
|
||||
{5620F0E4-6C43-49BC-A178-B804E1A0C3A7}.Release|x64.Build.0 = Release|x64
|
||||
{5B3A6DB8-1E7E-40D7-92B9-DA8AAE619FAD}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{5B3A6DB8-1E7E-40D7-92B9-DA8AAE619FAD}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{5B3A6DB8-1E7E-40D7-92B9-DA8AAE619FAD}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{5B3A6DB8-1E7E-40D7-92B9-DA8AAE619FAD}.Debug|x64.Build.0 = Debug|x64
|
||||
{5B3A6DB8-1E7E-40D7-92B9-DA8AAE619FAD}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{5B3A6DB8-1E7E-40D7-92B9-DA8AAE619FAD}.Release|Win32.Build.0 = Release|Win32
|
||||
{5B3A6DB8-1E7E-40D7-92B9-DA8AAE619FAD}.Release|x64.ActiveCfg = Release|x64
|
||||
{5B3A6DB8-1E7E-40D7-92B9-DA8AAE619FAD}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
|
@ -19,11 +19,17 @@
|
|||
],
|
||||
'sources': [
|
||||
'compiler/BaseTypes.h',
|
||||
'compiler/BuiltInFunctionEmulator.cpp',
|
||||
'compiler/BuiltInFunctionEmulator.h',
|
||||
'compiler/Common.h',
|
||||
'compiler/Compiler.cpp',
|
||||
'compiler/ConstantUnion.h',
|
||||
'compiler/compilerdebug.cpp',
|
||||
'compiler/compilerdebug.h',
|
||||
'compiler/debug.cpp',
|
||||
'compiler/debug.h',
|
||||
'compiler/DetectRecursion.cpp',
|
||||
'compiler/DetectRecursion.h',
|
||||
'compiler/ForLoopUnroll.cpp',
|
||||
'compiler/ForLoopUnroll.h',
|
||||
'compiler/glslang.h',
|
||||
'compiler/glslang_lex.cpp',
|
||||
'compiler/glslang_tab.cpp',
|
||||
|
@ -59,7 +65,6 @@
|
|||
'compiler/SymbolTable.cpp',
|
||||
'compiler/SymbolTable.h',
|
||||
'compiler/Types.h',
|
||||
'compiler/unistd.h',
|
||||
'compiler/util.cpp',
|
||||
'compiler/util.h',
|
||||
'compiler/ValidateLimitations.cpp',
|
||||
|
@ -102,10 +107,14 @@
|
|||
],
|
||||
'sources': [
|
||||
'compiler/CodeGenGLSL.cpp',
|
||||
'compiler/ForLoopUnroll.cpp',
|
||||
'compiler/ForLoopUnroll.h',
|
||||
'compiler/OutputESSL.cpp',
|
||||
'compiler/OutputESSL.h',
|
||||
'compiler/OutputGLSLBase.cpp',
|
||||
'compiler/OutputGLSLBase.h',
|
||||
'compiler/OutputGLSL.cpp',
|
||||
'compiler/OutputGLSL.h',
|
||||
'compiler/TranslatorESSL.cpp',
|
||||
'compiler/TranslatorESSL.h',
|
||||
'compiler/TranslatorGLSL.cpp',
|
||||
'compiler/TranslatorGLSL.h',
|
||||
'compiler/VersionGLSL.cpp',
|
||||
|
@ -169,6 +178,7 @@
|
|||
'libGLESv2/HandleAllocator.h',
|
||||
'libGLESv2/libGLESv2.cpp',
|
||||
'libGLESv2/libGLESv2.def',
|
||||
'libGLESv2/libGLESv2.rc',
|
||||
'libGLESv2/main.cpp',
|
||||
'libGLESv2/main.h',
|
||||
'libGLESv2/mathutil.h',
|
||||
|
@ -217,6 +227,7 @@
|
|||
'libEGL/Display.h',
|
||||
'libEGL/libEGL.cpp',
|
||||
'libEGL/libEGL.def',
|
||||
'libEGL/libEGL.rc',
|
||||
'libEGL/main.cpp',
|
||||
'libEGL/main.h',
|
||||
'libEGL/Surface.cpp',
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#define MAJOR_VERSION 0
|
||||
#define MINOR_VERSION 0
|
||||
#define BUILD_VERSION 0
|
||||
#define BUILD_REVISION 686
|
||||
#define BUILD_REVISION 740
|
||||
|
||||
#define STRINGIFY(x) #x
|
||||
#define MACRO_STRINGIFY(x) STRINGIFY(x)
|
||||
|
|
|
@ -42,6 +42,7 @@ enum TBasicType
|
|||
EbtGuardSamplerBegin, // non type: see implementation of IsSampler()
|
||||
EbtSampler2D,
|
||||
EbtSamplerCube,
|
||||
EbtSamplerExternalOES, // Only valid if OES_EGL_image_external exists.
|
||||
EbtGuardSamplerEnd, // non type: see implementation of IsSampler()
|
||||
EbtStruct,
|
||||
EbtAddress, // should be deprecated??
|
||||
|
@ -57,6 +58,7 @@ inline const char* getBasicString(TBasicType t)
|
|||
case EbtBool: return "bool"; break;
|
||||
case EbtSampler2D: return "sampler2D"; break;
|
||||
case EbtSamplerCube: return "samplerCube"; break;
|
||||
case EbtSamplerExternalOES: return "samplerExternalOES"; break;
|
||||
case EbtStruct: return "structure"; break;
|
||||
default: return "unknown type";
|
||||
}
|
||||
|
|
|
@ -0,0 +1,161 @@
|
|||
//
|
||||
// Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
//
|
||||
|
||||
#include "compiler/BuiltInFunctionEmulator.h"
|
||||
|
||||
#include "compiler/SymbolTable.h"
|
||||
|
||||
namespace {
|
||||
|
||||
const char* kFunctionEmulationSource[] = {
|
||||
"float webgl_normalize_emu(float a) { return normalize(a) * 1; }",
|
||||
"vec2 webgl_normalize_emu(vec2 a) { return normalize(a) * 1; }",
|
||||
"vec3 webgl_normalize_emu(vec3 a) { return normalize(a) * 1; }",
|
||||
"vec4 webgl_normalize_emu(vec4 a) { return normalize(a) * 1; }",
|
||||
"float webgl_abs_emu(float a) { float rt = abs(a); if (rt < 0.0) rt = 0.0; return rt; }",
|
||||
"vec2 webgl_abs_emu(vec2 a) { vec2 rt = abs(a); if (rt[0] < 0.0) rt[0] = 0.0; return rt; }",
|
||||
"vec3 webgl_abs_emu(vec3 a) { vec3 rt = abs(a); if (rt[0] < 0.0) rt[0] = 0.0; return rt; }",
|
||||
"vec4 webgl_abs_emu(vec4 a) { vec4 rt = abs(a); if (rt[0] < 0.0) rt[0] = 0.0; return rt; }",
|
||||
"float webgl_sign_emu(float a) { float rt = sign(a); if (rt > 1.0) rt = 1.0; return rt; }",
|
||||
"vec2 webgl_sign_emu(vec2 a) { float rt = sign(a); if (rt[0] > 1.0) rt[0] = 1.0; return rt; }",
|
||||
"vec3 webgl_sign_emu(vec3 a) { float rt = sign(a); if (rt[0] > 1.0) rt[0] = 1.0; return rt; }",
|
||||
"vec4 webgl_sign_emu(vec4 a) { float rt = sign(a); if (rt[0] > 1.0) rt[0] = 1.0; return rt; }",
|
||||
};
|
||||
|
||||
class BuiltInFunctionEmulationMarker : public TIntermTraverser {
|
||||
public:
|
||||
BuiltInFunctionEmulationMarker(BuiltInFunctionEmulator& emulator)
|
||||
: mEmulator(emulator)
|
||||
{
|
||||
}
|
||||
|
||||
virtual bool visitUnary(Visit visit, TIntermUnary* node)
|
||||
{
|
||||
if (visit == PreVisit) {
|
||||
bool needToEmulate = mEmulator.SetFunctionCalled(
|
||||
node->getOp(), node->getOperand()->getType());
|
||||
if (needToEmulate)
|
||||
node->setUseEmulatedFunction();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
BuiltInFunctionEmulator& mEmulator;
|
||||
};
|
||||
|
||||
} // anonymous namepsace
|
||||
|
||||
BuiltInFunctionEmulator::BuiltInFunctionEmulator()
|
||||
: mFunctionGroupMask(TFunctionGroupAll)
|
||||
{
|
||||
}
|
||||
|
||||
void BuiltInFunctionEmulator::SetFunctionGroupMask(
|
||||
unsigned int functionGroupMask)
|
||||
{
|
||||
mFunctionGroupMask = functionGroupMask;
|
||||
}
|
||||
|
||||
bool BuiltInFunctionEmulator::SetFunctionCalled(
|
||||
TOperator op, const TType& returnType)
|
||||
{
|
||||
TBuiltInFunction function = IdentifyFunction(op, returnType);
|
||||
if (function == TFunctionUnknown)
|
||||
return false;
|
||||
for (size_t i = 0; i < mFunctions.size(); ++i) {
|
||||
if (mFunctions[i] == function)
|
||||
return true;
|
||||
}
|
||||
switch (function) {
|
||||
case TFunctionNormalize1:
|
||||
case TFunctionNormalize2:
|
||||
case TFunctionNormalize3:
|
||||
case TFunctionNormalize4:
|
||||
if (mFunctionGroupMask & TFunctionGroupNormalize) {
|
||||
mFunctions.push_back(function);
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case TFunctionAbs1:
|
||||
case TFunctionAbs2:
|
||||
case TFunctionAbs3:
|
||||
case TFunctionAbs4:
|
||||
if (mFunctionGroupMask & TFunctionGroupAbs) {
|
||||
mFunctions.push_back(function);
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case TFunctionSign1:
|
||||
case TFunctionSign2:
|
||||
case TFunctionSign3:
|
||||
case TFunctionSign4:
|
||||
if (mFunctionGroupMask & TFunctionGroupSign) {
|
||||
mFunctions.push_back(function);
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void BuiltInFunctionEmulator::OutputEmulatedFunctionDefinition(
|
||||
TInfoSinkBase& out, bool withPrecision) const
|
||||
{
|
||||
if (mFunctions.size() == 0)
|
||||
return;
|
||||
out << "// BEGIN: Generated code for built-in function emulation\n\n";
|
||||
if (withPrecision) {
|
||||
out << "#if defined(GL_FRAGMENT_PRECISION_HIGH) && (GL_FRAGMENT_PRECISION_HIGH == 1)\n"
|
||||
<< "precision highp float;\n"
|
||||
<< "#else\n"
|
||||
<< "precision mediump float;\n"
|
||||
<< "#endif\n\n";
|
||||
}
|
||||
for (size_t i = 0; i < mFunctions.size(); ++i) {
|
||||
out << kFunctionEmulationSource[mFunctions[i]] << "\n\n";
|
||||
}
|
||||
out << "// END: Generated code for built-in function emulation\n\n";
|
||||
}
|
||||
|
||||
BuiltInFunctionEmulator::TBuiltInFunction
|
||||
BuiltInFunctionEmulator::IdentifyFunction(TOperator op, const TType& returnType)
|
||||
{
|
||||
unsigned int function = TFunctionUnknown;
|
||||
if (op == EOpNormalize)
|
||||
function = TFunctionNormalize1;
|
||||
else if (op == EOpAbs)
|
||||
function = TFunctionAbs1;
|
||||
else if (op == EOpSign)
|
||||
function = TFunctionSign1;
|
||||
else
|
||||
return static_cast<TBuiltInFunction>(function);
|
||||
|
||||
if (returnType.isVector())
|
||||
function += returnType.getNominalSize() - 1;
|
||||
return static_cast<TBuiltInFunction>(function);
|
||||
}
|
||||
|
||||
void BuiltInFunctionEmulator::MarkBuiltInFunctionsForEmulation(
|
||||
TIntermNode* root)
|
||||
{
|
||||
ASSERT(root);
|
||||
|
||||
BuiltInFunctionEmulationMarker marker(*this);
|
||||
root->traverse(&marker);
|
||||
}
|
||||
|
||||
//static
|
||||
TString BuiltInFunctionEmulator::GetEmulatedFunctionName(
|
||||
const TString& name)
|
||||
{
|
||||
ASSERT(name[name.length() - 1] == '(');
|
||||
return "webgl_" + name.substr(0, name.length() - 1) + "_emu(";
|
||||
}
|
||||
|
|
@ -0,0 +1,86 @@
|
|||
//
|
||||
// Copyright (c) 2011 The ANGLE Project Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
//
|
||||
|
||||
#ifndef COMPILIER_BUILT_IN_FUNCTION_EMULATOR_H_
|
||||
#define COMPILIER_BUILT_IN_FUNCTION_EMULATOR_H_
|
||||
|
||||
#include "compiler/InfoSink.h"
|
||||
#include "compiler/intermediate.h"
|
||||
|
||||
//
|
||||
// Built-in function groups. We only list the ones that might need to be
|
||||
// emulated in certain os/drivers, assuming they are no more than 32.
|
||||
//
|
||||
enum TBuiltInFunctionGroup {
|
||||
TFunctionGroupNormalize = 1 << 0,
|
||||
TFunctionGroupAbs = 1 << 1,
|
||||
TFunctionGroupSign = 1 << 2,
|
||||
TFunctionGroupAll =
|
||||
TFunctionGroupNormalize | TFunctionGroupAbs | TFunctionGroupSign
|
||||
};
|
||||
|
||||
//
|
||||
// This class decides which built-in functions need to be replaced with the
|
||||
// emulated ones.
|
||||
// It's only a workaround for OpenGL driver bugs, and isn't needed in general.
|
||||
//
|
||||
class BuiltInFunctionEmulator {
|
||||
public:
|
||||
BuiltInFunctionEmulator();
|
||||
|
||||
// functionGroupMask is a bitmap of TBuiltInFunctionGroup.
|
||||
// We only emulate functions that are marked by this mask and are actually
|
||||
// called in a given shader.
|
||||
// By default the value is TFunctionGroupAll.
|
||||
void SetFunctionGroupMask(unsigned int functionGroupMask);
|
||||
|
||||
// Records that a function is called by the shader and might needs to be
|
||||
// emulated. If the function's group is not in mFunctionGroupFilter, this
|
||||
// becomes an no-op.
|
||||
// Returns true if the function call needs to be replaced with an emulated
|
||||
// one.
|
||||
// TODO(zmo): for now, an operator and a return type is enough to identify
|
||||
// the function we want to emulate. Should make this more flexible to
|
||||
// handle any functions.
|
||||
bool SetFunctionCalled(TOperator op, const TType& returnType);
|
||||
|
||||
// Output function emulation definition. This should be before any other
|
||||
// shader source.
|
||||
void OutputEmulatedFunctionDefinition(TInfoSinkBase& out, bool withPrecision) const;
|
||||
|
||||
void MarkBuiltInFunctionsForEmulation(TIntermNode* root);
|
||||
|
||||
// "name(" becomes "webgl_name_emu(".
|
||||
static TString GetEmulatedFunctionName(const TString& name);
|
||||
|
||||
private:
|
||||
//
|
||||
// Built-in functions.
|
||||
//
|
||||
enum TBuiltInFunction {
|
||||
TFunctionNormalize1 = 0, // float normalize(float);
|
||||
TFunctionNormalize2, // vec2 normalize(vec2);
|
||||
TFunctionNormalize3, // vec3 normalize(vec3);
|
||||
TFunctionNormalize4, // fec4 normalize(vec4);
|
||||
TFunctionAbs1, // float abs(float);
|
||||
TFunctionAbs2, // vec2 abs(vec2);
|
||||
TFunctionAbs3, // vec3 abs(vec3);
|
||||
TFunctionAbs4, // vec4 abs(vec4);
|
||||
TFunctionSign1, // float sign(float);
|
||||
TFunctionSign2, // vec2 sign(vec2);
|
||||
TFunctionSign3, // vec3 sign(vec3);
|
||||
TFunctionSign4, // vec4 sign(vec4);
|
||||
TFunctionUnknown
|
||||
};
|
||||
|
||||
// Same TODO as SetFunctionCalled.
|
||||
TBuiltInFunction IdentifyFunction(TOperator op, const TType& returnType);
|
||||
|
||||
TVector<TBuiltInFunction> mFunctions;
|
||||
unsigned int mFunctionGroupMask; // a bitmap of TBuiltInFunctionGroup.
|
||||
};
|
||||
|
||||
#endif // COMPILIER_BUILT_IN_FUNCTION_EMULATOR_H_
|
|
@ -5,15 +5,24 @@
|
|||
//
|
||||
|
||||
#include "compiler/TranslatorGLSL.h"
|
||||
#include "compiler/TranslatorESSL.h"
|
||||
|
||||
//
|
||||
// This function must be provided to create the actual
|
||||
// compile object used by higher level code. It returns
|
||||
// a subclass of TCompiler.
|
||||
//
|
||||
TCompiler* ConstructCompiler(ShShaderType type, ShShaderSpec spec)
|
||||
TCompiler* ConstructCompiler(
|
||||
ShShaderType type, ShShaderSpec spec, ShShaderOutput output)
|
||||
{
|
||||
return new TranslatorGLSL(type, spec);
|
||||
switch (output) {
|
||||
case SH_GLSL_OUTPUT:
|
||||
return new TranslatorGLSL(type, spec);
|
||||
case SH_ESSL_OUTPUT:
|
||||
return new TranslatorESSL(type, spec);
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
@ -11,9 +11,15 @@
|
|||
// compile object used by higher level code. It returns
|
||||
// a subclass of TCompiler.
|
||||
//
|
||||
TCompiler* ConstructCompiler(ShShaderType type, ShShaderSpec spec)
|
||||
TCompiler* ConstructCompiler(
|
||||
ShShaderType type, ShShaderSpec spec, ShShaderOutput output)
|
||||
{
|
||||
return new TranslatorHLSL(type, spec);
|
||||
switch (output) {
|
||||
case SH_HLSL_OUTPUT:
|
||||
return new TranslatorHLSL(type, spec);
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
@ -4,7 +4,9 @@
|
|||
// found in the LICENSE file.
|
||||
//
|
||||
|
||||
#include "compiler/BuiltInFunctionEmulator.h"
|
||||
#include "compiler/DetectRecursion.h"
|
||||
#include "compiler/ForLoopUnroll.h"
|
||||
#include "compiler/Initialize.h"
|
||||
#include "compiler/ParseHelper.h"
|
||||
#include "compiler/ShHandle.h"
|
||||
|
@ -19,7 +21,10 @@ bool InitializeSymbolTable(
|
|||
{
|
||||
TIntermediate intermediate(infoSink);
|
||||
TExtensionBehavior extBehavior;
|
||||
TParseContext parseContext(symbolTable, extBehavior, intermediate, type, spec, 0, NULL, infoSink);
|
||||
InitExtensionBehavior(resources, extBehavior);
|
||||
// The builtins deliberately don't specify precisions for the function
|
||||
// arguments and return types. For that reason we don't try to check them.
|
||||
TParseContext parseContext(symbolTable, extBehavior, intermediate, type, spec, 0, false, NULL, infoSink);
|
||||
|
||||
GlobalParseContext = &parseContext;
|
||||
|
||||
|
@ -128,7 +133,7 @@ bool TCompiler::compile(const char* const shaderStrings[],
|
|||
|
||||
TIntermediate intermediate(infoSink);
|
||||
TParseContext parseContext(symbolTable, extensionBehavior, intermediate,
|
||||
shaderType, shaderSpec, compileOptions,
|
||||
shaderType, shaderSpec, compileOptions, true,
|
||||
sourcePath, infoSink);
|
||||
GlobalParseContext = &parseContext;
|
||||
|
||||
|
@ -152,6 +157,14 @@ bool TCompiler::compile(const char* const shaderStrings[],
|
|||
if (success && (compileOptions & SH_VALIDATE_LOOP_INDEXING))
|
||||
success = validateLimitations(root);
|
||||
|
||||
// Unroll for-loop markup needs to happen after validateLimitations pass.
|
||||
if (success && (compileOptions & SH_UNROLL_FOR_LOOP_WITH_INTEGER_INDEX))
|
||||
ForLoopUnroll::MarkForLoopsWithIntegerIndicesForUnrolling(root);
|
||||
|
||||
// Built-in function emulation needs to happen after validateLimitations pass.
|
||||
if (success && (compileOptions & SH_EMULATE_BUILT_IN_FUNCTIONS))
|
||||
builtInFunctionEmulator.MarkBuiltInFunctionsForEmulation(root);
|
||||
|
||||
// Call mapLongVariableNames() before collectAttribsUniforms() so in
|
||||
// collectAttribsUniforms() we already have the mapped symbol names and
|
||||
// we could composite mapped and original variable names.
|
||||
|
@ -238,3 +251,13 @@ int TCompiler::getMappedNameMaxLength() const
|
|||
{
|
||||
return MAX_IDENTIFIER_NAME_SIZE + 1;
|
||||
}
|
||||
|
||||
const TExtensionBehavior& TCompiler::getExtensionBehavior() const
|
||||
{
|
||||
return extensionBehavior;
|
||||
}
|
||||
|
||||
const BuiltInFunctionEmulator& TCompiler::getBuiltInFunctionEmulator() const
|
||||
{
|
||||
return builtInFunctionEmulator;
|
||||
}
|
||||
|
|
|
@ -64,29 +64,6 @@ DetectRecursion::~DetectRecursion()
|
|||
delete functions[i];
|
||||
}
|
||||
|
||||
void DetectRecursion::visitSymbol(TIntermSymbol*)
|
||||
{
|
||||
}
|
||||
|
||||
void DetectRecursion::visitConstantUnion(TIntermConstantUnion*)
|
||||
{
|
||||
}
|
||||
|
||||
bool DetectRecursion::visitBinary(Visit, TIntermBinary*)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DetectRecursion::visitUnary(Visit, TIntermUnary*)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DetectRecursion::visitSelection(Visit, TIntermSelection*)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DetectRecursion::visitAggregate(Visit visit, TIntermAggregate* node)
|
||||
{
|
||||
switch (node->getOp())
|
||||
|
@ -126,16 +103,6 @@ bool DetectRecursion::visitAggregate(Visit visit, TIntermAggregate* node)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool DetectRecursion::visitLoop(Visit, TIntermLoop*)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DetectRecursion::visitBranch(Visit, TIntermBranch*)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
DetectRecursion::ErrorCode DetectRecursion::detectRecursion()
|
||||
{
|
||||
FunctionNode* main = findFunctionByName("main(");
|
||||
|
|
|
@ -24,14 +24,7 @@ public:
|
|||
DetectRecursion();
|
||||
~DetectRecursion();
|
||||
|
||||
virtual void visitSymbol(TIntermSymbol*);
|
||||
virtual void visitConstantUnion(TIntermConstantUnion*);
|
||||
virtual bool visitBinary(Visit, TIntermBinary*);
|
||||
virtual bool visitUnary(Visit, TIntermUnary*);
|
||||
virtual bool visitSelection(Visit, TIntermSelection*);
|
||||
virtual bool visitAggregate(Visit, TIntermAggregate*);
|
||||
virtual bool visitLoop(Visit, TIntermLoop*);
|
||||
virtual bool visitBranch(Visit, TIntermBranch*);
|
||||
|
||||
ErrorCode detectRecursion();
|
||||
|
||||
|
|
|
@ -13,9 +13,26 @@ typedef enum {
|
|||
EBhRequire,
|
||||
EBhEnable,
|
||||
EBhWarn,
|
||||
EBhDisable
|
||||
EBhDisable,
|
||||
EBhUndefined,
|
||||
} TBehavior;
|
||||
|
||||
inline const char* getBehaviorString(TBehavior b)
|
||||
{
|
||||
switch(b) {
|
||||
case EBhRequire:
|
||||
return "require";
|
||||
case EBhEnable:
|
||||
return "enable";
|
||||
case EBhWarn:
|
||||
return "warn";
|
||||
case EBhDisable:
|
||||
return "disable";
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
typedef TMap<TString, TBehavior> TExtensionBehavior;
|
||||
|
||||
#endif // _EXTENSION_TABLE_INCLUDED_
|
||||
|
|
|
@ -6,6 +6,39 @@
|
|||
|
||||
#include "compiler/ForLoopUnroll.h"
|
||||
|
||||
namespace {
|
||||
|
||||
class IntegerForLoopUnrollMarker : public TIntermTraverser {
|
||||
public:
|
||||
|
||||
virtual bool visitLoop(Visit, TIntermLoop* node)
|
||||
{
|
||||
// This is called after ValidateLimitations pass, so all the ASSERT
|
||||
// should never fail.
|
||||
// See ValidateLimitations::validateForLoopInit().
|
||||
ASSERT(node);
|
||||
ASSERT(node->getType() == ELoopFor);
|
||||
ASSERT(node->getInit());
|
||||
TIntermAggregate* decl = node->getInit()->getAsAggregate();
|
||||
ASSERT(decl && decl->getOp() == EOpDeclaration);
|
||||
TIntermSequence& declSeq = decl->getSequence();
|
||||
ASSERT(declSeq.size() == 1);
|
||||
TIntermBinary* declInit = declSeq[0]->getAsBinaryNode();
|
||||
ASSERT(declInit && declInit->getOp() == EOpInitialize);
|
||||
ASSERT(declInit->getLeft());
|
||||
TIntermSymbol* symbol = declInit->getLeft()->getAsSymbolNode();
|
||||
ASSERT(symbol);
|
||||
TBasicType type = symbol->getBasicType();
|
||||
ASSERT(type == EbtInt || type == EbtFloat);
|
||||
if (type == EbtInt)
|
||||
node->setUnrollFlag(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
} // anonymous namepsace
|
||||
|
||||
void ForLoopUnroll::FillLoopIndexInfo(TIntermLoop* node, TLoopIndexInfo& info)
|
||||
{
|
||||
ASSERT(node->getType() == ELoopFor);
|
||||
|
@ -109,6 +142,16 @@ void ForLoopUnroll::Pop()
|
|||
mLoopIndexStack.pop_back();
|
||||
}
|
||||
|
||||
// static
|
||||
void ForLoopUnroll::MarkForLoopsWithIntegerIndicesForUnrolling(
|
||||
TIntermNode* root)
|
||||
{
|
||||
ASSERT(root);
|
||||
|
||||
IntegerForLoopUnrollMarker marker;
|
||||
root->traverse(&marker);
|
||||
}
|
||||
|
||||
int ForLoopUnroll::getLoopIncrement(TIntermLoop* node)
|
||||
{
|
||||
TIntermNode* expr = node->getExpression();
|
||||
|
|
|
@ -36,6 +36,8 @@ public:
|
|||
void Push(TLoopIndexInfo& info);
|
||||
void Pop();
|
||||
|
||||
static void MarkForLoopsWithIntegerIndicesForUnrolling(TIntermNode* root);
|
||||
|
||||
private:
|
||||
int getLoopIncrement(TIntermLoop* node);
|
||||
|
||||
|
|
|
@ -363,6 +363,12 @@ static TString BuiltInFunctionsVertex(const ShBuiltInResources& resources)
|
|||
s.append(TString("vec4 texture2DProjLod(sampler2D sampler, vec4 coord, float lod);"));
|
||||
s.append(TString("vec4 textureCubeLod(samplerCube sampler, vec3 coord, float lod);"));
|
||||
|
||||
if (resources.OES_EGL_image_external) {
|
||||
s.append(TString("vec4 texture2D(samplerExternalOES sampler, vec2 coord);"));
|
||||
s.append(TString("vec4 texture2DProj(samplerExternalOES sampler, vec3 coord);"));
|
||||
s.append(TString("vec4 texture2DProj(samplerExternalOES sampler, vec4 coord);"));
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
|
@ -388,6 +394,12 @@ static TString BuiltInFunctionsFragment(const ShBuiltInResources& resources)
|
|||
s.append(TString("vec4 texture2DProj(sampler2D sampler, vec4 coord, float bias);"));
|
||||
s.append(TString("vec4 textureCube(samplerCube sampler, vec3 coord, float bias);"));
|
||||
|
||||
if (resources.OES_EGL_image_external) {
|
||||
s.append(TString("vec4 texture2D(samplerExternalOES sampler, vec2 coord);"));
|
||||
s.append(TString("vec4 texture2DProj(samplerExternalOES sampler, vec3 coord);"));
|
||||
s.append(TString("vec4 texture2DProj(samplerExternalOES sampler, vec4 coord);"));
|
||||
}
|
||||
|
||||
if (resources.OES_standard_derivatives) {
|
||||
s.append(TString("float dFdx(float p);"));
|
||||
s.append(TString("vec2 dFdx(vec2 p);"));
|
||||
|
@ -625,5 +637,7 @@ void InitExtensionBehavior(const ShBuiltInResources& resources,
|
|||
TExtensionBehavior& extBehavior)
|
||||
{
|
||||
if (resources.OES_standard_derivatives)
|
||||
extBehavior["GL_OES_standard_derivatives"] = EBhDisable;
|
||||
extBehavior["GL_OES_standard_derivatives"] = EBhUndefined;
|
||||
if (resources.OES_EGL_image_external)
|
||||
extBehavior["GL_OES_EGL_image_external"] = EBhUndefined;
|
||||
}
|
||||
|
|
|
@ -48,37 +48,10 @@ void MapLongVariableNames::visitSymbol(TIntermSymbol* symbol)
|
|||
}
|
||||
}
|
||||
|
||||
void MapLongVariableNames::visitConstantUnion(TIntermConstantUnion*)
|
||||
{
|
||||
}
|
||||
|
||||
bool MapLongVariableNames::visitBinary(Visit, TIntermBinary*)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MapLongVariableNames::visitUnary(Visit, TIntermUnary*)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MapLongVariableNames::visitSelection(Visit, TIntermSelection*)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MapLongVariableNames::visitAggregate(Visit, TIntermAggregate* node)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MapLongVariableNames::visitLoop(Visit, TIntermLoop*)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MapLongVariableNames::visitBranch(Visit, TIntermBranch*)
|
||||
bool MapLongVariableNames::visitLoop(Visit, TIntermLoop* node)
|
||||
{
|
||||
if (node->getInit())
|
||||
node->getInit()->traverse(this);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,13 +22,7 @@ public:
|
|||
MapLongVariableNames(TMap<TString, TString>& varyingLongNameMap);
|
||||
|
||||
virtual void visitSymbol(TIntermSymbol*);
|
||||
virtual void visitConstantUnion(TIntermConstantUnion*);
|
||||
virtual bool visitBinary(Visit, TIntermBinary*);
|
||||
virtual bool visitUnary(Visit, TIntermUnary*);
|
||||
virtual bool visitSelection(Visit, TIntermSelection*);
|
||||
virtual bool visitAggregate(Visit, TIntermAggregate*);
|
||||
virtual bool visitLoop(Visit, TIntermLoop*);
|
||||
virtual bool visitBranch(Visit, TIntermBranch*);
|
||||
|
||||
private:
|
||||
TString mapVaryingLongName(const TString& name);
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
//
|
||||
// Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
//
|
||||
|
||||
#include "compiler/OutputESSL.h"
|
||||
|
||||
TOutputESSL::TOutputESSL(TInfoSinkBase& objSink)
|
||||
: TOutputGLSLBase(objSink)
|
||||
{
|
||||
}
|
||||
|
||||
bool TOutputESSL::writeVariablePrecision(TPrecision precision)
|
||||
{
|
||||
if (precision == EbpUndefined)
|
||||
return false;
|
||||
|
||||
TInfoSinkBase& out = objSink();
|
||||
out << getPrecisionString(precision);
|
||||
return true;
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
//
|
||||
// Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
//
|
||||
|
||||
#ifndef CROSSCOMPILERGLSL_OUTPUTESSL_H_
|
||||
#define CROSSCOMPILERGLSL_OUTPUTESSL_H_
|
||||
|
||||
#include "compiler/OutputGLSLBase.h"
|
||||
|
||||
class TOutputESSL : public TOutputGLSLBase
|
||||
{
|
||||
public:
|
||||
TOutputESSL(TInfoSinkBase& objSink);
|
||||
|
||||
protected:
|
||||
virtual bool writeVariablePrecision(TPrecision precision);
|
||||
};
|
||||
|
||||
#endif // CROSSCOMPILERGLSL_OUTPUTESSL_H_
|
|
@ -5,706 +5,13 @@
|
|||
//
|
||||
|
||||
#include "compiler/OutputGLSL.h"
|
||||
#include "compiler/compilerdebug.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
TString getTypeName(const TType& type)
|
||||
{
|
||||
TInfoSinkBase out;
|
||||
if (type.isMatrix())
|
||||
{
|
||||
out << "mat";
|
||||
out << type.getNominalSize();
|
||||
}
|
||||
else if (type.isVector())
|
||||
{
|
||||
switch (type.getBasicType())
|
||||
{
|
||||
case EbtFloat: out << "vec"; break;
|
||||
case EbtInt: out << "ivec"; break;
|
||||
case EbtBool: out << "bvec"; break;
|
||||
default: UNREACHABLE(); break;
|
||||
}
|
||||
out << type.getNominalSize();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (type.getBasicType() == EbtStruct)
|
||||
out << type.getTypeName();
|
||||
else
|
||||
out << type.getBasicString();
|
||||
}
|
||||
return TString(out.c_str());
|
||||
}
|
||||
|
||||
TString arrayBrackets(const TType& type)
|
||||
{
|
||||
ASSERT(type.isArray());
|
||||
TInfoSinkBase out;
|
||||
out << "[" << type.getArraySize() << "]";
|
||||
return TString(out.c_str());
|
||||
}
|
||||
|
||||
bool isSingleStatement(TIntermNode* node) {
|
||||
if (const TIntermAggregate* aggregate = node->getAsAggregate())
|
||||
{
|
||||
return (aggregate->getOp() != EOpFunction) &&
|
||||
(aggregate->getOp() != EOpSequence);
|
||||
}
|
||||
else if (const TIntermSelection* selection = node->getAsSelectionNode())
|
||||
{
|
||||
// Ternary operators are usually part of an assignment operator.
|
||||
// This handles those rare cases in which they are all by themselves.
|
||||
return selection->usesTernaryOperator();
|
||||
}
|
||||
else if (node->getAsLoopNode())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
TOutputGLSL::TOutputGLSL(TInfoSinkBase& objSink)
|
||||
: TIntermTraverser(true, true, true),
|
||||
mObjSink(objSink),
|
||||
mDeclaringVariables(false)
|
||||
: TOutputGLSLBase(objSink)
|
||||
{
|
||||
}
|
||||
|
||||
void TOutputGLSL::writeTriplet(Visit visit, const char* preStr, const char* inStr, const char* postStr)
|
||||
bool TOutputGLSL::writeVariablePrecision(TPrecision)
|
||||
{
|
||||
TInfoSinkBase& out = objSink();
|
||||
if (visit == PreVisit && preStr)
|
||||
{
|
||||
out << preStr;
|
||||
}
|
||||
else if (visit == InVisit && inStr)
|
||||
{
|
||||
out << inStr;
|
||||
}
|
||||
else if (visit == PostVisit && postStr)
|
||||
{
|
||||
out << postStr;
|
||||
}
|
||||
}
|
||||
|
||||
void TOutputGLSL::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) &&
|
||||
(mDeclaredStructs.find(type.getTypeName()) == mDeclaredStructs.end()))
|
||||
{
|
||||
out << "struct " << type.getTypeName() << "{\n";
|
||||
const TTypeList* structure = type.getStruct();
|
||||
ASSERT(structure != NULL);
|
||||
for (size_t i = 0; i < structure->size(); ++i)
|
||||
{
|
||||
const TType* fieldType = (*structure)[i].type;
|
||||
ASSERT(fieldType != NULL);
|
||||
out << getTypeName(*fieldType) << " " << fieldType->getFieldName();
|
||||
if (fieldType->isArray())
|
||||
out << arrayBrackets(*fieldType);
|
||||
out << ";\n";
|
||||
}
|
||||
out << "}";
|
||||
mDeclaredStructs.insert(type.getTypeName());
|
||||
}
|
||||
else
|
||||
{
|
||||
out << getTypeName(type);
|
||||
}
|
||||
}
|
||||
|
||||
void TOutputGLSL::writeFunctionParameters(const TIntermSequence& args)
|
||||
{
|
||||
TInfoSinkBase& out = objSink();
|
||||
for (TIntermSequence::const_iterator iter = args.begin();
|
||||
iter != args.end(); ++iter)
|
||||
{
|
||||
const TIntermSymbol* arg = (*iter)->getAsSymbolNode();
|
||||
ASSERT(arg != NULL);
|
||||
|
||||
const TType& type = arg->getType();
|
||||
TQualifier qualifier = type.getQualifier();
|
||||
// TODO(alokp): Validate qualifier for function arguments.
|
||||
if ((qualifier != EvqTemporary) && (qualifier != EvqGlobal))
|
||||
out << type.getQualifierString() << " ";
|
||||
|
||||
out << getTypeName(type);
|
||||
|
||||
const TString& name = arg->getSymbol();
|
||||
if (!name.empty())
|
||||
out << " " << name;
|
||||
if (type.isArray())
|
||||
out << arrayBrackets(type);
|
||||
|
||||
// Put a comma if this is not the last argument.
|
||||
if (iter != args.end() - 1)
|
||||
out << ", ";
|
||||
}
|
||||
}
|
||||
|
||||
const ConstantUnion* TOutputGLSL::writeConstantUnion(const TType& type,
|
||||
const ConstantUnion* pConstUnion)
|
||||
{
|
||||
TInfoSinkBase& out = objSink();
|
||||
|
||||
if (type.getBasicType() == EbtStruct)
|
||||
{
|
||||
out << type.getTypeName() << "(";
|
||||
const TTypeList* structure = type.getStruct();
|
||||
ASSERT(structure != NULL);
|
||||
for (size_t i = 0; i < structure->size(); ++i)
|
||||
{
|
||||
const TType* fieldType = (*structure)[i].type;
|
||||
ASSERT(fieldType != NULL);
|
||||
pConstUnion = writeConstantUnion(*fieldType, pConstUnion);
|
||||
if (i != structure->size() - 1) out << ", ";
|
||||
}
|
||||
out << ")";
|
||||
}
|
||||
else
|
||||
{
|
||||
int size = type.getObjectSize();
|
||||
bool writeType = size > 1;
|
||||
if (writeType) out << getTypeName(type) << "(";
|
||||
for (int i = 0; i < size; ++i, ++pConstUnion)
|
||||
{
|
||||
switch (pConstUnion->getType())
|
||||
{
|
||||
case EbtFloat: out << pConstUnion->getFConst(); break;
|
||||
case EbtInt: out << pConstUnion->getIConst(); break;
|
||||
case EbtBool: out << pConstUnion->getBConst(); break;
|
||||
default: UNREACHABLE();
|
||||
}
|
||||
if (i != size - 1) out << ", ";
|
||||
}
|
||||
if (writeType) out << ")";
|
||||
}
|
||||
return pConstUnion;
|
||||
}
|
||||
|
||||
void TOutputGLSL::visitSymbol(TIntermSymbol* node)
|
||||
{
|
||||
TInfoSinkBase& out = objSink();
|
||||
if (mLoopUnroll.NeedsToReplaceSymbolWithValue(node))
|
||||
out << mLoopUnroll.GetLoopIndexValue(node);
|
||||
else
|
||||
out << node->getSymbol();
|
||||
|
||||
if (mDeclaringVariables && node->getType().isArray())
|
||||
out << arrayBrackets(node->getType());
|
||||
}
|
||||
|
||||
void TOutputGLSL::visitConstantUnion(TIntermConstantUnion* node)
|
||||
{
|
||||
writeConstantUnion(node->getType(), node->getUnionArrayPointer());
|
||||
}
|
||||
|
||||
bool TOutputGLSL::visitBinary(Visit visit, TIntermBinary* node)
|
||||
{
|
||||
bool visitChildren = true;
|
||||
TInfoSinkBase& out = objSink();
|
||||
switch (node->getOp())
|
||||
{
|
||||
case EOpInitialize:
|
||||
if (visit == InVisit)
|
||||
{
|
||||
out << " = ";
|
||||
// RHS of initialize is not being declared.
|
||||
mDeclaringVariables = false;
|
||||
}
|
||||
break;
|
||||
case EOpAssign: writeTriplet(visit, "(", " = ", ")"); break;
|
||||
case EOpAddAssign: writeTriplet(visit, "(", " += ", ")"); break;
|
||||
case EOpSubAssign: writeTriplet(visit, "(", " -= ", ")"); break;
|
||||
case EOpDivAssign: writeTriplet(visit, "(", " /= ", ")"); break;
|
||||
// Notice the fall-through.
|
||||
case EOpMulAssign:
|
||||
case EOpVectorTimesMatrixAssign:
|
||||
case EOpVectorTimesScalarAssign:
|
||||
case EOpMatrixTimesScalarAssign:
|
||||
case EOpMatrixTimesMatrixAssign:
|
||||
writeTriplet(visit, "(", " *= ", ")");
|
||||
break;
|
||||
|
||||
case EOpIndexDirect:
|
||||
case EOpIndexIndirect:
|
||||
writeTriplet(visit, NULL, "[", "]");
|
||||
break;
|
||||
case EOpIndexDirectStruct:
|
||||
if (visit == InVisit)
|
||||
{
|
||||
out << ".";
|
||||
// TODO(alokp): ASSERT
|
||||
out << node->getType().getFieldName();
|
||||
visitChildren = false;
|
||||
}
|
||||
break;
|
||||
case EOpVectorSwizzle:
|
||||
if (visit == InVisit)
|
||||
{
|
||||
out << ".";
|
||||
TIntermAggregate* rightChild = node->getRight()->getAsAggregate();
|
||||
TIntermSequence& sequence = rightChild->getSequence();
|
||||
for (TIntermSequence::iterator sit = sequence.begin(); sit != sequence.end(); ++sit)
|
||||
{
|
||||
TIntermConstantUnion* element = (*sit)->getAsConstantUnion();
|
||||
ASSERT(element->getBasicType() == EbtInt);
|
||||
ASSERT(element->getNominalSize() == 1);
|
||||
const ConstantUnion& data = element->getUnionArrayPointer()[0];
|
||||
ASSERT(data.getType() == EbtInt);
|
||||
switch (data.getIConst())
|
||||
{
|
||||
case 0: out << "x"; break;
|
||||
case 1: out << "y"; break;
|
||||
case 2: out << "z"; break;
|
||||
case 3: out << "w"; break;
|
||||
default: UNREACHABLE(); break;
|
||||
}
|
||||
}
|
||||
visitChildren = false;
|
||||
}
|
||||
break;
|
||||
|
||||
case EOpAdd: writeTriplet(visit, "(", " + ", ")"); break;
|
||||
case EOpSub: writeTriplet(visit, "(", " - ", ")"); break;
|
||||
case EOpMul: writeTriplet(visit, "(", " * ", ")"); break;
|
||||
case EOpDiv: writeTriplet(visit, "(", " / ", ")"); break;
|
||||
case EOpMod: UNIMPLEMENTED(); break;
|
||||
case EOpEqual: writeTriplet(visit, "(", " == ", ")"); break;
|
||||
case EOpNotEqual: writeTriplet(visit, "(", " != ", ")"); break;
|
||||
case EOpLessThan: writeTriplet(visit, "(", " < ", ")"); break;
|
||||
case EOpGreaterThan: writeTriplet(visit, "(", " > ", ")"); break;
|
||||
case EOpLessThanEqual: writeTriplet(visit, "(", " <= ", ")"); break;
|
||||
case EOpGreaterThanEqual: writeTriplet(visit, "(", " >= ", ")"); break;
|
||||
|
||||
// Notice the fall-through.
|
||||
case EOpVectorTimesScalar:
|
||||
case EOpVectorTimesMatrix:
|
||||
case EOpMatrixTimesVector:
|
||||
case EOpMatrixTimesScalar:
|
||||
case EOpMatrixTimesMatrix:
|
||||
writeTriplet(visit, "(", " * ", ")");
|
||||
break;
|
||||
|
||||
case EOpLogicalOr: writeTriplet(visit, "(", " || ", ")"); break;
|
||||
case EOpLogicalXor: writeTriplet(visit, "(", " ^^ ", ")"); break;
|
||||
case EOpLogicalAnd: writeTriplet(visit, "(", " && ", ")"); break;
|
||||
default: UNREACHABLE(); break;
|
||||
}
|
||||
|
||||
return visitChildren;
|
||||
}
|
||||
|
||||
bool TOutputGLSL::visitUnary(Visit visit, TIntermUnary* node)
|
||||
{
|
||||
switch (node->getOp())
|
||||
{
|
||||
case EOpNegative: writeTriplet(visit, "(-", NULL, ")"); break;
|
||||
case EOpVectorLogicalNot: writeTriplet(visit, "not(", NULL, ")"); break;
|
||||
case EOpLogicalNot: writeTriplet(visit, "(!", NULL, ")"); break;
|
||||
|
||||
case EOpPostIncrement: writeTriplet(visit, "(", NULL, "++)"); break;
|
||||
case EOpPostDecrement: writeTriplet(visit, "(", NULL, "--)"); break;
|
||||
case EOpPreIncrement: writeTriplet(visit, "(++", NULL, ")"); break;
|
||||
case EOpPreDecrement: writeTriplet(visit, "(--", NULL, ")"); break;
|
||||
|
||||
case EOpConvIntToBool:
|
||||
case EOpConvFloatToBool:
|
||||
switch (node->getOperand()->getType().getNominalSize())
|
||||
{
|
||||
case 1: writeTriplet(visit, "bool(", NULL, ")"); break;
|
||||
case 2: writeTriplet(visit, "bvec2(", NULL, ")"); break;
|
||||
case 3: writeTriplet(visit, "bvec3(", NULL, ")"); break;
|
||||
case 4: writeTriplet(visit, "bvec4(", NULL, ")"); break;
|
||||
default: UNREACHABLE();
|
||||
}
|
||||
break;
|
||||
case EOpConvBoolToFloat:
|
||||
case EOpConvIntToFloat:
|
||||
switch (node->getOperand()->getType().getNominalSize())
|
||||
{
|
||||
case 1: writeTriplet(visit, "float(", NULL, ")"); break;
|
||||
case 2: writeTriplet(visit, "vec2(", NULL, ")"); break;
|
||||
case 3: writeTriplet(visit, "vec3(", NULL, ")"); break;
|
||||
case 4: writeTriplet(visit, "vec4(", NULL, ")"); break;
|
||||
default: UNREACHABLE();
|
||||
}
|
||||
break;
|
||||
case EOpConvFloatToInt:
|
||||
case EOpConvBoolToInt:
|
||||
switch (node->getOperand()->getType().getNominalSize())
|
||||
{
|
||||
case 1: writeTriplet(visit, "int(", NULL, ")"); break;
|
||||
case 2: writeTriplet(visit, "ivec2(", NULL, ")"); break;
|
||||
case 3: writeTriplet(visit, "ivec3(", NULL, ")"); break;
|
||||
case 4: writeTriplet(visit, "ivec4(", NULL, ")"); break;
|
||||
default: UNREACHABLE();
|
||||
}
|
||||
break;
|
||||
|
||||
case EOpRadians: writeTriplet(visit, "radians(", NULL, ")"); break;
|
||||
case EOpDegrees: writeTriplet(visit, "degrees(", NULL, ")"); break;
|
||||
case EOpSin: writeTriplet(visit, "sin(", NULL, ")"); break;
|
||||
case EOpCos: writeTriplet(visit, "cos(", NULL, ")"); break;
|
||||
case EOpTan: writeTriplet(visit, "tan(", NULL, ")"); break;
|
||||
case EOpAsin: writeTriplet(visit, "asin(", NULL, ")"); break;
|
||||
case EOpAcos: writeTriplet(visit, "acos(", NULL, ")"); break;
|
||||
case EOpAtan: writeTriplet(visit, "atan(", NULL, ")"); break;
|
||||
|
||||
case EOpExp: writeTriplet(visit, "exp(", NULL, ")"); break;
|
||||
case EOpLog: writeTriplet(visit, "log(", NULL, ")"); break;
|
||||
case EOpExp2: writeTriplet(visit, "exp2(", NULL, ")"); break;
|
||||
case EOpLog2: writeTriplet(visit, "log2(", NULL, ")"); break;
|
||||
case EOpSqrt: writeTriplet(visit, "sqrt(", NULL, ")"); break;
|
||||
case EOpInverseSqrt: writeTriplet(visit, "inversesqrt(", NULL, ")"); break;
|
||||
|
||||
case EOpAbs: writeTriplet(visit, "abs(", NULL, ")"); break;
|
||||
case EOpSign: writeTriplet(visit, "sign(", NULL, ")"); break;
|
||||
case EOpFloor: writeTriplet(visit, "floor(", NULL, ")"); break;
|
||||
case EOpCeil: writeTriplet(visit, "ceil(", NULL, ")"); break;
|
||||
case EOpFract: writeTriplet(visit, "fract(", NULL, ")"); break;
|
||||
|
||||
case EOpLength: writeTriplet(visit, "length(", NULL, ")"); break;
|
||||
case EOpNormalize: writeTriplet(visit, "normalize(", NULL, ")"); break;
|
||||
|
||||
case EOpDFdx: writeTriplet(visit, "dFdx(", NULL, ")"); break;
|
||||
case EOpDFdy: writeTriplet(visit, "dFdy(", NULL, ")"); break;
|
||||
case EOpFwidth: writeTriplet(visit, "fwidth(", NULL, ")"); break;
|
||||
|
||||
case EOpAny: writeTriplet(visit, "any(", NULL, ")"); break;
|
||||
case EOpAll: writeTriplet(visit, "all(", NULL, ")"); break;
|
||||
|
||||
default: UNREACHABLE(); break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TOutputGLSL::visitSelection(Visit visit, TIntermSelection* node)
|
||||
{
|
||||
TInfoSinkBase& out = objSink();
|
||||
|
||||
if (node->usesTernaryOperator())
|
||||
{
|
||||
// Notice two brackets at the beginning and end. The outer ones
|
||||
// encapsulate the whole ternary expression. This preserves the
|
||||
// order of precedence when ternary expressions are used in a
|
||||
// compound expression, i.e., c = 2 * (a < b ? 1 : 2).
|
||||
out << "((";
|
||||
node->getCondition()->traverse(this);
|
||||
out << ") ? (";
|
||||
node->getTrueBlock()->traverse(this);
|
||||
out << ") : (";
|
||||
node->getFalseBlock()->traverse(this);
|
||||
out << "))";
|
||||
}
|
||||
else
|
||||
{
|
||||
out << "if (";
|
||||
node->getCondition()->traverse(this);
|
||||
out << ")\n";
|
||||
|
||||
incrementDepth();
|
||||
visitCodeBlock(node->getTrueBlock());
|
||||
|
||||
if (node->getFalseBlock())
|
||||
{
|
||||
out << "else\n";
|
||||
visitCodeBlock(node->getFalseBlock());
|
||||
}
|
||||
decrementDepth();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool TOutputGLSL::visitAggregate(Visit visit, TIntermAggregate* node)
|
||||
{
|
||||
bool visitChildren = true;
|
||||
TInfoSinkBase& out = objSink();
|
||||
switch (node->getOp())
|
||||
{
|
||||
case EOpSequence: {
|
||||
// Scope the sequences except when at the global scope.
|
||||
if (depth > 0) out << "{\n";
|
||||
|
||||
incrementDepth();
|
||||
const TIntermSequence& sequence = node->getSequence();
|
||||
for (TIntermSequence::const_iterator iter = sequence.begin();
|
||||
iter != sequence.end(); ++iter)
|
||||
{
|
||||
TIntermNode* node = *iter;
|
||||
ASSERT(node != NULL);
|
||||
node->traverse(this);
|
||||
|
||||
if (isSingleStatement(node))
|
||||
out << ";\n";
|
||||
}
|
||||
decrementDepth();
|
||||
|
||||
// Scope the sequences except when at the global scope.
|
||||
if (depth > 0) out << "}\n";
|
||||
visitChildren = false;
|
||||
break;
|
||||
}
|
||||
case EOpPrototype: {
|
||||
// Function declaration.
|
||||
ASSERT(visit == PreVisit);
|
||||
TString returnType = getTypeName(node->getType());
|
||||
out << returnType << " " << node->getName();
|
||||
|
||||
out << "(";
|
||||
writeFunctionParameters(node->getSequence());
|
||||
out << ")";
|
||||
|
||||
visitChildren = false;
|
||||
break;
|
||||
}
|
||||
case EOpFunction: {
|
||||
// Function definition.
|
||||
ASSERT(visit == PreVisit);
|
||||
TString returnType = getTypeName(node->getType());
|
||||
TString functionName = TFunction::unmangleName(node->getName());
|
||||
out << returnType << " " << functionName;
|
||||
|
||||
incrementDepth();
|
||||
// Function definition node contains one or two children nodes
|
||||
// representing function parameters and function body. The latter
|
||||
// is not present in case of empty function bodies.
|
||||
const TIntermSequence& sequence = node->getSequence();
|
||||
ASSERT((sequence.size() == 1) || (sequence.size() == 2));
|
||||
TIntermSequence::const_iterator seqIter = sequence.begin();
|
||||
|
||||
// Traverse function parameters.
|
||||
TIntermAggregate* params = (*seqIter)->getAsAggregate();
|
||||
ASSERT(params != NULL);
|
||||
ASSERT(params->getOp() == EOpParameters);
|
||||
params->traverse(this);
|
||||
|
||||
// Traverse function body.
|
||||
TIntermAggregate* body = ++seqIter != sequence.end() ?
|
||||
(*seqIter)->getAsAggregate() : NULL;
|
||||
visitCodeBlock(body);
|
||||
decrementDepth();
|
||||
|
||||
// Fully processed; no need to visit children.
|
||||
visitChildren = false;
|
||||
break;
|
||||
}
|
||||
case EOpFunctionCall:
|
||||
// Function call.
|
||||
if (visit == PreVisit)
|
||||
{
|
||||
TString functionName = TFunction::unmangleName(node->getName());
|
||||
out << functionName << "(";
|
||||
}
|
||||
else if (visit == InVisit)
|
||||
{
|
||||
out << ", ";
|
||||
}
|
||||
else
|
||||
{
|
||||
out << ")";
|
||||
}
|
||||
break;
|
||||
case EOpParameters: {
|
||||
// Function parameters.
|
||||
ASSERT(visit == PreVisit);
|
||||
out << "(";
|
||||
writeFunctionParameters(node->getSequence());
|
||||
out << ")";
|
||||
visitChildren = false;
|
||||
break;
|
||||
}
|
||||
case EOpDeclaration: {
|
||||
// Variable declaration.
|
||||
if (visit == PreVisit)
|
||||
{
|
||||
const TIntermSequence& sequence = node->getSequence();
|
||||
const TIntermTyped* variable = sequence.front()->getAsTyped();
|
||||
writeVariableType(variable->getType());
|
||||
out << " ";
|
||||
mDeclaringVariables = true;
|
||||
}
|
||||
else if (visit == InVisit)
|
||||
{
|
||||
out << ", ";
|
||||
mDeclaringVariables = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
mDeclaringVariables = false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case EOpConstructFloat: writeTriplet(visit, "float(", NULL, ")"); break;
|
||||
case EOpConstructVec2: writeTriplet(visit, "vec2(", ", ", ")"); break;
|
||||
case EOpConstructVec3: writeTriplet(visit, "vec3(", ", ", ")"); break;
|
||||
case EOpConstructVec4: writeTriplet(visit, "vec4(", ", ", ")"); break;
|
||||
case EOpConstructBool: writeTriplet(visit, "bool(", NULL, ")"); break;
|
||||
case EOpConstructBVec2: writeTriplet(visit, "bvec2(", ", ", ")"); break;
|
||||
case EOpConstructBVec3: writeTriplet(visit, "bvec3(", ", ", ")"); break;
|
||||
case EOpConstructBVec4: writeTriplet(visit, "bvec4(", ", ", ")"); break;
|
||||
case EOpConstructInt: writeTriplet(visit, "int(", NULL, ")"); break;
|
||||
case EOpConstructIVec2: writeTriplet(visit, "ivec2(", ", ", ")"); break;
|
||||
case EOpConstructIVec3: writeTriplet(visit, "ivec3(", ", ", ")"); break;
|
||||
case EOpConstructIVec4: writeTriplet(visit, "ivec4(", ", ", ")"); break;
|
||||
case EOpConstructMat2: writeTriplet(visit, "mat2(", ", ", ")"); break;
|
||||
case EOpConstructMat3: writeTriplet(visit, "mat3(", ", ", ")"); break;
|
||||
case EOpConstructMat4: writeTriplet(visit, "mat4(", ", ", ")"); break;
|
||||
case EOpConstructStruct:
|
||||
if (visit == PreVisit)
|
||||
{
|
||||
const TType& type = node->getType();
|
||||
ASSERT(type.getBasicType() == EbtStruct);
|
||||
out << type.getTypeName() << "(";
|
||||
}
|
||||
else if (visit == InVisit)
|
||||
{
|
||||
out << ", ";
|
||||
}
|
||||
else
|
||||
{
|
||||
out << ")";
|
||||
}
|
||||
break;
|
||||
|
||||
case EOpLessThan: writeTriplet(visit, "lessThan(", ", ", ")"); break;
|
||||
case EOpGreaterThan: writeTriplet(visit, "greaterThan(", ", ", ")"); break;
|
||||
case EOpLessThanEqual: writeTriplet(visit, "lessThanEqual(", ", ", ")"); break;
|
||||
case EOpGreaterThanEqual: writeTriplet(visit, "greaterThanEqual(", ", ", ")"); break;
|
||||
case EOpVectorEqual: writeTriplet(visit, "equal(", ", ", ")"); break;
|
||||
case EOpVectorNotEqual: writeTriplet(visit, "notEqual(", ", ", ")"); break;
|
||||
case EOpComma: writeTriplet(visit, NULL, ", ", NULL); break;
|
||||
|
||||
case EOpMod: writeTriplet(visit, "mod(", ", ", ")"); break;
|
||||
case EOpPow: writeTriplet(visit, "pow(", ", ", ")"); break;
|
||||
case EOpAtan: writeTriplet(visit, "atan(", ", ", ")"); break;
|
||||
case EOpMin: writeTriplet(visit, "min(", ", ", ")"); break;
|
||||
case EOpMax: writeTriplet(visit, "max(", ", ", ")"); break;
|
||||
case EOpClamp: writeTriplet(visit, "clamp(", ", ", ")"); break;
|
||||
case EOpMix: writeTriplet(visit, "mix(", ", ", ")"); break;
|
||||
case EOpStep: writeTriplet(visit, "step(", ", ", ")"); break;
|
||||
case EOpSmoothStep: writeTriplet(visit, "smoothstep(", ", ", ")"); break;
|
||||
|
||||
case EOpDistance: writeTriplet(visit, "distance(", ", ", ")"); break;
|
||||
case EOpDot: writeTriplet(visit, "dot(", ", ", ")"); break;
|
||||
case EOpCross: writeTriplet(visit, "cross(", ", ", ")"); break;
|
||||
case EOpFaceForward: writeTriplet(visit, "faceforward(", ", ", ")"); break;
|
||||
case EOpReflect: writeTriplet(visit, "reflect(", ", ", ")"); break;
|
||||
case EOpRefract: writeTriplet(visit, "refract(", ", ", ")"); break;
|
||||
case EOpMul: writeTriplet(visit, "matrixCompMult(", ", ", ")"); break;
|
||||
|
||||
default: UNREACHABLE(); break;
|
||||
}
|
||||
return visitChildren;
|
||||
}
|
||||
|
||||
bool TOutputGLSL::visitLoop(Visit visit, TIntermLoop* node)
|
||||
{
|
||||
TInfoSinkBase& out = objSink();
|
||||
|
||||
incrementDepth();
|
||||
// Loop header.
|
||||
TLoopType loopType = node->getType();
|
||||
if (loopType == ELoopFor) // for loop
|
||||
{
|
||||
if (!node->getUnrollFlag()) {
|
||||
out << "for (";
|
||||
if (node->getInit())
|
||||
node->getInit()->traverse(this);
|
||||
out << "; ";
|
||||
|
||||
if (node->getCondition())
|
||||
node->getCondition()->traverse(this);
|
||||
out << "; ";
|
||||
|
||||
if (node->getExpression())
|
||||
node->getExpression()->traverse(this);
|
||||
out << ")\n";
|
||||
}
|
||||
}
|
||||
else if (loopType == ELoopWhile) // while loop
|
||||
{
|
||||
out << "while (";
|
||||
ASSERT(node->getCondition() != NULL);
|
||||
node->getCondition()->traverse(this);
|
||||
out << ")\n";
|
||||
}
|
||||
else // do-while loop
|
||||
{
|
||||
ASSERT(loopType == ELoopDoWhile);
|
||||
out << "do\n";
|
||||
}
|
||||
|
||||
// Loop body.
|
||||
if (node->getUnrollFlag())
|
||||
{
|
||||
TLoopIndexInfo indexInfo;
|
||||
mLoopUnroll.FillLoopIndexInfo(node, indexInfo);
|
||||
mLoopUnroll.Push(indexInfo);
|
||||
while (mLoopUnroll.SatisfiesLoopCondition())
|
||||
{
|
||||
visitCodeBlock(node->getBody());
|
||||
mLoopUnroll.Step();
|
||||
}
|
||||
mLoopUnroll.Pop();
|
||||
}
|
||||
else
|
||||
{
|
||||
visitCodeBlock(node->getBody());
|
||||
}
|
||||
|
||||
// Loop footer.
|
||||
if (loopType == ELoopDoWhile) // do-while loop
|
||||
{
|
||||
out << "while (";
|
||||
ASSERT(node->getCondition() != NULL);
|
||||
node->getCondition()->traverse(this);
|
||||
out << ");\n";
|
||||
}
|
||||
decrementDepth();
|
||||
|
||||
// No need to visit children. They have been already processed in
|
||||
// this function.
|
||||
return false;
|
||||
}
|
||||
|
||||
bool TOutputGLSL::visitBranch(Visit visit, TIntermBranch* node)
|
||||
{
|
||||
switch (node->getFlowOp())
|
||||
{
|
||||
case EOpKill: writeTriplet(visit, "discard", NULL, NULL); break;
|
||||
case EOpBreak: writeTriplet(visit, "break", NULL, NULL); break;
|
||||
case EOpContinue: writeTriplet(visit, "continue", NULL, NULL); break;
|
||||
case EOpReturn: writeTriplet(visit, "return ", NULL, NULL); break;
|
||||
default: UNREACHABLE(); break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void TOutputGLSL::visitCodeBlock(TIntermNode* node) {
|
||||
TInfoSinkBase &out = objSink();
|
||||
if (node != NULL)
|
||||
{
|
||||
node->traverse(this);
|
||||
// Single statements not part of a sequence need to be terminated
|
||||
// with semi-colon.
|
||||
if (isSingleStatement(node))
|
||||
out << ";\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
out << "{\n}\n"; // Empty code block.
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
|
||||
// Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
//
|
||||
|
@ -7,46 +7,15 @@
|
|||
#ifndef CROSSCOMPILERGLSL_OUTPUTGLSL_H_
|
||||
#define CROSSCOMPILERGLSL_OUTPUTGLSL_H_
|
||||
|
||||
#include <set>
|
||||
#include "compiler/OutputGLSLBase.h"
|
||||
|
||||
#include "compiler/ForLoopUnroll.h"
|
||||
#include "compiler/intermediate.h"
|
||||
#include "compiler/ParseHelper.h"
|
||||
|
||||
class TOutputGLSL : public TIntermTraverser
|
||||
class TOutputGLSL : public TOutputGLSLBase
|
||||
{
|
||||
public:
|
||||
TOutputGLSL(TInfoSinkBase& objSink);
|
||||
|
||||
protected:
|
||||
TInfoSinkBase& objSink() { return mObjSink; }
|
||||
void writeTriplet(Visit visit, const char* preStr, const char* inStr, const char* postStr);
|
||||
void writeVariableType(const TType& type);
|
||||
void writeFunctionParameters(const TIntermSequence& args);
|
||||
const ConstantUnion* writeConstantUnion(const TType& type, const ConstantUnion* pConstUnion);
|
||||
|
||||
virtual void visitSymbol(TIntermSymbol* node);
|
||||
virtual void visitConstantUnion(TIntermConstantUnion* node);
|
||||
virtual bool visitBinary(Visit visit, TIntermBinary* node);
|
||||
virtual bool visitUnary(Visit visit, TIntermUnary* node);
|
||||
virtual bool visitSelection(Visit visit, TIntermSelection* node);
|
||||
virtual bool visitAggregate(Visit visit, TIntermAggregate* node);
|
||||
virtual bool visitLoop(Visit visit, TIntermLoop* node);
|
||||
virtual bool visitBranch(Visit visit, TIntermBranch* node);
|
||||
|
||||
void visitCodeBlock(TIntermNode* node);
|
||||
|
||||
private:
|
||||
TInfoSinkBase& mObjSink;
|
||||
bool mDeclaringVariables;
|
||||
|
||||
// Structs are declared as the tree is traversed. This set contains all
|
||||
// the structs already declared. It is maintained so that a struct is
|
||||
// declared only once.
|
||||
typedef std::set<TString> DeclaredStructs;
|
||||
DeclaredStructs mDeclaredStructs;
|
||||
|
||||
ForLoopUnroll mLoopUnroll;
|
||||
virtual bool writeVariablePrecision(TPrecision);
|
||||
};
|
||||
|
||||
#endif // CROSSCOMPILERGLSL_OUTPUTGLSL_H_
|
||||
|
|
|
@ -0,0 +1,714 @@
|
|||
//
|
||||
// Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
//
|
||||
|
||||
#include "compiler/OutputGLSLBase.h"
|
||||
#include "compiler/compilerdebug.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
TString getTypeName(const TType& type)
|
||||
{
|
||||
TInfoSinkBase out;
|
||||
if (type.isMatrix())
|
||||
{
|
||||
out << "mat";
|
||||
out << type.getNominalSize();
|
||||
}
|
||||
else if (type.isVector())
|
||||
{
|
||||
switch (type.getBasicType())
|
||||
{
|
||||
case EbtFloat: out << "vec"; break;
|
||||
case EbtInt: out << "ivec"; break;
|
||||
case EbtBool: out << "bvec"; break;
|
||||
default: UNREACHABLE(); break;
|
||||
}
|
||||
out << type.getNominalSize();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (type.getBasicType() == EbtStruct)
|
||||
out << type.getTypeName();
|
||||
else
|
||||
out << type.getBasicString();
|
||||
}
|
||||
return TString(out.c_str());
|
||||
}
|
||||
|
||||
TString arrayBrackets(const TType& type)
|
||||
{
|
||||
ASSERT(type.isArray());
|
||||
TInfoSinkBase out;
|
||||
out << "[" << type.getArraySize() << "]";
|
||||
return TString(out.c_str());
|
||||
}
|
||||
|
||||
bool isSingleStatement(TIntermNode* node) {
|
||||
if (const TIntermAggregate* aggregate = node->getAsAggregate())
|
||||
{
|
||||
return (aggregate->getOp() != EOpFunction) &&
|
||||
(aggregate->getOp() != EOpSequence);
|
||||
}
|
||||
else if (const TIntermSelection* selection = node->getAsSelectionNode())
|
||||
{
|
||||
// Ternary operators are usually part of an assignment operator.
|
||||
// This handles those rare cases in which they are all by themselves.
|
||||
return selection->usesTernaryOperator();
|
||||
}
|
||||
else if (node->getAsLoopNode())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
TOutputGLSLBase::TOutputGLSLBase(TInfoSinkBase& objSink)
|
||||
: TIntermTraverser(true, true, true),
|
||||
mObjSink(objSink),
|
||||
mDeclaringVariables(false)
|
||||
{
|
||||
}
|
||||
|
||||
void TOutputGLSLBase::writeTriplet(Visit visit, const char* preStr, const char* inStr, const char* postStr)
|
||||
{
|
||||
TInfoSinkBase& out = objSink();
|
||||
if (visit == PreVisit && preStr)
|
||||
{
|
||||
out << preStr;
|
||||
}
|
||||
else if (visit == InVisit && inStr)
|
||||
{
|
||||
out << inStr;
|
||||
}
|
||||
else if (visit == PostVisit && postStr)
|
||||
{
|
||||
out << postStr;
|
||||
}
|
||||
}
|
||||
|
||||
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) &&
|
||||
(mDeclaredStructs.find(type.getTypeName()) == mDeclaredStructs.end()))
|
||||
{
|
||||
out << "struct " << type.getTypeName() << "{\n";
|
||||
const TTypeList* structure = type.getStruct();
|
||||
ASSERT(structure != NULL);
|
||||
for (size_t i = 0; i < structure->size(); ++i)
|
||||
{
|
||||
const TType* fieldType = (*structure)[i].type;
|
||||
ASSERT(fieldType != NULL);
|
||||
if (writeVariablePrecision(fieldType->getPrecision()))
|
||||
out << " ";
|
||||
out << getTypeName(*fieldType) << " " << fieldType->getFieldName();
|
||||
if (fieldType->isArray())
|
||||
out << arrayBrackets(*fieldType);
|
||||
out << ";\n";
|
||||
}
|
||||
out << "}";
|
||||
mDeclaredStructs.insert(type.getTypeName());
|
||||
}
|
||||
else
|
||||
{
|
||||
if (writeVariablePrecision(type.getPrecision()))
|
||||
out << " ";
|
||||
out << getTypeName(type);
|
||||
}
|
||||
}
|
||||
|
||||
void TOutputGLSLBase::writeFunctionParameters(const TIntermSequence& args)
|
||||
{
|
||||
TInfoSinkBase& out = objSink();
|
||||
for (TIntermSequence::const_iterator iter = args.begin();
|
||||
iter != args.end(); ++iter)
|
||||
{
|
||||
const TIntermSymbol* arg = (*iter)->getAsSymbolNode();
|
||||
ASSERT(arg != NULL);
|
||||
|
||||
const TType& type = arg->getType();
|
||||
writeVariableType(type);
|
||||
|
||||
const TString& name = arg->getSymbol();
|
||||
if (!name.empty())
|
||||
out << " " << name;
|
||||
if (type.isArray())
|
||||
out << arrayBrackets(type);
|
||||
|
||||
// Put a comma if this is not the last argument.
|
||||
if (iter != args.end() - 1)
|
||||
out << ", ";
|
||||
}
|
||||
}
|
||||
|
||||
const ConstantUnion* TOutputGLSLBase::writeConstantUnion(const TType& type,
|
||||
const ConstantUnion* pConstUnion)
|
||||
{
|
||||
TInfoSinkBase& out = objSink();
|
||||
|
||||
if (type.getBasicType() == EbtStruct)
|
||||
{
|
||||
out << type.getTypeName() << "(";
|
||||
const TTypeList* structure = type.getStruct();
|
||||
ASSERT(structure != NULL);
|
||||
for (size_t i = 0; i < structure->size(); ++i)
|
||||
{
|
||||
const TType* fieldType = (*structure)[i].type;
|
||||
ASSERT(fieldType != NULL);
|
||||
pConstUnion = writeConstantUnion(*fieldType, pConstUnion);
|
||||
if (i != structure->size() - 1) out << ", ";
|
||||
}
|
||||
out << ")";
|
||||
}
|
||||
else
|
||||
{
|
||||
int size = type.getObjectSize();
|
||||
bool writeType = size > 1;
|
||||
if (writeType) out << getTypeName(type) << "(";
|
||||
for (int i = 0; i < size; ++i, ++pConstUnion)
|
||||
{
|
||||
switch (pConstUnion->getType())
|
||||
{
|
||||
case EbtFloat: out << pConstUnion->getFConst(); break;
|
||||
case EbtInt: out << pConstUnion->getIConst(); break;
|
||||
case EbtBool: out << pConstUnion->getBConst(); break;
|
||||
default: UNREACHABLE();
|
||||
}
|
||||
if (i != size - 1) out << ", ";
|
||||
}
|
||||
if (writeType) out << ")";
|
||||
}
|
||||
return pConstUnion;
|
||||
}
|
||||
|
||||
void TOutputGLSLBase::visitSymbol(TIntermSymbol* node)
|
||||
{
|
||||
TInfoSinkBase& out = objSink();
|
||||
if (mLoopUnroll.NeedsToReplaceSymbolWithValue(node))
|
||||
out << mLoopUnroll.GetLoopIndexValue(node);
|
||||
else
|
||||
out << node->getSymbol();
|
||||
|
||||
if (mDeclaringVariables && node->getType().isArray())
|
||||
out << arrayBrackets(node->getType());
|
||||
}
|
||||
|
||||
void TOutputGLSLBase::visitConstantUnion(TIntermConstantUnion* node)
|
||||
{
|
||||
writeConstantUnion(node->getType(), node->getUnionArrayPointer());
|
||||
}
|
||||
|
||||
bool TOutputGLSLBase::visitBinary(Visit visit, TIntermBinary* node)
|
||||
{
|
||||
bool visitChildren = true;
|
||||
TInfoSinkBase& out = objSink();
|
||||
switch (node->getOp())
|
||||
{
|
||||
case EOpInitialize:
|
||||
if (visit == InVisit)
|
||||
{
|
||||
out << " = ";
|
||||
// RHS of initialize is not being declared.
|
||||
mDeclaringVariables = false;
|
||||
}
|
||||
break;
|
||||
case EOpAssign: writeTriplet(visit, "(", " = ", ")"); break;
|
||||
case EOpAddAssign: writeTriplet(visit, "(", " += ", ")"); break;
|
||||
case EOpSubAssign: writeTriplet(visit, "(", " -= ", ")"); break;
|
||||
case EOpDivAssign: writeTriplet(visit, "(", " /= ", ")"); break;
|
||||
// Notice the fall-through.
|
||||
case EOpMulAssign:
|
||||
case EOpVectorTimesMatrixAssign:
|
||||
case EOpVectorTimesScalarAssign:
|
||||
case EOpMatrixTimesScalarAssign:
|
||||
case EOpMatrixTimesMatrixAssign:
|
||||
writeTriplet(visit, "(", " *= ", ")");
|
||||
break;
|
||||
|
||||
case EOpIndexDirect:
|
||||
case EOpIndexIndirect:
|
||||
writeTriplet(visit, NULL, "[", "]");
|
||||
break;
|
||||
case EOpIndexDirectStruct:
|
||||
if (visit == InVisit)
|
||||
{
|
||||
out << ".";
|
||||
// TODO(alokp): ASSERT
|
||||
out << node->getType().getFieldName();
|
||||
visitChildren = false;
|
||||
}
|
||||
break;
|
||||
case EOpVectorSwizzle:
|
||||
if (visit == InVisit)
|
||||
{
|
||||
out << ".";
|
||||
TIntermAggregate* rightChild = node->getRight()->getAsAggregate();
|
||||
TIntermSequence& sequence = rightChild->getSequence();
|
||||
for (TIntermSequence::iterator sit = sequence.begin(); sit != sequence.end(); ++sit)
|
||||
{
|
||||
TIntermConstantUnion* element = (*sit)->getAsConstantUnion();
|
||||
ASSERT(element->getBasicType() == EbtInt);
|
||||
ASSERT(element->getNominalSize() == 1);
|
||||
const ConstantUnion& data = element->getUnionArrayPointer()[0];
|
||||
ASSERT(data.getType() == EbtInt);
|
||||
switch (data.getIConst())
|
||||
{
|
||||
case 0: out << "x"; break;
|
||||
case 1: out << "y"; break;
|
||||
case 2: out << "z"; break;
|
||||
case 3: out << "w"; break;
|
||||
default: UNREACHABLE(); break;
|
||||
}
|
||||
}
|
||||
visitChildren = false;
|
||||
}
|
||||
break;
|
||||
|
||||
case EOpAdd: writeTriplet(visit, "(", " + ", ")"); break;
|
||||
case EOpSub: writeTriplet(visit, "(", " - ", ")"); break;
|
||||
case EOpMul: writeTriplet(visit, "(", " * ", ")"); break;
|
||||
case EOpDiv: writeTriplet(visit, "(", " / ", ")"); break;
|
||||
case EOpMod: UNIMPLEMENTED(); break;
|
||||
case EOpEqual: writeTriplet(visit, "(", " == ", ")"); break;
|
||||
case EOpNotEqual: writeTriplet(visit, "(", " != ", ")"); break;
|
||||
case EOpLessThan: writeTriplet(visit, "(", " < ", ")"); break;
|
||||
case EOpGreaterThan: writeTriplet(visit, "(", " > ", ")"); break;
|
||||
case EOpLessThanEqual: writeTriplet(visit, "(", " <= ", ")"); break;
|
||||
case EOpGreaterThanEqual: writeTriplet(visit, "(", " >= ", ")"); break;
|
||||
|
||||
// Notice the fall-through.
|
||||
case EOpVectorTimesScalar:
|
||||
case EOpVectorTimesMatrix:
|
||||
case EOpMatrixTimesVector:
|
||||
case EOpMatrixTimesScalar:
|
||||
case EOpMatrixTimesMatrix:
|
||||
writeTriplet(visit, "(", " * ", ")");
|
||||
break;
|
||||
|
||||
case EOpLogicalOr: writeTriplet(visit, "(", " || ", ")"); break;
|
||||
case EOpLogicalXor: writeTriplet(visit, "(", " ^^ ", ")"); break;
|
||||
case EOpLogicalAnd: writeTriplet(visit, "(", " && ", ")"); break;
|
||||
default: UNREACHABLE(); break;
|
||||
}
|
||||
|
||||
return visitChildren;
|
||||
}
|
||||
|
||||
bool TOutputGLSLBase::visitUnary(Visit visit, TIntermUnary* node)
|
||||
{
|
||||
TString preString;
|
||||
TString postString = ")";
|
||||
|
||||
switch (node->getOp())
|
||||
{
|
||||
case EOpNegative: preString = "(-"; break;
|
||||
case EOpVectorLogicalNot: preString = "not("; break;
|
||||
case EOpLogicalNot: preString = "(!"; break;
|
||||
|
||||
case EOpPostIncrement: preString = "("; postString = "++)"; break;
|
||||
case EOpPostDecrement: preString = "("; postString = "--)"; break;
|
||||
case EOpPreIncrement: preString = "(++"; break;
|
||||
case EOpPreDecrement: preString = "(--"; break;
|
||||
|
||||
case EOpConvIntToBool:
|
||||
case EOpConvFloatToBool:
|
||||
switch (node->getOperand()->getType().getNominalSize())
|
||||
{
|
||||
case 1: preString = "bool("; break;
|
||||
case 2: preString = "bvec2("; break;
|
||||
case 3: preString = "bvec3("; break;
|
||||
case 4: preString = "bvec4("; break;
|
||||
default: UNREACHABLE();
|
||||
}
|
||||
break;
|
||||
case EOpConvBoolToFloat:
|
||||
case EOpConvIntToFloat:
|
||||
switch (node->getOperand()->getType().getNominalSize())
|
||||
{
|
||||
case 1: preString = "float("; break;
|
||||
case 2: preString = "vec2("; break;
|
||||
case 3: preString = "vec3("; break;
|
||||
case 4: preString = "vec4("; break;
|
||||
default: UNREACHABLE();
|
||||
}
|
||||
break;
|
||||
case EOpConvFloatToInt:
|
||||
case EOpConvBoolToInt:
|
||||
switch (node->getOperand()->getType().getNominalSize())
|
||||
{
|
||||
case 1: preString = "int("; break;
|
||||
case 2: preString = "ivec2("; break;
|
||||
case 3: preString = "ivec3("; break;
|
||||
case 4: preString = "ivec4("; break;
|
||||
default: UNREACHABLE();
|
||||
}
|
||||
break;
|
||||
|
||||
case EOpRadians: preString = "radians("; break;
|
||||
case EOpDegrees: preString = "degrees("; break;
|
||||
case EOpSin: preString = "sin("; break;
|
||||
case EOpCos: preString = "cos("; break;
|
||||
case EOpTan: preString = "tan("; break;
|
||||
case EOpAsin: preString = "asin("; break;
|
||||
case EOpAcos: preString = "acos("; break;
|
||||
case EOpAtan: preString = "atan("; break;
|
||||
|
||||
case EOpExp: preString = "exp("; break;
|
||||
case EOpLog: preString = "log("; break;
|
||||
case EOpExp2: preString = "exp2("; break;
|
||||
case EOpLog2: preString = "log2("; break;
|
||||
case EOpSqrt: preString = "sqrt("; break;
|
||||
case EOpInverseSqrt: preString = "inversesqrt("; break;
|
||||
|
||||
case EOpAbs: preString = "abs("; break;
|
||||
case EOpSign: preString = "sign("; break;
|
||||
case EOpFloor: preString = "floor("; break;
|
||||
case EOpCeil: preString = "ceil("; break;
|
||||
case EOpFract: preString = "fract("; break;
|
||||
|
||||
case EOpLength: preString = "length("; break;
|
||||
case EOpNormalize: preString = "normalize("; break;
|
||||
|
||||
case EOpDFdx: preString = "dFdx("; break;
|
||||
case EOpDFdy: preString = "dFdy("; break;
|
||||
case EOpFwidth: preString = "fwidth("; break;
|
||||
|
||||
case EOpAny: preString = "any("; break;
|
||||
case EOpAll: preString = "all("; break;
|
||||
|
||||
default: UNREACHABLE(); break;
|
||||
}
|
||||
|
||||
if (visit == PreVisit && node->getUseEmulatedFunction())
|
||||
preString = BuiltInFunctionEmulator::GetEmulatedFunctionName(preString);
|
||||
writeTriplet(visit, preString.c_str(), NULL, postString.c_str());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TOutputGLSLBase::visitSelection(Visit visit, TIntermSelection* node)
|
||||
{
|
||||
TInfoSinkBase& out = objSink();
|
||||
|
||||
if (node->usesTernaryOperator())
|
||||
{
|
||||
// Notice two brackets at the beginning and end. The outer ones
|
||||
// encapsulate the whole ternary expression. This preserves the
|
||||
// order of precedence when ternary expressions are used in a
|
||||
// compound expression, i.e., c = 2 * (a < b ? 1 : 2).
|
||||
out << "((";
|
||||
node->getCondition()->traverse(this);
|
||||
out << ") ? (";
|
||||
node->getTrueBlock()->traverse(this);
|
||||
out << ") : (";
|
||||
node->getFalseBlock()->traverse(this);
|
||||
out << "))";
|
||||
}
|
||||
else
|
||||
{
|
||||
out << "if (";
|
||||
node->getCondition()->traverse(this);
|
||||
out << ")\n";
|
||||
|
||||
incrementDepth();
|
||||
visitCodeBlock(node->getTrueBlock());
|
||||
|
||||
if (node->getFalseBlock())
|
||||
{
|
||||
out << "else\n";
|
||||
visitCodeBlock(node->getFalseBlock());
|
||||
}
|
||||
decrementDepth();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool TOutputGLSLBase::visitAggregate(Visit visit, TIntermAggregate* node)
|
||||
{
|
||||
bool visitChildren = true;
|
||||
TInfoSinkBase& out = objSink();
|
||||
switch (node->getOp())
|
||||
{
|
||||
case EOpSequence: {
|
||||
// Scope the sequences except when at the global scope.
|
||||
if (depth > 0) out << "{\n";
|
||||
|
||||
incrementDepth();
|
||||
const TIntermSequence& sequence = node->getSequence();
|
||||
for (TIntermSequence::const_iterator iter = sequence.begin();
|
||||
iter != sequence.end(); ++iter)
|
||||
{
|
||||
TIntermNode* node = *iter;
|
||||
ASSERT(node != NULL);
|
||||
node->traverse(this);
|
||||
|
||||
if (isSingleStatement(node))
|
||||
out << ";\n";
|
||||
}
|
||||
decrementDepth();
|
||||
|
||||
// Scope the sequences except when at the global scope.
|
||||
if (depth > 0) out << "}\n";
|
||||
visitChildren = false;
|
||||
break;
|
||||
}
|
||||
case EOpPrototype: {
|
||||
// Function declaration.
|
||||
ASSERT(visit == PreVisit);
|
||||
writeVariableType(node->getType());
|
||||
out << " " << node->getName();
|
||||
|
||||
out << "(";
|
||||
writeFunctionParameters(node->getSequence());
|
||||
out << ")";
|
||||
|
||||
visitChildren = false;
|
||||
break;
|
||||
}
|
||||
case EOpFunction: {
|
||||
// Function definition.
|
||||
ASSERT(visit == PreVisit);
|
||||
writeVariableType(node->getType());
|
||||
out << " " << TFunction::unmangleName(node->getName());
|
||||
|
||||
incrementDepth();
|
||||
// Function definition node contains one or two children nodes
|
||||
// representing function parameters and function body. The latter
|
||||
// is not present in case of empty function bodies.
|
||||
const TIntermSequence& sequence = node->getSequence();
|
||||
ASSERT((sequence.size() == 1) || (sequence.size() == 2));
|
||||
TIntermSequence::const_iterator seqIter = sequence.begin();
|
||||
|
||||
// Traverse function parameters.
|
||||
TIntermAggregate* params = (*seqIter)->getAsAggregate();
|
||||
ASSERT(params != NULL);
|
||||
ASSERT(params->getOp() == EOpParameters);
|
||||
params->traverse(this);
|
||||
|
||||
// Traverse function body.
|
||||
TIntermAggregate* body = ++seqIter != sequence.end() ?
|
||||
(*seqIter)->getAsAggregate() : NULL;
|
||||
visitCodeBlock(body);
|
||||
decrementDepth();
|
||||
|
||||
// Fully processed; no need to visit children.
|
||||
visitChildren = false;
|
||||
break;
|
||||
}
|
||||
case EOpFunctionCall:
|
||||
// Function call.
|
||||
if (visit == PreVisit)
|
||||
{
|
||||
TString functionName = TFunction::unmangleName(node->getName());
|
||||
out << functionName << "(";
|
||||
}
|
||||
else if (visit == InVisit)
|
||||
{
|
||||
out << ", ";
|
||||
}
|
||||
else
|
||||
{
|
||||
out << ")";
|
||||
}
|
||||
break;
|
||||
case EOpParameters: {
|
||||
// Function parameters.
|
||||
ASSERT(visit == PreVisit);
|
||||
out << "(";
|
||||
writeFunctionParameters(node->getSequence());
|
||||
out << ")";
|
||||
visitChildren = false;
|
||||
break;
|
||||
}
|
||||
case EOpDeclaration: {
|
||||
// Variable declaration.
|
||||
if (visit == PreVisit)
|
||||
{
|
||||
const TIntermSequence& sequence = node->getSequence();
|
||||
const TIntermTyped* variable = sequence.front()->getAsTyped();
|
||||
writeVariableType(variable->getType());
|
||||
out << " ";
|
||||
mDeclaringVariables = true;
|
||||
}
|
||||
else if (visit == InVisit)
|
||||
{
|
||||
out << ", ";
|
||||
mDeclaringVariables = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
mDeclaringVariables = false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case EOpConstructFloat: writeTriplet(visit, "float(", NULL, ")"); break;
|
||||
case EOpConstructVec2: writeTriplet(visit, "vec2(", ", ", ")"); break;
|
||||
case EOpConstructVec3: writeTriplet(visit, "vec3(", ", ", ")"); break;
|
||||
case EOpConstructVec4: writeTriplet(visit, "vec4(", ", ", ")"); break;
|
||||
case EOpConstructBool: writeTriplet(visit, "bool(", NULL, ")"); break;
|
||||
case EOpConstructBVec2: writeTriplet(visit, "bvec2(", ", ", ")"); break;
|
||||
case EOpConstructBVec3: writeTriplet(visit, "bvec3(", ", ", ")"); break;
|
||||
case EOpConstructBVec4: writeTriplet(visit, "bvec4(", ", ", ")"); break;
|
||||
case EOpConstructInt: writeTriplet(visit, "int(", NULL, ")"); break;
|
||||
case EOpConstructIVec2: writeTriplet(visit, "ivec2(", ", ", ")"); break;
|
||||
case EOpConstructIVec3: writeTriplet(visit, "ivec3(", ", ", ")"); break;
|
||||
case EOpConstructIVec4: writeTriplet(visit, "ivec4(", ", ", ")"); break;
|
||||
case EOpConstructMat2: writeTriplet(visit, "mat2(", ", ", ")"); break;
|
||||
case EOpConstructMat3: writeTriplet(visit, "mat3(", ", ", ")"); break;
|
||||
case EOpConstructMat4: writeTriplet(visit, "mat4(", ", ", ")"); break;
|
||||
case EOpConstructStruct:
|
||||
if (visit == PreVisit)
|
||||
{
|
||||
const TType& type = node->getType();
|
||||
ASSERT(type.getBasicType() == EbtStruct);
|
||||
out << type.getTypeName() << "(";
|
||||
}
|
||||
else if (visit == InVisit)
|
||||
{
|
||||
out << ", ";
|
||||
}
|
||||
else
|
||||
{
|
||||
out << ")";
|
||||
}
|
||||
break;
|
||||
|
||||
case EOpLessThan: writeTriplet(visit, "lessThan(", ", ", ")"); break;
|
||||
case EOpGreaterThan: writeTriplet(visit, "greaterThan(", ", ", ")"); break;
|
||||
case EOpLessThanEqual: writeTriplet(visit, "lessThanEqual(", ", ", ")"); break;
|
||||
case EOpGreaterThanEqual: writeTriplet(visit, "greaterThanEqual(", ", ", ")"); break;
|
||||
case EOpVectorEqual: writeTriplet(visit, "equal(", ", ", ")"); break;
|
||||
case EOpVectorNotEqual: writeTriplet(visit, "notEqual(", ", ", ")"); break;
|
||||
case EOpComma: writeTriplet(visit, NULL, ", ", NULL); break;
|
||||
|
||||
case EOpMod: writeTriplet(visit, "mod(", ", ", ")"); break;
|
||||
case EOpPow: writeTriplet(visit, "pow(", ", ", ")"); break;
|
||||
case EOpAtan: writeTriplet(visit, "atan(", ", ", ")"); break;
|
||||
case EOpMin: writeTriplet(visit, "min(", ", ", ")"); break;
|
||||
case EOpMax: writeTriplet(visit, "max(", ", ", ")"); break;
|
||||
case EOpClamp: writeTriplet(visit, "clamp(", ", ", ")"); break;
|
||||
case EOpMix: writeTriplet(visit, "mix(", ", ", ")"); break;
|
||||
case EOpStep: writeTriplet(visit, "step(", ", ", ")"); break;
|
||||
case EOpSmoothStep: writeTriplet(visit, "smoothstep(", ", ", ")"); break;
|
||||
|
||||
case EOpDistance: writeTriplet(visit, "distance(", ", ", ")"); break;
|
||||
case EOpDot: writeTriplet(visit, "dot(", ", ", ")"); break;
|
||||
case EOpCross: writeTriplet(visit, "cross(", ", ", ")"); break;
|
||||
case EOpFaceForward: writeTriplet(visit, "faceforward(", ", ", ")"); break;
|
||||
case EOpReflect: writeTriplet(visit, "reflect(", ", ", ")"); break;
|
||||
case EOpRefract: writeTriplet(visit, "refract(", ", ", ")"); break;
|
||||
case EOpMul: writeTriplet(visit, "matrixCompMult(", ", ", ")"); break;
|
||||
|
||||
default: UNREACHABLE(); break;
|
||||
}
|
||||
return visitChildren;
|
||||
}
|
||||
|
||||
bool TOutputGLSLBase::visitLoop(Visit visit, TIntermLoop* node)
|
||||
{
|
||||
TInfoSinkBase& out = objSink();
|
||||
|
||||
incrementDepth();
|
||||
// Loop header.
|
||||
TLoopType loopType = node->getType();
|
||||
if (loopType == ELoopFor) // for loop
|
||||
{
|
||||
if (!node->getUnrollFlag()) {
|
||||
out << "for (";
|
||||
if (node->getInit())
|
||||
node->getInit()->traverse(this);
|
||||
out << "; ";
|
||||
|
||||
if (node->getCondition())
|
||||
node->getCondition()->traverse(this);
|
||||
out << "; ";
|
||||
|
||||
if (node->getExpression())
|
||||
node->getExpression()->traverse(this);
|
||||
out << ")\n";
|
||||
}
|
||||
}
|
||||
else if (loopType == ELoopWhile) // while loop
|
||||
{
|
||||
out << "while (";
|
||||
ASSERT(node->getCondition() != NULL);
|
||||
node->getCondition()->traverse(this);
|
||||
out << ")\n";
|
||||
}
|
||||
else // do-while loop
|
||||
{
|
||||
ASSERT(loopType == ELoopDoWhile);
|
||||
out << "do\n";
|
||||
}
|
||||
|
||||
// Loop body.
|
||||
if (node->getUnrollFlag())
|
||||
{
|
||||
TLoopIndexInfo indexInfo;
|
||||
mLoopUnroll.FillLoopIndexInfo(node, indexInfo);
|
||||
mLoopUnroll.Push(indexInfo);
|
||||
while (mLoopUnroll.SatisfiesLoopCondition())
|
||||
{
|
||||
visitCodeBlock(node->getBody());
|
||||
mLoopUnroll.Step();
|
||||
}
|
||||
mLoopUnroll.Pop();
|
||||
}
|
||||
else
|
||||
{
|
||||
visitCodeBlock(node->getBody());
|
||||
}
|
||||
|
||||
// Loop footer.
|
||||
if (loopType == ELoopDoWhile) // do-while loop
|
||||
{
|
||||
out << "while (";
|
||||
ASSERT(node->getCondition() != NULL);
|
||||
node->getCondition()->traverse(this);
|
||||
out << ");\n";
|
||||
}
|
||||
decrementDepth();
|
||||
|
||||
// No need to visit children. They have been already processed in
|
||||
// this function.
|
||||
return false;
|
||||
}
|
||||
|
||||
bool TOutputGLSLBase::visitBranch(Visit visit, TIntermBranch* node)
|
||||
{
|
||||
switch (node->getFlowOp())
|
||||
{
|
||||
case EOpKill: writeTriplet(visit, "discard", NULL, NULL); break;
|
||||
case EOpBreak: writeTriplet(visit, "break", NULL, NULL); break;
|
||||
case EOpContinue: writeTriplet(visit, "continue", NULL, NULL); break;
|
||||
case EOpReturn: writeTriplet(visit, "return ", NULL, NULL); break;
|
||||
default: UNREACHABLE(); break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void TOutputGLSLBase::visitCodeBlock(TIntermNode* node) {
|
||||
TInfoSinkBase &out = objSink();
|
||||
if (node != NULL)
|
||||
{
|
||||
node->traverse(this);
|
||||
// Single statements not part of a sequence need to be terminated
|
||||
// with semi-colon.
|
||||
if (isSingleStatement(node))
|
||||
out << ";\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
out << "{\n}\n"; // Empty code block.
|
||||
}
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
//
|
||||
// Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
//
|
||||
|
||||
#ifndef CROSSCOMPILERGLSL_OUTPUTGLSLBASE_H_
|
||||
#define CROSSCOMPILERGLSL_OUTPUTGLSLBASE_H_
|
||||
|
||||
#include <set>
|
||||
|
||||
#include "compiler/ForLoopUnroll.h"
|
||||
#include "compiler/intermediate.h"
|
||||
#include "compiler/ParseHelper.h"
|
||||
|
||||
class TOutputGLSLBase : public TIntermTraverser
|
||||
{
|
||||
public:
|
||||
TOutputGLSLBase(TInfoSinkBase& objSink);
|
||||
|
||||
protected:
|
||||
TInfoSinkBase& objSink() { return mObjSink; }
|
||||
void writeTriplet(Visit visit, const char* preStr, const char* inStr, const char* postStr);
|
||||
void writeVariableType(const TType& type);
|
||||
virtual bool writeVariablePrecision(TPrecision precision) = 0;
|
||||
void writeFunctionParameters(const TIntermSequence& args);
|
||||
const ConstantUnion* writeConstantUnion(const TType& type, const ConstantUnion* pConstUnion);
|
||||
|
||||
virtual void visitSymbol(TIntermSymbol* node);
|
||||
virtual void visitConstantUnion(TIntermConstantUnion* node);
|
||||
virtual bool visitBinary(Visit visit, TIntermBinary* node);
|
||||
virtual bool visitUnary(Visit visit, TIntermUnary* node);
|
||||
virtual bool visitSelection(Visit visit, TIntermSelection* node);
|
||||
virtual bool visitAggregate(Visit visit, TIntermAggregate* node);
|
||||
virtual bool visitLoop(Visit visit, TIntermLoop* node);
|
||||
virtual bool visitBranch(Visit visit, TIntermBranch* node);
|
||||
|
||||
void visitCodeBlock(TIntermNode* node);
|
||||
|
||||
private:
|
||||
TInfoSinkBase& mObjSink;
|
||||
bool mDeclaringVariables;
|
||||
|
||||
// Structs are declared as the tree is traversed. This set contains all
|
||||
// the structs already declared. It is maintained so that a struct is
|
||||
// declared only once.
|
||||
typedef std::set<TString> DeclaredStructs;
|
||||
DeclaredStructs mDeclaredStructs;
|
||||
|
||||
ForLoopUnroll mLoopUnroll;
|
||||
};
|
||||
|
||||
#endif // CROSSCOMPILERGLSL_OUTPUTGLSLBASE_H_
|
|
@ -196,7 +196,6 @@ bool TParseContext::parseMatrixFields(const TString& compString, int matSize, TM
|
|||
//
|
||||
void TParseContext::recover()
|
||||
{
|
||||
recoveredFromError = true;
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -261,6 +260,8 @@ void TParseContext::binaryOpError(int line, const char* op, TString left, TStrin
|
|||
}
|
||||
|
||||
bool TParseContext::precisionErrorCheck(int line, TPrecision precision, TBasicType type){
|
||||
if (!checksPrecisionErrors)
|
||||
return false;
|
||||
switch( type ){
|
||||
case EbtFloat:
|
||||
if( precision == EbpUndefined ){
|
||||
|
@ -941,6 +942,12 @@ bool TParseContext::extensionErrorCheck(int line, const TString& extension)
|
|||
return false;
|
||||
}
|
||||
|
||||
bool TParseContext::supportsExtension(const char* extension)
|
||||
{
|
||||
TExtensionBehavior::const_iterator iter = extensionBehavior.find(extension);
|
||||
return (iter != extensionBehavior.end());
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Non-Errors.
|
||||
|
|
|
@ -30,36 +30,41 @@ struct TPragma {
|
|||
// they can be passed to the parser without needing a global.
|
||||
//
|
||||
struct TParseContext {
|
||||
TParseContext(TSymbolTable& symt, const TExtensionBehavior& ext, TIntermediate& interm, ShShaderType type, ShShaderSpec spec, int options, const char* sourcePath, TInfoSink& is) :
|
||||
intermediate(interm), symbolTable(symt), extensionBehavior(ext), infoSink(is), shaderType(type), shaderSpec(spec), compileOptions(options), sourcePath(sourcePath), treeRoot(0),
|
||||
recoveredFromError(false), numErrors(0), lexAfterType(false), loopNestingLevel(0),
|
||||
inTypeParen(false), scanner(NULL), contextPragma(true, false) { }
|
||||
TParseContext(TSymbolTable& symt, TExtensionBehavior& ext, TIntermediate& interm, ShShaderType type, ShShaderSpec spec, int options, bool checksPrecErrors, const char* sourcePath, TInfoSink& is) :
|
||||
intermediate(interm), symbolTable(symt), extensionBehavior(ext), infoSink(is), shaderType(type), shaderSpec(spec), compileOptions(options), checksPrecisionErrors(checksPrecErrors), sourcePath(sourcePath), treeRoot(0),
|
||||
numErrors(0), lexAfterType(false), loopNestingLevel(0),
|
||||
inTypeParen(false), contextPragma(true, false), scanner(NULL) { }
|
||||
TIntermediate& intermediate; // to hold and build a parse tree
|
||||
TSymbolTable& symbolTable; // symbol table that goes with the language currently being parsed
|
||||
TExtensionBehavior extensionBehavior; // mapping between supported extensions and current behavior.
|
||||
TExtensionBehavior& extensionBehavior; // mapping between supported extensions and current behavior.
|
||||
TInfoSink& infoSink;
|
||||
ShShaderType shaderType; // vertex or fragment language (future: pack or unpack)
|
||||
ShShaderSpec shaderSpec; // The language specification compiler conforms to - GLES2 or WebGL.
|
||||
int compileOptions;
|
||||
const char* sourcePath; // Path of source file or NULL.
|
||||
TIntermNode* treeRoot; // root of parse tree being created
|
||||
bool recoveredFromError; // true if a parse error has occurred, but we continue to parse
|
||||
int numErrors;
|
||||
bool lexAfterType; // true if we've recognized a type, so can only be looking for an identifier
|
||||
int loopNestingLevel; // 0 if outside all loops
|
||||
bool inTypeParen; // true if in parentheses, looking only for an identifier
|
||||
const TType* currentFunctionType; // the return type of the function that's currently being parsed
|
||||
bool functionReturnsValue; // true if a non-void function has a return
|
||||
bool checksPrecisionErrors; // true if an error will be generated when a variable is declared without precision, explicit or implicit.
|
||||
struct TPragma contextPragma;
|
||||
TString HashErrMsg;
|
||||
bool AfterEOF;
|
||||
void* scanner;
|
||||
|
||||
void error(TSourceLoc loc, const char *reason, const char* token,
|
||||
const char* extraInfoFormat, ...);
|
||||
void warning(TSourceLoc loc, const char* reason, const char* token,
|
||||
const char* extraInfoFormat, ...);
|
||||
bool reservedErrorCheck(int line, const TString& identifier);
|
||||
void recover();
|
||||
|
||||
bool parseVectorFields(const TString&, int vecSize, TVectorFields&, int line);
|
||||
bool parseMatrixFields(const TString&, int matSize, TMatrixFields&, int line);
|
||||
|
||||
bool reservedErrorCheck(int line, const TString& identifier);
|
||||
void assignError(int line, const char* op, TString left, TString right);
|
||||
void unaryOpError(int line, const char* op, TString operand);
|
||||
void binaryOpError(int line, const char* op, TString left, TString right);
|
||||
|
@ -79,15 +84,19 @@ struct TParseContext {
|
|||
bool samplerErrorCheck(int line, const TPublicType& pType, const char* reason);
|
||||
bool structQualifierErrorCheck(int line, const TPublicType& pType);
|
||||
bool parameterSamplerErrorCheck(int line, TQualifier qualifier, const TType& type);
|
||||
bool containsSampler(TType& type);
|
||||
bool nonInitConstErrorCheck(int line, TString& identifier, TPublicType& type);
|
||||
bool nonInitErrorCheck(int line, TString& identifier, TPublicType& type, TVariable*& variable);
|
||||
bool paramErrorCheck(int line, TQualifier qualifier, TQualifier paramQualifier, TType* type);
|
||||
bool extensionErrorCheck(int line, const TString&);
|
||||
bool supportsExtension(const char* extension);
|
||||
|
||||
bool containsSampler(TType& type);
|
||||
bool areAllChildConst(TIntermAggregate* aggrNode);
|
||||
const TFunction* findFunction(int line, TFunction* pfnCall, bool *builtIn = 0);
|
||||
bool executeInitializer(TSourceLoc line, TString& identifier, TPublicType& pType,
|
||||
TIntermTyped* initializer, TIntermNode*& intermNode, TVariable* variable = 0);
|
||||
bool areAllChildConst(TIntermAggregate* aggrNode);
|
||||
bool arraySetMaxSize(TIntermSymbol*, TType*, int, bool, TSourceLoc);
|
||||
|
||||
TIntermTyped* addConstructor(TIntermNode*, const TType*, TOperator, TFunction*, TSourceLoc);
|
||||
TIntermTyped* foldConstConstructor(TIntermAggregate* aggrNode, const TType& type);
|
||||
TIntermTyped* constructStruct(TIntermNode*, TType*, int, TSourceLoc, bool subset);
|
||||
|
@ -96,11 +105,6 @@ struct TParseContext {
|
|||
TIntermTyped* addConstMatrixNode(int , TIntermTyped*, TSourceLoc);
|
||||
TIntermTyped* addConstArrayNode(int index, TIntermTyped* node, TSourceLoc line);
|
||||
TIntermTyped* addConstStruct(TString& , TIntermTyped*, TSourceLoc);
|
||||
bool arraySetMaxSize(TIntermSymbol*, TType*, int, bool, TSourceLoc);
|
||||
void* scanner;
|
||||
struct TPragma contextPragma;
|
||||
TString HashErrMsg;
|
||||
bool AfterEOF;
|
||||
};
|
||||
|
||||
int PaParseStrings(int count, const char* const string[], const int length[],
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
#include "GLSLANG/ShaderLang.h"
|
||||
|
||||
#include "compiler/BuiltInFunctionEmulator.h"
|
||||
#include "compiler/ExtensionBehavior.h"
|
||||
#include "compiler/InfoSink.h"
|
||||
#include "compiler/SymbolTable.h"
|
||||
|
@ -77,6 +78,10 @@ protected:
|
|||
void mapLongVariableNames(TIntermNode* root);
|
||||
// Translate to object code.
|
||||
virtual void translate(TIntermNode* root) = 0;
|
||||
// Get built-in extensions with default behavior.
|
||||
const TExtensionBehavior& getExtensionBehavior() const;
|
||||
|
||||
const BuiltInFunctionEmulator& getBuiltInFunctionEmulator() const;
|
||||
|
||||
private:
|
||||
ShShaderType shaderType;
|
||||
|
@ -88,6 +93,8 @@ private:
|
|||
// Built-in extensions with default behavior.
|
||||
TExtensionBehavior extensionBehavior;
|
||||
|
||||
BuiltInFunctionEmulator builtInFunctionEmulator;
|
||||
|
||||
// Results of compilation.
|
||||
TInfoSink infoSink; // Output sink.
|
||||
TVariableInfoList attribs; // Active attributes in the compiled shader.
|
||||
|
@ -106,7 +113,8 @@ private:
|
|||
// destroy the machine dependent objects, which contain the
|
||||
// above machine independent information.
|
||||
//
|
||||
TCompiler* ConstructCompiler(ShShaderType type, ShShaderSpec spec);
|
||||
TCompiler* ConstructCompiler(
|
||||
ShShaderType type, ShShaderSpec spec, ShShaderOutput output);
|
||||
void DeleteCompiler(TCompiler*);
|
||||
|
||||
#endif // _SHHANDLE_INCLUDED_
|
||||
|
|
|
@ -104,18 +104,20 @@ void ShInitBuiltInResources(ShBuiltInResources* resources)
|
|||
|
||||
// Extensions.
|
||||
resources->OES_standard_derivatives = 0;
|
||||
resources->OES_EGL_image_external = 0;
|
||||
}
|
||||
|
||||
//
|
||||
// Driver calls these to create and destroy compiler objects.
|
||||
//
|
||||
ShHandle ShConstructCompiler(ShShaderType type, ShShaderSpec spec,
|
||||
ShShaderOutput output,
|
||||
const ShBuiltInResources* resources)
|
||||
{
|
||||
if (!InitThread())
|
||||
return 0;
|
||||
|
||||
TShHandleBase* base = static_cast<TShHandleBase*>(ConstructCompiler(type, spec));
|
||||
TShHandleBase* base = static_cast<TShHandleBase*>(ConstructCompiler(type, spec, output));
|
||||
TCompiler* compiler = base->getAsCompiler();
|
||||
if (compiler == 0)
|
||||
return 0;
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
//
|
||||
// Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
//
|
||||
|
||||
#include "compiler/TranslatorESSL.h"
|
||||
|
||||
#include "compiler/OutputESSL.h"
|
||||
|
||||
TranslatorESSL::TranslatorESSL(ShShaderType type, ShShaderSpec spec)
|
||||
: TCompiler(type, spec) {
|
||||
}
|
||||
|
||||
void TranslatorESSL::translate(TIntermNode* root) {
|
||||
TInfoSinkBase& sink = getInfoSink().obj;
|
||||
|
||||
// Write built-in extension behaviors.
|
||||
writeExtensionBehavior();
|
||||
|
||||
// Write emulated built-in functions if needed.
|
||||
getBuiltInFunctionEmulator().OutputEmulatedFunctionDefinition(
|
||||
sink, getShaderType() == SH_FRAGMENT_SHADER);
|
||||
|
||||
// Write translated shader.
|
||||
TOutputESSL outputESSL(sink);
|
||||
root->traverse(&outputESSL);
|
||||
}
|
||||
|
||||
void TranslatorESSL::writeExtensionBehavior() {
|
||||
TInfoSinkBase& sink = getInfoSink().obj;
|
||||
const TExtensionBehavior& extensionBehavior = getExtensionBehavior();
|
||||
for (TExtensionBehavior::const_iterator iter = extensionBehavior.begin();
|
||||
iter != extensionBehavior.end(); ++iter) {
|
||||
if (iter->second != EBhUndefined) {
|
||||
sink << "#extension " << iter->first << " : "
|
||||
<< getBehaviorString(iter->second) << "\n";
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
//
|
||||
// Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
//
|
||||
|
||||
#ifndef COMPILER_TRANSLATORESSL_H_
|
||||
#define COMPILER_TRANSLATORESSL_H_
|
||||
|
||||
#include "compiler/ShHandle.h"
|
||||
|
||||
class TranslatorESSL : public TCompiler {
|
||||
public:
|
||||
TranslatorESSL(ShShaderType type, ShShaderSpec spec);
|
||||
|
||||
protected:
|
||||
virtual void translate(TIntermNode* root);
|
||||
|
||||
private:
|
||||
void writeExtensionBehavior();
|
||||
};
|
||||
|
||||
#endif // COMPILER_TRANSLATORESSL_H_
|
|
@ -31,6 +31,10 @@ void TranslatorGLSL::translate(TIntermNode* root) {
|
|||
// Write GLSL version.
|
||||
writeVersion(getShaderType(), root, sink);
|
||||
|
||||
// Write emulated built-in functions if needed.
|
||||
getBuiltInFunctionEmulator().OutputEmulatedFunctionDefinition(
|
||||
sink, false);
|
||||
|
||||
// Write translated shader.
|
||||
TOutputGLSL outputGLSL(sink);
|
||||
root->traverse(&outputGLSL);
|
||||
|
|
|
@ -53,13 +53,6 @@ public:
|
|||
IsLoopIndex(symbol, mLoopStack);
|
||||
}
|
||||
}
|
||||
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; }
|
||||
|
||||
private:
|
||||
bool mValid;
|
||||
|
@ -94,13 +87,6 @@ public:
|
|||
}
|
||||
}
|
||||
}
|
||||
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; }
|
||||
|
||||
private:
|
||||
bool mUsesFloatLoopIndex;
|
||||
|
@ -117,14 +103,6 @@ ValidateLimitations::ValidateLimitations(ShShaderType shaderType,
|
|||
{
|
||||
}
|
||||
|
||||
void ValidateLimitations::visitSymbol(TIntermSymbol*)
|
||||
{
|
||||
}
|
||||
|
||||
void ValidateLimitations::visitConstantUnion(TIntermConstantUnion*)
|
||||
{
|
||||
}
|
||||
|
||||
bool ValidateLimitations::visitBinary(Visit, TIntermBinary* node)
|
||||
{
|
||||
// Check if loop index is modified in the loop body.
|
||||
|
@ -170,11 +148,6 @@ bool ValidateLimitations::visitUnary(Visit, TIntermUnary* node)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool ValidateLimitations::visitSelection(Visit, TIntermSelection*)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ValidateLimitations::visitAggregate(Visit, TIntermAggregate* node)
|
||||
{
|
||||
switch (node->getOp()) {
|
||||
|
@ -209,11 +182,6 @@ bool ValidateLimitations::visitLoop(Visit, TIntermLoop* node)
|
|||
return false;
|
||||
}
|
||||
|
||||
bool ValidateLimitations::visitBranch(Visit, TIntermBranch*)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void ValidateLimitations::error(TSourceLoc loc,
|
||||
const char *reason, const char* token)
|
||||
{
|
||||
|
|
|
@ -25,14 +25,10 @@ public:
|
|||
|
||||
int numErrors() const { return mNumErrors; }
|
||||
|
||||
virtual void visitSymbol(TIntermSymbol*);
|
||||
virtual void visitConstantUnion(TIntermConstantUnion*);
|
||||
virtual bool visitBinary(Visit, TIntermBinary*);
|
||||
virtual bool visitUnary(Visit, TIntermUnary*);
|
||||
virtual bool visitSelection(Visit, TIntermSelection*);
|
||||
virtual bool visitAggregate(Visit, TIntermAggregate*);
|
||||
virtual bool visitLoop(Visit, TIntermLoop*);
|
||||
virtual bool visitBranch(Visit, TIntermBranch*);
|
||||
|
||||
private:
|
||||
void error(TSourceLoc loc, const char *reason, const char* token);
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
#!/bin/bash
|
||||
# Copyright (c) 2010 The ANGLE Project Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
# Generates GLSL ES lexer - glslang_lex.cpp
|
||||
|
||||
script_dir=$(dirname $0)
|
||||
input_file=$script_dir/glslang.l
|
||||
output_file=$script_dir/glslang_lex.cpp
|
||||
flex --noline --nounistd --outfile=$output_file $input_file
|
|
@ -1,12 +0,0 @@
|
|||
#!/bin/bash
|
||||
# Copyright (c) 2010 The ANGLE Project Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
# Generates GLSL ES parser - glslang_tab.h and glslang_tab.cpp
|
||||
|
||||
script_dir=$(dirname $0)
|
||||
input_file=$script_dir/glslang.y
|
||||
output_header=$script_dir/glslang_tab.h
|
||||
output_source=$script_dir/glslang_tab.cpp
|
||||
bison --no-lines --skeleton=yacc.c --defines=$output_header --output=$output_source $input_file
|
|
@ -0,0 +1,27 @@
|
|||
#!/bin/bash
|
||||
# Copyright (c) 2010 The ANGLE Project Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
# Generates GLSL ES parser - glslang_lex.cpp, glslang_tab.h, and glslang_tab.cpp
|
||||
|
||||
run_flex()
|
||||
{
|
||||
input_file=$script_dir/$1.l
|
||||
output_source=$script_dir/$1_lex.cpp
|
||||
flex --noline --nounistd --outfile=$output_source $input_file
|
||||
}
|
||||
|
||||
run_bison()
|
||||
{
|
||||
input_file=$script_dir/$1.y
|
||||
output_header=$script_dir/$1_tab.h
|
||||
output_source=$script_dir/$1_tab.cpp
|
||||
bison --no-lines --skeleton=yacc.c --defines=$output_header --output=$output_source $input_file
|
||||
}
|
||||
|
||||
script_dir=$(dirname $0)
|
||||
|
||||
# Generate Parser
|
||||
run_flex glslang
|
||||
run_bison glslang
|
|
@ -9,7 +9,7 @@ This file contains the Lex specification for GLSL ES.
|
|||
Based on ANSI C grammar, Lex specification:
|
||||
http://www.lysator.liu.se/c/ANSI-C-grammar-l.html
|
||||
|
||||
IF YOU MODIFY THIS FILE YOU ALSO NEED TO RUN generate_glslang_lexer.sh,
|
||||
IF YOU MODIFY THIS FILE YOU ALSO NEED TO RUN generate_parser.sh,
|
||||
WHICH GENERATES THE GLSL ES LEXER (glslang_lex.cpp).
|
||||
*/
|
||||
|
||||
|
@ -20,7 +20,7 @@ WHICH GENERATES THE GLSL ES LEXER (glslang_lex.cpp).
|
|||
// found in the LICENSE file.
|
||||
//
|
||||
|
||||
// This file is auto-generated by generate_glslang_lexer.sh. DO NOT EDIT!
|
||||
// This file is auto-generated by generate_parser.sh. DO NOT EDIT!
|
||||
}
|
||||
|
||||
%{
|
||||
|
@ -120,6 +120,7 @@ O [0-7]
|
|||
|
||||
"sampler2D" { context->lexAfterType = true; return SAMPLER2D; }
|
||||
"samplerCube" { context->lexAfterType = true; return SAMPLERCUBE; }
|
||||
"samplerExternalOES" { context->lexAfterType = true; return SAMPLER_EXTERNAL_OES; }
|
||||
|
||||
"struct" { context->lexAfterType = true; return(STRUCT); }
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ This file contains the Yacc grammar for GLSL ES.
|
|||
Based on ANSI C Yacc grammar:
|
||||
http://www.lysator.liu.se/c/ANSI-C-grammar-y.html
|
||||
|
||||
IF YOU MODIFY THIS FILE YOU ALSO NEED TO RUN generate_glslang_parser.sh,
|
||||
IF YOU MODIFY THIS FILE YOU ALSO NEED TO RUN generate_parser.sh,
|
||||
WHICH GENERATES THE GLSL ES PARSER (glslang_tab.cpp AND glslang_tab.h).
|
||||
*/
|
||||
|
||||
|
@ -20,7 +20,7 @@ WHICH GENERATES THE GLSL ES PARSER (glslang_tab.cpp AND glslang_tab.h).
|
|||
// found in the LICENSE file.
|
||||
//
|
||||
|
||||
// This file is auto-generated by generate_glslang_parser.sh. DO NOT EDIT!
|
||||
// This file is auto-generated by generate_parser.sh. DO NOT EDIT!
|
||||
|
||||
#include "compiler/SymbolTable.h"
|
||||
#include "compiler/ParseHelper.h"
|
||||
|
@ -98,7 +98,7 @@ extern void yyerror(TParseContext* context, const char* reason);
|
|||
%token <lex> BVEC2 BVEC3 BVEC4 IVEC2 IVEC3 IVEC4 VEC2 VEC3 VEC4
|
||||
%token <lex> MATRIX2 MATRIX3 MATRIX4 IN_QUAL OUT_QUAL INOUT_QUAL UNIFORM VARYING
|
||||
%token <lex> STRUCT VOID_TYPE WHILE
|
||||
%token <lex> SAMPLER2D SAMPLERCUBE
|
||||
%token <lex> SAMPLER2D SAMPLERCUBE SAMPLER_EXTERNAL_OES
|
||||
|
||||
%token <lex> IDENTIFIER TYPE_NAME FLOATCONSTANT INTCONSTANT BOOLCONSTANT
|
||||
%token <lex> FIELD_SELECTION
|
||||
|
@ -591,17 +591,10 @@ function_call_header
|
|||
// Grammar Note: Constructors look like functions, but are recognized as types.
|
||||
|
||||
function_identifier
|
||||
: type_specifier {
|
||||
: type_specifier_nonarray {
|
||||
//
|
||||
// Constructor
|
||||
//
|
||||
if ($1.array) {
|
||||
// Constructors for arrays are not allowed.
|
||||
context->error($1.line, "cannot construct this type", "array", "");
|
||||
context->recover();
|
||||
$1.setArray(false);
|
||||
}
|
||||
|
||||
TOperator op = EOpNull;
|
||||
if ($1.userDef) {
|
||||
op = EOpConstructStruct;
|
||||
|
@ -1176,13 +1169,6 @@ parameter_type_specifier
|
|||
init_declarator_list
|
||||
: single_declaration {
|
||||
$$ = $1;
|
||||
|
||||
if ($$.type.precision == EbpUndefined) {
|
||||
$$.type.precision = context->symbolTable.getDefaultPrecision($1.type.type);
|
||||
if (context->precisionErrorCheck($1.line, $$.type.precision, $1.type.type)) {
|
||||
context->recover();
|
||||
}
|
||||
}
|
||||
}
|
||||
| init_declarator_list COMMA IDENTIFIER {
|
||||
TIntermSymbol* symbol = context->intermediate.addSymbol(0, *$3.string, TType($1.type), $3.line);
|
||||
|
@ -1490,6 +1476,13 @@ type_qualifier
|
|||
type_specifier
|
||||
: type_specifier_no_prec {
|
||||
$$ = $1;
|
||||
|
||||
if ($$.precision == EbpUndefined) {
|
||||
$$.precision = context->symbolTable.getDefaultPrecision($1.type);
|
||||
if (context->precisionErrorCheck($1.line, $$.precision, $1.type)) {
|
||||
context->recover();
|
||||
}
|
||||
}
|
||||
}
|
||||
| precision_qualifier type_specifier_no_prec {
|
||||
$$ = $2;
|
||||
|
@ -1622,6 +1615,15 @@ type_specifier_nonarray
|
|||
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
|
||||
$$.setBasic(EbtSamplerCube, qual, $1.line);
|
||||
}
|
||||
| SAMPLER_EXTERNAL_OES {
|
||||
if (!context->supportsExtension("GL_OES_EGL_image_external")) {
|
||||
context->error($1.line, "unsupported type", "samplerExternalOES", "");
|
||||
context->recover();
|
||||
}
|
||||
FRAG_VERT_ONLY("samplerExternalOES", $1.line);
|
||||
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
|
||||
$$.setBasic(EbtSamplerExternalOES, qual, $1.line);
|
||||
}
|
||||
| struct_specifier {
|
||||
FRAG_VERT_ONLY("struct", $1.line);
|
||||
$$ = $1;
|
||||
|
@ -1693,6 +1695,7 @@ struct_declaration
|
|||
type->setBasicType($1.type);
|
||||
type->setNominalSize($1.size);
|
||||
type->setMatrix($1.matrix);
|
||||
type->setPrecision($1.precision);
|
||||
|
||||
// don't allow arrays of arrays
|
||||
if (type->isArray()) {
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
// found in the LICENSE file.
|
||||
//
|
||||
|
||||
// This file is auto-generated by generate_glslang_lexer.sh. DO NOT EDIT!
|
||||
// This file is auto-generated by generate_parser.sh. DO NOT EDIT!
|
||||
|
||||
|
||||
|
||||
|
@ -371,8 +371,8 @@ static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner );
|
|||
*yy_cp = '\0'; \
|
||||
yyg->yy_c_buf_p = yy_cp;
|
||||
|
||||
#define YY_NUM_RULES 145
|
||||
#define YY_END_OF_BUFFER 146
|
||||
#define YY_NUM_RULES 146
|
||||
#define YY_END_OF_BUFFER 147
|
||||
/* This struct is not used in this scanner,
|
||||
but its presence is necessary. */
|
||||
struct yy_trans_info
|
||||
|
@ -380,53 +380,55 @@ struct yy_trans_info
|
|||
flex_int32_t yy_verify;
|
||||
flex_int32_t yy_nxt;
|
||||
};
|
||||
static yyconst flex_int16_t yy_accept[411] =
|
||||
static yyconst flex_int16_t yy_accept[422] =
|
||||
{ 0,
|
||||
0, 0, 0, 0, 0, 0, 146, 144, 143, 143,
|
||||
128, 134, 139, 123, 124, 132, 131, 120, 129, 127,
|
||||
133, 92, 92, 121, 117, 135, 122, 136, 140, 88,
|
||||
125, 126, 138, 88, 88, 88, 88, 88, 88, 88,
|
||||
88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
|
||||
88, 88, 88, 118, 137, 119, 130, 3, 4, 3,
|
||||
142, 145, 141, 114, 100, 119, 108, 103, 98, 106,
|
||||
96, 107, 97, 95, 2, 1, 99, 94, 90, 91,
|
||||
0, 0, 92, 126, 118, 125, 115, 111, 113, 112,
|
||||
116, 88, 104, 110, 88, 88, 88, 88, 88, 88,
|
||||
0, 0, 0, 0, 0, 0, 147, 145, 144, 144,
|
||||
129, 135, 140, 124, 125, 133, 132, 121, 130, 128,
|
||||
134, 93, 93, 122, 118, 136, 123, 137, 141, 89,
|
||||
126, 127, 139, 89, 89, 89, 89, 89, 89, 89,
|
||||
89, 89, 89, 89, 89, 89, 89, 89, 89, 89,
|
||||
89, 89, 89, 119, 138, 120, 131, 3, 4, 3,
|
||||
143, 146, 142, 115, 101, 120, 109, 104, 99, 107,
|
||||
97, 108, 98, 96, 2, 1, 100, 95, 91, 92,
|
||||
0, 0, 93, 127, 119, 126, 116, 112, 114, 113,
|
||||
117, 89, 105, 111, 89, 89, 89, 89, 89, 89,
|
||||
|
||||
88, 88, 88, 88, 17, 88, 88, 88, 88, 88,
|
||||
88, 88, 88, 88, 88, 88, 88, 88, 20, 22,
|
||||
88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
|
||||
88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
|
||||
88, 88, 88, 88, 88, 88, 105, 109, 5, 141,
|
||||
0, 1, 94, 0, 0, 93, 89, 101, 102, 48,
|
||||
88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
|
||||
88, 88, 88, 88, 88, 88, 88, 18, 88, 88,
|
||||
88, 88, 88, 88, 88, 88, 26, 88, 88, 88,
|
||||
88, 88, 88, 88, 88, 23, 88, 88, 88, 88,
|
||||
89, 89, 89, 89, 17, 89, 89, 89, 89, 89,
|
||||
89, 89, 89, 89, 89, 89, 89, 89, 20, 22,
|
||||
89, 89, 89, 89, 89, 89, 89, 89, 89, 89,
|
||||
89, 89, 89, 89, 89, 89, 89, 89, 89, 89,
|
||||
89, 89, 89, 89, 89, 89, 106, 110, 5, 142,
|
||||
0, 1, 95, 0, 0, 94, 90, 102, 103, 49,
|
||||
89, 89, 89, 89, 89, 89, 89, 89, 89, 89,
|
||||
89, 89, 89, 89, 89, 89, 89, 18, 89, 89,
|
||||
89, 89, 89, 89, 89, 89, 26, 89, 89, 89,
|
||||
89, 89, 89, 89, 89, 23, 89, 89, 89, 89,
|
||||
|
||||
88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
|
||||
88, 88, 88, 88, 88, 88, 88, 88, 0, 95,
|
||||
0, 94, 88, 28, 88, 88, 85, 88, 88, 88,
|
||||
88, 88, 88, 88, 21, 51, 88, 88, 88, 88,
|
||||
88, 56, 70, 88, 88, 88, 88, 88, 88, 88,
|
||||
88, 67, 9, 33, 34, 35, 88, 88, 88, 88,
|
||||
88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
|
||||
88, 54, 29, 88, 88, 88, 88, 88, 88, 36,
|
||||
37, 38, 27, 88, 88, 88, 15, 42, 43, 44,
|
||||
49, 12, 88, 88, 88, 88, 81, 82, 83, 88,
|
||||
89, 89, 89, 89, 89, 89, 89, 89, 89, 89,
|
||||
89, 89, 89, 89, 89, 89, 89, 89, 0, 96,
|
||||
0, 95, 89, 28, 89, 89, 86, 89, 89, 89,
|
||||
89, 89, 89, 89, 21, 52, 89, 89, 89, 89,
|
||||
89, 57, 71, 89, 89, 89, 89, 89, 89, 89,
|
||||
89, 68, 9, 33, 34, 35, 89, 89, 89, 89,
|
||||
89, 89, 89, 89, 89, 89, 89, 89, 89, 89,
|
||||
89, 55, 29, 89, 89, 89, 89, 89, 89, 36,
|
||||
37, 38, 27, 89, 89, 89, 15, 42, 43, 44,
|
||||
50, 12, 89, 89, 89, 89, 82, 83, 84, 89,
|
||||
|
||||
30, 71, 25, 78, 79, 80, 7, 75, 76, 77,
|
||||
88, 24, 73, 88, 88, 39, 40, 41, 88, 88,
|
||||
88, 88, 88, 88, 88, 88, 88, 68, 88, 88,
|
||||
88, 88, 88, 88, 88, 50, 88, 87, 88, 88,
|
||||
19, 88, 88, 88, 88, 69, 64, 59, 88, 88,
|
||||
88, 88, 88, 74, 55, 88, 62, 32, 88, 84,
|
||||
63, 47, 57, 88, 88, 88, 88, 88, 88, 88,
|
||||
88, 58, 31, 88, 88, 88, 8, 88, 88, 88,
|
||||
88, 88, 52, 13, 88, 14, 88, 88, 16, 65,
|
||||
88, 88, 88, 60, 88, 88, 88, 53, 72, 61,
|
||||
30, 72, 25, 79, 80, 81, 7, 76, 77, 78,
|
||||
89, 24, 74, 89, 89, 39, 40, 41, 89, 89,
|
||||
89, 89, 89, 89, 89, 89, 89, 69, 89, 89,
|
||||
89, 89, 89, 89, 89, 51, 89, 88, 89, 89,
|
||||
19, 89, 89, 89, 89, 70, 65, 60, 89, 89,
|
||||
89, 89, 89, 75, 56, 89, 63, 32, 89, 85,
|
||||
64, 48, 58, 89, 89, 89, 89, 89, 89, 89,
|
||||
89, 59, 31, 89, 89, 89, 8, 89, 89, 89,
|
||||
89, 89, 53, 13, 89, 14, 89, 89, 16, 66,
|
||||
89, 89, 89, 61, 89, 89, 89, 89, 54, 73,
|
||||
|
||||
11, 66, 6, 86, 10, 45, 88, 88, 46, 0
|
||||
62, 11, 67, 6, 87, 10, 45, 89, 89, 89,
|
||||
89, 46, 89, 89, 89, 89, 89, 89, 89, 47,
|
||||
0
|
||||
} ;
|
||||
|
||||
static yyconst flex_int32_t yy_ec[256] =
|
||||
|
@ -438,13 +440,13 @@ static yyconst flex_int32_t yy_ec[256] =
|
|||
8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
|
||||
18, 19, 16, 16, 16, 20, 20, 21, 22, 23,
|
||||
24, 25, 26, 1, 27, 27, 28, 29, 30, 27,
|
||||
31, 31, 31, 31, 31, 31, 31, 31, 31, 31,
|
||||
31, 31, 31, 31, 31, 31, 31, 32, 31, 31,
|
||||
33, 1, 34, 35, 31, 1, 36, 37, 38, 39,
|
||||
31, 31, 31, 31, 31, 31, 31, 31, 32, 31,
|
||||
31, 31, 33, 31, 31, 31, 31, 34, 31, 31,
|
||||
35, 1, 36, 37, 31, 1, 38, 39, 40, 41,
|
||||
|
||||
40, 41, 42, 43, 44, 31, 45, 46, 47, 48,
|
||||
49, 50, 31, 51, 52, 53, 54, 55, 56, 57,
|
||||
58, 59, 60, 61, 62, 63, 1, 1, 1, 1,
|
||||
42, 43, 44, 45, 46, 31, 47, 48, 49, 50,
|
||||
51, 52, 31, 53, 54, 55, 56, 57, 58, 59,
|
||||
60, 61, 62, 63, 64, 65, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
|
@ -461,195 +463,199 @@ static yyconst flex_int32_t yy_ec[256] =
|
|||
1, 1, 1, 1, 1
|
||||
} ;
|
||||
|
||||
static yyconst flex_int32_t yy_meta[64] =
|
||||
static yyconst flex_int32_t yy_meta[66] =
|
||||
{ 0,
|
||||
1, 1, 2, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 3, 3, 3, 3, 3, 3,
|
||||
1, 1, 1, 1, 1, 1, 3, 3, 3, 3,
|
||||
4, 4, 1, 1, 1, 3, 3, 3, 3, 3,
|
||||
3, 4, 4, 4, 4, 4, 4, 4, 4, 4,
|
||||
4, 4, 4, 4, 4, 4, 4, 4, 4, 1,
|
||||
1, 1, 1
|
||||
4, 4, 4, 4, 1, 1, 1, 3, 3, 3,
|
||||
3, 3, 3, 4, 4, 4, 4, 4, 4, 4,
|
||||
4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
|
||||
4, 1, 1, 1, 1
|
||||
} ;
|
||||
|
||||
static yyconst flex_int16_t yy_base[416] =
|
||||
static yyconst flex_int16_t yy_base[427] =
|
||||
{ 0,
|
||||
0, 0, 61, 62, 71, 0, 606, 607, 607, 607,
|
||||
581, 42, 129, 607, 607, 580, 126, 607, 125, 123,
|
||||
137, 149, 157, 578, 607, 175, 578, 44, 607, 0,
|
||||
607, 607, 120, 95, 103, 142, 146, 136, 156, 552,
|
||||
168, 162, 551, 120, 158, 545, 173, 558, 172, 178,
|
||||
111, 186, 554, 607, 159, 607, 607, 607, 607, 582,
|
||||
607, 607, 0, 607, 607, 607, 607, 607, 607, 607,
|
||||
607, 607, 607, 222, 607, 0, 607, 228, 254, 262,
|
||||
281, 0, 290, 607, 607, 607, 571, 607, 607, 607,
|
||||
570, 0, 607, 607, 546, 539, 542, 550, 549, 536,
|
||||
0, 0, 63, 64, 73, 0, 621, 622, 622, 622,
|
||||
596, 44, 133, 622, 622, 595, 130, 622, 129, 127,
|
||||
141, 153, 161, 593, 622, 177, 593, 46, 622, 0,
|
||||
622, 622, 124, 97, 105, 137, 148, 154, 168, 565,
|
||||
151, 167, 564, 121, 158, 558, 111, 571, 177, 176,
|
||||
157, 188, 567, 622, 168, 622, 622, 622, 622, 597,
|
||||
622, 622, 0, 622, 622, 622, 622, 622, 622, 622,
|
||||
622, 622, 622, 225, 622, 0, 622, 231, 259, 267,
|
||||
288, 0, 297, 622, 622, 622, 586, 622, 622, 622,
|
||||
585, 0, 622, 622, 559, 552, 555, 563, 562, 549,
|
||||
|
||||
551, 538, 544, 532, 529, 542, 529, 526, 526, 532,
|
||||
520, 527, 524, 534, 520, 526, 529, 530, 0, 204,
|
||||
529, 207, 515, 528, 519, 521, 511, 525, 522, 524,
|
||||
507, 512, 509, 498, 183, 512, 508, 510, 499, 502,
|
||||
212, 507, 499, 511, 186, 504, 607, 607, 607, 0,
|
||||
306, 0, 316, 332, 270, 342, 0, 607, 607, 0,
|
||||
496, 500, 509, 506, 490, 490, 161, 505, 502, 502,
|
||||
500, 497, 489, 495, 482, 493, 496, 0, 493, 481,
|
||||
488, 485, 489, 482, 471, 470, 483, 486, 483, 478,
|
||||
469, 294, 474, 477, 468, 465, 469, 475, 466, 457,
|
||||
564, 551, 557, 545, 542, 555, 542, 539, 539, 545,
|
||||
533, 540, 537, 547, 533, 539, 542, 543, 0, 205,
|
||||
542, 170, 528, 541, 532, 534, 524, 538, 535, 537,
|
||||
520, 525, 522, 511, 199, 525, 521, 523, 512, 515,
|
||||
212, 520, 512, 524, 138, 517, 622, 622, 622, 0,
|
||||
313, 0, 325, 341, 275, 353, 0, 622, 622, 0,
|
||||
509, 513, 522, 519, 503, 503, 179, 518, 515, 515,
|
||||
513, 510, 502, 508, 495, 506, 509, 0, 506, 494,
|
||||
501, 498, 502, 495, 484, 483, 496, 499, 496, 491,
|
||||
482, 246, 487, 490, 481, 478, 482, 488, 479, 470,
|
||||
|
||||
460, 458, 468, 454, 452, 452, 454, 451, 462, 461,
|
||||
278, 456, 451, 440, 320, 458, 460, 449, 348, 354,
|
||||
360, 366, 450, 0, 448, 336, 0, 440, 438, 446,
|
||||
435, 452, 441, 370, 0, 0, 435, 445, 445, 430,
|
||||
373, 0, 0, 432, 376, 433, 427, 426, 427, 426,
|
||||
379, 0, 0, 0, 0, 0, 422, 423, 428, 419,
|
||||
432, 427, 426, 418, 422, 414, 417, 421, 426, 425,
|
||||
416, 0, 0, 422, 411, 411, 416, 415, 412, 0,
|
||||
0, 0, 0, 402, 414, 416, 0, 0, 0, 0,
|
||||
0, 0, 404, 405, 399, 409, 0, 0, 0, 400,
|
||||
473, 471, 481, 467, 465, 465, 467, 464, 475, 474,
|
||||
245, 469, 464, 453, 251, 471, 473, 462, 359, 365,
|
||||
371, 377, 463, 0, 461, 301, 0, 453, 451, 459,
|
||||
448, 465, 454, 317, 0, 0, 448, 458, 458, 443,
|
||||
329, 0, 0, 445, 345, 446, 440, 439, 440, 439,
|
||||
381, 0, 0, 0, 0, 0, 435, 436, 441, 432,
|
||||
445, 440, 439, 431, 435, 427, 430, 434, 439, 438,
|
||||
429, 0, 0, 435, 424, 424, 429, 428, 425, 0,
|
||||
0, 0, 0, 415, 427, 429, 0, 0, 0, 0,
|
||||
0, 0, 417, 418, 412, 422, 0, 0, 0, 413,
|
||||
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
407, 0, 0, 405, 401, 0, 0, 0, 397, 393,
|
||||
398, 388, 401, 387, 400, 389, 396, 0, 394, 396,
|
||||
380, 389, 395, 390, 378, 0, 380, 0, 379, 382,
|
||||
0, 371, 370, 370, 383, 0, 385, 0, 384, 383,
|
||||
368, 381, 368, 0, 0, 371, 0, 0, 363, 0,
|
||||
0, 0, 0, 360, 371, 364, 368, 303, 297, 288,
|
||||
300, 0, 0, 283, 290, 269, 0, 277, 274, 255,
|
||||
232, 255, 0, 0, 244, 0, 236, 226, 0, 0,
|
||||
225, 208, 211, 0, 185, 202, 131, 0, 0, 0,
|
||||
420, 0, 0, 418, 414, 0, 0, 0, 410, 406,
|
||||
411, 401, 414, 400, 413, 402, 409, 0, 407, 409,
|
||||
393, 402, 408, 403, 391, 0, 393, 0, 392, 395,
|
||||
0, 384, 383, 383, 396, 0, 398, 0, 397, 396,
|
||||
381, 394, 381, 0, 0, 384, 0, 0, 376, 0,
|
||||
0, 0, 0, 373, 384, 377, 383, 380, 375, 367,
|
||||
379, 0, 0, 372, 379, 368, 0, 377, 374, 364,
|
||||
294, 372, 0, 0, 372, 0, 368, 324, 0, 0,
|
||||
323, 299, 310, 0, 300, 320, 282, 278, 0, 0,
|
||||
|
||||
0, 0, 0, 0, 0, 0, 134, 117, 0, 607,
|
||||
398, 400, 402, 406, 142
|
||||
0, 0, 0, 0, 0, 0, 0, 287, 266, 260,
|
||||
257, 0, 228, 221, 221, 206, 206, 197, 160, 0,
|
||||
622, 400, 402, 404, 408, 157
|
||||
} ;
|
||||
|
||||
static yyconst flex_int16_t yy_def[416] =
|
||||
static yyconst flex_int16_t yy_def[427] =
|
||||
{ 0,
|
||||
410, 1, 411, 411, 410, 5, 410, 410, 410, 410,
|
||||
410, 410, 410, 410, 410, 410, 410, 410, 410, 410,
|
||||
410, 410, 410, 410, 410, 410, 410, 410, 410, 412,
|
||||
410, 410, 410, 412, 412, 412, 412, 412, 412, 412,
|
||||
412, 412, 412, 412, 412, 412, 412, 412, 412, 412,
|
||||
412, 412, 412, 410, 410, 410, 410, 410, 410, 410,
|
||||
410, 410, 413, 410, 410, 410, 410, 410, 410, 410,
|
||||
410, 410, 410, 410, 410, 414, 410, 410, 410, 410,
|
||||
410, 415, 410, 410, 410, 410, 410, 410, 410, 410,
|
||||
410, 412, 410, 410, 412, 412, 412, 412, 412, 412,
|
||||
421, 1, 422, 422, 421, 5, 421, 421, 421, 421,
|
||||
421, 421, 421, 421, 421, 421, 421, 421, 421, 421,
|
||||
421, 421, 421, 421, 421, 421, 421, 421, 421, 423,
|
||||
421, 421, 421, 423, 423, 423, 423, 423, 423, 423,
|
||||
423, 423, 423, 423, 423, 423, 423, 423, 423, 423,
|
||||
423, 423, 423, 421, 421, 421, 421, 421, 421, 421,
|
||||
421, 421, 424, 421, 421, 421, 421, 421, 421, 421,
|
||||
421, 421, 421, 421, 421, 425, 421, 421, 421, 421,
|
||||
421, 426, 421, 421, 421, 421, 421, 421, 421, 421,
|
||||
421, 423, 421, 421, 423, 423, 423, 423, 423, 423,
|
||||
|
||||
412, 412, 412, 412, 412, 412, 412, 412, 412, 412,
|
||||
412, 412, 412, 412, 412, 412, 412, 412, 412, 412,
|
||||
412, 412, 412, 412, 412, 412, 412, 412, 412, 412,
|
||||
412, 412, 412, 412, 412, 412, 412, 412, 412, 412,
|
||||
412, 412, 412, 412, 412, 412, 410, 410, 410, 413,
|
||||
410, 414, 410, 410, 410, 410, 415, 410, 410, 412,
|
||||
412, 412, 412, 412, 412, 412, 412, 412, 412, 412,
|
||||
412, 412, 412, 412, 412, 412, 412, 412, 412, 412,
|
||||
412, 412, 412, 412, 412, 412, 412, 412, 412, 412,
|
||||
412, 412, 412, 412, 412, 412, 412, 412, 412, 412,
|
||||
423, 423, 423, 423, 423, 423, 423, 423, 423, 423,
|
||||
423, 423, 423, 423, 423, 423, 423, 423, 423, 423,
|
||||
423, 423, 423, 423, 423, 423, 423, 423, 423, 423,
|
||||
423, 423, 423, 423, 423, 423, 423, 423, 423, 423,
|
||||
423, 423, 423, 423, 423, 423, 421, 421, 421, 424,
|
||||
421, 425, 421, 421, 421, 421, 426, 421, 421, 423,
|
||||
423, 423, 423, 423, 423, 423, 423, 423, 423, 423,
|
||||
423, 423, 423, 423, 423, 423, 423, 423, 423, 423,
|
||||
423, 423, 423, 423, 423, 423, 423, 423, 423, 423,
|
||||
423, 423, 423, 423, 423, 423, 423, 423, 423, 423,
|
||||
|
||||
412, 412, 412, 412, 412, 412, 412, 412, 412, 412,
|
||||
412, 412, 412, 412, 412, 412, 412, 412, 410, 410,
|
||||
410, 410, 412, 412, 412, 412, 412, 412, 412, 412,
|
||||
412, 412, 412, 412, 412, 412, 412, 412, 412, 412,
|
||||
412, 412, 412, 412, 412, 412, 412, 412, 412, 412,
|
||||
412, 412, 412, 412, 412, 412, 412, 412, 412, 412,
|
||||
412, 412, 412, 412, 412, 412, 412, 412, 412, 412,
|
||||
412, 412, 412, 412, 412, 412, 412, 412, 412, 412,
|
||||
412, 412, 412, 412, 412, 412, 412, 412, 412, 412,
|
||||
412, 412, 412, 412, 412, 412, 412, 412, 412, 412,
|
||||
423, 423, 423, 423, 423, 423, 423, 423, 423, 423,
|
||||
423, 423, 423, 423, 423, 423, 423, 423, 421, 421,
|
||||
421, 421, 423, 423, 423, 423, 423, 423, 423, 423,
|
||||
423, 423, 423, 423, 423, 423, 423, 423, 423, 423,
|
||||
423, 423, 423, 423, 423, 423, 423, 423, 423, 423,
|
||||
423, 423, 423, 423, 423, 423, 423, 423, 423, 423,
|
||||
423, 423, 423, 423, 423, 423, 423, 423, 423, 423,
|
||||
423, 423, 423, 423, 423, 423, 423, 423, 423, 423,
|
||||
423, 423, 423, 423, 423, 423, 423, 423, 423, 423,
|
||||
423, 423, 423, 423, 423, 423, 423, 423, 423, 423,
|
||||
|
||||
412, 412, 412, 412, 412, 412, 412, 412, 412, 412,
|
||||
412, 412, 412, 412, 412, 412, 412, 412, 412, 412,
|
||||
412, 412, 412, 412, 412, 412, 412, 412, 412, 412,
|
||||
412, 412, 412, 412, 412, 412, 412, 412, 412, 412,
|
||||
412, 412, 412, 412, 412, 412, 412, 412, 412, 412,
|
||||
412, 412, 412, 412, 412, 412, 412, 412, 412, 412,
|
||||
412, 412, 412, 412, 412, 412, 412, 412, 412, 412,
|
||||
412, 412, 412, 412, 412, 412, 412, 412, 412, 412,
|
||||
412, 412, 412, 412, 412, 412, 412, 412, 412, 412,
|
||||
412, 412, 412, 412, 412, 412, 412, 412, 412, 412,
|
||||
423, 423, 423, 423, 423, 423, 423, 423, 423, 423,
|
||||
423, 423, 423, 423, 423, 423, 423, 423, 423, 423,
|
||||
423, 423, 423, 423, 423, 423, 423, 423, 423, 423,
|
||||
423, 423, 423, 423, 423, 423, 423, 423, 423, 423,
|
||||
423, 423, 423, 423, 423, 423, 423, 423, 423, 423,
|
||||
423, 423, 423, 423, 423, 423, 423, 423, 423, 423,
|
||||
423, 423, 423, 423, 423, 423, 423, 423, 423, 423,
|
||||
423, 423, 423, 423, 423, 423, 423, 423, 423, 423,
|
||||
423, 423, 423, 423, 423, 423, 423, 423, 423, 423,
|
||||
423, 423, 423, 423, 423, 423, 423, 423, 423, 423,
|
||||
|
||||
412, 412, 412, 412, 412, 412, 412, 412, 412, 0,
|
||||
410, 410, 410, 410, 410
|
||||
423, 423, 423, 423, 423, 423, 423, 423, 423, 423,
|
||||
423, 423, 423, 423, 423, 423, 423, 423, 423, 423,
|
||||
0, 421, 421, 421, 421, 421
|
||||
} ;
|
||||
|
||||
static yyconst flex_int16_t yy_nxt[671] =
|
||||
static yyconst flex_int16_t yy_nxt[688] =
|
||||
{ 0,
|
||||
8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
|
||||
18, 19, 20, 21, 22, 23, 23, 23, 23, 23,
|
||||
24, 25, 26, 27, 28, 29, 30, 30, 30, 30,
|
||||
30, 30, 31, 32, 33, 34, 35, 36, 37, 38,
|
||||
39, 40, 41, 42, 30, 43, 44, 45, 46, 47,
|
||||
48, 49, 50, 51, 52, 53, 30, 30, 30, 54,
|
||||
55, 56, 57, 59, 59, 65, 66, 90, 91, 60,
|
||||
60, 8, 61, 62, 8, 8, 8, 8, 8, 8,
|
||||
30, 30, 30, 30, 31, 32, 33, 34, 35, 36,
|
||||
37, 38, 39, 40, 41, 42, 30, 43, 44, 45,
|
||||
46, 47, 48, 49, 50, 51, 52, 53, 30, 30,
|
||||
30, 54, 55, 56, 57, 59, 59, 65, 66, 90,
|
||||
91, 60, 60, 8, 61, 62, 8, 8, 8, 8,
|
||||
8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
|
||||
8, 8, 8, 8, 8, 8, 8, 63, 63, 63,
|
||||
8, 8, 8, 8, 8, 8, 8, 8, 8, 63,
|
||||
|
||||
63, 63, 63, 8, 8, 8, 63, 63, 63, 63,
|
||||
63, 63, 63, 63, 63, 63, 63, 8, 8, 8,
|
||||
63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
|
||||
63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
|
||||
8, 8, 8, 8, 67, 70, 72, 74, 74, 74,
|
||||
74, 74, 74, 93, 157, 75, 95, 96, 73, 71,
|
||||
76, 97, 68, 98, 94, 123, 409, 99, 141, 124,
|
||||
77, 78, 142, 79, 79, 79, 79, 79, 80, 78,
|
||||
408, 83, 83, 83, 83, 83, 83, 100, 81, 85,
|
||||
82, 107, 147, 108, 407, 103, 81, 101, 81, 104,
|
||||
102, 110, 109, 125, 105, 86, 81, 87, 88, 111,
|
||||
63, 63, 63, 63, 8, 8, 8, 8, 67, 70,
|
||||
72, 74, 74, 74, 74, 74, 74, 93, 128, 75,
|
||||
95, 96, 73, 71, 76, 97, 68, 98, 123, 157,
|
||||
94, 99, 124, 129, 77, 78, 130, 79, 79, 79,
|
||||
79, 79, 80, 78, 100, 83, 83, 83, 83, 83,
|
||||
83, 85, 81, 216, 101, 217, 82, 102, 116, 103,
|
||||
81, 147, 420, 104, 81, 125, 117, 86, 105, 87,
|
||||
|
||||
106, 112, 119, 116, 113, 82, 126, 132, 128, 120,
|
||||
114, 117, 229, 230, 133, 134, 121, 137, 204, 148,
|
||||
138, 143, 118, 129, 135, 144, 130, 136, 139, 216,
|
||||
406, 217, 405, 205, 145, 140, 74, 74, 74, 74,
|
||||
74, 74, 153, 153, 153, 153, 153, 153, 396, 184,
|
||||
404, 151, 185, 186, 190, 211, 187, 154, 188, 397,
|
||||
403, 151, 191, 212, 402, 401, 78, 154, 79, 79,
|
||||
79, 79, 79, 80, 78, 400, 80, 80, 80, 80,
|
||||
80, 80, 399, 81, 156, 156, 156, 156, 156, 156,
|
||||
155, 81, 155, 81, 398, 156, 156, 156, 156, 156,
|
||||
88, 107, 81, 108, 106, 110, 141, 118, 126, 119,
|
||||
142, 82, 109, 111, 132, 112, 120, 137, 113, 190,
|
||||
138, 133, 134, 121, 114, 143, 419, 191, 139, 144,
|
||||
148, 135, 229, 230, 136, 140, 204, 418, 145, 74,
|
||||
74, 74, 74, 74, 74, 153, 153, 153, 153, 153,
|
||||
153, 205, 184, 417, 151, 185, 186, 211, 416, 187,
|
||||
154, 188, 254, 255, 256, 212, 151, 280, 281, 282,
|
||||
415, 78, 154, 79, 79, 79, 79, 79, 80, 78,
|
||||
414, 80, 80, 80, 80, 80, 80, 275, 81, 156,
|
||||
156, 156, 156, 156, 156, 276, 81, 155, 413, 155,
|
||||
|
||||
156, 81, 78, 395, 83, 83, 83, 83, 83, 83,
|
||||
254, 255, 256, 394, 393, 219, 392, 219, 275, 81,
|
||||
220, 220, 220, 220, 220, 220, 276, 391, 390, 81,
|
||||
153, 153, 153, 153, 153, 153, 280, 281, 282, 389,
|
||||
388, 221, 387, 221, 386, 154, 222, 222, 222, 222,
|
||||
222, 222, 288, 289, 290, 154, 156, 156, 156, 156,
|
||||
156, 156, 220, 220, 220, 220, 220, 220, 220, 220,
|
||||
220, 220, 220, 220, 222, 222, 222, 222, 222, 222,
|
||||
222, 222, 222, 222, 222, 222, 297, 298, 299, 304,
|
||||
305, 306, 308, 309, 310, 316, 317, 318, 58, 58,
|
||||
81, 412, 156, 156, 156, 156, 156, 156, 81, 78,
|
||||
396, 83, 83, 83, 83, 83, 83, 288, 289, 290,
|
||||
411, 397, 219, 398, 219, 410, 81, 220, 220, 220,
|
||||
220, 220, 220, 297, 298, 299, 409, 408, 81, 153,
|
||||
153, 153, 153, 153, 153, 304, 305, 306, 407, 406,
|
||||
221, 405, 221, 404, 154, 222, 222, 222, 222, 222,
|
||||
222, 308, 309, 310, 403, 402, 154, 156, 156, 156,
|
||||
156, 156, 156, 220, 220, 220, 220, 220, 220, 220,
|
||||
220, 220, 220, 220, 220, 222, 222, 222, 222, 222,
|
||||
222, 222, 222, 222, 222, 222, 222, 316, 317, 318,
|
||||
|
||||
58, 58, 92, 92, 150, 150, 152, 385, 152, 152,
|
||||
384, 383, 382, 381, 380, 379, 378, 377, 376, 375,
|
||||
374, 373, 372, 371, 370, 369, 368, 367, 366, 365,
|
||||
364, 363, 362, 361, 360, 359, 358, 357, 356, 355,
|
||||
354, 353, 352, 351, 350, 349, 348, 347, 346, 345,
|
||||
344, 343, 342, 341, 340, 339, 338, 337, 336, 335,
|
||||
334, 333, 332, 331, 330, 329, 328, 327, 326, 325,
|
||||
324, 323, 322, 321, 320, 319, 315, 314, 313, 312,
|
||||
311, 307, 303, 302, 301, 300, 296, 295, 294, 293,
|
||||
292, 291, 287, 286, 285, 284, 283, 279, 278, 277,
|
||||
58, 58, 58, 58, 92, 92, 150, 150, 152, 401,
|
||||
152, 152, 400, 399, 395, 394, 393, 392, 391, 390,
|
||||
389, 388, 387, 386, 385, 384, 383, 382, 381, 380,
|
||||
379, 378, 377, 376, 375, 374, 373, 372, 371, 370,
|
||||
369, 368, 367, 366, 365, 364, 363, 362, 361, 360,
|
||||
359, 358, 357, 356, 355, 354, 353, 352, 351, 350,
|
||||
349, 348, 347, 346, 345, 344, 343, 342, 341, 340,
|
||||
339, 338, 337, 336, 335, 334, 333, 332, 331, 330,
|
||||
329, 328, 327, 326, 325, 324, 323, 322, 321, 320,
|
||||
319, 315, 314, 313, 312, 311, 307, 303, 302, 301,
|
||||
|
||||
274, 273, 272, 271, 270, 269, 268, 267, 266, 265,
|
||||
264, 263, 262, 261, 260, 259, 258, 257, 253, 252,
|
||||
251, 250, 249, 248, 247, 246, 245, 244, 243, 242,
|
||||
241, 240, 239, 238, 237, 236, 235, 234, 233, 232,
|
||||
231, 228, 227, 226, 225, 224, 223, 218, 215, 214,
|
||||
213, 210, 209, 208, 207, 206, 203, 202, 201, 200,
|
||||
199, 198, 197, 196, 195, 194, 193, 192, 189, 183,
|
||||
182, 181, 180, 179, 178, 177, 176, 175, 174, 173,
|
||||
172, 171, 170, 169, 168, 167, 166, 165, 164, 163,
|
||||
162, 161, 160, 159, 158, 149, 146, 131, 127, 122,
|
||||
300, 296, 295, 294, 293, 292, 291, 287, 286, 285,
|
||||
284, 283, 279, 278, 277, 274, 273, 272, 271, 270,
|
||||
269, 268, 267, 266, 265, 264, 263, 262, 261, 260,
|
||||
259, 258, 257, 253, 252, 251, 250, 249, 248, 247,
|
||||
246, 245, 244, 243, 242, 241, 240, 239, 238, 237,
|
||||
236, 235, 234, 233, 232, 231, 228, 227, 226, 225,
|
||||
224, 223, 218, 215, 214, 213, 210, 209, 208, 207,
|
||||
206, 203, 202, 201, 200, 199, 198, 197, 196, 195,
|
||||
194, 193, 192, 189, 183, 182, 181, 180, 179, 178,
|
||||
177, 176, 175, 174, 173, 172, 171, 170, 169, 168,
|
||||
|
||||
115, 89, 84, 69, 64, 410, 7, 410, 410, 410,
|
||||
410, 410, 410, 410, 410, 410, 410, 410, 410, 410,
|
||||
410, 410, 410, 410, 410, 410, 410, 410, 410, 410,
|
||||
410, 410, 410, 410, 410, 410, 410, 410, 410, 410,
|
||||
410, 410, 410, 410, 410, 410, 410, 410, 410, 410,
|
||||
410, 410, 410, 410, 410, 410, 410, 410, 410, 410,
|
||||
410, 410, 410, 410, 410, 410, 410, 410, 410, 410
|
||||
167, 166, 165, 164, 163, 162, 161, 160, 159, 158,
|
||||
149, 146, 131, 127, 122, 115, 89, 84, 69, 64,
|
||||
421, 7, 421, 421, 421, 421, 421, 421, 421, 421,
|
||||
421, 421, 421, 421, 421, 421, 421, 421, 421, 421,
|
||||
421, 421, 421, 421, 421, 421, 421, 421, 421, 421,
|
||||
421, 421, 421, 421, 421, 421, 421, 421, 421, 421,
|
||||
421, 421, 421, 421, 421, 421, 421, 421, 421, 421,
|
||||
421, 421, 421, 421, 421, 421, 421, 421, 421, 421,
|
||||
421, 421, 421, 421, 421, 421, 421
|
||||
} ;
|
||||
|
||||
static yyconst flex_int16_t yy_chk[671] =
|
||||
static yyconst flex_int16_t yy_chk[688] =
|
||||
{ 0,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
|
@ -657,77 +663,79 @@ static yyconst flex_int16_t yy_chk[671] =
|
|||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 3, 4, 12, 12, 28, 28, 3,
|
||||
4, 5, 5, 5, 5, 5, 5, 5, 5, 5,
|
||||
1, 1, 1, 1, 1, 3, 4, 12, 12, 28,
|
||||
28, 3, 4, 5, 5, 5, 5, 5, 5, 5,
|
||||
5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
|
||||
5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
|
||||
|
||||
5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
|
||||
5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
|
||||
5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
|
||||
5, 5, 5, 5, 13, 17, 19, 20, 20, 20,
|
||||
20, 20, 20, 33, 415, 21, 34, 34, 19, 17,
|
||||
21, 35, 13, 35, 33, 44, 408, 35, 51, 44,
|
||||
21, 22, 51, 22, 22, 22, 22, 22, 22, 23,
|
||||
407, 23, 23, 23, 23, 23, 23, 36, 22, 26,
|
||||
22, 38, 55, 38, 397, 37, 23, 36, 22, 37,
|
||||
36, 39, 38, 45, 37, 26, 23, 26, 26, 39,
|
||||
5, 5, 5, 5, 5, 5, 5, 5, 13, 17,
|
||||
19, 20, 20, 20, 20, 20, 20, 33, 47, 21,
|
||||
34, 34, 19, 17, 21, 35, 13, 35, 44, 426,
|
||||
33, 35, 44, 47, 21, 22, 47, 22, 22, 22,
|
||||
22, 22, 22, 23, 36, 23, 23, 23, 23, 23,
|
||||
23, 26, 22, 145, 36, 145, 22, 36, 41, 37,
|
||||
23, 55, 419, 37, 22, 45, 41, 26, 37, 26,
|
||||
|
||||
37, 39, 42, 41, 39, 22, 45, 49, 47, 42,
|
||||
39, 41, 167, 167, 49, 49, 42, 50, 135, 55,
|
||||
50, 52, 41, 47, 49, 52, 47, 49, 50, 145,
|
||||
396, 145, 395, 135, 52, 50, 74, 74, 74, 74,
|
||||
74, 74, 78, 78, 78, 78, 78, 78, 381, 120,
|
||||
393, 74, 120, 120, 122, 141, 120, 78, 120, 381,
|
||||
392, 74, 122, 141, 391, 388, 79, 78, 79, 79,
|
||||
79, 79, 79, 79, 80, 387, 80, 80, 80, 80,
|
||||
80, 80, 385, 79, 155, 155, 155, 155, 155, 155,
|
||||
81, 80, 81, 79, 382, 81, 81, 81, 81, 81,
|
||||
26, 38, 23, 38, 37, 39, 51, 41, 45, 42,
|
||||
51, 22, 38, 39, 49, 39, 42, 50, 39, 122,
|
||||
50, 49, 49, 42, 39, 52, 418, 122, 50, 52,
|
||||
55, 49, 167, 167, 49, 50, 135, 417, 52, 74,
|
||||
74, 74, 74, 74, 74, 78, 78, 78, 78, 78,
|
||||
78, 135, 120, 416, 74, 120, 120, 141, 415, 120,
|
||||
78, 120, 192, 192, 192, 141, 74, 215, 215, 215,
|
||||
414, 79, 78, 79, 79, 79, 79, 79, 79, 80,
|
||||
413, 80, 80, 80, 80, 80, 80, 211, 79, 155,
|
||||
155, 155, 155, 155, 155, 211, 80, 81, 411, 81,
|
||||
|
||||
81, 80, 83, 380, 83, 83, 83, 83, 83, 83,
|
||||
192, 192, 192, 379, 378, 151, 376, 151, 211, 83,
|
||||
151, 151, 151, 151, 151, 151, 211, 375, 374, 83,
|
||||
153, 153, 153, 153, 153, 153, 215, 215, 215, 371,
|
||||
370, 154, 369, 154, 368, 153, 154, 154, 154, 154,
|
||||
154, 154, 226, 226, 226, 153, 156, 156, 156, 156,
|
||||
156, 156, 219, 219, 219, 219, 219, 219, 220, 220,
|
||||
220, 220, 220, 220, 221, 221, 221, 221, 221, 221,
|
||||
222, 222, 222, 222, 222, 222, 234, 234, 234, 241,
|
||||
241, 241, 245, 245, 245, 251, 251, 251, 411, 411,
|
||||
79, 410, 81, 81, 81, 81, 81, 81, 80, 83,
|
||||
381, 83, 83, 83, 83, 83, 83, 226, 226, 226,
|
||||
409, 381, 151, 381, 151, 408, 83, 151, 151, 151,
|
||||
151, 151, 151, 234, 234, 234, 398, 397, 83, 153,
|
||||
153, 153, 153, 153, 153, 241, 241, 241, 396, 395,
|
||||
154, 393, 154, 392, 153, 154, 154, 154, 154, 154,
|
||||
154, 245, 245, 245, 391, 388, 153, 156, 156, 156,
|
||||
156, 156, 156, 219, 219, 219, 219, 219, 219, 220,
|
||||
220, 220, 220, 220, 220, 221, 221, 221, 221, 221,
|
||||
221, 222, 222, 222, 222, 222, 222, 251, 251, 251,
|
||||
|
||||
411, 411, 412, 412, 413, 413, 414, 367, 414, 414,
|
||||
366, 365, 364, 359, 356, 353, 352, 351, 350, 349,
|
||||
347, 345, 344, 343, 342, 340, 339, 337, 335, 334,
|
||||
333, 332, 331, 330, 329, 327, 326, 325, 324, 323,
|
||||
322, 321, 320, 319, 315, 314, 311, 300, 296, 295,
|
||||
294, 293, 286, 285, 284, 279, 278, 277, 276, 275,
|
||||
274, 271, 270, 269, 268, 267, 266, 265, 264, 263,
|
||||
262, 261, 260, 259, 258, 257, 250, 249, 248, 247,
|
||||
246, 244, 240, 239, 238, 237, 233, 232, 231, 230,
|
||||
229, 228, 225, 223, 218, 217, 216, 214, 213, 212,
|
||||
422, 422, 422, 422, 423, 423, 424, 424, 425, 387,
|
||||
425, 425, 385, 382, 380, 379, 378, 376, 375, 374,
|
||||
371, 370, 369, 368, 367, 366, 365, 364, 359, 356,
|
||||
353, 352, 351, 350, 349, 347, 345, 344, 343, 342,
|
||||
340, 339, 337, 335, 334, 333, 332, 331, 330, 329,
|
||||
327, 326, 325, 324, 323, 322, 321, 320, 319, 315,
|
||||
314, 311, 300, 296, 295, 294, 293, 286, 285, 284,
|
||||
279, 278, 277, 276, 275, 274, 271, 270, 269, 268,
|
||||
267, 266, 265, 264, 263, 262, 261, 260, 259, 258,
|
||||
257, 250, 249, 248, 247, 246, 244, 240, 239, 238,
|
||||
|
||||
210, 209, 208, 207, 206, 205, 204, 203, 202, 201,
|
||||
200, 199, 198, 197, 196, 195, 194, 193, 191, 190,
|
||||
189, 188, 187, 186, 185, 184, 183, 182, 181, 180,
|
||||
179, 177, 176, 175, 174, 173, 172, 171, 170, 169,
|
||||
168, 166, 165, 164, 163, 162, 161, 146, 144, 143,
|
||||
142, 140, 139, 138, 137, 136, 134, 133, 132, 131,
|
||||
130, 129, 128, 127, 126, 125, 124, 123, 121, 118,
|
||||
117, 116, 115, 114, 113, 112, 111, 110, 109, 108,
|
||||
107, 106, 105, 104, 103, 102, 101, 100, 99, 98,
|
||||
97, 96, 95, 91, 87, 60, 53, 48, 46, 43,
|
||||
237, 233, 232, 231, 230, 229, 228, 225, 223, 218,
|
||||
217, 216, 214, 213, 212, 210, 209, 208, 207, 206,
|
||||
205, 204, 203, 202, 201, 200, 199, 198, 197, 196,
|
||||
195, 194, 193, 191, 190, 189, 188, 187, 186, 185,
|
||||
184, 183, 182, 181, 180, 179, 177, 176, 175, 174,
|
||||
173, 172, 171, 170, 169, 168, 166, 165, 164, 163,
|
||||
162, 161, 146, 144, 143, 142, 140, 139, 138, 137,
|
||||
136, 134, 133, 132, 131, 130, 129, 128, 127, 126,
|
||||
125, 124, 123, 121, 118, 117, 116, 115, 114, 113,
|
||||
112, 111, 110, 109, 108, 107, 106, 105, 104, 103,
|
||||
|
||||
40, 27, 24, 16, 11, 7, 410, 410, 410, 410,
|
||||
410, 410, 410, 410, 410, 410, 410, 410, 410, 410,
|
||||
410, 410, 410, 410, 410, 410, 410, 410, 410, 410,
|
||||
410, 410, 410, 410, 410, 410, 410, 410, 410, 410,
|
||||
410, 410, 410, 410, 410, 410, 410, 410, 410, 410,
|
||||
410, 410, 410, 410, 410, 410, 410, 410, 410, 410,
|
||||
410, 410, 410, 410, 410, 410, 410, 410, 410, 410
|
||||
102, 101, 100, 99, 98, 97, 96, 95, 91, 87,
|
||||
60, 53, 48, 46, 43, 40, 27, 24, 16, 11,
|
||||
7, 421, 421, 421, 421, 421, 421, 421, 421, 421,
|
||||
421, 421, 421, 421, 421, 421, 421, 421, 421, 421,
|
||||
421, 421, 421, 421, 421, 421, 421, 421, 421, 421,
|
||||
421, 421, 421, 421, 421, 421, 421, 421, 421, 421,
|
||||
421, 421, 421, 421, 421, 421, 421, 421, 421, 421,
|
||||
421, 421, 421, 421, 421, 421, 421, 421, 421, 421,
|
||||
421, 421, 421, 421, 421, 421, 421
|
||||
} ;
|
||||
|
||||
/* Table of booleans, true if rule could match eol. */
|
||||
static yyconst flex_int32_t yy_rule_can_match_eol[146] =
|
||||
static yyconst flex_int32_t yy_rule_can_match_eol[147] =
|
||||
{ 0,
|
||||
0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
|
@ -736,7 +744,7 @@ static yyconst flex_int32_t yy_rule_can_match_eol[146] =
|
|||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 1, 0, 0, };
|
||||
0, 0, 0, 0, 1, 0, 0, };
|
||||
|
||||
/* The intent behind this definition is that it'll catch
|
||||
* any uses of REJECT which flex missed.
|
||||
|
@ -756,7 +764,7 @@ This file contains the Lex specification for GLSL ES.
|
|||
Based on ANSI C grammar, Lex specification:
|
||||
http://www.lysator.liu.se/c/ANSI-C-grammar-l.html
|
||||
|
||||
IF YOU MODIFY THIS FILE YOU ALSO NEED TO RUN generate_glslang_lexer.sh,
|
||||
IF YOU MODIFY THIS FILE YOU ALSO NEED TO RUN generate_parser.sh,
|
||||
WHICH GENERATES THE GLSL ES LEXER (glslang_lex.cpp).
|
||||
*/
|
||||
|
||||
|
@ -1062,13 +1070,13 @@ yy_match:
|
|||
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
|
||||
{
|
||||
yy_current_state = (int) yy_def[yy_current_state];
|
||||
if ( yy_current_state >= 411 )
|
||||
if ( yy_current_state >= 422 )
|
||||
yy_c = yy_meta[(unsigned int) yy_c];
|
||||
}
|
||||
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
|
||||
++yy_cp;
|
||||
}
|
||||
while ( yy_current_state != 410 );
|
||||
while ( yy_current_state != 421 );
|
||||
yy_cp = yyg->yy_last_accepting_cpos;
|
||||
yy_current_state = yyg->yy_last_accepting_state;
|
||||
|
||||
|
@ -1285,11 +1293,11 @@ YY_RULE_SETUP
|
|||
YY_BREAK
|
||||
case 47:
|
||||
YY_RULE_SETUP
|
||||
{ context->lexAfterType = true; return(STRUCT); }
|
||||
{ context->lexAfterType = true; return SAMPLER_EXTERNAL_OES; }
|
||||
YY_BREAK
|
||||
case 48:
|
||||
YY_RULE_SETUP
|
||||
{ return reserved_word(yyscanner); }
|
||||
{ context->lexAfterType = true; return(STRUCT); }
|
||||
YY_BREAK
|
||||
case 49:
|
||||
YY_RULE_SETUP
|
||||
|
@ -1449,30 +1457,30 @@ YY_RULE_SETUP
|
|||
YY_BREAK
|
||||
case 88:
|
||||
YY_RULE_SETUP
|
||||
{ return reserved_word(yyscanner); }
|
||||
YY_BREAK
|
||||
case 89:
|
||||
YY_RULE_SETUP
|
||||
{
|
||||
yylval->lex.string = NewPoolTString(yytext);
|
||||
return check_type(yyscanner);
|
||||
}
|
||||
YY_BREAK
|
||||
case 89:
|
||||
YY_RULE_SETUP
|
||||
{ yylval->lex.i = strtol(yytext, 0, 0); return(INTCONSTANT); }
|
||||
YY_BREAK
|
||||
case 90:
|
||||
YY_RULE_SETUP
|
||||
{ yylval->lex.i = strtol(yytext, 0, 0); return(INTCONSTANT); }
|
||||
YY_BREAK
|
||||
case 91:
|
||||
YY_RULE_SETUP
|
||||
{ context->error(yylineno, "Invalid Octal number.", yytext, "", ""); context->recover(); return 0;}
|
||||
{ yylval->lex.i = strtol(yytext, 0, 0); return(INTCONSTANT); }
|
||||
YY_BREAK
|
||||
case 92:
|
||||
YY_RULE_SETUP
|
||||
{ yylval->lex.i = strtol(yytext, 0, 0); return(INTCONSTANT); }
|
||||
{ context->error(yylineno, "Invalid Octal number.", yytext, "", ""); context->recover(); return 0;}
|
||||
YY_BREAK
|
||||
case 93:
|
||||
YY_RULE_SETUP
|
||||
{ yylval->lex.f = static_cast<float>(atof_dot(yytext)); return(FLOATCONSTANT); }
|
||||
{ yylval->lex.i = strtol(yytext, 0, 0); return(INTCONSTANT); }
|
||||
YY_BREAK
|
||||
case 94:
|
||||
YY_RULE_SETUP
|
||||
|
@ -1484,198 +1492,202 @@ YY_RULE_SETUP
|
|||
YY_BREAK
|
||||
case 96:
|
||||
YY_RULE_SETUP
|
||||
{ return(ADD_ASSIGN); }
|
||||
{ yylval->lex.f = static_cast<float>(atof_dot(yytext)); return(FLOATCONSTANT); }
|
||||
YY_BREAK
|
||||
case 97:
|
||||
YY_RULE_SETUP
|
||||
{ return(SUB_ASSIGN); }
|
||||
{ return(ADD_ASSIGN); }
|
||||
YY_BREAK
|
||||
case 98:
|
||||
YY_RULE_SETUP
|
||||
{ return(MUL_ASSIGN); }
|
||||
{ return(SUB_ASSIGN); }
|
||||
YY_BREAK
|
||||
case 99:
|
||||
YY_RULE_SETUP
|
||||
{ return(DIV_ASSIGN); }
|
||||
{ return(MUL_ASSIGN); }
|
||||
YY_BREAK
|
||||
case 100:
|
||||
YY_RULE_SETUP
|
||||
{ return(MOD_ASSIGN); }
|
||||
{ return(DIV_ASSIGN); }
|
||||
YY_BREAK
|
||||
case 101:
|
||||
YY_RULE_SETUP
|
||||
{ return(LEFT_ASSIGN); }
|
||||
{ return(MOD_ASSIGN); }
|
||||
YY_BREAK
|
||||
case 102:
|
||||
YY_RULE_SETUP
|
||||
{ return(RIGHT_ASSIGN); }
|
||||
{ return(LEFT_ASSIGN); }
|
||||
YY_BREAK
|
||||
case 103:
|
||||
YY_RULE_SETUP
|
||||
{ return(AND_ASSIGN); }
|
||||
{ return(RIGHT_ASSIGN); }
|
||||
YY_BREAK
|
||||
case 104:
|
||||
YY_RULE_SETUP
|
||||
{ return(XOR_ASSIGN); }
|
||||
{ return(AND_ASSIGN); }
|
||||
YY_BREAK
|
||||
case 105:
|
||||
YY_RULE_SETUP
|
||||
{ return(OR_ASSIGN); }
|
||||
{ return(XOR_ASSIGN); }
|
||||
YY_BREAK
|
||||
case 106:
|
||||
YY_RULE_SETUP
|
||||
{ return(INC_OP); }
|
||||
{ return(OR_ASSIGN); }
|
||||
YY_BREAK
|
||||
case 107:
|
||||
YY_RULE_SETUP
|
||||
{ return(DEC_OP); }
|
||||
{ return(INC_OP); }
|
||||
YY_BREAK
|
||||
case 108:
|
||||
YY_RULE_SETUP
|
||||
{ return(AND_OP); }
|
||||
{ return(DEC_OP); }
|
||||
YY_BREAK
|
||||
case 109:
|
||||
YY_RULE_SETUP
|
||||
{ return(OR_OP); }
|
||||
{ return(AND_OP); }
|
||||
YY_BREAK
|
||||
case 110:
|
||||
YY_RULE_SETUP
|
||||
{ return(XOR_OP); }
|
||||
{ return(OR_OP); }
|
||||
YY_BREAK
|
||||
case 111:
|
||||
YY_RULE_SETUP
|
||||
{ return(LE_OP); }
|
||||
{ return(XOR_OP); }
|
||||
YY_BREAK
|
||||
case 112:
|
||||
YY_RULE_SETUP
|
||||
{ return(GE_OP); }
|
||||
{ return(LE_OP); }
|
||||
YY_BREAK
|
||||
case 113:
|
||||
YY_RULE_SETUP
|
||||
{ return(EQ_OP); }
|
||||
{ return(GE_OP); }
|
||||
YY_BREAK
|
||||
case 114:
|
||||
YY_RULE_SETUP
|
||||
{ return(NE_OP); }
|
||||
{ return(EQ_OP); }
|
||||
YY_BREAK
|
||||
case 115:
|
||||
YY_RULE_SETUP
|
||||
{ return(LEFT_OP); }
|
||||
{ return(NE_OP); }
|
||||
YY_BREAK
|
||||
case 116:
|
||||
YY_RULE_SETUP
|
||||
{ return(RIGHT_OP); }
|
||||
{ return(LEFT_OP); }
|
||||
YY_BREAK
|
||||
case 117:
|
||||
YY_RULE_SETUP
|
||||
{ context->lexAfterType = false; return(SEMICOLON); }
|
||||
{ return(RIGHT_OP); }
|
||||
YY_BREAK
|
||||
case 118:
|
||||
YY_RULE_SETUP
|
||||
{ context->lexAfterType = false; return(LEFT_BRACE); }
|
||||
{ context->lexAfterType = false; return(SEMICOLON); }
|
||||
YY_BREAK
|
||||
case 119:
|
||||
YY_RULE_SETUP
|
||||
{ return(RIGHT_BRACE); }
|
||||
{ context->lexAfterType = false; return(LEFT_BRACE); }
|
||||
YY_BREAK
|
||||
case 120:
|
||||
YY_RULE_SETUP
|
||||
{ if (context->inTypeParen) context->lexAfterType = false; return(COMMA); }
|
||||
{ return(RIGHT_BRACE); }
|
||||
YY_BREAK
|
||||
case 121:
|
||||
YY_RULE_SETUP
|
||||
{ return(COLON); }
|
||||
{ if (context->inTypeParen) context->lexAfterType = false; return(COMMA); }
|
||||
YY_BREAK
|
||||
case 122:
|
||||
YY_RULE_SETUP
|
||||
{ context->lexAfterType = false; return(EQUAL); }
|
||||
{ return(COLON); }
|
||||
YY_BREAK
|
||||
case 123:
|
||||
YY_RULE_SETUP
|
||||
{ context->lexAfterType = false; context->inTypeParen = true; return(LEFT_PAREN); }
|
||||
{ context->lexAfterType = false; return(EQUAL); }
|
||||
YY_BREAK
|
||||
case 124:
|
||||
YY_RULE_SETUP
|
||||
{ context->inTypeParen = false; return(RIGHT_PAREN); }
|
||||
{ context->lexAfterType = false; context->inTypeParen = true; return(LEFT_PAREN); }
|
||||
YY_BREAK
|
||||
case 125:
|
||||
YY_RULE_SETUP
|
||||
{ return(LEFT_BRACKET); }
|
||||
{ context->inTypeParen = false; return(RIGHT_PAREN); }
|
||||
YY_BREAK
|
||||
case 126:
|
||||
YY_RULE_SETUP
|
||||
{ return(RIGHT_BRACKET); }
|
||||
{ return(LEFT_BRACKET); }
|
||||
YY_BREAK
|
||||
case 127:
|
||||
YY_RULE_SETUP
|
||||
{ BEGIN(FIELDS); return(DOT); }
|
||||
{ return(RIGHT_BRACKET); }
|
||||
YY_BREAK
|
||||
case 128:
|
||||
YY_RULE_SETUP
|
||||
{ return(BANG); }
|
||||
{ BEGIN(FIELDS); return(DOT); }
|
||||
YY_BREAK
|
||||
case 129:
|
||||
YY_RULE_SETUP
|
||||
{ return(DASH); }
|
||||
{ return(BANG); }
|
||||
YY_BREAK
|
||||
case 130:
|
||||
YY_RULE_SETUP
|
||||
{ return(TILDE); }
|
||||
{ return(DASH); }
|
||||
YY_BREAK
|
||||
case 131:
|
||||
YY_RULE_SETUP
|
||||
{ return(PLUS); }
|
||||
{ return(TILDE); }
|
||||
YY_BREAK
|
||||
case 132:
|
||||
YY_RULE_SETUP
|
||||
{ return(STAR); }
|
||||
{ return(PLUS); }
|
||||
YY_BREAK
|
||||
case 133:
|
||||
YY_RULE_SETUP
|
||||
{ return(SLASH); }
|
||||
{ return(STAR); }
|
||||
YY_BREAK
|
||||
case 134:
|
||||
YY_RULE_SETUP
|
||||
{ return(PERCENT); }
|
||||
{ return(SLASH); }
|
||||
YY_BREAK
|
||||
case 135:
|
||||
YY_RULE_SETUP
|
||||
{ return(LEFT_ANGLE); }
|
||||
{ return(PERCENT); }
|
||||
YY_BREAK
|
||||
case 136:
|
||||
YY_RULE_SETUP
|
||||
{ return(RIGHT_ANGLE); }
|
||||
{ return(LEFT_ANGLE); }
|
||||
YY_BREAK
|
||||
case 137:
|
||||
YY_RULE_SETUP
|
||||
{ return(VERTICAL_BAR); }
|
||||
{ return(RIGHT_ANGLE); }
|
||||
YY_BREAK
|
||||
case 138:
|
||||
YY_RULE_SETUP
|
||||
{ return(CARET); }
|
||||
{ return(VERTICAL_BAR); }
|
||||
YY_BREAK
|
||||
case 139:
|
||||
YY_RULE_SETUP
|
||||
{ return(AMPERSAND); }
|
||||
{ return(CARET); }
|
||||
YY_BREAK
|
||||
case 140:
|
||||
YY_RULE_SETUP
|
||||
{ return(QUESTION); }
|
||||
{ return(AMPERSAND); }
|
||||
YY_BREAK
|
||||
case 141:
|
||||
YY_RULE_SETUP
|
||||
{ return(QUESTION); }
|
||||
YY_BREAK
|
||||
case 142:
|
||||
YY_RULE_SETUP
|
||||
{
|
||||
BEGIN(INITIAL);
|
||||
yylval->lex.string = NewPoolTString(yytext);
|
||||
return FIELD_SELECTION;
|
||||
}
|
||||
YY_BREAK
|
||||
case 142:
|
||||
case 143:
|
||||
YY_RULE_SETUP
|
||||
{}
|
||||
YY_BREAK
|
||||
case 143:
|
||||
/* rule 143 can match eol */
|
||||
case 144:
|
||||
/* rule 144 can match eol */
|
||||
YY_RULE_SETUP
|
||||
{ }
|
||||
YY_BREAK
|
||||
|
@ -1684,11 +1696,11 @@ case YY_STATE_EOF(COMMENT):
|
|||
case YY_STATE_EOF(FIELDS):
|
||||
{ context->AfterEOF = true; yyterminate(); }
|
||||
YY_BREAK
|
||||
case 144:
|
||||
case 145:
|
||||
YY_RULE_SETUP
|
||||
{ context->warning(yylineno, "Unknown char", yytext, ""); return 0; }
|
||||
YY_BREAK
|
||||
case 145:
|
||||
case 146:
|
||||
YY_RULE_SETUP
|
||||
ECHO;
|
||||
YY_BREAK
|
||||
|
@ -1984,7 +1996,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
|
|||
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
|
||||
{
|
||||
yy_current_state = (int) yy_def[yy_current_state];
|
||||
if ( yy_current_state >= 411 )
|
||||
if ( yy_current_state >= 422 )
|
||||
yy_c = yy_meta[(unsigned int) yy_c];
|
||||
}
|
||||
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
|
||||
|
@ -2013,11 +2025,11 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
|
|||
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
|
||||
{
|
||||
yy_current_state = (int) yy_def[yy_current_state];
|
||||
if ( yy_current_state >= 411 )
|
||||
if ( yy_current_state >= 422 )
|
||||
yy_c = yy_meta[(unsigned int) yy_c];
|
||||
}
|
||||
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
|
||||
yy_is_jam = (yy_current_state == 410);
|
||||
yy_is_jam = (yy_current_state == 421);
|
||||
|
||||
return yy_is_jam ? 0 : yy_current_state;
|
||||
}
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -79,57 +79,58 @@
|
|||
WHILE = 295,
|
||||
SAMPLER2D = 296,
|
||||
SAMPLERCUBE = 297,
|
||||
IDENTIFIER = 298,
|
||||
TYPE_NAME = 299,
|
||||
FLOATCONSTANT = 300,
|
||||
INTCONSTANT = 301,
|
||||
BOOLCONSTANT = 302,
|
||||
FIELD_SELECTION = 303,
|
||||
LEFT_OP = 304,
|
||||
RIGHT_OP = 305,
|
||||
INC_OP = 306,
|
||||
DEC_OP = 307,
|
||||
LE_OP = 308,
|
||||
GE_OP = 309,
|
||||
EQ_OP = 310,
|
||||
NE_OP = 311,
|
||||
AND_OP = 312,
|
||||
OR_OP = 313,
|
||||
XOR_OP = 314,
|
||||
MUL_ASSIGN = 315,
|
||||
DIV_ASSIGN = 316,
|
||||
ADD_ASSIGN = 317,
|
||||
MOD_ASSIGN = 318,
|
||||
LEFT_ASSIGN = 319,
|
||||
RIGHT_ASSIGN = 320,
|
||||
AND_ASSIGN = 321,
|
||||
XOR_ASSIGN = 322,
|
||||
OR_ASSIGN = 323,
|
||||
SUB_ASSIGN = 324,
|
||||
LEFT_PAREN = 325,
|
||||
RIGHT_PAREN = 326,
|
||||
LEFT_BRACKET = 327,
|
||||
RIGHT_BRACKET = 328,
|
||||
LEFT_BRACE = 329,
|
||||
RIGHT_BRACE = 330,
|
||||
DOT = 331,
|
||||
COMMA = 332,
|
||||
COLON = 333,
|
||||
EQUAL = 334,
|
||||
SEMICOLON = 335,
|
||||
BANG = 336,
|
||||
DASH = 337,
|
||||
TILDE = 338,
|
||||
PLUS = 339,
|
||||
STAR = 340,
|
||||
SLASH = 341,
|
||||
PERCENT = 342,
|
||||
LEFT_ANGLE = 343,
|
||||
RIGHT_ANGLE = 344,
|
||||
VERTICAL_BAR = 345,
|
||||
CARET = 346,
|
||||
AMPERSAND = 347,
|
||||
QUESTION = 348
|
||||
SAMPLER_EXTERNAL_OES = 298,
|
||||
IDENTIFIER = 299,
|
||||
TYPE_NAME = 300,
|
||||
FLOATCONSTANT = 301,
|
||||
INTCONSTANT = 302,
|
||||
BOOLCONSTANT = 303,
|
||||
FIELD_SELECTION = 304,
|
||||
LEFT_OP = 305,
|
||||
RIGHT_OP = 306,
|
||||
INC_OP = 307,
|
||||
DEC_OP = 308,
|
||||
LE_OP = 309,
|
||||
GE_OP = 310,
|
||||
EQ_OP = 311,
|
||||
NE_OP = 312,
|
||||
AND_OP = 313,
|
||||
OR_OP = 314,
|
||||
XOR_OP = 315,
|
||||
MUL_ASSIGN = 316,
|
||||
DIV_ASSIGN = 317,
|
||||
ADD_ASSIGN = 318,
|
||||
MOD_ASSIGN = 319,
|
||||
LEFT_ASSIGN = 320,
|
||||
RIGHT_ASSIGN = 321,
|
||||
AND_ASSIGN = 322,
|
||||
XOR_ASSIGN = 323,
|
||||
OR_ASSIGN = 324,
|
||||
SUB_ASSIGN = 325,
|
||||
LEFT_PAREN = 326,
|
||||
RIGHT_PAREN = 327,
|
||||
LEFT_BRACKET = 328,
|
||||
RIGHT_BRACKET = 329,
|
||||
LEFT_BRACE = 330,
|
||||
RIGHT_BRACE = 331,
|
||||
DOT = 332,
|
||||
COMMA = 333,
|
||||
COLON = 334,
|
||||
EQUAL = 335,
|
||||
SEMICOLON = 336,
|
||||
BANG = 337,
|
||||
DASH = 338,
|
||||
TILDE = 339,
|
||||
PLUS = 340,
|
||||
STAR = 341,
|
||||
SLASH = 342,
|
||||
PERCENT = 343,
|
||||
LEFT_ANGLE = 344,
|
||||
RIGHT_ANGLE = 345,
|
||||
VERTICAL_BAR = 346,
|
||||
CARET = 347,
|
||||
AMPERSAND = 348,
|
||||
QUESTION = 349
|
||||
};
|
||||
#endif
|
||||
/* Tokens. */
|
||||
|
@ -173,57 +174,58 @@
|
|||
#define WHILE 295
|
||||
#define SAMPLER2D 296
|
||||
#define SAMPLERCUBE 297
|
||||
#define IDENTIFIER 298
|
||||
#define TYPE_NAME 299
|
||||
#define FLOATCONSTANT 300
|
||||
#define INTCONSTANT 301
|
||||
#define BOOLCONSTANT 302
|
||||
#define FIELD_SELECTION 303
|
||||
#define LEFT_OP 304
|
||||
#define RIGHT_OP 305
|
||||
#define INC_OP 306
|
||||
#define DEC_OP 307
|
||||
#define LE_OP 308
|
||||
#define GE_OP 309
|
||||
#define EQ_OP 310
|
||||
#define NE_OP 311
|
||||
#define AND_OP 312
|
||||
#define OR_OP 313
|
||||
#define XOR_OP 314
|
||||
#define MUL_ASSIGN 315
|
||||
#define DIV_ASSIGN 316
|
||||
#define ADD_ASSIGN 317
|
||||
#define MOD_ASSIGN 318
|
||||
#define LEFT_ASSIGN 319
|
||||
#define RIGHT_ASSIGN 320
|
||||
#define AND_ASSIGN 321
|
||||
#define XOR_ASSIGN 322
|
||||
#define OR_ASSIGN 323
|
||||
#define SUB_ASSIGN 324
|
||||
#define LEFT_PAREN 325
|
||||
#define RIGHT_PAREN 326
|
||||
#define LEFT_BRACKET 327
|
||||
#define RIGHT_BRACKET 328
|
||||
#define LEFT_BRACE 329
|
||||
#define RIGHT_BRACE 330
|
||||
#define DOT 331
|
||||
#define COMMA 332
|
||||
#define COLON 333
|
||||
#define EQUAL 334
|
||||
#define SEMICOLON 335
|
||||
#define BANG 336
|
||||
#define DASH 337
|
||||
#define TILDE 338
|
||||
#define PLUS 339
|
||||
#define STAR 340
|
||||
#define SLASH 341
|
||||
#define PERCENT 342
|
||||
#define LEFT_ANGLE 343
|
||||
#define RIGHT_ANGLE 344
|
||||
#define VERTICAL_BAR 345
|
||||
#define CARET 346
|
||||
#define AMPERSAND 347
|
||||
#define QUESTION 348
|
||||
#define SAMPLER_EXTERNAL_OES 298
|
||||
#define IDENTIFIER 299
|
||||
#define TYPE_NAME 300
|
||||
#define FLOATCONSTANT 301
|
||||
#define INTCONSTANT 302
|
||||
#define BOOLCONSTANT 303
|
||||
#define FIELD_SELECTION 304
|
||||
#define LEFT_OP 305
|
||||
#define RIGHT_OP 306
|
||||
#define INC_OP 307
|
||||
#define DEC_OP 308
|
||||
#define LE_OP 309
|
||||
#define GE_OP 310
|
||||
#define EQ_OP 311
|
||||
#define NE_OP 312
|
||||
#define AND_OP 313
|
||||
#define OR_OP 314
|
||||
#define XOR_OP 315
|
||||
#define MUL_ASSIGN 316
|
||||
#define DIV_ASSIGN 317
|
||||
#define ADD_ASSIGN 318
|
||||
#define MOD_ASSIGN 319
|
||||
#define LEFT_ASSIGN 320
|
||||
#define RIGHT_ASSIGN 321
|
||||
#define AND_ASSIGN 322
|
||||
#define XOR_ASSIGN 323
|
||||
#define OR_ASSIGN 324
|
||||
#define SUB_ASSIGN 325
|
||||
#define LEFT_PAREN 326
|
||||
#define RIGHT_PAREN 327
|
||||
#define LEFT_BRACKET 328
|
||||
#define RIGHT_BRACKET 329
|
||||
#define LEFT_BRACE 330
|
||||
#define RIGHT_BRACE 331
|
||||
#define DOT 332
|
||||
#define COMMA 333
|
||||
#define COLON 334
|
||||
#define EQUAL 335
|
||||
#define SEMICOLON 336
|
||||
#define BANG 337
|
||||
#define DASH 338
|
||||
#define TILDE 339
|
||||
#define PLUS 340
|
||||
#define STAR 341
|
||||
#define SLASH 342
|
||||
#define PERCENT 343
|
||||
#define LEFT_ANGLE 344
|
||||
#define RIGHT_ANGLE 345
|
||||
#define VERTICAL_BAR 346
|
||||
#define CARET 347
|
||||
#define AMPERSAND 348
|
||||
#define QUESTION 349
|
||||
|
||||
|
||||
|
||||
|
@ -262,7 +264,7 @@ typedef union YYSTYPE
|
|||
};
|
||||
} interm;
|
||||
}
|
||||
/* Line 1529 of yacc.c. */
|
||||
/* Line 1489 of yacc.c. */
|
||||
|
||||
YYSTYPE;
|
||||
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
||||
|
|
|
@ -410,8 +410,8 @@ protected:
|
|||
//
|
||||
class TIntermUnary : public TIntermOperator {
|
||||
public:
|
||||
TIntermUnary(TOperator o, TType& t) : TIntermOperator(o, t), operand(0) {}
|
||||
TIntermUnary(TOperator o) : TIntermOperator(o), operand(0) {}
|
||||
TIntermUnary(TOperator o, TType& t) : TIntermOperator(o, t), operand(0), useEmulatedFunction(false) {}
|
||||
TIntermUnary(TOperator o) : TIntermOperator(o), operand(0), useEmulatedFunction(false) {}
|
||||
|
||||
virtual void traverse(TIntermTraverser*);
|
||||
virtual TIntermUnary* getAsUnaryNode() { return this; }
|
||||
|
@ -420,8 +420,12 @@ public:
|
|||
TIntermTyped* getOperand() { return operand; }
|
||||
bool promote(TInfoSink&);
|
||||
|
||||
void setUseEmulatedFunction() { useEmulatedFunction = true; }
|
||||
bool getUseEmulatedFunction() { return useEmulatedFunction; }
|
||||
|
||||
protected:
|
||||
TIntermTyped* operand;
|
||||
bool useEmulatedFunction; // if set to true, replace the function call by an emulated one.
|
||||
};
|
||||
|
||||
typedef TVector<TIntermNode*> TIntermSequence;
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
//
|
||||
// Copyright (c) 2011 The ANGLE Project Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
//
|
||||
|
||||
#include "Context.h"
|
||||
|
||||
namespace pp
|
||||
{
|
||||
|
||||
Context::Context(int count, const char* const string[], const int length[],
|
||||
TokenVector* output)
|
||||
: input(count, string, length),
|
||||
output(output),
|
||||
lexer(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
} // namespace pp
|
||||
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче