mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
merge mozilla-inbound to mozilla-central a=merge
This commit is contained in:
commit
c03f3ce652
@ -1324,21 +1324,14 @@ Accessible::Value(nsString& aValue)
|
||||
if (mRoleMapEntry->Is(nsGkAtoms::combobox)) {
|
||||
Accessible* option = CurrentItem();
|
||||
if (!option) {
|
||||
Accessible* listbox = nullptr;
|
||||
ARIAOwnsIterator iter(this);
|
||||
while ((listbox = iter.Next()) && !listbox->IsListControl());
|
||||
|
||||
if (!listbox) {
|
||||
uint32_t childCount = ChildCount();
|
||||
for (uint32_t idx = 0; idx < childCount; idx++) {
|
||||
Accessible* child = mChildren.ElementAt(idx);
|
||||
if (child->IsListControl())
|
||||
listbox = child;
|
||||
uint32_t childCount = ChildCount();
|
||||
for (uint32_t idx = 0; idx < childCount; idx++) {
|
||||
Accessible* child = mChildren.ElementAt(idx);
|
||||
if (child->IsListControl()) {
|
||||
option = child->GetSelectedItem(0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (listbox)
|
||||
option = listbox->GetSelectedItem(0);
|
||||
}
|
||||
|
||||
if (option)
|
||||
|
1
aclocal.m4
vendored
1
aclocal.m4
vendored
@ -34,6 +34,7 @@ builtin(include, build/autoconf/clang-plugin.m4)dnl
|
||||
builtin(include, build/autoconf/alloc.m4)dnl
|
||||
builtin(include, build/autoconf/ios.m4)dnl
|
||||
builtin(include, build/autoconf/jemalloc.m4)dnl
|
||||
builtin(include, build/autoconf/rust.m4)dnl
|
||||
|
||||
MOZ_PROG_CHECKMSYS()
|
||||
|
||||
|
@ -8,6 +8,8 @@ Components.utils.import("resource://gre/modules/InlineSpellChecker.jsm");
|
||||
Components.utils.import("resource://gre/modules/LoginManagerContextMenu.jsm");
|
||||
Components.utils.import("resource://gre/modules/BrowserUtils.jsm");
|
||||
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "CustomizableUI",
|
||||
"resource:///modules/CustomizableUI.jsm");
|
||||
@ -42,6 +44,28 @@ nsContextMenu.prototype = {
|
||||
else {
|
||||
this.hasPageMenu = PageMenuParent.buildAndAddToPopup(this.target, aXulMenu);
|
||||
}
|
||||
|
||||
let subject = {
|
||||
menu: aXulMenu,
|
||||
tab: gBrowser ? gBrowser.getTabForBrowser(this.browser) : undefined,
|
||||
isContentSelected: this.isContentSelected,
|
||||
inFrame: this.inFrame,
|
||||
isTextSelected: this.isTextSelected,
|
||||
onTextInput: this.onTextInput,
|
||||
onLink: this.onLink,
|
||||
onImage: this.onImage,
|
||||
onVideo: this.onVideo,
|
||||
onAudio: this.onAudio,
|
||||
onCanvas: this.onCanvas,
|
||||
onEditableArea: this.onEditableArea,
|
||||
srcUrl: this.mediaURL,
|
||||
frameUrl: gContextMenuContentData ? gContextMenuContentData.docLocation : undefined,
|
||||
pageUrl: this.browser ? this.browser.currentURI.spec : undefined,
|
||||
linkUrl: this.linkURL,
|
||||
selectionText: this.isTextSelected ? this.selectionInfo.text : undefined,
|
||||
};
|
||||
subject.wrappedJSObject = subject;
|
||||
Services.obs.notifyObservers(subject, "on-build-contextmenu", null);
|
||||
}
|
||||
|
||||
this.isFrameImage = document.getElementById("isFrameImage");
|
||||
|
@ -1,8 +1,413 @@
|
||||
Cu.import("resource://gre/modules/ExtensionUtils.jsm");
|
||||
Cu.import("resource://gre/modules/MatchPattern.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
||||
let {
|
||||
EventManager,
|
||||
contextMenuItems,
|
||||
runSafe
|
||||
} = ExtensionUtils;
|
||||
|
||||
|
||||
// Map[Extension -> Map[ID -> MenuItem]]
|
||||
// Note: we want to enumerate all the menu items so
|
||||
// this cannot be a weak map.
|
||||
let contextMenuMap = new Map();
|
||||
|
||||
// Not really used yet, will be used for event pages.
|
||||
let onClickedCallbacksMap = new WeakMap();
|
||||
|
||||
// If id is not specified for an item we use an integer.
|
||||
let nextID = 0;
|
||||
|
||||
function contextMenuObserver(subject, topic, data) {
|
||||
subject = subject.wrappedJSObject;
|
||||
menuBuilder.build(subject);
|
||||
}
|
||||
|
||||
// When a new contextMenu is opened, this function is called and
|
||||
// we populate the |xulMenu| with all the items from extensions
|
||||
// to be displayed. We always clear all the items again when
|
||||
// popuphidden fires. Since most of the info we need is already
|
||||
// calculated in nsContextMenu.jsm we simple reuse its flags here.
|
||||
// For remote processes there is a gContextMenuContentData where all
|
||||
// the important info is stored from the child process. We get
|
||||
// this data in |contentData|.
|
||||
let menuBuilder = {
|
||||
build: function(contextData) {
|
||||
// TODO: icons should be set for items
|
||||
let xulMenu = contextData.menu;
|
||||
xulMenu.addEventListener("popuphidden", this);
|
||||
let doc = xulMenu.ownerDocument;
|
||||
for (let [ext, menuItemMap] of contextMenuMap) {
|
||||
let parentMap = new Map();
|
||||
let topLevelItems = new Set();
|
||||
for (let [id, item] of menuItemMap) {
|
||||
dump(id + " : " + item + "\n");
|
||||
if (item.enabledForContext(contextData)) {
|
||||
let element;
|
||||
if (item.isMenu) {
|
||||
element = doc.createElement("menu");
|
||||
// Menu elements need to have a menupopup child for
|
||||
// its menu items.
|
||||
let menupopup = doc.createElement("menupopup");
|
||||
element.appendChild(menupopup);
|
||||
// Storing the menupopup in a map, so we can find it for its
|
||||
// menu item children later.
|
||||
parentMap.set(id, menupopup);
|
||||
} else {
|
||||
element =
|
||||
(item.type == "separator") ? doc.createElement("menuseparator")
|
||||
: doc.createElement("menuitem");
|
||||
}
|
||||
|
||||
// FIXME: handle %s in the title
|
||||
element.setAttribute("label", item.title);
|
||||
|
||||
if (!item.enabled) {
|
||||
element.setAttribute("disabled", true);
|
||||
}
|
||||
|
||||
let parentId = item.parentId;
|
||||
if (parentId && parentMap.has(parentId)) {
|
||||
// If parentId is set we have to look up its parent
|
||||
// and appened to its menupopup.
|
||||
let parentElement = parentMap.get(parentId);
|
||||
parentElement.appendChild(element);
|
||||
} else {
|
||||
topLevelItems.add(element);
|
||||
}
|
||||
|
||||
if (item.onclick) {
|
||||
function clickHandlerForItem(item) {
|
||||
return event => {
|
||||
let clickData = item.getClickData(contextData, event);
|
||||
runSafe(item.extContext, item.onclick, clickData);
|
||||
}
|
||||
}
|
||||
element.addEventListener("command", clickHandlerForItem(item));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (topLevelItems.size > 1) {
|
||||
// If more than one top level items are visible, callopse them.
|
||||
let top = doc.createElement("menu");
|
||||
top.setAttribute("label", ext.name);
|
||||
top.setAttribute("ext-type", "top-level-menu");
|
||||
let menupopup = doc.createElement("menupopup");
|
||||
top.appendChild(menupopup);
|
||||
for (i of topLevelItems) {
|
||||
menupopup.appendChild(i);
|
||||
}
|
||||
xulMenu.appendChild(top);
|
||||
this._itemsToCleanUp.add(top);
|
||||
} else if (topLevelItems.size == 1) {
|
||||
// If there is only one visible item, we can just append it.
|
||||
let singleItem = topLevelItems.values().next().value;
|
||||
xulMenu.appendChild(singleItem);
|
||||
this._itemsToCleanUp.add(singleItem);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
handleEvent: function(event) {
|
||||
let target = event.target;
|
||||
|
||||
target.removeEventListener("popuphidden", this);
|
||||
for (let item of this._itemsToCleanUp) {
|
||||
target.removeChild(item);
|
||||
}
|
||||
// Let's detach the top level items.
|
||||
this._itemsToCleanUp.clear();
|
||||
},
|
||||
|
||||
_itemsToCleanUp: new Set(),
|
||||
}
|
||||
|
||||
function getContexts(contextData) {
|
||||
let contexts = new Set(["all"]);
|
||||
|
||||
contexts.add("page");
|
||||
|
||||
if (contextData.inFrame) {
|
||||
contexts.add("frame")
|
||||
}
|
||||
|
||||
if (contextData.isTextSelected) {
|
||||
contexts.add("selection")
|
||||
}
|
||||
|
||||
if (contextData.onLink) {
|
||||
contexts.add("link")
|
||||
}
|
||||
|
||||
if (contextData.onEditableArea) {
|
||||
contexts.add("editable")
|
||||
}
|
||||
|
||||
if (contextData.onImage) {
|
||||
contexts.add("image")
|
||||
}
|
||||
|
||||
if (contextData.onVideo) {
|
||||
contexts.add("video")
|
||||
}
|
||||
|
||||
if (contextData.onAudio) {
|
||||
contexts.add("audio")
|
||||
}
|
||||
|
||||
return contexts;
|
||||
}
|
||||
|
||||
function MenuItem(extension, extContext, createProperties)
|
||||
{
|
||||
this.extension = extension;
|
||||
this.extContext = extContext;
|
||||
|
||||
this.init(createProperties);
|
||||
}
|
||||
|
||||
MenuItem.prototype = {
|
||||
// init is called from the MenuItem ctor and from update. The |update|
|
||||
// flag is for the later case.
|
||||
init(createProperties, update=false) {
|
||||
let item = this;
|
||||
// return true if the prop was set on |this|
|
||||
function parseProp(propName, defaultValue = null) {
|
||||
if (propName in createProperties) {
|
||||
item[propName] = createProperties[propName];
|
||||
return true;
|
||||
} else if (!update && defaultValue !== null) {
|
||||
item[propName] = defaultValue;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if (update && "id" in createProperties) {
|
||||
throw new Error("Id of a MenuItem cannot be changed");
|
||||
} else if (!update) {
|
||||
let isIdUsed = contextMenuMap.get(this.extension).has(createProperties.id);
|
||||
if (createProperties.id && isIdUsed) {
|
||||
throw new Error("Id already exists");
|
||||
}
|
||||
this.id = createProperties.id ? createProperties.id : nextID++;
|
||||
}
|
||||
|
||||
parseProp("type", "normal");
|
||||
parseProp("title");
|
||||
parseProp("checked", false);
|
||||
parseProp("contexts", ["all"]);
|
||||
|
||||
// It's a bit wacky... but we shouldn't be too scared to use wrappedJSObject here.
|
||||
// Later on we will do proper argument validation anyway.
|
||||
if ("onclick" in createProperties.wrappedJSObject) {
|
||||
this.onclick = createProperties.wrappedJSObject.onclick;
|
||||
}
|
||||
|
||||
if (parseProp("parentId")) {
|
||||
let found = false;
|
||||
let menuMap = contextMenuMap.get(this.extension);
|
||||
if (menuMap.has(this.parentId)) {
|
||||
found = true;
|
||||
menuMap.get(this.parentId).isMenu = true;
|
||||
}
|
||||
if (!found) {
|
||||
throw new Error("MenuItem with this parentId not found");
|
||||
}
|
||||
} else {
|
||||
this.parentId = undefined;
|
||||
}
|
||||
|
||||
if (parseProp("documentUrlPatterns")) {
|
||||
this.documentUrlMatchPattern = new MatchPattern(this.documentUrlPatterns);
|
||||
}
|
||||
|
||||
if (parseProp("targetUrlPatterns")) {
|
||||
this.targetUrlPatterns = new MatchPattern(this.targetUrlPatterns);
|
||||
}
|
||||
|
||||
parseProp("enabled", true);
|
||||
},
|
||||
|
||||
remove() {
|
||||
let menuMap = contextMenuMap.get(this.extension);
|
||||
// We want to remove all the items that has |this| in its parent chain.
|
||||
// The |checked| map is only an optimisation to avoid checking any item
|
||||
// twice in the algorithm.
|
||||
let checked = new Map();
|
||||
function hasAncestorWithId(item, id) {
|
||||
if (checked.has(item)) {
|
||||
return checked.get(item);
|
||||
}
|
||||
if (item.parentId === undefined) {
|
||||
checked.set(item, false);
|
||||
return false;
|
||||
}
|
||||
let parent = menuMap.get(item.parentId);
|
||||
if (!parent) {
|
||||
checked.set(item, false);
|
||||
return false;
|
||||
}
|
||||
if (parent.id === id) {
|
||||
checked.set(item, true);
|
||||
return true;
|
||||
}
|
||||
let rv = hasAncestorWithId(parent, id);
|
||||
checked.set(item, rv);
|
||||
return rv;
|
||||
}
|
||||
|
||||
let toRemove = new Set();
|
||||
toRemove.add(this.id);
|
||||
for (let [id, item] of menuMap) {
|
||||
if (hasAncestorWithId(item, this.id)) {
|
||||
toRemove.add(item.id);
|
||||
}
|
||||
}
|
||||
for (let id of toRemove) {
|
||||
menuMap.delete(id);
|
||||
}
|
||||
},
|
||||
|
||||
getClickData(contextData, event) {
|
||||
let mediaType;
|
||||
if (contextData.onVideo) {
|
||||
mediaType = "video";
|
||||
}
|
||||
if (contextData.onAudio) {
|
||||
mediaType = "audio";
|
||||
}
|
||||
if (contextData.onImage) {
|
||||
mediaType = "image";
|
||||
}
|
||||
|
||||
let clickData = {
|
||||
menuItemId: this.id
|
||||
};
|
||||
|
||||
function setIfDefined(argName, value) {
|
||||
if (value) {
|
||||
clickData[argName] = value;
|
||||
}
|
||||
}
|
||||
|
||||
let tab = contextData.tab ? TabManager.convert(this.extension, contextData.tab) : undefined;
|
||||
|
||||
setIfDefined("parentMenuItemId", this.parentId);
|
||||
setIfDefined("mediaType", mediaType);
|
||||
setIfDefined("linkUrl", contextData.linkUrl);
|
||||
setIfDefined("srcUrl", contextData.srcUrl);
|
||||
setIfDefined("pageUrl", contextData.pageUrl);
|
||||
setIfDefined("frameUrl", contextData.frameUrl);
|
||||
setIfDefined("selectionText", contextData.selectionText);
|
||||
setIfDefined("editable", contextData.onEditableArea);
|
||||
setIfDefined("tab", tab);
|
||||
|
||||
return clickData;
|
||||
},
|
||||
|
||||
enabledForContext(contextData) {
|
||||
let enabled = false;
|
||||
let contexts = getContexts(contextData);
|
||||
for (let c of this.contexts) {
|
||||
if (contexts.has(c)) {
|
||||
enabled = true;
|
||||
break
|
||||
}
|
||||
}
|
||||
if (!enabled) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.documentUrlMatchPattern &&
|
||||
!this.documentUrlMatchPattern.matches(contentData.documentURIObject)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.targetUrlPatterns &&
|
||||
(contextData.onImage || contextData.onAudio || contextData.onVideo) &&
|
||||
!this.targetUrlPatterns.matches(contentData.mediaURL)) {
|
||||
// TODO: double check if mediaURL is always set when we need it
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
},
|
||||
};
|
||||
|
||||
let extCount = 0;
|
||||
extensions.on("startup", (type, extension) => {
|
||||
contextMenuMap.set(extension, new Map());
|
||||
if (++extCount == 1) {
|
||||
Services.obs.addObserver(contextMenuObserver,
|
||||
"on-build-contextmenu",
|
||||
false);
|
||||
}
|
||||
});
|
||||
|
||||
extensions.on("shutdown", (type, extension) => {
|
||||
contextMenuMap.delete(extension);
|
||||
if (--extCount == 0) {
|
||||
Services.obs.removeObserver(contextMenuObserver,
|
||||
"on-build-contextmenu");
|
||||
}
|
||||
});
|
||||
|
||||
extensions.registerPrivilegedAPI("contextMenus", (extension, context) => {
|
||||
return {
|
||||
contextMenus: {
|
||||
create() {},
|
||||
removeAll() {},
|
||||
create: function(createProperties, callback) {
|
||||
let menuItem = new MenuItem(extension, context, createProperties);
|
||||
contextMenuMap.get(extension).set(menuItem.id, menuItem);
|
||||
if (callback) {
|
||||
runSafe(context, callback);
|
||||
}
|
||||
return menuItem.id;
|
||||
},
|
||||
|
||||
update: function(id, updateProperties, callback) {
|
||||
let menuItem = contextMenuMap.get(extension).get(id);
|
||||
if (menuItem) {
|
||||
menuItem.init(updateProperties, true);
|
||||
}
|
||||
if (callback) {
|
||||
runSafe(context, callback);
|
||||
}
|
||||
},
|
||||
|
||||
remove: function(id, callback) {
|
||||
let menuItem = contextMenuMap.get(extension).get(id);
|
||||
if (menuItem) {
|
||||
menuItem.remove();
|
||||
}
|
||||
if (callback) {
|
||||
runSafe(context, callback);
|
||||
}
|
||||
},
|
||||
|
||||
removeAll: function(callback) {
|
||||
for (let [id, menuItem] of contextMenuMap.get(extension)) {
|
||||
menuItem.remove();
|
||||
}
|
||||
if (callback) {
|
||||
runSafe(context, callback);
|
||||
}
|
||||
},
|
||||
|
||||
// TODO: implement this once event pages are ready.
|
||||
onClicked: new EventManager(context, "contextMenus.onClicked", fire => {
|
||||
let callback = menuItem => {
|
||||
fire(menuItem.data);
|
||||
};
|
||||
|
||||
onClickedCallbacksMap.set(extension, callback);
|
||||
return () => {
|
||||
onClickedCallbacksMap.delete(extension);
|
||||
};
|
||||
}).api(),
|
||||
},
|
||||
};
|
||||
});
|
||||
|
@ -2,11 +2,14 @@
|
||||
skip-if = os == 'android' || buildapp == 'b2g' || os == 'mac'
|
||||
support-files =
|
||||
head.js
|
||||
context.html
|
||||
ctxmenu-image.png
|
||||
|
||||
[browser_ext_simple.js]
|
||||
[browser_ext_currentWindow.js]
|
||||
[browser_ext_browserAction_simple.js]
|
||||
[browser_ext_browserAction_icon.js]
|
||||
[browser_ext_contextMenus.js]
|
||||
[browser_ext_getViews.js]
|
||||
[browser_ext_tabs_executeScript.js]
|
||||
[browser_ext_tabs_query.js]
|
||||
|
@ -0,0 +1,148 @@
|
||||
add_task(function* () {
|
||||
let tab1 = yield BrowserTestUtils.openNewForegroundTab(gBrowser,
|
||||
"http://mochi.test:8888/browser/browser/components/extensions/test/browser/context.html");
|
||||
|
||||
gBrowser.selectedTab = tab1;
|
||||
|
||||
let extension = ExtensionTestUtils.loadExtension({
|
||||
manifest: {
|
||||
"permissions": ["contextMenus"]
|
||||
},
|
||||
|
||||
background: function() {
|
||||
// A generic onclick callback function.
|
||||
function genericOnClick(info) {
|
||||
browser.test.sendMessage("menuItemClick", JSON.stringify(info));
|
||||
}
|
||||
|
||||
browser.contextMenus.create({ "contexts": ["all"], "type": "separator" });
|
||||
|
||||
var contexts = ["page", "selection", "image"];
|
||||
for (var i = 0; i < contexts.length; i++) {
|
||||
var context = contexts[i];
|
||||
var title = context;
|
||||
var id = browser.contextMenus.create({ "title": title, "contexts": [context], "id": "ext-" + context,
|
||||
"onclick": genericOnClick });
|
||||
if (context == "selection") {
|
||||
browser.contextMenus.update("ext-selection", { "title": "selection-edited" });
|
||||
}
|
||||
}
|
||||
|
||||
var parent = browser.contextMenus.create({ "title": "parent" });
|
||||
var child1 = browser.contextMenus.create(
|
||||
{ "title": "child1", "parentId": parent, "onclick": genericOnClick });
|
||||
var child2 = browser.contextMenus.create(
|
||||
{ "title": "child2", "parentId": parent, "onclick": genericOnClick });
|
||||
|
||||
var parentToDel = browser.contextMenus.create({ "title": "parentToDel" });
|
||||
var child1ToDel = browser.contextMenus.create(
|
||||
{ "title": "child1", "parentId": parentToDel, "onclick": genericOnClick });
|
||||
var child2ToDel = browser.contextMenus.create(
|
||||
{ "title": "child2", "parentId": parentToDel, "onclick": genericOnClick });
|
||||
browser.contextMenus.remove(parentToDel);
|
||||
|
||||
browser.test.notifyPass();
|
||||
},
|
||||
});
|
||||
|
||||
let expectedClickInfo;
|
||||
function checkClickInfo(info) {
|
||||
info = JSON.parse(info);
|
||||
for (let i in expectedClickInfo) {
|
||||
is(info[i], expectedClickInfo[i],
|
||||
"click info " + i + " expected to be: " + expectedClickInfo[i] + " but was: " + info[i]);
|
||||
}
|
||||
is(expectedClickInfo.pageSrc, info.tab.url);
|
||||
}
|
||||
|
||||
yield extension.startup();
|
||||
yield extension.awaitFinish();
|
||||
|
||||
// Bring up context menu
|
||||
let contentAreaContextMenu = document.getElementById("contentAreaContextMenu");
|
||||
let popupShownPromise = BrowserTestUtils.waitForEvent(contentAreaContextMenu, "popupshown");
|
||||
yield BrowserTestUtils.synthesizeMouseAtCenter("#img1",
|
||||
{ type: "contextmenu", button: 2 }, gBrowser.selectedBrowser);
|
||||
yield popupShownPromise;
|
||||
|
||||
// Check some menu items
|
||||
let items = contentAreaContextMenu.getElementsByAttribute("ext-type", "top-level-menu");
|
||||
is(items.length, 1, "top level item was found (context=image)");
|
||||
let topItem = items.item(0);
|
||||
let top = topItem.childNodes[0];
|
||||
|
||||
items = top.getElementsByAttribute("label", "image");
|
||||
is(items.length, 1, "contextMenu item for image was found (context=image)");
|
||||
let image = items.item(0);
|
||||
|
||||
items = top.getElementsByAttribute("label", "selection-edited");
|
||||
is(items.length, 0, "contextMenu item for selection was not found (context=image)");
|
||||
|
||||
items = top.getElementsByAttribute("label", "parentToDel");
|
||||
is(items.length, 0, "contextMenu item for removed parent was not found (context=image)");
|
||||
|
||||
items = top.getElementsByAttribute("label", "parent");
|
||||
is(items.length, 1, "contextMenu item for parent was found (context=image)");
|
||||
|
||||
is(items.item(0).childNodes[0].childNodes.length, 2, "child items for parent were found (context=image)")
|
||||
|
||||
// Click on ext-image item and check the results
|
||||
let popupHiddenPromise = BrowserTestUtils.waitForEvent(contentAreaContextMenu, "popuphidden");
|
||||
expectedClickInfo = {
|
||||
menuItemId: "ext-image",
|
||||
mediaType: "image",
|
||||
srcUrl: "http://mochi.test:8888/browser/browser/components/extensions/test/browser/ctxmenu-image.png",
|
||||
pageUrl: "http://mochi.test:8888/browser/browser/components/extensions/test/browser/context.html",
|
||||
};
|
||||
top.openPopup(topItem, "end_before", 0, 0, true, false);
|
||||
EventUtils.synthesizeMouseAtCenter(image, {});
|
||||
let clickInfo = yield extension.awaitMessage("menuItemClick");
|
||||
checkClickInfo(clickInfo);
|
||||
yield popupHiddenPromise;
|
||||
|
||||
// Select some text
|
||||
yield ContentTask.spawn(gBrowser.selectedBrowser, { }, function* (arg) {
|
||||
let doc = content.document;
|
||||
let range = doc.createRange();
|
||||
let selection = content.getSelection();
|
||||
selection.removeAllRanges();
|
||||
let textNode = doc.getElementById("img1").previousSibling;
|
||||
range.setStart(textNode, 0);
|
||||
range.setEnd(textNode, 20);
|
||||
selection.addRange(range);
|
||||
});
|
||||
|
||||
// Bring up context menu again
|
||||
popupShownPromise = BrowserTestUtils.waitForEvent(contentAreaContextMenu, "popupshown");
|
||||
yield BrowserTestUtils.synthesizeMouse(null, 1, 1,
|
||||
{ type: "contextmenu", button: 2 }, gBrowser.selectedBrowser);
|
||||
yield popupShownPromise;
|
||||
|
||||
items = contentAreaContextMenu.getElementsByAttribute("ext-type", "top-level-menu");
|
||||
is(items.length, 1, "top level item was found (context=selection)");
|
||||
top = items.item(0).childNodes[0];
|
||||
|
||||
// Check some menu items
|
||||
items = top.getElementsByAttribute("label", "selection-edited");
|
||||
is(items.length, 1, "contextMenu item for selection was found (context=selection)");
|
||||
let selectionItem = items.item(0);
|
||||
|
||||
items = top.getElementsByAttribute("label", "selection");
|
||||
is(items.length, 0, "contextMenu item label update worked (context=selection)");
|
||||
|
||||
popupHiddenPromise = BrowserTestUtils.waitForEvent(contentAreaContextMenu, "popuphidden");
|
||||
expectedClickInfo = {
|
||||
menuItemId: "ext-selection",
|
||||
pageUrl: "http://mochi.test:8888/browser/browser/components/extensions/test/browser/context.html",
|
||||
selectionText: "just some text",
|
||||
};
|
||||
top.openPopup(topItem, "end_before", 0, 0, true, false);
|
||||
EventUtils.synthesizeMouseAtCenter(selectionItem, {});
|
||||
clickInfo = yield extension.awaitMessage("menuItemClick");
|
||||
checkClickInfo(clickInfo);
|
||||
yield popupHiddenPromise;
|
||||
|
||||
yield extension.unload();
|
||||
|
||||
yield BrowserTestUtils.removeTab(tab1);
|
||||
});
|
8
browser/components/extensions/test/browser/context.html
Normal file
8
browser/components/extensions/test/browser/context.html
Normal file
@ -0,0 +1,8 @@
|
||||
<html>
|
||||
<head>
|
||||
</head>
|
||||
<body>
|
||||
just some text
|
||||
<img src="ctxmenu-image.png" id="img1">
|
||||
</body>
|
||||
</html>
|
BIN
browser/components/extensions/test/browser/ctxmenu-image.png
Normal file
BIN
browser/components/extensions/test/browser/ctxmenu-image.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.3 KiB |
@ -13,10 +13,10 @@ else
|
||||
APP_INI_DEPS = $(topsrcdir)/config/milestone.txt
|
||||
endif
|
||||
|
||||
APP_BUILDID := $(shell cat $(DEPTH)/config/buildid)
|
||||
MOZ_APP_BUILDID := $(shell cat $(DEPTH)/config/buildid)
|
||||
APP_INI_DEPS += $(DEPTH)/config/buildid
|
||||
|
||||
DEFINES += -DAPP_BUILDID=$(APP_BUILDID)
|
||||
DEFINES += -DMOZ_APP_BUILDID=$(MOZ_APP_BUILDID)
|
||||
|
||||
APP_INI_DEPS += $(DEPTH)/config/autoconf.mk
|
||||
|
||||
|
@ -26,7 +26,7 @@ Version=@MOZ_APP_VERSION@
|
||||
#ifdef MOZ_APP_PROFILE
|
||||
Profile=@MOZ_APP_PROFILE@
|
||||
#endif
|
||||
BuildID=@APP_BUILDID@
|
||||
BuildID=@MOZ_APP_BUILDID@
|
||||
#ifdef MOZ_SOURCE_REPO
|
||||
SourceRepository=@MOZ_SOURCE_REPO@
|
||||
#endif
|
||||
@ -47,5 +47,5 @@ EnableProfileMigrator=1
|
||||
#if MOZ_CRASHREPORTER
|
||||
[Crash Reporter]
|
||||
Enabled=1
|
||||
ServerURL=https://crash-reports.mozilla.com/submit?id=@MOZ_APP_ID@&version=@MOZ_APP_VERSION@&buildid=@APP_BUILDID@
|
||||
ServerURL=https://crash-reports.mozilla.com/submit?id=@MOZ_APP_ID@&version=@MOZ_APP_VERSION@&buildid=@MOZ_APP_BUILDID@
|
||||
#endif
|
||||
|
35
build/autoconf/rust.m4
Normal file
35
build/autoconf/rust.m4
Normal file
@ -0,0 +1,35 @@
|
||||
dnl This Source Code Form is subject to the terms of the Mozilla Public
|
||||
dnl License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
AC_DEFUN([MOZ_RUST_SUPPORT], [
|
||||
MOZ_PATH_PROG(RUSTC, rustc)
|
||||
if test -n "$RUSTC"; then
|
||||
AC_MSG_CHECKING([rustc version])
|
||||
RUSTC_VERSION=`$RUSTC --version | cut -d ' ' -f 2`
|
||||
# Parse out semversion elements.
|
||||
_RUSTC_MAJOR_VERSION=`echo ${RUSTC_VERSION} | cut -d . -f 1`
|
||||
_RUSTC_MINOR_VERSION=`echo ${RUSTC_VERSION} | cut -d . -f 2`
|
||||
_RUSTC_EXTRA_VERSION=`echo ${RUSTC_VERSION} | cut -d . -f 3 | cut -d + -f 1`
|
||||
_RUSTC_PATCH_VERSION=`echo ${_RUSTC_EXTRA_VERSION} | cut -d '-' -f 1`
|
||||
AC_MSG_RESULT([$RUSTC_VERSION (v${_RUSTC_MAJOR_VERSION}.${_RUSTC_MINOR_VERSION}.${_RUSTC_PATCH_VERSION})])
|
||||
fi
|
||||
MOZ_ARG_ENABLE_BOOL([rust],
|
||||
[ --enable-rust Include Rust language sources],
|
||||
[MOZ_RUST=1],
|
||||
[MOZ_RUST= ])
|
||||
if test -z "$RUSTC" -a -n "$MOZ_RUST"; then
|
||||
AC_MSG_ERROR([Rust compiler not found.
|
||||
To compile rust language sources, you must have 'rustc' in your path.
|
||||
See http://www.rust-lang.org/ for more information.])
|
||||
fi
|
||||
if test -n "$MOZ_RUST" && test -z "$_RUSTC_MAJOR_VERSION" -o \
|
||||
"$_RUSTC_MAJOR_VERSION" -lt 1; then
|
||||
AC_MSG_ERROR([Rust compiler ${RUSTC_VERSION} is too old.
|
||||
To compile Rust language sources please install at least
|
||||
version 1.0 of the 'rustc' toolchain and make sure it is
|
||||
first in your path.
|
||||
You can verify this by typing 'rustc --version'.])
|
||||
fi
|
||||
AC_SUBST(MOZ_RUST)
|
||||
])
|
@ -632,7 +632,7 @@ awk '$$8 ~ /@$(2)_/ { \
|
||||
split(b[2],v,"."); \
|
||||
if ($(4)) { \
|
||||
if (!found) { \
|
||||
print "TEST-UNEXPECTED-FAIL | check_stdcxx | We do not want these $(3) symbols to be used:" \
|
||||
print "TEST-UNEXPECTED-FAIL | check_stdcxx | We do not want these $(3) symbol versions to be used:" \
|
||||
} \
|
||||
print " ",$$8; \
|
||||
found=1 \
|
||||
|
@ -31,8 +31,6 @@
|
||||
# symbolic links
|
||||
# - JAR_MN_TARGETS, which defines the targets to use for jar manifest
|
||||
# processing, see further below
|
||||
# - PP_TARGETS, which defines the file paths of preprocessed files, see
|
||||
# further below
|
||||
# - INSTALL_MANIFESTS, which defines the list of base directories handled
|
||||
# by install manifests, see further below
|
||||
# - MANIFEST_TARGETS, which defines the file paths of chrome manifests, see
|
||||
@ -47,7 +45,6 @@ default: $(addprefix install-,$(INSTALL_MANIFESTS))
|
||||
default: $(addprefix jar-,$(JAR_MN_TARGETS))
|
||||
|
||||
# Explicit files to be built for a default build
|
||||
default: $(addprefix $(TOPOBJDIR)/,$(PP_TARGETS))
|
||||
default: $(addprefix $(TOPOBJDIR)/,$(MANIFEST_TARGETS))
|
||||
default: $(TOPOBJDIR)/dist/bin/greprefs.js
|
||||
default: $(TOPOBJDIR)/dist/bin/platform.ini
|
||||
@ -83,42 +80,20 @@ $(TOPOBJDIR)/dist/%:
|
||||
# corresponding install manifests are named correspondingly, with forward
|
||||
# slashes replaced with underscores, and prefixed with `install_`. That is,
|
||||
# the install manifest for `dist/bin` would be `install_dist_bin`.
|
||||
$(addprefix install-,$(INSTALL_MANIFESTS)): install-%:
|
||||
$(addprefix install-,$(INSTALL_MANIFESTS)): install-%: $(TOPOBJDIR)/config/buildid
|
||||
@# For now, force preprocessed files to be reprocessed every time.
|
||||
@# The overhead is not that big, and this avoids waiting for proper
|
||||
@# support for defines tracking in process_install_manifest.
|
||||
@touch install_$(subst /,_,$*)
|
||||
$(PYTHON) -m mozbuild.action.process_install_manifest \
|
||||
--no-remove \
|
||||
--no-remove-empty-directories \
|
||||
$(TOPOBJDIR)/$* \
|
||||
install_$(subst /,_,$*)
|
||||
|
||||
# Preprocessed files. Ideally they would be using install manifests but
|
||||
# right now, it's not possible because of things like APP_BUILDID or
|
||||
# nsURLFormatter.js.
|
||||
#
|
||||
# The list of preprocessed files is defined in PP_TARGETS. The list is
|
||||
# relative to TOPOBJDIR.
|
||||
# The source file for each of those preprocessed files is defined as a Make
|
||||
# dependency for the $(TOPOBJDIR)/path target. For example:
|
||||
# PP_TARGETS = foo/bar
|
||||
# $(TOPOBJDIR)/foo/bar: /path/to/source/for/foo/bar.in
|
||||
# The file name for the source doesn't need to be different.
|
||||
# Additionally, extra defines can be specified for a given preprocessing
|
||||
# by setting the `defines` variable specifically for the given target.
|
||||
# For example:
|
||||
# $(TOPOBJDIR)/foo/bar: defines = -Dqux=foobar
|
||||
$(addprefix $(TOPOBJDIR)/,$(PP_TARGETS)): Makefile
|
||||
$(addprefix $(TOPOBJDIR)/,$(PP_TARGETS)): $(TOPOBJDIR)/%:
|
||||
$(PYTHON) -m mozbuild.action.preprocessor \
|
||||
--depend $(TOPOBJDIR)/faster/.deps/$(subst /,_,$*) \
|
||||
-DAB_CD=en-US \
|
||||
$(defines) \
|
||||
-DMOZ_APP_BUILDID=$(shell cat $(TOPOBJDIR)/config/buildid) \
|
||||
$(ACDEFINES) \
|
||||
$(MOZ_DEBUG_DEFINES) \
|
||||
$< \
|
||||
-o $@
|
||||
|
||||
# Include the dependency files from the above preprocessed files rule.
|
||||
$(foreach pp_target,$(PP_TARGETS), \
|
||||
$(eval -include $(TOPOBJDIR)/faster/.deps/$(subst /,_,$(pp_target))))
|
||||
install_$(subst /,_,$*)
|
||||
|
||||
# Install files from jar manifests. Ideally, they would be using install
|
||||
# manifests, but the code to read jar manifests and emit appropriate
|
||||
@ -191,11 +166,6 @@ jar-browser-themes-%-jar.mn: \
|
||||
$(TOPOBJDIR)/browser/themes/%/tab-selected-end.svg \
|
||||
$(TOPOBJDIR)/browser/themes/%/tab-selected-start.svg
|
||||
|
||||
# Extra dependencies and/or definitions for preprocessed files.
|
||||
$(TOPOBJDIR)/dist/bin/application.ini: $(TOPOBJDIR)/config/buildid
|
||||
$(TOPOBJDIR)/dist/bin/application.ini: defines += \
|
||||
-DAPP_BUILDID=$(shell cat $(TOPOBJDIR)/config/buildid)
|
||||
|
||||
# Files to build with the recursive backend and simply copy
|
||||
$(TOPOBJDIR)/dist/bin/greprefs.js: $(TOPOBJDIR)/modules/libpref/greprefs.js
|
||||
$(TOPOBJDIR)/dist/bin/platform.ini: $(TOPOBJDIR)/toolkit/xre/platform.ini
|
||||
|
@ -1152,11 +1152,6 @@ ifneq (,$(DIST_SUBDIR)$(XPI_NAME)$(LIBXUL_SDK))
|
||||
PREF_DIR = defaults/preferences
|
||||
endif
|
||||
|
||||
# on win32, pref files need CRLF line endings... see bug 206029
|
||||
ifeq (WINNT,$(OS_ARCH))
|
||||
PREF_PPFLAGS += --line-endings=crlf
|
||||
endif
|
||||
|
||||
ifneq ($(PREF_JS_EXPORTS),)
|
||||
ifndef NO_DIST_INSTALL
|
||||
PREF_JS_EXPORTS_PATH := $(FINAL_TARGET)/$(PREF_DIR)
|
||||
|
30
configure.in
30
configure.in
@ -414,35 +414,7 @@ MOZ_TOOL_VARIABLES
|
||||
|
||||
MOZ_CHECK_COMPILER_WRAPPER
|
||||
|
||||
MOZ_PATH_PROG(RUSTC, rustc)
|
||||
if test -n "$RUSTC"; then
|
||||
AC_MSG_CHECKING([rustc version])
|
||||
RUSTC_VERSION=`$RUSTC --version | cut -d ' ' -f 2`
|
||||
# Parse out semversion elements.
|
||||
_RUSTC_MAJOR_VERSION=`echo ${RUSTC_VERSION} | cut -d . -f 1`
|
||||
_RUSTC_MINOR_VERSION=`echo ${RUSTC_VERSION} | cut -d . -f 2`
|
||||
_RUSTC_EXTRA_VERSION=`echo ${RUSTC_VERSION} | cut -d . -f 3 | cut -d + -f 1`
|
||||
_RUSTC_PATCH_VERSION=`echo ${_RUSTC_EXTRA_VERSION} | cut -d '-' -f 1`
|
||||
AC_MSG_RESULT([$RUSTC_VERSION (v${_RUSTC_MAJOR_VERSION}.${_RUSTC_MINOR_VERSION}.${_RUSTC_PATCH_VERSION})])
|
||||
fi
|
||||
MOZ_ARG_ENABLE_BOOL([rust],
|
||||
[ --enable-rust Include Rust language sources],
|
||||
[MOZ_RUST=1],
|
||||
[MOZ_RUST= ])
|
||||
if test -z "$RUSTC" -a -n "$MOZ_RUST"; then
|
||||
AC_MSG_ERROR([Rust compiler not found.
|
||||
To compile rust language sources, you must have 'rustc' in your path.
|
||||
See http://www.rust-lang.org/ for more information.])
|
||||
fi
|
||||
if test -n "$MOZ_RUST" && test -z "$_RUSTC_MAJOR_VERSION" -o \
|
||||
"$_RUSTC_MAJOR_VERSION" -lt 1; then
|
||||
AC_MSG_ERROR([Rust compiler ${RUSTC_VERSION} is too old.
|
||||
To compile Rust language sources please install at least
|
||||
version 1.0 of the 'rustc' toolchain and make sure it is
|
||||
first in your path.
|
||||
You can verify this by typing 'rustc --version'.])
|
||||
fi
|
||||
AC_SUBST(MOZ_RUST)
|
||||
MOZ_RUST_SUPPORT
|
||||
|
||||
dnl ========================================================
|
||||
dnl Check for MacOS deployment target version
|
||||
|
@ -37,7 +37,7 @@ ArchiveReader::Constructor(const GlobalObject& aGlobal,
|
||||
nsAutoCString encoding;
|
||||
if (!EncodingUtils::FindEncodingForLabelNoReplacement(aOptions.mEncoding,
|
||||
encoding)) {
|
||||
aError.ThrowRangeError(MSG_ENCODING_NOT_SUPPORTED, &aOptions.mEncoding);
|
||||
aError.ThrowRangeError<MSG_ENCODING_NOT_SUPPORTED>(&aOptions.mEncoding);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -78,7 +78,7 @@ URL::Constructor(nsISupports* aParent, const nsAString& aUrl,
|
||||
nsresult rv = NS_NewURI(getter_AddRefs(baseUri), aBase, nullptr, nullptr,
|
||||
nsContentUtils::GetIOService());
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
aRv.ThrowTypeError(MSG_INVALID_URL, &aBase);
|
||||
aRv.ThrowTypeError<MSG_INVALID_URL>(&aBase);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -94,7 +94,7 @@ URL::Constructor(nsISupports* aParent, const nsAString& aUrl, nsIURI* aBase,
|
||||
nsresult rv = NS_NewURI(getter_AddRefs(uri), aUrl, nullptr, aBase,
|
||||
nsContentUtils::GetIOService());
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
aRv.ThrowTypeError(MSG_INVALID_URL, &aUrl);
|
||||
aRv.ThrowTypeError<MSG_INVALID_URL>(&aUrl);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -230,7 +230,7 @@ URL::SetHref(const nsAString& aHref, ErrorResult& aRv)
|
||||
rv = ioService->NewURI(href, nullptr, nullptr, getter_AddRefs(uri));
|
||||
if (NS_FAILED(rv)) {
|
||||
nsAutoString label(aHref);
|
||||
aRv.ThrowTypeError(MSG_INVALID_URL, &label);
|
||||
aRv.ThrowTypeError<MSG_INVALID_URL>(&label);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -157,7 +157,7 @@ WindowNamedPropertiesHandler::defineProperty(JSContext* aCx,
|
||||
JS::ObjectOpResult &result) const
|
||||
{
|
||||
ErrorResult rv;
|
||||
rv.ThrowTypeError(MSG_DEFINEPROPERTY_ON_GSP);
|
||||
rv.ThrowTypeError<MSG_DEFINEPROPERTY_ON_GSP>();
|
||||
rv.ReportErrorWithMessage(aCx);
|
||||
return false;
|
||||
}
|
||||
|
@ -3602,6 +3602,8 @@ nsContentUtils::IsChildOfSameType(nsIDocument* aDoc)
|
||||
bool
|
||||
nsContentUtils::IsPlainTextType(const nsACString& aContentType)
|
||||
{
|
||||
// NOTE: if you add a type here, add it to the CONTENTDLF_CATEGORIES
|
||||
// define in nsContentDLF.h as well.
|
||||
return aContentType.EqualsLiteral(TEXT_PLAIN) ||
|
||||
aContentType.EqualsLiteral(TEXT_CSS) ||
|
||||
aContentType.EqualsLiteral(TEXT_CACHE_MANIFEST) ||
|
||||
@ -3610,7 +3612,9 @@ nsContentUtils::IsPlainTextType(const nsACString& aContentType)
|
||||
aContentType.EqualsLiteral(TEXT_ECMASCRIPT) ||
|
||||
aContentType.EqualsLiteral(APPLICATION_ECMASCRIPT) ||
|
||||
aContentType.EqualsLiteral(TEXT_JAVASCRIPT) ||
|
||||
aContentType.EqualsLiteral(APPLICATION_JSON);
|
||||
aContentType.EqualsLiteral(APPLICATION_JSON) ||
|
||||
aContentType.EqualsLiteral(TEXT_JSON) ||
|
||||
aContentType.EqualsLiteral(TEXT_VTT);
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -1494,7 +1494,7 @@ nsObjectLoadingContent::IsYoutubeEmbed()
|
||||
nsAutoCString currentBaseDomain;
|
||||
bool ok = NS_SUCCEEDED(tldService->GetBaseDomain(mURI, 0, currentBaseDomain));
|
||||
if (!ok) {
|
||||
NS_WARNING("Could not parse plugin domain!");
|
||||
// Data URIs won't parse correctly, so just fail silently here.
|
||||
return false;
|
||||
}
|
||||
nsAutoCString domain("youtube.com");
|
||||
|
@ -37,6 +37,16 @@ enum ErrNum {
|
||||
Err_Limit
|
||||
};
|
||||
|
||||
// Debug-only compile-time table of the number of arguments of each error, for use in static_assert.
|
||||
#if defined(DEBUG) && (defined(__clang__) || defined(__GNUC__))
|
||||
uint16_t constexpr ErrorFormatNumArgs[] = {
|
||||
#define MSG_DEF(_name, _argc, _exn, _str) \
|
||||
_argc,
|
||||
#include "mozilla/dom/Errors.msg"
|
||||
#undef MSG_DEF
|
||||
};
|
||||
#endif
|
||||
|
||||
uint16_t
|
||||
GetErrorArgCount(const ErrNum aErrorNumber);
|
||||
|
||||
@ -114,16 +124,16 @@ public:
|
||||
return rv;
|
||||
}
|
||||
|
||||
template<typename... Ts>
|
||||
void ThrowTypeError(const dom::ErrNum errorNumber, Ts... messageArgs)
|
||||
template<dom::ErrNum errorNumber, typename... Ts>
|
||||
void ThrowTypeError(Ts... messageArgs)
|
||||
{
|
||||
ThrowErrorWithMessage(errorNumber, NS_ERROR_TYPE_ERR, messageArgs...);
|
||||
ThrowErrorWithMessage<errorNumber>(NS_ERROR_TYPE_ERR, messageArgs...);
|
||||
}
|
||||
|
||||
template<typename... Ts>
|
||||
void ThrowRangeError(const dom::ErrNum errorNumber, Ts... messageArgs)
|
||||
template<dom::ErrNum errorNumber, typename... Ts>
|
||||
void ThrowRangeError(Ts... messageArgs)
|
||||
{
|
||||
ThrowErrorWithMessage(errorNumber, NS_ERROR_RANGE_ERR, messageArgs...);
|
||||
ThrowErrorWithMessage<errorNumber>(NS_ERROR_RANGE_ERR, messageArgs...);
|
||||
}
|
||||
|
||||
void ReportErrorWithMessage(JSContext* cx);
|
||||
@ -211,9 +221,14 @@ private:
|
||||
// and returns the arguments array from that Message.
|
||||
nsTArray<nsString>& CreateErrorMessageHelper(const dom::ErrNum errorNumber, nsresult errorType);
|
||||
|
||||
template<typename... Ts>
|
||||
void ThrowErrorWithMessage(const dom::ErrNum errorNumber, nsresult errorType, Ts... messageArgs)
|
||||
template<dom::ErrNum errorNumber, typename... Ts>
|
||||
void ThrowErrorWithMessage(nsresult errorType, Ts... messageArgs)
|
||||
{
|
||||
#if defined(DEBUG) && (defined(__clang__) || defined(__GNUC__))
|
||||
static_assert(dom::ErrorFormatNumArgs[errorNumber] == sizeof...(messageArgs),
|
||||
"Pass in the right number of arguments");
|
||||
#endif
|
||||
|
||||
if (IsJSException()) {
|
||||
// We have rooted our mJSException, and we don't have the info
|
||||
// needed to unroot here, so just bail.
|
||||
|
6
dom/cache/Cache.cpp
vendored
6
dom/cache/Cache.cpp
vendored
@ -47,7 +47,7 @@ IsValidPutRequestURL(const nsAString& aUrl, ErrorResult& aRv)
|
||||
|
||||
if (!validScheme) {
|
||||
NS_NAMED_LITERAL_STRING(label, "Request");
|
||||
aRv.ThrowTypeError(MSG_INVALID_URL_SCHEME, &label, &aUrl);
|
||||
aRv.ThrowTypeError<MSG_INVALID_URL_SCHEME>(&label, &aUrl);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -61,7 +61,7 @@ IsValidPutRequestMethod(const Request& aRequest, ErrorResult& aRv)
|
||||
aRequest.GetMethod(method);
|
||||
if (!method.LowerCaseEqualsLiteral("get")) {
|
||||
NS_ConvertASCIItoUTF16 label(method);
|
||||
aRv.ThrowTypeError(MSG_INVALID_REQUEST_METHOD, &label);
|
||||
aRv.ThrowTypeError<MSG_INVALID_REQUEST_METHOD>(&label);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -193,7 +193,7 @@ private:
|
||||
Fail()
|
||||
{
|
||||
ErrorResult rv;
|
||||
rv.ThrowTypeError(MSG_FETCH_FAILED);
|
||||
rv.ThrowTypeError<MSG_FETCH_FAILED>();
|
||||
mPromise->MaybeReject(rv);
|
||||
}
|
||||
|
||||
|
8
dom/cache/TypeUtils.cpp
vendored
8
dom/cache/TypeUtils.cpp
vendored
@ -164,7 +164,7 @@ TypeUtils::ToCacheRequest(CacheRequest& aOut, InternalRequest* aIn,
|
||||
if (aSchemeAction == TypeErrorOnInvalidScheme) {
|
||||
NS_NAMED_LITERAL_STRING(label, "Request");
|
||||
NS_ConvertUTF8toUTF16 urlUTF16(url);
|
||||
aRv.ThrowTypeError(MSG_INVALID_URL_SCHEME, &label, &urlUTF16);
|
||||
aRv.ThrowTypeError<MSG_INVALID_URL_SCHEME>(&label, &urlUTF16);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -218,7 +218,7 @@ TypeUtils::ToCacheResponseWithoutBody(CacheResponse& aOut,
|
||||
nsRefPtr<InternalHeaders> headers = aIn.UnfilteredHeaders();
|
||||
MOZ_ASSERT(headers);
|
||||
if (HasVaryStar(headers)) {
|
||||
aRv.ThrowTypeError(MSG_RESPONSE_HAS_VARY_STAR);
|
||||
aRv.ThrowTypeError<MSG_RESPONSE_HAS_VARY_STAR>();
|
||||
return;
|
||||
}
|
||||
ToHeadersEntryList(aOut.headers(), headers);
|
||||
@ -235,7 +235,7 @@ void
|
||||
TypeUtils::ToCacheResponse(CacheResponse& aOut, Response& aIn, ErrorResult& aRv)
|
||||
{
|
||||
if (aIn.BodyUsed()) {
|
||||
aRv.ThrowTypeError(MSG_FETCH_BODY_CONSUMED_ERROR);
|
||||
aRv.ThrowTypeError<MSG_FETCH_BODY_CONSUMED_ERROR>();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -458,7 +458,7 @@ TypeUtils::CheckAndSetBodyUsed(Request* aRequest, BodyAction aBodyAction,
|
||||
}
|
||||
|
||||
if (aRequest->BodyUsed()) {
|
||||
aRv.ThrowTypeError(MSG_FETCH_BODY_CONSUMED_ERROR);
|
||||
aRv.ThrowTypeError<MSG_FETCH_BODY_CONSUMED_ERROR>();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@ TextDecoder::Init(const nsAString& aLabel, const bool aFatal,
|
||||
if (!EncodingUtils::FindEncodingForLabelNoReplacement(aLabel, encoding)) {
|
||||
nsAutoString label(aLabel);
|
||||
EncodingUtils::TrimSpaceCharacters(label);
|
||||
aRv.ThrowRangeError(MSG_ENCODING_NOT_SUPPORTED, &label);
|
||||
aRv.ThrowRangeError<MSG_ENCODING_NOT_SUPPORTED>(&label);
|
||||
return;
|
||||
}
|
||||
InitWithEncoding(encoding, aFatal);
|
||||
@ -83,7 +83,7 @@ TextDecoder::Decode(const char* aInput, const int32_t aLength,
|
||||
mDecoder->Reset();
|
||||
if (rv == NS_OK_UDEC_MOREINPUT) {
|
||||
if (mFatal) {
|
||||
aRv.ThrowTypeError(MSG_DOM_DECODING_FAILED);
|
||||
aRv.ThrowTypeError<MSG_DOM_DECODING_FAILED>();
|
||||
} else {
|
||||
// Need to emit a decode error manually
|
||||
// to simulate the EOF handling of the Encoding spec.
|
||||
@ -93,7 +93,7 @@ TextDecoder::Decode(const char* aInput, const int32_t aLength,
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
aRv.ThrowTypeError(MSG_DOM_DECODING_FAILED);
|
||||
aRv.ThrowTypeError<MSG_DOM_DECODING_FAILED>();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -21,14 +21,14 @@ TextEncoder::Init(const nsAString& aEncoding, ErrorResult& aRv)
|
||||
// If encoding is failure, or is none of utf-8, utf-16, and utf-16be,
|
||||
// throw a RangeError (https://encoding.spec.whatwg.org/#dom-textencoder).
|
||||
if (!EncodingUtils::FindEncodingForLabel(label, mEncoding)) {
|
||||
aRv.ThrowRangeError(MSG_ENCODING_NOT_SUPPORTED, &label);
|
||||
aRv.ThrowRangeError<MSG_ENCODING_NOT_SUPPORTED>(&label);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mEncoding.EqualsLiteral("UTF-8") &&
|
||||
!mEncoding.EqualsLiteral("UTF-16LE") &&
|
||||
!mEncoding.EqualsLiteral("UTF-16BE")) {
|
||||
aRv.ThrowRangeError(MSG_DOM_ENCODING_NOT_UTF);
|
||||
aRv.ThrowRangeError<MSG_DOM_ENCODING_NOT_UTF>();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,15 @@ function forceScrollAndWait(scrollbox, callback) {
|
||||
let utils = SpecialPowers.getDOMWindowUtils(win);
|
||||
|
||||
utils.advanceTimeAndRefresh(1000);
|
||||
waitForPaint(win, utils, callback);
|
||||
|
||||
let postApzFlush = function() {
|
||||
SpecialPowers.Services.obs.removeObserver(postApzFlush, "apz-repaints-flushed", false);
|
||||
waitForPaint(win, utils, callback);
|
||||
}
|
||||
SpecialPowers.Services.obs.addObserver(postApzFlush, "apz-repaints-flushed", false);
|
||||
if (!utils.flushApzRepaints()) {
|
||||
postApzFlush();
|
||||
}
|
||||
}
|
||||
|
||||
function sendTouchpadScrollMotion(scrollbox, direction, ctrl, momentum, callback) {
|
||||
|
@ -249,7 +249,7 @@ MainThreadFetchResolver::OnResponseAvailableInternal(InternalResponse* aResponse
|
||||
mPromise->MaybeResolve(mResponse);
|
||||
} else {
|
||||
ErrorResult result;
|
||||
result.ThrowTypeError(MSG_FETCH_FAILED);
|
||||
result.ThrowTypeError<MSG_FETCH_FAILED>();
|
||||
mPromise->MaybeReject(result);
|
||||
}
|
||||
}
|
||||
@ -288,7 +288,7 @@ public:
|
||||
promise->MaybeResolve(response);
|
||||
} else {
|
||||
ErrorResult result;
|
||||
result.ThrowTypeError(MSG_FETCH_FAILED);
|
||||
result.ThrowTypeError<MSG_FETCH_FAILED>();
|
||||
promise->MaybeReject(result);
|
||||
}
|
||||
return true;
|
||||
@ -1476,7 +1476,7 @@ FetchBody<Derived>::ConsumeBody(ConsumeType aType, ErrorResult& aRv)
|
||||
{
|
||||
mConsumeType = aType;
|
||||
if (BodyUsed()) {
|
||||
aRv.ThrowTypeError(MSG_FETCH_BODY_CONSUMED_ERROR);
|
||||
aRv.ThrowTypeError<MSG_FETCH_BODY_CONSUMED_ERROR>();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -140,7 +140,7 @@ FetchUtil::ConsumeFormData(nsIGlobalObject* aParent, const nsCString& aMimeType,
|
||||
if (isValidFormDataMimeType) {
|
||||
FormDataParser parser(aMimeType, aStr, aParent);
|
||||
if (!parser.Parse()) {
|
||||
aRv.ThrowTypeError(MSG_BAD_FORMDATA);
|
||||
aRv.ThrowTypeError<MSG_BAD_FORMDATA>();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -168,7 +168,7 @@ FetchUtil::ConsumeFormData(nsIGlobalObject* aParent, const nsCString& aMimeType,
|
||||
return fd.forget();
|
||||
}
|
||||
|
||||
aRv.ThrowTypeError(MSG_BAD_FORMDATA);
|
||||
aRv.ThrowTypeError<MSG_BAD_FORMDATA>();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -185,7 +185,7 @@ InternalHeaders::IsInvalidName(const nsACString& aName, ErrorResult& aRv)
|
||||
{
|
||||
if (!NS_IsValidHTTPToken(aName)) {
|
||||
NS_ConvertUTF8toUTF16 label(aName);
|
||||
aRv.ThrowTypeError(MSG_INVALID_HEADER_NAME, &label);
|
||||
aRv.ThrowTypeError<MSG_INVALID_HEADER_NAME>(&label);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -198,7 +198,7 @@ InternalHeaders::IsInvalidValue(const nsACString& aValue, ErrorResult& aRv)
|
||||
{
|
||||
if (!NS_IsReasonableHTTPHeaderValue(aValue)) {
|
||||
NS_ConvertUTF8toUTF16 label(aValue);
|
||||
aRv.ThrowTypeError(MSG_INVALID_HEADER_VALUE, &label);
|
||||
aRv.ThrowTypeError<MSG_INVALID_HEADER_VALUE>(&label);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -208,7 +208,7 @@ bool
|
||||
InternalHeaders::IsImmutable(ErrorResult& aRv) const
|
||||
{
|
||||
if (mGuard == HeadersGuardEnum::Immutable) {
|
||||
aRv.ThrowTypeError(MSG_HEADERS_IMMUTABLE);
|
||||
aRv.ThrowTypeError<MSG_HEADERS_IMMUTABLE>();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -259,7 +259,7 @@ InternalHeaders::Fill(const Sequence<Sequence<nsCString>>& aInit, ErrorResult& a
|
||||
for (uint32_t i = 0; i < aInit.Length() && !aRv.Failed(); ++i) {
|
||||
const Sequence<nsCString>& tuple = aInit[i];
|
||||
if (tuple.Length() != 2) {
|
||||
aRv.ThrowTypeError(MSG_INVALID_HEADER_SEQUENCE);
|
||||
aRv.ThrowTypeError<MSG_INVALID_HEADER_SEQUENCE>();
|
||||
return;
|
||||
}
|
||||
Append(tuple[0], tuple[1], aRv);
|
||||
|
@ -83,7 +83,7 @@ GetRequestURLFromDocument(nsIDocument* aDocument, const nsAString& aInput,
|
||||
nsCOMPtr<nsIURI> resolvedURI;
|
||||
aRv = NS_NewURI(getter_AddRefs(resolvedURI), aInput, nullptr, baseURI);
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
aRv.ThrowTypeError(MSG_INVALID_URL, &aInput);
|
||||
aRv.ThrowTypeError<MSG_INVALID_URL>(&aInput);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -92,7 +92,7 @@ GetRequestURLFromDocument(nsIDocument* aDocument, const nsAString& aInput,
|
||||
nsAutoCString credentials;
|
||||
unused << resolvedURI->GetUserPass(credentials);
|
||||
if (!credentials.IsEmpty()) {
|
||||
aRv.ThrowTypeError(MSG_URL_HAS_CREDENTIALS, &aInput);
|
||||
aRv.ThrowTypeError<MSG_URL_HAS_CREDENTIALS>(&aInput);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -122,7 +122,7 @@ GetRequestURLFromChrome(const nsAString& aInput, nsAString& aRequestURL,
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
aRv = NS_NewURI(getter_AddRefs(uri), aInput, nullptr, nullptr);
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
aRv.ThrowTypeError(MSG_INVALID_URL, &aInput);
|
||||
aRv.ThrowTypeError<MSG_INVALID_URL>(&aInput);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -131,7 +131,7 @@ GetRequestURLFromChrome(const nsAString& aInput, nsAString& aRequestURL,
|
||||
nsAutoCString credentials;
|
||||
unused << uri->GetUserPass(credentials);
|
||||
if (!credentials.IsEmpty()) {
|
||||
aRv.ThrowTypeError(MSG_URL_HAS_CREDENTIALS, &aInput);
|
||||
aRv.ThrowTypeError<MSG_URL_HAS_CREDENTIALS>(&aInput);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -164,7 +164,7 @@ GetRequestURLFromWorker(const GlobalObject& aGlobal, const nsAString& aInput,
|
||||
nsRefPtr<workers::URL> url =
|
||||
workers::URL::Constructor(aGlobal, aInput, baseURL, aRv);
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
aRv.ThrowTypeError(MSG_INVALID_URL, &aInput);
|
||||
aRv.ThrowTypeError<MSG_INVALID_URL>(&aInput);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -181,7 +181,7 @@ GetRequestURLFromWorker(const GlobalObject& aGlobal, const nsAString& aInput,
|
||||
}
|
||||
|
||||
if (!username.IsEmpty() || !password.IsEmpty()) {
|
||||
aRv.ThrowTypeError(MSG_URL_HAS_CREDENTIALS, &aInput);
|
||||
aRv.ThrowTypeError<MSG_URL_HAS_CREDENTIALS>(&aInput);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -214,7 +214,7 @@ Request::Constructor(const GlobalObject& aGlobal,
|
||||
inputReq->GetBody(getter_AddRefs(body));
|
||||
if (body) {
|
||||
if (inputReq->BodyUsed()) {
|
||||
aRv.ThrowTypeError(MSG_FETCH_BODY_CONSUMED_ERROR);
|
||||
aRv.ThrowTypeError<MSG_FETCH_BODY_CONSUMED_ERROR>();
|
||||
return nullptr;
|
||||
}
|
||||
temporaryBody = body;
|
||||
@ -267,7 +267,7 @@ Request::Constructor(const GlobalObject& aGlobal,
|
||||
NS_NAMED_LITERAL_STRING(sourceDescription, "'mode' member of RequestInit");
|
||||
NS_NAMED_LITERAL_STRING(value, "cors-with-forced-preflight");
|
||||
NS_NAMED_LITERAL_STRING(type, "RequestMode");
|
||||
aRv.ThrowTypeError(MSG_INVALID_ENUM_VALUE, &sourceDescription, &value, &type);
|
||||
aRv.ThrowTypeError<MSG_INVALID_ENUM_VALUE>(&sourceDescription, &value, &type);
|
||||
return nullptr;
|
||||
}
|
||||
RequestMode mode = aInit.mMode.WasPassed() ? aInit.mMode.Value() : fallbackMode;
|
||||
@ -307,7 +307,7 @@ Request::Constructor(const GlobalObject& aGlobal,
|
||||
nsresult rv = FetchUtil::GetValidRequestMethod(method, outMethod);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_ConvertUTF8toUTF16 label(method);
|
||||
aRv.ThrowTypeError(MSG_INVALID_REQUEST_METHOD, &label);
|
||||
aRv.ThrowTypeError<MSG_INVALID_REQUEST_METHOD>(&label);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -341,7 +341,7 @@ Request::Constructor(const GlobalObject& aGlobal,
|
||||
nsAutoCString method;
|
||||
request->GetMethod(method);
|
||||
NS_ConvertUTF8toUTF16 label(method);
|
||||
aRv.ThrowTypeError(MSG_INVALID_REQUEST_METHOD, &label);
|
||||
aRv.ThrowTypeError<MSG_INVALID_REQUEST_METHOD>(&label);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -362,7 +362,7 @@ Request::Constructor(const GlobalObject& aGlobal,
|
||||
request->GetMethod(method);
|
||||
// method is guaranteed to be uppercase due to step 14.2 above.
|
||||
if (method.EqualsLiteral("HEAD") || method.EqualsLiteral("GET")) {
|
||||
aRv.ThrowTypeError(MSG_NO_BODY_ALLOWED_FOR_GET_AND_HEAD);
|
||||
aRv.ThrowTypeError<MSG_NO_BODY_ALLOWED_FOR_GET_AND_HEAD>();
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
@ -412,7 +412,7 @@ already_AddRefed<Request>
|
||||
Request::Clone(ErrorResult& aRv) const
|
||||
{
|
||||
if (BodyUsed()) {
|
||||
aRv.ThrowTypeError(MSG_FETCH_BODY_CONSUMED_ERROR);
|
||||
aRv.ThrowTypeError<MSG_FETCH_BODY_CONSUMED_ERROR>();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -100,7 +100,7 @@ Response::Redirect(const GlobalObject& aGlobal, const nsAString& aUrl,
|
||||
}
|
||||
|
||||
if (aStatus != 301 && aStatus != 302 && aStatus != 303 && aStatus != 307 && aStatus != 308) {
|
||||
aRv.ThrowRangeError(MSG_INVALID_REDIRECT_STATUSCODE_ERROR);
|
||||
aRv.ThrowRangeError<MSG_INVALID_REDIRECT_STATUSCODE_ERROR>();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -131,7 +131,7 @@ Response::Constructor(const GlobalObject& aGlobal,
|
||||
nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(aGlobal.GetAsSupports());
|
||||
|
||||
if (aInit.mStatus < 200 || aInit.mStatus > 599) {
|
||||
aRv.ThrowRangeError(MSG_INVALID_RESPONSE_STATUSCODE_ERROR);
|
||||
aRv.ThrowRangeError<MSG_INVALID_RESPONSE_STATUSCODE_ERROR>();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -142,13 +142,13 @@ Response::Constructor(const GlobalObject& aGlobal,
|
||||
statusText.BeginReading(start);
|
||||
statusText.EndReading(end);
|
||||
if (FindCharInReadable('\r', start, end)) {
|
||||
aRv.ThrowTypeError(MSG_RESPONSE_INVALID_STATUSTEXT_ERROR);
|
||||
aRv.ThrowTypeError<MSG_RESPONSE_INVALID_STATUSTEXT_ERROR>();
|
||||
return nullptr;
|
||||
}
|
||||
// Reset iterator since FindCharInReadable advances it.
|
||||
statusText.BeginReading(start);
|
||||
if (FindCharInReadable('\n', start, end)) {
|
||||
aRv.ThrowTypeError(MSG_RESPONSE_INVALID_STATUSTEXT_ERROR);
|
||||
aRv.ThrowTypeError<MSG_RESPONSE_INVALID_STATUSTEXT_ERROR>();
|
||||
return nullptr;
|
||||
}
|
||||
} else {
|
||||
@ -199,7 +199,7 @@ Response::Constructor(const GlobalObject& aGlobal,
|
||||
|
||||
if (aBody.WasPassed()) {
|
||||
if (aInit.mStatus == 204 || aInit.mStatus == 205 || aInit.mStatus == 304) {
|
||||
aRv.ThrowTypeError(MSG_RESPONSE_NULL_STATUS_WITH_BODY);
|
||||
aRv.ThrowTypeError<MSG_RESPONSE_NULL_STATUS_WITH_BODY>();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -226,7 +226,7 @@ already_AddRefed<Response>
|
||||
Response::Clone(ErrorResult& aRv) const
|
||||
{
|
||||
if (BodyUsed()) {
|
||||
aRv.ThrowTypeError(MSG_FETCH_BODY_CONSUMED_ERROR);
|
||||
aRv.ThrowTypeError<MSG_FETCH_BODY_CONSUMED_ERROR>();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -359,7 +359,7 @@ FileHandleBase::CheckStateAndArgumentsForRead(uint64_t aSize, ErrorResult& aRv)
|
||||
|
||||
// Argument checking for read
|
||||
if (!aSize) {
|
||||
aRv.ThrowTypeError(MSG_INVALID_READ_SIZE);
|
||||
aRv.ThrowTypeError<MSG_INVALID_READ_SIZE>();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -520,7 +520,7 @@ IDBCursor::Advance(uint32_t aCount, ErrorResult &aRv)
|
||||
AssertIsOnOwningThread();
|
||||
|
||||
if (!aCount) {
|
||||
aRv.ThrowTypeError(MSG_INVALID_ADVANCE_COUNT);
|
||||
aRv.ThrowTypeError<MSG_INVALID_ADVANCE_COUNT>();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -657,7 +657,7 @@ IDBFactory::OpenInternal(nsIPrincipal* aPrincipal,
|
||||
uint64_t version = 0;
|
||||
if (!aDeleting && aVersion.WasPassed()) {
|
||||
if (aVersion.Value() < 1) {
|
||||
aRv.ThrowTypeError(MSG_INVALID_VERSION);
|
||||
aRv.ThrowTypeError<MSG_INVALID_VERSION>();
|
||||
return nullptr;
|
||||
}
|
||||
version = aVersion.Value();
|
||||
|
@ -75,7 +75,7 @@ IDBFileHandle::GetMetadata(const IDBFileMetadataParameters& aParameters,
|
||||
|
||||
// Argument checking for get metadata.
|
||||
if (!aParameters.mSize && !aParameters.mLastModified) {
|
||||
aRv.ThrowTypeError(MSG_METADATA_NOT_CONFIGURED);
|
||||
aRv.ThrowTypeError<MSG_METADATA_NOT_CONFIGURED>();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -347,9 +347,7 @@ static bool
|
||||
IsMP4SupportedType(const nsACString& aType,
|
||||
const nsAString& aCodecs = EmptyString())
|
||||
{
|
||||
// MP4Decoder/Reader is currently used for MSE and mp4 files local playback.
|
||||
bool haveAAC, haveMP3, haveH264;
|
||||
return MP4Decoder::CanHandleMediaType(aType, aCodecs, haveAAC, haveH264, haveMP3);
|
||||
return MP4Decoder::CanHandleMediaType(aType, aCodecs);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -381,7 +381,6 @@ MediaDecoderStateMachine::CreateAudioSink()
|
||||
bool MediaDecoderStateMachine::HasFutureAudio()
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
AssertCurrentThreadInMonitor();
|
||||
NS_ASSERTION(HasAudio(), "Should only call HasFutureAudio() when we have audio");
|
||||
// We've got audio ready to play if:
|
||||
// 1. We've not completed playback of audio, and
|
||||
@ -397,7 +396,6 @@ bool MediaDecoderStateMachine::HasFutureAudio()
|
||||
bool MediaDecoderStateMachine::HaveNextFrameData()
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
AssertCurrentThreadInMonitor();
|
||||
return (!HasAudio() || HasFutureAudio()) &&
|
||||
(!HasVideo() || VideoQueue().GetSize() > 1);
|
||||
}
|
||||
@ -405,7 +403,6 @@ bool MediaDecoderStateMachine::HaveNextFrameData()
|
||||
int64_t MediaDecoderStateMachine::GetDecodedAudioDuration()
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
AssertCurrentThreadInMonitor();
|
||||
int64_t audioDecoded = AudioQueue().Duration();
|
||||
if (mMediaSink->IsStarted()) {
|
||||
audioDecoded += AudioEndTime() - GetMediaTime();
|
||||
@ -416,7 +413,6 @@ int64_t MediaDecoderStateMachine::GetDecodedAudioDuration()
|
||||
void MediaDecoderStateMachine::DiscardStreamData()
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
AssertCurrentThreadInMonitor();
|
||||
|
||||
const auto clockTime = GetClock();
|
||||
while (true) {
|
||||
@ -439,7 +435,6 @@ void MediaDecoderStateMachine::DiscardStreamData()
|
||||
bool MediaDecoderStateMachine::HaveEnoughDecodedAudio(int64_t aAmpleAudioUSecs)
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
AssertCurrentThreadInMonitor();
|
||||
|
||||
if (AudioQueue().GetSize() == 0 ||
|
||||
GetDecodedAudioDuration() < aAmpleAudioUSecs) {
|
||||
@ -454,7 +449,6 @@ bool MediaDecoderStateMachine::HaveEnoughDecodedAudio(int64_t aAmpleAudioUSecs)
|
||||
bool MediaDecoderStateMachine::HaveEnoughDecodedVideo()
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
AssertCurrentThreadInMonitor();
|
||||
|
||||
if (VideoQueue().GetSize() - 1 < GetAmpleVideoFrames() * mPlaybackRate) {
|
||||
return false;
|
||||
@ -467,7 +461,6 @@ bool
|
||||
MediaDecoderStateMachine::NeedToDecodeVideo()
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
AssertCurrentThreadInMonitor();
|
||||
SAMPLE_LOG("NeedToDecodeVideo() isDec=%d decToTar=%d minPrl=%d seek=%d enufVid=%d",
|
||||
IsVideoDecoding(), mDecodeToSeekTarget, mMinimizePreroll,
|
||||
mState == DECODER_STATE_SEEKING,
|
||||
@ -483,7 +476,6 @@ bool
|
||||
MediaDecoderStateMachine::NeedToSkipToNextKeyframe()
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
AssertCurrentThreadInMonitor();
|
||||
if (IsDecodingFirstFrame()) {
|
||||
return false;
|
||||
}
|
||||
@ -540,7 +532,6 @@ bool
|
||||
MediaDecoderStateMachine::NeedToDecodeAudio()
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
AssertCurrentThreadInMonitor();
|
||||
SAMPLE_LOG("NeedToDecodeAudio() isDec=%d decToTar=%d minPrl=%d seek=%d enufAud=%d",
|
||||
IsAudioDecoding(), mDecodeToSeekTarget, mMinimizePreroll,
|
||||
mState == DECODER_STATE_SEEKING,
|
||||
@ -559,7 +550,6 @@ bool
|
||||
MediaDecoderStateMachine::IsAudioSeekComplete()
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
AssertCurrentThreadInMonitor();
|
||||
SAMPLE_LOG("IsAudioSeekComplete() curTarVal=%d mAudDis=%d aqFin=%d aqSz=%d",
|
||||
mCurrentSeek.Exists(), mDropAudioUntilNextDiscontinuity, AudioQueue().IsFinished(), AudioQueue().GetSize());
|
||||
return
|
||||
@ -573,7 +563,6 @@ bool
|
||||
MediaDecoderStateMachine::IsVideoSeekComplete()
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
AssertCurrentThreadInMonitor();
|
||||
SAMPLE_LOG("IsVideoSeekComplete() curTarVal=%d mVidDis=%d vqFin=%d vqSz=%d",
|
||||
mCurrentSeek.Exists(), mDropVideoUntilNextDiscontinuity, VideoQueue().IsFinished(), VideoQueue().GetSize());
|
||||
return
|
||||
@ -587,7 +576,6 @@ void
|
||||
MediaDecoderStateMachine::OnAudioDecoded(MediaData* aAudioSample)
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
|
||||
nsRefPtr<MediaData> audio(aAudioSample);
|
||||
MOZ_ASSERT(audio);
|
||||
mAudioDataRequest.Complete();
|
||||
@ -707,7 +695,6 @@ void
|
||||
MediaDecoderStateMachine::OnAudioPopped(const nsRefPtr<MediaData>& aSample)
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
|
||||
mPlaybackOffset = std::max(mPlaybackOffset.Ref(), aSample->mOffset);
|
||||
UpdateNextFrameStatus();
|
||||
DispatchAudioDecodeTaskIfNeeded();
|
||||
@ -718,7 +705,6 @@ void
|
||||
MediaDecoderStateMachine::OnVideoPopped(const nsRefPtr<MediaData>& aSample)
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
|
||||
mPlaybackOffset = std::max(mPlaybackOffset.Ref(), aSample->mOffset);
|
||||
UpdateNextFrameStatus();
|
||||
DispatchVideoDecodeTaskIfNeeded();
|
||||
@ -730,7 +716,6 @@ MediaDecoderStateMachine::OnNotDecoded(MediaData::Type aType,
|
||||
MediaDecoderReader::NotDecodedReason aReason)
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
|
||||
SAMPLE_LOG("OnNotDecoded (aType=%u, aReason=%u)", aType, aReason);
|
||||
bool isAudio = aType == MediaData::AUDIO_DATA;
|
||||
MOZ_ASSERT_IF(!isAudio, aType == MediaData::VIDEO_DATA);
|
||||
@ -761,12 +746,10 @@ MediaDecoderStateMachine::OnNotDecoded(MediaData::Type aType,
|
||||
&MediaDecoderReader::WaitForData, aType)
|
||||
->Then(OwnerThread(), __func__,
|
||||
[self] (MediaData::Type aType) -> void {
|
||||
ReentrantMonitorAutoEnter mon(self->mDecoder->GetReentrantMonitor());
|
||||
self->WaitRequestRef(aType).Complete();
|
||||
self->DispatchDecodeTasksIfNeeded();
|
||||
},
|
||||
[self] (WaitForDataRejectValue aRejection) -> void {
|
||||
ReentrantMonitorAutoEnter mon(self->mDecoder->GetReentrantMonitor());
|
||||
self->WaitRequestRef(aRejection.mType).Complete();
|
||||
}));
|
||||
|
||||
@ -831,7 +814,6 @@ bool
|
||||
MediaDecoderStateMachine::MaybeFinishDecodeFirstFrame()
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
AssertCurrentThreadInMonitor();
|
||||
if (!IsDecodingFirstFrame() ||
|
||||
(IsAudioDecoding() && AudioQueue().GetSize() == 0) ||
|
||||
(IsVideoDecoding() && VideoQueue().GetSize() == 0)) {
|
||||
@ -853,7 +835,6 @@ void
|
||||
MediaDecoderStateMachine::OnVideoDecoded(MediaData* aVideoSample)
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
|
||||
nsRefPtr<MediaData> video(aVideoSample);
|
||||
MOZ_ASSERT(video);
|
||||
mVideoDataRequest.Complete();
|
||||
@ -968,7 +949,6 @@ void
|
||||
MediaDecoderStateMachine::CheckIfSeekComplete()
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
AssertCurrentThreadInMonitor();
|
||||
MOZ_ASSERT(mState == DECODER_STATE_SEEKING);
|
||||
|
||||
const bool videoSeekComplete = IsVideoSeekComplete();
|
||||
@ -1002,7 +982,6 @@ bool
|
||||
MediaDecoderStateMachine::IsAudioDecoding()
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
AssertCurrentThreadInMonitor();
|
||||
return HasAudio() && !AudioQueue().IsFinished();
|
||||
}
|
||||
|
||||
@ -1010,7 +989,6 @@ bool
|
||||
MediaDecoderStateMachine::IsVideoDecoding()
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
AssertCurrentThreadInMonitor();
|
||||
return HasVideo() && !VideoQueue().IsFinished();
|
||||
}
|
||||
|
||||
@ -1018,7 +996,7 @@ void
|
||||
MediaDecoderStateMachine::CheckIfDecodeComplete()
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
AssertCurrentThreadInMonitor();
|
||||
|
||||
if (IsShutdown() ||
|
||||
mState == DECODER_STATE_SEEKING ||
|
||||
mState == DECODER_STATE_COMPLETED) {
|
||||
@ -1039,7 +1017,7 @@ MediaDecoderStateMachine::CheckIfDecodeComplete()
|
||||
|
||||
bool MediaDecoderStateMachine::IsPlaying() const
|
||||
{
|
||||
AssertCurrentThreadInMonitor();
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
return mMediaSink->IsPlaying();
|
||||
}
|
||||
|
||||
@ -1063,8 +1041,6 @@ void MediaDecoderStateMachine::StopPlayback()
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
DECODER_LOG("StopPlayback()");
|
||||
|
||||
AssertCurrentThreadInMonitor();
|
||||
|
||||
mDecoder->DispatchPlaybackStopped();
|
||||
|
||||
if (IsPlaying()) {
|
||||
@ -1079,7 +1055,6 @@ void MediaDecoderStateMachine::StopPlayback()
|
||||
void MediaDecoderStateMachine::MaybeStartPlayback()
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
AssertCurrentThreadInMonitor();
|
||||
MOZ_ASSERT(mState == DECODER_STATE_DECODING ||
|
||||
mState == DECODER_STATE_COMPLETED);
|
||||
|
||||
@ -1115,7 +1090,6 @@ void
|
||||
MediaDecoderStateMachine::MaybeStartBuffering()
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
AssertCurrentThreadInMonitor();
|
||||
|
||||
if (mState == DECODER_STATE_DECODING &&
|
||||
mPlayState == MediaDecoder::PLAY_STATE_PLAYING &&
|
||||
@ -1143,7 +1117,6 @@ void MediaDecoderStateMachine::UpdatePlaybackPositionInternal(int64_t aTime)
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
SAMPLE_LOG("UpdatePlaybackPositionInternal(%lld)", aTime);
|
||||
AssertCurrentThreadInMonitor();
|
||||
|
||||
mCurrentPosition = aTime;
|
||||
NS_ASSERTION(mCurrentPosition >= 0, "CurrentTime should be positive!");
|
||||
@ -1180,7 +1153,6 @@ static const char* const gMachineStateStr[] = {
|
||||
void MediaDecoderStateMachine::SetState(State aState)
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
AssertCurrentThreadInMonitor();
|
||||
if (mState == aState) {
|
||||
return;
|
||||
}
|
||||
@ -1198,14 +1170,12 @@ void MediaDecoderStateMachine::SetState(State aState)
|
||||
void MediaDecoderStateMachine::VolumeChanged()
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
|
||||
mMediaSink->SetVolume(mVolume);
|
||||
}
|
||||
|
||||
void MediaDecoderStateMachine::RecomputeDuration()
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
|
||||
|
||||
TimeUnit duration;
|
||||
if (mExplicitDuration.Ref().isSome()) {
|
||||
@ -1246,7 +1216,6 @@ void
|
||||
MediaDecoderStateMachine::SetDormant(bool aDormant)
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
|
||||
|
||||
if (IsShutdown()) {
|
||||
return;
|
||||
@ -1311,8 +1280,6 @@ void MediaDecoderStateMachine::Shutdown()
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
|
||||
// Once we've entered the shutdown state here there's no going back.
|
||||
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
|
||||
|
||||
// Change state before issuing shutdown request to threads so those
|
||||
// threads can start exiting cleanly during the Shutdown call.
|
||||
ScheduleStateMachine();
|
||||
@ -1351,7 +1318,6 @@ void MediaDecoderStateMachine::Shutdown()
|
||||
void MediaDecoderStateMachine::StartDecoding()
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
|
||||
if (mState == DECODER_STATE_DECODING && !mDecodingFirstFrame) {
|
||||
return;
|
||||
}
|
||||
@ -1398,7 +1364,6 @@ void MediaDecoderStateMachine::StartDecoding()
|
||||
void MediaDecoderStateMachine::PlayStateChanged()
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
|
||||
|
||||
// This method used to be a Play() method invoked by MediaDecoder when the
|
||||
// play state became PLAY_STATE_PLAYING. As such, it doesn't have any work to
|
||||
@ -1442,14 +1407,12 @@ void MediaDecoderStateMachine::PlayStateChanged()
|
||||
void MediaDecoderStateMachine::LogicallySeekingChanged()
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
|
||||
ScheduleStateMachine();
|
||||
}
|
||||
|
||||
void MediaDecoderStateMachine::SameOriginMediaChanged()
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
|
||||
mStreamSink->SetSameOrigin(mSameOriginMedia);
|
||||
}
|
||||
|
||||
@ -1475,7 +1438,6 @@ nsRefPtr<MediaDecoder::SeekPromise>
|
||||
MediaDecoderStateMachine::Seek(SeekTarget aTarget)
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
|
||||
|
||||
if (IsShutdown()) {
|
||||
return MediaDecoder::SeekPromise::CreateAndReject(/* aIgnored = */ true, __func__);
|
||||
@ -1519,8 +1481,6 @@ MediaDecoderStateMachine::InvokeSeek(SeekTarget aTarget)
|
||||
void MediaDecoderStateMachine::StopMediaSink()
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
AssertCurrentThreadInMonitor();
|
||||
|
||||
if (mMediaSink->IsStarted()) {
|
||||
DECODER_LOG("Stop MediaSink");
|
||||
mMediaSink->Stop();
|
||||
@ -1532,7 +1492,6 @@ void
|
||||
MediaDecoderStateMachine::DispatchDecodeTasksIfNeeded()
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
AssertCurrentThreadInMonitor();
|
||||
|
||||
if (mState != DECODER_STATE_DECODING &&
|
||||
mState != DECODER_STATE_BUFFERING &&
|
||||
@ -1591,7 +1550,6 @@ void
|
||||
MediaDecoderStateMachine::InitiateSeek()
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
AssertCurrentThreadInMonitor();
|
||||
|
||||
mCurrentSeek.RejectIfExists(__func__);
|
||||
mCurrentSeek.Steal(mPendingSeek);
|
||||
@ -1633,14 +1591,12 @@ MediaDecoderStateMachine::InitiateSeek()
|
||||
Duration().ToMicroseconds())
|
||||
->Then(OwnerThread(), __func__,
|
||||
[self] (int64_t) -> void {
|
||||
ReentrantMonitorAutoEnter mon(self->mDecoder->GetReentrantMonitor());
|
||||
self->mSeekRequest.Complete();
|
||||
// We must decode the first samples of active streams, so we can determine
|
||||
// the new stream time. So dispatch tasks to do that.
|
||||
self->mDecodeToSeekTarget = true;
|
||||
self->DispatchDecodeTasksIfNeeded();
|
||||
}, [self] (nsresult aResult) -> void {
|
||||
ReentrantMonitorAutoEnter mon(self->mDecoder->GetReentrantMonitor());
|
||||
self->mSeekRequest.Complete();
|
||||
MOZ_ASSERT(NS_FAILED(aResult), "Cancels should also disconnect mSeekRequest");
|
||||
self->DecodeError();
|
||||
@ -1651,7 +1607,6 @@ nsresult
|
||||
MediaDecoderStateMachine::DispatchAudioDecodeTaskIfNeeded()
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
|
||||
|
||||
if (IsShutdown()) {
|
||||
return NS_ERROR_FAILURE;
|
||||
@ -1668,7 +1623,6 @@ nsresult
|
||||
MediaDecoderStateMachine::EnsureAudioDecodeTaskQueued()
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
AssertCurrentThreadInMonitor();
|
||||
|
||||
SAMPLE_LOG("EnsureAudioDecodeTaskQueued isDecoding=%d status=%s",
|
||||
IsAudioDecoding(), AudioRequestStatus());
|
||||
@ -1692,7 +1646,6 @@ void
|
||||
MediaDecoderStateMachine::RequestAudioData()
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
AssertCurrentThreadInMonitor();
|
||||
|
||||
SAMPLE_LOG("Queueing audio task - queued=%i, decoder-queued=%o",
|
||||
AudioQueue().GetSize(), mReader->SizeOfAudioQueueInFrames());
|
||||
@ -1722,7 +1675,6 @@ nsresult
|
||||
MediaDecoderStateMachine::DispatchVideoDecodeTaskIfNeeded()
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
|
||||
|
||||
if (IsShutdown()) {
|
||||
return NS_ERROR_FAILURE;
|
||||
@ -1739,7 +1691,6 @@ nsresult
|
||||
MediaDecoderStateMachine::EnsureVideoDecodeTaskQueued()
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
AssertCurrentThreadInMonitor();
|
||||
|
||||
SAMPLE_LOG("EnsureVideoDecodeTaskQueued isDecoding=%d status=%s",
|
||||
IsVideoDecoding(), VideoRequestStatus());
|
||||
@ -1763,7 +1714,6 @@ void
|
||||
MediaDecoderStateMachine::RequestVideoData()
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
AssertCurrentThreadInMonitor();
|
||||
|
||||
// Time the video decode, so that if it's slow, we can increase our low
|
||||
// audio threshold to reduce the chance of an audio underrun while we're
|
||||
@ -1805,8 +1755,6 @@ void
|
||||
MediaDecoderStateMachine::StartMediaSink()
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
AssertCurrentThreadInMonitor();
|
||||
|
||||
if (!mMediaSink->IsStarted()) {
|
||||
mAudioCompleted = false;
|
||||
mMediaSink->Start(GetMediaTime(), mInfo);
|
||||
@ -1842,7 +1790,6 @@ int64_t MediaDecoderStateMachine::AudioDecodedUsecs()
|
||||
bool MediaDecoderStateMachine::HasLowDecodedData(int64_t aAudioUsecs)
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
AssertCurrentThreadInMonitor();
|
||||
MOZ_ASSERT(mReader->UseBufferingHeuristics());
|
||||
// We consider ourselves low on decoded data if we're low on audio,
|
||||
// provided we've not decoded to the end of the audio stream, or
|
||||
@ -1870,7 +1817,6 @@ bool MediaDecoderStateMachine::HasLowUndecodedData()
|
||||
bool MediaDecoderStateMachine::HasLowUndecodedData(int64_t aUsecs)
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
AssertCurrentThreadInMonitor();
|
||||
NS_ASSERTION(mState >= DECODER_STATE_DECODING && !IsDecodingFirstFrame(),
|
||||
"Must have loaded first frame for mBuffered to be valid");
|
||||
|
||||
@ -1910,7 +1856,7 @@ void
|
||||
MediaDecoderStateMachine::DecodeError()
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
|
||||
|
||||
if (IsShutdown()) {
|
||||
// Already shutdown.
|
||||
return;
|
||||
@ -1934,7 +1880,6 @@ MediaDecoderStateMachine::OnMetadataRead(MetadataHolder* aMetadata)
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
MOZ_ASSERT(mState == DECODER_STATE_DECODING_METADATA);
|
||||
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
|
||||
mMetadataRequest.Complete();
|
||||
|
||||
// Set mode to PLAYBACK after reading metadata.
|
||||
@ -2014,7 +1959,6 @@ MediaDecoderStateMachine::OnMetadataNotRead(ReadMetadataFailureReason aReason)
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
MOZ_ASSERT(mState == DECODER_STATE_DECODING_METADATA);
|
||||
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
|
||||
mMetadataRequest.Complete();
|
||||
DECODER_WARN("Decode metadata failed, shutting down decoder");
|
||||
DecodeError();
|
||||
@ -2060,7 +2004,6 @@ void
|
||||
MediaDecoderStateMachine::AdjustAudioThresholds()
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
|
||||
|
||||
// Experiments show that we need to buffer more if audio is captured to avoid
|
||||
// audio glitch. See bug 1188643 comment 16 for the details.
|
||||
@ -2087,7 +2030,6 @@ void
|
||||
MediaDecoderStateMachine::FinishDecodeFirstFrame()
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
AssertCurrentThreadInMonitor();
|
||||
DECODER_LOG("FinishDecodeFirstFrame");
|
||||
|
||||
if (!IsRealTime() && !mSentFirstFrameLoadedEvent) {
|
||||
@ -2104,10 +2046,7 @@ MediaDecoderStateMachine::FinishDecodeFirstFrame()
|
||||
Duration().ToMicroseconds(), mResource->IsTransportSeekable(), mMediaSeekable.Ref());
|
||||
|
||||
// Get potentially updated metadata
|
||||
{
|
||||
ReentrantMonitorAutoExit exitMon(mDecoder->GetReentrantMonitor());
|
||||
mReader->ReadUpdatedMetadata(&mInfo);
|
||||
}
|
||||
mReader->ReadUpdatedMetadata(&mInfo);
|
||||
|
||||
if (!mNotifyMetadataBeforeFirstFrame) {
|
||||
// If we didn't have duration and/or start time before, we should now.
|
||||
@ -2122,7 +2061,6 @@ void
|
||||
MediaDecoderStateMachine::SeekCompleted()
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
|
||||
MOZ_ASSERT(mState == DECODER_STATE_SEEKING);
|
||||
|
||||
int64_t seekTime = mCurrentSeek.mTarget.mTime;
|
||||
@ -2236,7 +2174,6 @@ void
|
||||
MediaDecoderStateMachine::FinishShutdown()
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
|
||||
|
||||
// The reader's listeners hold references to the state machine,
|
||||
// creating a cycle which keeps the state machine and its shared
|
||||
@ -2298,7 +2235,6 @@ MediaDecoderStateMachine::FinishShutdown()
|
||||
nsresult MediaDecoderStateMachine::RunStateMachine()
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
|
||||
|
||||
mDelayedScheduler.Reset(); // Must happen on state machine task queue.
|
||||
mDispatchedStateMachine = false;
|
||||
@ -2468,7 +2404,6 @@ void
|
||||
MediaDecoderStateMachine::Reset()
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
AssertCurrentThreadInMonitor();
|
||||
DECODER_LOG("MediaDecoderStateMachine::Reset");
|
||||
|
||||
// We should be resetting because we're seeking, shutting down, or entering
|
||||
@ -2513,7 +2448,6 @@ MediaDecoderStateMachine::Reset()
|
||||
bool MediaDecoderStateMachine::CheckFrameValidity(VideoData* aData)
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
AssertCurrentThreadInMonitor();
|
||||
|
||||
// If we've sent this frame before then only return the valid state,
|
||||
// don't update the statistics.
|
||||
@ -2550,7 +2484,6 @@ void MediaDecoderStateMachine::RenderVideoFrames(int32_t aMaxFrames,
|
||||
const TimeStamp& aClockTimeStamp)
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
AssertCurrentThreadInMonitor();
|
||||
|
||||
VideoFrameContainer* container = mDecoder->GetVideoFrameContainer();
|
||||
nsAutoTArray<nsRefPtr<MediaData>,16> frames;
|
||||
@ -2613,7 +2546,6 @@ int64_t
|
||||
MediaDecoderStateMachine::GetClock(TimeStamp* aTimeStamp) const
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
AssertCurrentThreadInMonitor();
|
||||
int64_t clockTime = mMediaSink->GetPosition(aTimeStamp);
|
||||
NS_ASSERTION(GetMediaTime() <= clockTime, "Clock should go forwards.");
|
||||
return clockTime;
|
||||
@ -2622,7 +2554,6 @@ MediaDecoderStateMachine::GetClock(TimeStamp* aTimeStamp) const
|
||||
void MediaDecoderStateMachine::UpdateRenderedVideoFrames()
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
AssertCurrentThreadInMonitor();
|
||||
|
||||
if (!IsPlaying() || mLogicallySeeking) {
|
||||
return;
|
||||
@ -2802,7 +2733,6 @@ MediaDecoderStateMachine::DropAudioUpToSeekTarget(MediaData* aSample)
|
||||
void MediaDecoderStateMachine::UpdateNextFrameStatus()
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
|
||||
|
||||
MediaDecoderOwner::NextFrameStatus status;
|
||||
const char* statusString;
|
||||
@ -2863,7 +2793,6 @@ MediaDecoderStateMachine::GetStatistics()
|
||||
void MediaDecoderStateMachine::StartBuffering()
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
|
||||
|
||||
if (mState != DECODER_STATE_DECODING) {
|
||||
// We only move into BUFFERING state if we're actually decoding.
|
||||
@ -2900,7 +2829,6 @@ void
|
||||
MediaDecoderStateMachine::ScheduleStateMachine()
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
AssertCurrentThreadInMonitor();
|
||||
if (mDispatchedStateMachine) {
|
||||
return;
|
||||
}
|
||||
@ -2914,7 +2842,6 @@ MediaDecoderStateMachine::ScheduleStateMachine()
|
||||
void
|
||||
MediaDecoderStateMachine::ScheduleStateMachineIn(int64_t aMicroseconds)
|
||||
{
|
||||
AssertCurrentThreadInMonitor();
|
||||
MOZ_ASSERT(OnTaskQueue()); // mDelayedScheduler.Ensure() may Disconnect()
|
||||
// the promise, which must happen on the state
|
||||
// machine task queue.
|
||||
@ -2955,7 +2882,6 @@ void
|
||||
MediaDecoderStateMachine::LogicalPlaybackRateChanged()
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
|
||||
|
||||
if (mLogicalPlaybackRate == 0) {
|
||||
// This case is handled in MediaDecoder by pausing playback.
|
||||
@ -2971,7 +2897,6 @@ MediaDecoderStateMachine::LogicalPlaybackRateChanged()
|
||||
void MediaDecoderStateMachine::PreservesPitchChanged()
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
|
||||
mMediaSink->SetPreservesPitch(mPreservesPitch);
|
||||
}
|
||||
|
||||
@ -2985,7 +2910,6 @@ int64_t
|
||||
MediaDecoderStateMachine::AudioEndTime() const
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
AssertCurrentThreadInMonitor();
|
||||
if (mMediaSink->IsStarted()) {
|
||||
return mMediaSink->GetEndTime(TrackInfo::kAudioTrack);
|
||||
}
|
||||
@ -2996,7 +2920,6 @@ MediaDecoderStateMachine::AudioEndTime() const
|
||||
void MediaDecoderStateMachine::OnMediaSinkComplete()
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
|
||||
|
||||
mMediaSinkPromise.Complete();
|
||||
// Set true only when we have audio.
|
||||
@ -3008,7 +2931,6 @@ void MediaDecoderStateMachine::OnMediaSinkComplete()
|
||||
void MediaDecoderStateMachine::OnMediaSinkError()
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
|
||||
|
||||
mMediaSinkPromise.Complete();
|
||||
// Set true only when we have audio.
|
||||
@ -3049,7 +2971,6 @@ void
|
||||
MediaDecoderStateMachine::SetAudioCaptured(bool aCaptured)
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
|
||||
|
||||
if (aCaptured == mAudioCaptured) {
|
||||
return;
|
||||
@ -3082,7 +3003,6 @@ MediaDecoderStateMachine::SetAudioCaptured(bool aCaptured)
|
||||
uint32_t MediaDecoderStateMachine::GetAmpleVideoFrames() const
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
AssertCurrentThreadInMonitor();
|
||||
return (mReader->IsAsync() && mReader->VideoIsHardwareAccelerated())
|
||||
? std::max<uint32_t>(sVideoQueueHWAccelSize, MIN_VIDEO_QUEUE_SIZE)
|
||||
: std::max<uint32_t>(sVideoQueueDefaultSize, MIN_VIDEO_QUEUE_SIZE);
|
||||
|
@ -185,7 +185,6 @@ public:
|
||||
nsCOMPtr<nsIRunnable> r = NS_NewRunnableFunction([self] () -> void
|
||||
{
|
||||
MOZ_ASSERT(self->OnTaskQueue());
|
||||
ReentrantMonitorAutoEnter mon(self->mDecoder->GetReentrantMonitor());
|
||||
self->mMinimizePreroll = true;
|
||||
|
||||
// Make sure that this arrives before playback starts, otherwise this won't
|
||||
@ -209,7 +208,6 @@ public:
|
||||
{
|
||||
nsRefPtr<MediaDecoderStateMachine> self = this;
|
||||
nsCOMPtr<nsIRunnable> r = NS_NewRunnableFunction([=] () {
|
||||
ReentrantMonitorAutoEnter mon(self->mDecoder->GetReentrantMonitor());
|
||||
if (self->mAudioOffloading != aAudioOffloading) {
|
||||
self->mAudioOffloading = aAudioOffloading;
|
||||
self->ScheduleStateMachine();
|
||||
@ -291,7 +289,6 @@ private:
|
||||
// The decoder monitor must be obtained before calling this.
|
||||
bool HasAudio() const {
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
AssertCurrentThreadInMonitor();
|
||||
return mInfo.HasAudio();
|
||||
}
|
||||
|
||||
@ -299,7 +296,6 @@ private:
|
||||
// The decoder monitor must be obtained before calling this.
|
||||
bool HasVideo() const {
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
AssertCurrentThreadInMonitor();
|
||||
return mInfo.HasVideo();
|
||||
}
|
||||
|
||||
@ -309,14 +305,12 @@ private:
|
||||
// Must be called with the decode monitor held.
|
||||
bool IsBuffering() const {
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
AssertCurrentThreadInMonitor();
|
||||
return mState == DECODER_STATE_BUFFERING;
|
||||
}
|
||||
|
||||
// Must be called with the decode monitor held.
|
||||
bool IsSeeking() const {
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
AssertCurrentThreadInMonitor();
|
||||
return mState == DECODER_STATE_SEEKING;
|
||||
}
|
||||
|
||||
@ -344,7 +338,6 @@ private:
|
||||
void OnDelayedSchedule()
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
|
||||
mDelayedScheduler.CompleteRequest();
|
||||
ScheduleStateMachine();
|
||||
}
|
||||
@ -385,8 +378,6 @@ private:
|
||||
protected:
|
||||
virtual ~MediaDecoderStateMachine();
|
||||
|
||||
void AssertCurrentThreadInMonitor() const { mDecoder->GetReentrantMonitor().AssertCurrentThreadIn(); }
|
||||
|
||||
void SetState(State aState);
|
||||
|
||||
void BufferedRangeUpdated();
|
||||
@ -588,7 +579,6 @@ protected:
|
||||
// which is in the range [0,duration].
|
||||
int64_t GetMediaTime() const {
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
AssertCurrentThreadInMonitor();
|
||||
return mCurrentPosition;
|
||||
}
|
||||
|
||||
@ -1053,7 +1043,6 @@ private:
|
||||
bool DonePrerollingAudio()
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
AssertCurrentThreadInMonitor();
|
||||
return !IsAudioDecoding() ||
|
||||
GetDecodedAudioDuration() >= AudioPrerollUsecs() * mPlaybackRate;
|
||||
}
|
||||
@ -1061,7 +1050,6 @@ private:
|
||||
bool DonePrerollingVideo()
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
AssertCurrentThreadInMonitor();
|
||||
return !IsVideoDecoding() ||
|
||||
static_cast<uint32_t>(VideoQueue().GetSize()) >=
|
||||
VideoPrerollFrames() * mPlaybackRate + 1;
|
||||
@ -1070,7 +1058,6 @@ private:
|
||||
void StopPrerollingAudio()
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
AssertCurrentThreadInMonitor();
|
||||
if (mIsAudioPrerolling) {
|
||||
mIsAudioPrerolling = false;
|
||||
ScheduleStateMachine();
|
||||
@ -1080,7 +1067,6 @@ private:
|
||||
void StopPrerollingVideo()
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
AssertCurrentThreadInMonitor();
|
||||
if (mIsVideoPrerolling) {
|
||||
mIsVideoPrerolling = false;
|
||||
ScheduleStateMachine();
|
||||
|
@ -988,7 +988,7 @@ MediaRecorder::Constructor(const GlobalObject& aGlobal,
|
||||
// Pretending that this constructor is not defined.
|
||||
NS_NAMED_LITERAL_STRING(argStr, "Argument 1 of MediaRecorder.constructor");
|
||||
NS_NAMED_LITERAL_STRING(typeStr, "MediaStream");
|
||||
aRv.ThrowTypeError(MSG_DOES_NOT_IMPLEMENT_INTERFACE, &argStr, &typeStr);
|
||||
aRv.ThrowTypeError<MSG_DOES_NOT_IMPLEMENT_INTERFACE>(&argStr, &typeStr);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -469,6 +469,15 @@ LogToBrowserConsole(const nsAString& aMsg)
|
||||
console->LogStringMessage(msg.get());
|
||||
}
|
||||
|
||||
bool
|
||||
IsAACCodecString(const nsAString& aCodec)
|
||||
{
|
||||
return
|
||||
aCodec.EqualsLiteral("mp4a.40.2") || // MPEG4 AAC-LC
|
||||
aCodec.EqualsLiteral("mp4a.40.5") || // MPEG4 HE-AAC
|
||||
aCodec.EqualsLiteral("mp4a.67"); // MPEG2 AAC-LC}
|
||||
}
|
||||
|
||||
bool
|
||||
ParseCodecsString(const nsAString& aCodecs, nsTArray<nsString>& aOutCodecs)
|
||||
{
|
||||
|
@ -338,6 +338,9 @@ IsH264ContentType(const nsAString& aContentType);
|
||||
bool
|
||||
IsAACContentType(const nsAString& aContentType);
|
||||
|
||||
bool
|
||||
IsAACCodecString(const nsAString& aCodec);
|
||||
|
||||
} // end namespace mozilla
|
||||
|
||||
#endif
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "mozilla/Logging.h"
|
||||
#include "nsMimeTypes.h"
|
||||
#include "nsContentTypeParser.h"
|
||||
#include "VideoUtils.h"
|
||||
|
||||
#ifdef XP_WIN
|
||||
#include "mozilla/WindowsVersion.h"
|
||||
@ -53,30 +54,7 @@ MediaDecoderStateMachine* MP4Decoder::CreateStateMachine()
|
||||
}
|
||||
|
||||
static bool
|
||||
IsSupportedAudioCodec(const nsAString& aCodec,
|
||||
bool& aOutContainsAAC,
|
||||
bool& aOutContainsMP3)
|
||||
{
|
||||
// AAC-LC or HE-AAC in M4A.
|
||||
aOutContainsAAC = aCodec.EqualsASCII("mp4a.40.2") // MPEG4 AAC-LC
|
||||
|| aCodec.EqualsASCII("mp4a.40.5") // MPEG4 HE-AAC
|
||||
|| aCodec.EqualsASCII("mp4a.67"); // MPEG2 AAC-LC
|
||||
if (aOutContainsAAC) {
|
||||
return true;
|
||||
}
|
||||
#ifndef MOZ_GONK_MEDIACODEC // B2G doesn't support MP3 in MP4 yet.
|
||||
aOutContainsMP3 = aCodec.EqualsASCII("mp3");
|
||||
if (aOutContainsMP3) {
|
||||
return true;
|
||||
}
|
||||
#else
|
||||
aOutContainsMP3 = false;
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool
|
||||
IsSupportedH264Codec(const nsAString& aCodec)
|
||||
IsWhitelistedH264Codec(const nsAString& aCodec)
|
||||
{
|
||||
int16_t profile = 0, level = 0;
|
||||
|
||||
@ -110,52 +88,76 @@ IsSupportedH264Codec(const nsAString& aCodec)
|
||||
|
||||
/* static */
|
||||
bool
|
||||
MP4Decoder::CanHandleMediaType(const nsACString& aType,
|
||||
const nsAString& aCodecs,
|
||||
bool& aOutContainsAAC,
|
||||
bool& aOutContainsH264,
|
||||
bool& aOutContainsMP3)
|
||||
MP4Decoder::CanHandleMediaType(const nsACString& aMIMETypeExcludingCodecs,
|
||||
const nsAString& aCodecs)
|
||||
{
|
||||
if (!IsEnabled()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (aType.EqualsASCII("audio/mp4") || aType.EqualsASCII("audio/x-m4a")) {
|
||||
return MP4Decoder::CanCreateAACDecoder() &&
|
||||
(aCodecs.IsEmpty() ||
|
||||
IsSupportedAudioCodec(aCodecs,
|
||||
aOutContainsAAC,
|
||||
aOutContainsMP3));
|
||||
// Whitelist MP4 types, so they explicitly match what we encounter on
|
||||
// the web, as opposed to what we use internally (i.e. what our demuxers
|
||||
// etc output).
|
||||
const bool isMP4Audio = aMIMETypeExcludingCodecs.EqualsASCII("audio/mp4") ||
|
||||
aMIMETypeExcludingCodecs.EqualsASCII("audio/x-m4a");
|
||||
const bool isMP4Video = aMIMETypeExcludingCodecs.EqualsASCII("video/mp4") ||
|
||||
aMIMETypeExcludingCodecs.EqualsASCII("video/x-m4v");
|
||||
if (!isMP4Audio && !isMP4Video) {
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef MOZ_GONK_MEDIACODEC
|
||||
if (aType.EqualsASCII(VIDEO_3GPP)) {
|
||||
if (aMIMETypeExcludingCodecs.EqualsASCII(VIDEO_3GPP)) {
|
||||
return Preferences::GetBool("media.fragmented-mp4.gonk.enabled", false);
|
||||
}
|
||||
#endif
|
||||
if ((!aType.EqualsASCII("video/mp4") && !aType.EqualsASCII("video/x-m4v")) ||
|
||||
!MP4Decoder::CanCreateH264Decoder()) {
|
||||
return false;
|
||||
|
||||
nsTArray<nsCString> codecMimes;
|
||||
if (aCodecs.IsEmpty()) {
|
||||
// No codecs specified. Assume AAC/H.264
|
||||
if (isMP4Audio) {
|
||||
codecMimes.AppendElement(NS_LITERAL_CSTRING("audio/mp4a-latm"));
|
||||
} else {
|
||||
MOZ_ASSERT(isMP4Video);
|
||||
codecMimes.AppendElement(NS_LITERAL_CSTRING("video/avc"));
|
||||
}
|
||||
} else {
|
||||
// Verify that all the codecs specified are ones that we expect that
|
||||
// we can play.
|
||||
nsTArray<nsString> codecs;
|
||||
if (!ParseCodecsString(aCodecs, codecs)) {
|
||||
return false;
|
||||
}
|
||||
for (const nsString& codec : codecs) {
|
||||
if (IsAACCodecString(codec)) {
|
||||
codecMimes.AppendElement(NS_LITERAL_CSTRING("audio/mp4a-latm"));
|
||||
continue;
|
||||
}
|
||||
if (codec.EqualsLiteral("mp3")) {
|
||||
codecMimes.AppendElement(NS_LITERAL_CSTRING("audio/mpeg"));
|
||||
continue;
|
||||
}
|
||||
// Note: Only accept H.264 in a video content type, not in an audio
|
||||
// content type.
|
||||
if (IsWhitelistedH264Codec(codec) && isMP4Video) {
|
||||
codecMimes.AppendElement(NS_LITERAL_CSTRING("video/avc"));
|
||||
continue;
|
||||
}
|
||||
// Some unsupported codec.
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Verify that all the codecs specifed are ones that we expect that
|
||||
// we can play.
|
||||
nsTArray<nsString> codecs;
|
||||
if (!ParseCodecsString(aCodecs, codecs)) {
|
||||
// Verify that we have a PDM that supports the whitelisted types.
|
||||
PlatformDecoderModule::Init();
|
||||
nsRefPtr<PlatformDecoderModule> platform = PlatformDecoderModule::Create();
|
||||
if (!platform) {
|
||||
return false;
|
||||
}
|
||||
for (const nsString& codec : codecs) {
|
||||
if (IsSupportedAudioCodec(codec,
|
||||
aOutContainsAAC,
|
||||
aOutContainsMP3)) {
|
||||
continue;
|
||||
for (const nsCString& codecMime : codecMimes) {
|
||||
if (!platform->SupportsMimeType(codecMime)) {
|
||||
return false;
|
||||
}
|
||||
if (IsSupportedH264Codec(codec)) {
|
||||
aOutContainsH264 = true;
|
||||
continue;
|
||||
}
|
||||
// Some unsupported codec.
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -173,10 +175,7 @@ MP4Decoder::CanHandleMediaType(const nsAString& aContentType)
|
||||
nsString codecs;
|
||||
parser.GetParameter("codecs", codecs);
|
||||
|
||||
bool ignoreAAC, ignoreH264, ignoreMP3;
|
||||
return CanHandleMediaType(NS_ConvertUTF16toUTF8(mimeType),
|
||||
codecs,
|
||||
ignoreAAC, ignoreH264, ignoreMP3);
|
||||
return CanHandleMediaType(NS_ConvertUTF16toUTF8(mimeType), codecs);
|
||||
}
|
||||
|
||||
static bool
|
||||
|
@ -29,11 +29,8 @@ public:
|
||||
// a MP4 platform decoder backend. If aCodecs is non emtpy, it is filled
|
||||
// with a comma-delimited list of codecs to check support for. Notes in
|
||||
// out params wether the codecs string contains AAC or H.264.
|
||||
static bool CanHandleMediaType(const nsACString& aMIMEType,
|
||||
const nsAString& aCodecs,
|
||||
bool& aOutContainsAAC,
|
||||
bool& aOutContainsH264,
|
||||
bool& aOutContainsMP3);
|
||||
static bool CanHandleMediaType(const nsACString& aMIMETypeExcludingCodecs,
|
||||
const nsAString& aCodecs);
|
||||
|
||||
static bool CanHandleMediaType(const nsAString& aMIMEType);
|
||||
|
||||
|
@ -12,6 +12,9 @@
|
||||
#include "mozilla/RefPtr.h"
|
||||
#include "WMFMediaDataDecoder.h"
|
||||
|
||||
extern const GUID CLSID_WebmMfVp8Dec;
|
||||
extern const GUID CLSID_WebmMfVp9Dec;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class WMFAudioMFTManager : public MFTManager {
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "gfxWindowsPlatform.h"
|
||||
#include "MediaInfo.h"
|
||||
#include "prsystem.h"
|
||||
#include "mozilla/Maybe.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
@ -123,16 +124,59 @@ WMFDecoderModule::CreateAudioDecoder(const AudioInfo& aConfig,
|
||||
return decoder.forget();
|
||||
}
|
||||
|
||||
static bool
|
||||
CanCreateMFTDecoder(const GUID& aGuid)
|
||||
{
|
||||
if (FAILED(wmf::MFStartup())) {
|
||||
return false;
|
||||
}
|
||||
RefPtr<MFTDecoder> decoder(new MFTDecoder());
|
||||
bool hasH264 = SUCCEEDED(decoder->Create(aGuid));
|
||||
wmf::MFShutdown();
|
||||
return hasH264;
|
||||
}
|
||||
|
||||
template<const GUID& aGuid>
|
||||
static bool
|
||||
CanCreateWMFDecoder()
|
||||
{
|
||||
static Maybe<bool> result;
|
||||
if (result.isNothing()) {
|
||||
result.emplace(CanCreateMFTDecoder(aGuid));
|
||||
}
|
||||
return result.value();
|
||||
}
|
||||
|
||||
bool
|
||||
WMFDecoderModule::SupportsMimeType(const nsACString& aMimeType)
|
||||
{
|
||||
return aMimeType.EqualsLiteral("video/mp4") ||
|
||||
aMimeType.EqualsLiteral("video/avc") ||
|
||||
aMimeType.EqualsLiteral("audio/mp4a-latm") ||
|
||||
aMimeType.EqualsLiteral("audio/mpeg") ||
|
||||
(sIsIntelDecoderEnabled &&
|
||||
(aMimeType.EqualsLiteral("video/webm; codecs=vp8") ||
|
||||
aMimeType.EqualsLiteral("video/webm; codecs=vp9")));
|
||||
if ((aMimeType.EqualsLiteral("audio/mp4a-latm") ||
|
||||
aMimeType.EqualsLiteral("audio/mp4")) &&
|
||||
CanCreateWMFDecoder<CLSID_CMSAACDecMFT>()) {
|
||||
return true;
|
||||
}
|
||||
if ((aMimeType.EqualsLiteral("video/avc") ||
|
||||
aMimeType.EqualsLiteral("video/mp4")) &&
|
||||
CanCreateWMFDecoder<CLSID_CMSH264DecoderMFT>()) {
|
||||
return true;
|
||||
}
|
||||
if (aMimeType.EqualsLiteral("audio/mpeg") &&
|
||||
CanCreateWMFDecoder<CLSID_CMP3DecMediaObject>()) {
|
||||
return true;
|
||||
}
|
||||
if (sIsIntelDecoderEnabled) {
|
||||
if (aMimeType.EqualsLiteral("video/webm; codecs=vp8") &&
|
||||
CanCreateWMFDecoder<CLSID_WebmMfVp8Dec>()) {
|
||||
return true;
|
||||
}
|
||||
if (aMimeType.EqualsLiteral("video/webm; codecs=vp9") &&
|
||||
CanCreateWMFDecoder<CLSID_WebmMfVp9Dec>()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Some unsupported codec.
|
||||
return false;
|
||||
}
|
||||
|
||||
PlatformDecoderModule::ConversionRequired
|
||||
@ -147,43 +191,4 @@ WMFDecoderModule::DecoderNeedsConversion(const TrackInfo& aConfig) const
|
||||
}
|
||||
}
|
||||
|
||||
static bool
|
||||
ClassesRootRegKeyExists(const nsAString& aRegKeyPath)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsIWindowsRegKey> regKey =
|
||||
do_CreateInstance("@mozilla.org/windows-registry-key;1", &rv);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
rv = regKey->Open(nsIWindowsRegKey::ROOT_KEY_CLASSES_ROOT,
|
||||
aRegKeyPath,
|
||||
nsIWindowsRegKey::ACCESS_READ);
|
||||
if (NS_FAILED(rv)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
regKey->Close();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* static */ bool
|
||||
WMFDecoderModule::HasH264()
|
||||
{
|
||||
// CLSID_CMSH264DecoderMFT
|
||||
return ClassesRootRegKeyExists(
|
||||
NS_LITERAL_STRING("CLSID\\{32D186A7-218F-4C75-8876-DD77273A8999}"));
|
||||
}
|
||||
|
||||
/* static */ bool
|
||||
WMFDecoderModule::HasAAC()
|
||||
{
|
||||
// CLSID_CMSAACDecMFT
|
||||
return ClassesRootRegKeyExists(
|
||||
NS_LITERAL_STRING("CLSID\\{62CE7E72-4C71-4D20-B15D-452831A87D9D}"));
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
@ -36,13 +36,6 @@ public:
|
||||
ConversionRequired
|
||||
DecoderNeedsConversion(const TrackInfo& aConfig) const override;
|
||||
|
||||
// Accessors that report whether we have the required MFTs available
|
||||
// on the system to play various codecs. Windows Vista doesn't have the
|
||||
// H.264/AAC decoders if the "Platform Update Supplement for Windows Vista"
|
||||
// is not installed.
|
||||
static bool HasAAC();
|
||||
static bool HasH264();
|
||||
|
||||
// Called on main thread.
|
||||
static void Init();
|
||||
|
||||
|
@ -168,7 +168,7 @@ WMFVideoMFTManager::InitializeDXVA(bool aForceD3D9)
|
||||
}
|
||||
|
||||
// The DXVA manager must be created on the main thread.
|
||||
nsRefPtr<CreateDXVAManagerEvent> event =
|
||||
nsRefPtr<CreateDXVAManagerEvent> event =
|
||||
new CreateDXVAManagerEvent(aForceD3D9 ? LayersBackend::LAYERS_D3D9 : mLayersBackend, mDXVAFailureReason);
|
||||
|
||||
if (NS_IsMainThread()) {
|
||||
|
@ -815,7 +815,7 @@ Notification::Constructor(const GlobalObject& aGlobal,
|
||||
ServiceWorkerGlobalScope* scope = nullptr;
|
||||
UNWRAP_WORKER_OBJECT(ServiceWorkerGlobalScope, aGlobal.Get(), scope);
|
||||
if (scope) {
|
||||
aRv.ThrowTypeError(MSG_NOTIFICATION_NO_CONSTRUCTOR_IN_SERVICEWORKER);
|
||||
aRv.ThrowTypeError<MSG_NOTIFICATION_NO_CONSTRUCTOR_IN_SERVICEWORKER>();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -2329,7 +2329,7 @@ Notification::ShowPersistentNotification(nsIGlobalObject *aGlobal,
|
||||
if (NS_WARN_IF(NS_FAILED(loadChecker->Result()))) {
|
||||
if (loadChecker->Result() == NS_ERROR_NOT_AVAILABLE) {
|
||||
nsAutoString scope(aScope);
|
||||
aRv.ThrowTypeError(MSG_NO_ACTIVE_WORKER, &scope);
|
||||
aRv.ThrowTypeError<MSG_NO_ACTIVE_WORKER>(&scope);
|
||||
} else {
|
||||
aRv.Throw(NS_ERROR_DOM_SECURITY_ERR);
|
||||
}
|
||||
@ -2350,7 +2350,7 @@ Notification::ShowPersistentNotification(nsIGlobalObject *aGlobal,
|
||||
// "If permission for notification’s origin is not "granted", reject promise with a TypeError exception, and terminate these substeps."
|
||||
if (NS_WARN_IF(aRv.Failed()) || permission == NotificationPermission::Denied) {
|
||||
ErrorResult result;
|
||||
result.ThrowTypeError(MSG_NOTIFICATION_PERMISSION_DENIED);
|
||||
result.ThrowTypeError<MSG_NOTIFICATION_PERMISSION_DENIED>();
|
||||
p->MaybeReject(result);
|
||||
return p.forget();
|
||||
}
|
||||
|
@ -470,7 +470,7 @@ SVGSVGElement::SetZoomAndPan(uint16_t aZoomAndPan, ErrorResult& rv)
|
||||
return;
|
||||
}
|
||||
|
||||
rv.ThrowRangeError(MSG_INVALID_ZOOMANDPAN_VALUE_ERROR);
|
||||
rv.ThrowRangeError<MSG_INVALID_ZOOMANDPAN_VALUE_ERROR>();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -260,7 +260,7 @@ SVGTransform::SetSkewX(float angle, ErrorResult& rv)
|
||||
}
|
||||
|
||||
if (!IsFinite(tan(angle * kRadPerDegree))) {
|
||||
rv.ThrowRangeError(MSG_INVALID_TRANSFORM_ANGLE_ERROR);
|
||||
rv.ThrowRangeError<MSG_INVALID_TRANSFORM_ANGLE_ERROR>();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -283,7 +283,7 @@ SVGTransform::SetSkewY(float angle, ErrorResult& rv)
|
||||
}
|
||||
|
||||
if (!IsFinite(tan(angle * kRadPerDegree))) {
|
||||
rv.ThrowRangeError(MSG_INVALID_TRANSFORM_ANGLE_ERROR);
|
||||
rv.ThrowRangeError<MSG_INVALID_TRANSFORM_ANGLE_ERROR>();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,7 @@ SVGViewElement::SetZoomAndPan(uint16_t aZoomAndPan, ErrorResult& rv)
|
||||
return;
|
||||
}
|
||||
|
||||
rv.ThrowRangeError(MSG_INVALID_ZOOMANDPAN_VALUE_ERROR);
|
||||
rv.ThrowRangeError<MSG_INVALID_ZOOMANDPAN_VALUE_ERROR>();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -168,7 +168,7 @@ ServiceWorkerContainer::Register(const nsAString& aScriptURL,
|
||||
nsCOMPtr<nsIURI> scriptURI;
|
||||
rv = NS_NewURI(getter_AddRefs(scriptURI), aScriptURL, nullptr, baseURI);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
aRv.ThrowTypeError(MSG_INVALID_URL, &aScriptURL);
|
||||
aRv.ThrowTypeError<MSG_INVALID_URL>(&aScriptURL);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -190,7 +190,7 @@ ServiceWorkerContainer::Register(const nsAString& aScriptURL,
|
||||
nsAutoCString spec;
|
||||
scriptURI->GetSpec(spec);
|
||||
NS_ConvertUTF8toUTF16 wSpec(spec);
|
||||
aRv.ThrowTypeError(MSG_INVALID_SCOPE, &defaultScope, &wSpec);
|
||||
aRv.ThrowTypeError<MSG_INVALID_SCOPE>(&defaultScope, &wSpec);
|
||||
return nullptr;
|
||||
}
|
||||
} else {
|
||||
@ -201,7 +201,7 @@ ServiceWorkerContainer::Register(const nsAString& aScriptURL,
|
||||
nsAutoCString spec;
|
||||
baseURI->GetSpec(spec);
|
||||
NS_ConvertUTF8toUTF16 wSpec(spec);
|
||||
aRv.ThrowTypeError(MSG_INVALID_SCOPE, &aOptions.mScope.Value(), &wSpec);
|
||||
aRv.ThrowTypeError<MSG_INVALID_SCOPE>(&aOptions.mScope.Value(), &wSpec);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -421,6 +421,7 @@ FetchEvent::RespondWith(Promise& aArg, ErrorResult& aRv)
|
||||
mPromise = &aArg;
|
||||
}
|
||||
nsRefPtr<InternalRequest> ir = mRequest->GetInternalRequest();
|
||||
StopImmediatePropagation();
|
||||
mWaitToRespond = true;
|
||||
nsRefPtr<RespondWithHandler> handler =
|
||||
new RespondWithHandler(mChannel, mRequest->Mode(), ir->IsClientRequest(),
|
||||
|
@ -704,7 +704,7 @@ ServiceWorkerRegistrationMainThread::ShowNotification(JSContext* aCx,
|
||||
|
||||
nsRefPtr<workers::ServiceWorker> worker = GetActive();
|
||||
if (!worker) {
|
||||
aRv.ThrowTypeError(MSG_NO_ACTIVE_WORKER, &mScope);
|
||||
aRv.ThrowTypeError<MSG_NO_ACTIVE_WORKER>(&mScope);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -6642,12 +6642,9 @@ nsHTMLEditRules::SplitParagraph(nsIDOMNode *aPara,
|
||||
NS_ENSURE_STATE(mHTMLEditor && rightParaNode);
|
||||
nsCOMPtr<nsIDOMNode> child =
|
||||
GetAsDOMNode(mHTMLEditor->GetLeftmostChild(rightParaNode, true));
|
||||
NS_ENSURE_STATE(mHTMLEditor);
|
||||
if (!mHTMLEditor ||
|
||||
mHTMLEditor->IsTextNode(child) ||
|
||||
if (mHTMLEditor->IsTextNode(child) ||
|
||||
mHTMLEditor->IsContainer(child))
|
||||
{
|
||||
NS_ENSURE_STATE(mHTMLEditor);
|
||||
aSelection->Collapse(child,0);
|
||||
}
|
||||
else
|
||||
@ -7442,12 +7439,9 @@ nsHTMLEditRules::PinSelectionToNewBlock(Selection* aSelection)
|
||||
NS_ENSURE_STATE(mHTMLEditor);
|
||||
tmp = GetAsDOMNode(mHTMLEditor->GetLastEditableChild(*block));
|
||||
uint32_t endPoint;
|
||||
NS_ENSURE_STATE(mHTMLEditor);
|
||||
if (!mHTMLEditor ||
|
||||
mHTMLEditor->IsTextNode(tmp) ||
|
||||
if (mHTMLEditor->IsTextNode(tmp) ||
|
||||
mHTMLEditor->IsContainer(tmp))
|
||||
{
|
||||
NS_ENSURE_STATE(mHTMLEditor);
|
||||
res = nsEditor::GetLengthOfDOMNode(tmp, endPoint);
|
||||
NS_ENSURE_SUCCESS(res, res);
|
||||
}
|
||||
@ -7462,16 +7456,13 @@ nsHTMLEditRules::PinSelectionToNewBlock(Selection* aSelection)
|
||||
{
|
||||
// selection is before block. put at start of block.
|
||||
nsCOMPtr<nsIDOMNode> tmp = mNewBlock;
|
||||
NS_ENSURE_STATE(mHTMLEditor);
|
||||
tmp = GetAsDOMNode(mHTMLEditor->GetFirstEditableChild(*block));
|
||||
int32_t offset;
|
||||
if (mHTMLEditor &&
|
||||
!(mHTMLEditor->IsTextNode(tmp) ||
|
||||
mHTMLEditor->IsContainer(tmp)))
|
||||
if (mHTMLEditor->IsTextNode(tmp) ||
|
||||
mHTMLEditor->IsContainer(tmp))
|
||||
{
|
||||
tmp = nsEditor::GetNodeLocation(tmp, &offset);
|
||||
}
|
||||
NS_ENSURE_STATE(mHTMLEditor);
|
||||
return aSelection->Collapse(tmp, 0);
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,19 @@
|
||||
# Copyright 2014 The Chromium Authors. All rights reserved.
|
||||
# Copyright 2014-2015 The Chromium Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
# import the use_x11 variable
|
||||
import("//build/config/ui.gni")
|
||||
import("//third_party/angle/build/angle_common.gni")
|
||||
|
||||
angle_git_is_present = exec_script("src/commit_id.py",
|
||||
[
|
||||
"check",
|
||||
rebase_path(".", root_build_dir),
|
||||
],
|
||||
"value")
|
||||
|
||||
angle_use_commit_id = angle_git_is_present == 1
|
||||
|
||||
gles_gypi = exec_script(
|
||||
"//build/gypi_to_gn.py",
|
||||
@ -33,30 +43,11 @@ config("internal_config") {
|
||||
]
|
||||
}
|
||||
|
||||
angle_enable_d3d9 = false
|
||||
angle_enable_d3d11 = false
|
||||
angle_enable_gl = false
|
||||
|
||||
if (is_win) {
|
||||
angle_enable_d3d9 = true
|
||||
angle_enable_d3d11 = true
|
||||
angle_enable_gl = true
|
||||
|
||||
import("//build/config/win/visual_studio_version.gni")
|
||||
copy("copy_compiler_dll") {
|
||||
sources = [ "$windows_sdk_path/Redist/D3D/$target_cpu/d3dcompiler_47.dll" ]
|
||||
outputs = [ "$root_build_dir/d3dcompiler_47.dll" ]
|
||||
}
|
||||
} # is_win
|
||||
|
||||
if (is_linux) {
|
||||
angle_enable_gl = true
|
||||
}
|
||||
|
||||
angle_enable_hlsl = false
|
||||
|
||||
if (angle_enable_d3d9 || angle_enable_d3d11) {
|
||||
angle_enable_hlsl = true
|
||||
}
|
||||
|
||||
component("translator") {
|
||||
@ -93,8 +84,9 @@ source_set("includes") {
|
||||
"include/GLES2/gl2ext.h",
|
||||
"include/GLES2/gl2platform.h",
|
||||
"include/GLES3/gl3.h",
|
||||
"include/GLES3/gl3ext.h",
|
||||
"include/GLES3/gl3platform.h",
|
||||
"include/GLES3/gl31.h",
|
||||
"include/GLES3/gl32.h",
|
||||
"include/GLSLANG/ShaderLang.h",
|
||||
"include/KHR/khrplatform.h",
|
||||
]
|
||||
@ -114,6 +106,7 @@ config("translator_static_config") {
|
||||
defines = [ "ANGLE_TRANSLATOR_STATIC" ]
|
||||
}
|
||||
|
||||
|
||||
config("debug_annotations_config") {
|
||||
if (is_debug) {
|
||||
defines = [
|
||||
@ -184,19 +177,32 @@ config("commit_id_config") {
|
||||
include_dirs = [ "$root_gen_dir/angle" ]
|
||||
}
|
||||
|
||||
action("commit_id") {
|
||||
script = "src/commit_id.py"
|
||||
commit_id_output_file = "$root_gen_dir/angle/id/commit.h"
|
||||
if (angle_use_commit_id) {
|
||||
action("commit_id") {
|
||||
script = "src/commit_id.py"
|
||||
outputs = [
|
||||
commit_id_output_file,
|
||||
]
|
||||
|
||||
output_file = "$root_gen_dir/angle/id/commit.h"
|
||||
outputs = [ output_file ]
|
||||
args = [
|
||||
"gen",
|
||||
rebase_path(".", root_build_dir),
|
||||
rebase_path(commit_id_output_file, root_build_dir),
|
||||
]
|
||||
|
||||
args = [
|
||||
"gen",
|
||||
rebase_path(".", root_build_dir),
|
||||
rebase_path(output_file, root_build_dir),
|
||||
]
|
||||
|
||||
public_configs = [ ":commit_id_config" ]
|
||||
public_configs = [ ":commit_id_config" ]
|
||||
}
|
||||
} else {
|
||||
copy("commit_id") {
|
||||
sources = [
|
||||
"src/commit.h",
|
||||
]
|
||||
outputs = [
|
||||
commit_id_output_file,
|
||||
]
|
||||
public_configs = [ ":commit_id_config" ]
|
||||
}
|
||||
}
|
||||
|
||||
config("libANGLE_config") {
|
||||
@ -215,10 +221,20 @@ config("libANGLE_config") {
|
||||
defines += [ "ANGLE_USE_X11" ]
|
||||
}
|
||||
defines += [
|
||||
"GL_APICALL=",
|
||||
"GL_GLEXT_PROTOTYPES=",
|
||||
"EGLAPI=",
|
||||
"GL_GLEXT_PROTOTYPES",
|
||||
]
|
||||
|
||||
if (is_win) {
|
||||
defines += [
|
||||
"GL_APICALL=",
|
||||
"EGLAPI=",
|
||||
]
|
||||
} else {
|
||||
defines += [
|
||||
"GL_APICALL=__attribute__((visibility(\"default\")))",
|
||||
"EGLAPI=__attribute__((visibility(\"default\")))",
|
||||
]
|
||||
}
|
||||
if (is_win) {
|
||||
cflags += [ "/wd4530" ] # C++ exception handler used, but unwind semantics are not enabled.
|
||||
}
|
||||
@ -333,6 +349,7 @@ shared_library("libEGL") {
|
||||
configs += [
|
||||
":internal_config",
|
||||
":commit_id_config",
|
||||
":debug_annotations_config",
|
||||
":libANGLE_config",
|
||||
"//build/config/compiler:no_chromium_code",
|
||||
]
|
||||
@ -346,3 +363,48 @@ shared_library("libEGL") {
|
||||
":libGLESv2",
|
||||
]
|
||||
}
|
||||
|
||||
util_gypi = exec_script(
|
||||
"//build/gypi_to_gn.py",
|
||||
[ rebase_path("util/util.gyp") ],
|
||||
"scope",
|
||||
[ "util/util.gyp" ])
|
||||
|
||||
static_library("angle_util") {
|
||||
sources = rebase_path(util_gypi.util_sources, ".", "util")
|
||||
|
||||
if (is_win) {
|
||||
sources += rebase_path(util_gypi.util_win32_sources, ".", "util")
|
||||
}
|
||||
|
||||
if (is_linux) {
|
||||
sources += rebase_path(util_gypi.util_linux_sources, ".", "util")
|
||||
}
|
||||
|
||||
if (is_mac) {
|
||||
sources += rebase_path(util_gypi.util_osx_sources, ".", "util")
|
||||
}
|
||||
|
||||
if (use_x11) {
|
||||
sources += rebase_path(util_gypi.util_x11_sources, ".", "util")
|
||||
}
|
||||
|
||||
defines = [
|
||||
"GL_GLEXT_PROTOTYPES",
|
||||
"EGL_EGLEXT_PROTOTYPES",
|
||||
]
|
||||
|
||||
configs += [
|
||||
":internal_config",
|
||||
":debug_annotations_config",
|
||||
]
|
||||
|
||||
include_dirs = [
|
||||
"util",
|
||||
]
|
||||
|
||||
deps = [
|
||||
":libEGL",
|
||||
":libGLESv2",
|
||||
]
|
||||
}
|
||||
|
@ -104,3 +104,4 @@ NVIDIA Corporation
|
||||
|
||||
Opera Software ASA
|
||||
Daniel Bratell
|
||||
Tomasz Moniuszko
|
||||
|
@ -4,12 +4,12 @@ vars = {
|
||||
|
||||
deps = {
|
||||
"third_party/gyp":
|
||||
Var('chromium_git') + "/external/gyp@b4781fc38236b0fb1238969c918a75a200cfffdb",
|
||||
Var('chromium_git') + "/external/gyp@81c2e5ff92af29bab61c982808076ddce3d200a2",
|
||||
|
||||
# TODO(kbr): figure out how to better stay in sync with Chromium's
|
||||
# versions of googletest and googlemock.
|
||||
"src/tests/third_party/googletest":
|
||||
Var('chromium_git') + "/external/googletest.git@23574bf2333f834ff665f894c97bef8a5b33a0a9",
|
||||
Var('chromium_git') + "/external/googletest.git@9855a87157778d39b95eccfb201a9dc90f6d61c6",
|
||||
|
||||
"src/tests/third_party/googlemock":
|
||||
Var('chromium_git') + "/external/googlemock.git@b2cb211e49d872101d991201362d7b97d7d69910",
|
||||
|
@ -6,7 +6,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Copyright (c) 2013-2014 The Khronos Group Inc.
|
||||
** Copyright (c) 2013-2015 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
|
||||
@ -33,12 +33,12 @@ extern "C" {
|
||||
** used to make the header, and the header can be found at
|
||||
** http://www.opengl.org/registry/
|
||||
**
|
||||
** Khronos $Revision: 29318 $ on $Date: 2015-01-02 03:16:10 -0800 (Fri, 02 Jan 2015) $
|
||||
** Khronos $Revision: 31566 $ on $Date: 2015-06-23 08:48:48 -0700 (Tue, 23 Jun 2015) $
|
||||
*/
|
||||
|
||||
#include <EGL/eglplatform.h>
|
||||
|
||||
/* Generated on date 20150102 */
|
||||
/* Generated on date 20150623 */
|
||||
|
||||
/* Generated C header for:
|
||||
* API: egl
|
||||
|
@ -6,7 +6,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Copyright (c) 2013-2014 The Khronos Group Inc.
|
||||
** Copyright (c) 2013-2015 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
|
||||
@ -33,12 +33,12 @@ extern "C" {
|
||||
** used to make the header, and the header can be found at
|
||||
** http://www.opengl.org/registry/
|
||||
**
|
||||
** Khronos $Revision: 27018 $ on $Date: 2014-06-10 08:06:12 -0700 (Tue, 10 Jun 2014) $
|
||||
** Khronos $Revision: 31566 $ on $Date: 2015-06-23 08:48:48 -0700 (Tue, 23 Jun 2015) $
|
||||
*/
|
||||
|
||||
#include <EGL/eglplatform.h>
|
||||
|
||||
#define EGL_EGLEXT_VERSION 20140610
|
||||
#define EGL_EGLEXT_VERSION 20150623
|
||||
|
||||
/* Generated C header for:
|
||||
* API: egl
|
||||
@ -94,12 +94,28 @@ EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSync64KHR (EGLDisplay dpy, EGLenum type,
|
||||
#define EGL_OPENGL_ES3_BIT_KHR 0x00000040
|
||||
#endif /* EGL_KHR_create_context */
|
||||
|
||||
#ifndef EGL_KHR_create_context_no_error
|
||||
#define EGL_KHR_create_context_no_error 1
|
||||
#define EGL_CONTEXT_OPENGL_NO_ERROR_KHR 0x31B3
|
||||
#endif /* EGL_KHR_create_context_no_error */
|
||||
|
||||
#ifndef EGL_KHR_fence_sync
|
||||
#define EGL_KHR_fence_sync 1
|
||||
typedef khronos_utime_nanoseconds_t EGLTimeKHR;
|
||||
#ifdef KHRONOS_SUPPORT_INT64
|
||||
#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR 0x30F0
|
||||
#define EGL_SYNC_CONDITION_KHR 0x30F8
|
||||
#define EGL_SYNC_FENCE_KHR 0x30F9
|
||||
typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESYNCKHRPROC) (EGLDisplay dpy, EGLenum type, const EGLint *attrib_list);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync);
|
||||
typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSyncKHR (EGLDisplay dpy, EGLenum type, const EGLint *attrib_list);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncKHR (EGLDisplay dpy, EGLSyncKHR sync);
|
||||
EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value);
|
||||
#endif
|
||||
#endif /* KHRONOS_SUPPORT_INT64 */
|
||||
#endif /* EGL_KHR_fence_sync */
|
||||
|
||||
@ -207,6 +223,15 @@ EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurface64KHR (EGLDisplay dpy, EGLSurface s
|
||||
#endif
|
||||
#endif /* EGL_KHR_lock_surface3 */
|
||||
|
||||
#ifndef EGL_KHR_partial_update
|
||||
#define EGL_KHR_partial_update 1
|
||||
#define EGL_BUFFER_AGE_KHR 0x313D
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSETDAMAGEREGIONKHRPROC) (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglSetDamageRegionKHR (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects);
|
||||
#endif
|
||||
#endif /* EGL_KHR_partial_update */
|
||||
|
||||
#ifndef EGL_KHR_platform_android
|
||||
#define EGL_KHR_platform_android 1
|
||||
#define EGL_PLATFORM_ANDROID_KHR 0x3141
|
||||
@ -230,7 +255,6 @@ EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurface64KHR (EGLDisplay dpy, EGLSurface s
|
||||
|
||||
#ifndef EGL_KHR_reusable_sync
|
||||
#define EGL_KHR_reusable_sync 1
|
||||
typedef khronos_utime_nanoseconds_t EGLTimeKHR;
|
||||
#ifdef KHRONOS_SUPPORT_INT64
|
||||
#define EGL_SYNC_STATUS_KHR 0x30F1
|
||||
#define EGL_SIGNALED_KHR 0x30F2
|
||||
@ -242,17 +266,9 @@ typedef khronos_utime_nanoseconds_t EGLTimeKHR;
|
||||
#define EGL_SYNC_FLUSH_COMMANDS_BIT_KHR 0x0001
|
||||
#define EGL_FOREVER_KHR 0xFFFFFFFFFFFFFFFFull
|
||||
#define EGL_NO_SYNC_KHR ((EGLSyncKHR)0)
|
||||
typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESYNCKHRPROC) (EGLDisplay dpy, EGLenum type, const EGLint *attrib_list);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync);
|
||||
typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSyncKHR (EGLDisplay dpy, EGLenum type, const EGLint *attrib_list);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncKHR (EGLDisplay dpy, EGLSyncKHR sync);
|
||||
EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglSignalSyncKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value);
|
||||
#endif
|
||||
#endif /* KHRONOS_SUPPORT_INT64 */
|
||||
#endif /* EGL_KHR_reusable_sync */
|
||||
@ -354,6 +370,14 @@ EGLAPI EGLSurface EGLAPIENTRY eglCreateStreamProducerSurfaceKHR (EGLDisplay dpy,
|
||||
#define EGL_KHR_surfaceless_context 1
|
||||
#endif /* EGL_KHR_surfaceless_context */
|
||||
|
||||
#ifndef EGL_KHR_swap_buffers_with_damage
|
||||
#define EGL_KHR_swap_buffers_with_damage 1
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSWITHDAMAGEKHRPROC) (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersWithDamageKHR (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects);
|
||||
#endif
|
||||
#endif /* EGL_KHR_swap_buffers_with_damage */
|
||||
|
||||
#ifndef EGL_KHR_vg_parent_image
|
||||
#define EGL_KHR_vg_parent_image 1
|
||||
#define EGL_VG_PARENT_IMAGE_KHR 0x30BA
|
||||
@ -410,10 +434,16 @@ EGLAPI EGLint EGLAPIENTRY eglDupNativeFenceFDANDROID (EGLDisplay dpy, EGLSyncKHR
|
||||
#define EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE 0x3200
|
||||
#endif /* EGL_ANGLE_d3d_share_handle_client_buffer */
|
||||
|
||||
#ifndef EGL_ANGLE_window_fixed_size
|
||||
#define EGL_ANGLE_window_fixed_size 1
|
||||
#define EGL_FIXED_SIZE_ANGLE 0x3201
|
||||
#endif /* EGL_ANGLE_window_fixed_size */
|
||||
#ifndef EGL_ANGLE_device_d3d
|
||||
#define EGL_ANGLE_device_d3d 1
|
||||
#define EGL_D3D9_DEVICE_ANGLE 0x33A0
|
||||
#define EGL_D3D11_DEVICE_ANGLE 0x33A1
|
||||
#endif /* EGL_ANGLE_device_d3d */
|
||||
|
||||
#ifndef EGL_ANGLE_keyed_mutex
|
||||
#define EGL_ANGLE_keyed_mutex 1
|
||||
#define EGL_DXGI_KEYED_MUTEX_ANGLE 0x33A2
|
||||
#endif /* EGL_ANGLE_keyed_mutex */
|
||||
|
||||
#ifndef EGL_ANGLE_query_surface_pointer
|
||||
#define EGL_ANGLE_query_surface_pointer 1
|
||||
@ -464,16 +494,10 @@ EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurfacePointerANGLE (EGLDisplay dpy, EGLSu
|
||||
#define EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE 0x320E
|
||||
#endif /* EGL_ANGLE_platform_angle_opengl */
|
||||
|
||||
#ifndef EGL_ANGLE_device_d3d
|
||||
#define EGL_ANGLE_device_d3d 1
|
||||
#define EGL_D3D9_DEVICE_ANGLE 0x33A0
|
||||
#define EGL_D3D11_DEVICE_ANGLE 0x33A1
|
||||
#endif /* EGL_ANGLE_device_d3d */
|
||||
|
||||
#ifndef EGL_ANGLE_keyed_mutex
|
||||
#define EGL_ANGLE_keyed_mutex 1
|
||||
#define EGL_DXGI_KEYED_MUTEX_ANGLE 0x33A2
|
||||
#endif /* EGL_ANGLE_keyed_mutex */
|
||||
#ifndef EGL_ANGLE_window_fixed_size
|
||||
#define EGL_ANGLE_window_fixed_size 1
|
||||
#define EGL_FIXED_SIZE_ANGLE 0x3201
|
||||
#endif /* EGL_ANGLE_window_fixed_size */
|
||||
|
||||
#ifndef EGL_ARM_pixmap_multisample_discard
|
||||
#define EGL_ARM_pixmap_multisample_discard 1
|
||||
@ -515,6 +539,20 @@ EGLAPI EGLBoolean EGLAPIENTRY eglQueryDisplayAttribEXT (EGLDisplay dpy, EGLint a
|
||||
#endif
|
||||
#endif /* EGL_EXT_device_base */
|
||||
|
||||
#ifndef EGL_EXT_device_drm
|
||||
#define EGL_EXT_device_drm 1
|
||||
#define EGL_DRM_DEVICE_FILE_EXT 0x3233
|
||||
#endif /* EGL_EXT_device_drm */
|
||||
|
||||
#ifndef EGL_EXT_device_enumeration
|
||||
#define EGL_EXT_device_enumeration 1
|
||||
#endif /* EGL_EXT_device_enumeration */
|
||||
|
||||
#ifndef EGL_EXT_device_openwf
|
||||
#define EGL_EXT_device_openwf 1
|
||||
#define EGL_OPENWF_DEVICE_ID_EXT 0x3237
|
||||
#endif /* EGL_EXT_device_openwf */
|
||||
|
||||
#ifndef EGL_EXT_device_query
|
||||
#define EGL_EXT_device_query 1
|
||||
#endif /* EGL_EXT_device_query */
|
||||
@ -550,6 +588,48 @@ EGLAPI EGLBoolean EGLAPIENTRY eglQueryDisplayAttribEXT (EGLDisplay dpy, EGLint a
|
||||
#define EGL_MULTIVIEW_VIEW_COUNT_EXT 0x3134
|
||||
#endif /* EGL_EXT_multiview_window */
|
||||
|
||||
#ifndef EGL_EXT_output_base
|
||||
#define EGL_EXT_output_base 1
|
||||
typedef void *EGLOutputLayerEXT;
|
||||
typedef void *EGLOutputPortEXT;
|
||||
#define EGL_NO_OUTPUT_LAYER_EXT ((EGLOutputLayerEXT)0)
|
||||
#define EGL_NO_OUTPUT_PORT_EXT ((EGLOutputPortEXT)0)
|
||||
#define EGL_BAD_OUTPUT_LAYER_EXT 0x322D
|
||||
#define EGL_BAD_OUTPUT_PORT_EXT 0x322E
|
||||
#define EGL_SWAP_INTERVAL_EXT 0x322F
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETOUTPUTLAYERSEXTPROC) (EGLDisplay dpy, const EGLAttrib *attrib_list, EGLOutputLayerEXT *layers, EGLint max_layers, EGLint *num_layers);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETOUTPUTPORTSEXTPROC) (EGLDisplay dpy, const EGLAttrib *attrib_list, EGLOutputPortEXT *ports, EGLint max_ports, EGLint *num_ports);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLOUTPUTLAYERATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib value);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYOUTPUTLAYERATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib *value);
|
||||
typedef const char *(EGLAPIENTRYP PFNEGLQUERYOUTPUTLAYERSTRINGEXTPROC) (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint name);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLOUTPUTPORTATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputPortEXT port, EGLint attribute, EGLAttrib value);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYOUTPUTPORTATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputPortEXT port, EGLint attribute, EGLAttrib *value);
|
||||
typedef const char *(EGLAPIENTRYP PFNEGLQUERYOUTPUTPORTSTRINGEXTPROC) (EGLDisplay dpy, EGLOutputPortEXT port, EGLint name);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglGetOutputLayersEXT (EGLDisplay dpy, const EGLAttrib *attrib_list, EGLOutputLayerEXT *layers, EGLint max_layers, EGLint *num_layers);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglGetOutputPortsEXT (EGLDisplay dpy, const EGLAttrib *attrib_list, EGLOutputPortEXT *ports, EGLint max_ports, EGLint *num_ports);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglOutputLayerAttribEXT (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib value);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglQueryOutputLayerAttribEXT (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib *value);
|
||||
EGLAPI const char *EGLAPIENTRY eglQueryOutputLayerStringEXT (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint name);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglOutputPortAttribEXT (EGLDisplay dpy, EGLOutputPortEXT port, EGLint attribute, EGLAttrib value);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglQueryOutputPortAttribEXT (EGLDisplay dpy, EGLOutputPortEXT port, EGLint attribute, EGLAttrib *value);
|
||||
EGLAPI const char *EGLAPIENTRY eglQueryOutputPortStringEXT (EGLDisplay dpy, EGLOutputPortEXT port, EGLint name);
|
||||
#endif
|
||||
#endif /* EGL_EXT_output_base */
|
||||
|
||||
#ifndef EGL_EXT_output_drm
|
||||
#define EGL_EXT_output_drm 1
|
||||
#define EGL_DRM_CRTC_EXT 0x3234
|
||||
#define EGL_DRM_PLANE_EXT 0x3235
|
||||
#define EGL_DRM_CONNECTOR_EXT 0x3236
|
||||
#endif /* EGL_EXT_output_drm */
|
||||
|
||||
#ifndef EGL_EXT_output_openwf
|
||||
#define EGL_EXT_output_openwf 1
|
||||
#define EGL_OPENWF_PIPELINE_ID_EXT 0x3238
|
||||
#define EGL_OPENWF_PORT_ID_EXT 0x3239
|
||||
#endif /* EGL_EXT_output_openwf */
|
||||
|
||||
#ifndef EGL_EXT_platform_base
|
||||
#define EGL_EXT_platform_base 1
|
||||
typedef EGLDisplay (EGLAPIENTRYP PFNEGLGETPLATFORMDISPLAYEXTPROC) (EGLenum platform, void *native_display, const EGLint *attrib_list);
|
||||
@ -583,6 +663,14 @@ EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformPixmapSurfaceEXT (EGLDisplay dpy,
|
||||
#define EGL_PROTECTED_CONTENT_EXT 0x32C0
|
||||
#endif /* EGL_EXT_protected_surface */
|
||||
|
||||
#ifndef EGL_EXT_stream_consumer_egloutput
|
||||
#define EGL_EXT_stream_consumer_egloutput 1
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMEROUTPUTEXTPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLOutputLayerEXT layer);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerOutputEXT (EGLDisplay dpy, EGLStreamKHR stream, EGLOutputLayerEXT layer);
|
||||
#endif
|
||||
#endif /* EGL_EXT_stream_consumer_egloutput */
|
||||
|
||||
#ifndef EGL_EXT_swap_buffers_with_damage
|
||||
#define EGL_EXT_swap_buffers_with_damage 1
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSWITHDAMAGEEXTPROC) (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects);
|
||||
@ -591,6 +679,35 @@ EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersWithDamageEXT (EGLDisplay dpy, EGLSu
|
||||
#endif
|
||||
#endif /* EGL_EXT_swap_buffers_with_damage */
|
||||
|
||||
#ifndef EGL_EXT_yuv_surface
|
||||
#define EGL_EXT_yuv_surface 1
|
||||
#define EGL_YUV_ORDER_EXT 0x3301
|
||||
#define EGL_YUV_NUMBER_OF_PLANES_EXT 0x3311
|
||||
#define EGL_YUV_SUBSAMPLE_EXT 0x3312
|
||||
#define EGL_YUV_DEPTH_RANGE_EXT 0x3317
|
||||
#define EGL_YUV_CSC_STANDARD_EXT 0x330A
|
||||
#define EGL_YUV_PLANE_BPP_EXT 0x331A
|
||||
#define EGL_YUV_BUFFER_EXT 0x3300
|
||||
#define EGL_YUV_ORDER_YUV_EXT 0x3302
|
||||
#define EGL_YUV_ORDER_YVU_EXT 0x3303
|
||||
#define EGL_YUV_ORDER_YUYV_EXT 0x3304
|
||||
#define EGL_YUV_ORDER_UYVY_EXT 0x3305
|
||||
#define EGL_YUV_ORDER_YVYU_EXT 0x3306
|
||||
#define EGL_YUV_ORDER_VYUY_EXT 0x3307
|
||||
#define EGL_YUV_ORDER_AYUV_EXT 0x3308
|
||||
#define EGL_YUV_SUBSAMPLE_4_2_0_EXT 0x3313
|
||||
#define EGL_YUV_SUBSAMPLE_4_2_2_EXT 0x3314
|
||||
#define EGL_YUV_SUBSAMPLE_4_4_4_EXT 0x3315
|
||||
#define EGL_YUV_DEPTH_RANGE_LIMITED_EXT 0x3318
|
||||
#define EGL_YUV_DEPTH_RANGE_FULL_EXT 0x3319
|
||||
#define EGL_YUV_CSC_STANDARD_601_EXT 0x330B
|
||||
#define EGL_YUV_CSC_STANDARD_709_EXT 0x330C
|
||||
#define EGL_YUV_CSC_STANDARD_2020_EXT 0x330D
|
||||
#define EGL_YUV_PLANE_BPP_0_EXT 0x331B
|
||||
#define EGL_YUV_PLANE_BPP_8_EXT 0x331C
|
||||
#define EGL_YUV_PLANE_BPP_10_EXT 0x331D
|
||||
#endif /* EGL_EXT_yuv_surface */
|
||||
|
||||
#ifndef EGL_HI_clientpixmap
|
||||
#define EGL_HI_clientpixmap 1
|
||||
struct EGLClientPixmapHI {
|
||||
@ -639,6 +756,16 @@ EGLAPI EGLBoolean EGLAPIENTRY eglExportDRMImageMESA (EGLDisplay dpy, EGLImageKHR
|
||||
#endif
|
||||
#endif /* EGL_MESA_drm_image */
|
||||
|
||||
#ifndef EGL_MESA_image_dma_buf_export
|
||||
#define EGL_MESA_image_dma_buf_export 1
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLEXPORTDMABUFIMAGEQUERYMESAPROC) (EGLDisplay dpy, EGLImageKHR image, int *fourcc, int *num_planes, EGLuint64KHR *modifiers);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLEXPORTDMABUFIMAGEMESAPROC) (EGLDisplay dpy, EGLImageKHR image, int *fds, EGLint *strides, EGLint *offsets);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglExportDMABUFImageQueryMESA (EGLDisplay dpy, EGLImageKHR image, int *fourcc, int *num_planes, EGLuint64KHR *modifiers);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglExportDMABUFImageMESA (EGLDisplay dpy, EGLImageKHR image, int *fds, EGLint *strides, EGLint *offsets);
|
||||
#endif
|
||||
#endif /* EGL_MESA_image_dma_buf_export */
|
||||
|
||||
#ifndef EGL_MESA_platform_gbm
|
||||
#define EGL_MESA_platform_gbm 1
|
||||
#define EGL_PLATFORM_GBM_MESA 0x31D7
|
||||
@ -683,6 +810,13 @@ EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersRegion2NOK (EGLDisplay dpy, EGLSurfa
|
||||
#define EGL_COVERAGE_SAMPLE_RESOLVE_NONE_NV 0x3133
|
||||
#endif /* EGL_NV_coverage_sample_resolve */
|
||||
|
||||
#ifndef EGL_NV_cuda_event
|
||||
#define EGL_NV_cuda_event 1
|
||||
#define EGL_CUDA_EVENT_HANDLE_NV 0x323B
|
||||
#define EGL_SYNC_CUDA_EVENT_NV 0x323C
|
||||
#define EGL_SYNC_CUDA_EVENT_COMPLETE_NV 0x323D
|
||||
#endif /* EGL_NV_cuda_event */
|
||||
|
||||
#ifndef EGL_NV_depth_nonlinear
|
||||
#define EGL_NV_depth_nonlinear 1
|
||||
#define EGL_DEPTH_ENCODING_NV 0x30E2
|
||||
@ -690,6 +824,11 @@ EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersRegion2NOK (EGLDisplay dpy, EGLSurfa
|
||||
#define EGL_DEPTH_ENCODING_NONLINEAR_NV 0x30E3
|
||||
#endif /* EGL_NV_depth_nonlinear */
|
||||
|
||||
#ifndef EGL_NV_device_cuda
|
||||
#define EGL_NV_device_cuda 1
|
||||
#define EGL_CUDA_DEVICE_NV 0x323A
|
||||
#endif /* EGL_NV_device_cuda */
|
||||
|
||||
#ifndef EGL_NV_native_query
|
||||
#define EGL_NV_native_query 1
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEDISPLAYNVPROC) (EGLDisplay dpy, EGLNativeDisplayType *display_id);
|
||||
@ -772,6 +911,16 @@ EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeNV (void);
|
||||
#endif /* KHRONOS_SUPPORT_INT64 */
|
||||
#endif /* EGL_NV_system_time */
|
||||
|
||||
#ifndef EGL_TIZEN_image_native_buffer
|
||||
#define EGL_TIZEN_image_native_buffer 1
|
||||
#define EGL_NATIVE_BUFFER_TIZEN 0x32A0
|
||||
#endif /* EGL_TIZEN_image_native_buffer */
|
||||
|
||||
#ifndef EGL_TIZEN_image_native_surface
|
||||
#define EGL_TIZEN_image_native_surface 1
|
||||
#define EGL_NATIVE_SURFACE_TIZEN 0x32A1
|
||||
#endif /* EGL_TIZEN_image_native_surface */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -25,7 +25,7 @@
|
||||
*/
|
||||
|
||||
/* Platform-specific types and definitions for egl.h
|
||||
* $Revision: 23432 $ on $Date: 2013-10-09 00:57:24 -0700 (Wed, 09 Oct 2013) $
|
||||
* $Revision: 30994 $ on $Date: 2015-04-30 13:36:48 -0700 (Thu, 30 Apr 2015) $
|
||||
*
|
||||
* 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
|
||||
@ -117,11 +117,15 @@ typedef Window EGLNativeWindowType;
|
||||
|
||||
#elif defined(__GNUC__) && ( defined(__APPLE_CPP__) || defined(__APPLE_CC__) || defined(__MACOS_CLASSIC__) )
|
||||
|
||||
// TODO(jmadill): native implementation for OSX
|
||||
#if defined(__OBJC__)
|
||||
@class CALayer;
|
||||
#else
|
||||
class CALayer;
|
||||
#endif
|
||||
|
||||
typedef void *EGLNativeDisplayType;
|
||||
typedef void *EGLNativePixmapType;
|
||||
typedef void *EGLNativeWindowType;
|
||||
typedef CALayer *EGLNativeWindowType;
|
||||
|
||||
#else
|
||||
#error "Platform not recognized"
|
||||
|
@ -1,56 +1,87 @@
|
||||
#ifndef __gl2_h_
|
||||
#define __gl2_h_
|
||||
|
||||
/* $Revision: 20555 $ on $Date:: 2013-02-12 14:32:47 -0800 #$ */
|
||||
|
||||
#include <GLES2/gl2platform.h>
|
||||
#define __gl2_h_ 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* This document is licensed under the SGI Free Software B License Version
|
||||
* 2.0. For details, see http://oss.sgi.com/projects/FreeB/ .
|
||||
** Copyright (c) 2013-2015 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
|
||||
** "Materials"), to deal in the Materials without restriction, including
|
||||
** without limitation the rights to use, copy, modify, merge, publish,
|
||||
** distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
** permit persons to whom the Materials are furnished to do so, subject to
|
||||
** the following conditions:
|
||||
**
|
||||
** The above copyright notice and this permission notice shall be included
|
||||
** in all copies or substantial portions of the Materials.
|
||||
**
|
||||
** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
*/
|
||||
/*
|
||||
** This header is generated from the Khronos OpenGL / OpenGL ES XML
|
||||
** API Registry. The current version of the Registry, generator scripts
|
||||
** used to make the header, and the header can be found at
|
||||
** http://www.opengl.org/registry/
|
||||
**
|
||||
** Khronos $Revision: 31811 $ on $Date: 2015-08-10 00:01:11 -0700 (Mon, 10 Aug 2015) $
|
||||
*/
|
||||
|
||||
#include <GLES2/gl2platform.h>
|
||||
|
||||
#ifndef GL_APIENTRYP
|
||||
#define GL_APIENTRYP GL_APIENTRY*
|
||||
#endif
|
||||
|
||||
/* Generated on date 20150809 */
|
||||
|
||||
/* Generated C header for:
|
||||
* API: gles2
|
||||
* Profile: common
|
||||
* Versions considered: 2\.[0-9]
|
||||
* Versions emitted: .*
|
||||
* Default extensions included: None
|
||||
* Additional extensions included: _nomatch_^
|
||||
* Extensions removed: _nomatch_^
|
||||
*/
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Data type definitions
|
||||
*-----------------------------------------------------------------------*/
|
||||
|
||||
typedef void GLvoid;
|
||||
typedef char GLchar;
|
||||
typedef unsigned int GLenum;
|
||||
typedef unsigned char GLboolean;
|
||||
typedef unsigned int GLbitfield;
|
||||
typedef khronos_int8_t GLbyte;
|
||||
typedef short GLshort;
|
||||
typedef int GLint;
|
||||
typedef int GLsizei;
|
||||
typedef khronos_uint8_t GLubyte;
|
||||
typedef unsigned short GLushort;
|
||||
typedef unsigned int GLuint;
|
||||
typedef khronos_float_t GLfloat;
|
||||
typedef khronos_float_t GLclampf;
|
||||
typedef khronos_int32_t GLfixed;
|
||||
|
||||
/* GL types for handling large vertex buffer objects */
|
||||
#ifndef GL_ES_VERSION_2_0
|
||||
#define GL_ES_VERSION_2_0 1
|
||||
#include <KHR/khrplatform.h>
|
||||
typedef khronos_int8_t GLbyte;
|
||||
typedef khronos_float_t GLclampf;
|
||||
typedef khronos_int32_t GLfixed;
|
||||
typedef short GLshort;
|
||||
typedef unsigned short GLushort;
|
||||
typedef void GLvoid;
|
||||
typedef struct __GLsync *GLsync;
|
||||
typedef khronos_int64_t GLint64;
|
||||
typedef khronos_uint64_t GLuint64;
|
||||
typedef unsigned int GLenum;
|
||||
typedef unsigned int GLuint;
|
||||
typedef char GLchar;
|
||||
typedef khronos_float_t GLfloat;
|
||||
typedef khronos_ssize_t GLsizeiptr;
|
||||
typedef khronos_intptr_t GLintptr;
|
||||
typedef khronos_ssize_t GLsizeiptr;
|
||||
|
||||
/* OpenGL ES core versions */
|
||||
#define GL_ES_VERSION_2_0 1
|
||||
|
||||
/* ClearBufferMask */
|
||||
typedef unsigned int GLbitfield;
|
||||
typedef int GLint;
|
||||
typedef unsigned char GLboolean;
|
||||
typedef int GLsizei;
|
||||
typedef khronos_uint8_t GLubyte;
|
||||
#define GL_DEPTH_BUFFER_BIT 0x00000100
|
||||
#define GL_STENCIL_BUFFER_BIT 0x00000400
|
||||
#define GL_COLOR_BUFFER_BIT 0x00004000
|
||||
|
||||
/* Boolean */
|
||||
#define GL_FALSE 0
|
||||
#define GL_TRUE 1
|
||||
|
||||
/* BeginMode */
|
||||
#define GL_POINTS 0x0000
|
||||
#define GL_LINES 0x0001
|
||||
#define GL_LINE_LOOP 0x0002
|
||||
@ -58,18 +89,6 @@ typedef khronos_ssize_t GLsizeiptr;
|
||||
#define GL_TRIANGLES 0x0004
|
||||
#define GL_TRIANGLE_STRIP 0x0005
|
||||
#define GL_TRIANGLE_FAN 0x0006
|
||||
|
||||
/* AlphaFunction (not supported in ES20) */
|
||||
/* GL_NEVER */
|
||||
/* GL_LESS */
|
||||
/* GL_EQUAL */
|
||||
/* GL_LEQUAL */
|
||||
/* GL_GREATER */
|
||||
/* GL_NOTEQUAL */
|
||||
/* GL_GEQUAL */
|
||||
/* GL_ALWAYS */
|
||||
|
||||
/* BlendingFactorDest */
|
||||
#define GL_ZERO 0
|
||||
#define GL_ONE 1
|
||||
#define GL_SRC_COLOR 0x0300
|
||||
@ -78,29 +97,15 @@ typedef khronos_ssize_t GLsizeiptr;
|
||||
#define GL_ONE_MINUS_SRC_ALPHA 0x0303
|
||||
#define GL_DST_ALPHA 0x0304
|
||||
#define GL_ONE_MINUS_DST_ALPHA 0x0305
|
||||
|
||||
/* BlendingFactorSrc */
|
||||
/* GL_ZERO */
|
||||
/* GL_ONE */
|
||||
#define GL_DST_COLOR 0x0306
|
||||
#define GL_ONE_MINUS_DST_COLOR 0x0307
|
||||
#define GL_SRC_ALPHA_SATURATE 0x0308
|
||||
/* GL_SRC_ALPHA */
|
||||
/* GL_ONE_MINUS_SRC_ALPHA */
|
||||
/* GL_DST_ALPHA */
|
||||
/* GL_ONE_MINUS_DST_ALPHA */
|
||||
|
||||
/* BlendEquationSeparate */
|
||||
#define GL_FUNC_ADD 0x8006
|
||||
#define GL_BLEND_EQUATION 0x8009
|
||||
#define GL_BLEND_EQUATION_RGB 0x8009 /* same as BLEND_EQUATION */
|
||||
#define GL_BLEND_EQUATION_RGB 0x8009
|
||||
#define GL_BLEND_EQUATION_ALPHA 0x883D
|
||||
|
||||
/* BlendSubtract */
|
||||
#define GL_FUNC_SUBTRACT 0x800A
|
||||
#define GL_FUNC_REVERSE_SUBTRACT 0x800B
|
||||
|
||||
/* Separate Blend Functions */
|
||||
#define GL_BLEND_DST_RGB 0x80C8
|
||||
#define GL_BLEND_SRC_RGB 0x80C9
|
||||
#define GL_BLEND_DST_ALPHA 0x80CA
|
||||
@ -110,38 +115,19 @@ typedef khronos_ssize_t GLsizeiptr;
|
||||
#define GL_CONSTANT_ALPHA 0x8003
|
||||
#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004
|
||||
#define GL_BLEND_COLOR 0x8005
|
||||
|
||||
/* Buffer Objects */
|
||||
#define GL_ARRAY_BUFFER 0x8892
|
||||
#define GL_ELEMENT_ARRAY_BUFFER 0x8893
|
||||
#define GL_ARRAY_BUFFER_BINDING 0x8894
|
||||
#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895
|
||||
|
||||
#define GL_STREAM_DRAW 0x88E0
|
||||
#define GL_STATIC_DRAW 0x88E4
|
||||
#define GL_DYNAMIC_DRAW 0x88E8
|
||||
|
||||
#define GL_BUFFER_SIZE 0x8764
|
||||
#define GL_BUFFER_USAGE 0x8765
|
||||
|
||||
#define GL_CURRENT_VERTEX_ATTRIB 0x8626
|
||||
|
||||
/* CullFaceMode */
|
||||
#define GL_FRONT 0x0404
|
||||
#define GL_BACK 0x0405
|
||||
#define GL_FRONT_AND_BACK 0x0408
|
||||
|
||||
/* DepthFunction */
|
||||
/* GL_NEVER */
|
||||
/* GL_LESS */
|
||||
/* GL_EQUAL */
|
||||
/* GL_LEQUAL */
|
||||
/* GL_GREATER */
|
||||
/* GL_NOTEQUAL */
|
||||
/* GL_GEQUAL */
|
||||
/* GL_ALWAYS */
|
||||
|
||||
/* EnableCap */
|
||||
#define GL_TEXTURE_2D 0x0DE1
|
||||
#define GL_CULL_FACE 0x0B44
|
||||
#define GL_BLEND 0x0BE2
|
||||
@ -152,19 +138,13 @@ typedef khronos_ssize_t GLsizeiptr;
|
||||
#define GL_POLYGON_OFFSET_FILL 0x8037
|
||||
#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E
|
||||
#define GL_SAMPLE_COVERAGE 0x80A0
|
||||
|
||||
/* ErrorCode */
|
||||
#define GL_NO_ERROR 0
|
||||
#define GL_INVALID_ENUM 0x0500
|
||||
#define GL_INVALID_VALUE 0x0501
|
||||
#define GL_INVALID_OPERATION 0x0502
|
||||
#define GL_OUT_OF_MEMORY 0x0505
|
||||
|
||||
/* FrontFaceDirection */
|
||||
#define GL_CW 0x0900
|
||||
#define GL_CCW 0x0901
|
||||
|
||||
/* GetPName */
|
||||
#define GL_LINE_WIDTH 0x0B21
|
||||
#define GL_ALIASED_POINT_SIZE_RANGE 0x846D
|
||||
#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E
|
||||
@ -191,7 +171,6 @@ typedef khronos_ssize_t GLsizeiptr;
|
||||
#define GL_STENCIL_BACK_WRITEMASK 0x8CA5
|
||||
#define GL_VIEWPORT 0x0BA2
|
||||
#define GL_SCISSOR_BOX 0x0C10
|
||||
/* GL_SCISSOR_TEST */
|
||||
#define GL_COLOR_CLEAR_VALUE 0x0C22
|
||||
#define GL_COLOR_WRITEMASK 0x0C23
|
||||
#define GL_UNPACK_ALIGNMENT 0x0CF5
|
||||
@ -206,32 +185,18 @@ typedef khronos_ssize_t GLsizeiptr;
|
||||
#define GL_DEPTH_BITS 0x0D56
|
||||
#define GL_STENCIL_BITS 0x0D57
|
||||
#define GL_POLYGON_OFFSET_UNITS 0x2A00
|
||||
/* GL_POLYGON_OFFSET_FILL */
|
||||
#define GL_POLYGON_OFFSET_FACTOR 0x8038
|
||||
#define GL_TEXTURE_BINDING_2D 0x8069
|
||||
#define GL_SAMPLE_BUFFERS 0x80A8
|
||||
#define GL_SAMPLES 0x80A9
|
||||
#define GL_SAMPLE_COVERAGE_VALUE 0x80AA
|
||||
#define GL_SAMPLE_COVERAGE_INVERT 0x80AB
|
||||
|
||||
/* GetTextureParameter */
|
||||
/* GL_TEXTURE_MAG_FILTER */
|
||||
/* GL_TEXTURE_MIN_FILTER */
|
||||
/* GL_TEXTURE_WRAP_S */
|
||||
/* GL_TEXTURE_WRAP_T */
|
||||
|
||||
#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2
|
||||
#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3
|
||||
|
||||
/* HintMode */
|
||||
#define GL_DONT_CARE 0x1100
|
||||
#define GL_FASTEST 0x1101
|
||||
#define GL_NICEST 0x1102
|
||||
|
||||
/* HintTarget */
|
||||
#define GL_GENERATE_MIPMAP_HINT 0x8192
|
||||
|
||||
/* DataType */
|
||||
#define GL_GENERATE_MIPMAP_HINT 0x8192
|
||||
#define GL_BYTE 0x1400
|
||||
#define GL_UNSIGNED_BYTE 0x1401
|
||||
#define GL_SHORT 0x1402
|
||||
@ -240,44 +205,35 @@ typedef khronos_ssize_t GLsizeiptr;
|
||||
#define GL_UNSIGNED_INT 0x1405
|
||||
#define GL_FLOAT 0x1406
|
||||
#define GL_FIXED 0x140C
|
||||
|
||||
/* PixelFormat */
|
||||
#define GL_DEPTH_COMPONENT 0x1902
|
||||
#define GL_ALPHA 0x1906
|
||||
#define GL_RGB 0x1907
|
||||
#define GL_RGBA 0x1908
|
||||
#define GL_LUMINANCE 0x1909
|
||||
#define GL_LUMINANCE_ALPHA 0x190A
|
||||
|
||||
/* PixelType */
|
||||
/* GL_UNSIGNED_BYTE */
|
||||
#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033
|
||||
#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034
|
||||
#define GL_UNSIGNED_SHORT_5_6_5 0x8363
|
||||
|
||||
/* Shaders */
|
||||
#define GL_FRAGMENT_SHADER 0x8B30
|
||||
#define GL_VERTEX_SHADER 0x8B31
|
||||
#define GL_MAX_VERTEX_ATTRIBS 0x8869
|
||||
#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB
|
||||
#define GL_MAX_VARYING_VECTORS 0x8DFC
|
||||
#define GL_FRAGMENT_SHADER 0x8B30
|
||||
#define GL_VERTEX_SHADER 0x8B31
|
||||
#define GL_MAX_VERTEX_ATTRIBS 0x8869
|
||||
#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB
|
||||
#define GL_MAX_VARYING_VECTORS 0x8DFC
|
||||
#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D
|
||||
#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C
|
||||
#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872
|
||||
#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD
|
||||
#define GL_SHADER_TYPE 0x8B4F
|
||||
#define GL_DELETE_STATUS 0x8B80
|
||||
#define GL_LINK_STATUS 0x8B82
|
||||
#define GL_VALIDATE_STATUS 0x8B83
|
||||
#define GL_ATTACHED_SHADERS 0x8B85
|
||||
#define GL_ACTIVE_UNIFORMS 0x8B86
|
||||
#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87
|
||||
#define GL_ACTIVE_ATTRIBUTES 0x8B89
|
||||
#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A
|
||||
#define GL_SHADING_LANGUAGE_VERSION 0x8B8C
|
||||
#define GL_CURRENT_PROGRAM 0x8B8D
|
||||
|
||||
/* StencilFunction */
|
||||
#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C
|
||||
#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872
|
||||
#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD
|
||||
#define GL_SHADER_TYPE 0x8B4F
|
||||
#define GL_DELETE_STATUS 0x8B80
|
||||
#define GL_LINK_STATUS 0x8B82
|
||||
#define GL_VALIDATE_STATUS 0x8B83
|
||||
#define GL_ATTACHED_SHADERS 0x8B85
|
||||
#define GL_ACTIVE_UNIFORMS 0x8B86
|
||||
#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87
|
||||
#define GL_ACTIVE_ATTRIBUTES 0x8B89
|
||||
#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A
|
||||
#define GL_SHADING_LANGUAGE_VERSION 0x8B8C
|
||||
#define GL_CURRENT_PROGRAM 0x8B8D
|
||||
#define GL_NEVER 0x0200
|
||||
#define GL_LESS 0x0201
|
||||
#define GL_EQUAL 0x0202
|
||||
@ -286,9 +242,6 @@ typedef khronos_ssize_t GLsizeiptr;
|
||||
#define GL_NOTEQUAL 0x0205
|
||||
#define GL_GEQUAL 0x0206
|
||||
#define GL_ALWAYS 0x0207
|
||||
|
||||
/* StencilOp */
|
||||
/* GL_ZERO */
|
||||
#define GL_KEEP 0x1E00
|
||||
#define GL_REPLACE 0x1E01
|
||||
#define GL_INCR 0x1E02
|
||||
@ -296,35 +249,21 @@ typedef khronos_ssize_t GLsizeiptr;
|
||||
#define GL_INVERT 0x150A
|
||||
#define GL_INCR_WRAP 0x8507
|
||||
#define GL_DECR_WRAP 0x8508
|
||||
|
||||
/* StringName */
|
||||
#define GL_VENDOR 0x1F00
|
||||
#define GL_RENDERER 0x1F01
|
||||
#define GL_VERSION 0x1F02
|
||||
#define GL_EXTENSIONS 0x1F03
|
||||
|
||||
/* TextureMagFilter */
|
||||
#define GL_NEAREST 0x2600
|
||||
#define GL_LINEAR 0x2601
|
||||
|
||||
/* TextureMinFilter */
|
||||
/* GL_NEAREST */
|
||||
/* GL_LINEAR */
|
||||
#define GL_NEAREST_MIPMAP_NEAREST 0x2700
|
||||
#define GL_LINEAR_MIPMAP_NEAREST 0x2701
|
||||
#define GL_NEAREST_MIPMAP_LINEAR 0x2702
|
||||
#define GL_LINEAR_MIPMAP_LINEAR 0x2703
|
||||
|
||||
/* TextureParameterName */
|
||||
#define GL_TEXTURE_MAG_FILTER 0x2800
|
||||
#define GL_TEXTURE_MIN_FILTER 0x2801
|
||||
#define GL_TEXTURE_WRAP_S 0x2802
|
||||
#define GL_TEXTURE_WRAP_T 0x2803
|
||||
|
||||
/* TextureTarget */
|
||||
/* GL_TEXTURE_2D */
|
||||
#define GL_TEXTURE 0x1702
|
||||
|
||||
#define GL_TEXTURE_CUBE_MAP 0x8513
|
||||
#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514
|
||||
#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515
|
||||
@ -334,8 +273,6 @@ typedef khronos_ssize_t GLsizeiptr;
|
||||
#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519
|
||||
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A
|
||||
#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C
|
||||
|
||||
/* TextureUnit */
|
||||
#define GL_TEXTURE0 0x84C0
|
||||
#define GL_TEXTURE1 0x84C1
|
||||
#define GL_TEXTURE2 0x84C2
|
||||
@ -369,13 +306,9 @@ typedef khronos_ssize_t GLsizeiptr;
|
||||
#define GL_TEXTURE30 0x84DE
|
||||
#define GL_TEXTURE31 0x84DF
|
||||
#define GL_ACTIVE_TEXTURE 0x84E0
|
||||
|
||||
/* TextureWrapMode */
|
||||
#define GL_REPEAT 0x2901
|
||||
#define GL_CLAMP_TO_EDGE 0x812F
|
||||
#define GL_MIRRORED_REPEAT 0x8370
|
||||
|
||||
/* Uniform Types */
|
||||
#define GL_FLOAT_VEC2 0x8B50
|
||||
#define GL_FLOAT_VEC3 0x8B51
|
||||
#define GL_FLOAT_VEC4 0x8B52
|
||||
@ -391,48 +324,34 @@ typedef khronos_ssize_t GLsizeiptr;
|
||||
#define GL_FLOAT_MAT4 0x8B5C
|
||||
#define GL_SAMPLER_2D 0x8B5E
|
||||
#define GL_SAMPLER_CUBE 0x8B60
|
||||
|
||||
/* Vertex Arrays */
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F
|
||||
|
||||
/* Read Format */
|
||||
#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A
|
||||
#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A
|
||||
#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B
|
||||
|
||||
/* Shader Source */
|
||||
#define GL_COMPILE_STATUS 0x8B81
|
||||
#define GL_INFO_LOG_LENGTH 0x8B84
|
||||
#define GL_SHADER_SOURCE_LENGTH 0x8B88
|
||||
#define GL_SHADER_COMPILER 0x8DFA
|
||||
|
||||
/* Shader Binary */
|
||||
#define GL_SHADER_BINARY_FORMATS 0x8DF8
|
||||
#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9
|
||||
|
||||
/* Shader Precision-Specified Types */
|
||||
#define GL_LOW_FLOAT 0x8DF0
|
||||
#define GL_MEDIUM_FLOAT 0x8DF1
|
||||
#define GL_HIGH_FLOAT 0x8DF2
|
||||
#define GL_LOW_INT 0x8DF3
|
||||
#define GL_MEDIUM_INT 0x8DF4
|
||||
#define GL_HIGH_INT 0x8DF5
|
||||
|
||||
/* Framebuffer Object. */
|
||||
#define GL_FRAMEBUFFER 0x8D40
|
||||
#define GL_RENDERBUFFER 0x8D41
|
||||
|
||||
#define GL_RGBA4 0x8056
|
||||
#define GL_RGB5_A1 0x8057
|
||||
#define GL_RGB565 0x8D62
|
||||
#define GL_DEPTH_COMPONENT16 0x81A5
|
||||
#define GL_STENCIL_INDEX8 0x8D48
|
||||
|
||||
#define GL_RENDERBUFFER_WIDTH 0x8D42
|
||||
#define GL_RENDERBUFFER_HEIGHT 0x8D43
|
||||
#define GL_RENDERBUFFER_INTERNAL_FORMAT 0x8D44
|
||||
@ -442,179 +361,313 @@ typedef khronos_ssize_t GLsizeiptr;
|
||||
#define GL_RENDERBUFFER_ALPHA_SIZE 0x8D53
|
||||
#define GL_RENDERBUFFER_DEPTH_SIZE 0x8D54
|
||||
#define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55
|
||||
|
||||
#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0
|
||||
#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1
|
||||
#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2
|
||||
#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0
|
||||
#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1
|
||||
#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2
|
||||
#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3
|
||||
|
||||
#define GL_COLOR_ATTACHMENT0 0x8CE0
|
||||
#define GL_DEPTH_ATTACHMENT 0x8D00
|
||||
#define GL_STENCIL_ATTACHMENT 0x8D20
|
||||
|
||||
#define GL_NONE 0
|
||||
|
||||
#define GL_FRAMEBUFFER_COMPLETE 0x8CD5
|
||||
#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6
|
||||
#define GL_FRAMEBUFFER_COMPLETE 0x8CD5
|
||||
#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6
|
||||
#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7
|
||||
#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS 0x8CD9
|
||||
#define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD
|
||||
|
||||
#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS 0x8CD9
|
||||
#define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD
|
||||
#define GL_FRAMEBUFFER_BINDING 0x8CA6
|
||||
#define GL_RENDERBUFFER_BINDING 0x8CA7
|
||||
#define GL_MAX_RENDERBUFFER_SIZE 0x84E8
|
||||
|
||||
#define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* GL core functions.
|
||||
*-----------------------------------------------------------------------*/
|
||||
|
||||
GL_APICALL void GL_APIENTRY glActiveTexture (GLenum texture);
|
||||
GL_APICALL void GL_APIENTRY glAttachShader (GLuint program, GLuint shader);
|
||||
GL_APICALL void GL_APIENTRY glBindAttribLocation (GLuint program, GLuint index, const GLchar* name);
|
||||
GL_APICALL void GL_APIENTRY glBindBuffer (GLenum target, GLuint buffer);
|
||||
GL_APICALL void GL_APIENTRY glBindFramebuffer (GLenum target, GLuint framebuffer);
|
||||
GL_APICALL void GL_APIENTRY glBindRenderbuffer (GLenum target, GLuint renderbuffer);
|
||||
GL_APICALL void GL_APIENTRY glBindTexture (GLenum target, GLuint texture);
|
||||
GL_APICALL void GL_APIENTRY glBlendColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
|
||||
GL_APICALL void GL_APIENTRY glBlendEquation ( GLenum mode );
|
||||
GL_APICALL void GL_APIENTRY glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha);
|
||||
GL_APICALL void GL_APIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor);
|
||||
GL_APICALL void GL_APIENTRY glBlendFuncSeparate (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
|
||||
GL_APICALL void GL_APIENTRY glBufferData (GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage);
|
||||
GL_APICALL void GL_APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data);
|
||||
GL_APICALL GLenum GL_APIENTRY glCheckFramebufferStatus (GLenum target);
|
||||
GL_APICALL void GL_APIENTRY glClear (GLbitfield mask);
|
||||
GL_APICALL void GL_APIENTRY glClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
|
||||
GL_APICALL void GL_APIENTRY glClearDepthf (GLclampf depth);
|
||||
GL_APICALL void GL_APIENTRY glClearStencil (GLint s);
|
||||
GL_APICALL void GL_APIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
|
||||
GL_APICALL void GL_APIENTRY glCompileShader (GLuint shader);
|
||||
GL_APICALL void GL_APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid* data);
|
||||
GL_APICALL void GL_APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid* data);
|
||||
GL_APICALL void GL_APIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
|
||||
GL_APICALL void GL_APIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
GL_APICALL GLuint GL_APIENTRY glCreateProgram (void);
|
||||
GL_APICALL GLuint GL_APIENTRY glCreateShader (GLenum type);
|
||||
GL_APICALL void GL_APIENTRY glCullFace (GLenum mode);
|
||||
GL_APICALL void GL_APIENTRY glDeleteBuffers (GLsizei n, const GLuint* buffers);
|
||||
GL_APICALL void GL_APIENTRY glDeleteFramebuffers (GLsizei n, const GLuint* framebuffers);
|
||||
GL_APICALL void GL_APIENTRY glDeleteProgram (GLuint program);
|
||||
GL_APICALL void GL_APIENTRY glDeleteRenderbuffers (GLsizei n, const GLuint* renderbuffers);
|
||||
GL_APICALL void GL_APIENTRY glDeleteShader (GLuint shader);
|
||||
GL_APICALL void GL_APIENTRY glDeleteTextures (GLsizei n, const GLuint* textures);
|
||||
GL_APICALL void GL_APIENTRY glDepthFunc (GLenum func);
|
||||
GL_APICALL void GL_APIENTRY glDepthMask (GLboolean flag);
|
||||
GL_APICALL void GL_APIENTRY glDepthRangef (GLclampf zNear, GLclampf zFar);
|
||||
GL_APICALL void GL_APIENTRY glDetachShader (GLuint program, GLuint shader);
|
||||
GL_APICALL void GL_APIENTRY glDisable (GLenum cap);
|
||||
GL_APICALL void GL_APIENTRY glDisableVertexAttribArray (GLuint index);
|
||||
GL_APICALL void GL_APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count);
|
||||
GL_APICALL void GL_APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const GLvoid* indices);
|
||||
GL_APICALL void GL_APIENTRY glEnable (GLenum cap);
|
||||
GL_APICALL void GL_APIENTRY glEnableVertexAttribArray (GLuint index);
|
||||
GL_APICALL void GL_APIENTRY glFinish (void);
|
||||
GL_APICALL void GL_APIENTRY glFlush (void);
|
||||
GL_APICALL void GL_APIENTRY glFramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
|
||||
GL_APICALL void GL_APIENTRY glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
|
||||
GL_APICALL void GL_APIENTRY glFrontFace (GLenum mode);
|
||||
GL_APICALL void GL_APIENTRY glGenBuffers (GLsizei n, GLuint* buffers);
|
||||
GL_APICALL void GL_APIENTRY glGenerateMipmap (GLenum target);
|
||||
GL_APICALL void GL_APIENTRY glGenFramebuffers (GLsizei n, GLuint* framebuffers);
|
||||
GL_APICALL void GL_APIENTRY glGenRenderbuffers (GLsizei n, GLuint* renderbuffers);
|
||||
GL_APICALL void GL_APIENTRY glGenTextures (GLsizei n, GLuint* textures);
|
||||
GL_APICALL void GL_APIENTRY glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name);
|
||||
GL_APICALL void GL_APIENTRY glGetActiveUniform (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name);
|
||||
GL_APICALL void GL_APIENTRY glGetAttachedShaders (GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders);
|
||||
GL_APICALL GLint GL_APIENTRY glGetAttribLocation (GLuint program, const GLchar* name);
|
||||
GL_APICALL void GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean* params);
|
||||
GL_APICALL void GL_APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint* params);
|
||||
GL_APICALL GLenum GL_APIENTRY glGetError (void);
|
||||
GL_APICALL void GL_APIENTRY glGetFloatv (GLenum pname, GLfloat* params);
|
||||
GL_APICALL void GL_APIENTRY glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint* params);
|
||||
GL_APICALL void GL_APIENTRY glGetIntegerv (GLenum pname, GLint* params);
|
||||
GL_APICALL void GL_APIENTRY glGetProgramiv (GLuint program, GLenum pname, GLint* params);
|
||||
GL_APICALL void GL_APIENTRY glGetProgramInfoLog (GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog);
|
||||
GL_APICALL void GL_APIENTRY glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint* params);
|
||||
GL_APICALL void GL_APIENTRY glGetShaderiv (GLuint shader, GLenum pname, GLint* params);
|
||||
GL_APICALL void GL_APIENTRY glGetShaderInfoLog (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog);
|
||||
GL_APICALL void GL_APIENTRY glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision);
|
||||
GL_APICALL void GL_APIENTRY glGetShaderSource (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source);
|
||||
GL_APICALL const GLubyte* GL_APIENTRY glGetString (GLenum name);
|
||||
GL_APICALL void GL_APIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat* params);
|
||||
GL_APICALL void GL_APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint* params);
|
||||
GL_APICALL void GL_APIENTRY glGetUniformfv (GLuint program, GLint location, GLfloat* params);
|
||||
GL_APICALL void GL_APIENTRY glGetUniformiv (GLuint program, GLint location, GLint* params);
|
||||
GL_APICALL GLint GL_APIENTRY glGetUniformLocation (GLuint program, const GLchar* name);
|
||||
GL_APICALL void GL_APIENTRY glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat* params);
|
||||
GL_APICALL void GL_APIENTRY glGetVertexAttribiv (GLuint index, GLenum pname, GLint* params);
|
||||
GL_APICALL void GL_APIENTRY glGetVertexAttribPointerv (GLuint index, GLenum pname, GLvoid** pointer);
|
||||
GL_APICALL void GL_APIENTRY glHint (GLenum target, GLenum mode);
|
||||
GL_APICALL GLboolean GL_APIENTRY glIsBuffer (GLuint buffer);
|
||||
GL_APICALL GLboolean GL_APIENTRY glIsEnabled (GLenum cap);
|
||||
GL_APICALL GLboolean GL_APIENTRY glIsFramebuffer (GLuint framebuffer);
|
||||
GL_APICALL GLboolean GL_APIENTRY glIsProgram (GLuint program);
|
||||
GL_APICALL GLboolean GL_APIENTRY glIsRenderbuffer (GLuint renderbuffer);
|
||||
GL_APICALL GLboolean GL_APIENTRY glIsShader (GLuint shader);
|
||||
GL_APICALL GLboolean GL_APIENTRY glIsTexture (GLuint texture);
|
||||
GL_APICALL void GL_APIENTRY glLineWidth (GLfloat width);
|
||||
GL_APICALL void GL_APIENTRY glLinkProgram (GLuint program);
|
||||
GL_APICALL void GL_APIENTRY glPixelStorei (GLenum pname, GLint param);
|
||||
GL_APICALL void GL_APIENTRY glPolygonOffset (GLfloat factor, GLfloat units);
|
||||
GL_APICALL void GL_APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels);
|
||||
GL_APICALL void GL_APIENTRY glReleaseShaderCompiler (void);
|
||||
GL_APICALL void GL_APIENTRY glRenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
|
||||
GL_APICALL void GL_APIENTRY glSampleCoverage (GLclampf value, GLboolean invert);
|
||||
GL_APICALL void GL_APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
GL_APICALL void GL_APIENTRY glShaderBinary (GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length);
|
||||
GL_APICALL void GL_APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar* const* string, const GLint* length);
|
||||
GL_APICALL void GL_APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask);
|
||||
GL_APICALL void GL_APIENTRY glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask);
|
||||
GL_APICALL void GL_APIENTRY glStencilMask (GLuint mask);
|
||||
GL_APICALL void GL_APIENTRY glStencilMaskSeparate (GLenum face, GLuint mask);
|
||||
GL_APICALL void GL_APIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass);
|
||||
GL_APICALL void GL_APIENTRY glStencilOpSeparate (GLenum face, GLenum fail, GLenum zfail, GLenum zpass);
|
||||
GL_APICALL void GL_APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels);
|
||||
GL_APICALL void GL_APIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param);
|
||||
GL_APICALL void GL_APIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat* params);
|
||||
GL_APICALL void GL_APIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param);
|
||||
GL_APICALL void GL_APIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint* params);
|
||||
GL_APICALL void GL_APIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels);
|
||||
GL_APICALL void GL_APIENTRY glUniform1f (GLint location, GLfloat x);
|
||||
GL_APICALL void GL_APIENTRY glUniform1fv (GLint location, GLsizei count, const GLfloat* v);
|
||||
GL_APICALL void GL_APIENTRY glUniform1i (GLint location, GLint x);
|
||||
GL_APICALL void GL_APIENTRY glUniform1iv (GLint location, GLsizei count, const GLint* v);
|
||||
GL_APICALL void GL_APIENTRY glUniform2f (GLint location, GLfloat x, GLfloat y);
|
||||
GL_APICALL void GL_APIENTRY glUniform2fv (GLint location, GLsizei count, const GLfloat* v);
|
||||
GL_APICALL void GL_APIENTRY glUniform2i (GLint location, GLint x, GLint y);
|
||||
GL_APICALL void GL_APIENTRY glUniform2iv (GLint location, GLsizei count, const GLint* v);
|
||||
GL_APICALL void GL_APIENTRY glUniform3f (GLint location, GLfloat x, GLfloat y, GLfloat z);
|
||||
GL_APICALL void GL_APIENTRY glUniform3fv (GLint location, GLsizei count, const GLfloat* v);
|
||||
GL_APICALL void GL_APIENTRY glUniform3i (GLint location, GLint x, GLint y, GLint z);
|
||||
GL_APICALL void GL_APIENTRY glUniform3iv (GLint location, GLsizei count, const GLint* v);
|
||||
GL_APICALL void GL_APIENTRY glUniform4f (GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
|
||||
GL_APICALL void GL_APIENTRY glUniform4fv (GLint location, GLsizei count, const GLfloat* v);
|
||||
GL_APICALL void GL_APIENTRY glUniform4i (GLint location, GLint x, GLint y, GLint z, GLint w);
|
||||
GL_APICALL void GL_APIENTRY glUniform4iv (GLint location, GLsizei count, const GLint* v);
|
||||
GL_APICALL void GL_APIENTRY glUniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
|
||||
GL_APICALL void GL_APIENTRY glUniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
|
||||
GL_APICALL void GL_APIENTRY glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
|
||||
GL_APICALL void GL_APIENTRY glUseProgram (GLuint program);
|
||||
GL_APICALL void GL_APIENTRY glValidateProgram (GLuint program);
|
||||
GL_APICALL void GL_APIENTRY glVertexAttrib1f (GLuint indx, GLfloat x);
|
||||
GL_APICALL void GL_APIENTRY glVertexAttrib1fv (GLuint indx, const GLfloat* values);
|
||||
GL_APICALL void GL_APIENTRY glVertexAttrib2f (GLuint indx, GLfloat x, GLfloat y);
|
||||
GL_APICALL void GL_APIENTRY glVertexAttrib2fv (GLuint indx, const GLfloat* values);
|
||||
GL_APICALL void GL_APIENTRY glVertexAttrib3f (GLuint indx, GLfloat x, GLfloat y, GLfloat z);
|
||||
GL_APICALL void GL_APIENTRY glVertexAttrib3fv (GLuint indx, const GLfloat* values);
|
||||
GL_APICALL void GL_APIENTRY glVertexAttrib4f (GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
|
||||
GL_APICALL void GL_APIENTRY glVertexAttrib4fv (GLuint indx, const GLfloat* values);
|
||||
GL_APICALL void GL_APIENTRY glVertexAttribPointer (GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr);
|
||||
GL_APICALL void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
typedef void (GL_APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture);
|
||||
typedef void (GL_APIENTRYP PFNGLATTACHSHADERPROC) (GLuint program, GLuint shader);
|
||||
typedef void (GL_APIENTRYP PFNGLBINDATTRIBLOCATIONPROC) (GLuint program, GLuint index, const GLchar *name);
|
||||
typedef void (GL_APIENTRYP PFNGLBINDBUFFERPROC) (GLenum target, GLuint buffer);
|
||||
typedef void (GL_APIENTRYP PFNGLBINDFRAMEBUFFERPROC) (GLenum target, GLuint framebuffer);
|
||||
typedef void (GL_APIENTRYP PFNGLBINDRENDERBUFFERPROC) (GLenum target, GLuint renderbuffer);
|
||||
typedef void (GL_APIENTRYP PFNGLBINDTEXTUREPROC) (GLenum target, GLuint texture);
|
||||
typedef void (GL_APIENTRYP PFNGLBLENDCOLORPROC) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
|
||||
typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONPROC) (GLenum mode);
|
||||
typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONSEPARATEPROC) (GLenum modeRGB, GLenum modeAlpha);
|
||||
typedef void (GL_APIENTRYP PFNGLBLENDFUNCPROC) (GLenum sfactor, GLenum dfactor);
|
||||
typedef void (GL_APIENTRYP PFNGLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
|
||||
typedef void (GL_APIENTRYP PFNGLBUFFERDATAPROC) (GLenum target, GLsizeiptr size, const void *data, GLenum usage);
|
||||
typedef void (GL_APIENTRYP PFNGLBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, const void *data);
|
||||
typedef GLenum (GL_APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSPROC) (GLenum target);
|
||||
typedef void (GL_APIENTRYP PFNGLCLEARPROC) (GLbitfield mask);
|
||||
typedef void (GL_APIENTRYP PFNGLCLEARCOLORPROC) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
|
||||
typedef void (GL_APIENTRYP PFNGLCLEARDEPTHFPROC) (GLfloat d);
|
||||
typedef void (GL_APIENTRYP PFNGLCLEARSTENCILPROC) (GLint s);
|
||||
typedef void (GL_APIENTRYP PFNGLCOLORMASKPROC) (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
|
||||
typedef void (GL_APIENTRYP PFNGLCOMPILESHADERPROC) (GLuint shader);
|
||||
typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data);
|
||||
typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data);
|
||||
typedef void (GL_APIENTRYP PFNGLCOPYTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
|
||||
typedef void (GL_APIENTRYP PFNGLCOPYTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
typedef GLuint (GL_APIENTRYP PFNGLCREATEPROGRAMPROC) (void);
|
||||
typedef GLuint (GL_APIENTRYP PFNGLCREATESHADERPROC) (GLenum type);
|
||||
typedef void (GL_APIENTRYP PFNGLCULLFACEPROC) (GLenum mode);
|
||||
typedef void (GL_APIENTRYP PFNGLDELETEBUFFERSPROC) (GLsizei n, const GLuint *buffers);
|
||||
typedef void (GL_APIENTRYP PFNGLDELETEFRAMEBUFFERSPROC) (GLsizei n, const GLuint *framebuffers);
|
||||
typedef void (GL_APIENTRYP PFNGLDELETEPROGRAMPROC) (GLuint program);
|
||||
typedef void (GL_APIENTRYP PFNGLDELETERENDERBUFFERSPROC) (GLsizei n, const GLuint *renderbuffers);
|
||||
typedef void (GL_APIENTRYP PFNGLDELETESHADERPROC) (GLuint shader);
|
||||
typedef void (GL_APIENTRYP PFNGLDELETETEXTURESPROC) (GLsizei n, const GLuint *textures);
|
||||
typedef void (GL_APIENTRYP PFNGLDEPTHFUNCPROC) (GLenum func);
|
||||
typedef void (GL_APIENTRYP PFNGLDEPTHMASKPROC) (GLboolean flag);
|
||||
typedef void (GL_APIENTRYP PFNGLDEPTHRANGEFPROC) (GLfloat n, GLfloat f);
|
||||
typedef void (GL_APIENTRYP PFNGLDETACHSHADERPROC) (GLuint program, GLuint shader);
|
||||
typedef void (GL_APIENTRYP PFNGLDISABLEPROC) (GLenum cap);
|
||||
typedef void (GL_APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYPROC) (GLuint index);
|
||||
typedef void (GL_APIENTRYP PFNGLDRAWARRAYSPROC) (GLenum mode, GLint first, GLsizei count);
|
||||
typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices);
|
||||
typedef void (GL_APIENTRYP PFNGLENABLEPROC) (GLenum cap);
|
||||
typedef void (GL_APIENTRYP PFNGLENABLEVERTEXATTRIBARRAYPROC) (GLuint index);
|
||||
typedef void (GL_APIENTRYP PFNGLFINISHPROC) (void);
|
||||
typedef void (GL_APIENTRYP PFNGLFLUSHPROC) (void);
|
||||
typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFERPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
|
||||
typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
|
||||
typedef void (GL_APIENTRYP PFNGLFRONTFACEPROC) (GLenum mode);
|
||||
typedef void (GL_APIENTRYP PFNGLGENBUFFERSPROC) (GLsizei n, GLuint *buffers);
|
||||
typedef void (GL_APIENTRYP PFNGLGENERATEMIPMAPPROC) (GLenum target);
|
||||
typedef void (GL_APIENTRYP PFNGLGENFRAMEBUFFERSPROC) (GLsizei n, GLuint *framebuffers);
|
||||
typedef void (GL_APIENTRYP PFNGLGENRENDERBUFFERSPROC) (GLsizei n, GLuint *renderbuffers);
|
||||
typedef void (GL_APIENTRYP PFNGLGENTEXTURESPROC) (GLsizei n, GLuint *textures);
|
||||
typedef void (GL_APIENTRYP PFNGLGETACTIVEATTRIBPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
|
||||
typedef void (GL_APIENTRYP PFNGLGETACTIVEUNIFORMPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
|
||||
typedef void (GL_APIENTRYP PFNGLGETATTACHEDSHADERSPROC) (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders);
|
||||
typedef GLint (GL_APIENTRYP PFNGLGETATTRIBLOCATIONPROC) (GLuint program, const GLchar *name);
|
||||
typedef void (GL_APIENTRYP PFNGLGETBOOLEANVPROC) (GLenum pname, GLboolean *data);
|
||||
typedef void (GL_APIENTRYP PFNGLGETBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
|
||||
typedef GLenum (GL_APIENTRYP PFNGLGETERRORPROC) (void);
|
||||
typedef void (GL_APIENTRYP PFNGLGETFLOATVPROC) (GLenum pname, GLfloat *data);
|
||||
typedef void (GL_APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC) (GLenum target, GLenum attachment, GLenum pname, GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETINTEGERVPROC) (GLenum pname, GLint *data);
|
||||
typedef void (GL_APIENTRYP PFNGLGETPROGRAMIVPROC) (GLuint program, GLenum pname, GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETPROGRAMINFOLOGPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
|
||||
typedef void (GL_APIENTRYP PFNGLGETRENDERBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETSHADERIVPROC) (GLuint shader, GLenum pname, GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETSHADERINFOLOGPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
|
||||
typedef void (GL_APIENTRYP PFNGLGETSHADERPRECISIONFORMATPROC) (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision);
|
||||
typedef void (GL_APIENTRYP PFNGLGETSHADERSOURCEPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source);
|
||||
typedef const GLubyte *(GL_APIENTRYP PFNGLGETSTRINGPROC) (GLenum name);
|
||||
typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETUNIFORMFVPROC) (GLuint program, GLint location, GLfloat *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETUNIFORMIVPROC) (GLuint program, GLint location, GLint *params);
|
||||
typedef GLint (GL_APIENTRYP PFNGLGETUNIFORMLOCATIONPROC) (GLuint program, const GLchar *name);
|
||||
typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBFVPROC) (GLuint index, GLenum pname, GLfloat *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBIVPROC) (GLuint index, GLenum pname, GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVPROC) (GLuint index, GLenum pname, void **pointer);
|
||||
typedef void (GL_APIENTRYP PFNGLHINTPROC) (GLenum target, GLenum mode);
|
||||
typedef GLboolean (GL_APIENTRYP PFNGLISBUFFERPROC) (GLuint buffer);
|
||||
typedef GLboolean (GL_APIENTRYP PFNGLISENABLEDPROC) (GLenum cap);
|
||||
typedef GLboolean (GL_APIENTRYP PFNGLISFRAMEBUFFERPROC) (GLuint framebuffer);
|
||||
typedef GLboolean (GL_APIENTRYP PFNGLISPROGRAMPROC) (GLuint program);
|
||||
typedef GLboolean (GL_APIENTRYP PFNGLISRENDERBUFFERPROC) (GLuint renderbuffer);
|
||||
typedef GLboolean (GL_APIENTRYP PFNGLISSHADERPROC) (GLuint shader);
|
||||
typedef GLboolean (GL_APIENTRYP PFNGLISTEXTUREPROC) (GLuint texture);
|
||||
typedef void (GL_APIENTRYP PFNGLLINEWIDTHPROC) (GLfloat width);
|
||||
typedef void (GL_APIENTRYP PFNGLLINKPROGRAMPROC) (GLuint program);
|
||||
typedef void (GL_APIENTRYP PFNGLPIXELSTOREIPROC) (GLenum pname, GLint param);
|
||||
typedef void (GL_APIENTRYP PFNGLPOLYGONOFFSETPROC) (GLfloat factor, GLfloat units);
|
||||
typedef void (GL_APIENTRYP PFNGLREADPIXELSPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels);
|
||||
typedef void (GL_APIENTRYP PFNGLRELEASESHADERCOMPILERPROC) (void);
|
||||
typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
|
||||
typedef void (GL_APIENTRYP PFNGLSAMPLECOVERAGEPROC) (GLfloat value, GLboolean invert);
|
||||
typedef void (GL_APIENTRYP PFNGLSCISSORPROC) (GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
typedef void (GL_APIENTRYP PFNGLSHADERBINARYPROC) (GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length);
|
||||
typedef void (GL_APIENTRYP PFNGLSHADERSOURCEPROC) (GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length);
|
||||
typedef void (GL_APIENTRYP PFNGLSTENCILFUNCPROC) (GLenum func, GLint ref, GLuint mask);
|
||||
typedef void (GL_APIENTRYP PFNGLSTENCILFUNCSEPARATEPROC) (GLenum face, GLenum func, GLint ref, GLuint mask);
|
||||
typedef void (GL_APIENTRYP PFNGLSTENCILMASKPROC) (GLuint mask);
|
||||
typedef void (GL_APIENTRYP PFNGLSTENCILMASKSEPARATEPROC) (GLenum face, GLuint mask);
|
||||
typedef void (GL_APIENTRYP PFNGLSTENCILOPPROC) (GLenum fail, GLenum zfail, GLenum zpass);
|
||||
typedef void (GL_APIENTRYP PFNGLSTENCILOPSEPARATEPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXIMAGE2DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXPARAMETERFPROC) (GLenum target, GLenum pname, GLfloat param);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIPROC) (GLenum target, GLenum pname, GLint param);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORM1FPROC) (GLint location, GLfloat v0);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORM1FVPROC) (GLint location, GLsizei count, const GLfloat *value);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORM1IPROC) (GLint location, GLint v0);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORM1IVPROC) (GLint location, GLsizei count, const GLint *value);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORM2FPROC) (GLint location, GLfloat v0, GLfloat v1);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORM2FVPROC) (GLint location, GLsizei count, const GLfloat *value);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORM2IPROC) (GLint location, GLint v0, GLint v1);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORM2IVPROC) (GLint location, GLsizei count, const GLint *value);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORM3FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORM3FVPROC) (GLint location, GLsizei count, const GLfloat *value);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORM3IPROC) (GLint location, GLint v0, GLint v1, GLint v2);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORM3IVPROC) (GLint location, GLsizei count, const GLint *value);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORM4FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORM4FVPROC) (GLint location, GLsizei count, const GLfloat *value);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORM4IPROC) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORM4IVPROC) (GLint location, GLsizei count, const GLint *value);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
|
||||
typedef void (GL_APIENTRYP PFNGLUSEPROGRAMPROC) (GLuint program);
|
||||
typedef void (GL_APIENTRYP PFNGLVALIDATEPROGRAMPROC) (GLuint program);
|
||||
typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB1FPROC) (GLuint index, GLfloat x);
|
||||
typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB1FVPROC) (GLuint index, const GLfloat *v);
|
||||
typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB2FPROC) (GLuint index, GLfloat x, GLfloat y);
|
||||
typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB2FVPROC) (GLuint index, const GLfloat *v);
|
||||
typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB3FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z);
|
||||
typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB3FVPROC) (GLuint index, const GLfloat *v);
|
||||
typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB4FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
|
||||
typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB4FVPROC) (GLuint index, const GLfloat *v);
|
||||
typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBPOINTERPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer);
|
||||
typedef void (GL_APIENTRYP PFNGLVIEWPORTPROC) (GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_APICALL void GL_APIENTRY glActiveTexture (GLenum texture);
|
||||
GL_APICALL void GL_APIENTRY glAttachShader (GLuint program, GLuint shader);
|
||||
GL_APICALL void GL_APIENTRY glBindAttribLocation (GLuint program, GLuint index, const GLchar *name);
|
||||
GL_APICALL void GL_APIENTRY glBindBuffer (GLenum target, GLuint buffer);
|
||||
GL_APICALL void GL_APIENTRY glBindFramebuffer (GLenum target, GLuint framebuffer);
|
||||
GL_APICALL void GL_APIENTRY glBindRenderbuffer (GLenum target, GLuint renderbuffer);
|
||||
GL_APICALL void GL_APIENTRY glBindTexture (GLenum target, GLuint texture);
|
||||
GL_APICALL void GL_APIENTRY glBlendColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
|
||||
GL_APICALL void GL_APIENTRY glBlendEquation (GLenum mode);
|
||||
GL_APICALL void GL_APIENTRY glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha);
|
||||
GL_APICALL void GL_APIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor);
|
||||
GL_APICALL void GL_APIENTRY glBlendFuncSeparate (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
|
||||
GL_APICALL void GL_APIENTRY glBufferData (GLenum target, GLsizeiptr size, const void *data, GLenum usage);
|
||||
GL_APICALL void GL_APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const void *data);
|
||||
GL_APICALL GLenum GL_APIENTRY glCheckFramebufferStatus (GLenum target);
|
||||
GL_APICALL void GL_APIENTRY glClear (GLbitfield mask);
|
||||
GL_APICALL void GL_APIENTRY glClearColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
|
||||
GL_APICALL void GL_APIENTRY glClearDepthf (GLfloat d);
|
||||
GL_APICALL void GL_APIENTRY glClearStencil (GLint s);
|
||||
GL_APICALL void GL_APIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
|
||||
GL_APICALL void GL_APIENTRY glCompileShader (GLuint shader);
|
||||
GL_APICALL void GL_APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data);
|
||||
GL_APICALL void GL_APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data);
|
||||
GL_APICALL void GL_APIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
|
||||
GL_APICALL void GL_APIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
GL_APICALL GLuint GL_APIENTRY glCreateProgram (void);
|
||||
GL_APICALL GLuint GL_APIENTRY glCreateShader (GLenum type);
|
||||
GL_APICALL void GL_APIENTRY glCullFace (GLenum mode);
|
||||
GL_APICALL void GL_APIENTRY glDeleteBuffers (GLsizei n, const GLuint *buffers);
|
||||
GL_APICALL void GL_APIENTRY glDeleteFramebuffers (GLsizei n, const GLuint *framebuffers);
|
||||
GL_APICALL void GL_APIENTRY glDeleteProgram (GLuint program);
|
||||
GL_APICALL void GL_APIENTRY glDeleteRenderbuffers (GLsizei n, const GLuint *renderbuffers);
|
||||
GL_APICALL void GL_APIENTRY glDeleteShader (GLuint shader);
|
||||
GL_APICALL void GL_APIENTRY glDeleteTextures (GLsizei n, const GLuint *textures);
|
||||
GL_APICALL void GL_APIENTRY glDepthFunc (GLenum func);
|
||||
GL_APICALL void GL_APIENTRY glDepthMask (GLboolean flag);
|
||||
GL_APICALL void GL_APIENTRY glDepthRangef (GLfloat n, GLfloat f);
|
||||
GL_APICALL void GL_APIENTRY glDetachShader (GLuint program, GLuint shader);
|
||||
GL_APICALL void GL_APIENTRY glDisable (GLenum cap);
|
||||
GL_APICALL void GL_APIENTRY glDisableVertexAttribArray (GLuint index);
|
||||
GL_APICALL void GL_APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count);
|
||||
GL_APICALL void GL_APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const void *indices);
|
||||
GL_APICALL void GL_APIENTRY glEnable (GLenum cap);
|
||||
GL_APICALL void GL_APIENTRY glEnableVertexAttribArray (GLuint index);
|
||||
GL_APICALL void GL_APIENTRY glFinish (void);
|
||||
GL_APICALL void GL_APIENTRY glFlush (void);
|
||||
GL_APICALL void GL_APIENTRY glFramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
|
||||
GL_APICALL void GL_APIENTRY glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
|
||||
GL_APICALL void GL_APIENTRY glFrontFace (GLenum mode);
|
||||
GL_APICALL void GL_APIENTRY glGenBuffers (GLsizei n, GLuint *buffers);
|
||||
GL_APICALL void GL_APIENTRY glGenerateMipmap (GLenum target);
|
||||
GL_APICALL void GL_APIENTRY glGenFramebuffers (GLsizei n, GLuint *framebuffers);
|
||||
GL_APICALL void GL_APIENTRY glGenRenderbuffers (GLsizei n, GLuint *renderbuffers);
|
||||
GL_APICALL void GL_APIENTRY glGenTextures (GLsizei n, GLuint *textures);
|
||||
GL_APICALL void GL_APIENTRY glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
|
||||
GL_APICALL void GL_APIENTRY glGetActiveUniform (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
|
||||
GL_APICALL void GL_APIENTRY glGetAttachedShaders (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders);
|
||||
GL_APICALL GLint GL_APIENTRY glGetAttribLocation (GLuint program, const GLchar *name);
|
||||
GL_APICALL void GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean *data);
|
||||
GL_APICALL void GL_APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint *params);
|
||||
GL_APICALL GLenum GL_APIENTRY glGetError (void);
|
||||
GL_APICALL void GL_APIENTRY glGetFloatv (GLenum pname, GLfloat *data);
|
||||
GL_APICALL void GL_APIENTRY glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint *params);
|
||||
GL_APICALL void GL_APIENTRY glGetIntegerv (GLenum pname, GLint *data);
|
||||
GL_APICALL void GL_APIENTRY glGetProgramiv (GLuint program, GLenum pname, GLint *params);
|
||||
GL_APICALL void GL_APIENTRY glGetProgramInfoLog (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
|
||||
GL_APICALL void GL_APIENTRY glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint *params);
|
||||
GL_APICALL void GL_APIENTRY glGetShaderiv (GLuint shader, GLenum pname, GLint *params);
|
||||
GL_APICALL void GL_APIENTRY glGetShaderInfoLog (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
|
||||
GL_APICALL void GL_APIENTRY glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision);
|
||||
GL_APICALL void GL_APIENTRY glGetShaderSource (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source);
|
||||
GL_APICALL const GLubyte *GL_APIENTRY glGetString (GLenum name);
|
||||
GL_APICALL void GL_APIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat *params);
|
||||
GL_APICALL void GL_APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint *params);
|
||||
GL_APICALL void GL_APIENTRY glGetUniformfv (GLuint program, GLint location, GLfloat *params);
|
||||
GL_APICALL void GL_APIENTRY glGetUniformiv (GLuint program, GLint location, GLint *params);
|
||||
GL_APICALL GLint GL_APIENTRY glGetUniformLocation (GLuint program, const GLchar *name);
|
||||
GL_APICALL void GL_APIENTRY glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat *params);
|
||||
GL_APICALL void GL_APIENTRY glGetVertexAttribiv (GLuint index, GLenum pname, GLint *params);
|
||||
GL_APICALL void GL_APIENTRY glGetVertexAttribPointerv (GLuint index, GLenum pname, void **pointer);
|
||||
GL_APICALL void GL_APIENTRY glHint (GLenum target, GLenum mode);
|
||||
GL_APICALL GLboolean GL_APIENTRY glIsBuffer (GLuint buffer);
|
||||
GL_APICALL GLboolean GL_APIENTRY glIsEnabled (GLenum cap);
|
||||
GL_APICALL GLboolean GL_APIENTRY glIsFramebuffer (GLuint framebuffer);
|
||||
GL_APICALL GLboolean GL_APIENTRY glIsProgram (GLuint program);
|
||||
GL_APICALL GLboolean GL_APIENTRY glIsRenderbuffer (GLuint renderbuffer);
|
||||
GL_APICALL GLboolean GL_APIENTRY glIsShader (GLuint shader);
|
||||
GL_APICALL GLboolean GL_APIENTRY glIsTexture (GLuint texture);
|
||||
GL_APICALL void GL_APIENTRY glLineWidth (GLfloat width);
|
||||
GL_APICALL void GL_APIENTRY glLinkProgram (GLuint program);
|
||||
GL_APICALL void GL_APIENTRY glPixelStorei (GLenum pname, GLint param);
|
||||
GL_APICALL void GL_APIENTRY glPolygonOffset (GLfloat factor, GLfloat units);
|
||||
GL_APICALL void GL_APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels);
|
||||
GL_APICALL void GL_APIENTRY glReleaseShaderCompiler (void);
|
||||
GL_APICALL void GL_APIENTRY glRenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
|
||||
GL_APICALL void GL_APIENTRY glSampleCoverage (GLfloat value, GLboolean invert);
|
||||
GL_APICALL void GL_APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
GL_APICALL void GL_APIENTRY glShaderBinary (GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length);
|
||||
GL_APICALL void GL_APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length);
|
||||
GL_APICALL void GL_APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask);
|
||||
GL_APICALL void GL_APIENTRY glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask);
|
||||
GL_APICALL void GL_APIENTRY glStencilMask (GLuint mask);
|
||||
GL_APICALL void GL_APIENTRY glStencilMaskSeparate (GLenum face, GLuint mask);
|
||||
GL_APICALL void GL_APIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass);
|
||||
GL_APICALL void GL_APIENTRY glStencilOpSeparate (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
|
||||
GL_APICALL void GL_APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels);
|
||||
GL_APICALL void GL_APIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param);
|
||||
GL_APICALL void GL_APIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat *params);
|
||||
GL_APICALL void GL_APIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param);
|
||||
GL_APICALL void GL_APIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint *params);
|
||||
GL_APICALL void GL_APIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels);
|
||||
GL_APICALL void GL_APIENTRY glUniform1f (GLint location, GLfloat v0);
|
||||
GL_APICALL void GL_APIENTRY glUniform1fv (GLint location, GLsizei count, const GLfloat *value);
|
||||
GL_APICALL void GL_APIENTRY glUniform1i (GLint location, GLint v0);
|
||||
GL_APICALL void GL_APIENTRY glUniform1iv (GLint location, GLsizei count, const GLint *value);
|
||||
GL_APICALL void GL_APIENTRY glUniform2f (GLint location, GLfloat v0, GLfloat v1);
|
||||
GL_APICALL void GL_APIENTRY glUniform2fv (GLint location, GLsizei count, const GLfloat *value);
|
||||
GL_APICALL void GL_APIENTRY glUniform2i (GLint location, GLint v0, GLint v1);
|
||||
GL_APICALL void GL_APIENTRY glUniform2iv (GLint location, GLsizei count, const GLint *value);
|
||||
GL_APICALL void GL_APIENTRY glUniform3f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
|
||||
GL_APICALL void GL_APIENTRY glUniform3fv (GLint location, GLsizei count, const GLfloat *value);
|
||||
GL_APICALL void GL_APIENTRY glUniform3i (GLint location, GLint v0, GLint v1, GLint v2);
|
||||
GL_APICALL void GL_APIENTRY glUniform3iv (GLint location, GLsizei count, const GLint *value);
|
||||
GL_APICALL void GL_APIENTRY glUniform4f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
|
||||
GL_APICALL void GL_APIENTRY glUniform4fv (GLint location, GLsizei count, const GLfloat *value);
|
||||
GL_APICALL void GL_APIENTRY glUniform4i (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
|
||||
GL_APICALL void GL_APIENTRY glUniform4iv (GLint location, GLsizei count, const GLint *value);
|
||||
GL_APICALL void GL_APIENTRY glUniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
|
||||
GL_APICALL void GL_APIENTRY glUniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
|
||||
GL_APICALL void GL_APIENTRY glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
|
||||
GL_APICALL void GL_APIENTRY glUseProgram (GLuint program);
|
||||
GL_APICALL void GL_APIENTRY glValidateProgram (GLuint program);
|
||||
GL_APICALL void GL_APIENTRY glVertexAttrib1f (GLuint index, GLfloat x);
|
||||
GL_APICALL void GL_APIENTRY glVertexAttrib1fv (GLuint index, const GLfloat *v);
|
||||
GL_APICALL void GL_APIENTRY glVertexAttrib2f (GLuint index, GLfloat x, GLfloat y);
|
||||
GL_APICALL void GL_APIENTRY glVertexAttrib2fv (GLuint index, const GLfloat *v);
|
||||
GL_APICALL void GL_APIENTRY glVertexAttrib3f (GLuint index, GLfloat x, GLfloat y, GLfloat z);
|
||||
GL_APICALL void GL_APIENTRY glVertexAttrib3fv (GLuint index, const GLfloat *v);
|
||||
GL_APICALL void GL_APIENTRY glVertexAttrib4f (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
|
||||
GL_APICALL void GL_APIENTRY glVertexAttrib4fv (GLuint index, const GLfloat *v);
|
||||
GL_APICALL void GL_APIENTRY glVertexAttribPointer (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer);
|
||||
GL_APICALL void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
#endif
|
||||
#endif /* GL_ES_VERSION_2_0 */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __gl2_h_ */
|
||||
#endif
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,7 @@
|
||||
#ifndef __gl2platform_h_
|
||||
#define __gl2platform_h_
|
||||
|
||||
/* $Revision: 10602 $ on $Date:: 2010-03-04 22:35:34 -0800 #$ */
|
||||
/* $Revision: 23328 $ on $Date:: 2013-10-02 02:28:28 -0700 #$ */
|
||||
|
||||
/*
|
||||
* This document is licensed under the SGI Free Software B License Version
|
||||
|
File diff suppressed because it is too large
Load Diff
1524
gfx/angle/include/GLES3/gl31.h
Normal file
1524
gfx/angle/include/GLES3/gl31.h
Normal file
File diff suppressed because it is too large
Load Diff
1825
gfx/angle/include/GLES3/gl32.h
Normal file
1825
gfx/angle/include/GLES3/gl32.h
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,24 +0,0 @@
|
||||
#ifndef __gl3ext_h_
|
||||
#define __gl3ext_h_
|
||||
|
||||
/* $Revision: 17809 $ on $Date:: 2012-05-14 08:03:36 -0700 #$ */
|
||||
|
||||
/*
|
||||
* This document is licensed under the SGI Free Software B License Version
|
||||
* 2.0. For details, see http://oss.sgi.com/projects/FreeB/ .
|
||||
*/
|
||||
|
||||
/* OpenGL ES 3 Extensions
|
||||
*
|
||||
* After an OES extension's interactions with OpenGl ES 3.0 have been documented,
|
||||
* its tokens and function definitions should be added to this file in a manner
|
||||
* that does not conflict with gl2ext.h or gl3.h.
|
||||
*
|
||||
* Tokens and function definitions for extensions that have become standard
|
||||
* features in OpenGL ES 3.0 will not be added to this file.
|
||||
*
|
||||
* Applications using OpenGL-ES-2-only extensions should include gl2ext.h
|
||||
*/
|
||||
|
||||
#endif /* __gl3ext_h_ */
|
||||
|
@ -1,7 +1,7 @@
|
||||
#ifndef __gl3platform_h_
|
||||
#define __gl3platform_h_
|
||||
|
||||
/* $Revision: 18437 $ on $Date:: 2012-07-08 23:31:39 -0700 #$ */
|
||||
/* $Revision: 23328 $ on $Date:: 2013-10-02 02:28:28 -0700 #$ */
|
||||
|
||||
/*
|
||||
* This document is licensed under the SGI Free Software B License Version
|
||||
|
@ -48,7 +48,7 @@ typedef unsigned int GLenum;
|
||||
|
||||
// Version number for shader translation API.
|
||||
// It is incremented every time the API changes.
|
||||
#define ANGLE_SH_VERSION 138
|
||||
#define ANGLE_SH_VERSION 140
|
||||
|
||||
typedef enum {
|
||||
SH_GLES2_SPEC = 0x8B40,
|
||||
@ -247,6 +247,7 @@ typedef struct
|
||||
int OES_standard_derivatives;
|
||||
int OES_EGL_image_external;
|
||||
int ARB_texture_rectangle;
|
||||
int EXT_blend_func_extended;
|
||||
int EXT_draw_buffers;
|
||||
int EXT_frag_depth;
|
||||
int EXT_shader_texture_lod;
|
||||
@ -271,6 +272,13 @@ typedef struct
|
||||
int MinProgramTexelOffset;
|
||||
int MaxProgramTexelOffset;
|
||||
|
||||
// Extension constants.
|
||||
|
||||
// Value of GL_MAX_DUAL_SOURCE_DRAW_BUFFERS_EXT for OpenGL ES output context.
|
||||
// Value of GL_MAX_DUAL_SOURCE_DRAW_BUFFERS for OpenGL output context.
|
||||
// GLES SL version 100 gl_MaxDualSourceDrawBuffersEXT value for EXT_blend_func_extended.
|
||||
int MaxDualSourceDrawBuffers;
|
||||
|
||||
// Name Hashing.
|
||||
// Set a 64 bit hash function to enable user-defined name hashing.
|
||||
// Default is NULL.
|
||||
@ -398,7 +406,7 @@ COMPILER_EXPORT const std::map<std::string, std::string> *ShGetNameHashingMap(
|
||||
COMPILER_EXPORT const std::vector<sh::Uniform> *ShGetUniforms(const ShHandle handle);
|
||||
COMPILER_EXPORT const std::vector<sh::Varying> *ShGetVaryings(const ShHandle handle);
|
||||
COMPILER_EXPORT const std::vector<sh::Attribute> *ShGetAttributes(const ShHandle handle);
|
||||
COMPILER_EXPORT const std::vector<sh::Attribute> *ShGetOutputVariables(const ShHandle handle);
|
||||
COMPILER_EXPORT const std::vector<sh::OutputVariable> *ShGetOutputVariables(const ShHandle handle);
|
||||
COMPILER_EXPORT const std::vector<sh::InterfaceBlock> *ShGetInterfaceBlocks(const ShHandle handle);
|
||||
|
||||
typedef struct
|
||||
|
@ -110,19 +110,39 @@ struct COMPILER_EXPORT Uniform : public ShaderVariable
|
||||
bool isSameUniformAtLinkTime(const Uniform &other) const;
|
||||
};
|
||||
|
||||
struct COMPILER_EXPORT Attribute : public ShaderVariable
|
||||
// An interface variable is a variable which passes data between the GL data structures and the
|
||||
// shader execution: either vertex shader inputs or fragment shader outputs. These variables can
|
||||
// have integer locations to pass back to the GL API.
|
||||
struct COMPILER_EXPORT InterfaceVariable : public ShaderVariable
|
||||
{
|
||||
InterfaceVariable();
|
||||
~InterfaceVariable();
|
||||
InterfaceVariable(const InterfaceVariable &other);
|
||||
InterfaceVariable &operator=(const InterfaceVariable &other);
|
||||
bool operator==(const InterfaceVariable &other) const;
|
||||
bool operator!=(const InterfaceVariable &other) const { return !operator==(other); }
|
||||
|
||||
int location;
|
||||
};
|
||||
|
||||
struct COMPILER_EXPORT Attribute : public InterfaceVariable
|
||||
{
|
||||
Attribute();
|
||||
~Attribute();
|
||||
Attribute(const Attribute &other);
|
||||
Attribute &operator=(const Attribute &other);
|
||||
bool operator==(const Attribute &other) const;
|
||||
bool operator!=(const Attribute &other) const
|
||||
{
|
||||
return !operator==(other);
|
||||
}
|
||||
bool operator!=(const Attribute &other) const { return !operator==(other); }
|
||||
};
|
||||
|
||||
int location;
|
||||
struct COMPILER_EXPORT OutputVariable : public InterfaceVariable
|
||||
{
|
||||
OutputVariable();
|
||||
~OutputVariable();
|
||||
OutputVariable(const OutputVariable &other);
|
||||
OutputVariable &operator=(const OutputVariable &other);
|
||||
bool operator==(const OutputVariable &other) const;
|
||||
bool operator!=(const OutputVariable &other) const { return !operator==(other); }
|
||||
};
|
||||
|
||||
struct COMPILER_EXPORT InterfaceBlockField : public ShaderVariable
|
||||
|
@ -13,7 +13,8 @@
|
||||
#include "GLES2/gl2.h"
|
||||
#include "GLES2/gl2ext.h"
|
||||
#include "GLES3/gl3.h"
|
||||
#include "GLES3/gl3ext.h"
|
||||
#include "GLES3/gl31.h"
|
||||
#include "GLES3/gl32.h"
|
||||
|
||||
// The following enum is used in ANGLE, but is from desktop GL
|
||||
#ifndef GL_SAMPLER_2D_RECT_ARB
|
||||
|
@ -31,6 +31,17 @@ class Platform
|
||||
// it is recommended that the fixed point be no further in the past than the epoch.
|
||||
virtual double monotonicallyIncreasingTime() { return 0; }
|
||||
|
||||
// Logging ------------------------------------------------------------
|
||||
|
||||
// Log an error message within the platform implementation.
|
||||
virtual void logError(const char *errorMessage) {}
|
||||
|
||||
// Log a warning message within the platform implementation.
|
||||
virtual void logWarning(const char *warningMessage) {}
|
||||
|
||||
// Log an info message within the platform implementation.
|
||||
virtual void logInfo(const char *infoMessage) {}
|
||||
|
||||
// Tracing --------
|
||||
|
||||
// Get a pointer to the enabled state of the given trace category. The
|
||||
|
@ -69,6 +69,7 @@ UNIFIED_SOURCES += [
|
||||
'src/compiler/translator/PruneEmptyDeclarations.cpp',
|
||||
'src/compiler/translator/RecordConstantPrecision.cpp',
|
||||
'src/compiler/translator/RegenerateStructNames.cpp',
|
||||
'src/compiler/translator/RemoveDynamicIndexing.cpp',
|
||||
'src/compiler/translator/RemovePow.cpp',
|
||||
'src/compiler/translator/RemoveSwitchFallThrough.cpp',
|
||||
'src/compiler/translator/RewriteElseBlocks.cpp',
|
||||
|
@ -86,15 +86,6 @@
|
||||
},
|
||||
'conditions':
|
||||
[
|
||||
['angle_build_winrt==1',
|
||||
{
|
||||
'msvs_enable_winrt' : '1',
|
||||
'msvs_application_type_revision' : '<(angle_build_winrt_app_type_revision)',
|
||||
}],
|
||||
['angle_build_winphone==1',
|
||||
{
|
||||
'msvs_enable_winphone' : '1',
|
||||
}],
|
||||
['OS=="win"',
|
||||
{
|
||||
'configurations':
|
||||
@ -127,14 +118,8 @@
|
||||
[
|
||||
['angle_build_winrt==1',
|
||||
{
|
||||
'msvs_enable_winrt' : '1',
|
||||
'msvs_application_type_revision' : '<(angle_build_winrt_app_type_revision)',
|
||||
'type' : 'shared_library',
|
||||
}],
|
||||
['angle_build_winphone==1',
|
||||
{
|
||||
'msvs_enable_winphone' : '1',
|
||||
}],
|
||||
],
|
||||
},
|
||||
],
|
||||
@ -176,14 +161,8 @@
|
||||
[
|
||||
['angle_build_winrt==1',
|
||||
{
|
||||
'msvs_enable_winrt' : '1',
|
||||
'msvs_application_type_revision' : '<(angle_build_winrt_app_type_revision)',
|
||||
'type' : 'shared_library',
|
||||
}],
|
||||
['angle_build_winphone==1',
|
||||
{
|
||||
'msvs_enable_winphone' : '1',
|
||||
}],
|
||||
],
|
||||
}
|
||||
]
|
||||
@ -214,14 +193,8 @@
|
||||
[
|
||||
['angle_build_winrt==1',
|
||||
{
|
||||
'msvs_enable_winrt' : '1',
|
||||
'msvs_application_type_revision' : '<(angle_build_winrt_app_type_revision)',
|
||||
'type' : 'shared_library',
|
||||
}],
|
||||
['angle_build_winphone==1',
|
||||
{
|
||||
'msvs_enable_winphone' : '1',
|
||||
}],
|
||||
],
|
||||
}
|
||||
]
|
||||
@ -259,14 +232,8 @@
|
||||
}],
|
||||
['angle_build_winrt==1',
|
||||
{
|
||||
'msvs_enable_winrt' : '1',
|
||||
'msvs_application_type_revision' : '<(angle_build_winrt_app_type_revision)',
|
||||
'type' : 'shared_library',
|
||||
}],
|
||||
['angle_build_winphone==1',
|
||||
{
|
||||
'msvs_enable_winphone' : '1',
|
||||
}],
|
||||
]
|
||||
},
|
||||
], # targets
|
||||
|
@ -1,14 +1,3 @@
|
||||
//
|
||||
// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
//
|
||||
// commit.h:
|
||||
// This is a default commit hash header, when git is not available.
|
||||
//
|
||||
|
||||
#define ANGLE_COMMIT_HASH "unknown hash"
|
||||
#define ANGLE_COMMIT_HASH_SIZE 12
|
||||
#define ANGLE_COMMIT_DATE "unknown date"
|
||||
|
||||
#define ANGLE_DISABLE_PROGRAM_BINARY_LOAD
|
||||
#define ANGLE_COMMIT_HASH "4a2a4c31a988"
|
||||
#define ANGLE_COMMIT_HASH_SIZE 12
|
||||
#define ANGLE_COMMIT_DATE "2015-09-29 14:41:08 -0400"
|
||||
|
156
gfx/angle/src/common/BitSetIterator.h
Normal file
156
gfx/angle/src/common/BitSetIterator.h
Normal file
@ -0,0 +1,156 @@
|
||||
//
|
||||
// Copyright 2015 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.
|
||||
//
|
||||
// BitSetIterator:
|
||||
// A helper class to quickly bitscan bitsets for set bits.
|
||||
//
|
||||
|
||||
#ifndef COMMON_BITSETITERATOR_H_
|
||||
#define COMMON_BITSETITERATOR_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <bitset>
|
||||
|
||||
#include "common/angleutils.h"
|
||||
#include "common/debug.h"
|
||||
#include "common/mathutil.h"
|
||||
#include "common/platform.h"
|
||||
|
||||
namespace angle
|
||||
{
|
||||
template <size_t N>
|
||||
class BitSetIterator final
|
||||
{
|
||||
public:
|
||||
BitSetIterator(const std::bitset<N> &bitset);
|
||||
BitSetIterator(const BitSetIterator &other);
|
||||
BitSetIterator &operator=(const BitSetIterator &other);
|
||||
|
||||
class Iterator final
|
||||
{
|
||||
public:
|
||||
Iterator(const std::bitset<N> &bits);
|
||||
Iterator &operator++();
|
||||
|
||||
bool operator==(const Iterator &other) const;
|
||||
bool operator!=(const Iterator &other) const;
|
||||
unsigned long operator*() const { return mCurrentBit; }
|
||||
|
||||
private:
|
||||
unsigned long getNextBit();
|
||||
|
||||
static const size_t BitsPerWord = sizeof(unsigned long) * 8;
|
||||
std::bitset<N> mBits;
|
||||
unsigned long mCurrentBit;
|
||||
unsigned long mOffset;
|
||||
};
|
||||
|
||||
Iterator begin() const { return Iterator(mBits); }
|
||||
Iterator end() const { return Iterator(std::bitset<N>(0)); }
|
||||
|
||||
private:
|
||||
const std::bitset<N> mBits;
|
||||
};
|
||||
|
||||
template <size_t N>
|
||||
BitSetIterator<N>::BitSetIterator(const std::bitset<N> &bitset)
|
||||
: mBits(bitset)
|
||||
{
|
||||
}
|
||||
|
||||
template <size_t N>
|
||||
BitSetIterator<N>::BitSetIterator(const BitSetIterator &other)
|
||||
: mBits(other.mBits)
|
||||
{
|
||||
}
|
||||
|
||||
template <size_t N>
|
||||
BitSetIterator<N> &BitSetIterator<N>::operator=(const BitSetIterator &other)
|
||||
{
|
||||
mBits = other.mBits;
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <size_t N>
|
||||
BitSetIterator<N>::Iterator::Iterator(const std::bitset<N> &bits)
|
||||
: mBits(bits), mCurrentBit(0), mOffset(0)
|
||||
{
|
||||
if (bits.any())
|
||||
{
|
||||
mCurrentBit = getNextBit();
|
||||
}
|
||||
else
|
||||
{
|
||||
mOffset = static_cast<unsigned long>(rx::roundUp(N, BitsPerWord));
|
||||
}
|
||||
}
|
||||
|
||||
template <size_t N>
|
||||
typename BitSetIterator<N>::Iterator &BitSetIterator<N>::Iterator::operator++()
|
||||
{
|
||||
ASSERT(mBits.any());
|
||||
mBits.set(mCurrentBit - mOffset, 0);
|
||||
mCurrentBit = getNextBit();
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline unsigned long ScanForward(unsigned long bits)
|
||||
{
|
||||
ASSERT(bits != 0);
|
||||
#if defined(ANGLE_PLATFORM_WINDOWS)
|
||||
unsigned long firstBitIndex = 0ul;
|
||||
unsigned char ret = _BitScanForward(&firstBitIndex, bits);
|
||||
ASSERT(ret != 0);
|
||||
UNUSED_ASSERTION_VARIABLE(ret);
|
||||
return firstBitIndex;
|
||||
#elif defined(ANGLE_PLATFORM_POSIX)
|
||||
return static_cast<unsigned long>(__builtin_ctzl(bits));
|
||||
#else
|
||||
#error Please implement bit-scan-forward for your platform!
|
||||
#endif
|
||||
}
|
||||
|
||||
template <size_t N>
|
||||
bool BitSetIterator<N>::Iterator::operator==(const Iterator &other) const
|
||||
{
|
||||
return mOffset == other.mOffset && mBits == other.mBits;
|
||||
}
|
||||
|
||||
template <size_t N>
|
||||
bool BitSetIterator<N>::Iterator::operator!=(const Iterator &other) const
|
||||
{
|
||||
return !(*this == other);
|
||||
}
|
||||
|
||||
template <size_t N>
|
||||
unsigned long BitSetIterator<N>::Iterator::getNextBit()
|
||||
{
|
||||
static std::bitset<N> wordMask(std::numeric_limits<unsigned long>::max());
|
||||
|
||||
while (mOffset < N)
|
||||
{
|
||||
unsigned long wordBits = (mBits & wordMask).to_ulong();
|
||||
if (wordBits != 0ul)
|
||||
{
|
||||
return ScanForward(wordBits) + mOffset;
|
||||
}
|
||||
|
||||
mBits >>= BitsPerWord;
|
||||
mOffset += BitsPerWord;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Helper to avoid needing to specify the template parameter size
|
||||
template <size_t N>
|
||||
BitSetIterator<N> IterateBitSet(const std::bitset<N> &bitset)
|
||||
{
|
||||
return BitSetIterator<N>(bitset);
|
||||
}
|
||||
|
||||
} // angle
|
||||
|
||||
#endif // COMMON_BITSETITERATOR_H_
|
91
gfx/angle/src/common/BitSetIterator_unittest.cpp
Normal file
91
gfx/angle/src/common/BitSetIterator_unittest.cpp
Normal file
@ -0,0 +1,91 @@
|
||||
//
|
||||
// Copyright 2015 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.
|
||||
//
|
||||
// BitSetIteratorTest:
|
||||
// Test the IterableBitSet class.
|
||||
//
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "common/BitSetIterator.h"
|
||||
|
||||
using namespace angle;
|
||||
|
||||
namespace
|
||||
{
|
||||
class BitSetIteratorTest : public testing::Test
|
||||
{
|
||||
protected:
|
||||
std::bitset<40> mStateBits;
|
||||
};
|
||||
|
||||
// Simple iterator test.
|
||||
TEST_F(BitSetIteratorTest, Iterator)
|
||||
{
|
||||
std::set<unsigned long> originalValues;
|
||||
originalValues.insert(2);
|
||||
originalValues.insert(6);
|
||||
originalValues.insert(8);
|
||||
originalValues.insert(35);
|
||||
|
||||
for (unsigned long value : originalValues)
|
||||
{
|
||||
mStateBits.set(value);
|
||||
}
|
||||
|
||||
std::set<unsigned long> readValues;
|
||||
for (unsigned long bit : IterateBitSet(mStateBits))
|
||||
{
|
||||
EXPECT_EQ(1u, originalValues.count(bit));
|
||||
EXPECT_EQ(0u, readValues.count(bit));
|
||||
readValues.insert(bit);
|
||||
}
|
||||
|
||||
EXPECT_EQ(originalValues.size(), readValues.size());
|
||||
}
|
||||
|
||||
// Test an empty iterator.
|
||||
TEST_F(BitSetIteratorTest, EmptySet)
|
||||
{
|
||||
// We don't use the FAIL gtest macro here since it returns immediately,
|
||||
// causing an unreachable code warning in MSVS
|
||||
bool sawBit = false;
|
||||
for (unsigned long bit : IterateBitSet(mStateBits))
|
||||
{
|
||||
sawBit = true;
|
||||
UNUSED_TRACE_VARIABLE(bit);
|
||||
}
|
||||
EXPECT_FALSE(sawBit);
|
||||
}
|
||||
|
||||
// Test iterating a result of combining two bitsets.
|
||||
TEST_F(BitSetIteratorTest, NonLValueBitset)
|
||||
{
|
||||
std::bitset<40> otherBits;
|
||||
|
||||
mStateBits.set(1);
|
||||
mStateBits.set(2);
|
||||
mStateBits.set(3);
|
||||
mStateBits.set(4);
|
||||
|
||||
otherBits.set(0);
|
||||
otherBits.set(1);
|
||||
otherBits.set(3);
|
||||
otherBits.set(5);
|
||||
|
||||
std::set<unsigned long> seenBits;
|
||||
|
||||
for (unsigned long bit : IterateBitSet(mStateBits & otherBits))
|
||||
{
|
||||
EXPECT_EQ(0u, seenBits.count(bit));
|
||||
seenBits.insert(bit);
|
||||
EXPECT_TRUE(mStateBits[bit]);
|
||||
EXPECT_TRUE(otherBits[bit]);
|
||||
}
|
||||
|
||||
EXPECT_EQ((mStateBits & otherBits).count(), seenBits.size());
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
@ -47,10 +47,7 @@ struct Optional
|
||||
mValid = false;
|
||||
}
|
||||
|
||||
static Optional None()
|
||||
{
|
||||
return Optional();
|
||||
}
|
||||
static Optional Invalid() { return Optional(); }
|
||||
|
||||
bool valid() const { return mValid; }
|
||||
const T &value() const { return mValue; }
|
||||
|
@ -18,7 +18,7 @@ TEST(OptionalTest, BasicInvalid)
|
||||
{
|
||||
Optional<int> testInvalid;
|
||||
ASSERT_FALSE(testInvalid.valid());
|
||||
ASSERT_EQ(Optional<int>::None(), testInvalid);
|
||||
ASSERT_EQ(Optional<int>::Invalid(), testInvalid);
|
||||
}
|
||||
|
||||
TEST(OptionalTest, BasicValid)
|
||||
@ -26,7 +26,7 @@ TEST(OptionalTest, BasicValid)
|
||||
Optional<int> testValid(3);
|
||||
ASSERT_TRUE(testValid.valid());
|
||||
ASSERT_EQ(3, testValid.value());
|
||||
ASSERT_NE(Optional<int>::None(), testValid);
|
||||
ASSERT_NE(Optional<int>::Invalid(), testValid);
|
||||
}
|
||||
|
||||
TEST(OptionalTest, Copies)
|
||||
|
@ -69,13 +69,13 @@ inline int clampToInt(unsigned int x)
|
||||
template <typename DestT, typename SrcT>
|
||||
inline DestT clampCast(SrcT value)
|
||||
{
|
||||
// This assumes SrcT can properly represent DestT::min/max
|
||||
// Unfortunately we can't use META_ASSERT without C++11 constexpr support
|
||||
ASSERT(static_cast<DestT>(static_cast<SrcT>(std::numeric_limits<DestT>::min())) == std::numeric_limits<DestT>::min());
|
||||
ASSERT(static_cast<DestT>(static_cast<SrcT>(std::numeric_limits<DestT>::max())) == std::numeric_limits<DestT>::max());
|
||||
|
||||
SrcT lo = static_cast<SrcT>(std::numeric_limits<DestT>::min());
|
||||
SrcT hi = static_cast<SrcT>(std::numeric_limits<DestT>::max());
|
||||
|
||||
// This assumes SrcT can properly represent DestT::min/max. Checking this is a bit tricky,
|
||||
// especially given floating point representations.
|
||||
ASSERT(lo < hi);
|
||||
|
||||
return static_cast<DestT>(value > lo ? (value > hi ? hi : value) : lo);
|
||||
}
|
||||
|
||||
@ -503,7 +503,6 @@ inline unsigned int averageFloat10(unsigned int a, unsigned int b)
|
||||
return float32ToFloat10((float10ToFloat32(static_cast<unsigned short>(a)) + float10ToFloat32(static_cast<unsigned short>(b))) * 0.5f);
|
||||
}
|
||||
|
||||
// Represents intervals of the type [a, b)
|
||||
template <typename T>
|
||||
struct Range
|
||||
{
|
||||
@ -542,6 +541,26 @@ struct Range
|
||||
typedef Range<int> RangeI;
|
||||
typedef Range<unsigned int> RangeUI;
|
||||
|
||||
struct IndexRange
|
||||
{
|
||||
IndexRange() : IndexRange(0, 0, 0) {}
|
||||
IndexRange(size_t start_, size_t end_, size_t vertexIndexCount_)
|
||||
: start(start_), end(end_), vertexIndexCount(vertexIndexCount_)
|
||||
{
|
||||
ASSERT(start <= end);
|
||||
}
|
||||
|
||||
// Number of vertices in the range.
|
||||
size_t vertexCount() const { return (end - start) + 1; }
|
||||
|
||||
// Inclusive range of indices that are not primitive restart
|
||||
size_t start;
|
||||
size_t end;
|
||||
|
||||
// Number of non-primitive restart indices
|
||||
size_t vertexIndexCount;
|
||||
};
|
||||
|
||||
// First, both normalized floating-point values are converted into 16-bit integer values.
|
||||
// Then, the results are packed into the returned 32-bit unsigned integer.
|
||||
// The first float value will be written to the least significant bits of the output;
|
||||
|
@ -71,15 +71,15 @@ class Matrix
|
||||
{
|
||||
ASSERT(columns() == m.rows());
|
||||
|
||||
size_t resultRows = rows();
|
||||
size_t resultCols = m.columns();
|
||||
unsigned int resultRows = rows();
|
||||
unsigned int resultCols = m.columns();
|
||||
Matrix<T> result(std::vector<T>(resultRows * resultCols), resultRows, resultCols);
|
||||
for (size_t i = 0; i < resultRows; i++)
|
||||
for (unsigned int i = 0; i < resultRows; i++)
|
||||
{
|
||||
for (size_t j = 0; j < resultCols; j++)
|
||||
for (unsigned int j = 0; j < resultCols; j++)
|
||||
{
|
||||
T tmp = 0.0f;
|
||||
for (size_t k = 0; k < columns(); k++)
|
||||
for (unsigned int k = 0; k < columns(); k++)
|
||||
tmp += at(i, k) * m(k, j);
|
||||
result(i, j) = tmp;
|
||||
}
|
||||
@ -103,8 +103,8 @@ class Matrix
|
||||
Matrix<T> compMult(const Matrix<T> &mat1) const
|
||||
{
|
||||
Matrix result(std::vector<T>(mElements.size()), size());
|
||||
for (size_t i = 0; i < columns(); i++)
|
||||
for (size_t j = 0; j < rows(); j++)
|
||||
for (unsigned int i = 0; i < columns(); i++)
|
||||
for (unsigned int j = 0; j < rows(); j++)
|
||||
result(i, j) = at(i, j) * mat1(i, j);
|
||||
|
||||
return result;
|
||||
@ -114,8 +114,8 @@ class Matrix
|
||||
{
|
||||
unsigned int cols = mat1.columns();
|
||||
Matrix result(std::vector<T>(rows() * cols), rows(), cols);
|
||||
for (size_t i = 0; i < rows(); i++)
|
||||
for (size_t j = 0; j < cols; j++)
|
||||
for (unsigned int i = 0; i < rows(); i++)
|
||||
for (unsigned int j = 0; j < cols; j++)
|
||||
result(i, j) = at(i, 0) * mat1(0, j);
|
||||
|
||||
return result;
|
||||
@ -124,8 +124,8 @@ class Matrix
|
||||
Matrix<T> transpose() const
|
||||
{
|
||||
Matrix result(std::vector<T>(mElements.size()), columns(), rows());
|
||||
for (size_t i = 0; i < columns(); i++)
|
||||
for (size_t j = 0; j < rows(); j++)
|
||||
for (unsigned int i = 0; i < columns(); i++)
|
||||
for (unsigned int j = 0; j < rows(); j++)
|
||||
result(i, j) = at(j, i);
|
||||
|
||||
return result;
|
||||
@ -330,8 +330,8 @@ class Matrix
|
||||
Matrix<T> adjugateMatrix(cof.transpose());
|
||||
T det = determinant();
|
||||
Matrix<T> result(std::vector<T>(mElements.size()), rows(), columns());
|
||||
for (size_t i = 0; i < rows(); i++)
|
||||
for (size_t j = 0; j < columns(); j++)
|
||||
for (unsigned int i = 0; i < rows(); i++)
|
||||
for (unsigned int j = 0; j < columns(); j++)
|
||||
result(i, j) = det ? adjugateMatrix(i, j) / det : T();
|
||||
|
||||
return result;
|
||||
|
@ -21,9 +21,9 @@ const unsigned int maxDimensions = 4;
|
||||
|
||||
TEST(MatrixUtilsTest, MatrixConstructorTest)
|
||||
{
|
||||
for (size_t i = minDimensions; i <= maxDimensions; i++)
|
||||
for (unsigned int i = minDimensions; i <= maxDimensions; i++)
|
||||
{
|
||||
for (size_t j = minDimensions; j <= maxDimensions; j++)
|
||||
for (unsigned int j = minDimensions; j <= maxDimensions; j++)
|
||||
{
|
||||
unsigned int numElements = i * j;
|
||||
Matrix<float> m(std::vector<float>(numElements, 1.0f), i, j);
|
||||
@ -33,7 +33,7 @@ TEST(MatrixUtilsTest, MatrixConstructorTest)
|
||||
}
|
||||
}
|
||||
|
||||
for (size_t i = minDimensions; i <= maxDimensions; i++)
|
||||
for (unsigned int i = minDimensions; i <= maxDimensions; i++)
|
||||
{
|
||||
unsigned int numElements = i * i;
|
||||
Matrix<float> m(std::vector<float>(numElements, 1.0f), i);
|
||||
@ -45,7 +45,7 @@ TEST(MatrixUtilsTest, MatrixConstructorTest)
|
||||
|
||||
TEST(MatrixUtilsTest, MatrixCompMultTest)
|
||||
{
|
||||
for (size_t i = minDimensions; i <= maxDimensions; i++)
|
||||
for (unsigned int i = minDimensions; i <= maxDimensions; i++)
|
||||
{
|
||||
unsigned int numElements = i * i;
|
||||
Matrix<float> m1(std::vector<float>(numElements, 2.0f), i);
|
||||
@ -58,9 +58,9 @@ TEST(MatrixUtilsTest, MatrixCompMultTest)
|
||||
|
||||
TEST(MatrixUtilsTest, MatrixOuterProductTest)
|
||||
{
|
||||
for (size_t i = minDimensions; i <= maxDimensions; i++)
|
||||
for (unsigned int i = minDimensions; i <= maxDimensions; i++)
|
||||
{
|
||||
for (size_t j = minDimensions; j <= maxDimensions; j++)
|
||||
for (unsigned int j = minDimensions; j <= maxDimensions; j++)
|
||||
{
|
||||
unsigned int numElements = i * j;
|
||||
Matrix<float> m1(std::vector<float>(numElements, 2.0f), i, 1);
|
||||
@ -77,9 +77,9 @@ TEST(MatrixUtilsTest, MatrixOuterProductTest)
|
||||
|
||||
TEST(MatrixUtilsTest, MatrixTransposeTest)
|
||||
{
|
||||
for (size_t i = minDimensions; i <= maxDimensions; i++)
|
||||
for (unsigned int i = minDimensions; i <= maxDimensions; i++)
|
||||
{
|
||||
for (size_t j = minDimensions; j <= maxDimensions; j++)
|
||||
for (unsigned int j = minDimensions; j <= maxDimensions; j++)
|
||||
{
|
||||
unsigned int numElements = i * j;
|
||||
Matrix<float> m1(std::vector<float>(numElements, 2.0f), i, j);
|
||||
@ -97,7 +97,7 @@ TEST(MatrixUtilsTest, MatrixTransposeTest)
|
||||
|
||||
TEST(MatrixUtilsTest, MatrixDeterminantTest)
|
||||
{
|
||||
for (size_t i = minDimensions; i <= maxDimensions; i++)
|
||||
for (unsigned int i = minDimensions; i <= maxDimensions; i++)
|
||||
{
|
||||
unsigned int numElements = i * i;
|
||||
Matrix<float> m(std::vector<float>(numElements, 2.0f), i);
|
||||
@ -176,7 +176,7 @@ TEST(MatrixUtilsTest, 4x4MatrixInverseTest)
|
||||
Matrix<float> result = inputMatrix * inputMatrix.inverse();
|
||||
std::vector<float> resultElements = result.elements();
|
||||
const float floatFaultTolarance = 0.00001f;
|
||||
for (size_t i = 0; i < numElements; i++)
|
||||
for (unsigned int i = 0; i < numElements; i++)
|
||||
EXPECT_NEAR(resultElements[i], identityMatrix[i], floatFaultTolarance);
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,78 @@
|
||||
# include <windows.graphics.display.h>
|
||||
#endif
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
template <class IndexType>
|
||||
gl::IndexRange ComputeTypedIndexRange(const IndexType *indices,
|
||||
size_t count,
|
||||
bool primitiveRestartEnabled,
|
||||
GLuint primitiveRestartIndex)
|
||||
{
|
||||
ASSERT(count > 0);
|
||||
|
||||
IndexType minIndex = 0;
|
||||
IndexType maxIndex = 0;
|
||||
size_t nonPrimitiveRestartIndices = 0;
|
||||
|
||||
if (primitiveRestartEnabled)
|
||||
{
|
||||
// Find the first non-primitive restart index to initialize the min and max values
|
||||
size_t i = 0;
|
||||
for (; i < count; i++)
|
||||
{
|
||||
if (indices[i] != primitiveRestartIndex)
|
||||
{
|
||||
minIndex = indices[i];
|
||||
maxIndex = indices[i];
|
||||
nonPrimitiveRestartIndices++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Loop over the rest of the indices
|
||||
for (; i < count; i++)
|
||||
{
|
||||
if (indices[i] != primitiveRestartIndex)
|
||||
{
|
||||
if (minIndex > indices[i])
|
||||
{
|
||||
minIndex = indices[i];
|
||||
}
|
||||
if (maxIndex < indices[i])
|
||||
{
|
||||
maxIndex = indices[i];
|
||||
}
|
||||
nonPrimitiveRestartIndices++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
minIndex = indices[0];
|
||||
maxIndex = indices[0];
|
||||
nonPrimitiveRestartIndices = count;
|
||||
|
||||
for (size_t i = 1; i < count; i++)
|
||||
{
|
||||
if (minIndex > indices[i])
|
||||
{
|
||||
minIndex = indices[i];
|
||||
}
|
||||
if (maxIndex < indices[i])
|
||||
{
|
||||
maxIndex = indices[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return gl::IndexRange(static_cast<size_t>(minIndex), static_cast<size_t>(maxIndex),
|
||||
nonPrimitiveRestartIndices);
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
namespace gl
|
||||
{
|
||||
|
||||
@ -399,30 +471,44 @@ GLenum LayerIndexToCubeMapTextureTarget(size_t index)
|
||||
return FirstCubeMapTextureTarget + static_cast<GLenum>(index);
|
||||
}
|
||||
|
||||
template <class IndexType>
|
||||
static RangeUI ComputeTypedIndexRange(const IndexType *indices, GLsizei count)
|
||||
{
|
||||
ASSERT(count > 0);
|
||||
IndexType minIndex = indices[0];
|
||||
IndexType maxIndex = indices[0];
|
||||
|
||||
for (GLsizei i = 1; i < count; i++)
|
||||
{
|
||||
if (minIndex > indices[i]) minIndex = indices[i];
|
||||
if (maxIndex < indices[i]) maxIndex = indices[i];
|
||||
}
|
||||
|
||||
return RangeUI(static_cast<GLuint>(minIndex), static_cast<GLuint>(maxIndex));
|
||||
}
|
||||
|
||||
RangeUI ComputeIndexRange(GLenum indexType, const GLvoid *indices, GLsizei count)
|
||||
IndexRange ComputeIndexRange(GLenum indexType,
|
||||
const GLvoid *indices,
|
||||
size_t count,
|
||||
bool primitiveRestartEnabled)
|
||||
{
|
||||
switch (indexType)
|
||||
{
|
||||
case GL_UNSIGNED_BYTE: return ComputeTypedIndexRange(static_cast<const GLubyte*>(indices), count);
|
||||
case GL_UNSIGNED_SHORT: return ComputeTypedIndexRange(static_cast<const GLushort*>(indices), count);
|
||||
case GL_UNSIGNED_INT: return ComputeTypedIndexRange(static_cast<const GLuint*>(indices), count);
|
||||
default: UNREACHABLE(); return RangeUI(0, 0);
|
||||
case GL_UNSIGNED_BYTE:
|
||||
return ComputeTypedIndexRange(static_cast<const GLubyte *>(indices), count,
|
||||
primitiveRestartEnabled,
|
||||
GetPrimitiveRestartIndex(indexType));
|
||||
case GL_UNSIGNED_SHORT:
|
||||
return ComputeTypedIndexRange(static_cast<const GLushort *>(indices), count,
|
||||
primitiveRestartEnabled,
|
||||
GetPrimitiveRestartIndex(indexType));
|
||||
case GL_UNSIGNED_INT:
|
||||
return ComputeTypedIndexRange(static_cast<const GLuint *>(indices), count,
|
||||
primitiveRestartEnabled,
|
||||
GetPrimitiveRestartIndex(indexType));
|
||||
default:
|
||||
UNREACHABLE();
|
||||
return IndexRange();
|
||||
}
|
||||
}
|
||||
|
||||
GLuint GetPrimitiveRestartIndex(GLenum indexType)
|
||||
{
|
||||
switch (indexType)
|
||||
{
|
||||
case GL_UNSIGNED_BYTE:
|
||||
return 0xFF;
|
||||
case GL_UNSIGNED_SHORT:
|
||||
return 0xFFFF;
|
||||
case GL_UNSIGNED_INT:
|
||||
return 0xFFFFFFFF;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -555,6 +641,99 @@ std::string ParseUniformName(const std::string &name, size_t *outSubscript)
|
||||
|
||||
}
|
||||
|
||||
namespace egl
|
||||
{
|
||||
static_assert(EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X_KHR - EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR == 1,
|
||||
"Unexpected EGL cube map enum value.");
|
||||
static_assert(EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y_KHR - EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR == 2,
|
||||
"Unexpected EGL cube map enum value.");
|
||||
static_assert(EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_KHR - EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR == 3,
|
||||
"Unexpected EGL cube map enum value.");
|
||||
static_assert(EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z_KHR - EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR == 4,
|
||||
"Unexpected EGL cube map enum value.");
|
||||
static_assert(EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_KHR - EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR == 5,
|
||||
"Unexpected EGL cube map enum value.");
|
||||
|
||||
bool IsCubeMapTextureTarget(EGLenum target)
|
||||
{
|
||||
return (target >= FirstCubeMapTextureTarget && target <= LastCubeMapTextureTarget);
|
||||
}
|
||||
|
||||
size_t CubeMapTextureTargetToLayerIndex(EGLenum target)
|
||||
{
|
||||
ASSERT(IsCubeMapTextureTarget(target));
|
||||
return target - static_cast<size_t>(FirstCubeMapTextureTarget);
|
||||
}
|
||||
|
||||
EGLenum LayerIndexToCubeMapTextureTarget(size_t index)
|
||||
{
|
||||
ASSERT(index <= (LastCubeMapTextureTarget - FirstCubeMapTextureTarget));
|
||||
return FirstCubeMapTextureTarget + static_cast<GLenum>(index);
|
||||
}
|
||||
|
||||
bool IsTextureTarget(EGLenum target)
|
||||
{
|
||||
switch (target)
|
||||
{
|
||||
case EGL_GL_TEXTURE_2D_KHR:
|
||||
case EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR:
|
||||
case EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X_KHR:
|
||||
case EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y_KHR:
|
||||
case EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_KHR:
|
||||
case EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z_KHR:
|
||||
case EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_KHR:
|
||||
case EGL_GL_TEXTURE_3D_KHR:
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool IsRenderbufferTarget(EGLenum target)
|
||||
{
|
||||
return target == EGL_GL_RENDERBUFFER_KHR;
|
||||
}
|
||||
}
|
||||
|
||||
namespace egl_gl
|
||||
{
|
||||
GLenum EGLCubeMapTargetToGLCubeMapTarget(EGLenum eglTarget)
|
||||
{
|
||||
ASSERT(egl::IsCubeMapTextureTarget(eglTarget));
|
||||
return gl::LayerIndexToCubeMapTextureTarget(egl::CubeMapTextureTargetToLayerIndex(eglTarget));
|
||||
}
|
||||
|
||||
GLenum EGLImageTargetToGLTextureTarget(EGLenum eglTarget)
|
||||
{
|
||||
switch (eglTarget)
|
||||
{
|
||||
case EGL_GL_TEXTURE_2D_KHR:
|
||||
return GL_TEXTURE_2D;
|
||||
|
||||
case EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR:
|
||||
case EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X_KHR:
|
||||
case EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y_KHR:
|
||||
case EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_KHR:
|
||||
case EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z_KHR:
|
||||
case EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_KHR:
|
||||
return EGLCubeMapTargetToGLCubeMapTarget(eglTarget);
|
||||
|
||||
case EGL_GL_TEXTURE_3D_KHR:
|
||||
return GL_TEXTURE_3D;
|
||||
|
||||
default:
|
||||
UNREACHABLE();
|
||||
return GL_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
GLuint EGLClientBufferToGLObjectHandle(EGLClientBuffer buffer)
|
||||
{
|
||||
return static_cast<GLuint>(reinterpret_cast<uintptr_t>(buffer));
|
||||
}
|
||||
}
|
||||
|
||||
#if !defined(ANGLE_ENABLE_WINDOWS_STORE)
|
||||
std::string getTempPath()
|
||||
{
|
||||
|
@ -9,6 +9,9 @@
|
||||
#ifndef COMMON_UTILITIES_H_
|
||||
#define COMMON_UTILITIES_H_
|
||||
|
||||
#include <EGL/egl.h>
|
||||
#include <EGL/eglext.h>
|
||||
|
||||
#include "angle_gl.h"
|
||||
#include <string>
|
||||
#include <math.h>
|
||||
@ -47,7 +50,15 @@ GLenum LayerIndexToCubeMapTextureTarget(size_t index);
|
||||
// set to GL_INVALID_INDEX if the provided name is not an array or the array index is invalid.
|
||||
std::string ParseUniformName(const std::string &name, size_t *outSubscript);
|
||||
|
||||
RangeUI ComputeIndexRange(GLenum indexType, const GLvoid *indices, GLsizei count);
|
||||
// Find the range of index values in the provided indices pointer. Primitive restart indices are
|
||||
// only counted in the range if primitive restart is disabled.
|
||||
IndexRange ComputeIndexRange(GLenum indexType,
|
||||
const GLvoid *indices,
|
||||
size_t count,
|
||||
bool primitiveRestartEnabled);
|
||||
|
||||
// Get the primitive restart index value for the given index type.
|
||||
GLuint GetPrimitiveRestartIndex(GLenum indexType);
|
||||
|
||||
bool IsTriangleMode(GLenum drawMode);
|
||||
|
||||
@ -59,6 +70,24 @@ template <typename outT> outT uiround(GLfloat value) { return static_cast<outT>(
|
||||
|
||||
}
|
||||
|
||||
namespace egl
|
||||
{
|
||||
static const EGLenum FirstCubeMapTextureTarget = EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR;
|
||||
static const EGLenum LastCubeMapTextureTarget = EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_KHR;
|
||||
bool IsCubeMapTextureTarget(EGLenum target);
|
||||
size_t CubeMapTextureTargetToLayerIndex(EGLenum target);
|
||||
EGLenum LayerIndexToCubeMapTextureTarget(size_t index);
|
||||
bool IsTextureTarget(EGLenum target);
|
||||
bool IsRenderbufferTarget(EGLenum target);
|
||||
}
|
||||
|
||||
namespace egl_gl
|
||||
{
|
||||
GLenum EGLCubeMapTargetToGLCubeMapTarget(EGLenum eglTarget);
|
||||
GLenum EGLImageTargetToGLTextureTarget(EGLenum eglTarget);
|
||||
GLuint EGLClientBufferToGLObjectHandle(EGLClientBuffer buffer);
|
||||
}
|
||||
|
||||
#if !defined(ANGLE_ENABLE_WINDOWS_STORE)
|
||||
std::string getTempPath();
|
||||
void writeFile(const char* path, const void* data, size_t size);
|
||||
|
@ -15,8 +15,9 @@
|
||||
'../include/GLES2/gl2ext.h',
|
||||
'../include/GLES2/gl2platform.h',
|
||||
'../include/GLES3/gl3.h',
|
||||
'../include/GLES3/gl3ext.h',
|
||||
'../include/GLES3/gl3platform.h',
|
||||
'../include/GLES3/gl31.h',
|
||||
'../include/GLES3/gl32.h',
|
||||
'../include/GLSLANG/ShaderLang.h',
|
||||
'../include/GLSLANG/ShaderVars.h',
|
||||
'../include/KHR/khrplatform.h',
|
||||
@ -156,6 +157,8 @@
|
||||
'compiler/translator/BuiltInFunctionEmulatorHLSL.h',
|
||||
'compiler/translator/OutputHLSL.cpp',
|
||||
'compiler/translator/OutputHLSL.h',
|
||||
'compiler/translator/RemoveDynamicIndexing.cpp',
|
||||
'compiler/translator/RemoveDynamicIndexing.h',
|
||||
'compiler/translator/RemoveSwitchFallThrough.cpp',
|
||||
'compiler/translator/RemoveSwitchFallThrough.h',
|
||||
'compiler/translator/RewriteElseBlocks.cpp',
|
||||
@ -217,18 +220,6 @@
|
||||
'type': 'static_library',
|
||||
'includes': [ '../build/common_defines.gypi', ],
|
||||
'sources': [ '<@(angle_preprocessor_sources)', ],
|
||||
'conditions':
|
||||
[
|
||||
['angle_build_winrt==1',
|
||||
{
|
||||
'msvs_enable_winrt' : '1',
|
||||
'msvs_application_type_revision' : '<(angle_build_winrt_app_type_revision)',
|
||||
}],
|
||||
['angle_build_winphone==1',
|
||||
{
|
||||
'msvs_enable_winphone' : '1',
|
||||
}],
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'translator_lib',
|
||||
@ -259,15 +250,6 @@
|
||||
},
|
||||
'conditions':
|
||||
[
|
||||
['angle_build_winrt==1',
|
||||
{
|
||||
'msvs_enable_winrt' : '1',
|
||||
'msvs_application_type_revision' : '<(angle_build_winrt_app_type_revision)',
|
||||
}],
|
||||
['angle_build_winphone==1',
|
||||
{
|
||||
'msvs_enable_winphone' : '1',
|
||||
}],
|
||||
['angle_enable_hlsl==1',
|
||||
{
|
||||
'defines':
|
||||
@ -308,18 +290,6 @@
|
||||
'compiler/translator/ShaderLang.cpp',
|
||||
'compiler/translator/ShaderVars.cpp'
|
||||
],
|
||||
'conditions':
|
||||
[
|
||||
['angle_build_winrt==1',
|
||||
{
|
||||
'msvs_enable_winrt' : '1',
|
||||
'msvs_application_type_revision' : '<(angle_build_winrt_app_type_revision)',
|
||||
}],
|
||||
['angle_build_winphone==1',
|
||||
{
|
||||
'msvs_enable_winphone' : '1',
|
||||
}],
|
||||
],
|
||||
},
|
||||
|
||||
{
|
||||
@ -348,18 +318,6 @@
|
||||
'compiler/translator/ShaderLang.cpp',
|
||||
'compiler/translator/ShaderVars.cpp'
|
||||
],
|
||||
'conditions':
|
||||
[
|
||||
['angle_build_winrt==1',
|
||||
{
|
||||
'msvs_enable_winrt' : '1',
|
||||
'msvs_application_type_revision' : '<(angle_build_winrt_app_type_revision)',
|
||||
}],
|
||||
['angle_build_winphone==1',
|
||||
{
|
||||
'msvs_enable_winphone' : '1',
|
||||
}],
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
|
@ -113,10 +113,6 @@ std::string Diagnostics::message(ID id)
|
||||
return "invalid file number";
|
||||
case PP_INVALID_LINE_DIRECTIVE:
|
||||
return "invalid line directive";
|
||||
case PP_INVALID_PRAGMA:
|
||||
return "invalid pragma";
|
||||
case PP_INVALID_PRAGMA_VALUE:
|
||||
return "invalid pragma value, must be 'on' or 'off'";
|
||||
case PP_NON_PP_TOKEN_BEFORE_EXTENSION_ESSL3:
|
||||
return "extension directive must occur before any non-preprocessor tokens in ESSL3";
|
||||
// Errors end.
|
||||
|
@ -64,8 +64,6 @@ class Diagnostics
|
||||
PP_INVALID_LINE_NUMBER,
|
||||
PP_INVALID_FILE_NUMBER,
|
||||
PP_INVALID_LINE_DIRECTIVE,
|
||||
PP_INVALID_PRAGMA,
|
||||
PP_INVALID_PRAGMA_VALUE,
|
||||
PP_NON_PP_TOKEN_BEFORE_EXTENSION_ESSL3,
|
||||
PP_ERROR_END,
|
||||
|
||||
|
@ -141,71 +141,6 @@ bool isMacroPredefined(const std::string &name,
|
||||
namespace pp
|
||||
{
|
||||
|
||||
class DefinedParser : public Lexer
|
||||
{
|
||||
public:
|
||||
DefinedParser(Lexer *lexer,
|
||||
const MacroSet *macroSet,
|
||||
Diagnostics *diagnostics)
|
||||
: mLexer(lexer),
|
||||
mMacroSet(macroSet),
|
||||
mDiagnostics(diagnostics)
|
||||
{
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual void lex(Token *token)
|
||||
{
|
||||
const char kDefined[] = "defined";
|
||||
|
||||
mLexer->lex(token);
|
||||
if (token->type != Token::IDENTIFIER)
|
||||
return;
|
||||
if (token->text != kDefined)
|
||||
return;
|
||||
|
||||
bool paren = false;
|
||||
mLexer->lex(token);
|
||||
if (token->type == '(')
|
||||
{
|
||||
paren = true;
|
||||
mLexer->lex(token);
|
||||
}
|
||||
|
||||
if (token->type != Token::IDENTIFIER)
|
||||
{
|
||||
mDiagnostics->report(Diagnostics::PP_UNEXPECTED_TOKEN,
|
||||
token->location, token->text);
|
||||
skipUntilEOD(mLexer, token);
|
||||
return;
|
||||
}
|
||||
MacroSet::const_iterator iter = mMacroSet->find(token->text);
|
||||
std::string expression = iter != mMacroSet->end() ? "1" : "0";
|
||||
|
||||
if (paren)
|
||||
{
|
||||
mLexer->lex(token);
|
||||
if (token->type != ')')
|
||||
{
|
||||
mDiagnostics->report(Diagnostics::PP_UNEXPECTED_TOKEN,
|
||||
token->location, token->text);
|
||||
skipUntilEOD(mLexer, token);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// We have a valid defined operator.
|
||||
// Convert the current token into a CONST_INT token.
|
||||
token->type = Token::CONST_INT;
|
||||
token->text = expression;
|
||||
}
|
||||
|
||||
private:
|
||||
Lexer *mLexer;
|
||||
const MacroSet *mMacroSet;
|
||||
Diagnostics *mDiagnostics;
|
||||
};
|
||||
|
||||
DirectiveParser::DirectiveParser(Tokenizer *tokenizer,
|
||||
MacroSet *macroSet,
|
||||
Diagnostics *diagnostics,
|
||||
@ -631,8 +566,7 @@ void DirectiveParser::parsePragma(Token *token)
|
||||
break;
|
||||
case PRAGMA_VALUE:
|
||||
value = token->text;
|
||||
// Pragma value validation is handled in DirectiveHandler::handlePragma
|
||||
// because the proper pragma value is dependent on the pragma name.
|
||||
valid = valid && (token->type == Token::IDENTIFIER);
|
||||
break;
|
||||
case RIGHT_PAREN:
|
||||
valid = valid && (token->type == ')');
|
||||
@ -649,7 +583,7 @@ void DirectiveParser::parsePragma(Token *token)
|
||||
(state == RIGHT_PAREN + 1)); // With value.
|
||||
if (!valid)
|
||||
{
|
||||
mDiagnostics->report(Diagnostics::PP_INVALID_PRAGMA,
|
||||
mDiagnostics->report(Diagnostics::PP_UNRECOGNIZED_PRAGMA,
|
||||
token->location, name);
|
||||
}
|
||||
else if (state > PRAGMA_NAME) // Do not notify for empty pragma.
|
||||
@ -822,6 +756,7 @@ void DirectiveParser::parseVersion(Token *token)
|
||||
{
|
||||
mDirectiveHandler->handleVersion(token->location, version);
|
||||
mShaderVersion = version;
|
||||
PredefineMacro(mMacroSet, "__VERSION__", version);
|
||||
}
|
||||
}
|
||||
|
||||
@ -839,7 +774,7 @@ void DirectiveParser::parseLine(Token *token)
|
||||
int line = 0, file = 0;
|
||||
int state = LINE_NUMBER;
|
||||
|
||||
MacroExpander macroExpander(mTokenizer, mMacroSet, mDiagnostics);
|
||||
MacroExpander macroExpander(mTokenizer, mMacroSet, mDiagnostics, false);
|
||||
macroExpander.lex(token);
|
||||
while ((token->type != '\n') && (token->type != Token::LAST))
|
||||
{
|
||||
@ -954,12 +889,10 @@ int DirectiveParser::parseExpressionIf(Token *token)
|
||||
assert((getDirective(token) == DIRECTIVE_IF) ||
|
||||
(getDirective(token) == DIRECTIVE_ELIF));
|
||||
|
||||
DefinedParser definedParser(mTokenizer, mMacroSet, mDiagnostics);
|
||||
MacroExpander macroExpander(&definedParser, mMacroSet, mDiagnostics);
|
||||
MacroExpander macroExpander(mTokenizer, mMacroSet, mDiagnostics, true);
|
||||
ExpressionParser expressionParser(¯oExpander, mDiagnostics);
|
||||
|
||||
int expression = 0;
|
||||
macroExpander.lex(token);
|
||||
expressionParser.parse(token, &expression);
|
||||
|
||||
// Check if there are tokens after #if expression.
|
||||
|
@ -27,7 +27,7 @@ class DirectiveParser : public Lexer
|
||||
Diagnostics *diagnostics,
|
||||
DirectiveHandler *directiveHandler);
|
||||
|
||||
virtual void lex(Token *token);
|
||||
void lex(Token *token) override;
|
||||
|
||||
private:
|
||||
PP_DISALLOW_COPY_AND_ASSIGN(DirectiveParser);
|
||||
|
@ -110,6 +110,7 @@ typedef __int64 YYSTYPE;
|
||||
#include <stdint.h>
|
||||
typedef intmax_t YYSTYPE;
|
||||
#endif // _MSC_VER
|
||||
|
||||
#define YYENABLE_NLS 0
|
||||
#define YYLTYPE_IS_TRIVIAL 1
|
||||
#define YYSTYPE_IS_TRIVIAL 1
|
||||
@ -122,6 +123,13 @@ struct Context
|
||||
pp::Lexer* lexer;
|
||||
pp::Token* token;
|
||||
int* result;
|
||||
|
||||
void startIgnoreErrors() { ++ignoreErrors; }
|
||||
void endIgnoreErrors() { --ignoreErrors; }
|
||||
|
||||
bool isIgnoringErrors() { return ignoreErrors > 0; }
|
||||
|
||||
int ignoreErrors;
|
||||
};
|
||||
} // namespace
|
||||
|
||||
@ -162,15 +170,16 @@ extern int ppdebug;
|
||||
enum yytokentype
|
||||
{
|
||||
TOK_CONST_INT = 258,
|
||||
TOK_OP_OR = 259,
|
||||
TOK_OP_AND = 260,
|
||||
TOK_OP_EQ = 261,
|
||||
TOK_OP_NE = 262,
|
||||
TOK_OP_LE = 263,
|
||||
TOK_OP_GE = 264,
|
||||
TOK_OP_LEFT = 265,
|
||||
TOK_OP_RIGHT = 266,
|
||||
TOK_UNARY = 267
|
||||
TOK_IDENTIFIER = 259,
|
||||
TOK_OP_OR = 260,
|
||||
TOK_OP_AND = 261,
|
||||
TOK_OP_EQ = 262,
|
||||
TOK_OP_NE = 263,
|
||||
TOK_OP_LE = 264,
|
||||
TOK_OP_GE = 265,
|
||||
TOK_OP_LEFT = 266,
|
||||
TOK_OP_RIGHT = 267,
|
||||
TOK_UNARY = 268
|
||||
};
|
||||
#endif
|
||||
|
||||
@ -429,23 +438,23 @@ union yyalloc
|
||||
#endif /* !YYCOPY_NEEDED */
|
||||
|
||||
/* YYFINAL -- State number of the termination state. */
|
||||
#define YYFINAL 14
|
||||
#define YYFINAL 15
|
||||
/* YYLAST -- Last index in YYTABLE. */
|
||||
#define YYLAST 175
|
||||
#define YYLAST 176
|
||||
|
||||
/* YYNTOKENS -- Number of terminals. */
|
||||
#define YYNTOKENS 27
|
||||
#define YYNTOKENS 28
|
||||
/* YYNNTS -- Number of nonterminals. */
|
||||
#define YYNNTS 3
|
||||
#define YYNNTS 5
|
||||
/* YYNRULES -- Number of rules. */
|
||||
#define YYNRULES 26
|
||||
#define YYNRULES 29
|
||||
/* YYNSTATES -- Number of states. */
|
||||
#define YYNSTATES 52
|
||||
#define YYNSTATES 55
|
||||
|
||||
/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
|
||||
by yylex, with out-of-bounds checking. */
|
||||
#define YYUNDEFTOK 2
|
||||
#define YYMAXUTOK 267
|
||||
#define YYMAXUTOK 268
|
||||
|
||||
#define YYTRANSLATE(YYX) \
|
||||
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
|
||||
@ -457,16 +466,16 @@ static const yytype_uint8 yytranslate[] =
|
||||
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 23, 2, 2, 2, 21, 8, 2,
|
||||
25, 26, 19, 17, 2, 18, 2, 20, 2, 2,
|
||||
2, 2, 2, 24, 2, 2, 2, 22, 9, 2,
|
||||
26, 27, 20, 18, 2, 19, 2, 21, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
11, 2, 12, 2, 2, 2, 2, 2, 2, 2,
|
||||
12, 2, 13, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 7, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 8, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 6, 2, 24, 2, 2, 2,
|
||||
2, 2, 2, 2, 7, 2, 25, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
@ -480,16 +489,16 @@ static const yytype_uint8 yytranslate[] =
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
|
||||
5, 9, 10, 13, 14, 15, 16, 22
|
||||
5, 6, 10, 11, 14, 15, 16, 17, 23
|
||||
};
|
||||
|
||||
#if YYDEBUG
|
||||
/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
|
||||
static const yytype_uint8 yyrline[] =
|
||||
static const yytype_uint16 yyrline[] =
|
||||
{
|
||||
0, 97, 97, 104, 105, 108, 111, 114, 117, 120,
|
||||
123, 126, 129, 132, 135, 138, 141, 144, 147, 150,
|
||||
163, 176, 179, 182, 185, 188, 191
|
||||
0, 106, 106, 113, 114, 124, 124, 145, 145, 166,
|
||||
169, 172, 175, 178, 181, 184, 187, 190, 193, 196,
|
||||
199, 202, 205, 224, 243, 246, 249, 252, 255, 258
|
||||
};
|
||||
#endif
|
||||
|
||||
@ -498,11 +507,11 @@ static const yytype_uint8 yyrline[] =
|
||||
First, the terminals, then, starting at YYNTOKENS, nonterminals. */
|
||||
static const char *const yytname[] =
|
||||
{
|
||||
"$end", "error", "$undefined", "TOK_CONST_INT", "TOK_OP_OR",
|
||||
"TOK_OP_AND", "'|'", "'^'", "'&'", "TOK_OP_EQ", "TOK_OP_NE", "'<'",
|
||||
"'>'", "TOK_OP_LE", "TOK_OP_GE", "TOK_OP_LEFT", "TOK_OP_RIGHT", "'+'",
|
||||
"'-'", "'*'", "'/'", "'%'", "TOK_UNARY", "'!'", "'~'", "'('", "')'",
|
||||
"$accept", "input", "expression", YY_NULLPTR
|
||||
"$end", "error", "$undefined", "TOK_CONST_INT", "TOK_IDENTIFIER",
|
||||
"TOK_OP_OR", "TOK_OP_AND", "'|'", "'^'", "'&'", "TOK_OP_EQ", "TOK_OP_NE",
|
||||
"'<'", "'>'", "TOK_OP_LE", "TOK_OP_GE", "TOK_OP_LEFT", "TOK_OP_RIGHT",
|
||||
"'+'", "'-'", "'*'", "'/'", "'%'", "TOK_UNARY", "'!'", "'~'", "'('",
|
||||
"')'", "$accept", "input", "expression", "$@1", "$@2", YY_NULLPTR
|
||||
};
|
||||
#endif
|
||||
|
||||
@ -511,16 +520,16 @@ static const char *const yytname[] =
|
||||
(internal) symbol number NUM (which must be that of a token). */
|
||||
static const yytype_uint16 yytoknum[] =
|
||||
{
|
||||
0, 256, 257, 258, 259, 260, 124, 94, 38, 261,
|
||||
262, 60, 62, 263, 264, 265, 266, 43, 45, 42,
|
||||
47, 37, 267, 33, 126, 40, 41
|
||||
0, 256, 257, 258, 259, 260, 261, 124, 94, 38,
|
||||
262, 263, 60, 62, 264, 265, 266, 267, 43, 45,
|
||||
42, 47, 37, 268, 33, 126, 40, 41
|
||||
};
|
||||
# endif
|
||||
|
||||
#define YYPACT_NINF -11
|
||||
#define YYPACT_NINF -12
|
||||
|
||||
#define yypact_value_is_default(Yystate) \
|
||||
(!!((Yystate) == (-11)))
|
||||
(!!((Yystate) == (-12)))
|
||||
|
||||
#define YYTABLE_NINF -1
|
||||
|
||||
@ -531,12 +540,12 @@ static const yytype_uint16 yytoknum[] =
|
||||
STATE-NUM. */
|
||||
static const yytype_int16 yypact[] =
|
||||
{
|
||||
46, -11, 46, 46, 46, 46, 46, 12, 68, -11,
|
||||
-11, -11, -11, 27, -11, 46, 46, 46, 46, 46,
|
||||
46, 46, 46, 46, 46, 46, 46, 46, 46, 46,
|
||||
46, 46, 46, -11, 85, 101, 116, 130, 143, 154,
|
||||
154, -10, -10, -10, -10, 37, 37, 31, 31, -11,
|
||||
-11, -11
|
||||
31, -12, -12, 31, 31, 31, 31, 31, 51, 76,
|
||||
-12, -12, -12, -12, 53, -12, -12, -12, 31, 31,
|
||||
31, 31, 31, 31, 31, 31, 31, 31, 31, 31,
|
||||
31, 31, 31, 31, -12, 31, 31, 124, 138, 26,
|
||||
149, 149, -11, -11, -11, -11, 154, 154, -8, -8,
|
||||
-12, -12, -12, 93, 109
|
||||
};
|
||||
|
||||
/* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
|
||||
@ -544,24 +553,24 @@ static const yytype_int16 yypact[] =
|
||||
means the default is an error. */
|
||||
static const yytype_uint8 yydefact[] =
|
||||
{
|
||||
0, 3, 0, 0, 0, 0, 0, 0, 2, 25,
|
||||
24, 22, 23, 0, 1, 0, 0, 0, 0, 0,
|
||||
0, 3, 4, 0, 0, 0, 0, 0, 0, 2,
|
||||
28, 27, 25, 26, 0, 1, 5, 7, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 26, 4, 5, 6, 7, 8, 10,
|
||||
9, 14, 13, 12, 11, 16, 15, 18, 17, 21,
|
||||
20, 19
|
||||
0, 0, 0, 0, 29, 0, 0, 9, 10, 11,
|
||||
13, 12, 17, 16, 15, 14, 19, 18, 21, 20,
|
||||
24, 23, 22, 6, 8
|
||||
};
|
||||
|
||||
/* YYPGOTO[NTERM-NUM]. */
|
||||
static const yytype_int8 yypgoto[] =
|
||||
{
|
||||
-11, -11, -2
|
||||
-12, -12, -3, -12, -12
|
||||
};
|
||||
|
||||
/* YYDEFGOTO[NTERM-NUM]. */
|
||||
static const yytype_int8 yydefgoto[] =
|
||||
{
|
||||
-1, 7, 8
|
||||
-1, 8, 9, 35, 36
|
||||
};
|
||||
|
||||
/* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
|
||||
@ -569,74 +578,74 @@ static const yytype_int8 yydefgoto[] =
|
||||
number is the opposite. If YYTABLE_NINF, syntax error. */
|
||||
static const yytype_uint8 yytable[] =
|
||||
{
|
||||
9, 10, 11, 12, 13, 26, 27, 28, 29, 30,
|
||||
31, 32, 14, 34, 35, 36, 37, 38, 39, 40,
|
||||
41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
|
||||
51, 15, 16, 17, 18, 19, 20, 21, 22, 23,
|
||||
24, 25, 26, 27, 28, 29, 30, 31, 32, 1,
|
||||
30, 31, 32, 33, 28, 29, 30, 31, 32, 0,
|
||||
0, 0, 0, 2, 3, 0, 0, 0, 0, 4,
|
||||
5, 6, 15, 16, 17, 18, 19, 20, 21, 22,
|
||||
10, 11, 12, 13, 14, 27, 28, 29, 30, 31,
|
||||
32, 33, 31, 32, 33, 37, 38, 39, 40, 41,
|
||||
42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
|
||||
52, 0, 53, 54, 1, 2, 21, 22, 23, 24,
|
||||
25, 26, 27, 28, 29, 30, 31, 32, 33, 3,
|
||||
4, 15, 0, 0, 0, 5, 6, 7, 16, 17,
|
||||
18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
|
||||
28, 29, 30, 31, 32, 33, 0, 0, 0, 0,
|
||||
34, 16, 17, 18, 19, 20, 21, 22, 23, 24,
|
||||
25, 26, 27, 28, 29, 30, 31, 32, 33, 17,
|
||||
18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
|
||||
28, 29, 30, 31, 32, 33, 18, 19, 20, 21,
|
||||
22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
|
||||
32, 33, 19, 20, 21, 22, 23, 24, 25, 26,
|
||||
27, 28, 29, 30, 31, 32, 33, 20, 21, 22,
|
||||
23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
|
||||
16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
|
||||
26, 27, 28, 29, 30, 31, 32, 17, 18, 19,
|
||||
20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
|
||||
30, 31, 32, 18, 19, 20, 21, 22, 23, 24,
|
||||
25, 26, 27, 28, 29, 30, 31, 32, 19, 20,
|
||||
21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
|
||||
31, 32, 20, 21, 22, 23, 24, 25, 26, 27,
|
||||
28, 29, 30, 31, 32, 22, 23, 24, 25, 26,
|
||||
27, 28, 29, 30, 31, 32
|
||||
33, 23, 24, 25, 26, 27, 28, 29, 30, 31,
|
||||
32, 33, 29, 30, 31, 32, 33
|
||||
};
|
||||
|
||||
static const yytype_int8 yycheck[] =
|
||||
{
|
||||
2, 3, 4, 5, 6, 15, 16, 17, 18, 19,
|
||||
20, 21, 0, 15, 16, 17, 18, 19, 20, 21,
|
||||
22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
|
||||
32, 4, 5, 6, 7, 8, 9, 10, 11, 12,
|
||||
13, 14, 15, 16, 17, 18, 19, 20, 21, 3,
|
||||
19, 20, 21, 26, 17, 18, 19, 20, 21, -1,
|
||||
-1, -1, -1, 17, 18, -1, -1, -1, -1, 23,
|
||||
24, 25, 4, 5, 6, 7, 8, 9, 10, 11,
|
||||
3, 4, 5, 6, 7, 16, 17, 18, 19, 20,
|
||||
21, 22, 20, 21, 22, 18, 19, 20, 21, 22,
|
||||
23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
|
||||
33, -1, 35, 36, 3, 4, 10, 11, 12, 13,
|
||||
14, 15, 16, 17, 18, 19, 20, 21, 22, 18,
|
||||
19, 0, -1, -1, -1, 24, 25, 26, 5, 6,
|
||||
7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
|
||||
17, 18, 19, 20, 21, 22, -1, -1, -1, -1,
|
||||
27, 5, 6, 7, 8, 9, 10, 11, 12, 13,
|
||||
14, 15, 16, 17, 18, 19, 20, 21, 22, 6,
|
||||
7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
|
||||
17, 18, 19, 20, 21, 22, 7, 8, 9, 10,
|
||||
11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
|
||||
21, 22, 8, 9, 10, 11, 12, 13, 14, 15,
|
||||
16, 17, 18, 19, 20, 21, 22, 9, 10, 11,
|
||||
12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
|
||||
5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
|
||||
15, 16, 17, 18, 19, 20, 21, 6, 7, 8,
|
||||
9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
|
||||
19, 20, 21, 7, 8, 9, 10, 11, 12, 13,
|
||||
14, 15, 16, 17, 18, 19, 20, 21, 8, 9,
|
||||
10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
|
||||
20, 21, 9, 10, 11, 12, 13, 14, 15, 16,
|
||||
17, 18, 19, 20, 21, 11, 12, 13, 14, 15,
|
||||
16, 17, 18, 19, 20, 21
|
||||
22, 12, 13, 14, 15, 16, 17, 18, 19, 20,
|
||||
21, 22, 18, 19, 20, 21, 22
|
||||
};
|
||||
|
||||
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
|
||||
symbol of state STATE-NUM. */
|
||||
static const yytype_uint8 yystos[] =
|
||||
{
|
||||
0, 3, 17, 18, 23, 24, 25, 28, 29, 29,
|
||||
29, 29, 29, 29, 0, 4, 5, 6, 7, 8,
|
||||
0, 3, 4, 18, 19, 24, 25, 26, 29, 30,
|
||||
30, 30, 30, 30, 30, 0, 5, 6, 7, 8,
|
||||
9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
|
||||
19, 20, 21, 26, 29, 29, 29, 29, 29, 29,
|
||||
29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
|
||||
29, 29
|
||||
19, 20, 21, 22, 27, 31, 32, 30, 30, 30,
|
||||
30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
|
||||
30, 30, 30, 30, 30
|
||||
};
|
||||
|
||||
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
|
||||
static const yytype_uint8 yyr1[] =
|
||||
{
|
||||
0, 27, 28, 29, 29, 29, 29, 29, 29, 29,
|
||||
29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
|
||||
29, 29, 29, 29, 29, 29, 29
|
||||
0, 28, 29, 30, 30, 31, 30, 32, 30, 30,
|
||||
30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
|
||||
30, 30, 30, 30, 30, 30, 30, 30, 30, 30
|
||||
};
|
||||
|
||||
/* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
|
||||
static const yytype_uint8 yyr2[] =
|
||||
{
|
||||
0, 2, 1, 1, 3, 3, 3, 3, 3, 3,
|
||||
0, 2, 1, 1, 1, 0, 4, 0, 4, 3,
|
||||
3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
|
||||
3, 3, 2, 2, 2, 2, 3
|
||||
3, 3, 3, 3, 3, 2, 2, 2, 2, 3
|
||||
};
|
||||
|
||||
|
||||
@ -1330,7 +1339,14 @@ yyreduce:
|
||||
case 4:
|
||||
|
||||
{
|
||||
(yyval) = (yyvsp[-2]) || (yyvsp[0]);
|
||||
if (!context->isIgnoringErrors())
|
||||
{
|
||||
// This rule should be applied right after the token is lexed, so we can
|
||||
// refer to context->token in the error message.
|
||||
context->diagnostics->report(pp::Diagnostics::PP_CONDITIONAL_UNEXPECTED_TOKEN,
|
||||
context->token->location, context->token->text);
|
||||
}
|
||||
(yyval) = (yyvsp[0]);
|
||||
}
|
||||
|
||||
break;
|
||||
@ -1338,7 +1354,15 @@ yyreduce:
|
||||
case 5:
|
||||
|
||||
{
|
||||
(yyval) = (yyvsp[-2]) && (yyvsp[0]);
|
||||
if ((yyvsp[-1]) != 0)
|
||||
{
|
||||
// Ignore errors in the short-circuited part of the expression.
|
||||
// ESSL3.00 section 3.4:
|
||||
// If an operand is not evaluated, the presence of undefined identifiers
|
||||
// in the operand will not cause an error.
|
||||
// Unevaluated division by zero should not cause an error either.
|
||||
context->startIgnoreErrors();
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
@ -1346,7 +1370,15 @@ yyreduce:
|
||||
case 6:
|
||||
|
||||
{
|
||||
(yyval) = (yyvsp[-2]) | (yyvsp[0]);
|
||||
if ((yyvsp[-3]) != 0)
|
||||
{
|
||||
context->endIgnoreErrors();
|
||||
(yyval) = static_cast<YYSTYPE>(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
(yyval) = (yyvsp[-3]) || (yyvsp[0]);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
@ -1354,7 +1386,15 @@ yyreduce:
|
||||
case 7:
|
||||
|
||||
{
|
||||
(yyval) = (yyvsp[-2]) ^ (yyvsp[0]);
|
||||
if ((yyvsp[-1]) == 0)
|
||||
{
|
||||
// Ignore errors in the short-circuited part of the expression.
|
||||
// ESSL3.00 section 3.4:
|
||||
// If an operand is not evaluated, the presence of undefined identifiers
|
||||
// in the operand will not cause an error.
|
||||
// Unevaluated division by zero should not cause an error either.
|
||||
context->startIgnoreErrors();
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
@ -1362,7 +1402,15 @@ yyreduce:
|
||||
case 8:
|
||||
|
||||
{
|
||||
(yyval) = (yyvsp[-2]) & (yyvsp[0]);
|
||||
if ((yyvsp[-3]) == 0)
|
||||
{
|
||||
context->endIgnoreErrors();
|
||||
(yyval) = static_cast<YYSTYPE>(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
(yyval) = (yyvsp[-3]) && (yyvsp[0]);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
@ -1370,7 +1418,7 @@ yyreduce:
|
||||
case 9:
|
||||
|
||||
{
|
||||
(yyval) = (yyvsp[-2]) != (yyvsp[0]);
|
||||
(yyval) = (yyvsp[-2]) | (yyvsp[0]);
|
||||
}
|
||||
|
||||
break;
|
||||
@ -1378,7 +1426,7 @@ yyreduce:
|
||||
case 10:
|
||||
|
||||
{
|
||||
(yyval) = (yyvsp[-2]) == (yyvsp[0]);
|
||||
(yyval) = (yyvsp[-2]) ^ (yyvsp[0]);
|
||||
}
|
||||
|
||||
break;
|
||||
@ -1386,7 +1434,7 @@ yyreduce:
|
||||
case 11:
|
||||
|
||||
{
|
||||
(yyval) = (yyvsp[-2]) >= (yyvsp[0]);
|
||||
(yyval) = (yyvsp[-2]) & (yyvsp[0]);
|
||||
}
|
||||
|
||||
break;
|
||||
@ -1394,7 +1442,7 @@ yyreduce:
|
||||
case 12:
|
||||
|
||||
{
|
||||
(yyval) = (yyvsp[-2]) <= (yyvsp[0]);
|
||||
(yyval) = (yyvsp[-2]) != (yyvsp[0]);
|
||||
}
|
||||
|
||||
break;
|
||||
@ -1402,7 +1450,7 @@ yyreduce:
|
||||
case 13:
|
||||
|
||||
{
|
||||
(yyval) = (yyvsp[-2]) > (yyvsp[0]);
|
||||
(yyval) = (yyvsp[-2]) == (yyvsp[0]);
|
||||
}
|
||||
|
||||
break;
|
||||
@ -1410,7 +1458,7 @@ yyreduce:
|
||||
case 14:
|
||||
|
||||
{
|
||||
(yyval) = (yyvsp[-2]) < (yyvsp[0]);
|
||||
(yyval) = (yyvsp[-2]) >= (yyvsp[0]);
|
||||
}
|
||||
|
||||
break;
|
||||
@ -1418,7 +1466,7 @@ yyreduce:
|
||||
case 15:
|
||||
|
||||
{
|
||||
(yyval) = (yyvsp[-2]) >> (yyvsp[0]);
|
||||
(yyval) = (yyvsp[-2]) <= (yyvsp[0]);
|
||||
}
|
||||
|
||||
break;
|
||||
@ -1426,7 +1474,7 @@ yyreduce:
|
||||
case 16:
|
||||
|
||||
{
|
||||
(yyval) = (yyvsp[-2]) << (yyvsp[0]);
|
||||
(yyval) = (yyvsp[-2]) > (yyvsp[0]);
|
||||
}
|
||||
|
||||
break;
|
||||
@ -1434,7 +1482,7 @@ yyreduce:
|
||||
case 17:
|
||||
|
||||
{
|
||||
(yyval) = (yyvsp[-2]) - (yyvsp[0]);
|
||||
(yyval) = (yyvsp[-2]) < (yyvsp[0]);
|
||||
}
|
||||
|
||||
break;
|
||||
@ -1442,7 +1490,7 @@ yyreduce:
|
||||
case 18:
|
||||
|
||||
{
|
||||
(yyval) = (yyvsp[-2]) + (yyvsp[0]);
|
||||
(yyval) = (yyvsp[-2]) >> (yyvsp[0]);
|
||||
}
|
||||
|
||||
break;
|
||||
@ -1450,17 +1498,7 @@ yyreduce:
|
||||
case 19:
|
||||
|
||||
{
|
||||
if ((yyvsp[0]) == 0) {
|
||||
std::ostringstream stream;
|
||||
stream << (yyvsp[-2]) << " % " << (yyvsp[0]);
|
||||
std::string text = stream.str();
|
||||
context->diagnostics->report(pp::Diagnostics::PP_DIVISION_BY_ZERO,
|
||||
context->token->location,
|
||||
text.c_str());
|
||||
YYABORT;
|
||||
} else {
|
||||
(yyval) = (yyvsp[-2]) % (yyvsp[0]);
|
||||
}
|
||||
(yyval) = (yyvsp[-2]) << (yyvsp[0]);
|
||||
}
|
||||
|
||||
break;
|
||||
@ -1468,17 +1506,7 @@ yyreduce:
|
||||
case 20:
|
||||
|
||||
{
|
||||
if ((yyvsp[0]) == 0) {
|
||||
std::ostringstream stream;
|
||||
stream << (yyvsp[-2]) << " / " << (yyvsp[0]);
|
||||
std::string text = stream.str();
|
||||
context->diagnostics->report(pp::Diagnostics::PP_DIVISION_BY_ZERO,
|
||||
context->token->location,
|
||||
text.c_str());
|
||||
YYABORT;
|
||||
} else {
|
||||
(yyval) = (yyvsp[-2]) / (yyvsp[0]);
|
||||
}
|
||||
(yyval) = (yyvsp[-2]) - (yyvsp[0]);
|
||||
}
|
||||
|
||||
break;
|
||||
@ -1486,7 +1514,7 @@ yyreduce:
|
||||
case 21:
|
||||
|
||||
{
|
||||
(yyval) = (yyvsp[-2]) * (yyvsp[0]);
|
||||
(yyval) = (yyvsp[-2]) + (yyvsp[0]);
|
||||
}
|
||||
|
||||
break;
|
||||
@ -1494,7 +1522,23 @@ yyreduce:
|
||||
case 22:
|
||||
|
||||
{
|
||||
(yyval) = ! (yyvsp[0]);
|
||||
if ((yyvsp[0]) == 0)
|
||||
{
|
||||
if (!context->isIgnoringErrors())
|
||||
{
|
||||
std::ostringstream stream;
|
||||
stream << (yyvsp[-2]) << " % " << (yyvsp[0]);
|
||||
std::string text = stream.str();
|
||||
context->diagnostics->report(pp::Diagnostics::PP_DIVISION_BY_ZERO,
|
||||
context->token->location,
|
||||
text.c_str());
|
||||
}
|
||||
(yyval) = static_cast<YYSTYPE>(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
(yyval) = (yyvsp[-2]) % (yyvsp[0]);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
@ -1502,7 +1546,23 @@ yyreduce:
|
||||
case 23:
|
||||
|
||||
{
|
||||
(yyval) = ~ (yyvsp[0]);
|
||||
if ((yyvsp[0]) == 0)
|
||||
{
|
||||
if (!context->isIgnoringErrors())
|
||||
{
|
||||
std::ostringstream stream;
|
||||
stream << (yyvsp[-2]) << " / " << (yyvsp[0]);
|
||||
std::string text = stream.str();
|
||||
context->diagnostics->report(pp::Diagnostics::PP_DIVISION_BY_ZERO,
|
||||
context->token->location,
|
||||
text.c_str());
|
||||
}
|
||||
(yyval) = static_cast<YYSTYPE>(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
(yyval) = (yyvsp[-2]) / (yyvsp[0]);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
@ -1510,7 +1570,7 @@ yyreduce:
|
||||
case 24:
|
||||
|
||||
{
|
||||
(yyval) = - (yyvsp[0]);
|
||||
(yyval) = (yyvsp[-2]) * (yyvsp[0]);
|
||||
}
|
||||
|
||||
break;
|
||||
@ -1518,13 +1578,37 @@ yyreduce:
|
||||
case 25:
|
||||
|
||||
{
|
||||
(yyval) = + (yyvsp[0]);
|
||||
(yyval) = ! (yyvsp[0]);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 26:
|
||||
|
||||
{
|
||||
(yyval) = ~ (yyvsp[0]);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 27:
|
||||
|
||||
{
|
||||
(yyval) = - (yyvsp[0]);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 28:
|
||||
|
||||
{
|
||||
(yyval) = + (yyvsp[0]);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 29:
|
||||
|
||||
{
|
||||
(yyval) = (yyvsp[-1]);
|
||||
}
|
||||
@ -1765,9 +1849,11 @@ yyreturn:
|
||||
|
||||
int yylex(YYSTYPE *lvalp, Context *context)
|
||||
{
|
||||
pp::Token *token = context->token;
|
||||
context->lexer->lex(token);
|
||||
|
||||
int type = 0;
|
||||
|
||||
pp::Token *token = context->token;
|
||||
switch (token->type)
|
||||
{
|
||||
case pp::Token::CONST_INT: {
|
||||
@ -1781,6 +1867,10 @@ int yylex(YYSTYPE *lvalp, Context *context)
|
||||
type = TOK_CONST_INT;
|
||||
break;
|
||||
}
|
||||
case pp::Token::IDENTIFIER:
|
||||
*lvalp = static_cast<YYSTYPE>(-1);
|
||||
type = TOK_IDENTIFIER;
|
||||
break;
|
||||
case pp::Token::OP_OR:
|
||||
type = TOK_OP_OR;
|
||||
break;
|
||||
@ -1826,10 +1916,6 @@ int yylex(YYSTYPE *lvalp, Context *context)
|
||||
break;
|
||||
}
|
||||
|
||||
// Advance to the next token if the current one is valid.
|
||||
if (type != 0)
|
||||
context->lexer->lex(token);
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
@ -1855,6 +1941,7 @@ bool ExpressionParser::parse(Token *token, int *result)
|
||||
context.lexer = mLexer;
|
||||
context.token = token;
|
||||
context.result = result;
|
||||
context.ignoreErrors = 0;
|
||||
int ret = yyparse(&context);
|
||||
switch (ret)
|
||||
{
|
||||
|
@ -52,6 +52,7 @@ typedef __int64 YYSTYPE;
|
||||
#include <stdint.h>
|
||||
typedef intmax_t YYSTYPE;
|
||||
#endif // _MSC_VER
|
||||
|
||||
#define YYENABLE_NLS 0
|
||||
#define YYLTYPE_IS_TRIVIAL 1
|
||||
#define YYSTYPE_IS_TRIVIAL 1
|
||||
@ -64,6 +65,13 @@ struct Context
|
||||
pp::Lexer* lexer;
|
||||
pp::Token* token;
|
||||
int* result;
|
||||
|
||||
void startIgnoreErrors() { ++ignoreErrors; }
|
||||
void endIgnoreErrors() { --ignoreErrors; }
|
||||
|
||||
bool isIgnoringErrors() { return ignoreErrors > 0; }
|
||||
|
||||
int ignoreErrors;
|
||||
};
|
||||
} // namespace
|
||||
%}
|
||||
@ -79,6 +87,7 @@ static void yyerror(Context* context, const char* reason);
|
||||
%}
|
||||
|
||||
%token TOK_CONST_INT
|
||||
%token TOK_IDENTIFIER
|
||||
%left TOK_OP_OR
|
||||
%left TOK_OP_AND
|
||||
%left '|'
|
||||
@ -102,11 +111,57 @@ input
|
||||
|
||||
expression
|
||||
: TOK_CONST_INT
|
||||
| expression TOK_OP_OR expression {
|
||||
$$ = $1 || $3;
|
||||
| TOK_IDENTIFIER {
|
||||
if (!context->isIgnoringErrors())
|
||||
{
|
||||
// This rule should be applied right after the token is lexed, so we can
|
||||
// refer to context->token in the error message.
|
||||
context->diagnostics->report(pp::Diagnostics::PP_CONDITIONAL_UNEXPECTED_TOKEN,
|
||||
context->token->location, context->token->text);
|
||||
}
|
||||
$$ = $1;
|
||||
}
|
||||
| expression TOK_OP_AND expression {
|
||||
$$ = $1 && $3;
|
||||
| expression TOK_OP_OR {
|
||||
if ($1 != 0)
|
||||
{
|
||||
// Ignore errors in the short-circuited part of the expression.
|
||||
// ESSL3.00 section 3.4:
|
||||
// If an operand is not evaluated, the presence of undefined identifiers
|
||||
// in the operand will not cause an error.
|
||||
// Unevaluated division by zero should not cause an error either.
|
||||
context->startIgnoreErrors();
|
||||
}
|
||||
} expression {
|
||||
if ($1 != 0)
|
||||
{
|
||||
context->endIgnoreErrors();
|
||||
$$ = static_cast<YYSTYPE>(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
$$ = $1 || $4;
|
||||
}
|
||||
}
|
||||
| expression TOK_OP_AND {
|
||||
if ($1 == 0)
|
||||
{
|
||||
// Ignore errors in the short-circuited part of the expression.
|
||||
// ESSL3.00 section 3.4:
|
||||
// If an operand is not evaluated, the presence of undefined identifiers
|
||||
// in the operand will not cause an error.
|
||||
// Unevaluated division by zero should not cause an error either.
|
||||
context->startIgnoreErrors();
|
||||
}
|
||||
} expression {
|
||||
if ($1 == 0)
|
||||
{
|
||||
context->endIgnoreErrors();
|
||||
$$ = static_cast<YYSTYPE>(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
$$ = $1 && $4;
|
||||
}
|
||||
}
|
||||
| expression '|' expression {
|
||||
$$ = $1 | $3;
|
||||
@ -148,28 +203,40 @@ expression
|
||||
$$ = $1 + $3;
|
||||
}
|
||||
| expression '%' expression {
|
||||
if ($3 == 0) {
|
||||
std::ostringstream stream;
|
||||
stream << $1 << " % " << $3;
|
||||
std::string text = stream.str();
|
||||
context->diagnostics->report(pp::Diagnostics::PP_DIVISION_BY_ZERO,
|
||||
context->token->location,
|
||||
text.c_str());
|
||||
YYABORT;
|
||||
} else {
|
||||
if ($3 == 0)
|
||||
{
|
||||
if (!context->isIgnoringErrors())
|
||||
{
|
||||
std::ostringstream stream;
|
||||
stream << $1 << " % " << $3;
|
||||
std::string text = stream.str();
|
||||
context->diagnostics->report(pp::Diagnostics::PP_DIVISION_BY_ZERO,
|
||||
context->token->location,
|
||||
text.c_str());
|
||||
}
|
||||
$$ = static_cast<YYSTYPE>(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
$$ = $1 % $3;
|
||||
}
|
||||
}
|
||||
| expression '/' expression {
|
||||
if ($3 == 0) {
|
||||
std::ostringstream stream;
|
||||
stream << $1 << " / " << $3;
|
||||
std::string text = stream.str();
|
||||
context->diagnostics->report(pp::Diagnostics::PP_DIVISION_BY_ZERO,
|
||||
context->token->location,
|
||||
text.c_str());
|
||||
YYABORT;
|
||||
} else {
|
||||
if ($3 == 0)
|
||||
{
|
||||
if (!context->isIgnoringErrors())
|
||||
{
|
||||
std::ostringstream stream;
|
||||
stream << $1 << " / " << $3;
|
||||
std::string text = stream.str();
|
||||
context->diagnostics->report(pp::Diagnostics::PP_DIVISION_BY_ZERO,
|
||||
context->token->location,
|
||||
text.c_str());
|
||||
}
|
||||
$$ = static_cast<YYSTYPE>(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
$$ = $1 / $3;
|
||||
}
|
||||
}
|
||||
@ -197,9 +264,11 @@ expression
|
||||
|
||||
int yylex(YYSTYPE *lvalp, Context *context)
|
||||
{
|
||||
pp::Token *token = context->token;
|
||||
context->lexer->lex(token);
|
||||
|
||||
int type = 0;
|
||||
|
||||
pp::Token *token = context->token;
|
||||
switch (token->type)
|
||||
{
|
||||
case pp::Token::CONST_INT: {
|
||||
@ -213,6 +282,10 @@ int yylex(YYSTYPE *lvalp, Context *context)
|
||||
type = TOK_CONST_INT;
|
||||
break;
|
||||
}
|
||||
case pp::Token::IDENTIFIER:
|
||||
*lvalp = static_cast<YYSTYPE>(-1);
|
||||
type = TOK_IDENTIFIER;
|
||||
break;
|
||||
case pp::Token::OP_OR:
|
||||
type = TOK_OP_OR;
|
||||
break;
|
||||
@ -258,10 +331,6 @@ int yylex(YYSTYPE *lvalp, Context *context)
|
||||
break;
|
||||
}
|
||||
|
||||
// Advance to the next token if the current one is valid.
|
||||
if (type != 0)
|
||||
context->lexer->lex(token);
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
@ -287,6 +356,7 @@ bool ExpressionParser::parse(Token *token, int *result)
|
||||
context.lexer = mLexer;
|
||||
context.token = token;
|
||||
context.result = result;
|
||||
context.ignoreErrors = 0;
|
||||
int ret = yyparse(&context);
|
||||
switch (ret)
|
||||
{
|
||||
|
@ -29,13 +29,75 @@ Input::Input(size_t count, const char *const string[], const int length[]) :
|
||||
}
|
||||
}
|
||||
|
||||
size_t Input::read(char *buf, size_t maxSize)
|
||||
const char *Input::skipChar()
|
||||
{
|
||||
// This function should only be called when there is a character to skip.
|
||||
assert(mReadLoc.cIndex < mLength[mReadLoc.sIndex]);
|
||||
++mReadLoc.cIndex;
|
||||
if (mReadLoc.cIndex == mLength[mReadLoc.sIndex])
|
||||
{
|
||||
++mReadLoc.sIndex;
|
||||
mReadLoc.cIndex = 0;
|
||||
}
|
||||
if (mReadLoc.sIndex >= mCount)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
return mString[mReadLoc.sIndex] + mReadLoc.cIndex;
|
||||
}
|
||||
|
||||
size_t Input::read(char *buf, size_t maxSize, int *lineNo)
|
||||
{
|
||||
size_t nRead = 0;
|
||||
while ((nRead < maxSize) && (mReadLoc.sIndex < mCount))
|
||||
// The previous call to read might have stopped copying the string when encountering a line
|
||||
// continuation. Check for this possibility first.
|
||||
if (mReadLoc.sIndex < mCount && maxSize > 0)
|
||||
{
|
||||
const char *c = mString[mReadLoc.sIndex] + mReadLoc.cIndex;
|
||||
if ((*c) == '\\')
|
||||
{
|
||||
c = skipChar();
|
||||
if (c != nullptr && (*c) == '\n')
|
||||
{
|
||||
// Line continuation of backslash + newline.
|
||||
skipChar();
|
||||
++(*lineNo);
|
||||
}
|
||||
else if (c != nullptr && (*c) == '\r')
|
||||
{
|
||||
// Line continuation. Could be backslash + '\r\n' or just backslash + '\r'.
|
||||
c = skipChar();
|
||||
if (c != nullptr && (*c) == '\n')
|
||||
{
|
||||
skipChar();
|
||||
}
|
||||
++(*lineNo);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Not line continuation, so write the skipped backslash to buf.
|
||||
*buf = '\\';
|
||||
++nRead;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
size_t maxRead = maxSize;
|
||||
while ((nRead < maxRead) && (mReadLoc.sIndex < mCount))
|
||||
{
|
||||
size_t size = mLength[mReadLoc.sIndex] - mReadLoc.cIndex;
|
||||
size = std::min(size, maxSize);
|
||||
for (size_t i = 0; i < size; ++i)
|
||||
{
|
||||
// Stop if a possible line continuation is encountered.
|
||||
// It will be processed on the next call on input, which skips it
|
||||
// and increments line number if necessary.
|
||||
if (*(mString[mReadLoc.sIndex] + mReadLoc.cIndex + i) == '\\')
|
||||
{
|
||||
size = i;
|
||||
maxRead = nRead + size; // Stop reading right before the backslash.
|
||||
}
|
||||
}
|
||||
std::memcpy(buf + nRead, mString[mReadLoc.sIndex] + mReadLoc.cIndex, size);
|
||||
nRead += size;
|
||||
mReadLoc.cIndex += size;
|
||||
|
@ -33,7 +33,7 @@ class Input
|
||||
return mLength[index];
|
||||
}
|
||||
|
||||
size_t read(char *buf, size_t maxSize);
|
||||
size_t read(char *buf, size_t maxSize, int *lineNo);
|
||||
|
||||
struct Location
|
||||
{
|
||||
@ -49,6 +49,10 @@ class Input
|
||||
const Location &readLoc() const { return mReadLoc; }
|
||||
|
||||
private:
|
||||
// Skip a character and return the next character after the one that was skipped.
|
||||
// Return nullptr if data runs out.
|
||||
const char *skipChar();
|
||||
|
||||
// Input.
|
||||
size_t mCount;
|
||||
const char * const *mString;
|
||||
|
@ -6,6 +6,8 @@
|
||||
|
||||
#include "Macro.h"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
#include "Token.h"
|
||||
|
||||
namespace pp
|
||||
@ -19,5 +21,23 @@ bool Macro::equals(const Macro &other) const
|
||||
(replacements == other.replacements);
|
||||
}
|
||||
|
||||
void PredefineMacro(MacroSet *macroSet, const char *name, int value)
|
||||
{
|
||||
std::ostringstream stream;
|
||||
stream << value;
|
||||
|
||||
Token token;
|
||||
token.type = Token::CONST_INT;
|
||||
token.text = stream.str();
|
||||
|
||||
Macro macro;
|
||||
macro.predefined = true;
|
||||
macro.type = Macro::kTypeObj;
|
||||
macro.name = name;
|
||||
macro.replacements.push_back(token);
|
||||
|
||||
(*macroSet)[name] = macro;
|
||||
}
|
||||
|
||||
} // namespace pp
|
||||
|
||||
|
@ -45,6 +45,8 @@ struct Macro
|
||||
|
||||
typedef std::map<std::string, Macro> MacroSet;
|
||||
|
||||
void PredefineMacro(MacroSet *macroSet, const char *name, int value);
|
||||
|
||||
} // namespace pp
|
||||
|
||||
#endif // COMPILER_PREPROCESSOR_MACRO_H_
|
||||
|
@ -26,7 +26,7 @@ class TokenLexer : public Lexer
|
||||
mIter = mTokens.begin();
|
||||
}
|
||||
|
||||
virtual void lex(Token *token)
|
||||
void lex(Token *token) override
|
||||
{
|
||||
if (mIter == mTokens.end())
|
||||
{
|
||||
@ -48,10 +48,9 @@ class TokenLexer : public Lexer
|
||||
|
||||
MacroExpander::MacroExpander(Lexer *lexer,
|
||||
MacroSet *macroSet,
|
||||
Diagnostics *diagnostics)
|
||||
: mLexer(lexer),
|
||||
mMacroSet(macroSet),
|
||||
mDiagnostics(diagnostics)
|
||||
Diagnostics *diagnostics,
|
||||
bool parseDefined)
|
||||
: mLexer(lexer), mMacroSet(macroSet), mDiagnostics(diagnostics), mParseDefined(parseDefined)
|
||||
{
|
||||
}
|
||||
|
||||
@ -67,11 +66,54 @@ void MacroExpander::lex(Token *token)
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
const char kDefined[] = "defined";
|
||||
|
||||
getToken(token);
|
||||
|
||||
if (token->type != Token::IDENTIFIER)
|
||||
break;
|
||||
|
||||
// Defined operator is parsed here since it may be generated by macro expansion.
|
||||
// Defined operator produced by macro expansion has undefined behavior according to C++
|
||||
// spec, which the GLSL spec references (see C++14 draft spec section 16.1.4), but this
|
||||
// behavior is needed for passing dEQP tests, which enforce stricter compatibility between
|
||||
// implementations.
|
||||
if (mParseDefined && token->text == kDefined)
|
||||
{
|
||||
bool paren = false;
|
||||
getToken(token);
|
||||
if (token->type == '(')
|
||||
{
|
||||
paren = true;
|
||||
getToken(token);
|
||||
}
|
||||
if (token->type != Token::IDENTIFIER)
|
||||
{
|
||||
mDiagnostics->report(Diagnostics::PP_UNEXPECTED_TOKEN, token->location,
|
||||
token->text);
|
||||
break;
|
||||
}
|
||||
auto iter = mMacroSet->find(token->text);
|
||||
std::string expression = iter != mMacroSet->end() ? "1" : "0";
|
||||
|
||||
if (paren)
|
||||
{
|
||||
getToken(token);
|
||||
if (token->type != ')')
|
||||
{
|
||||
mDiagnostics->report(Diagnostics::PP_UNEXPECTED_TOKEN, token->location,
|
||||
token->text);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// We have a valid defined operator.
|
||||
// Convert the current token into a CONST_INT token.
|
||||
token->type = Token::CONST_INT;
|
||||
token->text = expression;
|
||||
break;
|
||||
}
|
||||
|
||||
if (token->expansionDisabled())
|
||||
break;
|
||||
|
||||
@ -187,6 +229,12 @@ bool MacroExpander::expandMacro(const Macro ¯o,
|
||||
std::vector<Token> *replacements)
|
||||
{
|
||||
replacements->clear();
|
||||
|
||||
// In the case of an object-like macro, the replacement list gets its location
|
||||
// from the identifier, but in the case of a function-like macro, the replacement
|
||||
// list gets its location from the closing parenthesis of the macro invocation.
|
||||
// This is tested by dEQP-GLES3.functional.shaders.preprocessor.predefined_macros.*
|
||||
SourceLocation replacementLocation = identifier.location;
|
||||
if (macro.type == Macro::kTypeObj)
|
||||
{
|
||||
replacements->assign(macro.replacements.begin(),
|
||||
@ -218,7 +266,7 @@ bool MacroExpander::expandMacro(const Macro ¯o,
|
||||
assert(macro.type == Macro::kTypeFunc);
|
||||
std::vector<MacroArg> args;
|
||||
args.reserve(macro.parameters.size());
|
||||
if (!collectMacroArgs(macro, identifier, &args))
|
||||
if (!collectMacroArgs(macro, identifier, &args, &replacementLocation))
|
||||
return false;
|
||||
|
||||
replaceMacroParams(macro, args, replacements);
|
||||
@ -234,14 +282,15 @@ bool MacroExpander::expandMacro(const Macro ¯o,
|
||||
repl.setAtStartOfLine(identifier.atStartOfLine());
|
||||
repl.setHasLeadingSpace(identifier.hasLeadingSpace());
|
||||
}
|
||||
repl.location = identifier.location;
|
||||
repl.location = replacementLocation;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MacroExpander::collectMacroArgs(const Macro ¯o,
|
||||
const Token &identifier,
|
||||
std::vector<MacroArg> *args)
|
||||
std::vector<MacroArg> *args,
|
||||
SourceLocation *closingParenthesisLocation)
|
||||
{
|
||||
Token token;
|
||||
getToken(&token);
|
||||
@ -271,6 +320,7 @@ bool MacroExpander::collectMacroArgs(const Macro ¯o,
|
||||
case ')':
|
||||
--openParens;
|
||||
isArg = openParens != 0;
|
||||
*closingParenthesisLocation = token.location;
|
||||
break;
|
||||
case ',':
|
||||
// The individual arguments are separated by comma tokens, but
|
||||
@ -317,7 +367,7 @@ bool MacroExpander::collectMacroArgs(const Macro ¯o,
|
||||
{
|
||||
MacroArg &arg = args->at(i);
|
||||
TokenLexer lexer(&arg);
|
||||
MacroExpander expander(&lexer, mMacroSet, mDiagnostics);
|
||||
MacroExpander expander(&lexer, mMacroSet, mDiagnostics, mParseDefined);
|
||||
|
||||
arg.clear();
|
||||
expander.lex(&token);
|
||||
|
@ -19,14 +19,15 @@ namespace pp
|
||||
{
|
||||
|
||||
class Diagnostics;
|
||||
struct SourceLocation;
|
||||
|
||||
class MacroExpander : public Lexer
|
||||
{
|
||||
public:
|
||||
MacroExpander(Lexer *lexer, MacroSet *macroSet, Diagnostics *diagnostics);
|
||||
virtual ~MacroExpander();
|
||||
MacroExpander(Lexer *lexer, MacroSet *macroSet, Diagnostics *diagnostics, bool parseDefined);
|
||||
~MacroExpander() override;
|
||||
|
||||
virtual void lex(Token *token);
|
||||
void lex(Token *token) override;
|
||||
|
||||
private:
|
||||
PP_DISALLOW_COPY_AND_ASSIGN(MacroExpander);
|
||||
@ -45,7 +46,8 @@ class MacroExpander : public Lexer
|
||||
typedef std::vector<Token> MacroArg;
|
||||
bool collectMacroArgs(const Macro ¯o,
|
||||
const Token &identifier,
|
||||
std::vector<MacroArg> *args);
|
||||
std::vector<MacroArg> *args,
|
||||
SourceLocation *closingParenthesisLocation);
|
||||
void replaceMacroParams(const Macro ¯o,
|
||||
const std::vector<MacroArg> &args,
|
||||
std::vector<Token> *replacements);
|
||||
@ -79,6 +81,7 @@ class MacroExpander : public Lexer
|
||||
Lexer *mLexer;
|
||||
MacroSet *mMacroSet;
|
||||
Diagnostics *mDiagnostics;
|
||||
bool mParseDefined;
|
||||
|
||||
std::auto_ptr<Token> mReserveToken;
|
||||
std::vector<MacroContext *> mContextStack;
|
||||
|
@ -7,7 +7,6 @@
|
||||
#include "Preprocessor.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <sstream>
|
||||
|
||||
#include "DiagnosticsBase.h"
|
||||
#include "DirectiveParser.h"
|
||||
@ -27,12 +26,11 @@ struct PreprocessorImpl
|
||||
DirectiveParser directiveParser;
|
||||
MacroExpander macroExpander;
|
||||
|
||||
PreprocessorImpl(Diagnostics *diag,
|
||||
DirectiveHandler *directiveHandler)
|
||||
PreprocessorImpl(Diagnostics *diag, DirectiveHandler *directiveHandler)
|
||||
: diagnostics(diag),
|
||||
tokenizer(diag),
|
||||
directiveParser(&tokenizer, ¯oSet, diag, directiveHandler),
|
||||
macroExpander(&directiveParser, ¯oSet, diag)
|
||||
macroExpander(&directiveParser, ¯oSet, diag, false)
|
||||
{
|
||||
}
|
||||
};
|
||||
@ -52,12 +50,12 @@ bool Preprocessor::init(size_t count,
|
||||
const char * const string[],
|
||||
const int length[])
|
||||
{
|
||||
static const int kGLSLVersion = 100;
|
||||
static const int kDefaultGLSLVersion = 100;
|
||||
|
||||
// Add standard pre-defined macros.
|
||||
predefineMacro("__LINE__", 0);
|
||||
predefineMacro("__FILE__", 0);
|
||||
predefineMacro("__VERSION__", kGLSLVersion);
|
||||
predefineMacro("__VERSION__", kDefaultGLSLVersion);
|
||||
predefineMacro("GL_ES", 1);
|
||||
|
||||
return mImpl->tokenizer.init(count, string, length);
|
||||
@ -65,20 +63,7 @@ bool Preprocessor::init(size_t count,
|
||||
|
||||
void Preprocessor::predefineMacro(const char *name, int value)
|
||||
{
|
||||
std::ostringstream stream;
|
||||
stream << value;
|
||||
|
||||
Token token;
|
||||
token.type = Token::CONST_INT;
|
||||
token.text = stream.str();
|
||||
|
||||
Macro macro;
|
||||
macro.predefined = true;
|
||||
macro.type = Macro::kTypeObj;
|
||||
macro.name = name;
|
||||
macro.replacements.push_back(token);
|
||||
|
||||
mImpl->macroSet[name] = macro;
|
||||
PredefineMacro(&mImpl->macroSet, name, value);
|
||||
}
|
||||
|
||||
void Preprocessor::lex(Token *token)
|
||||
|
@ -594,7 +594,7 @@ typedef pp::SourceLocation YYLTYPE;
|
||||
} while(0);
|
||||
|
||||
#define YY_INPUT(buf, result, maxSize) \
|
||||
result = yyextra->input.read(buf, maxSize);
|
||||
result = yyextra->input.read(buf, maxSize, &yylineno);
|
||||
|
||||
#define INITIAL 0
|
||||
#define COMMENT 1
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user