Merge remote-tracking branch 'origin/5.12' into dev
Conflicts: src/corelib/animation/qpropertyanimation.cpp src/gui/image/qicon.cpp tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp Change-Id: I3698172b7b44ebb487cb38f50fd2c4a9f8a35b21
This commit is contained in:
commit
e28e91ae99
@ -39,8 +39,8 @@
|
||||
|
||||
#include <openssl/opensslv.h>
|
||||
|
||||
#if !defined(OPENSSL_VERSION_NUMBER) || OPENSSL_VERSION_NUMBER-0 < 0x0090700fL
|
||||
# error "OpenSSL >= 0.9.7 is required"
|
||||
#if !defined(OPENSSL_VERSION_NUMBER) || OPENSSL_VERSION_NUMBER-0 < 0x10000000L
|
||||
# error "OpenSSL >= 1.0.0 is required"
|
||||
#endif
|
||||
|
||||
#include <openssl/ssl.h>
|
||||
|
@ -582,7 +582,7 @@
|
||||
"shared": {
|
||||
"label": "Building shared libraries",
|
||||
"autoDetect": "!config.uikit",
|
||||
"condition": "!config.integrity",
|
||||
"condition": "!config.integrity && !config.wasm",
|
||||
"output": [
|
||||
"shared",
|
||||
"publicFeature",
|
||||
@ -1119,6 +1119,7 @@
|
||||
"label": "Thread support",
|
||||
"purpose": "Provides QThread and related classes.",
|
||||
"section": "Kernel",
|
||||
"condition": "!config.wasm",
|
||||
"output": [ "publicFeature" ]
|
||||
},
|
||||
"future": {
|
||||
|
@ -1,6 +1,7 @@
|
||||
# HTML Header with qt.io branding and online links
|
||||
|
||||
HTML.stylesheets = template/style/online.css \
|
||||
template/style/cookie-confirm.css \
|
||||
template/style/gsc.css \
|
||||
template/style/list_arrow.png \
|
||||
template/style/list_expand.png \
|
||||
@ -14,6 +15,7 @@ HTML.stylesheets = template/style/online.css \
|
||||
|
||||
#for including files into the qch file. Relative to the outputdir of a QDoc build.
|
||||
qhp.extraFiles += style/online.css \
|
||||
style/cookie-confirm.css \
|
||||
style/gsc.css \
|
||||
style/list_arrow.png \
|
||||
style/list_expand.png \
|
||||
@ -27,11 +29,13 @@ qhp.extraFiles += style/online.css \
|
||||
|
||||
HTML.headerstyles = \
|
||||
" <link rel=\"stylesheet\" type=\"text/css\" href=\"style/online.css\" />\n" \
|
||||
" <link rel=\"shortcut icon\" href=\"//d3hp9ud7yvwzy0.cloudfront.net/wp-content/themes/oneqt/images/favicon.ico.gzip\" />\n"
|
||||
" <link rel=\"shortcut icon\" href=\"//d33sqmjvzgs8hq.cloudfront.net/wp-content/themes/oneqt/assets/images/favicon.ico.gzip\" />\n"
|
||||
|
||||
HTML.headerscripts = \
|
||||
" <script type=\"text/javascript\"> wpThemeFolder = \'http://qt.io/wp-content/themes/oneqt\'; </script>\n" \
|
||||
" <script type=\"text/javascript\" src=\"//d3hp9ud7yvwzy0.cloudfront.net/wp-content/themes/oneqt/js/combo.js.gzip\"></script>\n" \
|
||||
" <script type=\"text/javascript\" src=\"//d33sqmjvzgs8hq.cloudfront.net/wp-includes/js/jquery/jquery.js.gzip\"></script>\n" \
|
||||
" <script type=\"text/javascript\" src=\"//d33sqmjvzgs8hq.cloudfront.net/wp-includes/js/jquery/jquery-migrate.min.js.gzip\"></script>\n" \
|
||||
" <script type=\"text/javascript\" src=\"//d33sqmjvzgs8hq.cloudfront.net/wp-content/themes/oneqt/js/combo.js.gzip\"></script>\n" \
|
||||
" <script type=\"text/javascript\" src=\"scripts/main.js\"></script>\n" \
|
||||
" <script type=\"text/javascript\" src=\"scripts/extras.js\"></script>\n" \
|
||||
" <script type=\"text/javascript\">\n" \
|
||||
@ -61,58 +65,25 @@ HTML.endheader = \
|
||||
# minimal header
|
||||
HTML.postheader = \
|
||||
"<body>\n" \
|
||||
"<div class=\"header\" id=\"header\">\n" \
|
||||
"<header id=\"navbar\" class=\"\">\n" \
|
||||
" <div class=\"cookies_yum\">\n" \
|
||||
" <div>\n" \
|
||||
" <img src=\"//d3hp9ud7yvwzy0.cloudfront.net/wp-content/themes/oneqt/assets/images/cookie_small.png\" align=\"left\">\n" \
|
||||
" <p class=\"close_button\">\n" \
|
||||
" We bake cookies in your browser for a better experience. Using this site means that you consent. <a href=\"//qt.io/terms-conditions/\">Read More</a>\n" \
|
||||
" </p>\n" \
|
||||
" <a class=\"close\"></a>\n" \
|
||||
" </div>\n" \
|
||||
"<div class=\"header\" id=\"tmpl_header\">\n" \
|
||||
"<header class=\"\" id=\"navbar\"><div id=\"cookie-confirmation\" style=\"display:none\"><div id=\"cookie-confirmation-inner\"><p>We bake cookies in your browser for a better experience. Using this site means that you consent.\n" \
|
||||
"<a href=\"https://www1.qt.io/terms-conditions/ \">Read more</a></p><div id=\"cookie-confirmation-buttons-area\"><a href=\"#\" id=\"confirmation-button\">Continue »</a>\n" \
|
||||
"</div></div>\n" \
|
||||
"<script>\n" \
|
||||
" $('#confirmation-button').on('click', function() { $('#cookie-confirmation').fadeOut(); createCookie(\"cookies_nom\", \"yum\", 180); });\n" \
|
||||
" if (!(readCookie('cookies_nom') == 'yum')) { $('#cookie-confirmation').fadeIn(); }\n" \
|
||||
"</script>\n" \
|
||||
"</div>\n" \
|
||||
"<div class=\"container\">\n" \
|
||||
" <div class=\"navbar-header cf\">\n" \
|
||||
" <div id=\"mm-wrap\">\n" \
|
||||
" <ul id=\"mm-helper\" class=\"mm-menu\" data-event=\"hover_intent\" data-effect=\"fade\" data-effect-speed=\"200\" data-panel-width=\"#navbar\" data-panel-inner-width=\"1280px\" data-second-click=\"go\" data-document-click=\"collapse\" data-vertical-behaviour=\"accordion\" data-breakpoint=\"0\">\n" \
|
||||
" <li class=\"mm-item\"><a class=\"mm-link\" href=\"http://blog.qt.io/\" tabindex=\"0\">Blog</a></li>\n" \
|
||||
" <li class=\"mm-item\"><a class=\"mm-link\" href=\"https://www.qt.io/contact-us/\" tabindex=\"0\">Contact Us</a></li>\n" \
|
||||
" <li class=\"mm-item\"><a title=\"Qt Account\" class=\"mm-link\" href=\"https://account.qt.io/\" tabindex=\"0\"></a></li>\n" \
|
||||
" </ul>\n" \
|
||||
" </div>\n" \
|
||||
" <div class=\"container\">\n" \
|
||||
" <div class=\"navbar-header clearfix\">\n" \
|
||||
" <a href=\"#\" class=\"navbar-toggle\">\n" \
|
||||
" <figure>\n" \
|
||||
" <span class=\"line\"></span>\n" \
|
||||
" </figure>\n" \
|
||||
" <span>Menu</span>\n" \
|
||||
" </a>\n" \
|
||||
" <ul id=\"menuextras\">\n" \
|
||||
" <li>\n" \
|
||||
" <a href=\"//qt.io/partners/\" data-icon=\"\">\n" \
|
||||
" <span>Partners</span>\n" \
|
||||
" </a>\n" \
|
||||
" </li>\n" \
|
||||
" <li>\n" \
|
||||
" <a target=\"_blank\" href=\"http://blog.qt.io/\" data-icon=\"\">\n" \
|
||||
" <span>Blog</span>\n" \
|
||||
" </a>\n" \
|
||||
" </li>\n" \
|
||||
" <li class=\"sign-in\">\n" \
|
||||
" <a data-icon=\"\" class=\"signin\" href=\"https://account.qt.io/login\"><span>Sign in</span></a>\n" \
|
||||
" </li>\n" \
|
||||
" </ul>\n" \
|
||||
" <a href=\"http://qt.io/\" class=\"navbar-oneQt retina\" data-icon=\"\">\n" \
|
||||
" </a>\n" \
|
||||
" <nav class=\"navbar-menu clearfix\" role=\"navigation\">\n" \
|
||||
" <ul id=\"mainmenu\" class=\"menu\"><li id=\"menu-item-18\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-18\"><a href=\"http://qt.io/download/\">Download</a></li>\n" \
|
||||
"<li id=\"menu-item-12207\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-12207\"><a href=\"http://www.qt.io/qt-for-device-creation/\">Device Creation</a></li>\n" \
|
||||
"<li id=\"menu-item-12208\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-12208\"><a href=\"http://www.qt.io/application-development/\">Application Development</a></li>\n" \
|
||||
"<li id=\"menu-item-1381\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-1381\"><a href=\"http://www.qt.io/services/\">Services</a></li>\n" \
|
||||
"<li id=\"menu-item-20\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-20\"><a href=\"http://www.qt.io/developers/\">Developers</a></li>\n" \
|
||||
"</ul> <ul class=\"menuextraslanguages\">\n" \
|
||||
" <li class=\"active dark\"><a class=\"dark\" href=\"http://qt.io/support/\">EN</a></li><li class=\"dark\"><a class=\"dark\" href=\"http://qt.io/ru/\">RU</a></li><li class=\"dark\"><a class=\"dark\" href=\"http://qt.io/zh-hans/\">ZH</a></li></ul>\n" \
|
||||
" </nav>\n" \
|
||||
" </div>\n" \
|
||||
" </div>\n" \
|
||||
"<div class=\"big_bar account\" style=\"\">\n" \
|
||||
" <div class=\"container\">\n" \
|
||||
" <h1><!-- mclude oneqt_no_cache_bMrsJxAh /wp-content/themes/oneqt/php_login_info_bottom_header.php --><!-- /mclude oneqt_no_cache_bMrsJxAh -->\n" \
|
||||
" <div class=\"col-1 right big_bar_button account\" style=\"margin-top:5px !important;\"></div>\n" \
|
||||
" </h1>\n" \
|
||||
" <a class=\"navbar-oneQt retina\" data-icon=\"\" href=\"https://www.qt.io/\"></a>\n" \
|
||||
" </div>\n" \
|
||||
"</div>\n" \
|
||||
"</header>\n" \
|
||||
|
219
doc/global/template/style/cookie-confirm.css
Normal file
219
doc/global/template/style/cookie-confirm.css
Normal file
@ -0,0 +1,219 @@
|
||||
body div#cookie-confirmation,
|
||||
body div#cookie-confirmation.can-use-gradients {
|
||||
background:#222840 !important;
|
||||
position:fixed !important;
|
||||
box-shadow:0 0 10px #222840 !important;
|
||||
border-bottom:none;
|
||||
top:auto;
|
||||
bottom:0;
|
||||
}
|
||||
body div#cookie-confirmation div#cookie-confirmation-inner,
|
||||
body div#cookie-confirmation.can-use-gradients div#cookie-confirmation-inner {
|
||||
padding:0 30px !important;
|
||||
overflow:hidden;
|
||||
display:-ms-flexbox;
|
||||
display:flex;
|
||||
-ms-flex-direction:row;
|
||||
flex-direction:row;
|
||||
-ms-flex-align:center;
|
||||
align-items:center;
|
||||
height:60px;
|
||||
}
|
||||
|
||||
body div#cookie-confirmation div#cookie-confirmation-inner p,
|
||||
body div#cookie-confirmation.can-use-gradients div#cookie-confirmation-inner p {
|
||||
text-shadow:none !important;
|
||||
font-family:"Titillium Web" !important;
|
||||
font-size:inherit !important;
|
||||
line-height:inherit !important;
|
||||
float:left;
|
||||
margin:0!important;
|
||||
}
|
||||
|
||||
body div#cookie-confirmation div#cookie-confirmation-inner p a,
|
||||
body div#cookie-confirmation.can-use-gradients div#cookie-confirmation-inner p a {
|
||||
font-family:inherit !important;
|
||||
color:#41cd52 !important;
|
||||
font-size:inherit !important;
|
||||
}
|
||||
body div#cookie-confirmation div#cookie-confirmation-inner #cookie-confirmation-buttons-area,
|
||||
body div#cookie-confirmation.can-use-gradients div#cookie-confirmation-inner #cookie-confirmation-buttons-area {
|
||||
display:-ms-flexbox;
|
||||
display:flex;
|
||||
float:left;
|
||||
margin-left:50px;
|
||||
}
|
||||
|
||||
body div#cookie-confirmation div#cookie-confirmation-inner #cookie-confirmation-buttons-area a#confirmation-button,
|
||||
body div#cookie-confirmation.can-use-gradients div#cookie-confirmation-inner #cookie-confirmation-buttons-area a#confirmation-button {
|
||||
text-shadow:none !important;
|
||||
border-radius:0;
|
||||
border:0 !important;
|
||||
box-shadow:none;
|
||||
line-height:32px !important;
|
||||
height:32px !important;
|
||||
font-size:16px !important;
|
||||
font-weight:400 !important;
|
||||
color:#fff !important;
|
||||
font-family:"Titillium Web" !important;
|
||||
display:inline-block;
|
||||
padding:0 15px !important;
|
||||
position:relative;
|
||||
background:#41cd52 !important;
|
||||
transition:all .2s ease-in-out;
|
||||
}
|
||||
body div#cookie-confirmation div#cookie-confirmation-inner #cookie-confirmation-buttons-area a#confirmation-button:hover,
|
||||
body div#cookie-confirmation.can-use-gradients div#cookie-confirmation-inner #cookie-confirmation-buttons-area a#confirmation-button:hover{
|
||||
background:#17a81a !important;
|
||||
}
|
||||
|
||||
body div#cookie-confirmation div#cookie-confirmation-inner #cookie-confirmation-buttons-area a#confirmation-button:after,
|
||||
body div#cookie-confirmation div#cookie-confirmation-inner #cookie-confirmation-buttons-area a#confirmation-button:before,
|
||||
body div#cookie-confirmation.can-use-gradients div#cookie-confirmation-inner #cookie-confirmation-buttons-area a#confirmation-button:after,
|
||||
body div#cookie-confirmation.can-use-gradients div#cookie-confirmation-inner #cookie-confirmation-buttons-area a#confirmation-button:before {
|
||||
content:'';
|
||||
width:20px;
|
||||
height:20px;
|
||||
background:#222840;
|
||||
position:absolute;
|
||||
}
|
||||
|
||||
body div#cookie-confirmation div#cookie-confirmation-inner #cookie-confirmation-buttons-area a#confirmation-button:before,
|
||||
body div#cookie-confirmation.can-use-gradients div#cookie-confirmation-inner #cookie-confirmation-buttons-area a#confirmation-button:before {
|
||||
-ms-transform:rotate(45deg);
|
||||
transform:rotate(45deg);
|
||||
top:-12px;
|
||||
left:-13px;
|
||||
}
|
||||
body div#cookie-confirmation div#cookie-confirmation-inner #cookie-confirmation-buttons-area a#confirmation-button:after,
|
||||
body div#cookie-confirmation.can-use-gradients div#cookie-confirmation-inner #cookie-confirmation-buttons-area a#confirmation-button:after {
|
||||
-ms-transform:rotate(-135deg);
|
||||
transform:rotate(-135deg);
|
||||
top:auto;
|
||||
right:-13px;
|
||||
bottom:-12px;
|
||||
}
|
||||
|
||||
/*! CSS Used from: Embedded */
|
||||
div#cookie-confirmation{
|
||||
position:absolute;
|
||||
left:0;
|
||||
top:0;
|
||||
width:100%;
|
||||
height:auto;
|
||||
background-color:#2d2d2d;
|
||||
border-bottom:1px solid gray;
|
||||
border-bottom:1px solid rgba(0,0,0,0.5);
|
||||
-webkit-box-shadow:0 1px 2px rgba(0,0,0,0.2);
|
||||
-moz-box-shadow:0 1px 2px rgba(0,0,0,0.2);
|
||||
box-shadow:0 1px 2px rgba(0,0,0,0.2);
|
||||
font-size:14px !important;
|
||||
line-height:18px !important;
|
||||
font-family:helvetica neue,helvetica,arial,sans !important;
|
||||
color:#fff !important;
|
||||
text-shadow:0 1px 0 rgba(0,0,0,0.7) !important;
|
||||
text-align:left !important;
|
||||
z-index:100000000 !important;
|
||||
}
|
||||
div#cookie-confirmation.can-use-gradients{
|
||||
background-color:rgba(0,0,0,0);
|
||||
background-image:-webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, rgba(0,0,0,0.9)), color-stop(100%, rgba(0,0,0,0.75)));
|
||||
background-image:-webkit-linear-gradient(top, rgba(0,0,0,0.9),rgba(0,0,0,0.75));
|
||||
background-image:-moz-linear-gradient(top, rgba(0,0,0,0.9),rgba(0,0,0,0.75));
|
||||
background-image:-o-linear-gradient(top, rgba(0,0,0,0.9),rgba(0,0,0,0.75));
|
||||
background-image:linear-gradient(top, rgba(0,0,0,0.9),rgba(0,0,0,0.75));
|
||||
background-image:linear-gradient(to bottom, rgba(0,0,0,0.9),rgba(0,0,0,0.75));
|
||||
}
|
||||
div#cookie-confirmation div#cookie-confirmation-inner{
|
||||
padding:12px 18px 18px;
|
||||
}
|
||||
div#cookie-confirmation div#cookie-confirmation-inner a{
|
||||
font-family:helvetica neue,helvetica,arial,sans !important;
|
||||
color:#add8e6 !important;
|
||||
font-size:14px !important;
|
||||
text-decoration:none !important;
|
||||
background:none !important;
|
||||
border:none !important;
|
||||
font-weight:normal !important;
|
||||
}
|
||||
div#cookie-confirmation div#cookie-confirmation-inner a:hover{
|
||||
text-decoration:underline !important;
|
||||
background:none !important;
|
||||
border:none !important;
|
||||
}
|
||||
div#cookie-confirmation div#cookie-confirmation-inner div#cookie-confirmation-buttons-area{
|
||||
text-align:center !important;
|
||||
}
|
||||
div#cookie-confirmation div#cookie-confirmation-inner a#confirmation-button{
|
||||
font-family:helvetica neue,helvetica,arial,sans!important;
|
||||
font-size:14px !important;
|
||||
font-weight:normal !important;
|
||||
margin-right:16px !important;
|
||||
padding:4px 12px !important;
|
||||
background-color:green !important;
|
||||
border:1px solid gray !important;
|
||||
border:1px solid rgba(0,0,0,0.5) !important;
|
||||
background-image:-webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, transparent), color-stop(100%, rgba(0,0,0,0.2)));
|
||||
background-image:-webkit-linear-gradient(top, transparent,rgba(0,0,0,0.2));
|
||||
background-image:-moz-linear-gradient(top, transparent,rgba(0,0,0,0.2));
|
||||
background-image:-o-linear-gradient(top, transparent,rgba(0,0,0,0.2));
|
||||
background-image:linear-gradient(top, transparent,rgba(0,0,0,0.2));
|
||||
-webkit-border-radius:4px;
|
||||
-moz-border-radius:4px;
|
||||
-ms-border-radius:4px;
|
||||
-o-border-radius:4px;
|
||||
border-radius:4px;
|
||||
-webkit-box-shadow:0 1px 2px rgba(0,0,0,0.2),inset 0 1px 0 rgba(255,255,255,0.5);
|
||||
-moz-box-shadow:0 1px 2px rgba(0,0,0,0.2),inset 0 1px 0 rgba(255,255,255,0.5);
|
||||
box-shadow:0 1px 2px rgba(0,0,0,0.2),inset 0 1px 0 rgba(255,255,255,0.5);
|
||||
line-height:14px !important;
|
||||
color:#fff !important;
|
||||
text-shadow:0 1px 0 rgba(0,0,0,0.5) !important;
|
||||
text-decoration:none !important;
|
||||
}
|
||||
div#cookie-confirmation div#cookie-confirmation-inner a#confirmation-button:hover{
|
||||
background-image:-webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, transparent), color-stop(100%, rgba(0,0,0,0.3)));
|
||||
background-image:-webkit-linear-gradient(top, transparent,rgba(0,0,0,0.3));
|
||||
background-image:-moz-linear-gradient(top, transparent,rgba(0,0,0,0.3));
|
||||
background-image:-o-linear-gradient(top, transparent,rgba(0,0,0,0.3));
|
||||
background-image:linear-gradient(top, transparent,rgba(0,0,0,0.3));
|
||||
}
|
||||
div#cookie-confirmation div#cookie-confirmation-inner a#confirmation-button:active{
|
||||
background-image:-webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, rgba(0,0,0,0.3)), color-stop(100%, rgba(0,0,0,0.3)));
|
||||
background-image:-webkit-linear-gradient(top, rgba(0,0,0,0.3),rgba(0,0,0,0.3));
|
||||
background-image:-moz-linear-gradient(top, rgba(0,0,0,0.3),rgba(0,0,0,0.3));
|
||||
background-image:-o-linear-gradient(top, rgba(0,0,0,0.3),rgba(0,0,0,0.3));
|
||||
background-image:linear-gradient(top, rgba(0,0,0,0.3),rgba(0,0,0,0.3));
|
||||
-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,0.2);
|
||||
-moz-box-shadow:inset 0 1px 2px rgba(0,0,0,0.2);
|
||||
box-shadow:inset 0 1px 2px rgba(0,0,0,0.2);
|
||||
}
|
||||
div#cookie-confirmation div#cookie-confirmation-inner p{
|
||||
line-height:18px !important;
|
||||
font-family:helvetica neue,helvetica,arial,sans !important;
|
||||
font-weight:normal !important;
|
||||
font-size:14px !important;
|
||||
margin:0 0 16px !important;
|
||||
padding:0 !important;
|
||||
color:#fff !important;
|
||||
text-align:left !important;
|
||||
}
|
||||
@media screen and (max-width: 480px) {
|
||||
div#cookie-confirmation {
|
||||
font-size:12px !important;
|
||||
}
|
||||
div#cookie-confirmation div#cookie-confirmation-inner {
|
||||
padding:8px 14px 14px !important;
|
||||
}
|
||||
div#cookie-confirmation div#cookie-confirmation-inner a {
|
||||
font-size:12px !important;
|
||||
}
|
||||
div#cookie-confirmation div#cookie-confirmation-inner a#confirmation-button {
|
||||
font-size:12px !important;
|
||||
}
|
||||
div#cookie-confirmation div#cookie-confirmation-inner p {
|
||||
font-size:12px !important;
|
||||
margin-bottom:12px !important;
|
||||
line-height:15px !important;
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -80,9 +80,6 @@ machine.start();
|
||||
\sa QState, {The Animation Framework}
|
||||
*/
|
||||
|
||||
|
||||
#ifndef QT_NO_ANIMATION
|
||||
|
||||
/*!
|
||||
Constructs a new state with the given \a parent state.
|
||||
*/
|
||||
@ -155,5 +152,3 @@ bool QAnimationState::event(QEvent *e)
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif
|
||||
|
@ -61,9 +61,6 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
|
||||
#ifndef QT_NO_ANIMATION
|
||||
|
||||
class QAbstractAnimation;
|
||||
|
||||
class QAnimationState : public QState
|
||||
@ -89,8 +86,6 @@ private:
|
||||
QAbstractAnimation *m_animation;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QANIMATIONSTATE_H
|
||||
|
@ -1,10 +1,6 @@
|
||||
SOURCES += main.cpp xform.cpp
|
||||
HEADERS += xform.h
|
||||
|
||||
qtHaveModule(opengl) {
|
||||
DEFINES += QT_OPENGL_SUPPORT
|
||||
QT += opengl
|
||||
}
|
||||
QT += widgets
|
||||
|
||||
SHARED_FOLDER = ../shared
|
||||
|
@ -830,13 +830,11 @@ XFormWidget::XFormWidget(QWidget *parent)
|
||||
|
||||
QPushButton *showSourceButton = new QPushButton(mainGroup);
|
||||
showSourceButton->setText(tr("Show Source"));
|
||||
#ifdef QT_OPENGL_SUPPORT
|
||||
#if QT_CONFIG(opengl)
|
||||
QPushButton *enableOpenGLButton = new QPushButton(mainGroup);
|
||||
enableOpenGLButton->setText(tr("Use OpenGL"));
|
||||
enableOpenGLButton->setCheckable(true);
|
||||
enableOpenGLButton->setChecked(view->usesOpenGL());
|
||||
if (!QGLFormat::hasOpenGL())
|
||||
enableOpenGLButton->hide();
|
||||
#endif
|
||||
QPushButton *whatsThisButton = new QPushButton(mainGroup);
|
||||
whatsThisButton->setText(tr("What's This?"));
|
||||
@ -871,7 +869,7 @@ XFormWidget::XFormWidget(QWidget *parent)
|
||||
mainGroupLayout->addWidget(resetButton);
|
||||
mainGroupLayout->addWidget(animateButton);
|
||||
mainGroupLayout->addWidget(showSourceButton);
|
||||
#ifdef QT_OPENGL_SUPPORT
|
||||
#if QT_CONFIG(opengl)
|
||||
mainGroupLayout->addWidget(enableOpenGLButton);
|
||||
#endif
|
||||
mainGroupLayout->addWidget(whatsThisButton);
|
||||
@ -897,7 +895,7 @@ XFormWidget::XFormWidget(QWidget *parent)
|
||||
connect(view, &XFormView::descriptionEnabledChanged, view->hoverPoints(), &HoverPoints::setDisabled);
|
||||
connect(view, &XFormView::descriptionEnabledChanged, whatsThisButton, &QPushButton::setChecked);
|
||||
connect(showSourceButton, &QPushButton::clicked, view, &XFormView::showSource);
|
||||
#ifdef QT_OPENGL_SUPPORT
|
||||
#if QT_CONFIG(opengl)
|
||||
connect(enableOpenGLButton, &QPushButton::clicked, view, &XFormView::enableOpenGL);
|
||||
#endif
|
||||
view->loadSourceFile(":res/affine/xform.cpp");
|
||||
|
@ -57,6 +57,11 @@
|
||||
#include <QMouseEvent>
|
||||
#include <qmath.h>
|
||||
|
||||
#if QT_CONFIG(opengl)
|
||||
#include <QOpenGLFunctions>
|
||||
#include <QOpenGLWindow>
|
||||
#endif
|
||||
|
||||
const int animationInterval = 15; // update every 16 ms = ~60FPS
|
||||
|
||||
CompositionWidget::CompositionWidget(QWidget *parent)
|
||||
@ -136,14 +141,11 @@ CompositionWidget::CompositionWidget(QWidget *parent)
|
||||
|
||||
QPushButton *showSourceButton = new QPushButton(mainGroup);
|
||||
showSourceButton->setText(tr("Show Source"));
|
||||
#if defined(USE_OPENGL) && !defined(QT_OPENGL_ES)
|
||||
#if QT_CONFIG(opengl)
|
||||
QPushButton *enableOpenGLButton = new QPushButton(mainGroup);
|
||||
enableOpenGLButton->setText(tr("Use OpenGL"));
|
||||
enableOpenGLButton->setCheckable(true);
|
||||
enableOpenGLButton->setChecked(view->usesOpenGL());
|
||||
|
||||
if (!QGLFormat::hasOpenGL() || !QGLPixelBuffer::hasOpenGLPbuffers())
|
||||
enableOpenGLButton->hide();
|
||||
#endif
|
||||
QPushButton *whatsThisButton = new QPushButton(mainGroup);
|
||||
whatsThisButton->setText(tr("What's This?"));
|
||||
@ -166,7 +168,7 @@ CompositionWidget::CompositionWidget(QWidget *parent)
|
||||
mainGroupLayout->addWidget(animateButton);
|
||||
mainGroupLayout->addWidget(whatsThisButton);
|
||||
mainGroupLayout->addWidget(showSourceButton);
|
||||
#if defined(USE_OPENGL) && !defined(QT_OPENGL_ES)
|
||||
#if QT_CONFIG(opengl)
|
||||
mainGroupLayout->addWidget(enableOpenGLButton);
|
||||
#endif
|
||||
|
||||
@ -210,7 +212,7 @@ CompositionWidget::CompositionWidget(QWidget *parent)
|
||||
connect(whatsThisButton, SIGNAL(clicked(bool)), view, SLOT(setDescriptionEnabled(bool)));
|
||||
connect(view, SIGNAL(descriptionEnabledChanged(bool)), whatsThisButton, SLOT(setChecked(bool)));
|
||||
connect(showSourceButton, SIGNAL(clicked()), view, SLOT(showSource()));
|
||||
#if defined(USE_OPENGL) && !defined(QT_OPENGL_ES)
|
||||
#if QT_CONFIG(opengl)
|
||||
connect(enableOpenGLButton, SIGNAL(clicked(bool)), view, SLOT(enableOpenGL(bool)));
|
||||
#endif
|
||||
connect(animateButton, SIGNAL(toggled(bool)), view, SLOT(setAnimationEnabled(bool)));
|
||||
@ -258,8 +260,7 @@ CompositionRenderer::CompositionRenderer(QWidget *parent)
|
||||
m_circle_pos = QPoint(200, 100);
|
||||
|
||||
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
#ifdef USE_OPENGL
|
||||
m_pbuffer = 0;
|
||||
#if QT_CONFIG(opengl)
|
||||
m_pbuffer_size = 1024;
|
||||
#endif
|
||||
}
|
||||
@ -350,8 +351,11 @@ void CompositionRenderer::drawSource(QPainter &p)
|
||||
|
||||
void CompositionRenderer::paint(QPainter *painter)
|
||||
{
|
||||
#if defined(USE_OPENGL) && !defined(QT_OPENGL_ES)
|
||||
if (usesOpenGL()) {
|
||||
#if QT_CONFIG(opengl)
|
||||
if (usesOpenGL() && glWindow()->isValid()) {
|
||||
|
||||
if (!m_blitter.isCreated())
|
||||
m_blitter.create();
|
||||
|
||||
int new_pbuf_size = m_pbuffer_size;
|
||||
if (size().width() > m_pbuffer_size || size().height() > m_pbuffer_size)
|
||||
@ -360,95 +364,46 @@ void CompositionRenderer::paint(QPainter *painter)
|
||||
if (size().width() < m_pbuffer_size/2 && size().height() < m_pbuffer_size/2)
|
||||
new_pbuf_size /= 2;
|
||||
|
||||
if (!m_pbuffer || new_pbuf_size != m_pbuffer_size) {
|
||||
if (m_pbuffer) {
|
||||
m_pbuffer->deleteTexture(m_base_tex);
|
||||
m_pbuffer->deleteTexture(m_compositing_tex);
|
||||
delete m_pbuffer;
|
||||
}
|
||||
|
||||
m_pbuffer = new QGLPixelBuffer(QSize(new_pbuf_size, new_pbuf_size), QGLFormat::defaultFormat(), glWidget());
|
||||
m_pbuffer->makeCurrent();
|
||||
m_base_tex = m_pbuffer->generateDynamicTexture();
|
||||
m_compositing_tex = m_pbuffer->generateDynamicTexture();
|
||||
if (!m_fbo || new_pbuf_size != m_pbuffer_size) {
|
||||
m_fbo.reset(new QFboPaintDevice(QSize(new_pbuf_size, new_pbuf_size), false, false));
|
||||
m_pbuffer_size = new_pbuf_size;
|
||||
}
|
||||
|
||||
if (size() != m_previous_size) {
|
||||
m_previous_size = size();
|
||||
QPainter p(m_pbuffer);
|
||||
p.setCompositionMode(QPainter::CompositionMode_Source);
|
||||
p.fillRect(QRect(0, 0, m_pbuffer->width(), m_pbuffer->height()), Qt::transparent);
|
||||
QPainter p(m_fbo.data());
|
||||
drawBase(p);
|
||||
p.end();
|
||||
m_pbuffer->updateDynamicTexture(m_base_tex);
|
||||
m_base_tex = m_fbo->takeTexture();
|
||||
}
|
||||
|
||||
qreal x_fraction = width()/float(m_pbuffer->width());
|
||||
qreal y_fraction = height()/float(m_pbuffer->height());
|
||||
|
||||
painter->beginNativePainting();
|
||||
{
|
||||
QPainter p(m_pbuffer);
|
||||
p.setCompositionMode(QPainter::CompositionMode_Source);
|
||||
p.fillRect(QRect(0, 0, m_pbuffer->width(), m_pbuffer->height()), Qt::transparent);
|
||||
|
||||
p.save(); // Needed when using the GL1 engine
|
||||
p.beginNativePainting(); // Needed when using the GL2 engine
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, m_base_tex);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glColor4f(1.,1.,1.,1.);
|
||||
|
||||
glBegin(GL_QUADS);
|
||||
{
|
||||
glTexCoord2f(0, 1.0);
|
||||
glVertex2f(0, 0);
|
||||
|
||||
glTexCoord2f(x_fraction, 1.0);
|
||||
glVertex2f(width(), 0);
|
||||
|
||||
glTexCoord2f(x_fraction, 1.0-y_fraction);
|
||||
glVertex2f(width(), height());
|
||||
|
||||
glTexCoord2f(0, 1.0-y_fraction);
|
||||
glVertex2f(0, height());
|
||||
}
|
||||
glEnd();
|
||||
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
|
||||
p.endNativePainting(); // Needed when using the GL2 engine
|
||||
p.restore(); // Needed when using the GL1 engine
|
||||
|
||||
QPainter p(m_fbo.data());
|
||||
p.beginNativePainting();
|
||||
m_blitter.bind();
|
||||
const QRect targetRect(QPoint(0, 0), m_fbo->size());
|
||||
const QMatrix4x4 target = QOpenGLTextureBlitter::targetTransform(targetRect, QRect(QPoint(0, 0), m_fbo->size()));
|
||||
m_blitter.blit(m_base_tex, target, QOpenGLTextureBlitter::OriginBottomLeft);
|
||||
m_blitter.release();
|
||||
p.endNativePainting();
|
||||
drawSource(p);
|
||||
p.end();
|
||||
m_pbuffer->updateDynamicTexture(m_compositing_tex);
|
||||
m_compositing_tex = m_fbo->takeTexture();
|
||||
}
|
||||
painter->endNativePainting();
|
||||
|
||||
painter->beginNativePainting(); // Needed when using the GL2 engine
|
||||
glWidget()->makeCurrent(); // Needed when using the GL1 engine
|
||||
glBindTexture(GL_TEXTURE_2D, m_compositing_tex);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glColor4f(1.,1.,1.,1.);
|
||||
glBegin(GL_QUADS);
|
||||
{
|
||||
glTexCoord2f(0, 1.0);
|
||||
glVertex2f(0, 0);
|
||||
|
||||
glTexCoord2f(x_fraction, 1.0);
|
||||
glVertex2f(width(), 0);
|
||||
|
||||
glTexCoord2f(x_fraction, 1.0-y_fraction);
|
||||
glVertex2f(width(), height());
|
||||
|
||||
glTexCoord2f(0, 1.0-y_fraction);
|
||||
glVertex2f(0, height());
|
||||
}
|
||||
glEnd();
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
painter->endNativePainting(); // Needed when using the GL2 engine
|
||||
painter->beginNativePainting();
|
||||
auto *funcs = QOpenGLContext::currentContext()->functions();
|
||||
funcs->glEnable(GL_BLEND);
|
||||
funcs->glBlendEquation(GL_FUNC_ADD);
|
||||
funcs->glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
|
||||
m_blitter.bind();
|
||||
const QRect targetRect(QPoint(0, 0), m_fbo->size());
|
||||
const QMatrix4x4 target = QOpenGLTextureBlitter::targetTransform(targetRect, QRect(QPoint(0, 0), size()));
|
||||
m_blitter.blit(m_compositing_tex, target, QOpenGLTextureBlitter::OriginBottomLeft);
|
||||
m_blitter.release();
|
||||
painter->endNativePainting();
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
@ -520,7 +475,7 @@ void CompositionRenderer::setCirclePos(const QPointF &pos)
|
||||
const QRect oldRect = rectangle_around(m_circle_pos).toAlignedRect();
|
||||
m_circle_pos = pos;
|
||||
const QRect newRect = rectangle_around(m_circle_pos).toAlignedRect();
|
||||
#if defined(USE_OPENGL) && !defined(QT_OPENGL_ES)
|
||||
#if QT_CONFIG(opengl)
|
||||
if (usesOpenGL()) {
|
||||
update();
|
||||
return;
|
||||
|
@ -53,6 +53,11 @@
|
||||
|
||||
#include "arthurwidgets.h"
|
||||
|
||||
#if QT_CONFIG(opengl)
|
||||
#include "fbopaintdevice.h"
|
||||
#include <QOpenGLTextureBlitter>
|
||||
#endif
|
||||
|
||||
#include <QPainter>
|
||||
#include <QEvent>
|
||||
|
||||
@ -61,10 +66,6 @@ class QPushButton;
|
||||
class QRadioButton;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#ifdef QT_OPENGL_SUPPORT
|
||||
#include <QtOpenGL>
|
||||
#endif
|
||||
|
||||
class CompositionWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -186,12 +187,13 @@ private:
|
||||
bool m_animation_enabled;
|
||||
int m_animationTimer;
|
||||
|
||||
#ifdef QT_OPENGL_SUPPORT
|
||||
QGLPixelBuffer *m_pbuffer;
|
||||
GLuint m_base_tex;
|
||||
GLuint m_compositing_tex;
|
||||
#if QT_CONFIG(opengl)
|
||||
QScopedPointer<QFboPaintDevice> m_fbo;
|
||||
int m_pbuffer_size; // width==height==size of pbuffer
|
||||
uint m_base_tex;
|
||||
uint m_compositing_tex;
|
||||
QSize m_previous_size;
|
||||
QOpenGLTextureBlitter m_blitter;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@ -6,10 +6,6 @@ SHARED_FOLDER = ../shared
|
||||
include($$SHARED_FOLDER/shared.pri)
|
||||
|
||||
RESOURCES += composition.qrc
|
||||
qtHaveModule(opengl):!qtConfig(dynamicgl) {
|
||||
DEFINES += USE_OPENGL
|
||||
QT += opengl
|
||||
}
|
||||
QT += widgets
|
||||
|
||||
# install
|
||||
|
@ -51,17 +51,12 @@
|
||||
#include "composition.h"
|
||||
|
||||
#include <QApplication>
|
||||
#ifdef QT_OPENGL_SUPPORT
|
||||
#include <QtOpenGL>
|
||||
#endif
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
// Q_INIT_RESOURCE(deform);
|
||||
|
||||
QApplication app(argc, argv);
|
||||
|
||||
CompositionWidget compWidget(0);
|
||||
CompositionWidget compWidget(nullptr);
|
||||
QStyle *arthurStyle = new ArthurStyle();
|
||||
compWidget.setStyle(arthurStyle);
|
||||
|
||||
|
@ -7,10 +7,6 @@ include($$SHARED_FOLDER/shared.pri)
|
||||
|
||||
RESOURCES += deform.qrc
|
||||
|
||||
qtHaveModule(opengl) {
|
||||
DEFINES += QT_OPENGL_SUPPORT
|
||||
QT += opengl
|
||||
}
|
||||
QT += widgets
|
||||
|
||||
# install
|
||||
|
@ -109,13 +109,11 @@ void PathDeformControls::layoutForDesktop()
|
||||
QPushButton *showSourceButton = new QPushButton(mainGroup);
|
||||
showSourceButton->setText(tr("Show Source"));
|
||||
|
||||
#ifdef QT_OPENGL_SUPPORT
|
||||
#if QT_CONFIG(opengl)
|
||||
QPushButton *enableOpenGLButton = new QPushButton(mainGroup);
|
||||
enableOpenGLButton->setText(tr("Use OpenGL"));
|
||||
enableOpenGLButton->setCheckable(true);
|
||||
enableOpenGLButton->setChecked(m_renderer->usesOpenGL());
|
||||
if (!QGLFormat::hasOpenGL())
|
||||
enableOpenGLButton->hide();
|
||||
#endif
|
||||
|
||||
QPushButton *whatsThisButton = new QPushButton(mainGroup);
|
||||
@ -132,7 +130,7 @@ void PathDeformControls::layoutForDesktop()
|
||||
mainGroupLayout->addWidget(textGroup);
|
||||
mainGroupLayout->addWidget(animateButton);
|
||||
mainGroupLayout->addStretch(1);
|
||||
#ifdef QT_OPENGL_SUPPORT
|
||||
#if QT_CONFIG(opengl)
|
||||
mainGroupLayout->addWidget(enableOpenGLButton);
|
||||
#endif
|
||||
mainGroupLayout->addWidget(showSourceButton);
|
||||
@ -158,7 +156,7 @@ void PathDeformControls::layoutForDesktop()
|
||||
connect(deformSlider, SIGNAL(valueChanged(int)), m_renderer, SLOT(setIntensity(int)));
|
||||
connect(fontSizeSlider, SIGNAL(valueChanged(int)), m_renderer, SLOT(setFontSize(int)));
|
||||
connect(animateButton, SIGNAL(clicked(bool)), m_renderer, SLOT(setAnimated(bool)));
|
||||
#ifdef QT_OPENGL_SUPPORT
|
||||
#if QT_CONFIG(opengl)
|
||||
connect(enableOpenGLButton, SIGNAL(clicked(bool)), m_renderer, SLOT(enableOpenGL(bool)));
|
||||
#endif
|
||||
|
||||
@ -201,13 +199,11 @@ void PathDeformControls::layoutForSmallScreen()
|
||||
QPushButton *animateButton = new QPushButton(tr("Animated"), mainGroup);
|
||||
animateButton->setCheckable(true);
|
||||
|
||||
#ifdef QT_OPENGL_SUPPORT
|
||||
#if QT_CONFIG(opengl)
|
||||
QPushButton *enableOpenGLButton = new QPushButton(mainGroup);
|
||||
enableOpenGLButton->setText(tr("Use OpenGL"));
|
||||
enableOpenGLButton->setCheckable(mainGroup);
|
||||
enableOpenGLButton->setChecked(m_renderer->usesOpenGL());
|
||||
if (!QGLFormat::hasOpenGL())
|
||||
enableOpenGLButton->hide();
|
||||
#endif
|
||||
|
||||
QPushButton *quitButton = new QPushButton(tr("Quit"), mainGroup);
|
||||
@ -223,7 +219,7 @@ void PathDeformControls::layoutForSmallScreen()
|
||||
mainGroupLayout->addWidget(fontSizeLabel, 2, 0, Qt::AlignRight);
|
||||
mainGroupLayout->addWidget(fontSizeSlider, 2, 1);
|
||||
mainGroupLayout->addWidget(animateButton, 3,0, 1,2);
|
||||
#ifdef QT_OPENGL_SUPPORT
|
||||
#if QT_CONFIG(opengl)
|
||||
mainGroupLayout->addWidget(enableOpenGLButton, 4,0, 1,2);
|
||||
#endif
|
||||
|
||||
@ -239,7 +235,7 @@ void PathDeformControls::layoutForSmallScreen()
|
||||
connect(deformSlider, SIGNAL(valueChanged(int)), m_renderer, SLOT(setIntensity(int)));
|
||||
connect(fontSizeSlider, SIGNAL(valueChanged(int)), m_renderer, SLOT(setFontSize(int)));
|
||||
connect(animateButton, SIGNAL(clicked(bool)), m_renderer, SLOT(setAnimated(bool)));
|
||||
#ifdef QT_OPENGL_SUPPORT
|
||||
#if QT_CONFIG(opengl)
|
||||
connect(enableOpenGLButton, SIGNAL(clicked(bool)), m_renderer, SLOT(enableOpenGL(bool)));
|
||||
#endif
|
||||
|
||||
@ -463,7 +459,7 @@ void PathDeformRenderer::timerEvent(QTimerEvent *e)
|
||||
m_pos.setY(height() - m_radius);
|
||||
}
|
||||
|
||||
#ifdef QT_OPENGL_SUPPORT
|
||||
#if QT_CONFIG(opengl)
|
||||
if (usesOpenGL()) {
|
||||
update();
|
||||
} else
|
||||
@ -527,7 +523,7 @@ void PathDeformRenderer::mouseMoveEvent(QMouseEvent *e)
|
||||
m_direction = (m_direction + dir) / 2;
|
||||
}
|
||||
m_pos = e->pos() + m_offset;
|
||||
#ifdef QT_OPENGL_SUPPORT
|
||||
#if QT_CONFIG(opengl)
|
||||
if (usesOpenGL()) {
|
||||
update();
|
||||
} else
|
||||
@ -620,7 +616,7 @@ void PathDeformRenderer::setRadius(int radius)
|
||||
m_radius = radius;
|
||||
generateLensPixmap();
|
||||
if (!m_animated || m_radius < max) {
|
||||
#ifdef QT_OPENGL_SUPPORT
|
||||
#if QT_CONFIG(opengl)
|
||||
if (usesOpenGL()){
|
||||
update();
|
||||
return;
|
||||
@ -634,7 +630,7 @@ void PathDeformRenderer::setIntensity(int intensity)
|
||||
{
|
||||
m_intensity = intensity;
|
||||
if (!m_animated) {
|
||||
#ifdef QT_OPENGL_SUPPORT
|
||||
#if QT_CONFIG(opengl)
|
||||
if (usesOpenGL()) {
|
||||
update();
|
||||
return;
|
||||
|
@ -317,13 +317,11 @@ GradientWidget::GradientWidget(QWidget *parent)
|
||||
|
||||
QPushButton *showSourceButton = new QPushButton(mainGroup);
|
||||
showSourceButton->setText(tr("Show Source"));
|
||||
#ifdef QT_OPENGL_SUPPORT
|
||||
#if QT_CONFIG(opengl)
|
||||
QPushButton *enableOpenGLButton = new QPushButton(mainGroup);
|
||||
enableOpenGLButton->setText(tr("Use OpenGL"));
|
||||
enableOpenGLButton->setCheckable(true);
|
||||
enableOpenGLButton->setChecked(m_renderer->usesOpenGL());
|
||||
if (!QGLFormat::hasOpenGL())
|
||||
enableOpenGLButton->hide();
|
||||
#endif
|
||||
QPushButton *whatsThisButton = new QPushButton(mainGroup);
|
||||
whatsThisButton->setText(tr("What's This?"));
|
||||
@ -343,7 +341,7 @@ GradientWidget::GradientWidget(QWidget *parent)
|
||||
mainGroupLayout->addWidget(defaultsGroup);
|
||||
mainGroupLayout->addStretch(1);
|
||||
mainGroupLayout->addWidget(showSourceButton);
|
||||
#ifdef QT_OPENGL_SUPPORT
|
||||
#if QT_CONFIG(opengl)
|
||||
mainGroupLayout->addWidget(enableOpenGLButton);
|
||||
#endif
|
||||
mainGroupLayout->addWidget(whatsThisButton);
|
||||
@ -406,7 +404,7 @@ GradientWidget::GradientWidget(QWidget *parent)
|
||||
|
||||
connect(showSourceButton, &QPushButton::clicked,
|
||||
m_renderer, &GradientRenderer::showSource);
|
||||
#ifdef QT_OPENGL_SUPPORT
|
||||
#if QT_CONFIG(opengl)
|
||||
connect(enableOpenGLButton, QOverload<bool>::of(&QPushButton::clicked),
|
||||
m_renderer, &ArthurFrame::enableOpenGL);
|
||||
#endif
|
||||
|
@ -6,10 +6,6 @@ SHARED_FOLDER = ../shared
|
||||
include($$SHARED_FOLDER/shared.pri)
|
||||
|
||||
RESOURCES += gradients.qrc
|
||||
qtHaveModule(opengl) {
|
||||
DEFINES += QT_OPENGL_SUPPORT
|
||||
QT += opengl
|
||||
}
|
||||
QT += widgets
|
||||
|
||||
# install
|
||||
|
@ -211,13 +211,11 @@ void PathStrokeControls::layoutForDesktop()
|
||||
|
||||
QPushButton *showSourceButton = new QPushButton(mainGroup);
|
||||
showSourceButton->setText(tr("Show Source"));
|
||||
#ifdef QT_OPENGL_SUPPORT
|
||||
#if QT_CONFIG(opengl)
|
||||
QPushButton *enableOpenGLButton = new QPushButton(mainGroup);
|
||||
enableOpenGLButton->setText(tr("Use OpenGL"));
|
||||
enableOpenGLButton->setCheckable(true);
|
||||
enableOpenGLButton->setChecked(m_renderer->usesOpenGL());
|
||||
if (!QGLFormat::hasOpenGL())
|
||||
enableOpenGLButton->hide();
|
||||
#endif
|
||||
QPushButton *whatsThisButton = new QPushButton(mainGroup);
|
||||
whatsThisButton->setText(tr("What's This?"));
|
||||
@ -242,7 +240,7 @@ void PathStrokeControls::layoutForDesktop()
|
||||
mainGroupLayout->addWidget(animated);
|
||||
mainGroupLayout->addStretch(1);
|
||||
mainGroupLayout->addWidget(showSourceButton);
|
||||
#ifdef QT_OPENGL_SUPPORT
|
||||
#if QT_CONFIG(opengl)
|
||||
mainGroupLayout->addWidget(enableOpenGLButton);
|
||||
#endif
|
||||
mainGroupLayout->addWidget(whatsThisButton);
|
||||
@ -254,7 +252,7 @@ void PathStrokeControls::layoutForDesktop()
|
||||
connect(penWidth, SIGNAL(valueChanged(int)), m_renderer, SLOT(setPenWidth(int)));
|
||||
|
||||
connect(showSourceButton, SIGNAL(clicked()), m_renderer, SLOT(showSource()));
|
||||
#ifdef QT_OPENGL_SUPPORT
|
||||
#if QT_CONFIG(opengl)
|
||||
connect(enableOpenGLButton, SIGNAL(clicked(bool)), m_renderer, SLOT(enableOpenGL(bool)));
|
||||
#endif
|
||||
connect(whatsThisButton, SIGNAL(clicked(bool)), m_renderer, SLOT(setDescriptionEnabled(bool)));
|
||||
@ -290,13 +288,11 @@ void PathStrokeControls::layoutForSmallScreens()
|
||||
penWidth->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
|
||||
penWidth->setRange(0, 500);
|
||||
|
||||
#ifdef QT_OPENGL_SUPPORT
|
||||
#if QT_CONFIG(opengl)
|
||||
QPushButton *enableOpenGLButton = new QPushButton(this);
|
||||
enableOpenGLButton->setText(tr("Use OpenGL"));
|
||||
enableOpenGLButton->setCheckable(true);
|
||||
enableOpenGLButton->setChecked(m_renderer->usesOpenGL());
|
||||
if (!QGLFormat::hasOpenGL())
|
||||
enableOpenGLButton->hide();
|
||||
#endif
|
||||
|
||||
// Layouts:
|
||||
@ -307,7 +303,7 @@ void PathStrokeControls::layoutForSmallScreens()
|
||||
QVBoxLayout *leftLayout = new QVBoxLayout(0);
|
||||
leftLayout->addWidget(m_capGroup);
|
||||
leftLayout->addWidget(m_joinGroup);
|
||||
#ifdef QT_OPENGL_SUPPORT
|
||||
#if QT_CONFIG(opengl)
|
||||
leftLayout->addWidget(enableOpenGLButton);
|
||||
#endif
|
||||
leftLayout->addLayout(penWidthLayout);
|
||||
@ -330,7 +326,7 @@ void PathStrokeControls::layoutForSmallScreens()
|
||||
mainLayout->addWidget(quitBtn, 2, 1, Qt::AlignHCenter | Qt::AlignTop);
|
||||
mainLayout->addWidget(okBtn, 2, 2, Qt::AlignHCenter | Qt::AlignTop);
|
||||
|
||||
#ifdef QT_OPENGL_SUPPORT
|
||||
#if QT_CONFIG(opengl)
|
||||
connect(enableOpenGLButton, SIGNAL(clicked(bool)), m_renderer, SLOT(enableOpenGL(bool)));
|
||||
#endif
|
||||
|
||||
|
@ -7,10 +7,6 @@ include($$SHARED_FOLDER/shared.pri)
|
||||
|
||||
RESOURCES += pathstroke.qrc
|
||||
|
||||
qtHaveModule(opengl) {
|
||||
DEFINES += QT_OPENGL_SUPPORT
|
||||
QT += opengl
|
||||
}
|
||||
QT += widgets
|
||||
|
||||
# install
|
||||
|
@ -60,6 +60,10 @@
|
||||
#include <QTextBrowser>
|
||||
#include <QBoxLayout>
|
||||
#include <QRegularExpression>
|
||||
#include <QOffscreenSurface>
|
||||
#include <QOpenGLContext>
|
||||
#include <QOpenGLPaintDevice>
|
||||
#include <QOpenGLWindow>
|
||||
|
||||
extern QPixmap cached(const QString &img);
|
||||
|
||||
@ -67,17 +71,12 @@ ArthurFrame::ArthurFrame(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, m_prefer_image(false)
|
||||
{
|
||||
#ifdef QT_OPENGL_SUPPORT
|
||||
glw = 0;
|
||||
#if QT_CONFIG(opengl)
|
||||
m_glWindow = nullptr;
|
||||
m_glWidget = nullptr;
|
||||
m_use_opengl = false;
|
||||
QGLFormat f = QGLFormat::defaultFormat();
|
||||
f.setSampleBuffers(true);
|
||||
f.setStencil(true);
|
||||
f.setAlpha(true);
|
||||
f.setAlphaBufferSize(8);
|
||||
QGLFormat::setDefaultFormat(f);
|
||||
#endif
|
||||
m_document = 0;
|
||||
m_document = nullptr;
|
||||
m_show_doc = false;
|
||||
|
||||
m_tile = QPixmap(128, 128);
|
||||
@ -94,37 +93,55 @@ ArthurFrame::ArthurFrame(QWidget *parent)
|
||||
}
|
||||
|
||||
|
||||
#ifdef QT_OPENGL_SUPPORT
|
||||
#if QT_CONFIG(opengl)
|
||||
void ArthurFrame::enableOpenGL(bool use_opengl)
|
||||
{
|
||||
if (m_use_opengl == use_opengl)
|
||||
return;
|
||||
|
||||
if (!glw && use_opengl) {
|
||||
glw = new GLWidget(this);
|
||||
glw->setAutoFillBackground(false);
|
||||
glw->disableAutoBufferSwap();
|
||||
m_use_opengl = use_opengl;
|
||||
|
||||
if (!m_glWindow && use_opengl) {
|
||||
createGlWindow();
|
||||
QApplication::postEvent(this, new QResizeEvent(size(), size()));
|
||||
}
|
||||
|
||||
m_use_opengl = use_opengl;
|
||||
if (use_opengl) {
|
||||
glw->show();
|
||||
m_glWidget->show();
|
||||
} else {
|
||||
if (glw)
|
||||
glw->hide();
|
||||
if (m_glWidget)
|
||||
m_glWidget->hide();
|
||||
}
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
void ArthurFrame::createGlWindow()
|
||||
{
|
||||
Q_ASSERT(m_use_opengl);
|
||||
|
||||
m_glWindow = new QOpenGLWindow();
|
||||
QSurfaceFormat f = QSurfaceFormat::defaultFormat();
|
||||
f.setSamples(4);
|
||||
f.setAlphaBufferSize(8);
|
||||
f.setStencilBufferSize(8);
|
||||
m_glWindow->setFormat(f);
|
||||
m_glWindow->setFlags(Qt::WindowTransparentForInput);
|
||||
m_glWindow->resize(width() - 1, height() - 1);
|
||||
m_glWindow->create();
|
||||
m_glWidget = QWidget::createWindowContainer(m_glWindow, this);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void ArthurFrame::paintEvent(QPaintEvent *e)
|
||||
{
|
||||
static QImage *static_image = 0;
|
||||
|
||||
QPainter painter;
|
||||
|
||||
if (preferImage()
|
||||
#ifdef QT_OPENGL_SUPPORT
|
||||
#if QT_CONFIG(opengl)
|
||||
&& !m_use_opengl
|
||||
#endif
|
||||
) {
|
||||
@ -142,10 +159,12 @@ void ArthurFrame::paintEvent(QPaintEvent *e)
|
||||
painter.fillRect(0, height() - o, o, o, bg);
|
||||
painter.fillRect(width() - o, height() - o, o, o, bg);
|
||||
} else {
|
||||
#ifdef QT_OPENGL_SUPPORT
|
||||
if (m_use_opengl) {
|
||||
painter.begin(glw);
|
||||
painter.fillRect(QRectF(0, 0, glw->width(), glw->height()), palette().color(backgroundRole()));
|
||||
#if QT_CONFIG(opengl)
|
||||
if (m_use_opengl && m_glWindow->isValid()) {
|
||||
m_glWindow->makeCurrent();
|
||||
|
||||
painter.begin(m_glWindow);
|
||||
painter.fillRect(QRectF(0, 0, m_glWindow->width(), m_glWindow->height()), palette().color(backgroundRole()));
|
||||
} else {
|
||||
painter.begin(this);
|
||||
}
|
||||
@ -196,7 +215,7 @@ void ArthurFrame::paintEvent(QPaintEvent *e)
|
||||
painter.drawPath(clipPath);
|
||||
|
||||
if (preferImage()
|
||||
#ifdef QT_OPENGL_SUPPORT
|
||||
#if QT_CONFIG(opengl)
|
||||
&& !m_use_opengl
|
||||
#endif
|
||||
) {
|
||||
@ -204,18 +223,17 @@ void ArthurFrame::paintEvent(QPaintEvent *e)
|
||||
painter.begin(this);
|
||||
painter.drawImage(e->rect(), *static_image, e->rect());
|
||||
}
|
||||
|
||||
#ifdef QT_OPENGL_SUPPORT
|
||||
if (m_use_opengl && (inherits("PathDeformRenderer") || inherits("PathStrokeRenderer") || inherits("CompositionRenderer") || m_show_doc))
|
||||
glw->swapBuffers();
|
||||
#if QT_CONFIG(opengl)
|
||||
if (m_use_opengl)
|
||||
m_glWindow->update();
|
||||
#endif
|
||||
}
|
||||
|
||||
void ArthurFrame::resizeEvent(QResizeEvent *e)
|
||||
{
|
||||
#ifdef QT_OPENGL_SUPPORT
|
||||
if (glw)
|
||||
glw->setGeometry(0, 0, e->size().width()-1, e->size().height()-1);
|
||||
#if QT_CONFIG(opengl)
|
||||
if (m_glWidget)
|
||||
m_glWidget->setGeometry(0, 0, e->size().width()-1, e->size().height()-1);
|
||||
#endif
|
||||
QWidget::resizeEvent(e);
|
||||
}
|
||||
|
@ -56,42 +56,13 @@
|
||||
#include <QPushButton>
|
||||
#include <QGroupBox>
|
||||
|
||||
#if defined(QT_OPENGL_SUPPORT)
|
||||
#include <QGLWidget>
|
||||
#include <QEvent>
|
||||
class GLWidget : public QGLWidget
|
||||
{
|
||||
public:
|
||||
GLWidget(QWidget *parent)
|
||||
: QGLWidget(QGLFormat(QGL::SampleBuffers), parent)
|
||||
{
|
||||
setAttribute(Qt::WA_AcceptTouchEvents);
|
||||
}
|
||||
void disableAutoBufferSwap() { setAutoBufferSwap(false); }
|
||||
void paintEvent(QPaintEvent *) override { parentWidget()->update(); }
|
||||
protected:
|
||||
bool event(QEvent *event) override
|
||||
{
|
||||
switch (event->type()) {
|
||||
case QEvent::TouchBegin:
|
||||
case QEvent::TouchUpdate:
|
||||
case QEvent::TouchEnd:
|
||||
event->ignore();
|
||||
return false;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return QGLWidget::event(event);
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
QT_FORWARD_DECLARE_CLASS(QOpenGLWindow)
|
||||
QT_FORWARD_DECLARE_CLASS(QTextDocument)
|
||||
QT_FORWARD_DECLARE_CLASS(QTextEdit)
|
||||
QT_FORWARD_DECLARE_CLASS(QVBoxLayout)
|
||||
|
||||
class ArthurFrame : public QWidget
|
||||
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
@ -107,9 +78,8 @@ public:
|
||||
void loadSourceFile(const QString &fileName);
|
||||
|
||||
bool preferImage() const { return m_prefer_image; }
|
||||
|
||||
#if defined(QT_OPENGL_SUPPORT)
|
||||
QGLWidget *glWidget() const { return glw; }
|
||||
#if QT_CONFIG(opengl)
|
||||
QOpenGLWindow *glWindow() const { return m_glWindow; }
|
||||
#endif
|
||||
|
||||
public slots:
|
||||
@ -117,7 +87,7 @@ public slots:
|
||||
void setDescriptionEnabled(bool enabled);
|
||||
void showSource();
|
||||
|
||||
#if defined(QT_OPENGL_SUPPORT)
|
||||
#if QT_CONFIG(opengl)
|
||||
void enableOpenGL(bool use_opengl);
|
||||
bool usesOpenGL() { return m_use_opengl; }
|
||||
#endif
|
||||
@ -129,8 +99,10 @@ protected:
|
||||
void paintEvent(QPaintEvent *) override;
|
||||
void resizeEvent(QResizeEvent *) override;
|
||||
|
||||
#if defined(QT_OPENGL_SUPPORT)
|
||||
GLWidget *glw;
|
||||
#if QT_CONFIG(opengl)
|
||||
virtual void createGlWindow();
|
||||
QOpenGLWindow *m_glWindow;
|
||||
QWidget *m_glWidget;
|
||||
bool m_use_opengl;
|
||||
#endif
|
||||
QPixmap m_tile;
|
||||
|
113
examples/widgets/painting/shared/fbopaintdevice.cpp
Normal file
113
examples/widgets/painting/shared/fbopaintdevice.cpp
Normal file
@ -0,0 +1,113 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2018 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the demonstration applications of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:BSD$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** BSD License Usage
|
||||
** Alternatively, you may use this file under the terms of the BSD license
|
||||
** as follows:
|
||||
**
|
||||
** "Redistribution and use in source and binary forms, with or without
|
||||
** modification, are permitted provided that the following conditions are
|
||||
** met:
|
||||
** * Redistributions of source code must retain the above copyright
|
||||
** notice, this list of conditions and the following disclaimer.
|
||||
** * Redistributions in binary form must reproduce the above copyright
|
||||
** notice, this list of conditions and the following disclaimer in
|
||||
** the documentation and/or other materials provided with the
|
||||
** distribution.
|
||||
** * Neither the name of The Qt Company Ltd nor the names of its
|
||||
** contributors may be used to endorse or promote products derived
|
||||
** from this software without specific prior written permission.
|
||||
**
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "fbopaintdevice.h"
|
||||
|
||||
#include <QOffscreenSurface>
|
||||
#include <QOpenGLFunctions>
|
||||
|
||||
QFboPaintDevice::QFboPaintDevice(const QSize& size, bool flipped, bool clearOnInit,
|
||||
QOpenGLFramebufferObject::Attachment attachment)
|
||||
: QOpenGLPaintDevice(size)
|
||||
{
|
||||
QOpenGLFramebufferObjectFormat format;
|
||||
format.setAttachment(attachment);
|
||||
format.setSamples(4);
|
||||
m_framebufferObject = new QOpenGLFramebufferObject(size, format);
|
||||
QOffscreenSurface *surface = new QOffscreenSurface();
|
||||
surface->create();
|
||||
m_surface = surface;
|
||||
setPaintFlipped(flipped);
|
||||
if (clearOnInit) {
|
||||
m_framebufferObject->bind();
|
||||
|
||||
context()->functions()->glClearColor(0, 0, 0, 0);
|
||||
context()->functions()->glClear(GL_COLOR_BUFFER_BIT);
|
||||
}
|
||||
}
|
||||
|
||||
QFboPaintDevice::~QFboPaintDevice()
|
||||
{
|
||||
delete m_framebufferObject;
|
||||
delete m_surface;
|
||||
}
|
||||
|
||||
void QFboPaintDevice::ensureActiveTarget()
|
||||
{
|
||||
if (QOpenGLContext::currentContext() != context())
|
||||
context()->makeCurrent(m_surface);
|
||||
|
||||
m_framebufferObject->bind();
|
||||
}
|
||||
|
||||
GLuint QFboPaintDevice::takeTexture()
|
||||
{
|
||||
// We have multisamples so we can't just forward takeTexture().
|
||||
QOpenGLFramebufferObject resolvedFbo(m_framebufferObject->size(), m_framebufferObject->attachment());
|
||||
QOpenGLFramebufferObject::blitFramebuffer(&resolvedFbo, m_framebufferObject);
|
||||
return resolvedFbo.takeTexture();
|
||||
}
|
||||
|
||||
QImage QFboPaintDevice::toImage() const
|
||||
{
|
||||
QOpenGLContext* currentContext = QOpenGLContext::currentContext();
|
||||
QSurface* currentSurface = currentContext ? currentContext->surface() : 0;
|
||||
|
||||
context()->makeCurrent(m_surface);
|
||||
|
||||
QImage image = m_framebufferObject->toImage(!paintFlipped());
|
||||
|
||||
if (currentContext)
|
||||
currentContext->makeCurrent(currentSurface);
|
||||
else
|
||||
context()->doneCurrent();
|
||||
|
||||
return image;
|
||||
}
|
91
examples/widgets/painting/shared/fbopaintdevice.h
Normal file
91
examples/widgets/painting/shared/fbopaintdevice.h
Normal file
@ -0,0 +1,91 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2018 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the demonstration applications of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:BSD$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** BSD License Usage
|
||||
** Alternatively, you may use this file under the terms of the BSD license
|
||||
** as follows:
|
||||
**
|
||||
** "Redistribution and use in source and binary forms, with or without
|
||||
** modification, are permitted provided that the following conditions are
|
||||
** met:
|
||||
** * Redistributions of source code must retain the above copyright
|
||||
** notice, this list of conditions and the following disclaimer.
|
||||
** * Redistributions in binary form must reproduce the above copyright
|
||||
** notice, this list of conditions and the following disclaimer in
|
||||
** the documentation and/or other materials provided with the
|
||||
** distribution.
|
||||
** * Neither the name of The Qt Company Ltd nor the names of its
|
||||
** contributors may be used to endorse or promote products derived
|
||||
** from this software without specific prior written permission.
|
||||
**
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QFBOPAINTDEVICE_H
|
||||
#define QFBOPAINTDEVICE_H
|
||||
|
||||
#ifndef QT_NO_OPENGL
|
||||
|
||||
#include <QImage>
|
||||
#include <QOpenGLFramebufferObject>
|
||||
#include <QOpenGLPaintDevice>
|
||||
#include <QSurface>
|
||||
|
||||
class QFboPaintDevice : public QOpenGLPaintDevice {
|
||||
public:
|
||||
QFboPaintDevice(const QSize&, bool flipped = false, bool clearOnInit = true,
|
||||
QOpenGLFramebufferObject::Attachment = QOpenGLFramebufferObject::CombinedDepthStencil);
|
||||
~QFboPaintDevice();
|
||||
|
||||
// QOpenGLPaintDevice:
|
||||
void ensureActiveTarget() override;
|
||||
|
||||
bool isValid() const { return m_framebufferObject->isValid(); }
|
||||
GLuint handle() const { return m_framebufferObject->handle(); }
|
||||
GLuint takeTexture();
|
||||
QImage toImage() const;
|
||||
|
||||
bool bind() { return m_framebufferObject->bind(); }
|
||||
bool release() { return m_framebufferObject->release(); }
|
||||
QSize size() const { return m_framebufferObject->size(); }
|
||||
|
||||
QOpenGLFramebufferObject* framebufferObject() { return m_framebufferObject; }
|
||||
const QOpenGLFramebufferObject* framebufferObject() const { return m_framebufferObject; }
|
||||
|
||||
static bool isSupported() { return QOpenGLFramebufferObject::hasOpenGLFramebufferObjects(); }
|
||||
|
||||
private:
|
||||
QOpenGLFramebufferObject *m_framebufferObject;
|
||||
QSurface* m_surface;
|
||||
};
|
||||
|
||||
#endif // QT_NO_OPENGL
|
||||
|
||||
#endif // QFBOPAINTDEVICE_H
|
@ -48,10 +48,6 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef QT_OPENGL_SUPPORT
|
||||
#include <QGLWidget>
|
||||
#endif
|
||||
|
||||
#include "arthurwidgets.h"
|
||||
#include "hoverpoints.h"
|
||||
|
||||
@ -269,11 +265,6 @@ bool HoverPoints::eventFilter(QObject *object, QEvent *event)
|
||||
QApplication::sendEvent(object, event);
|
||||
m_widget = that_widget;
|
||||
paintPoints();
|
||||
#ifdef QT_OPENGL_SUPPORT
|
||||
ArthurFrame *af = qobject_cast<ArthurFrame *>(that_widget);
|
||||
if (af && af->usesOpenGL())
|
||||
af->glWidget()->swapBuffers();
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
default:
|
||||
@ -288,12 +279,14 @@ bool HoverPoints::eventFilter(QObject *object, QEvent *event)
|
||||
void HoverPoints::paintPoints()
|
||||
{
|
||||
QPainter p;
|
||||
#ifdef QT_OPENGL_SUPPORT
|
||||
#if QT_CONFIG(opengl)
|
||||
ArthurFrame *af = qobject_cast<ArthurFrame *>(m_widget);
|
||||
if (af && af->usesOpenGL())
|
||||
p.begin(af->glWidget());
|
||||
else
|
||||
if (af && af->usesOpenGL() && af->glWindow()->isValid()) {
|
||||
af->glWindow()->makeCurrent();
|
||||
p.begin(af->glWindow());
|
||||
} else {
|
||||
p.begin(m_widget);
|
||||
}
|
||||
#else
|
||||
p.begin(m_widget);
|
||||
#endif
|
||||
|
@ -1,8 +1,8 @@
|
||||
INCLUDEPATH += $$PWD
|
||||
|
||||
qtHaveModule(opengl)|qtConfig(opengles2) {
|
||||
DEFINES += QT_OPENGL_SUPPORT
|
||||
QT += opengl widgets
|
||||
qtConfig(opengl) {
|
||||
SOURCES += $$PWD/fbopaintdevice.cpp
|
||||
HEADERS += $$PWD/fbopaintdevice.h
|
||||
}
|
||||
|
||||
SOURCES += \
|
||||
|
@ -28,4 +28,5 @@ qtHaveModule(gui):qtConfig(opengl): \
|
||||
|
||||
contains(DEFINES, QT_NO_CURSOR): SUBDIRS -= mainwindows
|
||||
!qtConfig(draganddrop): SUBDIRS -= draganddrop
|
||||
!qtConfig(animation): SUBDIRS -= animation
|
||||
mac:SUBDIRS += mac
|
||||
|
@ -48,8 +48,8 @@ for (dep, dependentmodules): \
|
||||
dependentmodules = $$join(mod_deps, ";")
|
||||
|
||||
QT_FOR_CONFIG += gui-private
|
||||
qtConfig(angle): CMAKE_GL_DEFINES = -DQT_WITH_ANGLE=True
|
||||
!qtConfig(egl): CMAKE_GL_DEFINES += -DNO_EGL=True
|
||||
qtHaveModule(gui):qtConfig(angle): CMAKE_GL_DEFINES = -DQT_WITH_ANGLE=True
|
||||
qtHaveModule(gui):!qtConfig(egl): CMAKE_GL_DEFINES += -DNO_EGL=True
|
||||
|
||||
CMAKE_MODULE_VERSIONS =
|
||||
CMAKE_MODULES_UNDER_TEST =
|
||||
|
@ -113,6 +113,8 @@ breakpad {
|
||||
!isEmpty(QMAKE_STRIP):QMAKE_POST_LINK = $$QMAKE_POST_LINK$$escape_expand(\\n\\t)$$quote($$QMAKE_STRIP $$DEBUGFILENAME)
|
||||
}
|
||||
|
||||
c++17: CONFIG += c++1z
|
||||
|
||||
!c++11:!c++14:!c++1z {
|
||||
# Qt requires C++11 since 5.7, check if we need to force a compiler option
|
||||
QT_COMPILER_STDCXX_no_L = $$replace(QT_COMPILER_STDCXX, "L$", "")
|
||||
|
@ -110,6 +110,14 @@ load(qt_common)
|
||||
|
||||
load(resolve_target)
|
||||
TARGETPATHBASE = $$replace(TARGETPATH, \\.\\d+\$, )
|
||||
|
||||
!qml1_target {
|
||||
isEmpty(QMAKE_PLUGINDUMP_DEPENDENCIES_FILE):exists($$_PRO_FILE_PWD_/dependencies.json): \
|
||||
QMAKE_PLUGINDUMP_DEPENDENCIES_FILE = $$_PRO_FILE_PWD_/dependencies.json
|
||||
!isEmpty(QMAKE_PLUGINDUMP_DEPENDENCIES_FILE): \
|
||||
QMAKE_QMLPLUGINDUMP_FLAGS += -dependencies $$shell_quote($$QMAKE_PLUGINDUMP_DEPENDENCIES_FILE)
|
||||
}
|
||||
|
||||
qmltypes.target = qmltypes
|
||||
qmltypes.commands = $$QMLPLUGINDUMP -nonrelocatable $$QMAKE_QMLPLUGINDUMP_FLAGS $$replace(TARGETPATHBASE, /, .) $$IMPORT_VERSION > $$QMLTYPEFILE
|
||||
qmltypes.depends = $$QMAKE_RESOLVED_TARGET
|
||||
|
@ -1,4 +1,4 @@
|
||||
QMAKE_TARGET_COMPANY = The Qt Company Ltd.
|
||||
isEmpty(QMAKE_TARGET_PRODUCT): QMAKE_TARGET_PRODUCT = Qt5
|
||||
isEmpty(QMAKE_TARGET_DESCRIPTION): QMAKE_TARGET_DESCRIPTION = C++ Application Development Framework
|
||||
QMAKE_TARGET_COPYRIGHT = Copyright (C) 2017 The Qt Company Ltd.
|
||||
QMAKE_TARGET_COPYRIGHT = Copyright (C) 2018 The Qt Company Ltd.
|
||||
|
@ -1,7 +1,7 @@
|
||||
msvc {
|
||||
# -MD becomes -MT, -MDd becomes -MTd
|
||||
QMAKE_CFLAGS ~= s,^-MD(d?)$, -MT\1,g
|
||||
QMAKE_CXXFLAGS ~= s,^-MD(d?)$, -MT\1,g
|
||||
QMAKE_CFLAGS ~= s,^-MD(d?)$,-MT\1,g
|
||||
QMAKE_CXXFLAGS ~= s,^-MD(d?)$,-MT\1,g
|
||||
} else: mingw {
|
||||
QMAKE_LFLAGS += -static
|
||||
}
|
||||
|
@ -973,6 +973,7 @@
|
||||
\row \li c++1z \li C++17 support is enabled. This option has no effect if
|
||||
the compiler does not support C++17, or can't select the C++ standard.
|
||||
By default, support is disabled.
|
||||
\row \li c++17 \li Same as c++1z.
|
||||
\row \li strict_c++ \li Disables support for C++ compiler extensions.
|
||||
By default, they are enabled.
|
||||
\row \li depend_includepath \li Appending the value of INCLUDEPATH to
|
||||
|
9
src/3rdparty/angle/AUTHORS
vendored
9
src/3rdparty/angle/AUTHORS
vendored
@ -1,4 +1,4 @@
|
||||
# This is the official list of The ANGLE Project Authors
|
||||
# This is the official list of The ANGLE Project Authors
|
||||
# for copyright purposes.
|
||||
# This file is distinct from the CONTRIBUTORS files.
|
||||
# See the latter for an explanation.
|
||||
@ -26,6 +26,7 @@ Microsoft Open Technologies, Inc.
|
||||
NVIDIA Corporation
|
||||
Opera Software ASA
|
||||
The Qt Company Ltd.
|
||||
Advanced Micro Devices, Inc.
|
||||
|
||||
Jacek Caban
|
||||
Mark Callow
|
||||
@ -42,3 +43,9 @@ Yuri O'Donnell
|
||||
Josh Soref
|
||||
Maks Naumov
|
||||
Jinyoung Hur
|
||||
Sebastian Bergstein
|
||||
James Ross-Gowan
|
||||
Nickolay Artamonov
|
||||
Ihsan Akmal
|
||||
Andrei Volykhin
|
||||
Jérôme Duval
|
||||
|
20
src/3rdparty/angle/CONTRIBUTORS
vendored
20
src/3rdparty/angle/CONTRIBUTORS
vendored
@ -41,6 +41,7 @@ Google Inc.
|
||||
Justin Schuh
|
||||
Scott Graham
|
||||
Corentin Wallez
|
||||
Kai Ninomiya
|
||||
|
||||
Adobe Systems Inc.
|
||||
Alexandru Chiculita
|
||||
@ -64,12 +65,21 @@ Intel Corporation
|
||||
Andy Chen
|
||||
Josh Triplett
|
||||
Sudarsana Nagineni
|
||||
Jiajia Qin
|
||||
Jiawei Shao
|
||||
Jie Chen
|
||||
Qiankun Miao
|
||||
Bryan Bernhart
|
||||
Yunchao He
|
||||
Xinghua Cao
|
||||
Brandon Jones
|
||||
|
||||
Klarälvdalens Datakonsult AB
|
||||
Milian Wolff
|
||||
|
||||
Mozilla Corp.
|
||||
Ehsan Akhgari
|
||||
Edwin Flores
|
||||
Jeff Gilbert
|
||||
Mike Hommey
|
||||
Benoit Jacob
|
||||
@ -85,6 +95,10 @@ David Kilzer
|
||||
Jacek Caban
|
||||
Tibor den Ouden
|
||||
Régis Fénéon
|
||||
Sebastian Bergstein
|
||||
James Ross-Gowan
|
||||
Andrei Volykhin
|
||||
Jérôme Duval
|
||||
|
||||
Microsoft Corporation
|
||||
Cooper Partin
|
||||
@ -101,7 +115,13 @@ NVIDIA Corporation
|
||||
Arun Patole
|
||||
Qingqing Deng
|
||||
Kimmo Kinnunen
|
||||
Sami Väisänen
|
||||
Martin Radev
|
||||
|
||||
Opera Software ASA
|
||||
Daniel Bratell
|
||||
Tomasz Moniuszko
|
||||
David Landell
|
||||
|
||||
Advanced Micro Devices, Inc.
|
||||
Russ Lind
|
||||
|
64
src/3rdparty/angle/LICENSE
vendored
64
src/3rdparty/angle/LICENSE
vendored
@ -1,32 +1,32 @@
|
||||
Copyright (C) 2002-2013 The ANGLE Project Authors.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following
|
||||
disclaimer in the documentation and/or other materials provided
|
||||
with the distribution.
|
||||
|
||||
Neither the name of TransGaming Inc., Google Inc., 3DLabs Inc.
|
||||
Ltd., nor the names of their contributors may be used to endorse
|
||||
or promote products derived from this software without specific
|
||||
prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
// Copyright (C) 2002-2013 The ANGLE Project Authors.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following
|
||||
// disclaimer in the documentation and/or other materials provided
|
||||
// with the distribution.
|
||||
//
|
||||
// Neither the name of TransGaming Inc., Google Inc., 3DLabs Inc.
|
||||
// Ltd., nor the names of their contributors may be used to endorse
|
||||
// or promote products derived from this software without specific
|
||||
// prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
22
src/3rdparty/angle/SYSTEMINFO_LICENSE
vendored
22
src/3rdparty/angle/SYSTEMINFO_LICENSE
vendored
@ -1,22 +0,0 @@
|
||||
Copyright (C) 2009 Apple Inc. All Rights Reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
|
||||
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
27
src/3rdparty/angle/TRACEEVENT_LICENSE
vendored
27
src/3rdparty/angle/TRACEEVENT_LICENSE
vendored
@ -1,27 +0,0 @@
|
||||
Copyright 2013 The Chromium Authors. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following disclaimer
|
||||
in the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
* Neither the name of Google Inc. nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
14
src/3rdparty/angle/id/commit.h
vendored
Normal file
14
src/3rdparty/angle/id/commit.h
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
//
|
||||
// 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
|
24
src/3rdparty/angle/include/EGL/egl.h
vendored
24
src/3rdparty/angle/include/EGL/egl.h
vendored
@ -6,7 +6,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Copyright (c) 2013-2015 The Khronos Group Inc.
|
||||
** Copyright (c) 2013-2017 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
|
||||
@ -31,14 +31,14 @@ extern "C" {
|
||||
** 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/
|
||||
** http://www.opengl.org/registry/egl
|
||||
**
|
||||
** Khronos $Revision: 31566 $ on $Date: 2015-06-23 08:48:48 -0700 (Tue, 23 Jun 2015) $
|
||||
** Khronos $Revision$ on $Date$
|
||||
*/
|
||||
|
||||
#include <EGL/eglplatform.h>
|
||||
|
||||
/* Generated on date 20150623 */
|
||||
/* Generated on date 20161230 */
|
||||
|
||||
/* Generated C header for:
|
||||
* API: egl
|
||||
@ -78,7 +78,7 @@ typedef void (*__eglMustCastToProperFunctionPointerType)(void);
|
||||
#define EGL_CONFIG_ID 0x3028
|
||||
#define EGL_CORE_NATIVE_ENGINE 0x305B
|
||||
#define EGL_DEPTH_SIZE 0x3025
|
||||
#define EGL_DONT_CARE ((EGLint)-1)
|
||||
#define EGL_DONT_CARE EGL_CAST(EGLint,-1)
|
||||
#define EGL_DRAW 0x3059
|
||||
#define EGL_EXTENSIONS 0x3055
|
||||
#define EGL_FALSE 0
|
||||
@ -95,9 +95,9 @@ typedef void (*__eglMustCastToProperFunctionPointerType)(void);
|
||||
#define EGL_NONE 0x3038
|
||||
#define EGL_NON_CONFORMANT_CONFIG 0x3051
|
||||
#define EGL_NOT_INITIALIZED 0x3001
|
||||
#define EGL_NO_CONTEXT ((EGLContext)0)
|
||||
#define EGL_NO_DISPLAY ((EGLDisplay)0)
|
||||
#define EGL_NO_SURFACE ((EGLSurface)0)
|
||||
#define EGL_NO_CONTEXT EGL_CAST(EGLContext,0)
|
||||
#define EGL_NO_DISPLAY EGL_CAST(EGLDisplay,0)
|
||||
#define EGL_NO_SURFACE EGL_CAST(EGLSurface,0)
|
||||
#define EGL_PBUFFER_BIT 0x0001
|
||||
#define EGL_PIXMAP_BIT 0x0002
|
||||
#define EGL_READ 0x305A
|
||||
@ -197,7 +197,7 @@ typedef void *EGLClientBuffer;
|
||||
#define EGL_RGB_BUFFER 0x308E
|
||||
#define EGL_SINGLE_BUFFER 0x3085
|
||||
#define EGL_SWAP_BEHAVIOR 0x3093
|
||||
#define EGL_UNKNOWN ((EGLint)-1)
|
||||
#define EGL_UNKNOWN EGL_CAST(EGLint,-1)
|
||||
#define EGL_VERTICAL_RESOLUTION 0x3091
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglBindAPI (EGLenum api);
|
||||
EGLAPI EGLenum EGLAPIENTRY eglQueryAPI (void);
|
||||
@ -224,7 +224,7 @@ EGLAPI EGLBoolean EGLAPIENTRY eglWaitClient (void);
|
||||
|
||||
#ifndef EGL_VERSION_1_4
|
||||
#define EGL_VERSION_1_4 1
|
||||
#define EGL_DEFAULT_DISPLAY ((EGLNativeDisplayType)0)
|
||||
#define EGL_DEFAULT_DISPLAY EGL_CAST(EGLNativeDisplayType,0)
|
||||
#define EGL_MULTISAMPLE_RESOLVE_BOX_BIT 0x0200
|
||||
#define EGL_MULTISAMPLE_RESOLVE 0x3099
|
||||
#define EGL_MULTISAMPLE_RESOLVE_DEFAULT 0x309A
|
||||
@ -266,7 +266,7 @@ typedef void *EGLImage;
|
||||
#define EGL_FOREVER 0xFFFFFFFFFFFFFFFFull
|
||||
#define EGL_TIMEOUT_EXPIRED 0x30F5
|
||||
#define EGL_CONDITION_SATISFIED 0x30F6
|
||||
#define EGL_NO_SYNC ((EGLSync)0)
|
||||
#define EGL_NO_SYNC EGL_CAST(EGLSync,0)
|
||||
#define EGL_SYNC_FENCE 0x30F9
|
||||
#define EGL_GL_COLORSPACE 0x309D
|
||||
#define EGL_GL_COLORSPACE_SRGB 0x3089
|
||||
@ -283,7 +283,7 @@ typedef void *EGLImage;
|
||||
#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x30B7
|
||||
#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x30B8
|
||||
#define EGL_IMAGE_PRESERVED 0x30D2
|
||||
#define EGL_NO_IMAGE ((EGLImage)0)
|
||||
#define EGL_NO_IMAGE EGL_CAST(EGLImage,0)
|
||||
EGLAPI EGLSync EGLAPIENTRY eglCreateSync (EGLDisplay dpy, EGLenum type, const EGLAttrib *attrib_list);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglDestroySync (EGLDisplay dpy, EGLSync sync);
|
||||
EGLAPI EGLint EGLAPIENTRY eglClientWaitSync (EGLDisplay dpy, EGLSync sync, EGLint flags, EGLTime timeout);
|
||||
|
464
src/3rdparty/angle/include/EGL/eglext.h
vendored
464
src/3rdparty/angle/include/EGL/eglext.h
vendored
@ -6,7 +6,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Copyright (c) 2013-2015 The Khronos Group Inc.
|
||||
** Copyright (c) 2013-2017 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
|
||||
@ -31,14 +31,14 @@ extern "C" {
|
||||
** 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/
|
||||
** http://www.khronos.org/registry/egl
|
||||
**
|
||||
** Khronos $Revision: 31566 $ on $Date: 2015-06-23 08:48:48 -0700 (Tue, 23 Jun 2015) $
|
||||
** Khronos $Git commit SHA1: a732b061e7 $ on $Git commit date: 2017-06-17 23:27:53 +0100 $
|
||||
*/
|
||||
|
||||
#include <EGL/eglplatform.h>
|
||||
|
||||
#define EGL_EGLEXT_VERSION 20150623
|
||||
#define EGL_EGLEXT_VERSION 20170627
|
||||
|
||||
/* Generated C header for:
|
||||
* API: egl
|
||||
@ -77,6 +77,13 @@ EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSync64KHR (EGLDisplay dpy, EGLenum type,
|
||||
#define EGL_VG_ALPHA_FORMAT_PRE_BIT_KHR 0x0040
|
||||
#endif /* EGL_KHR_config_attribs */
|
||||
|
||||
#ifndef EGL_KHR_context_flush_control
|
||||
#define EGL_KHR_context_flush_control 1
|
||||
#define EGL_CONTEXT_RELEASE_BEHAVIOR_NONE_KHR 0
|
||||
#define EGL_CONTEXT_RELEASE_BEHAVIOR_KHR 0x2097
|
||||
#define EGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_KHR 0x2098
|
||||
#endif /* EGL_KHR_context_flush_control */
|
||||
|
||||
#ifndef EGL_KHR_create_context
|
||||
#define EGL_KHR_create_context 1
|
||||
#define EGL_CONTEXT_MAJOR_VERSION_KHR 0x3098
|
||||
@ -99,6 +106,42 @@ EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSync64KHR (EGLDisplay dpy, EGLenum type,
|
||||
#define EGL_CONTEXT_OPENGL_NO_ERROR_KHR 0x31B3
|
||||
#endif /* EGL_KHR_create_context_no_error */
|
||||
|
||||
#ifndef EGL_KHR_debug
|
||||
#define EGL_KHR_debug 1
|
||||
typedef void *EGLLabelKHR;
|
||||
typedef void *EGLObjectKHR;
|
||||
typedef void (EGLAPIENTRY *EGLDEBUGPROCKHR)(EGLenum error,const char *command,EGLint messageType,EGLLabelKHR threadLabel,EGLLabelKHR objectLabel,const char* message);
|
||||
#define EGL_OBJECT_THREAD_KHR 0x33B0
|
||||
#define EGL_OBJECT_DISPLAY_KHR 0x33B1
|
||||
#define EGL_OBJECT_CONTEXT_KHR 0x33B2
|
||||
#define EGL_OBJECT_SURFACE_KHR 0x33B3
|
||||
#define EGL_OBJECT_IMAGE_KHR 0x33B4
|
||||
#define EGL_OBJECT_SYNC_KHR 0x33B5
|
||||
#define EGL_OBJECT_STREAM_KHR 0x33B6
|
||||
#define EGL_DEBUG_MSG_CRITICAL_KHR 0x33B9
|
||||
#define EGL_DEBUG_MSG_ERROR_KHR 0x33BA
|
||||
#define EGL_DEBUG_MSG_WARN_KHR 0x33BB
|
||||
#define EGL_DEBUG_MSG_INFO_KHR 0x33BC
|
||||
#define EGL_DEBUG_CALLBACK_KHR 0x33B8
|
||||
typedef EGLint (EGLAPIENTRYP PFNEGLDEBUGMESSAGECONTROLKHRPROC) (EGLDEBUGPROCKHR callback, const EGLAttrib *attrib_list);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDEBUGKHRPROC) (EGLint attribute, EGLAttrib *value);
|
||||
typedef EGLint (EGLAPIENTRYP PFNEGLLABELOBJECTKHRPROC) (EGLDisplay display, EGLenum objectType, EGLObjectKHR object, EGLLabelKHR label);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLint EGLAPIENTRY eglDebugMessageControlKHR (EGLDEBUGPROCKHR callback, const EGLAttrib *attrib_list);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglQueryDebugKHR (EGLint attribute, EGLAttrib *value);
|
||||
EGLAPI EGLint EGLAPIENTRY eglLabelObjectKHR (EGLDisplay display, EGLenum objectType, EGLObjectKHR object, EGLLabelKHR label);
|
||||
#endif
|
||||
#endif /* EGL_KHR_debug */
|
||||
|
||||
#ifndef EGL_KHR_display_reference
|
||||
#define EGL_KHR_display_reference 1
|
||||
#define EGL_TRACK_REFERENCES_KHR 0x3352
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDISPLAYATTRIBKHRPROC) (EGLDisplay dpy, EGLint name, EGLAttrib *value);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglQueryDisplayAttribKHR (EGLDisplay dpy, EGLint name, EGLAttrib *value);
|
||||
#endif
|
||||
#endif /* EGL_KHR_display_reference */
|
||||
|
||||
#ifndef EGL_KHR_fence_sync
|
||||
#define EGL_KHR_fence_sync 1
|
||||
typedef khronos_utime_nanoseconds_t EGLTimeKHR;
|
||||
@ -161,7 +204,7 @@ EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribKHR (EGLDisplay dpy, EGLSyncKHR sy
|
||||
#define EGL_KHR_image 1
|
||||
typedef void *EGLImageKHR;
|
||||
#define EGL_NATIVE_PIXMAP_KHR 0x30B0
|
||||
#define EGL_NO_IMAGE_KHR ((EGLImageKHR)0)
|
||||
#define EGL_NO_IMAGE_KHR EGL_CAST(EGLImageKHR,0)
|
||||
typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEIMAGEKHRPROC) (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYIMAGEKHRPROC) (EGLDisplay dpy, EGLImageKHR image);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
@ -223,6 +266,16 @@ EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurface64KHR (EGLDisplay dpy, EGLSurface s
|
||||
#endif
|
||||
#endif /* EGL_KHR_lock_surface3 */
|
||||
|
||||
#ifndef EGL_KHR_mutable_render_buffer
|
||||
#define EGL_KHR_mutable_render_buffer 1
|
||||
#define EGL_MUTABLE_RENDER_BUFFER_BIT_KHR 0x1000
|
||||
#endif /* EGL_KHR_mutable_render_buffer */
|
||||
|
||||
#ifndef EGL_KHR_no_config_context
|
||||
#define EGL_KHR_no_config_context 1
|
||||
#define EGL_NO_CONFIG_KHR EGL_CAST(EGLConfig,0)
|
||||
#endif /* EGL_KHR_no_config_context */
|
||||
|
||||
#ifndef EGL_KHR_partial_update
|
||||
#define EGL_KHR_partial_update 1
|
||||
#define EGL_BUFFER_AGE_KHR 0x313D
|
||||
@ -265,7 +318,7 @@ EGLAPI EGLBoolean EGLAPIENTRY eglSetDamageRegionKHR (EGLDisplay dpy, EGLSurface
|
||||
#define EGL_SYNC_REUSABLE_KHR 0x30FA
|
||||
#define EGL_SYNC_FLUSH_COMMANDS_BIT_KHR 0x0001
|
||||
#define EGL_FOREVER_KHR 0xFFFFFFFFFFFFFFFFull
|
||||
#define EGL_NO_SYNC_KHR ((EGLSyncKHR)0)
|
||||
#define EGL_NO_SYNC_KHR EGL_CAST(EGLSyncKHR,0)
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglSignalSyncKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode);
|
||||
@ -278,7 +331,7 @@ EGLAPI EGLBoolean EGLAPIENTRY eglSignalSyncKHR (EGLDisplay dpy, EGLSyncKHR sync,
|
||||
typedef void *EGLStreamKHR;
|
||||
typedef khronos_uint64_t EGLuint64KHR;
|
||||
#ifdef KHRONOS_SUPPORT_INT64
|
||||
#define EGL_NO_STREAM_KHR ((EGLStreamKHR)0)
|
||||
#define EGL_NO_STREAM_KHR EGL_CAST(EGLStreamKHR,0)
|
||||
#define EGL_CONSUMER_LATENCY_USEC_KHR 0x3210
|
||||
#define EGL_PRODUCER_FRAME_KHR 0x3212
|
||||
#define EGL_CONSUMER_FRAME_KHR 0x3213
|
||||
@ -306,6 +359,24 @@ EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamu64KHR (EGLDisplay dpy, EGLStreamKHR
|
||||
#endif /* KHRONOS_SUPPORT_INT64 */
|
||||
#endif /* EGL_KHR_stream */
|
||||
|
||||
#ifndef EGL_KHR_stream_attrib
|
||||
#define EGL_KHR_stream_attrib 1
|
||||
#ifdef KHRONOS_SUPPORT_INT64
|
||||
typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMATTRIBKHRPROC) (EGLDisplay dpy, const EGLAttrib *attrib_list);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSETSTREAMATTRIBKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLAttrib value);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMATTRIBKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLAttrib *value);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERACQUIREATTRIBKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, const EGLAttrib *attrib_list);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERRELEASEATTRIBKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, const EGLAttrib *attrib_list);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLStreamKHR EGLAPIENTRY eglCreateStreamAttribKHR (EGLDisplay dpy, const EGLAttrib *attrib_list);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglSetStreamAttribKHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLAttrib value);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamAttribKHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLAttrib *value);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerAcquireAttribKHR (EGLDisplay dpy, EGLStreamKHR stream, const EGLAttrib *attrib_list);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerReleaseAttribKHR (EGLDisplay dpy, EGLStreamKHR stream, const EGLAttrib *attrib_list);
|
||||
#endif
|
||||
#endif /* KHRONOS_SUPPORT_INT64 */
|
||||
#endif /* EGL_KHR_stream_attrib */
|
||||
|
||||
#ifndef EGL_KHR_stream_consumer_gltexture
|
||||
#define EGL_KHR_stream_consumer_gltexture 1
|
||||
#ifdef EGL_KHR_stream
|
||||
@ -325,7 +396,7 @@ EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerReleaseKHR (EGLDisplay dpy, EGLSt
|
||||
#define EGL_KHR_stream_cross_process_fd 1
|
||||
typedef int EGLNativeFileDescriptorKHR;
|
||||
#ifdef EGL_KHR_stream
|
||||
#define EGL_NO_FILE_DESCRIPTOR_KHR ((EGLNativeFileDescriptorKHR)(-1))
|
||||
#define EGL_NO_FILE_DESCRIPTOR_KHR EGL_CAST(EGLNativeFileDescriptorKHR,-1)
|
||||
typedef EGLNativeFileDescriptorKHR (EGLAPIENTRYP PFNEGLGETSTREAMFILEDESCRIPTORKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
|
||||
typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMFROMFILEDESCRIPTORKHRPROC) (EGLDisplay dpy, EGLNativeFileDescriptorKHR file_descriptor);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
@ -402,11 +473,28 @@ EGLAPI void EGLAPIENTRY eglSetBlobCacheFuncsANDROID (EGLDisplay dpy, EGLSetBlobF
|
||||
#endif
|
||||
#endif /* EGL_ANDROID_blob_cache */
|
||||
|
||||
#ifndef EGL_ANDROID_create_native_client_buffer
|
||||
#define EGL_ANDROID_create_native_client_buffer 1
|
||||
#define EGL_NATIVE_BUFFER_USAGE_ANDROID 0x3143
|
||||
#define EGL_NATIVE_BUFFER_USAGE_PROTECTED_BIT_ANDROID 0x00000001
|
||||
#define EGL_NATIVE_BUFFER_USAGE_RENDERBUFFER_BIT_ANDROID 0x00000002
|
||||
#define EGL_NATIVE_BUFFER_USAGE_TEXTURE_BIT_ANDROID 0x00000004
|
||||
typedef EGLClientBuffer (EGLAPIENTRYP PFNEGLCREATENATIVECLIENTBUFFERANDROIDPROC) (const EGLint *attrib_list);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLClientBuffer EGLAPIENTRY eglCreateNativeClientBufferANDROID (const EGLint *attrib_list);
|
||||
#endif
|
||||
#endif /* EGL_ANDROID_create_native_client_buffer */
|
||||
|
||||
#ifndef EGL_ANDROID_framebuffer_target
|
||||
#define EGL_ANDROID_framebuffer_target 1
|
||||
#define EGL_FRAMEBUFFER_TARGET_ANDROID 0x3147
|
||||
#endif /* EGL_ANDROID_framebuffer_target */
|
||||
|
||||
#ifndef EGL_ANDROID_front_buffer_auto_refresh
|
||||
#define EGL_ANDROID_front_buffer_auto_refresh 1
|
||||
#define EGL_FRONT_BUFFER_AUTO_REFRESH_ANDROID 0x314C
|
||||
#endif /* EGL_ANDROID_front_buffer_auto_refresh */
|
||||
|
||||
#ifndef EGL_ANDROID_image_native_buffer
|
||||
#define EGL_ANDROID_image_native_buffer 1
|
||||
#define EGL_NATIVE_BUFFER_ANDROID 0x3140
|
||||
@ -424,6 +512,15 @@ EGLAPI EGLint EGLAPIENTRY eglDupNativeFenceFDANDROID (EGLDisplay dpy, EGLSyncKHR
|
||||
#endif
|
||||
#endif /* EGL_ANDROID_native_fence_sync */
|
||||
|
||||
#ifndef EGL_ANDROID_presentation_time
|
||||
#define EGL_ANDROID_presentation_time 1
|
||||
typedef khronos_stime_nanoseconds_t EGLnsecsANDROID;
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLPRESENTATIONTIMEANDROIDPROC) (EGLDisplay dpy, EGLSurface surface, EGLnsecsANDROID time);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglPresentationTimeANDROID (EGLDisplay dpy, EGLSurface surface, EGLnsecsANDROID time);
|
||||
#endif
|
||||
#endif /* EGL_ANDROID_presentation_time */
|
||||
|
||||
#ifndef EGL_ANDROID_recordable
|
||||
#define EGL_ANDROID_recordable 1
|
||||
#define EGL_RECORDABLE_ANDROID 0x3142
|
||||
@ -440,11 +537,6 @@ EGLAPI EGLint EGLAPIENTRY eglDupNativeFenceFDANDROID (EGLDisplay dpy, EGLSyncKHR
|
||||
#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
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSURFACEPOINTERANGLEPROC) (EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value);
|
||||
@ -453,87 +545,30 @@ EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurfacePointerANGLE (EGLDisplay dpy, EGLSu
|
||||
#endif
|
||||
#endif /* EGL_ANGLE_query_surface_pointer */
|
||||
|
||||
#ifndef EGL_ANGLE_software_display
|
||||
#define EGL_ANGLE_software_display 1
|
||||
#define EGL_SOFTWARE_DISPLAY_ANGLE ((EGLNativeDisplayType)-1)
|
||||
#endif /* EGL_ANGLE_software_display */
|
||||
|
||||
#ifndef EGL_ANGLE_direct3d_display
|
||||
#define EGL_ANGLE_direct3d_display 1
|
||||
#define EGL_D3D11_ELSE_D3D9_DISPLAY_ANGLE ((EGLNativeDisplayType)-2)
|
||||
#define EGL_D3D11_ONLY_DISPLAY_ANGLE ((EGLNativeDisplayType)-3)
|
||||
#endif /* EGL_ANGLE_direct3d_display */
|
||||
|
||||
#ifndef EGL_ANGLE_surface_d3d_texture_2d_share_handle
|
||||
#define EGL_ANGLE_surface_d3d_texture_2d_share_handle 1
|
||||
#endif /* EGL_ANGLE_surface_d3d_texture_2d_share_handle */
|
||||
|
||||
#ifndef EGL_ANGLE_direct_composition
|
||||
#define EGL_ANGLE_direct_composition 1
|
||||
#define EGL_DIRECT_COMPOSITION_ANGLE 0x33A5
|
||||
#endif /* EGL_ANGLE_direct_composition */
|
||||
|
||||
#ifndef EGL_ANGLE_platform_angle
|
||||
#define EGL_ANGLE_platform_angle 1
|
||||
#define EGL_PLATFORM_ANGLE_ANGLE 0x3202
|
||||
#define EGL_PLATFORM_ANGLE_TYPE_ANGLE 0x3203
|
||||
#define EGL_PLATFORM_ANGLE_MAX_VERSION_MAJOR_ANGLE 0x3204
|
||||
#define EGL_PLATFORM_ANGLE_MAX_VERSION_MINOR_ANGLE 0x3205
|
||||
#define EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE 0x3206
|
||||
#endif /* EGL_ANGLE_platform_angle */
|
||||
|
||||
#ifndef EGL_ANGLE_platform_angle_d3d
|
||||
#define EGL_ANGLE_platform_angle_d3d 1
|
||||
#define EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE 0x3207
|
||||
#define EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE 0x3208
|
||||
#define EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE 0x3209
|
||||
#define EGL_PLATFORM_ANGLE_DEVICE_TYPE_HARDWARE_ANGLE 0x320A
|
||||
#define EGL_PLATFORM_ANGLE_DEVICE_TYPE_WARP_ANGLE 0x320B
|
||||
#define EGL_PLATFORM_ANGLE_DEVICE_TYPE_REFERENCE_ANGLE 0x320C
|
||||
#define EGL_PLATFORM_ANGLE_ENABLE_AUTOMATIC_TRIM_ANGLE 0x320F
|
||||
#endif /* EGL_ANGLE_platform_angle_d3d */
|
||||
|
||||
#ifndef EGL_ANGLE_platform_angle_opengl
|
||||
#define EGL_ANGLE_platform_angle_opengl 1
|
||||
#define EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE 0x320D
|
||||
#define EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE 0x320E
|
||||
#endif /* EGL_ANGLE_platform_angle_opengl */
|
||||
|
||||
#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_x11_visual
|
||||
#define EGL_ANGLE_x11_visual
|
||||
#define EGL_X11_VISUAL_ID_ANGLE 0x33A3
|
||||
#endif /* EGL_ANGLE_x11_visual */
|
||||
|
||||
#ifndef EGL_ANGLE_flexible_surface_compatibility
|
||||
#define EGL_ANGLE_flexible_surface_compatibility 1
|
||||
#define EGL_FLEXIBLE_SURFACE_COMPATIBILITY_SUPPORTED_ANGLE 0x33A6
|
||||
#endif /* EGL_ANGLE_flexible_surface_compatibility */
|
||||
|
||||
#ifndef EGL_ANGLE_surface_orientation
|
||||
#define EGL_ANGLE_surface_orientation
|
||||
#define EGL_OPTIMAL_SURFACE_ORIENTATION_ANGLE 0x33A7
|
||||
#define EGL_SURFACE_ORIENTATION_ANGLE 0x33A8
|
||||
#define EGL_SURFACE_ORIENTATION_INVERT_X_ANGLE 0x0001
|
||||
#define EGL_SURFACE_ORIENTATION_INVERT_Y_ANGLE 0x0002
|
||||
#endif /* EGL_ANGLE_surface_orientation */
|
||||
|
||||
#ifndef EGL_ANGLE_experimental_present_path
|
||||
#define EGL_ANGLE_experimental_present_path
|
||||
#define EGL_EXPERIMENTAL_PRESENT_PATH_ANGLE 0x33A4
|
||||
#define EGL_EXPERIMENTAL_PRESENT_PATH_FAST_ANGLE 0x33A9
|
||||
#define EGL_EXPERIMENTAL_PRESENT_PATH_COPY_ANGLE 0x33AA
|
||||
#endif /* EGL_ANGLE_experimental_present_path */
|
||||
#ifndef EGL_ARM_implicit_external_sync
|
||||
#define EGL_ARM_implicit_external_sync 1
|
||||
#define EGL_SYNC_PRIOR_COMMANDS_IMPLICIT_EXTERNAL_ARM 0x328A
|
||||
#endif /* EGL_ARM_implicit_external_sync */
|
||||
|
||||
#ifndef EGL_ARM_pixmap_multisample_discard
|
||||
#define EGL_ARM_pixmap_multisample_discard 1
|
||||
#define EGL_DISCARD_SAMPLES_ARM 0x3286
|
||||
#endif /* EGL_ARM_pixmap_multisample_discard */
|
||||
|
||||
#ifndef EGL_EXT_bind_to_front
|
||||
#define EGL_EXT_bind_to_front 1
|
||||
#define EGL_FRONT_BUFFER_EXT 0x3464
|
||||
#endif /* EGL_EXT_bind_to_front */
|
||||
|
||||
#ifndef EGL_EXT_buffer_age
|
||||
#define EGL_EXT_buffer_age 1
|
||||
#define EGL_BUFFER_AGE_EXT 0x313D
|
||||
@ -543,6 +578,30 @@ EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurfacePointerANGLE (EGLDisplay dpy, EGLSu
|
||||
#define EGL_EXT_client_extensions 1
|
||||
#endif /* EGL_EXT_client_extensions */
|
||||
|
||||
#ifndef EGL_EXT_compositor
|
||||
#define EGL_EXT_compositor 1
|
||||
#define EGL_PRIMARY_COMPOSITOR_CONTEXT_EXT 0x3460
|
||||
#define EGL_EXTERNAL_REF_ID_EXT 0x3461
|
||||
#define EGL_COMPOSITOR_DROP_NEWEST_FRAME_EXT 0x3462
|
||||
#define EGL_COMPOSITOR_KEEP_NEWEST_FRAME_EXT 0x3463
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLCOMPOSITORSETCONTEXTLISTEXTPROC) (const EGLint *external_ref_ids, EGLint num_entries);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLCOMPOSITORSETCONTEXTATTRIBUTESEXTPROC) (EGLint external_ref_id, const EGLint *context_attributes, EGLint num_entries);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLCOMPOSITORSETWINDOWLISTEXTPROC) (EGLint external_ref_id, const EGLint *external_win_ids, EGLint num_entries);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLCOMPOSITORSETWINDOWATTRIBUTESEXTPROC) (EGLint external_win_id, const EGLint *window_attributes, EGLint num_entries);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLCOMPOSITORBINDTEXWINDOWEXTPROC) (EGLint external_win_id);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLCOMPOSITORSETSIZEEXTPROC) (EGLint external_win_id, EGLint width, EGLint height);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLCOMPOSITORSWAPPOLICYEXTPROC) (EGLint external_win_id, EGLint policy);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglCompositorSetContextListEXT (const EGLint *external_ref_ids, EGLint num_entries);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglCompositorSetContextAttributesEXT (EGLint external_ref_id, const EGLint *context_attributes, EGLint num_entries);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglCompositorSetWindowListEXT (EGLint external_ref_id, const EGLint *external_win_ids, EGLint num_entries);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglCompositorSetWindowAttributesEXT (EGLint external_win_id, const EGLint *window_attributes, EGLint num_entries);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglCompositorBindTexWindowEXT (EGLint external_win_id);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglCompositorSetSizeEXT (EGLint external_win_id, EGLint width, EGLint height);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglCompositorSwapPolicyEXT (EGLint external_win_id, EGLint policy);
|
||||
#endif
|
||||
#endif /* EGL_EXT_compositor */
|
||||
|
||||
#ifndef EGL_EXT_create_context_robustness
|
||||
#define EGL_EXT_create_context_robustness 1
|
||||
#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT 0x30BF
|
||||
@ -554,7 +613,7 @@ EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurfacePointerANGLE (EGLDisplay dpy, EGLSu
|
||||
#ifndef EGL_EXT_device_base
|
||||
#define EGL_EXT_device_base 1
|
||||
typedef void *EGLDeviceEXT;
|
||||
#define EGL_NO_DEVICE_EXT ((EGLDeviceEXT)(0))
|
||||
#define EGL_NO_DEVICE_EXT EGL_CAST(EGLDeviceEXT,0)
|
||||
#define EGL_BAD_DEVICE_EXT 0x322B
|
||||
#define EGL_DEVICE_EXT 0x322C
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDEVICEATTRIBEXTPROC) (EGLDeviceEXT device, EGLint attribute, EGLAttrib *value);
|
||||
@ -569,16 +628,6 @@ EGLAPI EGLBoolean EGLAPIENTRY eglQueryDisplayAttribEXT (EGLDisplay dpy, EGLint a
|
||||
#endif
|
||||
#endif /* EGL_EXT_device_base */
|
||||
|
||||
#ifndef EGL_ANGLE_device_creation
|
||||
#define EGL_ANGLE_device_creation 1
|
||||
typedef EGLDeviceEXT (EGLAPIENTRYP PFNEGLCREATEDEVICEANGLEPROC) (EGLint device_type, void *native_device, const EGLAttrib *attrib_list);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLRELEASEDEVICEANGLEPROC) (EGLDeviceEXT device);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLDeviceEXT EGLAPIENTRY eglCreateDeviceANGLE (EGLint device_type, void *native_device, const EGLAttrib *attrib_list);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglReleaseDeviceANGLE (EGLDeviceEXT device);
|
||||
#endif
|
||||
#endif /* EGL_ANGLE_device_creation */
|
||||
|
||||
#ifndef EGL_EXT_device_drm
|
||||
#define EGL_EXT_device_drm 1
|
||||
#define EGL_DRM_DEVICE_FILE_EXT 0x3233
|
||||
@ -597,6 +646,36 @@ EGLAPI EGLBoolean EGLAPIENTRY eglReleaseDeviceANGLE (EGLDeviceEXT device);
|
||||
#define EGL_EXT_device_query 1
|
||||
#endif /* EGL_EXT_device_query */
|
||||
|
||||
#ifndef EGL_EXT_gl_colorspace_bt2020_linear
|
||||
#define EGL_EXT_gl_colorspace_bt2020_linear 1
|
||||
#define EGL_GL_COLORSPACE_BT2020_LINEAR_EXT 0x333F
|
||||
#endif /* EGL_EXT_gl_colorspace_bt2020_linear */
|
||||
|
||||
#ifndef EGL_EXT_gl_colorspace_bt2020_pq
|
||||
#define EGL_EXT_gl_colorspace_bt2020_pq 1
|
||||
#define EGL_GL_COLORSPACE_BT2020_PQ_EXT 0x3340
|
||||
#endif /* EGL_EXT_gl_colorspace_bt2020_pq */
|
||||
|
||||
#ifndef EGL_EXT_gl_colorspace_display_p3
|
||||
#define EGL_EXT_gl_colorspace_display_p3 1
|
||||
#define EGL_GL_COLORSPACE_DISPLAY_P3_EXT 0x3363
|
||||
#endif /* EGL_EXT_gl_colorspace_display_p3 */
|
||||
|
||||
#ifndef EGL_EXT_gl_colorspace_display_p3_linear
|
||||
#define EGL_EXT_gl_colorspace_display_p3_linear 1
|
||||
#define EGL_GL_COLORSPACE_DISPLAY_P3_LINEAR_EXT 0x3362
|
||||
#endif /* EGL_EXT_gl_colorspace_display_p3_linear */
|
||||
|
||||
#ifndef EGL_EXT_gl_colorspace_scrgb
|
||||
#define EGL_EXT_gl_colorspace_scrgb 1
|
||||
#define EGL_GL_COLORSPACE_SCRGB_EXT 0x3351
|
||||
#endif /* EGL_EXT_gl_colorspace_scrgb */
|
||||
|
||||
#ifndef EGL_EXT_gl_colorspace_scrgb_linear
|
||||
#define EGL_EXT_gl_colorspace_scrgb_linear 1
|
||||
#define EGL_GL_COLORSPACE_SCRGB_LINEAR_EXT 0x3350
|
||||
#endif /* EGL_EXT_gl_colorspace_scrgb_linear */
|
||||
|
||||
#ifndef EGL_EXT_image_dma_buf_import
|
||||
#define EGL_EXT_image_dma_buf_import 1
|
||||
#define EGL_LINUX_DMA_BUF_EXT 0x3270
|
||||
@ -623,6 +702,34 @@ EGLAPI EGLBoolean EGLAPIENTRY eglReleaseDeviceANGLE (EGLDeviceEXT device);
|
||||
#define EGL_YUV_CHROMA_SITING_0_5_EXT 0x3285
|
||||
#endif /* EGL_EXT_image_dma_buf_import */
|
||||
|
||||
#ifndef EGL_EXT_image_dma_buf_import_modifiers
|
||||
#define EGL_EXT_image_dma_buf_import_modifiers 1
|
||||
#define EGL_DMA_BUF_PLANE3_FD_EXT 0x3440
|
||||
#define EGL_DMA_BUF_PLANE3_OFFSET_EXT 0x3441
|
||||
#define EGL_DMA_BUF_PLANE3_PITCH_EXT 0x3442
|
||||
#define EGL_DMA_BUF_PLANE0_MODIFIER_LO_EXT 0x3443
|
||||
#define EGL_DMA_BUF_PLANE0_MODIFIER_HI_EXT 0x3444
|
||||
#define EGL_DMA_BUF_PLANE1_MODIFIER_LO_EXT 0x3445
|
||||
#define EGL_DMA_BUF_PLANE1_MODIFIER_HI_EXT 0x3446
|
||||
#define EGL_DMA_BUF_PLANE2_MODIFIER_LO_EXT 0x3447
|
||||
#define EGL_DMA_BUF_PLANE2_MODIFIER_HI_EXT 0x3448
|
||||
#define EGL_DMA_BUF_PLANE3_MODIFIER_LO_EXT 0x3449
|
||||
#define EGL_DMA_BUF_PLANE3_MODIFIER_HI_EXT 0x344A
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDMABUFFORMATSEXTPROC) (EGLDisplay dpy, EGLint max_formats, EGLint *formats, EGLint *num_formats);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDMABUFMODIFIERSEXTPROC) (EGLDisplay dpy, EGLint format, EGLint max_modifiers, EGLuint64KHR *modifiers, EGLBoolean *external_only, EGLint *num_modifiers);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglQueryDmaBufFormatsEXT (EGLDisplay dpy, EGLint max_formats, EGLint *formats, EGLint *num_formats);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglQueryDmaBufModifiersEXT (EGLDisplay dpy, EGLint format, EGLint max_modifiers, EGLuint64KHR *modifiers, EGLBoolean *external_only, EGLint *num_modifiers);
|
||||
#endif
|
||||
#endif /* EGL_EXT_image_dma_buf_import_modifiers */
|
||||
|
||||
#ifndef EGL_EXT_image_implicit_sync_control
|
||||
#define EGL_EXT_image_implicit_sync_control 1
|
||||
#define EGL_IMPORT_SYNC_TYPE_EXT 0x3470
|
||||
#define EGL_IMPORT_IMPLICIT_SYNC_EXT 0x3471
|
||||
#define EGL_IMPORT_EXPLICIT_SYNC_EXT 0x3472
|
||||
#endif /* EGL_EXT_image_implicit_sync_control */
|
||||
|
||||
#ifndef EGL_EXT_multiview_window
|
||||
#define EGL_EXT_multiview_window 1
|
||||
#define EGL_MULTIVIEW_VIEW_COUNT_EXT 0x3134
|
||||
@ -632,8 +739,8 @@ EGLAPI EGLBoolean EGLAPIENTRY eglReleaseDeviceANGLE (EGLDeviceEXT device);
|
||||
#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_NO_OUTPUT_LAYER_EXT EGL_CAST(EGLOutputLayerEXT,0)
|
||||
#define EGL_NO_OUTPUT_PORT_EXT EGL_CAST(EGLOutputPortEXT,0)
|
||||
#define EGL_BAD_OUTPUT_LAYER_EXT 0x322D
|
||||
#define EGL_BAD_OUTPUT_PORT_EXT 0x322E
|
||||
#define EGL_SWAP_INTERVAL_EXT 0x322F
|
||||
@ -670,6 +777,13 @@ EGLAPI const char *EGLAPIENTRY eglQueryOutputPortStringEXT (EGLDisplay dpy, EGLO
|
||||
#define EGL_OPENWF_PORT_ID_EXT 0x3239
|
||||
#endif /* EGL_EXT_output_openwf */
|
||||
|
||||
#ifndef EGL_EXT_pixel_format_float
|
||||
#define EGL_EXT_pixel_format_float 1
|
||||
#define EGL_COLOR_COMPONENT_TYPE_EXT 0x3339
|
||||
#define EGL_COLOR_COMPONENT_TYPE_FIXED_EXT 0x333A
|
||||
#define EGL_COLOR_COMPONENT_TYPE_FLOAT_EXT 0x333B
|
||||
#endif /* EGL_EXT_pixel_format_float */
|
||||
|
||||
#ifndef EGL_EXT_platform_base
|
||||
#define EGL_EXT_platform_base 1
|
||||
typedef EGLDisplay (EGLAPIENTRYP PFNEGLGETPLATFORMDISPLAYEXTPROC) (EGLenum platform, void *native_display, const EGLint *attrib_list);
|
||||
@ -698,9 +812,13 @@ EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformPixmapSurfaceEXT (EGLDisplay dpy,
|
||||
#define EGL_PLATFORM_X11_SCREEN_EXT 0x31D6
|
||||
#endif /* EGL_EXT_platform_x11 */
|
||||
|
||||
#ifndef EGL_EXT_protected_content
|
||||
#define EGL_EXT_protected_content 1
|
||||
#define EGL_PROTECTED_CONTENT_EXT 0x32C0
|
||||
#endif /* EGL_EXT_protected_content */
|
||||
|
||||
#ifndef EGL_EXT_protected_surface
|
||||
#define EGL_EXT_protected_surface 1
|
||||
#define EGL_PROTECTED_CONTENT_EXT 0x32C0
|
||||
#endif /* EGL_EXT_protected_surface */
|
||||
|
||||
#ifndef EGL_EXT_stream_consumer_egloutput
|
||||
@ -711,6 +829,27 @@ EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerOutputEXT (EGLDisplay dpy, EGLStr
|
||||
#endif
|
||||
#endif /* EGL_EXT_stream_consumer_egloutput */
|
||||
|
||||
#ifndef EGL_EXT_surface_CTA861_3_metadata
|
||||
#define EGL_EXT_surface_CTA861_3_metadata 1
|
||||
#define EGL_CTA861_3_MAX_CONTENT_LIGHT_LEVEL_EXT 0x3360
|
||||
#define EGL_CTA861_3_MAX_FRAME_AVERAGE_LEVEL_EXT 0x3361
|
||||
#endif /* EGL_EXT_surface_CTA861_3_metadata */
|
||||
|
||||
#ifndef EGL_EXT_surface_SMPTE2086_metadata
|
||||
#define EGL_EXT_surface_SMPTE2086_metadata 1
|
||||
#define EGL_SMPTE2086_DISPLAY_PRIMARY_RX_EXT 0x3341
|
||||
#define EGL_SMPTE2086_DISPLAY_PRIMARY_RY_EXT 0x3342
|
||||
#define EGL_SMPTE2086_DISPLAY_PRIMARY_GX_EXT 0x3343
|
||||
#define EGL_SMPTE2086_DISPLAY_PRIMARY_GY_EXT 0x3344
|
||||
#define EGL_SMPTE2086_DISPLAY_PRIMARY_BX_EXT 0x3345
|
||||
#define EGL_SMPTE2086_DISPLAY_PRIMARY_BY_EXT 0x3346
|
||||
#define EGL_SMPTE2086_WHITE_POINT_X_EXT 0x3347
|
||||
#define EGL_SMPTE2086_WHITE_POINT_Y_EXT 0x3348
|
||||
#define EGL_SMPTE2086_MAX_LUMINANCE_EXT 0x3349
|
||||
#define EGL_SMPTE2086_MIN_LUMINANCE_EXT 0x334A
|
||||
#define EGL_METADATA_SCALING_EXT 50000
|
||||
#endif /* EGL_EXT_surface_SMPTE2086_metadata */
|
||||
|
||||
#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);
|
||||
@ -779,6 +918,12 @@ EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurfaceHI (EGLDisplay dpy, EGLConfi
|
||||
#define EGL_CONTEXT_PRIORITY_LOW_IMG 0x3103
|
||||
#endif /* EGL_IMG_context_priority */
|
||||
|
||||
#ifndef EGL_IMG_image_plane_attribs
|
||||
#define EGL_IMG_image_plane_attribs 1
|
||||
#define EGL_NATIVE_BUFFER_MULTIPLANE_SEPARATE_IMG 0x3105
|
||||
#define EGL_NATIVE_BUFFER_PLANE_OFFSET_IMG 0x3106
|
||||
#endif /* EGL_IMG_image_plane_attribs */
|
||||
|
||||
#ifndef EGL_MESA_drm_image
|
||||
#define EGL_MESA_drm_image 1
|
||||
#define EGL_DRM_BUFFER_FORMAT_MESA 0x31D0
|
||||
@ -811,6 +956,11 @@ EGLAPI EGLBoolean EGLAPIENTRY eglExportDMABUFImageMESA (EGLDisplay dpy, EGLImage
|
||||
#define EGL_PLATFORM_GBM_MESA 0x31D7
|
||||
#endif /* EGL_MESA_platform_gbm */
|
||||
|
||||
#ifndef EGL_MESA_platform_surfaceless
|
||||
#define EGL_MESA_platform_surfaceless 1
|
||||
#define EGL_PLATFORM_SURFACELESS_MESA 0x31DD
|
||||
#endif /* EGL_MESA_platform_surfaceless */
|
||||
|
||||
#ifndef EGL_NOK_swap_region
|
||||
#define EGL_NOK_swap_region 1
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSREGIONNOKPROC) (EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint *rects);
|
||||
@ -894,6 +1044,129 @@ EGLAPI EGLBoolean EGLAPIENTRY eglPostSubBufferNV (EGLDisplay dpy, EGLSurface sur
|
||||
#endif
|
||||
#endif /* EGL_NV_post_sub_buffer */
|
||||
|
||||
#ifndef EGL_NV_robustness_video_memory_purge
|
||||
#define EGL_NV_robustness_video_memory_purge 1
|
||||
#define EGL_GENERATE_RESET_ON_VIDEO_MEMORY_PURGE_NV 0x334C
|
||||
#endif /* EGL_NV_robustness_video_memory_purge */
|
||||
|
||||
#ifndef EGL_NV_stream_consumer_gltexture_yuv
|
||||
#define EGL_NV_stream_consumer_gltexture_yuv 1
|
||||
#define EGL_YUV_PLANE0_TEXTURE_UNIT_NV 0x332C
|
||||
#define EGL_YUV_PLANE1_TEXTURE_UNIT_NV 0x332D
|
||||
#define EGL_YUV_PLANE2_TEXTURE_UNIT_NV 0x332E
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALATTRIBSNVPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLAttrib *attrib_list);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerGLTextureExternalAttribsNV (EGLDisplay dpy, EGLStreamKHR stream, EGLAttrib *attrib_list);
|
||||
#endif
|
||||
#endif /* EGL_NV_stream_consumer_gltexture_yuv */
|
||||
|
||||
#ifndef EGL_NV_stream_cross_display
|
||||
#define EGL_NV_stream_cross_display 1
|
||||
#define EGL_STREAM_CROSS_DISPLAY_NV 0x334E
|
||||
#endif /* EGL_NV_stream_cross_display */
|
||||
|
||||
#ifndef EGL_NV_stream_cross_object
|
||||
#define EGL_NV_stream_cross_object 1
|
||||
#define EGL_STREAM_CROSS_OBJECT_NV 0x334D
|
||||
#endif /* EGL_NV_stream_cross_object */
|
||||
|
||||
#ifndef EGL_NV_stream_cross_partition
|
||||
#define EGL_NV_stream_cross_partition 1
|
||||
#define EGL_STREAM_CROSS_PARTITION_NV 0x323F
|
||||
#endif /* EGL_NV_stream_cross_partition */
|
||||
|
||||
#ifndef EGL_NV_stream_cross_process
|
||||
#define EGL_NV_stream_cross_process 1
|
||||
#define EGL_STREAM_CROSS_PROCESS_NV 0x3245
|
||||
#endif /* EGL_NV_stream_cross_process */
|
||||
|
||||
#ifndef EGL_NV_stream_cross_system
|
||||
#define EGL_NV_stream_cross_system 1
|
||||
#define EGL_STREAM_CROSS_SYSTEM_NV 0x334F
|
||||
#endif /* EGL_NV_stream_cross_system */
|
||||
|
||||
#ifndef EGL_NV_stream_fifo_next
|
||||
#define EGL_NV_stream_fifo_next 1
|
||||
#define EGL_PENDING_FRAME_NV 0x3329
|
||||
#define EGL_STREAM_TIME_PENDING_NV 0x332A
|
||||
#endif /* EGL_NV_stream_fifo_next */
|
||||
|
||||
#ifndef EGL_NV_stream_fifo_synchronous
|
||||
#define EGL_NV_stream_fifo_synchronous 1
|
||||
#define EGL_STREAM_FIFO_SYNCHRONOUS_NV 0x3336
|
||||
#endif /* EGL_NV_stream_fifo_synchronous */
|
||||
|
||||
#ifndef EGL_NV_stream_frame_limits
|
||||
#define EGL_NV_stream_frame_limits 1
|
||||
#define EGL_PRODUCER_MAX_FRAME_HINT_NV 0x3337
|
||||
#define EGL_CONSUMER_MAX_FRAME_HINT_NV 0x3338
|
||||
#endif /* EGL_NV_stream_frame_limits */
|
||||
|
||||
#ifndef EGL_NV_stream_metadata
|
||||
#define EGL_NV_stream_metadata 1
|
||||
#define EGL_MAX_STREAM_METADATA_BLOCKS_NV 0x3250
|
||||
#define EGL_MAX_STREAM_METADATA_BLOCK_SIZE_NV 0x3251
|
||||
#define EGL_MAX_STREAM_METADATA_TOTAL_SIZE_NV 0x3252
|
||||
#define EGL_PRODUCER_METADATA_NV 0x3253
|
||||
#define EGL_CONSUMER_METADATA_NV 0x3254
|
||||
#define EGL_PENDING_METADATA_NV 0x3328
|
||||
#define EGL_METADATA0_SIZE_NV 0x3255
|
||||
#define EGL_METADATA1_SIZE_NV 0x3256
|
||||
#define EGL_METADATA2_SIZE_NV 0x3257
|
||||
#define EGL_METADATA3_SIZE_NV 0x3258
|
||||
#define EGL_METADATA0_TYPE_NV 0x3259
|
||||
#define EGL_METADATA1_TYPE_NV 0x325A
|
||||
#define EGL_METADATA2_TYPE_NV 0x325B
|
||||
#define EGL_METADATA3_TYPE_NV 0x325C
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDISPLAYATTRIBNVPROC) (EGLDisplay dpy, EGLint attribute, EGLAttrib *value);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSETSTREAMMETADATANVPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLint n, EGLint offset, EGLint size, const void *data);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMMETADATANVPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum name, EGLint n, EGLint offset, EGLint size, void *data);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglQueryDisplayAttribNV (EGLDisplay dpy, EGLint attribute, EGLAttrib *value);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglSetStreamMetadataNV (EGLDisplay dpy, EGLStreamKHR stream, EGLint n, EGLint offset, EGLint size, const void *data);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamMetadataNV (EGLDisplay dpy, EGLStreamKHR stream, EGLenum name, EGLint n, EGLint offset, EGLint size, void *data);
|
||||
#endif
|
||||
#endif /* EGL_NV_stream_metadata */
|
||||
|
||||
#ifndef EGL_NV_stream_remote
|
||||
#define EGL_NV_stream_remote 1
|
||||
#define EGL_STREAM_STATE_INITIALIZING_NV 0x3240
|
||||
#define EGL_STREAM_TYPE_NV 0x3241
|
||||
#define EGL_STREAM_PROTOCOL_NV 0x3242
|
||||
#define EGL_STREAM_ENDPOINT_NV 0x3243
|
||||
#define EGL_STREAM_LOCAL_NV 0x3244
|
||||
#define EGL_STREAM_PRODUCER_NV 0x3247
|
||||
#define EGL_STREAM_CONSUMER_NV 0x3248
|
||||
#define EGL_STREAM_PROTOCOL_FD_NV 0x3246
|
||||
#endif /* EGL_NV_stream_remote */
|
||||
|
||||
#ifndef EGL_NV_stream_reset
|
||||
#define EGL_NV_stream_reset 1
|
||||
#define EGL_SUPPORT_RESET_NV 0x3334
|
||||
#define EGL_SUPPORT_REUSE_NV 0x3335
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLRESETSTREAMNVPROC) (EGLDisplay dpy, EGLStreamKHR stream);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglResetStreamNV (EGLDisplay dpy, EGLStreamKHR stream);
|
||||
#endif
|
||||
#endif /* EGL_NV_stream_reset */
|
||||
|
||||
#ifndef EGL_NV_stream_socket
|
||||
#define EGL_NV_stream_socket 1
|
||||
#define EGL_STREAM_PROTOCOL_SOCKET_NV 0x324B
|
||||
#define EGL_SOCKET_HANDLE_NV 0x324C
|
||||
#define EGL_SOCKET_TYPE_NV 0x324D
|
||||
#endif /* EGL_NV_stream_socket */
|
||||
|
||||
#ifndef EGL_NV_stream_socket_inet
|
||||
#define EGL_NV_stream_socket_inet 1
|
||||
#define EGL_SOCKET_TYPE_INET_NV 0x324F
|
||||
#endif /* EGL_NV_stream_socket_inet */
|
||||
|
||||
#ifndef EGL_NV_stream_socket_unix
|
||||
#define EGL_NV_stream_socket_unix 1
|
||||
#define EGL_SOCKET_TYPE_UNIX_NV 0x324E
|
||||
#endif /* EGL_NV_stream_socket_unix */
|
||||
|
||||
#ifndef EGL_NV_stream_sync
|
||||
#define EGL_NV_stream_sync 1
|
||||
#define EGL_SYNC_NEW_FRAME_NV 0x321F
|
||||
@ -920,7 +1193,7 @@ typedef khronos_utime_nanoseconds_t EGLTimeNV;
|
||||
#define EGL_SYNC_TYPE_NV 0x30ED
|
||||
#define EGL_SYNC_CONDITION_NV 0x30EE
|
||||
#define EGL_SYNC_FENCE_NV 0x30EF
|
||||
#define EGL_NO_SYNC_NV ((EGLSyncNV)0)
|
||||
#define EGL_NO_SYNC_NV EGL_CAST(EGLSyncNV,0)
|
||||
typedef EGLSyncNV (EGLAPIENTRYP PFNEGLCREATEFENCESYNCNVPROC) (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCNVPROC) (EGLSyncNV sync);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLFENCENVPROC) (EGLSyncNV sync);
|
||||
@ -961,6 +1234,9 @@ EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeNV (void);
|
||||
#define EGL_NATIVE_SURFACE_TIZEN 0x32A1
|
||||
#endif /* EGL_TIZEN_image_native_surface */
|
||||
|
||||
/* ANGLE EGL extensions */
|
||||
#include "eglext_angle.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
170
src/3rdparty/angle/include/EGL/eglext_angle.h
vendored
Normal file
170
src/3rdparty/angle/include/EGL/eglext_angle.h
vendored
Normal file
@ -0,0 +1,170 @@
|
||||
//
|
||||
// Copyright (c) 2017 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.
|
||||
//
|
||||
// eglext_angle.h: ANGLE modifications to the eglext.h header file.
|
||||
// Currently we don't include this file directly, we patch eglext.h
|
||||
// to include it implicitly so it is visible throughout our code.
|
||||
|
||||
#ifndef INCLUDE_EGL_EGLEXT_ANGLE_
|
||||
#define INCLUDE_EGL_EGLEXT_ANGLE_
|
||||
|
||||
// clang-format off
|
||||
|
||||
#ifndef EGL_ANGLE_robust_resource_initialization
|
||||
#define EGL_ANGLE_robust_resource_initialization 1
|
||||
#define EGL_ROBUST_RESOURCE_INITIALIZATION_ANGLE 0x3453
|
||||
#endif /* EGL_ANGLE_robust_resource_initialization */
|
||||
|
||||
#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_d3d_texture_client_buffer
|
||||
#define EGL_ANGLE_d3d_texture_client_buffer 1
|
||||
#define EGL_D3D_TEXTURE_ANGLE 0x33A3
|
||||
#endif /* EGL_ANGLE_d3d_texture_client_buffer */
|
||||
|
||||
#ifndef EGL_ANGLE_software_display
|
||||
#define EGL_ANGLE_software_display 1
|
||||
#define EGL_SOFTWARE_DISPLAY_ANGLE ((EGLNativeDisplayType)-1)
|
||||
#endif /* EGL_ANGLE_software_display */
|
||||
|
||||
#ifndef EGL_ANGLE_direct3d_display
|
||||
#define EGL_ANGLE_direct3d_display 1
|
||||
#define EGL_D3D11_ELSE_D3D9_DISPLAY_ANGLE ((EGLNativeDisplayType)-2)
|
||||
#define EGL_D3D11_ONLY_DISPLAY_ANGLE ((EGLNativeDisplayType)-3)
|
||||
#endif /* EGL_ANGLE_direct3d_display */
|
||||
|
||||
#ifndef EGL_ANGLE_direct_composition
|
||||
#define EGL_ANGLE_direct_composition 1
|
||||
#define EGL_DIRECT_COMPOSITION_ANGLE 0x33A5
|
||||
#endif /* EGL_ANGLE_direct_composition */
|
||||
|
||||
#ifndef EGL_ANGLE_platform_angle
|
||||
#define EGL_ANGLE_platform_angle 1
|
||||
#define EGL_PLATFORM_ANGLE_ANGLE 0x3202
|
||||
#define EGL_PLATFORM_ANGLE_TYPE_ANGLE 0x3203
|
||||
#define EGL_PLATFORM_ANGLE_MAX_VERSION_MAJOR_ANGLE 0x3204
|
||||
#define EGL_PLATFORM_ANGLE_MAX_VERSION_MINOR_ANGLE 0x3205
|
||||
#define EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE 0x3206
|
||||
#define EGL_PLATFORM_ANGLE_DEBUG_LAYERS_ENABLED_ANGLE 0x3451
|
||||
#endif /* EGL_ANGLE_platform_angle */
|
||||
|
||||
#ifndef EGL_ANGLE_platform_angle_d3d
|
||||
#define EGL_ANGLE_platform_angle_d3d 1
|
||||
#define EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE 0x3207
|
||||
#define EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE 0x3208
|
||||
#define EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE 0x3209
|
||||
#define EGL_PLATFORM_ANGLE_DEVICE_TYPE_HARDWARE_ANGLE 0x320A
|
||||
#define EGL_PLATFORM_ANGLE_DEVICE_TYPE_WARP_ANGLE 0x320B
|
||||
#define EGL_PLATFORM_ANGLE_DEVICE_TYPE_REFERENCE_ANGLE 0x320C
|
||||
#define EGL_PLATFORM_ANGLE_ENABLE_AUTOMATIC_TRIM_ANGLE 0x320F
|
||||
#endif /* EGL_ANGLE_platform_angle_d3d */
|
||||
|
||||
#ifndef EGL_ANGLE_platform_angle_opengl
|
||||
#define EGL_ANGLE_platform_angle_opengl 1
|
||||
#define EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE 0x320D
|
||||
#define EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE 0x320E
|
||||
#endif /* EGL_ANGLE_platform_angle_opengl */
|
||||
|
||||
#ifndef EGL_ANGLE_platform_angle_null
|
||||
#define EGL_ANGLE_platform_angle_null 1
|
||||
#define EGL_PLATFORM_ANGLE_TYPE_NULL_ANGLE 0x33AE
|
||||
#endif /* EGL_ANGLE_platform_angle_null */
|
||||
|
||||
#ifndef EGL_ANGLE_platform_angle_vulkan
|
||||
#define EGL_ANGLE_platform_angle_vulkan 1
|
||||
#define EGL_PLATFORM_ANGLE_TYPE_VULKAN_ANGLE 0x3450
|
||||
#endif /* EGL_ANGLE_platform_angle_vulkan */
|
||||
|
||||
#ifndef EGL_ANGLE_x11_visual
|
||||
#define EGL_ANGLE_x11_visual
|
||||
#define EGL_X11_VISUAL_ID_ANGLE 0x33A3
|
||||
#endif /* EGL_ANGLE_x11_visual */
|
||||
|
||||
#ifndef EGL_ANGLE_flexible_surface_compatibility
|
||||
#define EGL_ANGLE_flexible_surface_compatibility 1
|
||||
#define EGL_FLEXIBLE_SURFACE_COMPATIBILITY_SUPPORTED_ANGLE 0x33A6
|
||||
#endif /* EGL_ANGLE_flexible_surface_compatibility */
|
||||
|
||||
#ifndef EGL_ANGLE_surface_orientation
|
||||
#define EGL_ANGLE_surface_orientation
|
||||
#define EGL_OPTIMAL_SURFACE_ORIENTATION_ANGLE 0x33A7
|
||||
#define EGL_SURFACE_ORIENTATION_ANGLE 0x33A8
|
||||
#define EGL_SURFACE_ORIENTATION_INVERT_X_ANGLE 0x0001
|
||||
#define EGL_SURFACE_ORIENTATION_INVERT_Y_ANGLE 0x0002
|
||||
#endif /* EGL_ANGLE_surface_orientation */
|
||||
|
||||
#ifndef EGL_ANGLE_experimental_present_path
|
||||
#define EGL_ANGLE_experimental_present_path
|
||||
#define EGL_EXPERIMENTAL_PRESENT_PATH_ANGLE 0x33A4
|
||||
#define EGL_EXPERIMENTAL_PRESENT_PATH_FAST_ANGLE 0x33A9
|
||||
#define EGL_EXPERIMENTAL_PRESENT_PATH_COPY_ANGLE 0x33AA
|
||||
#endif /* EGL_ANGLE_experimental_present_path */
|
||||
|
||||
#ifndef EGL_ANGLE_stream_producer_d3d_texture_nv12
|
||||
#define EGL_ANGLE_stream_producer_d3d_texture_nv12
|
||||
#define EGL_D3D_TEXTURE_SUBRESOURCE_ID_ANGLE 0x33AB
|
||||
typedef EGLBoolean(EGLAPIENTRYP PFNEGLCREATESTREAMPRODUCERD3DTEXTURENV12ANGLEPROC)(EGLDisplay dpy, EGLStreamKHR stream, const EGLAttrib *attrib_list);
|
||||
typedef EGLBoolean(EGLAPIENTRYP PFNEGLSTREAMPOSTD3DTEXTURENV12ANGLEPROC)(EGLDisplay dpy, EGLStreamKHR stream, void *texture, const EGLAttrib *attrib_list);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglCreateStreamProducerD3DTextureNV12ANGLE(EGLDisplay dpy, EGLStreamKHR stream, const EGLAttrib *attrib_list);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglStreamPostD3DTextureNV12ANGLE(EGLDisplay dpy, EGLStreamKHR stream, void *texture, const EGLAttrib *attrib_list);
|
||||
#endif
|
||||
#endif /* EGL_ANGLE_stream_producer_d3d_texture_nv12 */
|
||||
|
||||
#ifndef EGL_ANGLE_create_context_webgl_compatibility
|
||||
#define EGL_ANGLE_create_context_webgl_compatibility 1
|
||||
#define EGL_CONTEXT_WEBGL_COMPATIBILITY_ANGLE 0x3AAC
|
||||
#endif /* EGL_ANGLE_create_context_webgl_compatibility */
|
||||
|
||||
#ifndef EGL_ANGLE_display_texture_share_group
|
||||
#define EGL_ANGLE_display_texture_share_group 1
|
||||
#define EGL_DISPLAY_TEXTURE_SHARE_GROUP_ANGLE 0x3AAF
|
||||
#endif /* EGL_ANGLE_display_texture_share_group */
|
||||
|
||||
#ifndef EGL_CHROMIUM_create_context_bind_generates_resource
|
||||
#define EGL_CHROMIUM_create_context_bind_generates_resource 1
|
||||
#define EGL_CONTEXT_BIND_GENERATES_RESOURCE_CHROMIUM 0x3AAD
|
||||
#endif /* EGL_CHROMIUM_create_context_bind_generates_resource */
|
||||
|
||||
#ifndef EGL_ANGLE_create_context_client_arrays
|
||||
#define EGL_ANGLE_create_context_client_arrays 1
|
||||
#define EGL_CONTEXT_CLIENT_ARRAYS_ENABLED_ANGLE 0x3452
|
||||
#endif /* EGL_ANGLE_create_context_client_arrays */
|
||||
|
||||
#ifndef EGL_ANGLE_device_creation
|
||||
#define EGL_ANGLE_device_creation 1
|
||||
typedef EGLDeviceEXT(EGLAPIENTRYP PFNEGLCREATEDEVICEANGLEPROC) (EGLint device_type, void *native_device, const EGLAttrib *attrib_list);
|
||||
typedef EGLBoolean(EGLAPIENTRYP PFNEGLRELEASEDEVICEANGLEPROC) (EGLDeviceEXT device);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLDeviceEXT EGLAPIENTRY eglCreateDeviceANGLE(EGLint device_type, void *native_device, const EGLAttrib *attrib_list);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglReleaseDeviceANGLE(EGLDeviceEXT device);
|
||||
#endif
|
||||
#endif /* EGL_ANGLE_device_creation */
|
||||
|
||||
#ifndef EGL_ANGLE_program_cache_control
|
||||
#define EGL_ANGLE_program_cache_control 1
|
||||
#define EGL_PROGRAM_CACHE_SIZE_ANGLE 0x3455
|
||||
#define EGL_PROGRAM_CACHE_KEY_LENGTH_ANGLE 0x3456
|
||||
#define EGL_PROGRAM_CACHE_RESIZE_ANGLE 0x3457
|
||||
#define EGL_PROGRAM_CACHE_TRIM_ANGLE 0x3458
|
||||
#define EGL_CONTEXT_PROGRAM_BINARY_CACHE_ENABLED_ANGLE 0x3459
|
||||
typedef EGLint (EGLAPIENTRYP PFNEGLPROGRAMCACHEGETATTRIBANGLEPROC) (EGLDisplay dpy, EGLenum attrib);
|
||||
typedef void (EGLAPIENTRYP PFNEGLPROGRAMCACHEQUERYANGLEPROC) (EGLDisplay dpy, EGLint index, void *key, EGLint *keysize, void *binary, EGLint *binarysize);
|
||||
typedef void (EGLAPIENTRYP PFNEGPROGRAMCACHELPOPULATEANGLEPROC) (EGLDisplay dpy, const void *key, EGLint keysize, const void *binary, EGLint binarysize);
|
||||
typedef EGLint (EGLAPIENTRYP PFNEGLPROGRAMCACHERESIZEANGLEPROC) (EGLDisplay dpy, EGLint limit, EGLenum mode);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLint EGLAPIENTRY eglProgramCacheGetAttribANGLE(EGLDisplay dpy, EGLenum attrib);
|
||||
EGLAPI void EGLAPIENTRY eglProgramCacheQueryANGLE(EGLDisplay dpy, EGLint index, void *key, EGLint *keysize, void *binary, EGLint *binarysize);
|
||||
EGLAPI void EGLAPIENTRY eglProgramCachePopulateANGLE(EGLDisplay dpy, const void *key, EGLint keysize, const void *binary, EGLint binarysize);
|
||||
EGLAPI EGLint EGLAPIENTRY eglProgramCacheResizeANGLE(EGLDisplay dpy, EGLint limit, EGLenum mode);
|
||||
#endif
|
||||
#endif /* EGL_ANGLE_program_cache_control */
|
||||
|
||||
// clang-format on
|
||||
|
||||
#endif // INCLUDE_EGL_EGLEXT_ANGLE_
|
31
src/3rdparty/angle/include/EGL/eglplatform.h
vendored
31
src/3rdparty/angle/include/EGL/eglplatform.h
vendored
@ -2,7 +2,7 @@
|
||||
#define __eglplatform_h_
|
||||
|
||||
/*
|
||||
** Copyright (c) 2007-2013 The Khronos Group Inc.
|
||||
** Copyright (c) 2007-2016 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
|
||||
@ -83,7 +83,8 @@ typedef HWND EGLNativeWindowType;
|
||||
typedef IInspectable* EGLNativeWindowType;
|
||||
#endif
|
||||
|
||||
#elif defined(__WINSCW__) || defined(__SYMBIAN32__) /* Symbian */
|
||||
#elif defined(__APPLE__) || defined(__WINSCW__) || defined(__SYMBIAN32__) || \
|
||||
defined(__Fuchsia__) || defined(__HAIKU__)
|
||||
|
||||
typedef int EGLNativeDisplayType;
|
||||
typedef void *EGLNativeWindowType;
|
||||
@ -105,6 +106,12 @@ typedef intptr_t EGLNativeDisplayType;
|
||||
typedef intptr_t EGLNativeWindowType;
|
||||
typedef intptr_t EGLNativePixmapType;
|
||||
|
||||
#elif defined(WL_EGL_PLATFORM)
|
||||
|
||||
typedef struct wl_display *EGLNativeDisplayType;
|
||||
typedef struct wl_egl_pixmap *EGLNativePixmapType;
|
||||
typedef struct wl_egl_window *EGLNativeWindowType;
|
||||
|
||||
#elif defined(__unix__)
|
||||
|
||||
/* X11 (tentative) */
|
||||
@ -115,18 +122,6 @@ typedef Display *EGLNativeDisplayType;
|
||||
typedef Pixmap EGLNativePixmapType;
|
||||
typedef Window EGLNativeWindowType;
|
||||
|
||||
#elif defined(__GNUC__) && ( defined(__APPLE_CPP__) || defined(__APPLE_CC__) || defined(__MACOS_CLASSIC__) )
|
||||
|
||||
#if defined(__OBJC__)
|
||||
@class CALayer;
|
||||
#else
|
||||
class CALayer;
|
||||
#endif
|
||||
|
||||
typedef void *EGLNativeDisplayType;
|
||||
typedef void *EGLNativePixmapType;
|
||||
typedef CALayer *EGLNativeWindowType;
|
||||
|
||||
#else
|
||||
#error "Platform not recognized"
|
||||
#endif
|
||||
@ -146,4 +141,12 @@ typedef EGLNativeWindowType NativeWindowType;
|
||||
*/
|
||||
typedef khronos_int32_t EGLint;
|
||||
|
||||
|
||||
/* C++ / C typecast macros for special EGL handle values */
|
||||
#if defined(__cplusplus)
|
||||
#define EGL_CAST(type, value) (static_cast<type>(value))
|
||||
#else
|
||||
#define EGL_CAST(type, value) ((type) (value))
|
||||
#endif
|
||||
|
||||
#endif /* __eglplatform_h */
|
||||
|
14
src/3rdparty/angle/include/GLES2/gl2.h
vendored
14
src/3rdparty/angle/include/GLES2/gl2.h
vendored
@ -6,7 +6,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Copyright (c) 2013-2015 The Khronos Group Inc.
|
||||
** Copyright (c) 2013-2017 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
|
||||
@ -31,9 +31,7 @@ extern "C" {
|
||||
** 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) $
|
||||
** https://github.com/KhronosGroup/OpenGL-Registry
|
||||
*/
|
||||
|
||||
#include <GLES2/gl2platform.h>
|
||||
@ -42,7 +40,11 @@ extern "C" {
|
||||
#define GL_APIENTRYP GL_APIENTRY*
|
||||
#endif
|
||||
|
||||
/* Generated on date 20150809 */
|
||||
#ifndef GL_GLES_PROTOTYPES
|
||||
#define GL_GLES_PROTOTYPES 1
|
||||
#endif
|
||||
|
||||
/* Generated on date 20170325 */
|
||||
|
||||
/* Generated C header for:
|
||||
* API: gles2
|
||||
@ -520,7 +522,7 @@ typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB4FPROC) (GLuint index, GLfloat x, GL
|
||||
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
|
||||
#if GL_GLES_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);
|
||||
|
544
src/3rdparty/angle/include/GLES2/gl2ext.h
vendored
544
src/3rdparty/angle/include/GLES2/gl2ext.h
vendored
@ -6,7 +6,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Copyright (c) 2013-2015 The Khronos Group Inc.
|
||||
** Copyright (c) 2013-2017 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
|
||||
@ -31,16 +31,14 @@ extern "C" {
|
||||
** 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: 31902 $ on $Date: 2015-09-03 15:44:53 -0700 (Thu, 03 Sep 2015) $
|
||||
** https://github.com/KhronosGroup/OpenGL-Registry
|
||||
*/
|
||||
|
||||
#ifndef GL_APIENTRYP
|
||||
#define GL_APIENTRYP GL_APIENTRY*
|
||||
#endif
|
||||
|
||||
/* Generated on date 20150903 */
|
||||
/* Generated on date 20170613 */
|
||||
|
||||
/* Generated C header for:
|
||||
* API: gles2
|
||||
@ -225,6 +223,10 @@ GL_APICALL void GL_APIENTRY glGetnUniformuivKHR (GLuint program, GLint location,
|
||||
#define GL_KHR_texture_compression_astc_ldr 1
|
||||
#endif /* GL_KHR_texture_compression_astc_ldr */
|
||||
|
||||
#ifndef GL_KHR_texture_compression_astc_sliced_3d
|
||||
#define GL_KHR_texture_compression_astc_sliced_3d 1
|
||||
#endif /* GL_KHR_texture_compression_astc_sliced_3d */
|
||||
|
||||
#ifndef GL_OES_EGL_image
|
||||
#define GL_OES_EGL_image 1
|
||||
typedef void *GLeglImageOES;
|
||||
@ -748,6 +750,34 @@ GL_APICALL GLboolean GL_APIENTRY glIsVertexArrayOES (GLuint array);
|
||||
#define GL_INT_10_10_10_2_OES 0x8DF7
|
||||
#endif /* GL_OES_vertex_type_10_10_10_2 */
|
||||
|
||||
#ifndef GL_OES_viewport_array
|
||||
#define GL_OES_viewport_array 1
|
||||
#define GL_MAX_VIEWPORTS_OES 0x825B
|
||||
#define GL_VIEWPORT_SUBPIXEL_BITS_OES 0x825C
|
||||
#define GL_VIEWPORT_BOUNDS_RANGE_OES 0x825D
|
||||
#define GL_VIEWPORT_INDEX_PROVOKING_VERTEX_OES 0x825F
|
||||
typedef void (GL_APIENTRYP PFNGLVIEWPORTARRAYVOESPROC) (GLuint first, GLsizei count, const GLfloat *v);
|
||||
typedef void (GL_APIENTRYP PFNGLVIEWPORTINDEXEDFOESPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h);
|
||||
typedef void (GL_APIENTRYP PFNGLVIEWPORTINDEXEDFVOESPROC) (GLuint index, const GLfloat *v);
|
||||
typedef void (GL_APIENTRYP PFNGLSCISSORARRAYVOESPROC) (GLuint first, GLsizei count, const GLint *v);
|
||||
typedef void (GL_APIENTRYP PFNGLSCISSORINDEXEDOESPROC) (GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height);
|
||||
typedef void (GL_APIENTRYP PFNGLSCISSORINDEXEDVOESPROC) (GLuint index, const GLint *v);
|
||||
typedef void (GL_APIENTRYP PFNGLDEPTHRANGEARRAYFVOESPROC) (GLuint first, GLsizei count, const GLfloat *v);
|
||||
typedef void (GL_APIENTRYP PFNGLDEPTHRANGEINDEXEDFOESPROC) (GLuint index, GLfloat n, GLfloat f);
|
||||
typedef void (GL_APIENTRYP PFNGLGETFLOATI_VOESPROC) (GLenum target, GLuint index, GLfloat *data);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_APICALL void GL_APIENTRY glViewportArrayvOES (GLuint first, GLsizei count, const GLfloat *v);
|
||||
GL_APICALL void GL_APIENTRY glViewportIndexedfOES (GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h);
|
||||
GL_APICALL void GL_APIENTRY glViewportIndexedfvOES (GLuint index, const GLfloat *v);
|
||||
GL_APICALL void GL_APIENTRY glScissorArrayvOES (GLuint first, GLsizei count, const GLint *v);
|
||||
GL_APICALL void GL_APIENTRY glScissorIndexedOES (GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height);
|
||||
GL_APICALL void GL_APIENTRY glScissorIndexedvOES (GLuint index, const GLint *v);
|
||||
GL_APICALL void GL_APIENTRY glDepthRangeArrayfvOES (GLuint first, GLsizei count, const GLfloat *v);
|
||||
GL_APICALL void GL_APIENTRY glDepthRangeIndexedfOES (GLuint index, GLfloat n, GLfloat f);
|
||||
GL_APICALL void GL_APIENTRY glGetFloati_vOES (GLenum target, GLuint index, GLfloat *data);
|
||||
#endif
|
||||
#endif /* GL_OES_viewport_array */
|
||||
|
||||
#ifndef GL_AMD_compressed_3DC_texture
|
||||
#define GL_AMD_compressed_3DC_texture 1
|
||||
#define GL_3DC_X_AMD 0x87F9
|
||||
@ -1021,6 +1051,10 @@ GL_APICALL void GL_APIENTRY glGetSyncivAPPLE (GLsync sync, GLenum pname, GLsizei
|
||||
#define GL_SHADER_BINARY_DMP 0x9250
|
||||
#endif /* GL_DMP_shader_binary */
|
||||
|
||||
#ifndef GL_EXT_EGL_image_array
|
||||
#define GL_EXT_EGL_image_array 1
|
||||
#endif /* GL_EXT_EGL_image_array */
|
||||
|
||||
#ifndef GL_EXT_YUV_target
|
||||
#define GL_EXT_YUV_target 1
|
||||
#define GL_SAMPLER_EXTERNAL_2D_Y2Y_EXT 0x8BE7
|
||||
@ -1082,6 +1116,31 @@ GL_APICALL void GL_APIENTRY glBufferStorageEXT (GLenum target, GLsizeiptr size,
|
||||
#endif
|
||||
#endif /* GL_EXT_buffer_storage */
|
||||
|
||||
#ifndef GL_EXT_clear_texture
|
||||
#define GL_EXT_clear_texture 1
|
||||
typedef void (GL_APIENTRYP PFNGLCLEARTEXIMAGEEXTPROC) (GLuint texture, GLint level, GLenum format, GLenum type, const void *data);
|
||||
typedef void (GL_APIENTRYP PFNGLCLEARTEXSUBIMAGEEXTPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *data);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_APICALL void GL_APIENTRY glClearTexImageEXT (GLuint texture, GLint level, GLenum format, GLenum type, const void *data);
|
||||
GL_APICALL void GL_APIENTRY glClearTexSubImageEXT (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *data);
|
||||
#endif
|
||||
#endif /* GL_EXT_clear_texture */
|
||||
|
||||
#ifndef GL_EXT_clip_cull_distance
|
||||
#define GL_EXT_clip_cull_distance 1
|
||||
#define GL_MAX_CLIP_DISTANCES_EXT 0x0D32
|
||||
#define GL_MAX_CULL_DISTANCES_EXT 0x82F9
|
||||
#define GL_MAX_COMBINED_CLIP_AND_CULL_DISTANCES_EXT 0x82FA
|
||||
#define GL_CLIP_DISTANCE0_EXT 0x3000
|
||||
#define GL_CLIP_DISTANCE1_EXT 0x3001
|
||||
#define GL_CLIP_DISTANCE2_EXT 0x3002
|
||||
#define GL_CLIP_DISTANCE3_EXT 0x3003
|
||||
#define GL_CLIP_DISTANCE4_EXT 0x3004
|
||||
#define GL_CLIP_DISTANCE5_EXT 0x3005
|
||||
#define GL_CLIP_DISTANCE6_EXT 0x3006
|
||||
#define GL_CLIP_DISTANCE7_EXT 0x3007
|
||||
#endif /* GL_EXT_clip_cull_distance */
|
||||
|
||||
#ifndef GL_EXT_color_buffer_float
|
||||
#define GL_EXT_color_buffer_float 1
|
||||
#endif /* GL_EXT_color_buffer_float */
|
||||
@ -1096,6 +1155,10 @@ GL_APICALL void GL_APIENTRY glBufferStorageEXT (GLenum target, GLsizeiptr size,
|
||||
#define GL_UNSIGNED_NORMALIZED_EXT 0x8C17
|
||||
#endif /* GL_EXT_color_buffer_half_float */
|
||||
|
||||
#ifndef GL_EXT_conservative_depth
|
||||
#define GL_EXT_conservative_depth 1
|
||||
#endif /* GL_EXT_conservative_depth */
|
||||
|
||||
#ifndef GL_EXT_copy_image
|
||||
#define GL_EXT_copy_image 1
|
||||
typedef void (GL_APIENTRYP PFNGLCOPYIMAGESUBDATAEXTPROC) (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth);
|
||||
@ -1267,6 +1330,27 @@ GL_APICALL void GL_APIENTRY glDrawElementsInstancedEXT (GLenum mode, GLsizei cou
|
||||
#endif
|
||||
#endif /* GL_EXT_draw_instanced */
|
||||
|
||||
#ifndef GL_EXT_draw_transform_feedback
|
||||
#define GL_EXT_draw_transform_feedback 1
|
||||
typedef void (GL_APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKEXTPROC) (GLenum mode, GLuint id);
|
||||
typedef void (GL_APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKINSTANCEDEXTPROC) (GLenum mode, GLuint id, GLsizei instancecount);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_APICALL void GL_APIENTRY glDrawTransformFeedbackEXT (GLenum mode, GLuint id);
|
||||
GL_APICALL void GL_APIENTRY glDrawTransformFeedbackInstancedEXT (GLenum mode, GLuint id, GLsizei instancecount);
|
||||
#endif
|
||||
#endif /* GL_EXT_draw_transform_feedback */
|
||||
|
||||
#ifndef GL_EXT_external_buffer
|
||||
#define GL_EXT_external_buffer 1
|
||||
typedef void *GLeglClientBufferEXT;
|
||||
typedef void (GL_APIENTRYP PFNGLBUFFERSTORAGEEXTERNALEXTPROC) (GLenum target, GLintptr offset, GLsizeiptr size, GLeglClientBufferEXT clientBuffer, GLbitfield flags);
|
||||
typedef void (GL_APIENTRYP PFNGLNAMEDBUFFERSTORAGEEXTERNALEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, GLeglClientBufferEXT clientBuffer, GLbitfield flags);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_APICALL void GL_APIENTRY glBufferStorageExternalEXT (GLenum target, GLintptr offset, GLsizeiptr size, GLeglClientBufferEXT clientBuffer, GLbitfield flags);
|
||||
GL_APICALL void GL_APIENTRY glNamedBufferStorageExternalEXT (GLuint buffer, GLintptr offset, GLsizeiptr size, GLeglClientBufferEXT clientBuffer, GLbitfield flags);
|
||||
#endif
|
||||
#endif /* GL_EXT_external_buffer */
|
||||
|
||||
#ifndef GL_EXT_float_blend
|
||||
#define GL_EXT_float_blend 1
|
||||
#endif /* GL_EXT_float_blend */
|
||||
@ -1345,6 +1429,85 @@ GL_APICALL void GL_APIENTRY glFlushMappedBufferRangeEXT (GLenum target, GLintptr
|
||||
#endif
|
||||
#endif /* GL_EXT_map_buffer_range */
|
||||
|
||||
#ifndef GL_EXT_memory_object
|
||||
#define GL_EXT_memory_object 1
|
||||
#define GL_TEXTURE_TILING_EXT 0x9580
|
||||
#define GL_DEDICATED_MEMORY_OBJECT_EXT 0x9581
|
||||
#define GL_PROTECTED_MEMORY_OBJECT_EXT 0x959B
|
||||
#define GL_NUM_TILING_TYPES_EXT 0x9582
|
||||
#define GL_TILING_TYPES_EXT 0x9583
|
||||
#define GL_OPTIMAL_TILING_EXT 0x9584
|
||||
#define GL_LINEAR_TILING_EXT 0x9585
|
||||
#define GL_NUM_DEVICE_UUIDS_EXT 0x9596
|
||||
#define GL_DEVICE_UUID_EXT 0x9597
|
||||
#define GL_DRIVER_UUID_EXT 0x9598
|
||||
#define GL_UUID_SIZE_EXT 16
|
||||
typedef void (GL_APIENTRYP PFNGLGETUNSIGNEDBYTEVEXTPROC) (GLenum pname, GLubyte *data);
|
||||
typedef void (GL_APIENTRYP PFNGLGETUNSIGNEDBYTEI_VEXTPROC) (GLenum target, GLuint index, GLubyte *data);
|
||||
typedef void (GL_APIENTRYP PFNGLDELETEMEMORYOBJECTSEXTPROC) (GLsizei n, const GLuint *memoryObjects);
|
||||
typedef GLboolean (GL_APIENTRYP PFNGLISMEMORYOBJECTEXTPROC) (GLuint memoryObject);
|
||||
typedef void (GL_APIENTRYP PFNGLCREATEMEMORYOBJECTSEXTPROC) (GLsizei n, GLuint *memoryObjects);
|
||||
typedef void (GL_APIENTRYP PFNGLMEMORYOBJECTPARAMETERIVEXTPROC) (GLuint memoryObject, GLenum pname, const GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETMEMORYOBJECTPARAMETERIVEXTPROC) (GLuint memoryObject, GLenum pname, GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXSTORAGEMEM2DEXTPROC) (GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLuint memory, GLuint64 offset);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXSTORAGEMEM2DMULTISAMPLEEXTPROC) (GLenum target, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXSTORAGEMEM3DEXTPROC) (GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLuint memory, GLuint64 offset);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXSTORAGEMEM3DMULTISAMPLEEXTPROC) (GLenum target, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset);
|
||||
typedef void (GL_APIENTRYP PFNGLBUFFERSTORAGEMEMEXTPROC) (GLenum target, GLsizeiptr size, GLuint memory, GLuint64 offset);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGEMEM2DEXTPROC) (GLuint texture, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLuint memory, GLuint64 offset);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGEMEM2DMULTISAMPLEEXTPROC) (GLuint texture, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGEMEM3DEXTPROC) (GLuint texture, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLuint memory, GLuint64 offset);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGEMEM3DMULTISAMPLEEXTPROC) (GLuint texture, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset);
|
||||
typedef void (GL_APIENTRYP PFNGLNAMEDBUFFERSTORAGEMEMEXTPROC) (GLuint buffer, GLsizeiptr size, GLuint memory, GLuint64 offset);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_APICALL void GL_APIENTRY glGetUnsignedBytevEXT (GLenum pname, GLubyte *data);
|
||||
GL_APICALL void GL_APIENTRY glGetUnsignedBytei_vEXT (GLenum target, GLuint index, GLubyte *data);
|
||||
GL_APICALL void GL_APIENTRY glDeleteMemoryObjectsEXT (GLsizei n, const GLuint *memoryObjects);
|
||||
GL_APICALL GLboolean GL_APIENTRY glIsMemoryObjectEXT (GLuint memoryObject);
|
||||
GL_APICALL void GL_APIENTRY glCreateMemoryObjectsEXT (GLsizei n, GLuint *memoryObjects);
|
||||
GL_APICALL void GL_APIENTRY glMemoryObjectParameterivEXT (GLuint memoryObject, GLenum pname, const GLint *params);
|
||||
GL_APICALL void GL_APIENTRY glGetMemoryObjectParameterivEXT (GLuint memoryObject, GLenum pname, GLint *params);
|
||||
GL_APICALL void GL_APIENTRY glTexStorageMem2DEXT (GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLuint memory, GLuint64 offset);
|
||||
GL_APICALL void GL_APIENTRY glTexStorageMem2DMultisampleEXT (GLenum target, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset);
|
||||
GL_APICALL void GL_APIENTRY glTexStorageMem3DEXT (GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLuint memory, GLuint64 offset);
|
||||
GL_APICALL void GL_APIENTRY glTexStorageMem3DMultisampleEXT (GLenum target, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset);
|
||||
GL_APICALL void GL_APIENTRY glBufferStorageMemEXT (GLenum target, GLsizeiptr size, GLuint memory, GLuint64 offset);
|
||||
GL_APICALL void GL_APIENTRY glTextureStorageMem2DEXT (GLuint texture, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLuint memory, GLuint64 offset);
|
||||
GL_APICALL void GL_APIENTRY glTextureStorageMem2DMultisampleEXT (GLuint texture, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset);
|
||||
GL_APICALL void GL_APIENTRY glTextureStorageMem3DEXT (GLuint texture, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLuint memory, GLuint64 offset);
|
||||
GL_APICALL void GL_APIENTRY glTextureStorageMem3DMultisampleEXT (GLuint texture, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset);
|
||||
GL_APICALL void GL_APIENTRY glNamedBufferStorageMemEXT (GLuint buffer, GLsizeiptr size, GLuint memory, GLuint64 offset);
|
||||
#endif
|
||||
#endif /* GL_EXT_memory_object */
|
||||
|
||||
#ifndef GL_EXT_memory_object_fd
|
||||
#define GL_EXT_memory_object_fd 1
|
||||
#define GL_HANDLE_TYPE_OPAQUE_FD_EXT 0x9586
|
||||
typedef void (GL_APIENTRYP PFNGLIMPORTMEMORYFDEXTPROC) (GLuint memory, GLuint64 size, GLenum handleType, GLint fd);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_APICALL void GL_APIENTRY glImportMemoryFdEXT (GLuint memory, GLuint64 size, GLenum handleType, GLint fd);
|
||||
#endif
|
||||
#endif /* GL_EXT_memory_object_fd */
|
||||
|
||||
#ifndef GL_EXT_memory_object_win32
|
||||
#define GL_EXT_memory_object_win32 1
|
||||
#define GL_HANDLE_TYPE_OPAQUE_WIN32_EXT 0x9587
|
||||
#define GL_HANDLE_TYPE_OPAQUE_WIN32_KMT_EXT 0x9588
|
||||
#define GL_DEVICE_LUID_EXT 0x9599
|
||||
#define GL_DEVICE_NODE_MASK_EXT 0x959A
|
||||
#define GL_LUID_SIZE_EXT 8
|
||||
#define GL_HANDLE_TYPE_D3D12_TILEPOOL_EXT 0x9589
|
||||
#define GL_HANDLE_TYPE_D3D12_RESOURCE_EXT 0x958A
|
||||
#define GL_HANDLE_TYPE_D3D11_IMAGE_EXT 0x958B
|
||||
#define GL_HANDLE_TYPE_D3D11_IMAGE_KMT_EXT 0x958C
|
||||
typedef void (GL_APIENTRYP PFNGLIMPORTMEMORYWIN32HANDLEEXTPROC) (GLuint memory, GLuint64 size, GLenum handleType, void *handle);
|
||||
typedef void (GL_APIENTRYP PFNGLIMPORTMEMORYWIN32NAMEEXTPROC) (GLuint memory, GLuint64 size, GLenum handleType, const void *name);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_APICALL void GL_APIENTRY glImportMemoryWin32HandleEXT (GLuint memory, GLuint64 size, GLenum handleType, void *handle);
|
||||
GL_APICALL void GL_APIENTRY glImportMemoryWin32NameEXT (GLuint memory, GLuint64 size, GLenum handleType, const void *name);
|
||||
#endif
|
||||
#endif /* GL_EXT_memory_object_win32 */
|
||||
|
||||
#ifndef GL_EXT_multi_draw_arrays
|
||||
#define GL_EXT_multi_draw_arrays 1
|
||||
typedef void (GL_APIENTRYP PFNGLMULTIDRAWARRAYSEXTPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount);
|
||||
@ -1408,6 +1571,15 @@ GL_APICALL void GL_APIENTRY glGetIntegeri_vEXT (GLenum target, GLuint index, GLi
|
||||
#define GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT 0x8D6A
|
||||
#endif /* GL_EXT_occlusion_query_boolean */
|
||||
|
||||
#ifndef GL_EXT_polygon_offset_clamp
|
||||
#define GL_EXT_polygon_offset_clamp 1
|
||||
#define GL_POLYGON_OFFSET_CLAMP_EXT 0x8E1B
|
||||
typedef void (GL_APIENTRYP PFNGLPOLYGONOFFSETCLAMPEXTPROC) (GLfloat factor, GLfloat units, GLfloat clamp);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_APICALL void GL_APIENTRY glPolygonOffsetClampEXT (GLfloat factor, GLfloat units, GLfloat clamp);
|
||||
#endif
|
||||
#endif /* GL_EXT_polygon_offset_clamp */
|
||||
|
||||
#ifndef GL_EXT_post_depth_coverage
|
||||
#define GL_EXT_post_depth_coverage 1
|
||||
#endif /* GL_EXT_post_depth_coverage */
|
||||
@ -1421,6 +1593,12 @@ GL_APICALL void GL_APIENTRY glPrimitiveBoundingBoxEXT (GLfloat minX, GLfloat min
|
||||
#endif
|
||||
#endif /* GL_EXT_primitive_bounding_box */
|
||||
|
||||
#ifndef GL_EXT_protected_textures
|
||||
#define GL_EXT_protected_textures 1
|
||||
#define GL_CONTEXT_FLAG_PROTECTED_CONTENT_BIT_EXT 0x00000010
|
||||
#define GL_TEXTURE_PROTECTED_EXT 0x8BFA
|
||||
#endif /* GL_EXT_protected_textures */
|
||||
|
||||
#ifndef GL_EXT_pvrtc_sRGB
|
||||
#define GL_EXT_pvrtc_sRGB 1
|
||||
#define GL_COMPRESSED_SRGB_PVRTC_2BPPV1_EXT 0x8A54
|
||||
@ -1495,6 +1673,53 @@ GL_APICALL void GL_APIENTRY glGetnUniformivEXT (GLuint program, GLint location,
|
||||
#define GL_FRAMEBUFFER_SRGB_EXT 0x8DB9
|
||||
#endif /* GL_EXT_sRGB_write_control */
|
||||
|
||||
#ifndef GL_EXT_semaphore
|
||||
#define GL_EXT_semaphore 1
|
||||
#define GL_LAYOUT_GENERAL_EXT 0x958D
|
||||
#define GL_LAYOUT_COLOR_ATTACHMENT_EXT 0x958E
|
||||
#define GL_LAYOUT_DEPTH_STENCIL_ATTACHMENT_EXT 0x958F
|
||||
#define GL_LAYOUT_DEPTH_STENCIL_READ_ONLY_EXT 0x9590
|
||||
#define GL_LAYOUT_SHADER_READ_ONLY_EXT 0x9591
|
||||
#define GL_LAYOUT_TRANSFER_SRC_EXT 0x9592
|
||||
#define GL_LAYOUT_TRANSFER_DST_EXT 0x9593
|
||||
typedef void (GL_APIENTRYP PFNGLGENSEMAPHORESEXTPROC) (GLsizei n, GLuint *semaphores);
|
||||
typedef void (GL_APIENTRYP PFNGLDELETESEMAPHORESEXTPROC) (GLsizei n, const GLuint *semaphores);
|
||||
typedef GLboolean (GL_APIENTRYP PFNGLISSEMAPHOREEXTPROC) (GLuint semaphore);
|
||||
typedef void (GL_APIENTRYP PFNGLSEMAPHOREPARAMETERUI64VEXTPROC) (GLuint semaphore, GLenum pname, const GLuint64 *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETSEMAPHOREPARAMETERUI64VEXTPROC) (GLuint semaphore, GLenum pname, GLuint64 *params);
|
||||
typedef void (GL_APIENTRYP PFNGLWAITSEMAPHOREEXTPROC) (GLuint semaphore, GLuint numBufferBarriers, const GLuint *buffers, GLuint numTextureBarriers, const GLuint *textures, const GLenum *srcLayouts);
|
||||
typedef void (GL_APIENTRYP PFNGLSIGNALSEMAPHOREEXTPROC) (GLuint semaphore, GLuint numBufferBarriers, const GLuint *buffers, GLuint numTextureBarriers, const GLuint *textures, const GLenum *dstLayouts);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_APICALL void GL_APIENTRY glGenSemaphoresEXT (GLsizei n, GLuint *semaphores);
|
||||
GL_APICALL void GL_APIENTRY glDeleteSemaphoresEXT (GLsizei n, const GLuint *semaphores);
|
||||
GL_APICALL GLboolean GL_APIENTRY glIsSemaphoreEXT (GLuint semaphore);
|
||||
GL_APICALL void GL_APIENTRY glSemaphoreParameterui64vEXT (GLuint semaphore, GLenum pname, const GLuint64 *params);
|
||||
GL_APICALL void GL_APIENTRY glGetSemaphoreParameterui64vEXT (GLuint semaphore, GLenum pname, GLuint64 *params);
|
||||
GL_APICALL void GL_APIENTRY glWaitSemaphoreEXT (GLuint semaphore, GLuint numBufferBarriers, const GLuint *buffers, GLuint numTextureBarriers, const GLuint *textures, const GLenum *srcLayouts);
|
||||
GL_APICALL void GL_APIENTRY glSignalSemaphoreEXT (GLuint semaphore, GLuint numBufferBarriers, const GLuint *buffers, GLuint numTextureBarriers, const GLuint *textures, const GLenum *dstLayouts);
|
||||
#endif
|
||||
#endif /* GL_EXT_semaphore */
|
||||
|
||||
#ifndef GL_EXT_semaphore_fd
|
||||
#define GL_EXT_semaphore_fd 1
|
||||
typedef void (GL_APIENTRYP PFNGLIMPORTSEMAPHOREFDEXTPROC) (GLuint semaphore, GLenum handleType, GLint fd);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_APICALL void GL_APIENTRY glImportSemaphoreFdEXT (GLuint semaphore, GLenum handleType, GLint fd);
|
||||
#endif
|
||||
#endif /* GL_EXT_semaphore_fd */
|
||||
|
||||
#ifndef GL_EXT_semaphore_win32
|
||||
#define GL_EXT_semaphore_win32 1
|
||||
#define GL_HANDLE_TYPE_D3D12_FENCE_EXT 0x9594
|
||||
#define GL_D3D12_FENCE_VALUE_EXT 0x9595
|
||||
typedef void (GL_APIENTRYP PFNGLIMPORTSEMAPHOREWIN32HANDLEEXTPROC) (GLuint semaphore, GLenum handleType, void *handle);
|
||||
typedef void (GL_APIENTRYP PFNGLIMPORTSEMAPHOREWIN32NAMEEXTPROC) (GLuint semaphore, GLenum handleType, const void *name);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_APICALL void GL_APIENTRY glImportSemaphoreWin32HandleEXT (GLuint semaphore, GLenum handleType, void *handle);
|
||||
GL_APICALL void GL_APIENTRY glImportSemaphoreWin32NameEXT (GLuint semaphore, GLenum handleType, const void *name);
|
||||
#endif
|
||||
#endif /* GL_EXT_semaphore_win32 */
|
||||
|
||||
#ifndef GL_EXT_separate_shader_objects
|
||||
#define GL_EXT_separate_shader_objects 1
|
||||
#define GL_ACTIVE_PROGRAM_EXT 0x8259
|
||||
@ -1600,6 +1825,10 @@ GL_APICALL void GL_APIENTRY glProgramUniformMatrix4x3fvEXT (GLuint program, GLin
|
||||
#define GL_FRAGMENT_SHADER_DISCARDS_SAMPLES_EXT 0x8A52
|
||||
#endif /* GL_EXT_shader_framebuffer_fetch */
|
||||
|
||||
#ifndef GL_EXT_shader_group_vote
|
||||
#define GL_EXT_shader_group_vote 1
|
||||
#endif /* GL_EXT_shader_group_vote */
|
||||
|
||||
#ifndef GL_EXT_shader_implicit_conversions
|
||||
#define GL_EXT_shader_implicit_conversions 1
|
||||
#endif /* GL_EXT_shader_implicit_conversions */
|
||||
@ -1612,6 +1841,10 @@ GL_APICALL void GL_APIENTRY glProgramUniformMatrix4x3fvEXT (GLuint program, GLin
|
||||
#define GL_EXT_shader_io_blocks 1
|
||||
#endif /* GL_EXT_shader_io_blocks */
|
||||
|
||||
#ifndef GL_EXT_shader_non_constant_global_initializers
|
||||
#define GL_EXT_shader_non_constant_global_initializers 1
|
||||
#endif /* GL_EXT_shader_non_constant_global_initializers */
|
||||
|
||||
#ifndef GL_EXT_shader_pixel_local_storage
|
||||
#define GL_EXT_shader_pixel_local_storage 1
|
||||
#define GL_MAX_SHADER_PIXEL_LOCAL_STORAGE_FAST_SIZE_EXT 0x8F63
|
||||
@ -1619,6 +1852,21 @@ GL_APICALL void GL_APIENTRY glProgramUniformMatrix4x3fvEXT (GLuint program, GLin
|
||||
#define GL_SHADER_PIXEL_LOCAL_STORAGE_EXT 0x8F64
|
||||
#endif /* GL_EXT_shader_pixel_local_storage */
|
||||
|
||||
#ifndef GL_EXT_shader_pixel_local_storage2
|
||||
#define GL_EXT_shader_pixel_local_storage2 1
|
||||
#define GL_MAX_SHADER_COMBINED_LOCAL_STORAGE_FAST_SIZE_EXT 0x9650
|
||||
#define GL_MAX_SHADER_COMBINED_LOCAL_STORAGE_SIZE_EXT 0x9651
|
||||
#define GL_FRAMEBUFFER_INCOMPLETE_INSUFFICIENT_SHADER_COMBINED_LOCAL_STORAGE_EXT 0x9652
|
||||
typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERPIXELLOCALSTORAGESIZEEXTPROC) (GLuint target, GLsizei size);
|
||||
typedef GLsizei (GL_APIENTRYP PFNGLGETFRAMEBUFFERPIXELLOCALSTORAGESIZEEXTPROC) (GLuint target);
|
||||
typedef void (GL_APIENTRYP PFNGLCLEARPIXELLOCALSTORAGEUIEXTPROC) (GLsizei offset, GLsizei n, const GLuint *values);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_APICALL void GL_APIENTRY glFramebufferPixelLocalStorageSizeEXT (GLuint target, GLsizei size);
|
||||
GL_APICALL GLsizei GL_APIENTRY glGetFramebufferPixelLocalStorageSizeEXT (GLuint target);
|
||||
GL_APICALL void GL_APIENTRY glClearPixelLocalStorageuiEXT (GLsizei offset, GLsizei n, const GLuint *values);
|
||||
#endif
|
||||
#endif /* GL_EXT_shader_pixel_local_storage2 */
|
||||
|
||||
#ifndef GL_EXT_shader_texture_lod
|
||||
#define GL_EXT_shader_texture_lod 1
|
||||
#endif /* GL_EXT_shader_texture_lod */
|
||||
@ -1652,6 +1900,10 @@ GL_APICALL void GL_APIENTRY glTexPageCommitmentEXT (GLenum target, GLint level,
|
||||
#endif
|
||||
#endif /* GL_EXT_sparse_texture */
|
||||
|
||||
#ifndef GL_EXT_sparse_texture2
|
||||
#define GL_EXT_sparse_texture2 1
|
||||
#endif /* GL_EXT_sparse_texture2 */
|
||||
|
||||
#ifndef GL_EXT_tessellation_point_size
|
||||
#define GL_EXT_tessellation_point_size 1
|
||||
#endif /* GL_EXT_tessellation_point_size */
|
||||
@ -1755,6 +2007,11 @@ GL_APICALL void GL_APIENTRY glTexBufferRangeEXT (GLenum target, GLenum internalf
|
||||
#endif
|
||||
#endif /* GL_EXT_texture_buffer */
|
||||
|
||||
#ifndef GL_EXT_texture_compression_astc_decode_mode
|
||||
#define GL_EXT_texture_compression_astc_decode_mode 1
|
||||
#define GL_TEXTURE_ASTC_DECODE_PRECISION_EXT 0x8F69
|
||||
#endif /* GL_EXT_texture_compression_astc_decode_mode */
|
||||
|
||||
#ifndef GL_EXT_texture_compression_dxt1
|
||||
#define GL_EXT_texture_compression_dxt1 1
|
||||
#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0
|
||||
@ -1884,11 +2141,67 @@ GL_APICALL void GL_APIENTRY glTextureViewEXT (GLuint texture, GLenum target, GLu
|
||||
#define GL_UNPACK_SKIP_PIXELS_EXT 0x0CF4
|
||||
#endif /* GL_EXT_unpack_subimage */
|
||||
|
||||
#ifndef GL_EXT_win32_keyed_mutex
|
||||
#define GL_EXT_win32_keyed_mutex 1
|
||||
typedef GLboolean (GL_APIENTRYP PFNGLACQUIREKEYEDMUTEXWIN32EXTPROC) (GLuint memory, GLuint64 key, GLuint timeout);
|
||||
typedef GLboolean (GL_APIENTRYP PFNGLRELEASEKEYEDMUTEXWIN32EXTPROC) (GLuint memory, GLuint64 key);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_APICALL GLboolean GL_APIENTRY glAcquireKeyedMutexWin32EXT (GLuint memory, GLuint64 key, GLuint timeout);
|
||||
GL_APICALL GLboolean GL_APIENTRY glReleaseKeyedMutexWin32EXT (GLuint memory, GLuint64 key);
|
||||
#endif
|
||||
#endif /* GL_EXT_win32_keyed_mutex */
|
||||
|
||||
#ifndef GL_EXT_window_rectangles
|
||||
#define GL_EXT_window_rectangles 1
|
||||
#define GL_INCLUSIVE_EXT 0x8F10
|
||||
#define GL_EXCLUSIVE_EXT 0x8F11
|
||||
#define GL_WINDOW_RECTANGLE_EXT 0x8F12
|
||||
#define GL_WINDOW_RECTANGLE_MODE_EXT 0x8F13
|
||||
#define GL_MAX_WINDOW_RECTANGLES_EXT 0x8F14
|
||||
#define GL_NUM_WINDOW_RECTANGLES_EXT 0x8F15
|
||||
typedef void (GL_APIENTRYP PFNGLWINDOWRECTANGLESEXTPROC) (GLenum mode, GLsizei count, const GLint *box);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_APICALL void GL_APIENTRY glWindowRectanglesEXT (GLenum mode, GLsizei count, const GLint *box);
|
||||
#endif
|
||||
#endif /* GL_EXT_window_rectangles */
|
||||
|
||||
#ifndef GL_FJ_shader_binary_GCCSO
|
||||
#define GL_FJ_shader_binary_GCCSO 1
|
||||
#define GL_GCCSO_SHADER_BINARY_FJ 0x9260
|
||||
#endif /* GL_FJ_shader_binary_GCCSO */
|
||||
|
||||
#ifndef GL_IMG_bindless_texture
|
||||
#define GL_IMG_bindless_texture 1
|
||||
typedef GLuint64 (GL_APIENTRYP PFNGLGETTEXTUREHANDLEIMGPROC) (GLuint texture);
|
||||
typedef GLuint64 (GL_APIENTRYP PFNGLGETTEXTURESAMPLERHANDLEIMGPROC) (GLuint texture, GLuint sampler);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORMHANDLEUI64IMGPROC) (GLint location, GLuint64 value);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORMHANDLEUI64VIMGPROC) (GLint location, GLsizei count, const GLuint64 *value);
|
||||
typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMHANDLEUI64IMGPROC) (GLuint program, GLint location, GLuint64 value);
|
||||
typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMHANDLEUI64VIMGPROC) (GLuint program, GLint location, GLsizei count, const GLuint64 *values);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_APICALL GLuint64 GL_APIENTRY glGetTextureHandleIMG (GLuint texture);
|
||||
GL_APICALL GLuint64 GL_APIENTRY glGetTextureSamplerHandleIMG (GLuint texture, GLuint sampler);
|
||||
GL_APICALL void GL_APIENTRY glUniformHandleui64IMG (GLint location, GLuint64 value);
|
||||
GL_APICALL void GL_APIENTRY glUniformHandleui64vIMG (GLint location, GLsizei count, const GLuint64 *value);
|
||||
GL_APICALL void GL_APIENTRY glProgramUniformHandleui64IMG (GLuint program, GLint location, GLuint64 value);
|
||||
GL_APICALL void GL_APIENTRY glProgramUniformHandleui64vIMG (GLuint program, GLint location, GLsizei count, const GLuint64 *values);
|
||||
#endif
|
||||
#endif /* GL_IMG_bindless_texture */
|
||||
|
||||
#ifndef GL_IMG_framebuffer_downsample
|
||||
#define GL_IMG_framebuffer_downsample 1
|
||||
#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_AND_DOWNSAMPLE_IMG 0x913C
|
||||
#define GL_NUM_DOWNSAMPLE_SCALES_IMG 0x913D
|
||||
#define GL_DOWNSAMPLE_SCALES_IMG 0x913E
|
||||
#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SCALE_IMG 0x913F
|
||||
typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DDOWNSAMPLEIMGPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint xscale, GLint yscale);
|
||||
typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURELAYERDOWNSAMPLEIMGPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer, GLint xscale, GLint yscale);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_APICALL void GL_APIENTRY glFramebufferTexture2DDownsampleIMG (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint xscale, GLint yscale);
|
||||
GL_APICALL void GL_APIENTRY glFramebufferTextureLayerDownsampleIMG (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer, GLint xscale, GLint yscale);
|
||||
#endif
|
||||
#endif /* GL_IMG_framebuffer_downsample */
|
||||
|
||||
#ifndef GL_IMG_multisampled_render_to_texture
|
||||
#define GL_IMG_multisampled_render_to_texture 1
|
||||
#define GL_RENDERBUFFER_SAMPLES_IMG 0x9133
|
||||
@ -1933,6 +2246,18 @@ GL_APICALL void GL_APIENTRY glFramebufferTexture2DMultisampleIMG (GLenum target,
|
||||
#define GL_COMPRESSED_RGBA_PVRTC_4BPPV2_IMG 0x9138
|
||||
#endif /* GL_IMG_texture_compression_pvrtc2 */
|
||||
|
||||
#ifndef GL_IMG_texture_filter_cubic
|
||||
#define GL_IMG_texture_filter_cubic 1
|
||||
#define GL_CUBIC_IMG 0x9139
|
||||
#define GL_CUBIC_MIPMAP_NEAREST_IMG 0x913A
|
||||
#define GL_CUBIC_MIPMAP_LINEAR_IMG 0x913B
|
||||
#endif /* GL_IMG_texture_filter_cubic */
|
||||
|
||||
#ifndef GL_INTEL_conservative_rasterization
|
||||
#define GL_INTEL_conservative_rasterization 1
|
||||
#define GL_CONSERVATIVE_RASTERIZATION_INTEL 0x83FE
|
||||
#endif /* GL_INTEL_conservative_rasterization */
|
||||
|
||||
#ifndef GL_INTEL_framebuffer_CMAA
|
||||
#define GL_INTEL_framebuffer_CMAA 1
|
||||
typedef void (GL_APIENTRYP PFNGLAPPLYFRAMEBUFFERATTACHMENTCMAAINTELPROC) (void);
|
||||
@ -1987,6 +2312,14 @@ GL_APICALL void GL_APIENTRY glGetPerfQueryInfoINTEL (GLuint queryId, GLuint quer
|
||||
#endif
|
||||
#endif /* GL_INTEL_performance_query */
|
||||
|
||||
#ifndef GL_MESA_shader_integer_functions
|
||||
#define GL_MESA_shader_integer_functions 1
|
||||
#endif /* GL_MESA_shader_integer_functions */
|
||||
|
||||
#ifndef GL_NVX_blend_equation_advanced_multi_draw_buffers
|
||||
#define GL_NVX_blend_equation_advanced_multi_draw_buffers 1
|
||||
#endif /* GL_NVX_blend_equation_advanced_multi_draw_buffers */
|
||||
|
||||
#ifndef GL_NV_bindless_texture
|
||||
#define GL_NV_bindless_texture 1
|
||||
typedef GLuint64 (GL_APIENTRYP PFNGLGETTEXTUREHANDLENVPROC) (GLuint texture);
|
||||
@ -2109,6 +2442,17 @@ GL_APICALL void GL_APIENTRY glSubpixelPrecisionBiasNV (GLuint xbits, GLuint ybit
|
||||
#endif
|
||||
#endif /* GL_NV_conservative_raster */
|
||||
|
||||
#ifndef GL_NV_conservative_raster_pre_snap_triangles
|
||||
#define GL_NV_conservative_raster_pre_snap_triangles 1
|
||||
#define GL_CONSERVATIVE_RASTER_MODE_NV 0x954D
|
||||
#define GL_CONSERVATIVE_RASTER_MODE_POST_SNAP_NV 0x954E
|
||||
#define GL_CONSERVATIVE_RASTER_MODE_PRE_SNAP_TRIANGLES_NV 0x954F
|
||||
typedef void (GL_APIENTRYP PFNGLCONSERVATIVERASTERPARAMETERINVPROC) (GLenum pname, GLint param);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_APICALL void GL_APIENTRY glConservativeRasterParameteriNV (GLenum pname, GLint param);
|
||||
#endif
|
||||
#endif /* GL_NV_conservative_raster_pre_snap_triangles */
|
||||
|
||||
#ifndef GL_NV_copy_buffer
|
||||
#define GL_NV_copy_buffer 1
|
||||
#define GL_COPY_READ_BUFFER_NV 0x8F36
|
||||
@ -2194,6 +2538,23 @@ GL_APICALL void GL_APIENTRY glDrawElementsInstancedNV (GLenum mode, GLsizei coun
|
||||
#endif
|
||||
#endif /* GL_NV_draw_instanced */
|
||||
|
||||
#ifndef GL_NV_draw_vulkan_image
|
||||
#define GL_NV_draw_vulkan_image 1
|
||||
typedef void (GL_APIENTRY *GLVULKANPROCNV)(void);
|
||||
typedef void (GL_APIENTRYP PFNGLDRAWVKIMAGENVPROC) (GLuint64 vkImage, GLuint sampler, GLfloat x0, GLfloat y0, GLfloat x1, GLfloat y1, GLfloat z, GLfloat s0, GLfloat t0, GLfloat s1, GLfloat t1);
|
||||
typedef GLVULKANPROCNV (GL_APIENTRYP PFNGLGETVKPROCADDRNVPROC) (const GLchar *name);
|
||||
typedef void (GL_APIENTRYP PFNGLWAITVKSEMAPHORENVPROC) (GLuint64 vkSemaphore);
|
||||
typedef void (GL_APIENTRYP PFNGLSIGNALVKSEMAPHORENVPROC) (GLuint64 vkSemaphore);
|
||||
typedef void (GL_APIENTRYP PFNGLSIGNALVKFENCENVPROC) (GLuint64 vkFence);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_APICALL void GL_APIENTRY glDrawVkImageNV (GLuint64 vkImage, GLuint sampler, GLfloat x0, GLfloat y0, GLfloat x1, GLfloat y1, GLfloat z, GLfloat s0, GLfloat t0, GLfloat s1, GLfloat t1);
|
||||
GL_APICALL GLVULKANPROCNV GL_APIENTRY glGetVkProcAddrNV (const GLchar *name);
|
||||
GL_APICALL void GL_APIENTRY glWaitVkSemaphoreNV (GLuint64 vkSemaphore);
|
||||
GL_APICALL void GL_APIENTRY glSignalVkSemaphoreNV (GLuint64 vkSemaphore);
|
||||
GL_APICALL void GL_APIENTRY glSignalVkFenceNV (GLuint64 vkFence);
|
||||
#endif
|
||||
#endif /* GL_NV_draw_vulkan_image */
|
||||
|
||||
#ifndef GL_NV_explicit_attrib_location
|
||||
#define GL_NV_explicit_attrib_location 1
|
||||
#endif /* GL_NV_explicit_attrib_location */
|
||||
@ -2296,6 +2657,109 @@ GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleNV (GLenum target, G
|
||||
#define GL_NV_geometry_shader_passthrough 1
|
||||
#endif /* GL_NV_geometry_shader_passthrough */
|
||||
|
||||
#ifndef GL_NV_gpu_shader5
|
||||
#define GL_NV_gpu_shader5 1
|
||||
typedef khronos_int64_t GLint64EXT;
|
||||
typedef khronos_uint64_t GLuint64EXT;
|
||||
#define GL_INT64_NV 0x140E
|
||||
#define GL_UNSIGNED_INT64_NV 0x140F
|
||||
#define GL_INT8_NV 0x8FE0
|
||||
#define GL_INT8_VEC2_NV 0x8FE1
|
||||
#define GL_INT8_VEC3_NV 0x8FE2
|
||||
#define GL_INT8_VEC4_NV 0x8FE3
|
||||
#define GL_INT16_NV 0x8FE4
|
||||
#define GL_INT16_VEC2_NV 0x8FE5
|
||||
#define GL_INT16_VEC3_NV 0x8FE6
|
||||
#define GL_INT16_VEC4_NV 0x8FE7
|
||||
#define GL_INT64_VEC2_NV 0x8FE9
|
||||
#define GL_INT64_VEC3_NV 0x8FEA
|
||||
#define GL_INT64_VEC4_NV 0x8FEB
|
||||
#define GL_UNSIGNED_INT8_NV 0x8FEC
|
||||
#define GL_UNSIGNED_INT8_VEC2_NV 0x8FED
|
||||
#define GL_UNSIGNED_INT8_VEC3_NV 0x8FEE
|
||||
#define GL_UNSIGNED_INT8_VEC4_NV 0x8FEF
|
||||
#define GL_UNSIGNED_INT16_NV 0x8FF0
|
||||
#define GL_UNSIGNED_INT16_VEC2_NV 0x8FF1
|
||||
#define GL_UNSIGNED_INT16_VEC3_NV 0x8FF2
|
||||
#define GL_UNSIGNED_INT16_VEC4_NV 0x8FF3
|
||||
#define GL_UNSIGNED_INT64_VEC2_NV 0x8FF5
|
||||
#define GL_UNSIGNED_INT64_VEC3_NV 0x8FF6
|
||||
#define GL_UNSIGNED_INT64_VEC4_NV 0x8FF7
|
||||
#define GL_FLOAT16_NV 0x8FF8
|
||||
#define GL_FLOAT16_VEC2_NV 0x8FF9
|
||||
#define GL_FLOAT16_VEC3_NV 0x8FFA
|
||||
#define GL_FLOAT16_VEC4_NV 0x8FFB
|
||||
#define GL_PATCHES 0x000E
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORM1I64NVPROC) (GLint location, GLint64EXT x);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORM2I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORM3I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORM4I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORM1I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORM2I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORM3I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORM4I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORM1UI64NVPROC) (GLint location, GLuint64EXT x);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORM2UI64NVPROC) (GLint location, GLuint64EXT x, GLuint64EXT y);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORM3UI64NVPROC) (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORM4UI64NVPROC) (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORM1UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORM2UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORM3UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORM4UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value);
|
||||
typedef void (GL_APIENTRYP PFNGLGETUNIFORMI64VNVPROC) (GLuint program, GLint location, GLint64EXT *params);
|
||||
typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1I64NVPROC) (GLuint program, GLint location, GLint64EXT x);
|
||||
typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2I64NVPROC) (GLuint program, GLint location, GLint64EXT x, GLint64EXT y);
|
||||
typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3I64NVPROC) (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z);
|
||||
typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4I64NVPROC) (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w);
|
||||
typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value);
|
||||
typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value);
|
||||
typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value);
|
||||
typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value);
|
||||
typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x);
|
||||
typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y);
|
||||
typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z);
|
||||
typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w);
|
||||
typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
|
||||
typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
|
||||
typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
|
||||
typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_APICALL void GL_APIENTRY glUniform1i64NV (GLint location, GLint64EXT x);
|
||||
GL_APICALL void GL_APIENTRY glUniform2i64NV (GLint location, GLint64EXT x, GLint64EXT y);
|
||||
GL_APICALL void GL_APIENTRY glUniform3i64NV (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z);
|
||||
GL_APICALL void GL_APIENTRY glUniform4i64NV (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w);
|
||||
GL_APICALL void GL_APIENTRY glUniform1i64vNV (GLint location, GLsizei count, const GLint64EXT *value);
|
||||
GL_APICALL void GL_APIENTRY glUniform2i64vNV (GLint location, GLsizei count, const GLint64EXT *value);
|
||||
GL_APICALL void GL_APIENTRY glUniform3i64vNV (GLint location, GLsizei count, const GLint64EXT *value);
|
||||
GL_APICALL void GL_APIENTRY glUniform4i64vNV (GLint location, GLsizei count, const GLint64EXT *value);
|
||||
GL_APICALL void GL_APIENTRY glUniform1ui64NV (GLint location, GLuint64EXT x);
|
||||
GL_APICALL void GL_APIENTRY glUniform2ui64NV (GLint location, GLuint64EXT x, GLuint64EXT y);
|
||||
GL_APICALL void GL_APIENTRY glUniform3ui64NV (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z);
|
||||
GL_APICALL void GL_APIENTRY glUniform4ui64NV (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w);
|
||||
GL_APICALL void GL_APIENTRY glUniform1ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value);
|
||||
GL_APICALL void GL_APIENTRY glUniform2ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value);
|
||||
GL_APICALL void GL_APIENTRY glUniform3ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value);
|
||||
GL_APICALL void GL_APIENTRY glUniform4ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value);
|
||||
GL_APICALL void GL_APIENTRY glGetUniformi64vNV (GLuint program, GLint location, GLint64EXT *params);
|
||||
GL_APICALL void GL_APIENTRY glProgramUniform1i64NV (GLuint program, GLint location, GLint64EXT x);
|
||||
GL_APICALL void GL_APIENTRY glProgramUniform2i64NV (GLuint program, GLint location, GLint64EXT x, GLint64EXT y);
|
||||
GL_APICALL void GL_APIENTRY glProgramUniform3i64NV (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z);
|
||||
GL_APICALL void GL_APIENTRY glProgramUniform4i64NV (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w);
|
||||
GL_APICALL void GL_APIENTRY glProgramUniform1i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value);
|
||||
GL_APICALL void GL_APIENTRY glProgramUniform2i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value);
|
||||
GL_APICALL void GL_APIENTRY glProgramUniform3i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value);
|
||||
GL_APICALL void GL_APIENTRY glProgramUniform4i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value);
|
||||
GL_APICALL void GL_APIENTRY glProgramUniform1ui64NV (GLuint program, GLint location, GLuint64EXT x);
|
||||
GL_APICALL void GL_APIENTRY glProgramUniform2ui64NV (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y);
|
||||
GL_APICALL void GL_APIENTRY glProgramUniform3ui64NV (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z);
|
||||
GL_APICALL void GL_APIENTRY glProgramUniform4ui64NV (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w);
|
||||
GL_APICALL void GL_APIENTRY glProgramUniform1ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
|
||||
GL_APICALL void GL_APIENTRY glProgramUniform2ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
|
||||
GL_APICALL void GL_APIENTRY glProgramUniform3ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
|
||||
GL_APICALL void GL_APIENTRY glProgramUniform4ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
|
||||
#endif
|
||||
#endif /* GL_NV_gpu_shader5 */
|
||||
|
||||
#ifndef GL_NV_image_formats
|
||||
#define GL_NV_image_formats 1
|
||||
#endif /* GL_NV_image_formats */
|
||||
@ -2702,6 +3166,10 @@ GL_APICALL void GL_APIENTRY glResolveDepthValuesNV (void);
|
||||
#define GL_NV_sample_mask_override_coverage 1
|
||||
#endif /* GL_NV_sample_mask_override_coverage */
|
||||
|
||||
#ifndef GL_NV_shader_atomic_fp16_vector
|
||||
#define GL_NV_shader_atomic_fp16_vector 1
|
||||
#endif /* GL_NV_shader_atomic_fp16_vector */
|
||||
|
||||
#ifndef GL_NV_shader_noperspective_interpolation
|
||||
#define GL_NV_shader_noperspective_interpolation 1
|
||||
#endif /* GL_NV_shader_noperspective_interpolation */
|
||||
@ -2768,11 +3236,32 @@ GL_APICALL GLboolean GL_APIENTRY glIsEnablediNV (GLenum target, GLuint index);
|
||||
#define GL_NV_viewport_array2 1
|
||||
#endif /* GL_NV_viewport_array2 */
|
||||
|
||||
#ifndef GL_NV_viewport_swizzle
|
||||
#define GL_NV_viewport_swizzle 1
|
||||
#define GL_VIEWPORT_SWIZZLE_POSITIVE_X_NV 0x9350
|
||||
#define GL_VIEWPORT_SWIZZLE_NEGATIVE_X_NV 0x9351
|
||||
#define GL_VIEWPORT_SWIZZLE_POSITIVE_Y_NV 0x9352
|
||||
#define GL_VIEWPORT_SWIZZLE_NEGATIVE_Y_NV 0x9353
|
||||
#define GL_VIEWPORT_SWIZZLE_POSITIVE_Z_NV 0x9354
|
||||
#define GL_VIEWPORT_SWIZZLE_NEGATIVE_Z_NV 0x9355
|
||||
#define GL_VIEWPORT_SWIZZLE_POSITIVE_W_NV 0x9356
|
||||
#define GL_VIEWPORT_SWIZZLE_NEGATIVE_W_NV 0x9357
|
||||
#define GL_VIEWPORT_SWIZZLE_X_NV 0x9358
|
||||
#define GL_VIEWPORT_SWIZZLE_Y_NV 0x9359
|
||||
#define GL_VIEWPORT_SWIZZLE_Z_NV 0x935A
|
||||
#define GL_VIEWPORT_SWIZZLE_W_NV 0x935B
|
||||
typedef void (GL_APIENTRYP PFNGLVIEWPORTSWIZZLENVPROC) (GLuint index, GLenum swizzlex, GLenum swizzley, GLenum swizzlez, GLenum swizzlew);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_APICALL void GL_APIENTRY glViewportSwizzleNV (GLuint index, GLenum swizzlex, GLenum swizzley, GLenum swizzlez, GLenum swizzlew);
|
||||
#endif
|
||||
#endif /* GL_NV_viewport_swizzle */
|
||||
|
||||
#ifndef GL_OVR_multiview
|
||||
#define GL_OVR_multiview 1
|
||||
#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_NUM_VIEWS_OVR 0x9630
|
||||
#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_BASE_VIEW_INDEX_OVR 0x9632
|
||||
#define GL_MAX_VIEWS_OVR 0x9631
|
||||
#define GL_FRAMEBUFFER_INCOMPLETE_VIEW_TARGETS_OVR 0x9633
|
||||
typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTUREMULTIVIEWOVRPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint baseViewIndex, GLsizei numViews);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_APICALL void GL_APIENTRY glFramebufferTextureMultiviewOVR (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint baseViewIndex, GLsizei numViews);
|
||||
@ -2783,6 +3272,14 @@ GL_APICALL void GL_APIENTRY glFramebufferTextureMultiviewOVR (GLenum target, GLe
|
||||
#define GL_OVR_multiview2 1
|
||||
#endif /* GL_OVR_multiview2 */
|
||||
|
||||
#ifndef GL_OVR_multiview_multisampled_render_to_texture
|
||||
#define GL_OVR_multiview_multisampled_render_to_texture 1
|
||||
typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTUREMULTISAMPLEMULTIVIEWOVRPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLsizei samples, GLint baseViewIndex, GLsizei numViews);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_APICALL void GL_APIENTRY glFramebufferTextureMultisampleMultiviewOVR (GLenum target, GLenum attachment, GLuint texture, GLint level, GLsizei samples, GLint baseViewIndex, GLsizei numViews);
|
||||
#endif
|
||||
#endif /* GL_OVR_multiview_multisampled_render_to_texture */
|
||||
|
||||
#ifndef GL_QCOM_alpha_test
|
||||
#define GL_QCOM_alpha_test 1
|
||||
#define GL_ALPHA_TEST_QCOM 0x0BC0
|
||||
@ -2863,11 +3360,32 @@ GL_APICALL void GL_APIENTRY glExtGetProgramBinarySourceQCOM (GLuint program, GLe
|
||||
#endif
|
||||
#endif /* GL_QCOM_extended_get2 */
|
||||
|
||||
#ifndef GL_QCOM_framebuffer_foveated
|
||||
#define GL_QCOM_framebuffer_foveated 1
|
||||
#define GL_FOVEATION_ENABLE_BIT_QCOM 0x00000001
|
||||
#define GL_FOVEATION_SCALED_BIN_METHOD_BIT_QCOM 0x00000002
|
||||
typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERFOVEATIONCONFIGQCOMPROC) (GLuint framebuffer, GLuint numLayers, GLuint focalPointsPerLayer, GLuint requestedFeatures, GLuint *providedFeatures);
|
||||
typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERFOVEATIONPARAMETERSQCOMPROC) (GLuint framebuffer, GLuint layer, GLuint focalPoint, GLfloat focalX, GLfloat focalY, GLfloat gainX, GLfloat gainY, GLfloat foveaArea);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_APICALL void GL_APIENTRY glFramebufferFoveationConfigQCOM (GLuint framebuffer, GLuint numLayers, GLuint focalPointsPerLayer, GLuint requestedFeatures, GLuint *providedFeatures);
|
||||
GL_APICALL void GL_APIENTRY glFramebufferFoveationParametersQCOM (GLuint framebuffer, GLuint layer, GLuint focalPoint, GLfloat focalX, GLfloat focalY, GLfloat gainX, GLfloat gainY, GLfloat foveaArea);
|
||||
#endif
|
||||
#endif /* GL_QCOM_framebuffer_foveated */
|
||||
|
||||
#ifndef GL_QCOM_perfmon_global_mode
|
||||
#define GL_QCOM_perfmon_global_mode 1
|
||||
#define GL_PERFMON_GLOBAL_MODE_QCOM 0x8FA0
|
||||
#endif /* GL_QCOM_perfmon_global_mode */
|
||||
|
||||
#ifndef GL_QCOM_shader_framebuffer_fetch_noncoherent
|
||||
#define GL_QCOM_shader_framebuffer_fetch_noncoherent 1
|
||||
#define GL_FRAMEBUFFER_FETCH_NONCOHERENT_QCOM 0x96A2
|
||||
typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERFETCHBARRIERQCOMPROC) (void);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_APICALL void GL_APIENTRY glFramebufferFetchBarrierQCOM (void);
|
||||
#endif
|
||||
#endif /* GL_QCOM_shader_framebuffer_fetch_noncoherent */
|
||||
|
||||
#ifndef GL_QCOM_tiled_rendering
|
||||
#define GL_QCOM_tiled_rendering 1
|
||||
#define GL_COLOR_BUFFER_BIT0_QCOM 0x00000001
|
||||
@ -2920,20 +3438,8 @@ GL_APICALL void GL_APIENTRY glEndTilingQCOM (GLbitfield preserveMask);
|
||||
#define GL_SHADER_BINARY_VIV 0x8FC4
|
||||
#endif /* GL_VIV_shader_binary */
|
||||
|
||||
#ifndef GL_ANGLE_lossy_etc_decode
|
||||
#define GL_ANGLE_lossy_etc_decode 1
|
||||
#define GL_ETC1_RGB8_LOSSY_DECODE_ANGLE 0x9690
|
||||
#define GL_COMPRESSED_R11_LOSSY_DECODE_EAC_ANGLE 0x9691
|
||||
#define GL_COMPRESSED_SIGNED_R11_LOSSY_DECODE_EAC_ANGLE 0x9692
|
||||
#define GL_COMPRESSED_RG11_LOSSY_DECODE_EAC_ANGLE 0x9693
|
||||
#define GL_COMPRESSED_SIGNED_RG11_LOSSY_DECODE_EAC_ANGLE 0x9694
|
||||
#define GL_COMPRESSED_RGB8_LOSSY_DECODE_ETC2_ANGLE 0x9695
|
||||
#define GL_COMPRESSED_SRGB8_LOSSY_DECODE_ETC2_ANGLE 0x9696
|
||||
#define GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_LOSSY_DECODE_ETC2_ANGLE 0x9697
|
||||
#define GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_LOSSY_DECODE_ETC2_ANGLE 0x9698
|
||||
#define GL_COMPRESSED_RGBA8_LOSSY_DECODE_ETC2_EAC_ANGLE 0x9699
|
||||
#define GL_COMPRESSED_SRGB8_ALPHA8_LOSSY_DECODE_ETC2_EAC_ANGLE 0x969A
|
||||
#endif /* GL_ANGLE_lossy_etc_decode */
|
||||
/* ANGLE GLES2 extensions */
|
||||
#include "gl2ext_angle.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
551
src/3rdparty/angle/include/GLES2/gl2ext_angle.h
vendored
Normal file
551
src/3rdparty/angle/include/GLES2/gl2ext_angle.h
vendored
Normal file
@ -0,0 +1,551 @@
|
||||
//
|
||||
// Copyright (c) 2017 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.
|
||||
//
|
||||
// gl2ext_angle.h: ANGLE modifications to the gl2ext.h header file.
|
||||
// Currently we don't include this file directly, we patch gl2ext.h
|
||||
// to include it implicitly so it is visible throughout our code.
|
||||
|
||||
#ifndef INCLUDE_GLES2_GL2EXT_ANGLE_H_
|
||||
#define INCLUDE_GLES2_GL2EXT_ANGLE_H_
|
||||
|
||||
// clang-format off
|
||||
|
||||
#ifndef GL_ANGLE_client_arrays
|
||||
#define GL_ANGLE_client_arrays 1
|
||||
#define GL_CLIENT_ARRAYS_ANGLE 0x93AA
|
||||
#endif /* GL_ANGLE_client_arrays */
|
||||
|
||||
#ifndef GL_ANGLE_request_extension
|
||||
#define GL_ANGLE_request_extension 1
|
||||
#define GL_REQUESTABLE_EXTENSIONS_ANGLE 0x93A8
|
||||
#define GL_NUM_REQUESTABLE_EXTENSIONS_ANGLE 0x93A8
|
||||
typedef void (GL_APIENTRYP PFNGLREQUESTEXTENSIONANGLEPROC) (const GLchar *name);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_APICALL void GL_APIENTRY glRequestExtensionANGLE (const GLchar *name);
|
||||
#endif
|
||||
#endif /* GL_ANGLE_webgl_compatibility */
|
||||
|
||||
#ifndef GL_ANGLE_robust_resource_initialization
|
||||
#define GL_ANGLE_robust_resource_initialization 1
|
||||
#define GL_ROBUST_RESOURCE_INITIALIZATION_ANGLE 0x93AB
|
||||
#endif /* GL_ANGLE_robust_resource_initialization */
|
||||
|
||||
#ifndef GL_CHROMIUM_framebuffer_mixed_samples
|
||||
#define GL_CHROMIUM_frambuffer_mixed_samples 1
|
||||
#define GL_COVERAGE_MODULATION_CHROMIUM 0x9332
|
||||
typedef void (GL_APIENTRYP PFNGLCOVERAGEMODULATIONCHROMIUMPROC) (GLenum components);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_APICALL void GL_APIENTRY glCoverageModulationCHROMIUM(GLenum components);
|
||||
#endif
|
||||
#endif /* GL_CHROMIUM_framebuffer_mixed_samples */
|
||||
|
||||
#ifndef GL_CHROMIUM_bind_generates_resource
|
||||
#define GL_CHROMIUM_bind_generates_resource 1
|
||||
#define GL_BIND_GENERATES_RESOURCE_CHROMIUM 0x9244
|
||||
#endif /* GL_CHROMIUM_bind_generates_resource */
|
||||
|
||||
// needed by NV_path_rendering (and thus CHROMIUM_path_rendering)
|
||||
// but CHROMIUM_path_rendering only needs MatrixLoadfEXT, MatrixLoadIdentityEXT
|
||||
#ifndef GL_EXT_direct_state_access
|
||||
#define GL_EXT_direct_state_access 1
|
||||
typedef void(GL_APIENTRYP PFNGLMATRIXLOADFEXTPROC)(GLenum matrixMode, const GLfloat *m);
|
||||
typedef void(GL_APIENTRYP PFNGLMATRIXLOADIDENTITYEXTPROC)(GLenum matrixMode);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_APICALL void GL_APIENTRY glMatrixLoadfEXT(GLenum matrixMode, const GLfloat *m);
|
||||
GL_APICALL void GL_APIENTRY glMatrixLoadIdentityEXT(GLenum matrixMode);
|
||||
#endif
|
||||
#endif /* GL_EXT_direct_state_access */
|
||||
|
||||
#ifndef GL_CHROMIUM_path_rendering
|
||||
#define GL_CHROMIUM_path_rendering 1
|
||||
#define GL_PATH_MODELVIEW_CHROMIUM 0x1700
|
||||
#define GL_PATH_PROJECTION_CHROMIUM 0x1701
|
||||
#define GL_CLOSE_PATH_CHROMIUM 0x00
|
||||
#define GL_MOVE_TO_CHROMIUM 0x02
|
||||
#define GL_LINE_TO_CHROMIUM 0x04
|
||||
#define GL_QUADRATIC_CURVE_TO_CHROMIUM 0x0A
|
||||
#define GL_CUBIC_CURVE_TO_CHROMIUM 0x0C
|
||||
#define GL_CONIC_CURVE_TO_CHROMIUM 0x1A
|
||||
#define GL_PATH_MODELVIEW_MATRIX_CHROMIUM 0x0BA6
|
||||
#define GL_PATH_PROJECTION_MATRIX_CHROMIUM 0x0BA7
|
||||
#define GL_PATH_STROKE_WIDTH_CHROMIUM 0x9075
|
||||
#define GL_PATH_END_CAPS_CHROMIUM 0x9076
|
||||
#define GL_PATH_JOIN_STYLE_CHROMIUM 0x9079
|
||||
#define GL_PATH_MITER_LIMIT_CHROMIUM 0x907a
|
||||
#define GL_PATH_STROKE_BOUND_CHROMIUM 0x9086
|
||||
#define GL_FLAT_CHROMIUM 0x1D00
|
||||
#define GL_SQUARE_CHROMIUM 0x90a3
|
||||
#define GL_ROUND_CHROMIUM 0x90a4
|
||||
#define GL_BEVEL_CHROMIUM 0x90A6
|
||||
#define GL_MITER_REVERT_CHROMIUM 0x90A7
|
||||
#define GL_COUNT_UP_CHROMIUM 0x9088
|
||||
#define GL_COUNT_DOWN_CHROMIUM 0x9089
|
||||
#define GL_CONVEX_HULL_CHROMIUM 0x908B
|
||||
#define GL_BOUNDING_BOX_CHROMIUM 0x908D
|
||||
#define GL_BOUNDING_BOX_OF_BOUNDING_BOXES_CHROMIUM 0x909C
|
||||
#define GL_EYE_LINEAR_CHROMIUM 0x2400
|
||||
#define GL_OBJECT_LINEAR_CHROMIUM 0x2401
|
||||
#define GL_CONSTANT_CHROMIUM 0x8576
|
||||
#define GL_TRANSLATE_X_CHROMIUM 0x908E
|
||||
#define GL_TRANSLATE_Y_CHROMIUM 0x908F
|
||||
#define GL_TRANSLATE_2D_CHROMIUM 0x9090
|
||||
#define GL_TRANSLATE_3D_CHROMIUM 0x9091
|
||||
#define GL_AFFINE_2D_CHROMIUM 0x9092
|
||||
#define GL_AFFINE_3D_CHROMIUM 0x9094
|
||||
#define GL_TRANSPOSE_AFFINE_2D_CHROMIUM 0x9096
|
||||
#define GL_TRANSPOSE_AFFINE_3D_CHROMIUM 0x9098
|
||||
typedef void(GL_APIENTRYP PFNGLMATRIXLOADFCHROMIUMPROC)(GLenum matrixMode, const GLfloat *m);
|
||||
typedef void(GL_APIENTRYP PFNGLMATRIXLOADIDENTITYCHROMIUMPROC)(GLenum matrixMode);
|
||||
typedef GLuint(GL_APIENTRYP PFNGLGENPATHSCHROMIUMPROC)(GLsizei range);
|
||||
typedef void(GL_APIENTRYP PFNGLDELETEPATHSCHROMIUMPROC)(GLuint path, GLsizei range);
|
||||
typedef GLboolean(GL_APIENTRYP PFNGLISPATHCHROMIUMPROC)(GLuint path);
|
||||
typedef void(GL_APIENTRYP PFNGLPATHCOMMANDSCHROMIUMPROC)(GLuint path,
|
||||
GLsizei numCommands,
|
||||
const GLubyte *commands,
|
||||
GLsizei numCoords,
|
||||
GLenum coordType,
|
||||
const void *coords);
|
||||
typedef void(GL_APIENTRYP PFNGLPATHPARAMETERICHROMIUMPROC)(GLuint path, GLenum pname, GLint value);
|
||||
typedef void(GL_APIENTRYP PFNGLPATHPARAMETERFCHROMIUMPROC)(GLuint path,
|
||||
GLenum pname,
|
||||
GLfloat value);
|
||||
typedef void(GL_APIENTRYP PFNGLGETPATHPARAMETERIVCHROMIUMPROC)(GLuint path,
|
||||
GLenum pname,
|
||||
GLint *value);
|
||||
typedef void(GL_APIENTRYP PFNGLGETPATHPARAMETERFVCHROMIUMPROC)(GLuint path,
|
||||
GLenum pname,
|
||||
GLfloat *value);
|
||||
typedef void(GL_APIENTRYP PFNGLPATHSTENCILFUNCCHROMIUMPROC)(GLenum func, GLint ref, GLuint mask);
|
||||
typedef void(GL_APIENTRYP PFNGLSTENCILFILLPATHCHROMIUMPROC)(GLuint path,
|
||||
GLenum fillMode,
|
||||
GLuint mask);
|
||||
typedef void(GL_APIENTRYP PFNGLSTENCILSTROKEPATHCHROMIUMPROC)(GLuint path,
|
||||
GLint reference,
|
||||
GLuint mask);
|
||||
typedef void(GL_APIENTRYP PFNGLCOVERFILLPATHCHROMIUMPROC)(GLuint path, GLenum coverMode);
|
||||
typedef void(GL_APIENTRYP PFNGLCOVERSTROKEPATHCHROMIUMPROC)(GLuint path, GLenum coverMode);
|
||||
typedef void(GL_APIENTRYP PFNGLSTENCILTHENCOVERFILLPATHCHROMIUMPROC)(GLuint path,
|
||||
GLenum fillMode,
|
||||
GLuint mask,
|
||||
GLenum coverMode);
|
||||
typedef void(GL_APIENTRYP PFNGLSTENCILTHENCOVERSTROKEPATHCHROMIUMPROC)(GLuint path,
|
||||
GLint reference,
|
||||
GLuint mask,
|
||||
GLenum coverMode);
|
||||
typedef void(GL_APIENTRYP PFNGLCOVERFILLPATHINSTANCEDCHROMIUMPROC)(GLsizei numPaths,
|
||||
GLenum pathNameType,
|
||||
const void *paths,
|
||||
GLuint pathBase,
|
||||
GLenum coverMode,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues);
|
||||
typedef void(GL_APIENTRYP PFNGLCOVERSTROKEPATHINSTANCEDCHROMIUMPROC)(
|
||||
GLsizei numPaths,
|
||||
GLenum pathNameType,
|
||||
const void *paths,
|
||||
GLuint pathBase,
|
||||
GLenum coverMode,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues);
|
||||
typedef void(GL_APIENTRYP PFNGLSTENCILFILLPATHINSTANCEDCHROMIUMPROC)(
|
||||
GLsizei numPaths,
|
||||
GLenum pathNameType,
|
||||
const void *paths,
|
||||
GLuint pathBase,
|
||||
GLenum fillMode,
|
||||
GLuint mask,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues);
|
||||
typedef void(GL_APIENTRYP PFNGLSTENCILSTROKEPATHINSTANCEDCHROMIUMPROC)(
|
||||
GLsizei numPaths,
|
||||
GLenum pathNameType,
|
||||
const void *paths,
|
||||
GLuint pathBase,
|
||||
GLint reference,
|
||||
GLuint mask,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues);
|
||||
typedef void(GL_APIENTRYP PFNGLSTENCILTHENCOVERFILLPATHINSTANCEDCHROMIUMPROC)(
|
||||
GLsizei numPaths,
|
||||
GLenum pathNameType,
|
||||
const void *paths,
|
||||
GLuint pathBase,
|
||||
GLenum fillMode,
|
||||
GLuint mask,
|
||||
GLenum coverMode,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues);
|
||||
typedef void(GL_APIENTRYP PFNGLSTENCILTHENCOVERSTROKEPATHINSTANCEDCHROMIUMPROC)(
|
||||
GLsizei numPaths,
|
||||
GLenum pathNameType,
|
||||
const void *paths,
|
||||
GLuint pathBase,
|
||||
GLint reference,
|
||||
GLuint mask,
|
||||
GLenum coverMode,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues);
|
||||
|
||||
typedef void(GL_APIENTRY PFNGLBINDFRAGMENTINPUTLOCATIONCHROMIUMPROC)(GLuint program,
|
||||
GLint location,
|
||||
const GLchar *name);
|
||||
typedef void(GL_APIENTRYP PFNGLPROGRAMPATHFRAGMENTINPUTGENCHROMIUMPROC)(GLuint program,
|
||||
GLint location,
|
||||
GLenum genMode,
|
||||
GLint components,
|
||||
const GLfloat *coeffs);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_APICALL void GL_APIENTRY glMatrixLoadfCHROMIUM(GLenum matrixMode, const GLfloat *m);
|
||||
GL_APICALL void GL_APIENTRY glMatrixLoadIdentityCHROMIUM(GLenum matrixMode);
|
||||
GL_APICALL GLuint GL_APIENTRY glGenPathsCHROMIUM(GLsizei range);
|
||||
GL_APICALL void GL_APIENTRY glDeletePathsCHROMIUM(GLuint path, GLsizei range);
|
||||
GL_APICALL GLboolean GL_APIENTRY glIsPathCHROMIUM(GLuint path);
|
||||
GL_APICALL void GL_APIENTRY glPathCommandsCHROMIUM(GLuint path,
|
||||
GLsizei numCommands,
|
||||
const GLubyte *commands,
|
||||
GLsizei numCoords,
|
||||
GLenum coordType,
|
||||
const void *coords);
|
||||
GL_APICALL void GL_APIENTRY glPathParameteriCHROMIUM(GLuint path, GLenum pname, GLint value);
|
||||
GL_APICALL void GL_APIENTRY glPathParameterfCHROMIUM(GLuint path, GLenum pname, GLfloat value);
|
||||
GL_APICALL void GL_APIENTRY glGetPathParameterivCHROMIUM(GLuint path, GLenum pname, GLint *value);
|
||||
GL_APICALL void GL_APIENTRY glGetPathParameterfvCHROMIUM(GLuint path, GLenum pname, GLfloat *value);
|
||||
GL_APICALL void GL_APIENTRY glPathStencilFuncCHROMIUM(GLenum func, GLint ref, GLuint mask);
|
||||
GL_APICALL void GL_APIENTRY glStencilFillPathCHROMIUM(GLuint path, GLenum fillMode, GLuint mask);
|
||||
GL_APICALL void GL_APIENTRY glStencilStrokePathCHROMIUM(GLuint path, GLint reference, GLuint mask);
|
||||
GL_APICALL void GL_APIENTRY glCoverFillPathCHROMIUM(GLuint path, GLenum coverMode);
|
||||
GL_APICALL void GL_APIENTRY glCoverStrokePathCHROMIUM(GLuint path, GLenum coverMode);
|
||||
GL_APICALL void GL_APIENTRY glStencilThenCoverFillPathCHROMIUM(GLuint path,
|
||||
GLenum fillMode,
|
||||
GLuint mask,
|
||||
GLenum coverMode);
|
||||
GL_APICALL void GL_APIENTRY glStencilThenCoverStrokePathCHROMIUM(GLuint path,
|
||||
GLint reference,
|
||||
GLuint mask,
|
||||
GLenum coverMode);
|
||||
GL_APICALL void GL_APIENTRY glCoverFillPathInstancedCHROMIUM(GLsizei numPaths,
|
||||
GLenum pathNameType,
|
||||
const void *paths,
|
||||
GLuint pathBase,
|
||||
GLenum coverMode,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues);
|
||||
GL_APICALL void GL_APIENTRY glCoverStrokePathInstancedCHROMIUM(GLsizei numPaths,
|
||||
GLenum pathNameType,
|
||||
const void *paths,
|
||||
GLuint pathBase,
|
||||
GLenum coverMode,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues);
|
||||
GL_APICALL void GL_APIENTRY glStencilFillPathInstancedCHROMIUM(GLsizei numPaths,
|
||||
GLenum pathNameType,
|
||||
const void *paths,
|
||||
GLuint pathBase,
|
||||
GLenum fillMode,
|
||||
GLuint mask,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues);
|
||||
GL_APICALL void GL_APIENTRY glStencilStrokePathInstancedCHROMIUM(GLsizei numPaths,
|
||||
GLenum pathNameType,
|
||||
const void *paths,
|
||||
GLuint pathBase,
|
||||
GLint reference,
|
||||
GLuint mask,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues);
|
||||
GL_APICALL void GL_APIENTRY
|
||||
glStencilThenCoverFillPathInstancedCHROMIUM(GLsizei numPaths,
|
||||
GLenum pathNameType,
|
||||
const void *paths,
|
||||
GLuint pathBase,
|
||||
GLenum fillMode,
|
||||
GLuint mask,
|
||||
GLenum coverMode,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues);
|
||||
|
||||
GL_APICALL void GL_APIENTRY
|
||||
glStencilThenCoverStrokePathInstancedCHROMIUM(GLsizei numPaths,
|
||||
GLenum pathNameType,
|
||||
const void *paths,
|
||||
GLuint pathBase,
|
||||
GLint reference,
|
||||
GLuint mask,
|
||||
GLenum coverMode,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues);
|
||||
|
||||
GL_APICALL void GL_APIENTRY glBindFragmentInputLocationCHROMIUM(GLuint program,
|
||||
GLint location,
|
||||
const GLchar *name);
|
||||
GL_APICALL void GL_APIENTRY glProgramPathFragmentInputGenCHROMIUM(GLuint program,
|
||||
GLint location,
|
||||
GLenum genMode,
|
||||
GLint components,
|
||||
const GLfloat *coeffs);
|
||||
|
||||
#endif
|
||||
#endif /* GL_CHROMIUM_path_rendering */
|
||||
|
||||
#ifndef GL_CHROMIUM_copy_texture
|
||||
#define GL_CHROMIUM_copy_texture 1
|
||||
typedef void(GL_APIENTRYP PFNGLCOPYTEXTURECHROMIUMPROC)(GLuint sourceId,
|
||||
GLint sourceLevel,
|
||||
GLenum destTarget,
|
||||
GLuint destId,
|
||||
GLint destLevel,
|
||||
GLint internalFormat,
|
||||
GLenum destType,
|
||||
GLboolean unpackFlipY,
|
||||
GLboolean unpackPremultiplyAlpha,
|
||||
GLboolean unpackUnmultiplyAlpha);
|
||||
typedef void(GL_APIENTRYP PFNGLCOPYSUBTEXTURECHROMIUMPROC)(GLuint sourceId,
|
||||
GLint sourceLevel,
|
||||
GLenum destTarget,
|
||||
GLuint destId,
|
||||
GLint destLevel,
|
||||
GLint xoffset,
|
||||
GLint yoffset,
|
||||
GLint x,
|
||||
GLint y,
|
||||
GLsizei width,
|
||||
GLsizei height,
|
||||
GLboolean unpackFlipY,
|
||||
GLboolean unpackPremultiplyAlpha,
|
||||
GLboolean unpackUnmultiplyAlpha);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_APICALL void GL_APIENTRY glCopyTextureCHROMIUM(GLuint sourceId,
|
||||
GLint sourceLevel,
|
||||
GLenum destTarget,
|
||||
GLuint destId,
|
||||
GLint destLevel,
|
||||
GLint internalFormat,
|
||||
GLenum destType,
|
||||
GLboolean unpackFlipY,
|
||||
GLboolean unpackPremultiplyAlpha,
|
||||
GLboolean unpackUnmultiplyAlpha);
|
||||
GL_APICALL void GL_APIENTRY glCopySubTextureCHROMIUM(GLuint sourceId,
|
||||
GLint sourceLevel,
|
||||
GLenum destTarget,
|
||||
GLuint destId,
|
||||
GLint destLevel,
|
||||
GLint xoffset,
|
||||
GLint yoffset,
|
||||
GLint x,
|
||||
GLint y,
|
||||
GLsizei width,
|
||||
GLsizei height,
|
||||
GLboolean unpackFlipY,
|
||||
GLboolean unpackPremultiplyAlpha,
|
||||
GLboolean unpackUnmultiplyAlpha);
|
||||
#endif
|
||||
#endif /* GL_CHROMIUM_copy_texture */
|
||||
|
||||
#ifndef GL_CHROMIUM_compressed_copy_texture
|
||||
#define GL_CHROMIUM_compressed_copy_texture 1
|
||||
typedef void(GL_APIENTRYP PFNGLCOMPRESSEDCOPYTEXTURECHROMIUMPROC)(GLuint sourceId, GLuint destId);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_APICALL void GL_APIENTRY glCompressedCopyTextureCHROMIUM(GLuint sourceId, GLuint destId);
|
||||
#endif
|
||||
#endif /* GL_CHROMIUM_compressed_copy_texture */
|
||||
|
||||
#ifndef GL_CHROMIUM_sync_query
|
||||
#define GL_CHROMIUM_sync_query 1
|
||||
#define GL_COMMANDS_COMPLETED_CHROMIUM 0x84F7
|
||||
#endif /* GL_CHROMIUM_sync_query */
|
||||
|
||||
#ifndef GL_EXT_texture_compression_s3tc_srgb
|
||||
#define GL_EXT_texture_compression_s3tc_srgb 1
|
||||
#define GL_COMPRESSED_SRGB_S3TC_DXT1_EXT 0x8C4C
|
||||
#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT 0x8C4D
|
||||
#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT 0x8C4E
|
||||
#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT 0x8C4F
|
||||
#endif /* GL_EXT_texture_compression_s3tc_srgb */
|
||||
|
||||
#ifndef GL_ANGLE_lossy_etc_decode
|
||||
#define GL_ANGLE_lossy_etc_decode 1
|
||||
#define GL_ETC1_RGB8_LOSSY_DECODE_ANGLE 0x9690
|
||||
#define GL_COMPRESSED_R11_LOSSY_DECODE_EAC_ANGLE 0x9691
|
||||
#define GL_COMPRESSED_SIGNED_R11_LOSSY_DECODE_EAC_ANGLE 0x9692
|
||||
#define GL_COMPRESSED_RG11_LOSSY_DECODE_EAC_ANGLE 0x9693
|
||||
#define GL_COMPRESSED_SIGNED_RG11_LOSSY_DECODE_EAC_ANGLE 0x9694
|
||||
#define GL_COMPRESSED_RGB8_LOSSY_DECODE_ETC2_ANGLE 0x9695
|
||||
#define GL_COMPRESSED_SRGB8_LOSSY_DECODE_ETC2_ANGLE 0x9696
|
||||
#define GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_LOSSY_DECODE_ETC2_ANGLE 0x9697
|
||||
#define GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_LOSSY_DECODE_ETC2_ANGLE 0x9698
|
||||
#define GL_COMPRESSED_RGBA8_LOSSY_DECODE_ETC2_EAC_ANGLE 0x9699
|
||||
#define GL_COMPRESSED_SRGB8_ALPHA8_LOSSY_DECODE_ETC2_EAC_ANGLE 0x969A
|
||||
#endif /* GL_ANGLE_lossy_etc_decode */
|
||||
|
||||
#ifndef GL_ANGLE_robust_client_memory
|
||||
#define GL_ANGLE_robust_client_memory 1
|
||||
typedef void (GL_APIENTRYP PFNGLGETBOOLEANVROBUSTANGLE) (GLenum pname, GLsizei bufSize, GLsizei *length, GLboolean *data);
|
||||
typedef void (GL_APIENTRYP PFNGLGETBUFFERPARAMETERIVROBUSTANGLE) (GLenum target, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETFLOATVROBUSTANGLE) (GLenum pname, GLsizei bufSize, GLsizei *length, GLfloat *data);
|
||||
typedef void (GL_APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVROBUSTANGLE) (GLenum target, GLenum attachment, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETINTEGERVROBUSTANGLE) (GLenum pname, GLsizei bufSize, GLsizei *length, GLint *data);
|
||||
typedef void (GL_APIENTRYP PFNGLGETPROGRAMIVROBUSTANGLE) (GLuint program, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETRENDERBUFFERPARAMETERIVROBUSTANGLE) (GLenum target, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETSHADERIVROBUSTANGLE) (GLuint shader, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERFVROBUSTANGLE) (GLenum target, GLenum pname, GLsizei bufSize, GLsizei *length, GLfloat *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERIVROBUSTANGLE) (GLenum target, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETUNIFORMFVROBUSTANGLE) (GLuint program, GLint location, GLsizei bufSize, GLsizei *length, GLfloat *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETUNIFORMIVROBUSTANGLE) (GLuint program, GLint location, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBFVROBUSTANGLE) (GLuint index, GLenum pname, GLsizei bufSize, GLsizei *length, GLfloat *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBIVROBUSTANGLE) (GLuint index, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVROBUSTANGLE) (GLuint index, GLenum pname, GLsizei bufSize, GLsizei *length, void **pointer);
|
||||
typedef void (GL_APIENTRYP PFNGLREADPIXELSROBUSTANGLE) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, GLsizei *length, GLsizei *columns, GLsizei *rows, void *pixels);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXIMAGE2DROBUSTANGLE) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, GLsizei bufSize, const void *pixels);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXPARAMETERFVROBUSTANGLE) (GLenum target, GLenum pname, GLsizei bufSize, const GLfloat *params);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIVROBUSTANGLE) (GLenum target, GLenum pname, GLsizei bufSize, const GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXSUBIMAGE2DROBUSTANGLE) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, const void *pixels);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXIMAGE3DROBUSTANGLE) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, GLsizei bufSize, const void *pixels);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXSUBIMAGE3DROBUSTANGLE) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLsizei bufSize, const void *pixels);
|
||||
typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DROBUSTANGLE) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, GLsizei bufSize, const void *data);
|
||||
typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DROBUSTANGLE) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, GLsizei bufSize, const void *data);
|
||||
typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DROBUSTANGLE) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, GLsizei bufSize, const void *data);
|
||||
typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DROBUSTANGLE) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, GLsizei bufSize, const void *data);
|
||||
typedef void (GL_APIENTRYP PFNGLGETQUERYIVROBUSTANGLE) (GLenum target, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTUIVROBUSTANGLE) (GLuint id, GLenum pname, GLsizei bufSize, GLsizei *length, GLuint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETBUFFERPOINTERVROBUSTANGLE) (GLenum target, GLenum pname, GLsizei bufSize, GLsizei *length, void **params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETINTEGERI_VROBUSTANGLE) (GLenum target, GLuint index, GLsizei bufSize, GLsizei *length, GLint *data);
|
||||
typedef void (GL_APIENTRYP PFNGETINTERNALFORMATIVROBUSTANGLE) (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBIIVROBUSTANGLE) (GLuint index, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBIUIVROBUSTANGLE) (GLuint index, GLenum pname, GLsizei bufSize, GLsizei *length, GLuint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETUNIFORMUIVROBUSTANGLE) (GLuint program, GLint location, GLsizei bufSize, GLsizei *length, GLuint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETACTIVEUNIFORMBLOCKIVROBUSTANGLE) (GLuint program, GLuint uniformBlockIndex, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETINTEGER64VROBUSTANGLE) (GLenum pname, GLsizei bufSize, GLsizei *length, GLint64 *data);
|
||||
typedef void (GL_APIENTRYP PFNGLGETINTEGER64I_VROBUSTANGLE) (GLenum target, GLuint index, GLsizei bufSize, GLsizei *length, GLint64 *data);
|
||||
typedef void (GL_APIENTRYP PFNGLGETBUFFERPARAMETERI64VROBUSTANGLE) (GLenum target, GLenum pname, GLsizei bufSize, GLsizei *length, GLint64 *params);
|
||||
typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERIVROBUSTANGLE) (GLuint sampler, GLenum pname, GLsizei bufSize, const GLint *param);
|
||||
typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERFVROBUSTANGLE) (GLuint sampler, GLenum pname, GLsizei bufSize, const GLfloat *param);
|
||||
typedef void (GL_APIENTRYP PFNGLGETSAMPLERPARAMETERIVROBUSTANGLE) (GLuint sampler, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETSAMPLERPARAMETERFVROBUSTANGLE) (GLuint sampler, GLenum pname, GLsizei bufSize, GLsizei *length, GLfloat *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETFRAMEBUFFERPARAMETERIVROBUSTANGLE) (GLenum target, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETPROGRAMINTERFACEIVROBUSTANGLE) (GLuint program, GLenum programInterface, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETBOOLEANI_VROBUSTANGLE) (GLenum target, GLuint index, GLsizei bufSize, GLsizei *length, GLboolean *data);
|
||||
typedef void (GL_APIENTRYP PFNGLGETMULTISAMPLEFVROBUSTANGLE) (GLenum pname, GLuint index, GLsizei bufSize, GLsizei *length, GLfloat *val);
|
||||
typedef void (GL_APIENTRYP PFNGLGETTEXLEVELPARAMETERIVROBUSTANGLE) (GLenum target, GLint level, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETTEXLEVELPARAMETERFVROBUSTANGLE) (GLenum target, GLint level, GLenum pname, GLsizei bufSize, GLsizei *length, GLfloat *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETPOINTERVROBUSTANGLEROBUSTANGLE) (GLenum pname, GLsizei bufSize, GLsizei *length, void **params);
|
||||
typedef void (GL_APIENTRYP PFNGLREADNPIXELSROBUSTANGLE) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, GLsizei *length, GLsizei *columns, GLsizei *rows, void *data);
|
||||
typedef void (GL_APIENTRYP PFNGLGETNUNIFORMFVROBUSTANGLE) (GLuint program, GLint location, GLsizei bufSize, GLsizei *length, GLfloat *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETNUNIFORMIVROBUSTANGLE) (GLuint program, GLint location, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETNUNIFORMUIVROBUSTANGLE) (GLuint program, GLint location, GLsizei bufSize, GLsizei *length, GLuint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIIVROBUSTANGLE) (GLenum target, GLenum pname, GLsizei bufSize, const GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIUIVROBUSTANGLE) (GLenum target, GLenum pname, GLsizei bufSize, const GLuint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERIIVROBUSTANGLE) (GLenum target, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERIUIVROBUSTANGLE) (GLenum target, GLenum pname, GLsizei bufSize, GLsizei *length, GLuint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERIIVROBUSTANGLE) (GLuint sampler, GLenum pname, GLsizei bufSize, const GLint *param);
|
||||
typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERIUIVROBUSTANGLE) (GLuint sampler, GLenum pname, GLsizei bufSize, const GLuint *param);
|
||||
typedef void (GL_APIENTRYP PFNGLGETSAMPLERPARAMETERIIVROBUSTANGLE) (GLuint sampler, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETSAMPLERPARAMETERIUIVROBUSTANGLE) (GLuint sampler, GLenum pname, GLsizei bufSize, GLsizei *length, GLuint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTIVROBUSTANGLE)(GLuint id, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTI64VROBUSTANGLE)(GLuint id, GLenum pname, GLsizei bufSize, GLsizei *length, GLint64 *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTUI64VROBUSTANGLE)(GLuint id, GLenum pname, GLsizei bufSize, GLsizei *length, GLuint64 *params);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_APICALL void GL_APIENTRY glGetBooleanvRobustANGLE (GLenum pname, GLsizei bufSize, GLsizei *length, GLboolean *data);
|
||||
GL_APICALL void GL_APIENTRY glGetBufferParameterivRobustANGLE (GLenum target, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
GL_APICALL void GL_APIENTRY glGetFloatvRobustANGLE (GLenum pname, GLsizei bufSize, GLsizei *length, GLfloat *data);
|
||||
GL_APICALL void GL_APIENTRY glGetFramebufferAttachmentParameterivRobustANGLE (GLenum target, GLenum attachment, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
GL_APICALL void GL_APIENTRY glGetIntegervRobustANGLE (GLenum pname, GLsizei bufSize, GLsizei *length, GLint *data);
|
||||
GL_APICALL void GL_APIENTRY glGetProgramivRobustANGLE (GLuint program, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
GL_APICALL void GL_APIENTRY glGetRenderbufferParameterivRobustANGLE (GLenum target, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
GL_APICALL void GL_APIENTRY glGetShaderivRobustANGLE (GLuint shader, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
GL_APICALL void GL_APIENTRY glGetTexParameterfvRobustANGLE (GLenum target, GLenum pname, GLsizei bufSize, GLsizei *length, GLfloat *params);
|
||||
GL_APICALL void GL_APIENTRY glGetTexParameterivRobustANGLE (GLenum target, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
GL_APICALL void GL_APIENTRY glGetUniformfvRobustANGLE (GLuint program, GLint location, GLsizei bufSize, GLsizei *length, GLfloat *params);
|
||||
GL_APICALL void GL_APIENTRY glGetUniformivRobustANGLE (GLuint program, GLint location, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
GL_APICALL void GL_APIENTRY glGetVertexAttribfvRobustANGLE (GLuint index, GLenum pname, GLsizei bufSize, GLsizei *length, GLfloat *params);
|
||||
GL_APICALL void GL_APIENTRY glGetVertexAttribivRobustANGLE (GLuint index, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
GL_APICALL void GL_APIENTRY glGetVertexAttribPointervRobustANGLE (GLuint index, GLenum pname, GLsizei bufSize, GLsizei *length, void **pointer);
|
||||
GL_APICALL void GL_APIENTRY glReadPixelsRobustANGLE (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, GLsizei *length, GLsizei *columns, GLsizei *rows, void *pixels);
|
||||
GL_APICALL void GL_APIENTRY glTexImage2DRobustANGLE (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, GLsizei bufSize, const void *pixels);
|
||||
GL_APICALL void GL_APIENTRY glTexParameterfvRobustANGLE (GLenum target, GLenum pname, GLsizei bufSize, const GLfloat *params);
|
||||
GL_APICALL void GL_APIENTRY glTexParameterivRobustANGLE (GLenum target, GLenum pname, GLsizei bufSize, const GLint *params);
|
||||
GL_APICALL void GL_APIENTRY glTexSubImage2DRobustANGLE (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, const void *pixels);
|
||||
GL_APICALL void GL_APIENTRY glTexImage3DRobustANGLE (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, GLsizei bufSize, const void *pixels);
|
||||
GL_APICALL void GL_APIENTRY glTexSubImage3DRobustANGLE (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLsizei bufSize, const void *pixels);
|
||||
GL_APICALL void GL_APIENTRY glCompressedTexImage2DRobustANGLE(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, GLsizei bufSize, const void *data);
|
||||
GL_APICALL void GL_APIENTRY glCompressedTexSubImage2DRobustANGLE(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, GLsizei bufSize, const void *data);
|
||||
GL_APICALL void GL_APIENTRY glCompressedTexImage3DRobustANGLE(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, GLsizei bufSize, const void *data);
|
||||
GL_APICALL void GL_APIENTRY glCompressedTexSubImage3DRobustANGLE(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, GLsizei bufSize, const void *data);
|
||||
GL_APICALL void GL_APIENTRY glGetQueryivRobustANGLE (GLenum target, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
GL_APICALL void GL_APIENTRY glGetQueryObjectuivRobustANGLE (GLuint id, GLenum pname, GLsizei bufSize, GLsizei *length, GLuint *params);
|
||||
GL_APICALL void GL_APIENTRY glGetBufferPointervRobustANGLE (GLenum target, GLenum pname, GLsizei bufSize, GLsizei *length, void **params);
|
||||
GL_APICALL void GL_APIENTRY glGetIntegeri_vRobustANGLE (GLenum target, GLuint index, GLsizei bufSize, GLsizei *length, GLint *data);
|
||||
GL_APICALL void GL_APIENTRY glGetInternalformativRobustANGLE (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
GL_APICALL void GL_APIENTRY glGetVertexAttribIivRobustANGLE (GLuint index, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
GL_APICALL void GL_APIENTRY glGetVertexAttribIuivRobustANGLE (GLuint index, GLenum pname, GLsizei bufSize, GLsizei *length, GLuint *params);
|
||||
GL_APICALL void GL_APIENTRY glGetUniformuivRobustANGLE (GLuint program, GLint location, GLsizei bufSize, GLsizei *length, GLuint *params);
|
||||
GL_APICALL void GL_APIENTRY glGetActiveUniformBlockivRobustANGLE (GLuint program, GLuint uniformBlockIndex, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
GL_APICALL void GL_APIENTRY glGetInteger64vRobustANGLE (GLenum pname, GLsizei bufSize, GLsizei *length, GLint64 *data);
|
||||
GL_APICALL void GL_APIENTRY glGetInteger64i_vRobustANGLE (GLenum target, GLuint index, GLsizei bufSize, GLsizei *length, GLint64 *data);
|
||||
GL_APICALL void GL_APIENTRY glGetBufferParameteri64vRobustANGLE (GLenum target, GLenum pname, GLsizei bufSize, GLsizei *length, GLint64 *params);
|
||||
GL_APICALL void GL_APIENTRY glSamplerParameterivRobustANGLE (GLuint sampler, GLenum pname, GLsizei bufSize, const GLint *param);
|
||||
GL_APICALL void GL_APIENTRY glSamplerParameterfvRobustANGLE (GLuint sampler, GLenum pname, GLsizei bufSize, const GLfloat *param);
|
||||
GL_APICALL void GL_APIENTRY glGetSamplerParameterivRobustANGLE (GLuint sampler, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
GL_APICALL void GL_APIENTRY glGetSamplerParameterfvRobustANGLE (GLuint sampler, GLenum pname, GLsizei bufSize, GLsizei *length, GLfloat *params);
|
||||
GL_APICALL void GL_APIENTRY glGetFramebufferParameterivRobustANGLE (GLenum target, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
GL_APICALL void GL_APIENTRY glGetProgramInterfaceivRobustANGLE (GLuint program, GLenum programInterface, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
GL_APICALL void GL_APIENTRY glGetBooleani_vRobustANGLE (GLenum target, GLuint index, GLsizei bufSize, GLsizei *length, GLboolean *data);
|
||||
GL_APICALL void GL_APIENTRY glGetMultisamplefvRobustANGLE (GLenum pname, GLuint index, GLsizei bufSize, GLsizei *length, GLfloat *val);
|
||||
GL_APICALL void GL_APIENTRY glGetTexLevelParameterivRobustANGLE (GLenum target, GLint level, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
GL_APICALL void GL_APIENTRY glGetTexLevelParameterfvRobustANGLE (GLenum target, GLint level, GLenum pname, GLsizei bufSize, GLsizei *length, GLfloat *params);
|
||||
GL_APICALL void GL_APIENTRY glGetPointervRobustANGLERobustANGLE (GLenum pname, GLsizei bufSize, GLsizei *length, void **params);
|
||||
GL_APICALL void GL_APIENTRY glReadnPixelsRobustANGLE (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, GLsizei *length, GLsizei *columns, GLsizei *rows, void *data);
|
||||
GL_APICALL void GL_APIENTRY glGetnUniformfvRobustANGLE (GLuint program, GLint location, GLsizei bufSize, GLsizei *length, GLfloat *params);
|
||||
GL_APICALL void GL_APIENTRY glGetnUniformivRobustANGLE (GLuint program, GLint location, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
GL_APICALL void GL_APIENTRY glGetnUniformuivRobustANGLE (GLuint program, GLint location, GLsizei bufSize, GLsizei *length, GLuint *params);
|
||||
GL_APICALL void GL_APIENTRY glTexParameterIivRobustANGLE (GLenum target, GLenum pname, GLsizei bufSize, const GLint *params);
|
||||
GL_APICALL void GL_APIENTRY glTexParameterIuivRobustANGLE (GLenum target, GLenum pname, GLsizei bufSize, const GLuint *params);
|
||||
GL_APICALL void GL_APIENTRY glGetTexParameterIivRobustANGLE (GLenum target, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
GL_APICALL void GL_APIENTRY glGetTexParameterIuivRobustANGLE (GLenum target, GLenum pname, GLsizei bufSize, GLsizei *length, GLuint *params);
|
||||
GL_APICALL void GL_APIENTRY glSamplerParameterIivRobustANGLE (GLuint sampler, GLenum pname, GLsizei bufSize, const GLint *param);
|
||||
GL_APICALL void GL_APIENTRY glSamplerParameterIuivRobustANGLE (GLuint sampler, GLenum pname, GLsizei bufSize, const GLuint *param);
|
||||
GL_APICALL void GL_APIENTRY glGetSamplerParameterIivRobustANGLE (GLuint sampler, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
GL_APICALL void GL_APIENTRY glGetSamplerParameterIuivRobustANGLE (GLuint sampler, GLenum pname, GLsizei bufSize, GLsizei *length, GLuint *params);
|
||||
GL_APICALL void GL_APIENTRY glGetQueryObjectivRobustANGLE(GLuint id, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
GL_APICALL void GL_APIENTRY glGetQueryObjecti64vRobustANGLE(GLuint id, GLenum pname, GLsizei bufSize, GLsizei *length, GLint64 *params);
|
||||
GL_APICALL void GL_APIENTRY glGetQueryObjectui64vRobustANGLE(GLuint id, GLenum pname, GLsizei bufSize, GLsizei *length, GLuint64 *params);
|
||||
#endif
|
||||
#endif /* GL_ANGLE_robust_client_memory */
|
||||
|
||||
#ifndef GL_ANGLE_program_cache_control
|
||||
#define GL_ANGLE_program_cache_control 1
|
||||
#define GL_PROGRAM_CACHE_ENABLED_ANGLE 0x93AC
|
||||
#endif /* GL_ANGLE_program_cache_control */
|
||||
|
||||
#ifndef GL_ANGLE_multiview
|
||||
#define GL_ANGLE_multiview 1
|
||||
// The next four enums coincide with the enums introduced by the GL_OVR_multiview extension and use the values reserved by that extension.
|
||||
#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_NUM_VIEWS_ANGLE 0x9630
|
||||
#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_BASE_VIEW_INDEX_ANGLE 0x9632
|
||||
#define GL_MAX_VIEWS_ANGLE 0x9631
|
||||
#define GL_FRAMEBUFFER_INCOMPLETE_VIEW_TARGETS_ANGLE 0x9633
|
||||
// The next four enums are reserved specifically for ANGLE.
|
||||
#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_VIEWPORT_OFFSETS_ANGLE 0x969B
|
||||
#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_MULTIVIEW_LAYOUT_ANGLE 0x969C
|
||||
#define GL_FRAMEBUFFER_MULTIVIEW_SIDE_BY_SIDE_ANGLE 0x969D
|
||||
#define GL_FRAMEBUFFER_MULTIVIEW_LAYERED_ANGLE 0x969E
|
||||
typedef void(GL_APIENTRYP PFNGLFRAMEBUFFERTEXTUREMULTIVIEWLAYEREDANGLE)(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint baseViewIndex, GLsizei numViews);
|
||||
typedef void(GL_APIENTRYP PFNGLFRAMEBUFFERTEXTUREMULTIVIEWSIDEBYSIDEANGLE)(GLenum target, GLenum attachment, GLuint texture, GLint level, GLsizei numViews, const GLint *viewportOffsets);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_APICALL void GL_APIENTRY glFramebufferTextureMultiviewLayeredANGLE(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint baseViewIndex, GLsizei numViews);
|
||||
GL_APICALL void GL_APIENTRY glFramebufferTextureMultiviewSideBySideANGLE(GLenum target, GLenum attachment, GLuint texture, GLint level, GLsizei numViews, const GLint *viewportOffsets);
|
||||
#endif
|
||||
#endif /* GL_ANGLE_multiview */
|
||||
|
||||
#ifndef GL_ANGLE_texture_rectangle
|
||||
#define GL_ANGLE_texture_rectangle 1
|
||||
#define GL_MAX_RECTANGLE_TEXTURE_SIZE_ANGLE 0x84F8
|
||||
#define GL_TEXTURE_RECTANGLE_ANGLE 0x84F5
|
||||
#define GL_TEXTURE_BINDING_RECTANGLE_ANGLE 0x84F6
|
||||
#define GL_SAMPLER_2D_RECT_ANGLE 0x8B63
|
||||
#endif /* GL_ANGLE_texture_rectangle */
|
||||
|
||||
// clang-format on
|
||||
|
||||
#endif // INCLUDE_GLES2_GL2EXT_ANGLE_H_
|
24
src/3rdparty/angle/include/GLES3/gl3ext.h
vendored
24
src/3rdparty/angle/include/GLES3/gl3ext.h
vendored
@ -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_ */
|
||||
|
625
src/3rdparty/angle/include/GLSLANG/ShaderLang.h
vendored
625
src/3rdparty/angle/include/GLSLANG/ShaderLang.h
vendored
@ -6,27 +6,11 @@
|
||||
#ifndef GLSLANG_SHADERLANG_H_
|
||||
#define GLSLANG_SHADERLANG_H_
|
||||
|
||||
#if defined(COMPONENT_BUILD) && !defined(ANGLE_TRANSLATOR_STATIC)
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
|
||||
#if defined(ANGLE_TRANSLATOR_IMPLEMENTATION)
|
||||
#define COMPILER_EXPORT __declspec(dllexport)
|
||||
#else
|
||||
#define COMPILER_EXPORT __declspec(dllimport)
|
||||
#endif // defined(ANGLE_TRANSLATOR_IMPLEMENTATION)
|
||||
|
||||
#else // defined(_WIN32) || defined(_WIN64)
|
||||
#define COMPILER_EXPORT __attribute__((visibility("default")))
|
||||
#endif
|
||||
|
||||
#else // defined(COMPONENT_BUILD) && !defined(ANGLE_TRANSLATOR_STATIC)
|
||||
#define COMPILER_EXPORT
|
||||
#endif
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include "KHR/khrplatform.h"
|
||||
|
||||
#include <array>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
@ -36,51 +20,26 @@
|
||||
// and the shading language compiler.
|
||||
//
|
||||
|
||||
namespace sh
|
||||
{
|
||||
// GLenum alias
|
||||
typedef unsigned int GLenum;
|
||||
}
|
||||
|
||||
// Must be included after GLenum proxy typedef
|
||||
// Note: make sure to increment ANGLE_SH_VERSION when changing ShaderVars.h
|
||||
#include "ShaderVars.h"
|
||||
|
||||
// Version number for shader translation API.
|
||||
// It is incremented every time the API changes.
|
||||
#define ANGLE_SH_VERSION 143
|
||||
#define ANGLE_SH_VERSION 190
|
||||
|
||||
typedef enum {
|
||||
SH_GLES2_SPEC = 0x8B40,
|
||||
SH_WEBGL_SPEC = 0x8B41,
|
||||
enum ShShaderSpec
|
||||
{
|
||||
SH_GLES2_SPEC,
|
||||
SH_WEBGL_SPEC,
|
||||
|
||||
SH_GLES3_SPEC = 0x8B86,
|
||||
SH_WEBGL2_SPEC = 0x8B87,
|
||||
SH_GLES3_SPEC,
|
||||
SH_WEBGL2_SPEC,
|
||||
|
||||
// The CSS Shaders spec is a subset of the WebGL spec.
|
||||
//
|
||||
// In both CSS vertex and fragment shaders, ANGLE:
|
||||
// (1) Reserves the "css_" prefix.
|
||||
// (2) Renames the main function to css_main.
|
||||
// (3) Disables the gl_MaxDrawBuffers built-in.
|
||||
//
|
||||
// In CSS fragment shaders, ANGLE:
|
||||
// (1) Disables the gl_FragColor built-in.
|
||||
// (2) Disables the gl_FragData built-in.
|
||||
// (3) Enables the css_MixColor built-in.
|
||||
// (4) Enables the css_ColorMatrix built-in.
|
||||
//
|
||||
// After passing a CSS shader through ANGLE, the browser is expected to append
|
||||
// a new main function to it.
|
||||
// This new main function will call the css_main function.
|
||||
// It may also perform additional operations like varying assignment, texture
|
||||
// access, and gl_FragColor assignment in order to implement the CSS Shaders
|
||||
// blend modes.
|
||||
//
|
||||
SH_CSS_SHADERS_SPEC = 0x8B42
|
||||
} ShShaderSpec;
|
||||
SH_GLES3_1_SPEC,
|
||||
SH_WEBGL3_SPEC,
|
||||
};
|
||||
|
||||
typedef enum
|
||||
enum ShShaderOutput
|
||||
{
|
||||
// ESSL output only supported in some configurations.
|
||||
SH_ESSL_OUTPUT = 0x8B45,
|
||||
@ -99,147 +58,224 @@ typedef enum
|
||||
SH_GLSL_440_CORE_OUTPUT = 0x8B87,
|
||||
SH_GLSL_450_CORE_OUTPUT = 0x8B88,
|
||||
|
||||
// HLSL output only supported in some configurations.
|
||||
// Deprecated:
|
||||
SH_HLSL_OUTPUT = 0x8B48,
|
||||
SH_HLSL9_OUTPUT = 0x8B48,
|
||||
SH_HLSL11_OUTPUT = 0x8B49,
|
||||
|
||||
// Prefer using these to specify HLSL output type:
|
||||
SH_HLSL_3_0_OUTPUT = 0x8B48, // D3D 9
|
||||
SH_HLSL_4_1_OUTPUT = 0x8B49, // D3D 11
|
||||
SH_HLSL_4_0_FL9_3_OUTPUT = 0x8B4A // D3D 11 feature level 9_3
|
||||
} ShShaderOutput;
|
||||
SH_HLSL_4_0_FL9_3_OUTPUT = 0x8B4A, // D3D 11 feature level 9_3
|
||||
|
||||
// Output specialized GLSL to be fed to glslang for Vulkan SPIR.
|
||||
SH_GLSL_VULKAN_OUTPUT = 0x8B4B,
|
||||
};
|
||||
|
||||
// Compile options.
|
||||
typedef enum {
|
||||
SH_VALIDATE = 0,
|
||||
SH_VALIDATE_LOOP_INDEXING = 0x0001,
|
||||
SH_INTERMEDIATE_TREE = 0x0002,
|
||||
SH_OBJECT_CODE = 0x0004,
|
||||
SH_VARIABLES = 0x0008,
|
||||
SH_LINE_DIRECTIVES = 0x0010,
|
||||
SH_SOURCE_PATH = 0x0020,
|
||||
SH_UNROLL_FOR_LOOP_WITH_INTEGER_INDEX = 0x0040,
|
||||
// If a sampler array index happens to be a loop index,
|
||||
// 1) if its type is integer, unroll the loop.
|
||||
// 2) if its type is float, fail the shader compile.
|
||||
// This is to work around a mac driver bug.
|
||||
SH_UNROLL_FOR_LOOP_WITH_SAMPLER_ARRAY_INDEX = 0x0080,
|
||||
// The Compile options type is defined in ShaderVars.h, to allow ANGLE to import the ShaderVars
|
||||
// header without needing the ShaderLang header. This avoids some conflicts with glslang.
|
||||
|
||||
// This is needed only as a workaround for certain OpenGL driver bugs.
|
||||
SH_EMULATE_BUILT_IN_FUNCTIONS = 0x0100,
|
||||
const ShCompileOptions SH_VALIDATE = 0;
|
||||
const ShCompileOptions SH_VALIDATE_LOOP_INDEXING = UINT64_C(1) << 0;
|
||||
const ShCompileOptions SH_INTERMEDIATE_TREE = UINT64_C(1) << 1;
|
||||
const ShCompileOptions SH_OBJECT_CODE = UINT64_C(1) << 2;
|
||||
const ShCompileOptions SH_VARIABLES = UINT64_C(1) << 3;
|
||||
const ShCompileOptions SH_LINE_DIRECTIVES = UINT64_C(1) << 4;
|
||||
const ShCompileOptions SH_SOURCE_PATH = UINT64_C(1) << 5;
|
||||
|
||||
// This is an experimental flag to enforce restrictions that aim to prevent
|
||||
// timing attacks.
|
||||
// It generates compilation errors for shaders that could expose sensitive
|
||||
// texture information via the timing channel.
|
||||
// To use this flag, you must compile the shader under the WebGL spec
|
||||
// (using the SH_WEBGL_SPEC flag).
|
||||
SH_TIMING_RESTRICTIONS = 0x0200,
|
||||
// This flag will keep invariant declaration for input in fragment shader for GLSL >=4.20 on AMD.
|
||||
// From GLSL >= 4.20, it's optional to add invariant for fragment input, but GPU vendors have
|
||||
// different implementations about this. Some drivers forbid invariant in fragment for GLSL>= 4.20,
|
||||
// e.g. Linux Mesa, some drivers treat that as optional, e.g. NVIDIA, some drivers require invariant
|
||||
// must match between vertex and fragment shader, e.g. AMD. The behavior on AMD is obviously wrong.
|
||||
// Remove invariant for input in fragment shader to workaround the restriction on Intel Mesa.
|
||||
// But don't remove on AMD Linux to avoid triggering the bug on AMD.
|
||||
const ShCompileOptions SH_DONT_REMOVE_INVARIANT_FOR_FRAGMENT_INPUT = UINT64_C(1) << 6;
|
||||
|
||||
// This flag prints the dependency graph that is used to enforce timing
|
||||
// restrictions on fragment shaders.
|
||||
// This flag only has an effect if all of the following are true:
|
||||
// - The shader spec is SH_WEBGL_SPEC.
|
||||
// - The compile options contain the SH_TIMING_RESTRICTIONS flag.
|
||||
// - The shader type is GL_FRAGMENT_SHADER.
|
||||
SH_DEPENDENCY_GRAPH = 0x0400,
|
||||
// Due to spec difference between GLSL 4.1 or lower and ESSL3, some platforms (for example, Mac OSX
|
||||
// core profile) require a variable's "invariant"/"centroid" qualifiers to match between vertex and
|
||||
// fragment shader. A simple solution to allow such shaders to link is to omit the two qualifiers.
|
||||
// AMD driver in Linux requires invariant qualifier to match between vertex and fragment shaders,
|
||||
// while ESSL3 disallows invariant qualifier in fragment shader and GLSL >= 4.2 doesn't require
|
||||
// invariant qualifier to match between shaders. Remove invariant qualifier from vertex shader to
|
||||
// workaround AMD driver bug.
|
||||
// Note that the two flags take effect on ESSL3 input shaders translated to GLSL 4.1 or lower and to
|
||||
// GLSL 4.2 or newer on Linux AMD.
|
||||
// TODO(zmo): This is not a good long-term solution. Simply dropping these qualifiers may break some
|
||||
// developers' content. A more complex workaround of dynamically generating, compiling, and
|
||||
// re-linking shaders that use these qualifiers should be implemented.
|
||||
const ShCompileOptions SH_REMOVE_INVARIANT_AND_CENTROID_FOR_ESSL3 = UINT64_C(1) << 7;
|
||||
|
||||
// Enforce the GLSL 1.017 Appendix A section 7 packing restrictions.
|
||||
// This flag only enforces (and can only enforce) the packing
|
||||
// restrictions for uniform variables in both vertex and fragment
|
||||
// shaders. ShCheckVariablesWithinPackingLimits() lets embedders
|
||||
// enforce the packing restrictions for varying variables during
|
||||
// program link time.
|
||||
SH_ENFORCE_PACKING_RESTRICTIONS = 0x0800,
|
||||
// This flag works around bug in Intel Mac drivers related to abs(i) where
|
||||
// i is an integer.
|
||||
const ShCompileOptions SH_EMULATE_ABS_INT_FUNCTION = UINT64_C(1) << 8;
|
||||
|
||||
// This flag ensures all indirect (expression-based) array indexing
|
||||
// is clamped to the bounds of the array. This ensures, for example,
|
||||
// that you cannot read off the end of a uniform, whether an array
|
||||
// vec234, or mat234 type. The ShArrayIndexClampingStrategy enum,
|
||||
// specified in the ShBuiltInResources when constructing the
|
||||
// compiler, selects the strategy for the clamping implementation.
|
||||
SH_CLAMP_INDIRECT_ARRAY_BOUNDS = 0x1000,
|
||||
// Enforce the GLSL 1.017 Appendix A section 7 packing restrictions.
|
||||
// This flag only enforces (and can only enforce) the packing
|
||||
// restrictions for uniform variables in both vertex and fragment
|
||||
// shaders. ShCheckVariablesWithinPackingLimits() lets embedders
|
||||
// enforce the packing restrictions for varying variables during
|
||||
// program link time.
|
||||
const ShCompileOptions SH_ENFORCE_PACKING_RESTRICTIONS = UINT64_C(1) << 9;
|
||||
|
||||
// This flag limits the complexity of an expression.
|
||||
SH_LIMIT_EXPRESSION_COMPLEXITY = 0x2000,
|
||||
// This flag ensures all indirect (expression-based) array indexing
|
||||
// is clamped to the bounds of the array. This ensures, for example,
|
||||
// that you cannot read off the end of a uniform, whether an array
|
||||
// vec234, or mat234 type. The ShArrayIndexClampingStrategy enum,
|
||||
// specified in the ShBuiltInResources when constructing the
|
||||
// compiler, selects the strategy for the clamping implementation.
|
||||
const ShCompileOptions SH_CLAMP_INDIRECT_ARRAY_BOUNDS = UINT64_C(1) << 10;
|
||||
|
||||
// This flag limits the depth of the call stack.
|
||||
SH_LIMIT_CALL_STACK_DEPTH = 0x4000,
|
||||
// This flag limits the complexity of an expression.
|
||||
const ShCompileOptions SH_LIMIT_EXPRESSION_COMPLEXITY = UINT64_C(1) << 11;
|
||||
|
||||
// This flag initializes gl_Position to vec4(0,0,0,0) at the
|
||||
// beginning of the vertex shader's main(), and has no effect in the
|
||||
// fragment shader. It is intended as a workaround for drivers which
|
||||
// incorrectly fail to link programs if gl_Position is not written.
|
||||
SH_INIT_GL_POSITION = 0x8000,
|
||||
// This flag limits the depth of the call stack.
|
||||
const ShCompileOptions SH_LIMIT_CALL_STACK_DEPTH = UINT64_C(1) << 12;
|
||||
|
||||
// This flag replaces
|
||||
// "a && b" with "a ? b : false",
|
||||
// "a || b" with "a ? true : b".
|
||||
// This is to work around a MacOSX driver bug that |b| is executed
|
||||
// independent of |a|'s value.
|
||||
SH_UNFOLD_SHORT_CIRCUIT = 0x10000,
|
||||
// This flag initializes gl_Position to vec4(0,0,0,0) at the
|
||||
// beginning of the vertex shader's main(), and has no effect in the
|
||||
// fragment shader. It is intended as a workaround for drivers which
|
||||
// incorrectly fail to link programs if gl_Position is not written.
|
||||
const ShCompileOptions SH_INIT_GL_POSITION = UINT64_C(1) << 13;
|
||||
|
||||
// This flag initializes varyings without static use in vertex shader
|
||||
// at the beginning of main(), and has no effects in the fragment shader.
|
||||
// It is intended as a workaround for drivers which incorrectly optimize
|
||||
// out such varyings and cause a link failure.
|
||||
SH_INIT_VARYINGS_WITHOUT_STATIC_USE = 0x20000,
|
||||
// This flag replaces
|
||||
// "a && b" with "a ? b : false",
|
||||
// "a || b" with "a ? true : b".
|
||||
// This is to work around a MacOSX driver bug that |b| is executed
|
||||
// independent of |a|'s value.
|
||||
const ShCompileOptions SH_UNFOLD_SHORT_CIRCUIT = UINT64_C(1) << 14;
|
||||
|
||||
// This flag scalarizes vec/ivec/bvec/mat constructor args.
|
||||
// It is intended as a workaround for Linux/Mac driver bugs.
|
||||
SH_SCALARIZE_VEC_AND_MAT_CONSTRUCTOR_ARGS = 0x40000,
|
||||
// This flag initializes output variables to 0 at the beginning of main().
|
||||
// It is to avoid undefined behaviors.
|
||||
const ShCompileOptions SH_INIT_OUTPUT_VARIABLES = UINT64_C(1) << 15;
|
||||
|
||||
// This flag overwrites a struct name with a unique prefix.
|
||||
// It is intended as a workaround for drivers that do not handle
|
||||
// struct scopes correctly, including all Mac drivers and Linux AMD.
|
||||
SH_REGENERATE_STRUCT_NAMES = 0x80000,
|
||||
// This flag scalarizes vec/ivec/bvec/mat constructor args.
|
||||
// It is intended as a workaround for Linux/Mac driver bugs.
|
||||
const ShCompileOptions SH_SCALARIZE_VEC_AND_MAT_CONSTRUCTOR_ARGS = UINT64_C(1) << 16;
|
||||
|
||||
// This flag makes the compiler not prune unused function early in the
|
||||
// compilation process. Pruning coupled with SH_LIMIT_CALL_STACK_DEPTH
|
||||
// helps avoid bad shaders causing stack overflows.
|
||||
SH_DONT_PRUNE_UNUSED_FUNCTIONS = 0x100000,
|
||||
// This flag overwrites a struct name with a unique prefix.
|
||||
// It is intended as a workaround for drivers that do not handle
|
||||
// struct scopes correctly, including all Mac drivers and Linux AMD.
|
||||
const ShCompileOptions SH_REGENERATE_STRUCT_NAMES = UINT64_C(1) << 17;
|
||||
|
||||
// This flag works around a bug in NVIDIA 331 series drivers related
|
||||
// to pow(x, y) where y is a constant vector.
|
||||
SH_REMOVE_POW_WITH_CONSTANT_EXPONENT = 0x200000,
|
||||
// This flag makes the compiler not prune unused function early in the
|
||||
// compilation process. Pruning coupled with SH_LIMIT_CALL_STACK_DEPTH
|
||||
// helps avoid bad shaders causing stack overflows.
|
||||
const ShCompileOptions SH_DONT_PRUNE_UNUSED_FUNCTIONS = UINT64_C(1) << 18;
|
||||
|
||||
// This flag works around bugs in Mac drivers related to do-while by
|
||||
// transforming them into an other construct.
|
||||
SH_REWRITE_DO_WHILE_LOOPS = 0x400000,
|
||||
} ShCompileOptions;
|
||||
// This flag works around a bug in NVIDIA 331 series drivers related
|
||||
// to pow(x, y) where y is a constant vector.
|
||||
const ShCompileOptions SH_REMOVE_POW_WITH_CONSTANT_EXPONENT = UINT64_C(1) << 19;
|
||||
|
||||
// This flag works around bugs in Mac drivers related to do-while by
|
||||
// transforming them into an other construct.
|
||||
const ShCompileOptions SH_REWRITE_DO_WHILE_LOOPS = UINT64_C(1) << 20;
|
||||
|
||||
// This flag works around a bug in the HLSL compiler optimizer that folds certain
|
||||
// constant pow expressions incorrectly. Only applies to the HLSL back-end. It works
|
||||
// by expanding the integer pow expressions into a series of multiplies.
|
||||
const ShCompileOptions SH_EXPAND_SELECT_HLSL_INTEGER_POW_EXPRESSIONS = UINT64_C(1) << 21;
|
||||
|
||||
// Flatten "#pragma STDGL invariant(all)" into the declarations of
|
||||
// varying variables and built-in GLSL variables. This compiler
|
||||
// option is enabled automatically when needed.
|
||||
const ShCompileOptions SH_FLATTEN_PRAGMA_STDGL_INVARIANT_ALL = UINT64_C(1) << 22;
|
||||
|
||||
// Some drivers do not take into account the base level of the texture in the results of the
|
||||
// HLSL GetDimensions builtin. This flag instructs the compiler to manually add the base level
|
||||
// offsetting.
|
||||
const ShCompileOptions SH_HLSL_GET_DIMENSIONS_IGNORES_BASE_LEVEL = UINT64_C(1) << 23;
|
||||
|
||||
// This flag works around an issue in translating GLSL function texelFetchOffset on
|
||||
// INTEL drivers. It works by translating texelFetchOffset into texelFetch.
|
||||
const ShCompileOptions SH_REWRITE_TEXELFETCHOFFSET_TO_TEXELFETCH = UINT64_C(1) << 24;
|
||||
|
||||
// This flag works around condition bug of for and while loops in Intel Mac OSX drivers.
|
||||
// Condition calculation is not correct. Rewrite it from "CONDITION" to "CONDITION && true".
|
||||
const ShCompileOptions SH_ADD_AND_TRUE_TO_LOOP_CONDITION = UINT64_C(1) << 25;
|
||||
|
||||
// This flag works around a bug in evaluating unary minus operator on integer on some INTEL
|
||||
// drivers. It works by translating -(int) into ~(int) + 1.
|
||||
const ShCompileOptions SH_REWRITE_INTEGER_UNARY_MINUS_OPERATOR = UINT64_C(1) << 26;
|
||||
|
||||
// This flag works around a bug in evaluating isnan() on some INTEL D3D and Mac OSX drivers.
|
||||
// It works by using an expression to emulate this function.
|
||||
const ShCompileOptions SH_EMULATE_ISNAN_FLOAT_FUNCTION = UINT64_C(1) << 27;
|
||||
|
||||
// This flag will use all uniforms of unused std140 and shared uniform blocks at the
|
||||
// beginning of the vertex/fragment shader's main(). It is intended as a workaround for Mac
|
||||
// drivers with shader version 4.10. In those drivers, they will treat unused
|
||||
// std140 and shared uniform blocks' members as inactive. However, WebGL2.0 based on
|
||||
// OpenGL ES3.0.4 requires all members of a named uniform block declared with a shared or std140
|
||||
// layout qualifier to be considered active. The uniform block itself is also considered active.
|
||||
const ShCompileOptions SH_USE_UNUSED_STANDARD_SHARED_BLOCKS = UINT64_C(1) << 28;
|
||||
|
||||
// This flag works around a bug in unary minus operator on float numbers on Intel
|
||||
// Mac OSX 10.11 drivers. It works by translating -float into 0.0 - float.
|
||||
const ShCompileOptions SH_REWRITE_FLOAT_UNARY_MINUS_OPERATOR = UINT64_C(1) << 29;
|
||||
|
||||
// This flag works around a bug in evaluating atan(y, x) on some NVIDIA OpenGL drivers.
|
||||
// It works by using an expression to emulate this function.
|
||||
const ShCompileOptions SH_EMULATE_ATAN2_FLOAT_FUNCTION = UINT64_C(1) << 30;
|
||||
|
||||
// Set to 1 to translate gl_ViewID_OVR to an uniform so that the extension can be emulated.
|
||||
// "uniform highp uint ViewID_OVR".
|
||||
const ShCompileOptions SH_TRANSLATE_VIEWID_OVR_TO_UNIFORM = UINT64_C(1) << 31;
|
||||
|
||||
// Set to initialize uninitialized local and global temporary variables. Should only be used with
|
||||
// GLSL output. In HLSL output variables are initialized regardless of if this flag is set.
|
||||
const ShCompileOptions SH_INITIALIZE_UNINITIALIZED_LOCALS = UINT64_C(1) << 32;
|
||||
|
||||
// The flag modifies the shader in the following way:
|
||||
// Every occurrence of gl_InstanceID is replaced by the global temporary variable InstanceID.
|
||||
// Every occurrence of gl_ViewID_OVR is replaced by the varying variable ViewID_OVR.
|
||||
// At the beginning of the body of main() in a vertex shader the following initializers are added:
|
||||
// ViewID_OVR = uint(gl_InstanceID) % num_views;
|
||||
// InstanceID = gl_InstanceID / num_views;
|
||||
// ViewID_OVR is added as a varying variable to both the vertex and fragment shaders.
|
||||
const ShCompileOptions SH_INITIALIZE_BUILTINS_FOR_INSTANCED_MULTIVIEW = UINT64_C(1) << 33;
|
||||
|
||||
// With the flag enabled the GLSL/ESSL vertex shader is modified to include code for viewport
|
||||
// selection in the following way:
|
||||
// - Code to enable the extension NV_viewport_array2 is included.
|
||||
// - Code to select the viewport index or layer is inserted at the beginning of main after
|
||||
// ViewID_OVR's initialization.
|
||||
// - A declaration of the uniform multiviewBaseViewLayerIndex.
|
||||
// Note: The SH_INITIALIZE_BUILTINS_FOR_INSTANCED_MULTIVIEW flag also has to be enabled to have the
|
||||
// temporary variable ViewID_OVR declared and initialized.
|
||||
const ShCompileOptions SH_SELECT_VIEW_IN_NV_GLSL_VERTEX_SHADER = UINT64_C(1) << 34;
|
||||
|
||||
// If the flag is enabled, gl_PointSize is clamped to the maximum point size specified in
|
||||
// ShBuiltInResources in vertex shaders.
|
||||
const ShCompileOptions SH_CLAMP_POINT_SIZE = UINT64_C(1) << 35;
|
||||
|
||||
// Turn some arithmetic operations that operate on a float vector-scalar pair into vector-vector
|
||||
// operations. This is done recursively. Some scalar binary operations inside vector constructors
|
||||
// are also turned into vector operations.
|
||||
//
|
||||
// This is targeted to work around a bug in NVIDIA OpenGL drivers that was reproducible on NVIDIA
|
||||
// driver version 387.92. It works around the most common occurrences of the bug.
|
||||
const ShCompileOptions SH_REWRITE_VECTOR_SCALAR_ARITHMETIC = UINT64_C(1) << 36;
|
||||
|
||||
// Don't use loops to initialize uninitialized variables. Only has an effect if some kind of
|
||||
// variable initialization is turned on.
|
||||
const ShCompileOptions SH_DONT_USE_LOOPS_TO_INITIALIZE_VARIABLES = UINT64_C(1) << 37;
|
||||
|
||||
// Defines alternate strategies for implementing array index clamping.
|
||||
typedef enum {
|
||||
// Use the clamp intrinsic for array index clamping.
|
||||
SH_CLAMP_WITH_CLAMP_INTRINSIC = 1,
|
||||
enum ShArrayIndexClampingStrategy
|
||||
{
|
||||
// Use the clamp intrinsic for array index clamping.
|
||||
SH_CLAMP_WITH_CLAMP_INTRINSIC = 1,
|
||||
|
||||
// Use a user-defined function for array index clamping.
|
||||
SH_CLAMP_WITH_USER_DEFINED_INT_CLAMP_FUNCTION
|
||||
} ShArrayIndexClampingStrategy;
|
||||
|
||||
//
|
||||
// Driver must call this first, once, before doing any other
|
||||
// compiler operations.
|
||||
// If the function succeeds, the return value is true, else false.
|
||||
//
|
||||
COMPILER_EXPORT bool ShInitialize();
|
||||
//
|
||||
// Driver should call this at shutdown.
|
||||
// If the function succeeds, the return value is true, else false.
|
||||
//
|
||||
COMPILER_EXPORT bool ShFinalize();
|
||||
// Use a user-defined function for array index clamping.
|
||||
SH_CLAMP_WITH_USER_DEFINED_INT_CLAMP_FUNCTION
|
||||
};
|
||||
|
||||
// The 64 bits hash function. The first parameter is the input string; the
|
||||
// second parameter is the string length.
|
||||
typedef khronos_uint64_t (*ShHashFunction64)(const char*, size_t);
|
||||
using ShHashFunction64 = khronos_uint64_t (*)(const char *, size_t);
|
||||
|
||||
//
|
||||
// Implementation dependent built-in resources (constants and extensions).
|
||||
// The names for these resources has been obtained by stripping gl_/GL_.
|
||||
//
|
||||
typedef struct
|
||||
struct ShBuiltInResources
|
||||
{
|
||||
// Constants.
|
||||
int MaxVertexAttribs;
|
||||
@ -255,6 +291,8 @@ typedef struct
|
||||
// Set to 1 to enable the extension, else 0.
|
||||
int OES_standard_derivatives;
|
||||
int OES_EGL_image_external;
|
||||
int OES_EGL_image_external_essl3;
|
||||
int NV_EGL_stream_consumer_external;
|
||||
int ARB_texture_rectangle;
|
||||
int EXT_blend_func_extended;
|
||||
int EXT_draw_buffers;
|
||||
@ -264,6 +302,9 @@ typedef struct
|
||||
int EXT_shader_framebuffer_fetch;
|
||||
int NV_shader_framebuffer_fetch;
|
||||
int ARM_shader_framebuffer_fetch;
|
||||
int OVR_multiview;
|
||||
int EXT_YUV_target;
|
||||
int OES_geometry_shader;
|
||||
|
||||
// Set to 1 to enable replacing GL_EXT_draw_buffers #extension directives
|
||||
// with GL_NV_draw_buffers in ESSL output. This flag can be used to emulate
|
||||
@ -290,6 +331,9 @@ typedef struct
|
||||
// GLES SL version 100 gl_MaxDualSourceDrawBuffersEXT value for EXT_blend_func_extended.
|
||||
int MaxDualSourceDrawBuffers;
|
||||
|
||||
// Value of GL_MAX_VIEWS_OVR.
|
||||
int MaxViewsOVR;
|
||||
|
||||
// Name Hashing.
|
||||
// Set a 64 bit hash function to enable user-defined name hashing.
|
||||
// Default is NULL.
|
||||
@ -299,19 +343,107 @@ typedef struct
|
||||
// Default is SH_CLAMP_WITH_CLAMP_INTRINSIC.
|
||||
ShArrayIndexClampingStrategy ArrayIndexClampingStrategy;
|
||||
|
||||
// The maximum complexity an expression can be.
|
||||
// The maximum complexity an expression can be when SH_LIMIT_EXPRESSION_COMPLEXITY is turned on.
|
||||
int MaxExpressionComplexity;
|
||||
|
||||
// The maximum depth a call stack can be.
|
||||
int MaxCallStackDepth;
|
||||
} ShBuiltInResources;
|
||||
|
||||
//
|
||||
// Initialize built-in resources with minimum expected values.
|
||||
// Parameters:
|
||||
// resources: The object to initialize. Will be comparable with memcmp.
|
||||
//
|
||||
COMPILER_EXPORT void ShInitBuiltInResources(ShBuiltInResources *resources);
|
||||
// The maximum number of parameters a function can have when SH_LIMIT_EXPRESSION_COMPLEXITY is
|
||||
// turned on.
|
||||
int MaxFunctionParameters;
|
||||
|
||||
// GLES 3.1 constants
|
||||
|
||||
// texture gather offset constraints.
|
||||
int MinProgramTextureGatherOffset;
|
||||
int MaxProgramTextureGatherOffset;
|
||||
|
||||
// maximum number of available image units
|
||||
int MaxImageUnits;
|
||||
|
||||
// maximum number of image uniforms in a vertex shader
|
||||
int MaxVertexImageUniforms;
|
||||
|
||||
// maximum number of image uniforms in a fragment shader
|
||||
int MaxFragmentImageUniforms;
|
||||
|
||||
// maximum number of image uniforms in a compute shader
|
||||
int MaxComputeImageUniforms;
|
||||
|
||||
// maximum total number of image uniforms in a program
|
||||
int MaxCombinedImageUniforms;
|
||||
|
||||
// maximum number of uniform locations
|
||||
int MaxUniformLocations;
|
||||
|
||||
// maximum number of ssbos and images in a shader
|
||||
int MaxCombinedShaderOutputResources;
|
||||
|
||||
// maximum number of groups in each dimension
|
||||
std::array<int, 3> MaxComputeWorkGroupCount;
|
||||
// maximum number of threads per work group in each dimension
|
||||
std::array<int, 3> MaxComputeWorkGroupSize;
|
||||
|
||||
// maximum number of total uniform components
|
||||
int MaxComputeUniformComponents;
|
||||
|
||||
// maximum number of texture image units in a compute shader
|
||||
int MaxComputeTextureImageUnits;
|
||||
|
||||
// maximum number of atomic counters in a compute shader
|
||||
int MaxComputeAtomicCounters;
|
||||
|
||||
// maximum number of atomic counter buffers in a compute shader
|
||||
int MaxComputeAtomicCounterBuffers;
|
||||
|
||||
// maximum number of atomic counters in a vertex shader
|
||||
int MaxVertexAtomicCounters;
|
||||
|
||||
// maximum number of atomic counters in a fragment shader
|
||||
int MaxFragmentAtomicCounters;
|
||||
|
||||
// maximum number of atomic counters in a program
|
||||
int MaxCombinedAtomicCounters;
|
||||
|
||||
// maximum binding for an atomic counter
|
||||
int MaxAtomicCounterBindings;
|
||||
|
||||
// maximum number of atomic counter buffers in a vertex shader
|
||||
int MaxVertexAtomicCounterBuffers;
|
||||
|
||||
// maximum number of atomic counter buffers in a fragment shader
|
||||
int MaxFragmentAtomicCounterBuffers;
|
||||
|
||||
// maximum number of atomic counter buffers in a program
|
||||
int MaxCombinedAtomicCounterBuffers;
|
||||
|
||||
// maximum number of buffer object storage in machine units
|
||||
int MaxAtomicCounterBufferSize;
|
||||
|
||||
// maximum number of uniform block bindings
|
||||
int MaxUniformBufferBindings;
|
||||
|
||||
// maximum number of shader storage buffer bindings
|
||||
int MaxShaderStorageBufferBindings;
|
||||
|
||||
// maximum point size (higher limit from ALIASED_POINT_SIZE_RANGE)
|
||||
float MaxPointSize;
|
||||
|
||||
// OES_geometry_shader constants
|
||||
int MaxGeometryUniformComponents;
|
||||
int MaxGeometryUniformBlocks;
|
||||
int MaxGeometryInputComponents;
|
||||
int MaxGeometryOutputComponents;
|
||||
int MaxGeometryOutputVertices;
|
||||
int MaxGeometryTotalOutputComponents;
|
||||
int MaxGeometryTextureImageUnits;
|
||||
int MaxGeometryAtomicCounterBuffers;
|
||||
int MaxGeometryAtomicCounters;
|
||||
int MaxGeometryShaderStorageBlocks;
|
||||
int MaxGeometryShaderInvocations;
|
||||
int MaxGeometryImageUniforms;
|
||||
};
|
||||
|
||||
//
|
||||
// ShHandle held by but opaque to the driver. It is allocated,
|
||||
@ -320,43 +452,60 @@ COMPILER_EXPORT void ShInitBuiltInResources(ShBuiltInResources *resources);
|
||||
//
|
||||
// If handle creation fails, 0 will be returned.
|
||||
//
|
||||
typedef void *ShHandle;
|
||||
using ShHandle = void *;
|
||||
|
||||
namespace sh
|
||||
{
|
||||
|
||||
//
|
||||
// Returns the a concatenated list of the items in ShBuiltInResources as a
|
||||
// null-terminated string.
|
||||
// Driver must call this first, once, before doing any other compiler operations.
|
||||
// If the function succeeds, the return value is true, else false.
|
||||
//
|
||||
bool Initialize();
|
||||
//
|
||||
// Driver should call this at shutdown.
|
||||
// If the function succeeds, the return value is true, else false.
|
||||
//
|
||||
bool Finalize();
|
||||
|
||||
//
|
||||
// Initialize built-in resources with minimum expected values.
|
||||
// Parameters:
|
||||
// resources: The object to initialize. Will be comparable with memcmp.
|
||||
//
|
||||
void InitBuiltInResources(ShBuiltInResources *resources);
|
||||
|
||||
//
|
||||
// Returns the a concatenated list of the items in ShBuiltInResources as a null-terminated string.
|
||||
// This function must be updated whenever ShBuiltInResources is changed.
|
||||
// Parameters:
|
||||
// handle: Specifies the handle of the compiler to be used.
|
||||
COMPILER_EXPORT const std::string &ShGetBuiltInResourcesString(const ShHandle handle);
|
||||
const std::string &GetBuiltInResourcesString(const ShHandle handle);
|
||||
|
||||
//
|
||||
// Driver calls these to create and destroy compiler objects.
|
||||
//
|
||||
// Returns the handle of constructed compiler, null if the requested compiler is
|
||||
// not supported.
|
||||
// Returns the handle of constructed compiler, null if the requested compiler is not supported.
|
||||
// Parameters:
|
||||
// type: Specifies the type of shader - GL_FRAGMENT_SHADER or GL_VERTEX_SHADER.
|
||||
// spec: Specifies the language spec the compiler must conform to -
|
||||
// SH_GLES2_SPEC or SH_WEBGL_SPEC.
|
||||
// spec: Specifies the language spec the compiler must conform to - SH_GLES2_SPEC or SH_WEBGL_SPEC.
|
||||
// output: Specifies the output code type - for example SH_ESSL_OUTPUT, SH_GLSL_OUTPUT,
|
||||
// SH_HLSL_3_0_OUTPUT or SH_HLSL_4_1_OUTPUT. Note: Each output type may only
|
||||
// be supported in some configurations.
|
||||
// resources: Specifies the built-in resources.
|
||||
COMPILER_EXPORT ShHandle ShConstructCompiler(
|
||||
sh::GLenum type,
|
||||
ShShaderSpec spec,
|
||||
ShShaderOutput output,
|
||||
const ShBuiltInResources *resources);
|
||||
COMPILER_EXPORT void ShDestruct(ShHandle handle);
|
||||
ShHandle ConstructCompiler(sh::GLenum type,
|
||||
ShShaderSpec spec,
|
||||
ShShaderOutput output,
|
||||
const ShBuiltInResources *resources);
|
||||
void Destruct(ShHandle handle);
|
||||
|
||||
//
|
||||
// Compiles the given shader source.
|
||||
// If the function succeeds, the return value is true, else false.
|
||||
// Parameters:
|
||||
// handle: Specifies the handle of compiler to be used.
|
||||
// shaderStrings: Specifies an array of pointers to null-terminated strings
|
||||
// containing the shader source code.
|
||||
// shaderStrings: Specifies an array of pointers to null-terminated strings containing the shader
|
||||
// source code.
|
||||
// numStrings: Specifies the number of elements in shaderStrings array.
|
||||
// compileOptions: A mask containing the following parameters:
|
||||
// SH_VALIDATE: Validates shader to ensure that it conforms to the spec
|
||||
@ -368,45 +517,41 @@ COMPILER_EXPORT void ShDestruct(ShHandle handle);
|
||||
// There is no need to specify this parameter when
|
||||
// compiling for WebGL - it is implied.
|
||||
// SH_INTERMEDIATE_TREE: Writes intermediate tree to info log.
|
||||
// Can be queried by calling ShGetInfoLog().
|
||||
// Can be queried by calling sh::GetInfoLog().
|
||||
// SH_OBJECT_CODE: Translates intermediate tree to glsl or hlsl shader.
|
||||
// Can be queried by calling ShGetObjectCode().
|
||||
// Can be queried by calling sh::GetObjectCode().
|
||||
// SH_VARIABLES: Extracts attributes, uniforms, and varyings.
|
||||
// Can be queried by calling ShGetVariableInfo().
|
||||
//
|
||||
COMPILER_EXPORT bool ShCompile(
|
||||
const ShHandle handle,
|
||||
const char * const shaderStrings[],
|
||||
size_t numStrings,
|
||||
int compileOptions);
|
||||
bool Compile(const ShHandle handle,
|
||||
const char *const shaderStrings[],
|
||||
size_t numStrings,
|
||||
ShCompileOptions compileOptions);
|
||||
|
||||
// Clears the results from the previous compilation.
|
||||
COMPILER_EXPORT void ShClearResults(const ShHandle handle);
|
||||
void ClearResults(const ShHandle handle);
|
||||
|
||||
// Return the version of the shader language.
|
||||
COMPILER_EXPORT int ShGetShaderVersion(const ShHandle handle);
|
||||
int GetShaderVersion(const ShHandle handle);
|
||||
|
||||
// Return the currently set language output type.
|
||||
COMPILER_EXPORT ShShaderOutput ShGetShaderOutputType(
|
||||
const ShHandle handle);
|
||||
ShShaderOutput GetShaderOutputType(const ShHandle handle);
|
||||
|
||||
// Returns null-terminated information log for a compiled shader.
|
||||
// Parameters:
|
||||
// handle: Specifies the compiler
|
||||
COMPILER_EXPORT const std::string &ShGetInfoLog(const ShHandle handle);
|
||||
const std::string &GetInfoLog(const ShHandle handle);
|
||||
|
||||
// Returns null-terminated object code for a compiled shader.
|
||||
// Parameters:
|
||||
// handle: Specifies the compiler
|
||||
COMPILER_EXPORT const std::string &ShGetObjectCode(const ShHandle handle);
|
||||
const std::string &GetObjectCode(const ShHandle handle);
|
||||
|
||||
// Returns a (original_name, hash) map containing all the user defined
|
||||
// names in the shader, including variable names, function names, struct
|
||||
// names, and struct field names.
|
||||
// Returns a (original_name, hash) map containing all the user defined names in the shader,
|
||||
// including variable names, function names, struct names, and struct field names.
|
||||
// Parameters:
|
||||
// handle: Specifies the compiler
|
||||
COMPILER_EXPORT const std::map<std::string, std::string> *ShGetNameHashingMap(
|
||||
const ShHandle handle);
|
||||
const std::map<std::string, std::string> *GetNameHashingMap(const ShHandle handle);
|
||||
|
||||
// Shader variable inspection.
|
||||
// Returns a pointer to a list of variables of the designated type.
|
||||
@ -414,52 +559,50 @@ COMPILER_EXPORT const std::map<std::string, std::string> *ShGetNameHashingMap(
|
||||
// Returns NULL on failure.
|
||||
// Parameters:
|
||||
// handle: Specifies the compiler
|
||||
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::OutputVariable> *ShGetOutputVariables(const ShHandle handle);
|
||||
COMPILER_EXPORT const std::vector<sh::InterfaceBlock> *ShGetInterfaceBlocks(const ShHandle handle);
|
||||
const std::vector<sh::Uniform> *GetUniforms(const ShHandle handle);
|
||||
const std::vector<sh::Varying> *GetVaryings(const ShHandle handle);
|
||||
const std::vector<sh::Varying> *GetInputVaryings(const ShHandle handle);
|
||||
const std::vector<sh::Varying> *GetOutputVaryings(const ShHandle handle);
|
||||
const std::vector<sh::Attribute> *GetAttributes(const ShHandle handle);
|
||||
const std::vector<sh::OutputVariable> *GetOutputVariables(const ShHandle handle);
|
||||
const std::vector<sh::InterfaceBlock> *GetInterfaceBlocks(const ShHandle handle);
|
||||
const std::vector<sh::InterfaceBlock> *GetUniformBlocks(const ShHandle handle);
|
||||
const std::vector<sh::InterfaceBlock> *GetShaderStorageBlocks(const ShHandle handle);
|
||||
sh::WorkGroupSize GetComputeShaderLocalGroupSize(const ShHandle handle);
|
||||
// Returns the number of views specified through the num_views layout qualifier. If num_views is
|
||||
// not set, the function returns -1.
|
||||
int GetVertexShaderNumViews(const ShHandle handle);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
sh::GLenum type;
|
||||
int size;
|
||||
} ShVariableInfo;
|
||||
|
||||
// Returns true if the passed in variables pack in maxVectors following
|
||||
// the packing rules from the GLSL 1.017 spec, Appendix A, section 7.
|
||||
// Returns true if the passed in variables pack in maxVectors followingthe packing rules from the
|
||||
// GLSL 1.017 spec, Appendix A, section 7.
|
||||
// Returns false otherwise. Also look at the SH_ENFORCE_PACKING_RESTRICTIONS
|
||||
// flag above.
|
||||
// Parameters:
|
||||
// maxVectors: the available rows of registers.
|
||||
// varInfoArray: an array of variable info (types and sizes).
|
||||
// varInfoArraySize: the size of the variable array.
|
||||
COMPILER_EXPORT bool ShCheckVariablesWithinPackingLimits(
|
||||
int maxVectors,
|
||||
ShVariableInfo *varInfoArray,
|
||||
size_t varInfoArraySize);
|
||||
// variables: an array of variables.
|
||||
bool CheckVariablesWithinPackingLimits(int maxVectors,
|
||||
const std::vector<sh::ShaderVariable> &variables);
|
||||
|
||||
// Gives the compiler-assigned register for an interface block.
|
||||
// Gives the compiler-assigned register for a uniform block.
|
||||
// The method writes the value to the output variable "indexOut".
|
||||
// Returns true if it found a valid interface block, false otherwise.
|
||||
// Returns true if it found a valid uniform block, false otherwise.
|
||||
// Parameters:
|
||||
// handle: Specifies the compiler
|
||||
// interfaceBlockName: Specifies the interface block
|
||||
// uniformBlockName: Specifies the uniform block
|
||||
// indexOut: output variable that stores the assigned register
|
||||
COMPILER_EXPORT bool ShGetInterfaceBlockRegister(const ShHandle handle,
|
||||
const std::string &interfaceBlockName,
|
||||
unsigned int *indexOut);
|
||||
bool GetUniformBlockRegister(const ShHandle handle,
|
||||
const std::string &uniformBlockName,
|
||||
unsigned int *indexOut);
|
||||
|
||||
// Gives the compiler-assigned register for uniforms in the default
|
||||
// interface block.
|
||||
// The method writes the value to the output variable "indexOut".
|
||||
// Returns true if it found a valid default uniform, false otherwise.
|
||||
// Parameters:
|
||||
// handle: Specifies the compiler
|
||||
// interfaceBlockName: Specifies the uniform
|
||||
// indexOut: output variable that stores the assigned register
|
||||
COMPILER_EXPORT bool ShGetUniformRegister(const ShHandle handle,
|
||||
const std::string &uniformName,
|
||||
unsigned int *indexOut);
|
||||
// Gives a map from uniform names to compiler-assigned registers in the default uniform block.
|
||||
// Note that the map contains also registers of samplers that have been extracted from structs.
|
||||
const std::map<std::string, unsigned int> *GetUniformRegisterMap(const ShHandle handle);
|
||||
|
||||
GLenum GetGeometryShaderInputPrimitiveType(const ShHandle handle);
|
||||
GLenum GetGeometryShaderOutputPrimitiveType(const ShHandle handle);
|
||||
int GetGeometryShaderInvocations(const ShHandle handle);
|
||||
int GetGeometryShaderMaxVertices(const ShHandle handle);
|
||||
|
||||
} // namespace sh
|
||||
|
||||
#endif // GLSLANG_SHADERLANG_H_
|
||||
|
161
src/3rdparty/angle/include/GLSLANG/ShaderVars.h
vendored
161
src/3rdparty/angle/include/GLSLANG/ShaderVars.h
vendored
@ -10,15 +10,18 @@
|
||||
#ifndef GLSLANG_SHADERVARS_H_
|
||||
#define GLSLANG_SHADERVARS_H_
|
||||
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
|
||||
// Assume ShaderLang.h is included before ShaderVars.h, for sh::GLenum
|
||||
// Note: make sure to increment ANGLE_SH_VERSION when changing ShaderVars.h
|
||||
// This type is defined here to simplify ANGLE's integration with glslang for SPIRv.
|
||||
using ShCompileOptions = uint64_t;
|
||||
|
||||
namespace sh
|
||||
{
|
||||
// GLenum alias
|
||||
typedef unsigned int GLenum;
|
||||
|
||||
// Varying interpolation qualifier, see section 4.3.9 of the ESSL 3.00.4 spec
|
||||
enum InterpolationType
|
||||
@ -29,30 +32,65 @@ enum InterpolationType
|
||||
};
|
||||
|
||||
// Validate link & SSO consistency of interpolation qualifiers
|
||||
COMPILER_EXPORT bool InterpolationTypesMatch(InterpolationType a, InterpolationType b);
|
||||
bool InterpolationTypesMatch(InterpolationType a, InterpolationType b);
|
||||
|
||||
// Uniform block layout qualifier, see section 4.3.8.3 of the ESSL 3.00.4 spec
|
||||
enum BlockLayoutType
|
||||
{
|
||||
BLOCKLAYOUT_STANDARD,
|
||||
BLOCKLAYOUT_STD140 = BLOCKLAYOUT_STANDARD,
|
||||
BLOCKLAYOUT_STD430, // Shader storage block layout qualifier
|
||||
BLOCKLAYOUT_PACKED,
|
||||
BLOCKLAYOUT_SHARED
|
||||
};
|
||||
|
||||
// Interface Blocks, see section 4.3.9 of the ESSL 3.10 spec
|
||||
enum class BlockType
|
||||
{
|
||||
BLOCK_UNIFORM,
|
||||
BLOCK_BUFFER,
|
||||
|
||||
// Required in OpenGL ES 3.1 extension GL_OES_shader_io_blocks.
|
||||
// TODO(jiawei.shao@intel.com): add BLOCK_OUT.
|
||||
BLOCK_IN
|
||||
};
|
||||
|
||||
// Base class for all variables defined in shaders, including Varyings, Uniforms, etc
|
||||
// Note: we must override the copy constructor and assignment operator so we can
|
||||
// work around excessive GCC binary bloating:
|
||||
// See https://code.google.com/p/angleproject/issues/detail?id=697
|
||||
struct COMPILER_EXPORT ShaderVariable
|
||||
struct ShaderVariable
|
||||
{
|
||||
ShaderVariable();
|
||||
ShaderVariable(GLenum typeIn);
|
||||
ShaderVariable(GLenum typeIn, unsigned int arraySizeIn);
|
||||
~ShaderVariable();
|
||||
ShaderVariable(const ShaderVariable &other);
|
||||
ShaderVariable &operator=(const ShaderVariable &other);
|
||||
|
||||
bool isArray() const { return arraySize > 0; }
|
||||
unsigned int elementCount() const { return std::max(1u, arraySize); }
|
||||
bool isArrayOfArrays() const { return arraySizes.size() >= 2u; }
|
||||
bool isArray() const { return !arraySizes.empty(); }
|
||||
unsigned int getArraySizeProduct() const;
|
||||
|
||||
// Array size 0 means not an array when passed to or returned from these functions.
|
||||
// Note that setArraySize() is deprecated and should not be used inside ANGLE.
|
||||
unsigned int getOutermostArraySize() const { return isArray() ? arraySizes.back() : 0; }
|
||||
void setArraySize(unsigned int size);
|
||||
|
||||
// Turn this ShaderVariable from an array into a specific element in that array. Will update
|
||||
// flattenedOffsetInParentArrays.
|
||||
void indexIntoArray(unsigned int arrayIndex);
|
||||
|
||||
// Get the nth nested array size from the top. Caller is responsible for range checking
|
||||
// arrayNestingIndex.
|
||||
unsigned int getNestedArraySize(unsigned int arrayNestingIndex) const;
|
||||
|
||||
// This function should only be used with variables that are of a basic type or an array of a
|
||||
// basic type. Shader interface variables that are enumerated according to rules in GLES 3.1
|
||||
// spec section 7.3.1.1 page 77 are fine. For those variables the return value should match the
|
||||
// ARRAY_SIZE value that can be queried through the API.
|
||||
unsigned int getBasicTypeElementCount() const;
|
||||
|
||||
bool isStruct() const { return !fields.empty(); }
|
||||
|
||||
// All of the shader's variables are described using nested data
|
||||
@ -70,20 +108,32 @@ struct COMPILER_EXPORT ShaderVariable
|
||||
const ShaderVariable **leafVar,
|
||||
std::string* originalFullName) const;
|
||||
|
||||
bool isBuiltIn() const { return name.compare(0, 3, "gl_") == 0; }
|
||||
bool isBuiltIn() const;
|
||||
|
||||
GLenum type;
|
||||
GLenum precision;
|
||||
std::string name;
|
||||
std::string mappedName;
|
||||
unsigned int arraySize;
|
||||
|
||||
// Used to make an array type. Outermost array size is stored at the end of the vector.
|
||||
std::vector<unsigned int> arraySizes;
|
||||
|
||||
// Offset of this variable in parent arrays. In case the parent is an array of arrays, the
|
||||
// offset is outerArrayElement * innerArraySize + innerArrayElement.
|
||||
// For example, if there's a variable declared as size 3 array of size 4 array of int:
|
||||
// int a[3][4];
|
||||
// then the flattenedOffsetInParentArrays of a[2] would be 2.
|
||||
// and flattenedOffsetInParentArrays of a[2][1] would be 2*4 + 1 = 9.
|
||||
unsigned int flattenedOffsetInParentArrays;
|
||||
|
||||
bool staticUse;
|
||||
std::vector<ShaderVariable> fields;
|
||||
std::string structName;
|
||||
|
||||
protected:
|
||||
bool isSameVariableAtLinkTime(const ShaderVariable &other,
|
||||
bool matchPrecision) const;
|
||||
bool matchPrecision,
|
||||
bool matchName) const;
|
||||
|
||||
bool operator==(const ShaderVariable &other) const;
|
||||
bool operator!=(const ShaderVariable &other) const
|
||||
@ -92,7 +142,21 @@ struct COMPILER_EXPORT ShaderVariable
|
||||
}
|
||||
};
|
||||
|
||||
struct COMPILER_EXPORT Uniform : public ShaderVariable
|
||||
// A variable with an integer location to pass back to the GL API: either uniform (can have location
|
||||
// in GLES3.1+), vertex shader input or fragment shader output.
|
||||
struct VariableWithLocation : public ShaderVariable
|
||||
{
|
||||
VariableWithLocation();
|
||||
~VariableWithLocation();
|
||||
VariableWithLocation(const VariableWithLocation &other);
|
||||
VariableWithLocation &operator=(const VariableWithLocation &other);
|
||||
bool operator==(const VariableWithLocation &other) const;
|
||||
bool operator!=(const VariableWithLocation &other) const { return !operator==(other); }
|
||||
|
||||
int location;
|
||||
};
|
||||
|
||||
struct Uniform : public VariableWithLocation
|
||||
{
|
||||
Uniform();
|
||||
~Uniform();
|
||||
@ -104,28 +168,17 @@ struct COMPILER_EXPORT Uniform : public ShaderVariable
|
||||
return !operator==(other);
|
||||
}
|
||||
|
||||
int binding;
|
||||
int offset;
|
||||
|
||||
// Decide whether two uniforms are the same at shader link time,
|
||||
// assuming one from vertex shader and the other from fragment shader.
|
||||
// See GLSL ES Spec 3.00.3, sec 4.3.5.
|
||||
// GLSL ES Spec 3.00.3, section 4.3.5.
|
||||
// GLSL ES Spec 3.10.4, section 4.4.5
|
||||
bool isSameUniformAtLinkTime(const Uniform &other) const;
|
||||
};
|
||||
|
||||
// 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
|
||||
struct Attribute : public VariableWithLocation
|
||||
{
|
||||
Attribute();
|
||||
~Attribute();
|
||||
@ -135,7 +188,7 @@ struct COMPILER_EXPORT Attribute : public InterfaceVariable
|
||||
bool operator!=(const Attribute &other) const { return !operator==(other); }
|
||||
};
|
||||
|
||||
struct COMPILER_EXPORT OutputVariable : public InterfaceVariable
|
||||
struct OutputVariable : public VariableWithLocation
|
||||
{
|
||||
OutputVariable();
|
||||
~OutputVariable();
|
||||
@ -145,7 +198,7 @@ struct COMPILER_EXPORT OutputVariable : public InterfaceVariable
|
||||
bool operator!=(const OutputVariable &other) const { return !operator==(other); }
|
||||
};
|
||||
|
||||
struct COMPILER_EXPORT InterfaceBlockField : public ShaderVariable
|
||||
struct InterfaceBlockField : public ShaderVariable
|
||||
{
|
||||
InterfaceBlockField();
|
||||
~InterfaceBlockField();
|
||||
@ -167,7 +220,7 @@ struct COMPILER_EXPORT InterfaceBlockField : public ShaderVariable
|
||||
bool isRowMajorLayout;
|
||||
};
|
||||
|
||||
struct COMPILER_EXPORT Varying : public ShaderVariable
|
||||
struct Varying : public VariableWithLocation
|
||||
{
|
||||
Varying();
|
||||
~Varying();
|
||||
@ -193,7 +246,7 @@ struct COMPILER_EXPORT Varying : public ShaderVariable
|
||||
bool isInvariant;
|
||||
};
|
||||
|
||||
struct COMPILER_EXPORT InterfaceBlock
|
||||
struct InterfaceBlock
|
||||
{
|
||||
InterfaceBlock();
|
||||
~InterfaceBlock();
|
||||
@ -202,6 +255,15 @@ struct COMPILER_EXPORT InterfaceBlock
|
||||
|
||||
// Fields from blocks with non-empty instance names are prefixed with the block name.
|
||||
std::string fieldPrefix() const;
|
||||
std::string fieldMappedPrefix() const;
|
||||
|
||||
// Decide whether two interface blocks are the same at shader link time.
|
||||
bool isSameInterfaceBlockAtLinkTime(const InterfaceBlock &other) const;
|
||||
|
||||
bool isBuiltIn() const;
|
||||
|
||||
bool isArray() const { return arraySize > 0; }
|
||||
unsigned int elementCount() const { return std::max(1u, arraySize); }
|
||||
|
||||
std::string name;
|
||||
std::string mappedName;
|
||||
@ -209,10 +271,45 @@ struct COMPILER_EXPORT InterfaceBlock
|
||||
unsigned int arraySize;
|
||||
BlockLayoutType layout;
|
||||
bool isRowMajorLayout;
|
||||
int binding;
|
||||
bool staticUse;
|
||||
BlockType blockType;
|
||||
std::vector<InterfaceBlockField> fields;
|
||||
};
|
||||
|
||||
struct WorkGroupSize
|
||||
{
|
||||
// Must have a trivial default constructor since it is used in YYSTYPE.
|
||||
WorkGroupSize() = default;
|
||||
explicit constexpr WorkGroupSize(int initialSize)
|
||||
: localSizeQualifiers{initialSize, initialSize, initialSize}
|
||||
{
|
||||
}
|
||||
|
||||
void fill(int fillValue);
|
||||
void setLocalSize(int localSizeX, int localSizeY, int localSizeZ);
|
||||
|
||||
int &operator[](size_t index);
|
||||
int operator[](size_t index) const;
|
||||
size_t size() const;
|
||||
|
||||
// Checks whether two work group size declarations match.
|
||||
// Two work group size declarations are the same if the explicitly specified elements are the
|
||||
// same or if one of them is specified as one and the other one is not specified
|
||||
bool isWorkGroupSizeMatching(const WorkGroupSize &right) const;
|
||||
|
||||
// Checks whether any of the values are set.
|
||||
bool isAnyValueSet() const;
|
||||
|
||||
// Checks whether all of the values are set.
|
||||
bool isDeclared() const;
|
||||
|
||||
// Checks whether either all of the values are set, or none of them are.
|
||||
bool isLocalSizeValid() const;
|
||||
|
||||
std::array<int, 3> localSizeQualifiers;
|
||||
};
|
||||
|
||||
} // namespace sh
|
||||
|
||||
#endif // GLSLANG_SHADERVARS_H_
|
||||
|
9
src/3rdparty/angle/include/KHR/khrplatform.h
vendored
9
src/3rdparty/angle/include/KHR/khrplatform.h
vendored
@ -26,7 +26,7 @@
|
||||
|
||||
/* Khronos platform-specific types and definitions.
|
||||
*
|
||||
* $Revision: 23298 $ on $Date: 2013-09-30 17:07:13 -0700 (Mon, 30 Sep 2013) $
|
||||
* $Revision: 32517 $ on $Date: 2016-03-11 02:41:19 -0800 (Fri, 11 Mar 2016) $
|
||||
*
|
||||
* Adopters may modify this file to suit their platform. Adopters are
|
||||
* encouraged to submit platform specific modifications to the Khronos
|
||||
@ -101,6 +101,9 @@
|
||||
# define KHRONOS_APICALL __declspec(dllimport)
|
||||
#elif defined (__SYMBIAN32__)
|
||||
# define KHRONOS_APICALL IMPORT_C
|
||||
#elif defined(__ANDROID__)
|
||||
# include <sys/cdefs.h>
|
||||
# define KHRONOS_APICALL __attribute__((visibility("default"))) __NDK_FPABI__
|
||||
#else
|
||||
# define KHRONOS_APICALL
|
||||
#endif
|
||||
@ -223,7 +226,7 @@ typedef signed short int khronos_int16_t;
|
||||
typedef unsigned short int khronos_uint16_t;
|
||||
|
||||
/*
|
||||
* Types that differ between LLP64 and LP64 architectures - in LLP64,
|
||||
* Types that differ between LLP64 and LP64 architectures - in LLP64,
|
||||
* pointers are 64 bits, but 'long' is still 32 bits. Win64 appears
|
||||
* to be the only LLP64 architecture in current use.
|
||||
*/
|
||||
@ -279,4 +282,4 @@ typedef enum {
|
||||
KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM
|
||||
} khronos_boolean_enum_t;
|
||||
|
||||
#endif /* __khrplatform_h_ */
|
||||
#endif /* __khrplatform_h_ */
|
5
src/3rdparty/angle/include/angle_gl.h
vendored
5
src/3rdparty/angle/include/angle_gl.h
vendored
@ -16,9 +16,4 @@
|
||||
#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
|
||||
#define GL_SAMPLER_2D_RECT_ARB 0x8B63
|
||||
#endif
|
||||
|
||||
#endif // ANGLEGL_H_
|
||||
|
8
src/3rdparty/angle/include/export.h
vendored
8
src/3rdparty/angle/include/export.h
vendored
@ -9,14 +9,17 @@
|
||||
#ifndef LIBGLESV2_EXPORT_H_
|
||||
#define LIBGLESV2_EXPORT_H_
|
||||
|
||||
#if !defined(ANGLE_EXPORT)
|
||||
#if defined(_WIN32)
|
||||
# if defined(LIBGLESV2_IMPLEMENTATION) || defined(LIBANGLE_IMPLEMENTATION)
|
||||
#if defined(LIBGLESV2_IMPLEMENTATION) || defined(LIBANGLE_IMPLEMENTATION) || \
|
||||
defined(LIBANGLE_UTIL_IMPLEMENTATION)
|
||||
# define ANGLE_EXPORT __declspec(dllexport)
|
||||
# else
|
||||
# define ANGLE_EXPORT __declspec(dllimport)
|
||||
# endif
|
||||
#elif defined(__GNUC__)
|
||||
# if defined(LIBGLESV2_IMPLEMENTATION) || defined(LIBANGLE_IMPLEMENTATION)
|
||||
#if defined(LIBGLESV2_IMPLEMENTATION) || defined(LIBANGLE_IMPLEMENTATION) || \
|
||||
defined(LIBANGLE_UTIL_IMPLEMENTATION)
|
||||
# define ANGLE_EXPORT __attribute__((visibility ("default")))
|
||||
# else
|
||||
# define ANGLE_EXPORT
|
||||
@ -24,5 +27,6 @@
|
||||
#else
|
||||
# define ANGLE_EXPORT
|
||||
#endif
|
||||
#endif // !defined(ANGLE_EXPORT)
|
||||
|
||||
#endif // LIBGLESV2_EXPORT_H_
|
||||
|
389
src/3rdparty/angle/include/platform/Platform.h
vendored
389
src/3rdparty/angle/include/platform/Platform.h
vendored
@ -10,15 +10,16 @@
|
||||
#define ANGLE_PLATFORM_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <array>
|
||||
|
||||
#if defined(_WIN32)
|
||||
# if !defined(LIBANGLE_IMPLEMENTATION)
|
||||
# define ANGLE_PLATFORM_EXPORT __declspec(dllimport)
|
||||
# else
|
||||
# define ANGLE_PLATFORM_EXPORT __declspec(dllexport)
|
||||
# endif
|
||||
#elif defined(__GNUC__)
|
||||
# if defined(LIBANGLE_IMPLEMENTATION)
|
||||
# define ANGLE_PLATFORM_EXPORT __attribute__((visibility ("default")))
|
||||
# endif
|
||||
#elif defined(__GNUC__) || defined(__clang__)
|
||||
# define ANGLE_PLATFORM_EXPORT __attribute__((visibility ("default")))
|
||||
#endif
|
||||
#if !defined(ANGLE_PLATFORM_EXPORT)
|
||||
# define ANGLE_PLATFORM_EXPORT
|
||||
@ -32,137 +33,295 @@
|
||||
|
||||
namespace angle
|
||||
{
|
||||
struct WorkaroundsD3D;
|
||||
using TraceEventHandle = uint64_t;
|
||||
using EGLDisplayType = void *;
|
||||
struct PlatformMethods;
|
||||
|
||||
class Platform
|
||||
// Use a C-like API to not trigger undefined calling behaviour.
|
||||
// Avoid using decltype here to work around sanitizer limitations.
|
||||
// TODO(jmadill): Use decltype here if/when UBSAN is fixed.
|
||||
|
||||
// System --------------------------------------------------------------
|
||||
|
||||
// Wall clock time in seconds since the epoch.
|
||||
// TODO(jmadill): investigate using an ANGLE internal time library
|
||||
using CurrentTimeFunc = double (*)(PlatformMethods *platform);
|
||||
inline double DefaultCurrentTime(PlatformMethods *platform)
|
||||
{
|
||||
public:
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
// System --------------------------------------------------------------
|
||||
// Monotonically increasing time in seconds from an arbitrary fixed point in the past.
|
||||
// This function is expected to return at least millisecond-precision values. For this reason,
|
||||
// it is recommended that the fixed point be no further in the past than the epoch.
|
||||
using MonotonicallyIncreasingTimeFunc = double (*)(PlatformMethods *platform);
|
||||
inline double DefaultMonotonicallyIncreasingTime(PlatformMethods *platform)
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
// Wall clock time in seconds since the epoch.
|
||||
// TODO(jmadill): investigate using an ANGLE internal time library
|
||||
virtual double currentTime() { return 0; }
|
||||
// Logging ------------------------------------------------------------
|
||||
|
||||
// Monotonically increasing time in seconds from an arbitrary fixed point in the past.
|
||||
// This function is expected to return at least millisecond-precision values. For this reason,
|
||||
// it is recommended that the fixed point be no further in the past than the epoch.
|
||||
virtual double monotonicallyIncreasingTime() { return 0; }
|
||||
// Log an error message within the platform implementation.
|
||||
using LogErrorFunc = void (*)(PlatformMethods *platform, const char *errorMessage);
|
||||
inline void DefaultLogError(PlatformMethods *platform, const char *errorMessage)
|
||||
{
|
||||
}
|
||||
|
||||
// Logging ------------------------------------------------------------
|
||||
// Log a warning message within the platform implementation.
|
||||
using LogWarningFunc = void (*)(PlatformMethods *platform, const char *warningMessage);
|
||||
inline void DefaultLogWarning(PlatformMethods *platform, const char *warningMessage)
|
||||
{
|
||||
}
|
||||
|
||||
// Log an error message within the platform implementation.
|
||||
virtual void logError(const char *errorMessage) {}
|
||||
// Log an info message within the platform implementation.
|
||||
using LogInfoFunc = void (*)(PlatformMethods *platform, const char *infoMessage);
|
||||
inline void DefaultLogInfo(PlatformMethods *platform, const char *infoMessage)
|
||||
{
|
||||
}
|
||||
|
||||
// Log a warning message within the platform implementation.
|
||||
virtual void logWarning(const char *warningMessage) {}
|
||||
// Tracing --------
|
||||
|
||||
// Log an info message within the platform implementation.
|
||||
virtual void logInfo(const char *infoMessage) {}
|
||||
// Get a pointer to the enabled state of the given trace category. The
|
||||
// embedder can dynamically change the enabled state as trace event
|
||||
// recording is started and stopped by the application. Only long-lived
|
||||
// literal strings should be given as the category name. The implementation
|
||||
// expects the returned pointer to be held permanently in a local static. If
|
||||
// the unsigned char is non-zero, tracing is enabled. If tracing is enabled,
|
||||
// addTraceEvent is expected to be called by the trace event macros.
|
||||
using GetTraceCategoryEnabledFlagFunc = const unsigned char *(*)(PlatformMethods *platform,
|
||||
const char *categoryName);
|
||||
inline const unsigned char *DefaultGetTraceCategoryEnabledFlag(PlatformMethods *platform,
|
||||
const char *categoryName)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Tracing --------
|
||||
//
|
||||
// Add a trace event to the platform tracing system. Depending on the actual
|
||||
// enabled state, this event may be recorded or dropped.
|
||||
// - phase specifies the type of event:
|
||||
// - BEGIN ('B'): Marks the beginning of a scoped event.
|
||||
// - END ('E'): Marks the end of a scoped event.
|
||||
// - COMPLETE ('X'): Marks the beginning of a scoped event, but doesn't
|
||||
// need a matching END event. Instead, at the end of the scope,
|
||||
// updateTraceEventDuration() must be called with the TraceEventHandle
|
||||
// returned from addTraceEvent().
|
||||
// - INSTANT ('I'): Standalone, instantaneous event.
|
||||
// - START ('S'): Marks the beginning of an asynchronous event (the end
|
||||
// event can occur in a different scope or thread). The id parameter is
|
||||
// used to match START/FINISH pairs.
|
||||
// - FINISH ('F'): Marks the end of an asynchronous event.
|
||||
// - COUNTER ('C'): Used to trace integer quantities that change over
|
||||
// time. The argument values are expected to be of type int.
|
||||
// - METADATA ('M'): Reserved for internal use.
|
||||
// - categoryEnabled is the pointer returned by getTraceCategoryEnabledFlag.
|
||||
// - name is the name of the event. Also used to match BEGIN/END and
|
||||
// START/FINISH pairs.
|
||||
// - id optionally allows events of the same name to be distinguished from
|
||||
// each other. For example, to trace the consutruction and destruction of
|
||||
// objects, specify the pointer as the id parameter.
|
||||
// - timestamp should be a time value returned from monotonicallyIncreasingTime.
|
||||
// - numArgs specifies the number of elements in argNames, argTypes, and
|
||||
// argValues.
|
||||
// - argNames is the array of argument names. Use long-lived literal strings
|
||||
// or specify the COPY flag.
|
||||
// - argTypes is the array of argument types:
|
||||
// - BOOL (1): bool
|
||||
// - UINT (2): unsigned long long
|
||||
// - INT (3): long long
|
||||
// - DOUBLE (4): double
|
||||
// - POINTER (5): void*
|
||||
// - STRING (6): char* (long-lived null-terminated char* string)
|
||||
// - COPY_STRING (7): char* (temporary null-terminated char* string)
|
||||
// - CONVERTABLE (8): WebConvertableToTraceFormat
|
||||
// - argValues is the array of argument values. Each value is the unsigned
|
||||
// long long member of a union of all supported types.
|
||||
// - flags can be 0 or one or more of the following, ORed together:
|
||||
// - COPY (0x1): treat all strings (name, argNames and argValues of type
|
||||
// string) as temporary so that they will be copied by addTraceEvent.
|
||||
// - HAS_ID (0x2): use the id argument to uniquely identify the event for
|
||||
// matching with other events of the same name.
|
||||
// - MANGLE_ID (0x4): specify this flag if the id parameter is the value
|
||||
// of a pointer.
|
||||
using AddTraceEventFunc = angle::TraceEventHandle (*)(PlatformMethods *platform,
|
||||
char phase,
|
||||
const unsigned char *categoryEnabledFlag,
|
||||
const char *name,
|
||||
unsigned long long id,
|
||||
double timestamp,
|
||||
int numArgs,
|
||||
const char **argNames,
|
||||
const unsigned char *argTypes,
|
||||
const unsigned long long *argValues,
|
||||
unsigned char flags);
|
||||
inline angle::TraceEventHandle DefaultAddTraceEvent(PlatformMethods *platform,
|
||||
char phase,
|
||||
const unsigned char *categoryEnabledFlag,
|
||||
const char *name,
|
||||
unsigned long long id,
|
||||
double timestamp,
|
||||
int numArgs,
|
||||
const char **argNames,
|
||||
const unsigned char *argTypes,
|
||||
const unsigned long long *argValues,
|
||||
unsigned char flags)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Get a pointer to the enabled state of the given trace category. The
|
||||
// embedder can dynamically change the enabled state as trace event
|
||||
// recording is started and stopped by the application. Only long-lived
|
||||
// literal strings should be given as the category name. The implementation
|
||||
// expects the returned pointer to be held permanently in a local static. If
|
||||
// the unsigned char is non-zero, tracing is enabled. If tracing is enabled,
|
||||
// addTraceEvent is expected to be called by the trace event macros.
|
||||
virtual const unsigned char *getTraceCategoryEnabledFlag(const char *categoryName) { return 0; }
|
||||
// Set the duration field of a COMPLETE trace event.
|
||||
using UpdateTraceEventDurationFunc = void (*)(PlatformMethods *platform,
|
||||
const unsigned char *categoryEnabledFlag,
|
||||
const char *name,
|
||||
angle::TraceEventHandle eventHandle);
|
||||
inline void DefaultUpdateTraceEventDuration(PlatformMethods *platform,
|
||||
const unsigned char *categoryEnabledFlag,
|
||||
const char *name,
|
||||
angle::TraceEventHandle eventHandle)
|
||||
{
|
||||
}
|
||||
|
||||
typedef uint64_t TraceEventHandle;
|
||||
|
||||
// Add a trace event to the platform tracing system. Depending on the actual
|
||||
// enabled state, this event may be recorded or dropped.
|
||||
// - phase specifies the type of event:
|
||||
// - BEGIN ('B'): Marks the beginning of a scoped event.
|
||||
// - END ('E'): Marks the end of a scoped event.
|
||||
// - COMPLETE ('X'): Marks the beginning of a scoped event, but doesn't
|
||||
// need a matching END event. Instead, at the end of the scope,
|
||||
// updateTraceEventDuration() must be called with the TraceEventHandle
|
||||
// returned from addTraceEvent().
|
||||
// - INSTANT ('I'): Standalone, instantaneous event.
|
||||
// - START ('S'): Marks the beginning of an asynchronous event (the end
|
||||
// event can occur in a different scope or thread). The id parameter is
|
||||
// used to match START/FINISH pairs.
|
||||
// - FINISH ('F'): Marks the end of an asynchronous event.
|
||||
// - COUNTER ('C'): Used to trace integer quantities that change over
|
||||
// time. The argument values are expected to be of type int.
|
||||
// - METADATA ('M'): Reserved for internal use.
|
||||
// - categoryEnabled is the pointer returned by getTraceCategoryEnabledFlag.
|
||||
// - name is the name of the event. Also used to match BEGIN/END and
|
||||
// START/FINISH pairs.
|
||||
// - id optionally allows events of the same name to be distinguished from
|
||||
// each other. For example, to trace the consutruction and destruction of
|
||||
// objects, specify the pointer as the id parameter.
|
||||
// - timestamp should be a time value returned from monotonicallyIncreasingTime.
|
||||
// - numArgs specifies the number of elements in argNames, argTypes, and
|
||||
// argValues.
|
||||
// - argNames is the array of argument names. Use long-lived literal strings
|
||||
// or specify the COPY flag.
|
||||
// - argTypes is the array of argument types:
|
||||
// - BOOL (1): bool
|
||||
// - UINT (2): unsigned long long
|
||||
// - INT (3): long long
|
||||
// - DOUBLE (4): double
|
||||
// - POINTER (5): void*
|
||||
// - STRING (6): char* (long-lived null-terminated char* string)
|
||||
// - COPY_STRING (7): char* (temporary null-terminated char* string)
|
||||
// - CONVERTABLE (8): WebConvertableToTraceFormat
|
||||
// - argValues is the array of argument values. Each value is the unsigned
|
||||
// long long member of a union of all supported types.
|
||||
// - flags can be 0 or one or more of the following, ORed together:
|
||||
// - COPY (0x1): treat all strings (name, argNames and argValues of type
|
||||
// string) as temporary so that they will be copied by addTraceEvent.
|
||||
// - HAS_ID (0x2): use the id argument to uniquely identify the event for
|
||||
// matching with other events of the same name.
|
||||
// - MANGLE_ID (0x4): specify this flag if the id parameter is the value
|
||||
// of a pointer.
|
||||
virtual TraceEventHandle addTraceEvent(char phase,
|
||||
const unsigned char *categoryEnabledFlag,
|
||||
// Callbacks for reporting histogram data.
|
||||
// CustomCounts histogram has exponential bucket sizes, so that min=1, max=1000000, bucketCount=50
|
||||
// would do.
|
||||
using HistogramCustomCountsFunc = void (*)(PlatformMethods *platform,
|
||||
const char *name,
|
||||
unsigned long long id,
|
||||
double timestamp,
|
||||
int numArgs,
|
||||
const char **argNames,
|
||||
const unsigned char *argTypes,
|
||||
const unsigned long long *argValues,
|
||||
unsigned char flags)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
int sample,
|
||||
int min,
|
||||
int max,
|
||||
int bucketCount);
|
||||
inline void DefaultHistogramCustomCounts(PlatformMethods *platform,
|
||||
const char *name,
|
||||
int sample,
|
||||
int min,
|
||||
int max,
|
||||
int bucketCount)
|
||||
{
|
||||
}
|
||||
// Enumeration histogram buckets are linear, boundaryValue should be larger than any possible sample
|
||||
// value.
|
||||
using HistogramEnumerationFunc = void (*)(PlatformMethods *platform,
|
||||
const char *name,
|
||||
int sample,
|
||||
int boundaryValue);
|
||||
inline void DefaultHistogramEnumeration(PlatformMethods *platform,
|
||||
const char *name,
|
||||
int sample,
|
||||
int boundaryValue)
|
||||
{
|
||||
}
|
||||
// Unlike enumeration histograms, sparse histograms only allocate memory for non-empty buckets.
|
||||
using HistogramSparseFunc = void (*)(PlatformMethods *platform, const char *name, int sample);
|
||||
inline void DefaultHistogramSparse(PlatformMethods *platform, const char *name, int sample)
|
||||
{
|
||||
}
|
||||
// Boolean histograms track two-state variables.
|
||||
using HistogramBooleanFunc = void (*)(PlatformMethods *platform, const char *name, bool sample);
|
||||
inline void DefaultHistogramBoolean(PlatformMethods *platform, const char *name, bool sample)
|
||||
{
|
||||
}
|
||||
|
||||
// Set the duration field of a COMPLETE trace event.
|
||||
virtual void updateTraceEventDuration(const unsigned char *categoryEnabledFlag, const char *name, TraceEventHandle eventHandle) { }
|
||||
// Allows us to programatically override ANGLE's default workarounds for testing purposes.
|
||||
using OverrideWorkaroundsD3DFunc = void (*)(PlatformMethods *platform,
|
||||
angle::WorkaroundsD3D *workaroundsD3D);
|
||||
inline void DefaultOverrideWorkaroundsD3D(PlatformMethods *platform,
|
||||
angle::WorkaroundsD3D *workaroundsD3D)
|
||||
{
|
||||
}
|
||||
|
||||
// Callbacks for reporting histogram data.
|
||||
// CustomCounts histogram has exponential bucket sizes, so that min=1, max=1000000, bucketCount=50 would do.
|
||||
virtual void histogramCustomCounts(const char *name, int sample, int min, int max, int bucketCount) { }
|
||||
// Enumeration histogram buckets are linear, boundaryValue should be larger than any possible sample value.
|
||||
virtual void histogramEnumeration(const char *name, int sample, int boundaryValue) { }
|
||||
// Unlike enumeration histograms, sparse histograms only allocate memory for non-empty buckets.
|
||||
virtual void histogramSparse(const char *name, int sample) { }
|
||||
// Boolean histograms track two-state variables.
|
||||
virtual void histogramBoolean(const char *name, bool sample) { }
|
||||
// Callback on a successful program link with the program binary. Can be used to store
|
||||
// shaders to disk. Keys are a 160-bit SHA-1 hash.
|
||||
using ProgramKeyType = std::array<uint8_t, 20>;
|
||||
using CacheProgramFunc = void (*)(PlatformMethods *platform,
|
||||
const ProgramKeyType &key,
|
||||
size_t programSize,
|
||||
const uint8_t *programBytes);
|
||||
inline void DefaultCacheProgram(PlatformMethods *platform,
|
||||
const ProgramKeyType &key,
|
||||
size_t programSize,
|
||||
const uint8_t *programBytes)
|
||||
{
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual ~Platform() { }
|
||||
// Platform methods are enumerated here once.
|
||||
#define ANGLE_PLATFORM_OP(OP) \
|
||||
OP(currentTime, CurrentTime) \
|
||||
OP(monotonicallyIncreasingTime, MonotonicallyIncreasingTime) \
|
||||
OP(logError, LogError) \
|
||||
OP(logWarning, LogWarning) \
|
||||
OP(logInfo, LogInfo) \
|
||||
OP(getTraceCategoryEnabledFlag, GetTraceCategoryEnabledFlag) \
|
||||
OP(addTraceEvent, AddTraceEvent) \
|
||||
OP(updateTraceEventDuration, UpdateTraceEventDuration) \
|
||||
OP(histogramCustomCounts, HistogramCustomCounts) \
|
||||
OP(histogramEnumeration, HistogramEnumeration) \
|
||||
OP(histogramSparse, HistogramSparse) \
|
||||
OP(histogramBoolean, HistogramBoolean) \
|
||||
OP(overrideWorkaroundsD3D, OverrideWorkaroundsD3D) \
|
||||
OP(cacheProgram, CacheProgram)
|
||||
|
||||
#define ANGLE_PLATFORM_METHOD_DEF(Name, CapsName) CapsName##Func Name = Default##CapsName;
|
||||
|
||||
struct ANGLE_PLATFORM_EXPORT PlatformMethods
|
||||
{
|
||||
PlatformMethods();
|
||||
|
||||
// User data pointer for any implementation specific members. Put it at the start of the
|
||||
// platform structure so it doesn't become overwritten if one version of the platform
|
||||
// adds or removes new members.
|
||||
void *context = 0;
|
||||
|
||||
ANGLE_PLATFORM_OP(ANGLE_PLATFORM_METHOD_DEF);
|
||||
};
|
||||
|
||||
}
|
||||
#undef ANGLE_PLATFORM_METHOD_DEF
|
||||
|
||||
extern "C"
|
||||
// Subtract one to account for the context pointer.
|
||||
constexpr unsigned int g_NumPlatformMethods = (sizeof(PlatformMethods) / sizeof(uintptr_t)) - 1;
|
||||
|
||||
#define ANGLE_PLATFORM_METHOD_STRING(Name) #Name
|
||||
#define ANGLE_PLATFORM_METHOD_STRING2(Name, CapsName) ANGLE_PLATFORM_METHOD_STRING(Name),
|
||||
|
||||
constexpr const char *const g_PlatformMethodNames[g_NumPlatformMethods] = {
|
||||
ANGLE_PLATFORM_OP(ANGLE_PLATFORM_METHOD_STRING2)};
|
||||
|
||||
#undef ANGLE_PLATFORM_METHOD_STRING2
|
||||
#undef ANGLE_PLATFORM_METHOD_STRING
|
||||
|
||||
} // namespace angle
|
||||
|
||||
extern "C" {
|
||||
|
||||
// Gets the platform methods on the passed-in EGL display. If the method name signature does not
|
||||
// match the compiled signature for this ANGLE, false is returned. On success true is returned.
|
||||
// The application should set any platform methods it cares about on the returned pointer.
|
||||
// If display is not valid, behaviour is undefined.
|
||||
|
||||
ANGLE_PLATFORM_EXPORT bool ANGLE_APIENTRY ANGLEGetDisplayPlatform(angle::EGLDisplayType display,
|
||||
const char *const methodNames[],
|
||||
unsigned int methodNameCount,
|
||||
void *context,
|
||||
void *platformMethodsOut);
|
||||
|
||||
// Sets the platform methods back to their defaults.
|
||||
// If display is not valid, behaviour is undefined.
|
||||
ANGLE_PLATFORM_EXPORT void ANGLE_APIENTRY ANGLEResetDisplayPlatform(angle::EGLDisplayType display);
|
||||
|
||||
} // extern "C"
|
||||
|
||||
namespace angle
|
||||
{
|
||||
typedef bool(ANGLE_APIENTRY *GetDisplayPlatformFunc)(angle::EGLDisplayType,
|
||||
const char *const *,
|
||||
unsigned int,
|
||||
void *,
|
||||
void *);
|
||||
typedef void(ANGLE_APIENTRY *ResetDisplayPlatformFunc)(angle::EGLDisplayType);
|
||||
} // namespace angle
|
||||
|
||||
typedef void (ANGLE_APIENTRY *ANGLEPlatformInitializeFunc)(angle::Platform*);
|
||||
ANGLE_PLATFORM_EXPORT void ANGLE_APIENTRY ANGLEPlatformInitialize(angle::Platform*);
|
||||
|
||||
typedef void (ANGLE_APIENTRY *ANGLEPlatformShutdownFunc)();
|
||||
ANGLE_PLATFORM_EXPORT void ANGLE_APIENTRY ANGLEPlatformShutdown();
|
||||
|
||||
typedef angle::Platform *(ANGLE_APIENTRY *ANGLEPlatformCurrentFunc)();
|
||||
ANGLE_PLATFORM_EXPORT angle::Platform *ANGLE_APIENTRY ANGLEPlatformCurrent();
|
||||
|
||||
}
|
||||
// This function is not exported
|
||||
angle::PlatformMethods *ANGLEPlatformCurrent();
|
||||
|
||||
#endif // ANGLE_PLATFORM_H
|
||||
|
130
src/3rdparty/angle/include/platform/WorkaroundsD3D.h
vendored
Normal file
130
src/3rdparty/angle/include/platform/WorkaroundsD3D.h
vendored
Normal file
@ -0,0 +1,130 @@
|
||||
//
|
||||
// Copyright (c) 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.
|
||||
//
|
||||
|
||||
// WorkaroundsD3D.h: Workarounds for D3D driver bugs and other issues.
|
||||
|
||||
#ifndef ANGLE_PLATFORM_WORKAROUNDSD3D_H_
|
||||
#define ANGLE_PLATFORM_WORKAROUNDSD3D_H_
|
||||
|
||||
// TODO(jmadill,zmo,geofflang): make a workarounds library that can operate
|
||||
// independent of ANGLE's renderer. Workarounds should also be accessible
|
||||
// outside of the Renderer.
|
||||
|
||||
namespace angle
|
||||
{
|
||||
struct CompilerWorkaroundsD3D
|
||||
{
|
||||
bool skipOptimization = false;
|
||||
bool useMaxOptimization = false;
|
||||
|
||||
// IEEE strictness needs to be enabled for NANs to work.
|
||||
bool enableIEEEStrictness = false;
|
||||
};
|
||||
|
||||
struct WorkaroundsD3D
|
||||
{
|
||||
// On some systems, having extra rendertargets than necessary slows down the shader.
|
||||
// We can fix this by optimizing those out of the shader. At the same time, we can
|
||||
// work around a bug on some nVidia drivers that they ignore "null" render targets
|
||||
// in D3D11, by compacting the active color attachments list to omit null entries.
|
||||
bool mrtPerfWorkaround = false;
|
||||
|
||||
bool setDataFasterThanImageUpload = false;
|
||||
|
||||
// Some renderers can't disable mipmaps on a mipmapped texture (i.e. solely sample from level
|
||||
// zero, and ignore the other levels). D3D11 Feature Level 10+ does this by setting MaxLOD to
|
||||
// 0.0f in the Sampler state. D3D9 sets D3DSAMP_MIPFILTER to D3DTEXF_NONE. There is no
|
||||
// equivalent to this in D3D11 Feature Level 9_3. This causes problems when (for example) an
|
||||
// application creates a mipmapped texture2D, but sets GL_TEXTURE_MIN_FILTER to GL_NEAREST
|
||||
// (i.e disables mipmaps). To work around this, D3D11 FL9_3 has to create two copies of the
|
||||
// texture. The textures' level zeros are identical, but only one texture has mips.
|
||||
bool zeroMaxLodWorkaround = false;
|
||||
|
||||
// Some renderers do not support Geometry Shaders so the Geometry Shader-based PointSprite
|
||||
// emulation will not work. To work around this, D3D11 FL9_3 has to use a different pointsprite
|
||||
// emulation that is implemented using instanced quads.
|
||||
bool useInstancedPointSpriteEmulation = false;
|
||||
|
||||
// A bug fixed in NVIDIA driver version 347.88 < x <= 368.81 triggers a TDR when using
|
||||
// CopySubresourceRegion from a staging texture to a depth/stencil in D3D11. The workaround
|
||||
// is to use UpdateSubresource to trigger an extra copy. We disable this workaround on newer
|
||||
// NVIDIA driver versions because of a second driver bug present with the workaround enabled.
|
||||
// (See: http://anglebug.com/1452)
|
||||
bool depthStencilBlitExtraCopy = false;
|
||||
|
||||
// The HLSL optimizer has a bug with optimizing "pow" in certain integer-valued expressions.
|
||||
// We can work around this by expanding the pow into a series of multiplies if we're running
|
||||
// under the affected compiler.
|
||||
bool expandIntegerPowExpressions = false;
|
||||
|
||||
// NVIDIA drivers sometimes write out-of-order results to StreamOut buffers when transform
|
||||
// feedback is used to repeatedly write to the same buffer positions.
|
||||
bool flushAfterEndingTransformFeedback = false;
|
||||
|
||||
// Some drivers (NVIDIA) do not take into account the base level of the texture in the results
|
||||
// of the HLSL GetDimensions builtin.
|
||||
bool getDimensionsIgnoresBaseLevel = false;
|
||||
|
||||
// On some Intel drivers, HLSL's function texture.Load returns 0 when the parameter Location
|
||||
// is negative, even if the sum of Offset and Location is in range. This may cause errors when
|
||||
// translating GLSL's function texelFetchOffset into texture.Load, as it is valid for
|
||||
// texelFetchOffset to use negative texture coordinates as its parameter P when the sum of P
|
||||
// and Offset is in range. To work around this, we translate texelFetchOffset into texelFetch
|
||||
// by adding Offset directly to Location before reading the texture.
|
||||
bool preAddTexelFetchOffsets = false;
|
||||
|
||||
// On some AMD drivers, 1x1 and 2x2 mips of depth/stencil textures aren't sampled correctly.
|
||||
// We can work around this bug by doing an internal blit to a temporary single-channel texture
|
||||
// before we sample.
|
||||
bool emulateTinyStencilTextures = false;
|
||||
|
||||
// In Intel driver, the data with format DXGI_FORMAT_B5G6R5_UNORM will be parsed incorrectly.
|
||||
// This workaroud will disable B5G6R5 support when it's Intel driver. By default, it will use
|
||||
// R8G8B8A8 format. This bug is fixed in version 4539 on Intel drivers.
|
||||
bool disableB5G6R5Support = false;
|
||||
|
||||
// On some Intel drivers, evaluating unary minus operator on integer may get wrong answer in
|
||||
// vertex shaders. To work around this bug, we translate -(int) into ~(int)+1.
|
||||
// This driver bug is fixed in 20.19.15.4624.
|
||||
bool rewriteUnaryMinusOperator = false;
|
||||
|
||||
// On some Intel drivers, using isnan() on highp float will get wrong answer. To work around
|
||||
// this bug, we use an expression to emulate function isnan().
|
||||
// Tracking bug: https://crbug.com/650547
|
||||
// This driver bug is fixed in 21.20.16.4542.
|
||||
bool emulateIsnanFloat = false;
|
||||
|
||||
// On some Intel drivers, using clear() may not take effect. To work around this bug, we call
|
||||
// clear() twice on these platforms.
|
||||
// Tracking bug: https://crbug.com/655534
|
||||
bool callClearTwice = false;
|
||||
|
||||
// On some Intel drivers, copying from staging storage to constant buffer storage does not
|
||||
// seem to work. Work around this by keeping system memory storage as a canonical reference
|
||||
// for buffer data.
|
||||
// D3D11-only workaround. See http://crbug.com/593024.
|
||||
bool useSystemMemoryForConstantBuffers = false;
|
||||
|
||||
// This workaround is for the ANGLE_multiview extension. If enabled the viewport or render
|
||||
// target slice will be selected in the geometry shader stage. The workaround flag is added to
|
||||
// make it possible to select the code path in end2end and performance tests.
|
||||
bool selectViewInGeometryShader = false;
|
||||
|
||||
// When rendering with no render target on D3D, two bugs lead to incorrect behavior on Intel
|
||||
// drivers < 4815. The rendering samples always pass neglecting discard statements in pixel
|
||||
// shader.
|
||||
// 1. If rendertarget is not set, the pixel shader will be recompiled to drop 'SV_TARGET'.
|
||||
// When using a pixel shader with no 'SV_TARGET' in a draw, the pixels are always generated even
|
||||
// if they should be discard by 'discard' statements.
|
||||
// 2. If ID3D11BlendState.RenderTarget[].RenderTargetWriteMask is 0 and rendertarget is not set,
|
||||
// then rendering samples also pass neglecting discard statements in pixel shader.
|
||||
// So we add a dummy texture as render target in such case. See http://anglebug.com/2152
|
||||
bool addDummyTextureNoRenderTarget = false;
|
||||
};
|
||||
|
||||
} // namespace angle
|
||||
|
||||
#endif // ANGLE_PLATFORM_WORKAROUNDSD3D_H_
|
156
src/3rdparty/angle/src/common/BitSetIterator.h
vendored
156
src/3rdparty/angle/src/common/BitSetIterator.h
vendored
@ -1,156 +0,0 @@
|
||||
//
|
||||
// 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_
|
53
src/3rdparty/angle/src/common/Color.h
vendored
Normal file
53
src/3rdparty/angle/src/common/Color.h
vendored
Normal file
@ -0,0 +1,53 @@
|
||||
//
|
||||
// Copyright (c) 2016 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.
|
||||
//
|
||||
|
||||
// Color.h : Defines the Color type used throughout the ANGLE libraries
|
||||
|
||||
#ifndef COMMON_COLOR_H_
|
||||
#define COMMON_COLOR_H_
|
||||
|
||||
namespace angle
|
||||
{
|
||||
|
||||
template <typename T>
|
||||
struct Color
|
||||
{
|
||||
T red;
|
||||
T green;
|
||||
T blue;
|
||||
T alpha;
|
||||
|
||||
Color();
|
||||
Color(T r, T g, T b, T a);
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
bool operator==(const Color<T> &a, const Color<T> &b);
|
||||
|
||||
template <typename T>
|
||||
bool operator!=(const Color<T> &a, const Color<T> &b);
|
||||
|
||||
typedef Color<float> ColorF;
|
||||
typedef Color<int> ColorI;
|
||||
typedef Color<unsigned int> ColorUI;
|
||||
|
||||
} // namespace angle
|
||||
|
||||
// TODO: Move this fully into the angle namespace
|
||||
namespace gl
|
||||
{
|
||||
|
||||
template <typename T>
|
||||
using Color = angle::Color<T>;
|
||||
using ColorF = angle::ColorF;
|
||||
using ColorI = angle::ColorI;
|
||||
using ColorUI = angle::ColorUI;
|
||||
|
||||
} // namespace gl
|
||||
|
||||
#include "Color.inl"
|
||||
|
||||
#endif // COMMON_COLOR_H_
|
37
src/3rdparty/angle/src/common/Color.inl
vendored
Normal file
37
src/3rdparty/angle/src/common/Color.inl
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
//
|
||||
// Copyright (c) 2016 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.
|
||||
//
|
||||
|
||||
// Color.inl : Inline definitions of some functions from Color.h
|
||||
|
||||
namespace angle
|
||||
{
|
||||
|
||||
template <typename T>
|
||||
Color<T>::Color() : Color(0, 0, 0, 0)
|
||||
{
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
Color<T>::Color(T r, T g, T b, T a) : red(r), green(g), blue(b), alpha(a)
|
||||
{
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
bool operator==(const Color<T> &a, const Color<T> &b)
|
||||
{
|
||||
return a.red == b.red &&
|
||||
a.green == b.green &&
|
||||
a.blue == b.blue &&
|
||||
a.alpha == b.alpha;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
bool operator!=(const Color<T> &a, const Color<T> &b)
|
||||
{
|
||||
return !(a == b);
|
||||
}
|
||||
|
||||
} // namespace angle
|
105
src/3rdparty/angle/src/common/MemoryBuffer.cpp
vendored
105
src/3rdparty/angle/src/common/MemoryBuffer.cpp
vendored
@ -11,19 +11,18 @@
|
||||
|
||||
#include "common/debug.h"
|
||||
|
||||
namespace rx
|
||||
namespace angle
|
||||
{
|
||||
|
||||
MemoryBuffer::MemoryBuffer()
|
||||
: mSize(0),
|
||||
mData(NULL)
|
||||
// MemoryBuffer implementation.
|
||||
MemoryBuffer::MemoryBuffer() : mSize(0), mData(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
MemoryBuffer::~MemoryBuffer()
|
||||
{
|
||||
free(mData);
|
||||
mData = NULL;
|
||||
mData = nullptr;
|
||||
}
|
||||
|
||||
bool MemoryBuffer::resize(size_t size)
|
||||
@ -31,7 +30,7 @@ bool MemoryBuffer::resize(size_t size)
|
||||
if (size == 0)
|
||||
{
|
||||
free(mData);
|
||||
mData = NULL;
|
||||
mData = nullptr;
|
||||
mSize = 0;
|
||||
return true;
|
||||
}
|
||||
@ -42,8 +41,8 @@ bool MemoryBuffer::resize(size_t size)
|
||||
}
|
||||
|
||||
// Only reallocate if the size has changed.
|
||||
uint8_t *newMemory = reinterpret_cast<uint8_t*>(malloc(sizeof(uint8_t) * size));
|
||||
if (newMemory == NULL)
|
||||
uint8_t *newMemory = reinterpret_cast<uint8_t *>(malloc(sizeof(uint8_t) * size));
|
||||
if (newMemory == nullptr)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -61,20 +60,96 @@ bool MemoryBuffer::resize(size_t size)
|
||||
return true;
|
||||
}
|
||||
|
||||
size_t MemoryBuffer::size() const
|
||||
void MemoryBuffer::fill(uint8_t datum)
|
||||
{
|
||||
return mSize;
|
||||
if (!empty())
|
||||
{
|
||||
std::fill(mData, mData + mSize, datum);
|
||||
}
|
||||
}
|
||||
|
||||
const uint8_t *MemoryBuffer::data() const
|
||||
MemoryBuffer::MemoryBuffer(MemoryBuffer &&other) : MemoryBuffer()
|
||||
{
|
||||
return mData;
|
||||
*this = std::move(other);
|
||||
}
|
||||
|
||||
uint8_t *MemoryBuffer::data()
|
||||
MemoryBuffer &MemoryBuffer::operator=(MemoryBuffer &&other)
|
||||
{
|
||||
ASSERT(mData);
|
||||
return mData;
|
||||
std::swap(mSize, other.mSize);
|
||||
std::swap(mData, other.mData);
|
||||
return *this;
|
||||
}
|
||||
|
||||
// ScratchBuffer implementation.
|
||||
|
||||
ScratchBuffer::ScratchBuffer(uint32_t lifetime) : mLifetime(lifetime), mResetCounter(lifetime)
|
||||
{
|
||||
}
|
||||
|
||||
ScratchBuffer::~ScratchBuffer()
|
||||
{
|
||||
}
|
||||
|
||||
bool ScratchBuffer::get(size_t requestedSize, MemoryBuffer **memoryBufferOut)
|
||||
{
|
||||
return getImpl(requestedSize, memoryBufferOut, Optional<uint8_t>::Invalid());
|
||||
}
|
||||
|
||||
bool ScratchBuffer::getInitialized(size_t requestedSize,
|
||||
MemoryBuffer **memoryBufferOut,
|
||||
uint8_t initValue)
|
||||
{
|
||||
return getImpl(requestedSize, memoryBufferOut, Optional<uint8_t>(initValue));
|
||||
}
|
||||
|
||||
bool ScratchBuffer::getImpl(size_t requestedSize,
|
||||
MemoryBuffer **memoryBufferOut,
|
||||
Optional<uint8_t> initValue)
|
||||
{
|
||||
if (mScratchMemory.size() == requestedSize)
|
||||
{
|
||||
mResetCounter = mLifetime;
|
||||
*memoryBufferOut = &mScratchMemory;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (mScratchMemory.size() > requestedSize)
|
||||
{
|
||||
tick();
|
||||
}
|
||||
|
||||
if (mResetCounter == 0 || mScratchMemory.size() < requestedSize)
|
||||
{
|
||||
mScratchMemory.resize(0);
|
||||
if (!mScratchMemory.resize(requestedSize))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
mResetCounter = mLifetime;
|
||||
if (initValue.valid())
|
||||
{
|
||||
mScratchMemory.fill(initValue.value());
|
||||
}
|
||||
}
|
||||
|
||||
ASSERT(mScratchMemory.size() >= requestedSize);
|
||||
|
||||
*memoryBufferOut = &mScratchMemory;
|
||||
return true;
|
||||
}
|
||||
|
||||
void ScratchBuffer::tick()
|
||||
{
|
||||
if (mResetCounter > 0)
|
||||
{
|
||||
--mResetCounter;
|
||||
}
|
||||
}
|
||||
|
||||
void ScratchBuffer::clear()
|
||||
{
|
||||
mResetCounter = mLifetime;
|
||||
mScratchMemory.resize(0);
|
||||
}
|
||||
|
||||
} // namespace angle
|
||||
|
55
src/3rdparty/angle/src/common/MemoryBuffer.h
vendored
55
src/3rdparty/angle/src/common/MemoryBuffer.h
vendored
@ -7,32 +7,71 @@
|
||||
#ifndef COMMON_MEMORYBUFFER_H_
|
||||
#define COMMON_MEMORYBUFFER_H_
|
||||
|
||||
#include "common/Optional.h"
|
||||
#include "common/angleutils.h"
|
||||
#include "common/debug.h"
|
||||
|
||||
#include <cstddef>
|
||||
#include <stdint.h>
|
||||
#include <cstddef>
|
||||
|
||||
namespace rx
|
||||
namespace angle
|
||||
{
|
||||
|
||||
class MemoryBuffer : angle::NonCopyable
|
||||
class MemoryBuffer final : NonCopyable
|
||||
{
|
||||
public:
|
||||
MemoryBuffer();
|
||||
~MemoryBuffer();
|
||||
|
||||
MemoryBuffer(MemoryBuffer &&other);
|
||||
MemoryBuffer &operator=(MemoryBuffer &&other);
|
||||
|
||||
bool resize(size_t size);
|
||||
size_t size() const;
|
||||
size_t size() const { return mSize; }
|
||||
bool empty() const { return mSize == 0; }
|
||||
|
||||
const uint8_t *data() const;
|
||||
uint8_t *data();
|
||||
const uint8_t *data() const { return mData; }
|
||||
uint8_t *data()
|
||||
{
|
||||
ASSERT(mData);
|
||||
return mData;
|
||||
}
|
||||
|
||||
void fill(uint8_t datum);
|
||||
|
||||
private:
|
||||
size_t mSize;
|
||||
uint8_t *mData;
|
||||
};
|
||||
|
||||
}
|
||||
class ScratchBuffer final : NonCopyable
|
||||
{
|
||||
public:
|
||||
// If we request a scratch buffer requesting a smaller size this many times, release and
|
||||
// recreate the scratch buffer. This ensures we don't have a degenerate case where we are stuck
|
||||
// hogging memory.
|
||||
ScratchBuffer(uint32_t lifetime);
|
||||
~ScratchBuffer();
|
||||
|
||||
#endif // COMMON_MEMORYBUFFER_H_
|
||||
// Returns true with a memory buffer of the requested size, or false on failure.
|
||||
bool get(size_t requestedSize, MemoryBuffer **memoryBufferOut);
|
||||
|
||||
// Same as get, but ensures new values are initialized to a fixed constant.
|
||||
bool getInitialized(size_t requestedSize, MemoryBuffer **memoryBufferOut, uint8_t initValue);
|
||||
|
||||
// Ticks the release counter for the scratch buffer. Also done implicitly in get().
|
||||
void tick();
|
||||
|
||||
void clear();
|
||||
|
||||
private:
|
||||
bool getImpl(size_t requestedSize, MemoryBuffer **memoryBufferOut, Optional<uint8_t> initValue);
|
||||
|
||||
const uint32_t mLifetime;
|
||||
uint32_t mResetCounter;
|
||||
MemoryBuffer mScratchMemory;
|
||||
};
|
||||
|
||||
} // namespace angle
|
||||
|
||||
#endif // COMMON_MEMORYBUFFER_H_
|
||||
|
33
src/3rdparty/angle/src/common/Optional.h
vendored
33
src/3rdparty/angle/src/common/Optional.h
vendored
@ -10,23 +10,16 @@
|
||||
#ifndef COMMON_OPTIONAL_H_
|
||||
#define COMMON_OPTIONAL_H_
|
||||
|
||||
#include <utility>
|
||||
|
||||
template <class T>
|
||||
struct Optional
|
||||
{
|
||||
Optional()
|
||||
: mValid(false),
|
||||
mValue(T())
|
||||
{}
|
||||
Optional() : mValid(false), mValue(T()) {}
|
||||
|
||||
explicit Optional(const T &valueIn)
|
||||
: mValid(true),
|
||||
mValue(valueIn)
|
||||
{}
|
||||
Optional(const T &valueIn) : mValid(true), mValue(valueIn) {}
|
||||
|
||||
Optional(const Optional &other)
|
||||
: mValid(other.mValid),
|
||||
mValue(other.mValue)
|
||||
{}
|
||||
Optional(const Optional &other) : mValid(other.mValid), mValue(other.mValue) {}
|
||||
|
||||
Optional &operator=(const Optional &other)
|
||||
{
|
||||
@ -49,10 +42,7 @@ struct Optional
|
||||
return *this;
|
||||
}
|
||||
|
||||
void reset()
|
||||
{
|
||||
mValid = false;
|
||||
}
|
||||
void reset() { mValid = false; }
|
||||
|
||||
static Optional Invalid() { return Optional(); }
|
||||
|
||||
@ -64,14 +54,15 @@ struct Optional
|
||||
return ((mValid == other.mValid) && (!mValid || (mValue == other.mValue)));
|
||||
}
|
||||
|
||||
bool operator!=(const Optional &other) const
|
||||
{
|
||||
return !(*this == other);
|
||||
}
|
||||
bool operator!=(const Optional &other) const { return !(*this == other); }
|
||||
|
||||
bool operator==(const T &value) const { return mValid && (mValue == value); }
|
||||
|
||||
bool operator!=(const T &value) const { return !(*this == value); }
|
||||
|
||||
private:
|
||||
bool mValid;
|
||||
T mValue;
|
||||
};
|
||||
|
||||
#endif // COMMON_OPTIONAL_H_
|
||||
#endif // COMMON_OPTIONAL_H_
|
||||
|
62
src/3rdparty/angle/src/common/angleutils.cpp
vendored
62
src/3rdparty/angle/src/common/angleutils.cpp
vendored
@ -14,39 +14,61 @@
|
||||
|
||||
namespace angle
|
||||
{
|
||||
// dirtyPointer is a special value that will make the comparison with any valid pointer fail and
|
||||
// force the renderer to re-apply the state.
|
||||
const uintptr_t DirtyPointer = std::numeric_limits<uintptr_t>::max();
|
||||
}
|
||||
|
||||
std::string ArrayString(unsigned int i)
|
||||
{
|
||||
// We assume that UINT_MAX and GL_INVALID_INDEX are equal.
|
||||
ASSERT(i != UINT_MAX);
|
||||
|
||||
std::stringstream strstr;
|
||||
strstr << "[";
|
||||
strstr << i;
|
||||
strstr << "]";
|
||||
return strstr.str();
|
||||
}
|
||||
|
||||
std::string ArrayIndexString(const std::vector<unsigned int> &indices)
|
||||
{
|
||||
std::stringstream strstr;
|
||||
|
||||
for (auto indicesIt = indices.rbegin(); indicesIt != indices.rend(); ++indicesIt)
|
||||
{
|
||||
// We assume that UINT_MAX and GL_INVALID_INDEX are equal.
|
||||
ASSERT(*indicesIt != UINT_MAX);
|
||||
strstr << "[";
|
||||
strstr << (*indicesIt);
|
||||
strstr << "]";
|
||||
}
|
||||
|
||||
return strstr.str();
|
||||
}
|
||||
|
||||
size_t FormatStringIntoVector(const char *fmt, va_list vararg, std::vector<char>& outBuffer)
|
||||
{
|
||||
// The state of the va_list passed to vsnprintf is undefined after the call, do a copy in case
|
||||
// we need to grow the buffer.
|
||||
va_list varargCopy;
|
||||
va_copy(varargCopy, vararg);
|
||||
|
||||
// Attempt to just print to the current buffer
|
||||
int len = vsnprintf(&(outBuffer.front()), outBuffer.size(), fmt, vararg);
|
||||
int len = vsnprintf(&(outBuffer.front()), outBuffer.size(), fmt, varargCopy);
|
||||
va_end(varargCopy);
|
||||
|
||||
if (len < 0 || static_cast<size_t>(len) >= outBuffer.size())
|
||||
{
|
||||
// Buffer was not large enough, calculate the required size and resize the buffer
|
||||
len = vsnprintf(NULL, 0, fmt, vararg);
|
||||
len = vsnprintf(nullptr, 0, fmt, vararg);
|
||||
outBuffer.resize(len + 1);
|
||||
|
||||
// Print again
|
||||
len = vsnprintf(&(outBuffer.front()), outBuffer.size(), fmt, vararg);
|
||||
va_copy(varargCopy, vararg);
|
||||
len = vsnprintf(&(outBuffer.front()), outBuffer.size(), fmt, varargCopy);
|
||||
va_end(varargCopy);
|
||||
}
|
||||
ASSERT(len >= 0);
|
||||
return static_cast<size_t>(len);
|
||||
}
|
||||
|
||||
std::string FormatString(const char *fmt, va_list vararg)
|
||||
{
|
||||
static std::vector<char> buffer(512);
|
||||
|
||||
size_t len = FormatStringIntoVector(fmt, vararg, buffer);
|
||||
return std::string(&buffer[0], len);
|
||||
}
|
||||
|
||||
std::string FormatString(const char *fmt, ...)
|
||||
{
|
||||
va_list vararg;
|
||||
va_start(vararg, fmt);
|
||||
std::string result = FormatString(fmt, vararg);
|
||||
va_end(vararg);
|
||||
return result;
|
||||
}
|
||||
|
131
src/3rdparty/angle/src/common/angleutils.h
vendored
131
src/3rdparty/angle/src/common/angleutils.h
vendored
@ -23,25 +23,59 @@
|
||||
namespace angle
|
||||
{
|
||||
|
||||
#if defined(ANGLE_ENABLE_D3D9) || defined(ANGLE_ENABLE_D3D11)
|
||||
using Microsoft::WRL::ComPtr;
|
||||
#endif // defined(ANGLE_ENABLE_D3D9) || defined(ANGLE_ENABLE_D3D11)
|
||||
|
||||
class NonCopyable
|
||||
{
|
||||
public:
|
||||
protected:
|
||||
NonCopyable() = default;
|
||||
~NonCopyable() = default;
|
||||
protected:
|
||||
|
||||
private:
|
||||
NonCopyable(const NonCopyable&) = delete;
|
||||
void operator=(const NonCopyable&) = delete;
|
||||
};
|
||||
|
||||
extern const uintptr_t DirtyPointer;
|
||||
}
|
||||
|
||||
} // namespace angle
|
||||
|
||||
template <typename T, size_t N>
|
||||
inline size_t ArraySize(T(&)[N])
|
||||
constexpr inline size_t ArraySize(T (&)[N])
|
||||
{
|
||||
return N;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
class WrappedArray final : angle::NonCopyable
|
||||
{
|
||||
public:
|
||||
template <size_t N>
|
||||
constexpr WrappedArray(const T (&data)[N]) : mArray(&data[0]), mSize(N)
|
||||
{
|
||||
}
|
||||
|
||||
constexpr WrappedArray() : mArray(nullptr), mSize(0) {}
|
||||
constexpr WrappedArray(const T *data, size_t size) : mArray(data), mSize(size) {}
|
||||
|
||||
WrappedArray(WrappedArray &&other) : WrappedArray()
|
||||
{
|
||||
std::swap(mArray, other.mArray);
|
||||
std::swap(mSize, other.mSize);
|
||||
}
|
||||
|
||||
~WrappedArray() {}
|
||||
|
||||
constexpr const T *get() const { return mArray; }
|
||||
constexpr size_t size() const { return mSize; }
|
||||
|
||||
private:
|
||||
const T *mArray;
|
||||
size_t mSize;
|
||||
};
|
||||
|
||||
template <typename T, unsigned int N>
|
||||
void SafeRelease(T (&resourceBlock)[N])
|
||||
{
|
||||
@ -57,15 +91,15 @@ void SafeRelease(T& resource)
|
||||
if (resource)
|
||||
{
|
||||
resource->Release();
|
||||
resource = NULL;
|
||||
resource = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void SafeDelete(T*& resource)
|
||||
void SafeDelete(T *&resource)
|
||||
{
|
||||
delete resource;
|
||||
resource = NULL;
|
||||
resource = nullptr;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
@ -82,7 +116,7 @@ template <typename T>
|
||||
void SafeDeleteArray(T*& resource)
|
||||
{
|
||||
delete[] resource;
|
||||
resource = NULL;
|
||||
resource = nullptr;
|
||||
}
|
||||
|
||||
// Provide a less-than function for comparing structs
|
||||
@ -126,23 +160,11 @@ inline const char* MakeStaticString(const std::string &str)
|
||||
return strings.insert(str).first->c_str();
|
||||
}
|
||||
|
||||
inline std::string ArrayString(unsigned int i)
|
||||
{
|
||||
// We assume UINT_MAX and GL_INVALID_INDEX are equal
|
||||
// See DynamicHLSL.cpp
|
||||
if (i == UINT_MAX)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
std::string ArrayString(unsigned int i);
|
||||
|
||||
std::stringstream strstr;
|
||||
|
||||
strstr << "[";
|
||||
strstr << i;
|
||||
strstr << "]";
|
||||
|
||||
return strstr.str();
|
||||
}
|
||||
// Indices are stored in vectors with the outermost index in the back. In the output of the function
|
||||
// the indices are reversed.
|
||||
std::string ArrayIndexString(const std::vector<unsigned int> &indices);
|
||||
|
||||
inline std::string Str(int i)
|
||||
{
|
||||
@ -156,17 +178,76 @@ size_t FormatStringIntoVector(const char *fmt, va_list vararg, std::vector<char>
|
||||
std::string FormatString(const char *fmt, va_list vararg);
|
||||
std::string FormatString(const char *fmt, ...);
|
||||
|
||||
template <typename T>
|
||||
std::string ToString(const T &value)
|
||||
{
|
||||
std::ostringstream o;
|
||||
o << value;
|
||||
return o.str();
|
||||
}
|
||||
|
||||
// snprintf is not defined with MSVC prior to to msvc14
|
||||
#if defined(_MSC_VER) && _MSC_VER < 1900
|
||||
#define snprintf _snprintf
|
||||
#endif
|
||||
|
||||
#define GL_BGRX8_ANGLEX 0x6ABA
|
||||
#define GL_BGR565_ANGLEX 0x6ABB
|
||||
#define GL_BGRA4_ANGLEX 0x6ABC
|
||||
#define GL_BGR5_A1_ANGLEX 0x6ABD
|
||||
#define GL_INT_64_ANGLEX 0x6ABE
|
||||
#define GL_STRUCT_ANGLEX 0x6ABF
|
||||
#define GL_UINT_64_ANGLEX 0x6ABF
|
||||
#define GL_BGRA8_SRGB_ANGLEX 0x6AC0
|
||||
|
||||
// Hidden enum for the NULL D3D device type.
|
||||
#define EGL_PLATFORM_ANGLE_DEVICE_TYPE_NULL_ANGLE 0x6AC0
|
||||
|
||||
// TODO(jmadill): Clean this up at some point.
|
||||
#define EGL_PLATFORM_ANGLE_PLATFORM_METHODS_ANGLEX 0x9999
|
||||
|
||||
#define ANGLE_TRY_CHECKED_MATH(result) \
|
||||
if (!result.IsValid()) \
|
||||
{ \
|
||||
return gl::InternalError() << "Integer overflow."; \
|
||||
}
|
||||
|
||||
// The below inlining code lifted from V8.
|
||||
#if defined(__clang__) || (defined(__GNUC__) && defined(__has_attribute))
|
||||
#define ANGLE_HAS_ATTRIBUTE_ALWAYS_INLINE (__has_attribute(always_inline))
|
||||
#define ANGLE_HAS___FORCEINLINE 0
|
||||
#elif defined(_MSC_VER)
|
||||
#define ANGLE_HAS_ATTRIBUTE_ALWAYS_INLINE 0
|
||||
#define ANGLE_HAS___FORCEINLINE 1
|
||||
#else
|
||||
#define ANGLE_HAS_ATTRIBUTE_ALWAYS_INLINE 0
|
||||
#define ANGLE_HAS___FORCEINLINE 0
|
||||
#endif
|
||||
|
||||
#if defined(NDEBUG) && ANGLE_HAS_ATTRIBUTE_ALWAYS_INLINE
|
||||
#define ANGLE_INLINE inline __attribute__((always_inline))
|
||||
#elif defined(NDEBUG) && ANGLE_HAS___FORCEINLINE
|
||||
#define ANGLE_INLINE __forceinline
|
||||
#else
|
||||
#define ANGLE_INLINE inline
|
||||
#endif
|
||||
|
||||
#ifndef ANGLE_STRINGIFY
|
||||
#define ANGLE_STRINGIFY(x) #x
|
||||
#endif
|
||||
|
||||
#ifndef ANGLE_MACRO_STRINGIFY
|
||||
#define ANGLE_MACRO_STRINGIFY(x) ANGLE_STRINGIFY(x)
|
||||
#endif
|
||||
|
||||
// Detect support for C++17 [[nodiscard]]
|
||||
#if !defined(__has_cpp_attribute)
|
||||
#define __has_cpp_attribute(name) 0
|
||||
#endif // !defined(__has_cpp_attribute)
|
||||
|
||||
#if __has_cpp_attribute(nodiscard)
|
||||
#define ANGLE_NO_DISCARD [[nodiscard]]
|
||||
#else
|
||||
#define ANGLE_NO_DISCARD
|
||||
#endif // __has_cpp_attribute(nodiscard)
|
||||
|
||||
#endif // COMMON_ANGLEUTILS_H_
|
||||
|
498
src/3rdparty/angle/src/common/bitset_utils.h
vendored
Normal file
498
src/3rdparty/angle/src/common/bitset_utils.h
vendored
Normal file
@ -0,0 +1,498 @@
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// bitset_utils:
|
||||
// Bitset-related helper classes, such as a fast iterator to scan 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, typename BitsT>
|
||||
class BitSetT final
|
||||
{
|
||||
public:
|
||||
class Reference final
|
||||
{
|
||||
public:
|
||||
~Reference() {}
|
||||
Reference &operator=(bool x)
|
||||
{
|
||||
mParent->set(mBit, x);
|
||||
return *this;
|
||||
}
|
||||
explicit operator bool() const { return mParent->test(mBit); }
|
||||
|
||||
private:
|
||||
friend class BitSetT;
|
||||
|
||||
Reference(BitSetT *parent, std::size_t bit) : mParent(parent), mBit(bit) {}
|
||||
|
||||
BitSetT *mParent;
|
||||
std::size_t mBit;
|
||||
};
|
||||
|
||||
class Iterator final
|
||||
{
|
||||
public:
|
||||
Iterator(const BitSetT &bits);
|
||||
Iterator &operator++();
|
||||
|
||||
bool operator==(const Iterator &other) const;
|
||||
bool operator!=(const Iterator &other) const;
|
||||
std::size_t operator*() const;
|
||||
|
||||
private:
|
||||
std::size_t getNextBit();
|
||||
|
||||
BitSetT mBitsCopy;
|
||||
std::size_t mCurrentBit;
|
||||
};
|
||||
|
||||
BitSetT();
|
||||
BitSetT(BitsT value);
|
||||
~BitSetT();
|
||||
|
||||
BitSetT(const BitSetT &other);
|
||||
BitSetT &operator=(const BitSetT &other);
|
||||
|
||||
bool operator==(const BitSetT &other) const;
|
||||
bool operator!=(const BitSetT &other) const;
|
||||
|
||||
constexpr bool operator[](std::size_t pos) const;
|
||||
Reference operator[](std::size_t pos) { return Reference(this, pos); }
|
||||
|
||||
bool test(std::size_t pos) const;
|
||||
|
||||
bool all() const;
|
||||
bool any() const;
|
||||
bool none() const;
|
||||
std::size_t count() const;
|
||||
|
||||
constexpr std::size_t size() const { return N; }
|
||||
|
||||
BitSetT &operator&=(const BitSetT &other);
|
||||
BitSetT &operator|=(const BitSetT &other);
|
||||
BitSetT &operator^=(const BitSetT &other);
|
||||
BitSetT operator~() const;
|
||||
|
||||
BitSetT operator<<(std::size_t pos) const;
|
||||
BitSetT &operator<<=(std::size_t pos);
|
||||
BitSetT operator>>(std::size_t pos) const;
|
||||
BitSetT &operator>>=(std::size_t pos);
|
||||
|
||||
BitSetT &set();
|
||||
BitSetT &set(std::size_t pos, bool value = true);
|
||||
|
||||
BitSetT &reset();
|
||||
BitSetT &reset(std::size_t pos);
|
||||
|
||||
BitSetT &flip();
|
||||
BitSetT &flip(std::size_t pos);
|
||||
|
||||
unsigned long to_ulong() const { return static_cast<unsigned long>(mBits); }
|
||||
BitsT bits() const { return mBits; }
|
||||
|
||||
Iterator begin() const { return Iterator(*this); }
|
||||
Iterator end() const { return Iterator(BitSetT()); }
|
||||
|
||||
private:
|
||||
constexpr static BitsT Bit(std::size_t x) { return (static_cast<BitsT>(1) << x); }
|
||||
constexpr static BitsT Mask(std::size_t x) { return ((Bit(x - 1) - 1) << 1) + 1; }
|
||||
|
||||
BitsT mBits;
|
||||
};
|
||||
|
||||
template <size_t N>
|
||||
class IterableBitSet : public std::bitset<N>
|
||||
{
|
||||
public:
|
||||
IterableBitSet() {}
|
||||
IterableBitSet(const std::bitset<N> &implicitBitSet) : std::bitset<N>(implicitBitSet) {}
|
||||
|
||||
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 constexpr size_t BitsPerWord = sizeof(uint32_t) * 8;
|
||||
std::bitset<N> mBits;
|
||||
unsigned long mCurrentBit;
|
||||
unsigned long mOffset;
|
||||
};
|
||||
|
||||
Iterator begin() const { return Iterator(*this); }
|
||||
Iterator end() const { return Iterator(std::bitset<N>(0)); }
|
||||
};
|
||||
|
||||
template <size_t N>
|
||||
IterableBitSet<N>::Iterator::Iterator(const std::bitset<N> &bitset)
|
||||
: mBits(bitset), mCurrentBit(0), mOffset(0)
|
||||
{
|
||||
if (mBits.any())
|
||||
{
|
||||
mCurrentBit = getNextBit();
|
||||
}
|
||||
else
|
||||
{
|
||||
mOffset = static_cast<unsigned long>(rx::roundUp(N, BitsPerWord));
|
||||
}
|
||||
}
|
||||
|
||||
template <size_t N>
|
||||
typename IterableBitSet<N>::Iterator &IterableBitSet<N>::Iterator::operator++()
|
||||
{
|
||||
ASSERT(mBits.any());
|
||||
mBits.set(mCurrentBit - mOffset, 0);
|
||||
mCurrentBit = getNextBit();
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <size_t N>
|
||||
bool IterableBitSet<N>::Iterator::operator==(const Iterator &other) const
|
||||
{
|
||||
return mOffset == other.mOffset && mBits == other.mBits;
|
||||
}
|
||||
|
||||
template <size_t N>
|
||||
bool IterableBitSet<N>::Iterator::operator!=(const Iterator &other) const
|
||||
{
|
||||
return !(*this == other);
|
||||
}
|
||||
|
||||
template <size_t N>
|
||||
unsigned long IterableBitSet<N>::Iterator::getNextBit()
|
||||
{
|
||||
// TODO(jmadill): Use 64-bit scan when possible.
|
||||
static constexpr std::bitset<N> wordMask(std::numeric_limits<uint32_t>::max());
|
||||
|
||||
while (mOffset < N)
|
||||
{
|
||||
uint32_t wordBits = static_cast<uint32_t>((mBits & wordMask).to_ulong());
|
||||
if (wordBits != 0)
|
||||
{
|
||||
return gl::ScanForward(wordBits) + mOffset;
|
||||
}
|
||||
|
||||
mBits >>= BitsPerWord;
|
||||
mOffset += BitsPerWord;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
template <size_t N, typename BitsT>
|
||||
BitSetT<N, BitsT>::BitSetT() : mBits(0)
|
||||
{
|
||||
static_assert(N > 0, "Bitset type cannot support zero bits.");
|
||||
static_assert(N <= sizeof(BitsT) * 8, "Bitset type cannot support a size this large.");
|
||||
}
|
||||
|
||||
template <size_t N, typename BitsT>
|
||||
BitSetT<N, BitsT>::BitSetT(BitsT value) : mBits(value & Mask(N))
|
||||
{
|
||||
}
|
||||
|
||||
template <size_t N, typename BitsT>
|
||||
BitSetT<N, BitsT>::~BitSetT()
|
||||
{
|
||||
}
|
||||
|
||||
template <size_t N, typename BitsT>
|
||||
BitSetT<N, BitsT>::BitSetT(const BitSetT &other) : mBits(other.mBits)
|
||||
{
|
||||
}
|
||||
|
||||
template <size_t N, typename BitsT>
|
||||
BitSetT<N, BitsT> &BitSetT<N, BitsT>::operator=(const BitSetT &other)
|
||||
{
|
||||
mBits = other.mBits;
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <size_t N, typename BitsT>
|
||||
bool BitSetT<N, BitsT>::operator==(const BitSetT &other) const
|
||||
{
|
||||
return mBits == other.mBits;
|
||||
}
|
||||
|
||||
template <size_t N, typename BitsT>
|
||||
bool BitSetT<N, BitsT>::operator!=(const BitSetT &other) const
|
||||
{
|
||||
return mBits != other.mBits;
|
||||
}
|
||||
|
||||
template <size_t N, typename BitsT>
|
||||
constexpr bool BitSetT<N, BitsT>::operator[](std::size_t pos) const
|
||||
{
|
||||
return test(pos);
|
||||
}
|
||||
|
||||
template <size_t N, typename BitsT>
|
||||
bool BitSetT<N, BitsT>::test(std::size_t pos) const
|
||||
{
|
||||
return (mBits & Bit(pos)) != 0;
|
||||
}
|
||||
|
||||
template <size_t N, typename BitsT>
|
||||
bool BitSetT<N, BitsT>::all() const
|
||||
{
|
||||
ASSERT(mBits == (mBits & Mask(N)));
|
||||
return mBits == Mask(N);
|
||||
}
|
||||
|
||||
template <size_t N, typename BitsT>
|
||||
bool BitSetT<N, BitsT>::any() const
|
||||
{
|
||||
ASSERT(mBits == (mBits & Mask(N)));
|
||||
return (mBits != 0);
|
||||
}
|
||||
|
||||
template <size_t N, typename BitsT>
|
||||
bool BitSetT<N, BitsT>::none() const
|
||||
{
|
||||
ASSERT(mBits == (mBits & Mask(N)));
|
||||
return (mBits == 0);
|
||||
}
|
||||
|
||||
template <size_t N, typename BitsT>
|
||||
std::size_t BitSetT<N, BitsT>::count() const
|
||||
{
|
||||
return gl::BitCount(mBits);
|
||||
}
|
||||
|
||||
template <size_t N, typename BitsT>
|
||||
BitSetT<N, BitsT> &BitSetT<N, BitsT>::operator&=(const BitSetT &other)
|
||||
{
|
||||
mBits &= other.mBits;
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <size_t N, typename BitsT>
|
||||
BitSetT<N, BitsT> &BitSetT<N, BitsT>::operator|=(const BitSetT &other)
|
||||
{
|
||||
mBits |= other.mBits;
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <size_t N, typename BitsT>
|
||||
BitSetT<N, BitsT> &BitSetT<N, BitsT>::operator^=(const BitSetT &other)
|
||||
{
|
||||
mBits = (mBits ^ other.mBits) & Mask(N);
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <size_t N, typename BitsT>
|
||||
BitSetT<N, BitsT> BitSetT<N, BitsT>::operator~() const
|
||||
{
|
||||
return BitSetT<N, BitsT>(~mBits & Mask(N));
|
||||
}
|
||||
|
||||
template <size_t N, typename BitsT>
|
||||
BitSetT<N, BitsT> BitSetT<N, BitsT>::operator<<(std::size_t pos) const
|
||||
{
|
||||
return BitSetT<N, BitsT>((mBits << pos) & Mask(N));
|
||||
}
|
||||
|
||||
template <size_t N, typename BitsT>
|
||||
BitSetT<N, BitsT> &BitSetT<N, BitsT>::operator<<=(std::size_t pos)
|
||||
{
|
||||
mBits = (mBits << pos & Mask(N));
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <size_t N, typename BitsT>
|
||||
BitSetT<N, BitsT> BitSetT<N, BitsT>::operator>>(std::size_t pos) const
|
||||
{
|
||||
return BitSetT<N, BitsT>(mBits >> pos);
|
||||
}
|
||||
|
||||
template <size_t N, typename BitsT>
|
||||
BitSetT<N, BitsT> &BitSetT<N, BitsT>::operator>>=(std::size_t pos)
|
||||
{
|
||||
mBits = ((mBits >> pos) & Mask(N));
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <size_t N, typename BitsT>
|
||||
BitSetT<N, BitsT> &BitSetT<N, BitsT>::set()
|
||||
{
|
||||
mBits = Mask(N);
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <size_t N, typename BitsT>
|
||||
BitSetT<N, BitsT> &BitSetT<N, BitsT>::set(std::size_t pos, bool value)
|
||||
{
|
||||
if (value)
|
||||
{
|
||||
mBits |= Bit(pos);
|
||||
}
|
||||
else
|
||||
{
|
||||
reset(pos);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <size_t N, typename BitsT>
|
||||
BitSetT<N, BitsT> &BitSetT<N, BitsT>::reset()
|
||||
{
|
||||
mBits = 0;
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <size_t N, typename BitsT>
|
||||
BitSetT<N, BitsT> &BitSetT<N, BitsT>::reset(std::size_t pos)
|
||||
{
|
||||
mBits &= ~Bit(pos);
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <size_t N, typename BitsT>
|
||||
BitSetT<N, BitsT> &BitSetT<N, BitsT>::flip()
|
||||
{
|
||||
mBits ^= Mask(N);
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <size_t N, typename BitsT>
|
||||
BitSetT<N, BitsT> &BitSetT<N, BitsT>::flip(std::size_t pos)
|
||||
{
|
||||
mBits ^= Bit(pos);
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <size_t N, typename BitsT>
|
||||
BitSetT<N, BitsT>::Iterator::Iterator(const BitSetT &bits) : mBitsCopy(bits), mCurrentBit(0)
|
||||
{
|
||||
if (bits.any())
|
||||
{
|
||||
mCurrentBit = getNextBit();
|
||||
}
|
||||
}
|
||||
|
||||
template <size_t N, typename BitsT>
|
||||
typename BitSetT<N, BitsT>::Iterator &BitSetT<N, BitsT>::Iterator::operator++()
|
||||
{
|
||||
ASSERT(mBitsCopy.any());
|
||||
mBitsCopy.reset(mCurrentBit);
|
||||
mCurrentBit = getNextBit();
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <size_t N, typename BitsT>
|
||||
bool BitSetT<N, BitsT>::Iterator::operator==(const Iterator &other) const
|
||||
{
|
||||
return mBitsCopy == other.mBitsCopy;
|
||||
}
|
||||
|
||||
template <size_t N, typename BitsT>
|
||||
bool BitSetT<N, BitsT>::Iterator::operator!=(const Iterator &other) const
|
||||
{
|
||||
return !(*this == other);
|
||||
}
|
||||
|
||||
template <size_t N, typename BitsT>
|
||||
std::size_t BitSetT<N, BitsT>::Iterator::operator*() const
|
||||
{
|
||||
return mCurrentBit;
|
||||
}
|
||||
|
||||
template <size_t N, typename BitsT>
|
||||
std::size_t BitSetT<N, BitsT>::Iterator::getNextBit()
|
||||
{
|
||||
if (mBitsCopy.none())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return gl::ScanForward(mBitsCopy.mBits);
|
||||
}
|
||||
|
||||
template <size_t N>
|
||||
using BitSet32 = BitSetT<N, uint32_t>;
|
||||
|
||||
// ScanForward for 64-bits requires a 64-bit implementation.
|
||||
#if defined(ANGLE_IS_64_BIT_CPU)
|
||||
template <size_t N>
|
||||
using BitSet64 = BitSetT<N, uint64_t>;
|
||||
#endif // defined(ANGLE_IS_64_BIT_CPU)
|
||||
|
||||
namespace priv
|
||||
{
|
||||
|
||||
template <size_t N, typename T>
|
||||
using EnableIfBitsFit = typename std::enable_if<N <= sizeof(T) * 8>::type;
|
||||
|
||||
template <size_t N, typename Enable = void>
|
||||
struct GetBitSet
|
||||
{
|
||||
using Type = IterableBitSet<N>;
|
||||
};
|
||||
|
||||
// Prefer 64-bit bitsets on 64-bit CPUs. They seem faster than 32-bit.
|
||||
#if defined(ANGLE_IS_64_BIT_CPU)
|
||||
template <size_t N>
|
||||
struct GetBitSet<N, EnableIfBitsFit<N, uint64_t>>
|
||||
{
|
||||
using Type = BitSet64<N>;
|
||||
};
|
||||
#else
|
||||
template <size_t N>
|
||||
struct GetBitSet<N, EnableIfBitsFit<N, uint32_t>>
|
||||
{
|
||||
using Type = BitSet32<N>;
|
||||
};
|
||||
#endif // defined(ANGLE_IS_64_BIT_CPU)
|
||||
|
||||
} // namespace priv
|
||||
|
||||
template <size_t N>
|
||||
using BitSet = typename priv::GetBitSet<N>::Type;
|
||||
|
||||
} // angle
|
||||
|
||||
template <size_t N, typename BitsT>
|
||||
inline angle::BitSetT<N, BitsT> operator&(const angle::BitSetT<N, BitsT> &lhs,
|
||||
const angle::BitSetT<N, BitsT> &rhs)
|
||||
{
|
||||
return angle::BitSetT<N, BitsT>(lhs.bits() & rhs.bits());
|
||||
}
|
||||
|
||||
template <size_t N, typename BitsT>
|
||||
inline angle::BitSetT<N, BitsT> operator|(const angle::BitSetT<N, BitsT> &lhs,
|
||||
const angle::BitSetT<N, BitsT> &rhs)
|
||||
{
|
||||
return angle::BitSetT<N, BitsT>(lhs.bits() | rhs.bits());
|
||||
}
|
||||
|
||||
template <size_t N, typename BitsT>
|
||||
inline angle::BitSetT<N, BitsT> operator^(const angle::BitSetT<N, BitsT> &lhs,
|
||||
const angle::BitSetT<N, BitsT> &rhs)
|
||||
{
|
||||
return angle::BitSetT<N, BitsT>(lhs.bits() ^ rhs.bits());
|
||||
}
|
||||
|
||||
#endif // COMMON_BITSETITERATOR_H_
|
236
src/3rdparty/angle/src/common/debug.cpp
vendored
236
src/3rdparty/angle/src/common/debug.cpp
vendored
@ -7,92 +7,61 @@
|
||||
// debug.cpp: Debugging utilities.
|
||||
|
||||
#include "common/debug.h"
|
||||
#include "common/platform.h"
|
||||
#include "common/angleutils.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <vector>
|
||||
#include <fstream>
|
||||
|
||||
#include <array>
|
||||
#include <cstdio>
|
||||
#include <fstream>
|
||||
#include <ostream>
|
||||
#include <vector>
|
||||
|
||||
#include "common/angleutils.h"
|
||||
#include "common/Optional.h"
|
||||
|
||||
namespace gl
|
||||
{
|
||||
|
||||
namespace
|
||||
{
|
||||
enum DebugTraceOutputType
|
||||
{
|
||||
DebugTraceOutputTypeNone,
|
||||
DebugTraceOutputTypeSetMarker,
|
||||
DebugTraceOutputTypeBeginEvent
|
||||
};
|
||||
|
||||
DebugAnnotator *g_debugAnnotator = nullptr;
|
||||
|
||||
void output(bool traceInDebugOnly, MessageType messageType, DebugTraceOutputType outputType,
|
||||
const char *format, va_list vararg)
|
||||
constexpr std::array<const char *, LOG_NUM_SEVERITIES> g_logSeverityNames = {
|
||||
{"EVENT", "WARN", "ERR"}};
|
||||
|
||||
constexpr const char *LogSeverityName(int severity)
|
||||
{
|
||||
if (DebugAnnotationsActive())
|
||||
{
|
||||
static std::vector<char> buffer(512);
|
||||
size_t len = FormatStringIntoVector(format, vararg, buffer);
|
||||
std::wstring formattedWideMessage(buffer.begin(), buffer.begin() + len);
|
||||
|
||||
ASSERT(g_debugAnnotator != nullptr);
|
||||
switch (outputType)
|
||||
{
|
||||
case DebugTraceOutputTypeNone:
|
||||
break;
|
||||
case DebugTraceOutputTypeBeginEvent:
|
||||
g_debugAnnotator->beginEvent(formattedWideMessage.c_str());
|
||||
break;
|
||||
case DebugTraceOutputTypeSetMarker:
|
||||
g_debugAnnotator->setMarker(formattedWideMessage.c_str());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
std::string formattedMessage;
|
||||
UNUSED_VARIABLE(formattedMessage);
|
||||
|
||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||
if (messageType == MESSAGE_ERR)
|
||||
{
|
||||
if (formattedMessage.empty())
|
||||
{
|
||||
formattedMessage = FormatString(format, vararg);
|
||||
}
|
||||
OutputDebugStringA(formattedMessage.c_str());
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(ANGLE_ENABLE_DEBUG_TRACE)
|
||||
#if defined(NDEBUG)
|
||||
if (traceInDebugOnly)
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endif // NDEBUG
|
||||
if (formattedMessage.empty())
|
||||
{
|
||||
formattedMessage = FormatString(format, vararg);
|
||||
}
|
||||
|
||||
static std::ofstream file(TRACE_OUTPUT_FILE, std::ofstream::app);
|
||||
if (file)
|
||||
{
|
||||
file.write(formattedMessage.c_str(), formattedMessage.length());
|
||||
file.flush();
|
||||
}
|
||||
|
||||
#if defined(ANGLE_ENABLE_DEBUG_TRACE_TO_DEBUGGER)
|
||||
OutputDebugStringA(formattedMessage.c_str());
|
||||
#endif // ANGLE_ENABLE_DEBUG_TRACE_TO_DEBUGGER
|
||||
|
||||
#endif // ANGLE_ENABLE_DEBUG_TRACE
|
||||
return (severity >= 0 && severity < LOG_NUM_SEVERITIES) ? g_logSeverityNames[severity]
|
||||
: "UNKNOWN";
|
||||
}
|
||||
|
||||
} // namespace
|
||||
bool ShouldCreateLogMessage(LogSeverity severity)
|
||||
{
|
||||
#if defined(ANGLE_TRACE_ENABLED)
|
||||
return true;
|
||||
#elif defined(ANGLE_ENABLE_ASSERTS)
|
||||
return severity == LOG_ERR;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace priv
|
||||
{
|
||||
|
||||
bool ShouldCreatePlatformLogMessage(LogSeverity severity)
|
||||
{
|
||||
#if defined(ANGLE_TRACE_ENABLED)
|
||||
return true;
|
||||
#else
|
||||
return severity != LOG_EVENT;
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace priv
|
||||
|
||||
bool DebugAnnotationsActive()
|
||||
{
|
||||
@ -103,6 +72,11 @@ bool DebugAnnotationsActive()
|
||||
#endif
|
||||
}
|
||||
|
||||
bool DebugAnnotationsInitialized()
|
||||
{
|
||||
return g_debugAnnotator != nullptr;
|
||||
}
|
||||
|
||||
void InitializeDebugAnnotations(DebugAnnotator *debugAnnotator)
|
||||
{
|
||||
UninitializeDebugAnnotations();
|
||||
@ -115,25 +89,20 @@ void UninitializeDebugAnnotations()
|
||||
g_debugAnnotator = nullptr;
|
||||
}
|
||||
|
||||
void trace(bool traceInDebugOnly, MessageType messageType, const char *format, ...)
|
||||
{
|
||||
va_list vararg;
|
||||
va_start(vararg, format);
|
||||
output(traceInDebugOnly, messageType, DebugTraceOutputTypeSetMarker, format, vararg);
|
||||
va_end(vararg);
|
||||
}
|
||||
|
||||
ScopedPerfEventHelper::ScopedPerfEventHelper(const char* format, ...)
|
||||
ScopedPerfEventHelper::ScopedPerfEventHelper(const char *format, ...)
|
||||
{
|
||||
#if !defined(ANGLE_ENABLE_DEBUG_TRACE)
|
||||
if (!DebugAnnotationsActive())
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endif // !ANGLE_ENABLE_DEBUG_TRACE
|
||||
#endif // !ANGLE_ENABLE_DEBUG_TRACE
|
||||
|
||||
va_list vararg;
|
||||
va_start(vararg, format);
|
||||
output(true, MESSAGE_EVENT, DebugTraceOutputTypeBeginEvent, format, vararg);
|
||||
std::vector<char> buffer(512);
|
||||
size_t len = FormatStringIntoVector(format, vararg, buffer);
|
||||
ANGLE_LOG(EVENT) << std::string(&buffer[0], len);
|
||||
va_end(vararg);
|
||||
}
|
||||
|
||||
@ -145,4 +114,107 @@ ScopedPerfEventHelper::~ScopedPerfEventHelper()
|
||||
}
|
||||
}
|
||||
|
||||
LogMessage::LogMessage(const char *function, int line, LogSeverity severity)
|
||||
: mFunction(function), mLine(line), mSeverity(severity)
|
||||
{
|
||||
// EVENT() does not require additional function(line) info.
|
||||
if (mSeverity != LOG_EVENT)
|
||||
{
|
||||
mStream << mFunction << "(" << mLine << "): ";
|
||||
}
|
||||
}
|
||||
|
||||
LogMessage::~LogMessage()
|
||||
{
|
||||
if (DebugAnnotationsInitialized() && (mSeverity == LOG_ERR || mSeverity == LOG_WARN))
|
||||
{
|
||||
g_debugAnnotator->logMessage(*this);
|
||||
}
|
||||
else
|
||||
{
|
||||
Trace(getSeverity(), getMessage().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void Trace(LogSeverity severity, const char *message)
|
||||
{
|
||||
if (!ShouldCreateLogMessage(severity))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
std::string str(message);
|
||||
|
||||
if (DebugAnnotationsActive())
|
||||
{
|
||||
std::wstring formattedWideMessage(str.begin(), str.end());
|
||||
|
||||
switch (severity)
|
||||
{
|
||||
case LOG_EVENT:
|
||||
g_debugAnnotator->beginEvent(formattedWideMessage.c_str());
|
||||
break;
|
||||
default:
|
||||
g_debugAnnotator->setMarker(formattedWideMessage.c_str());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (severity == LOG_ERR)
|
||||
{
|
||||
// Note: we use fprintf because <iostream> includes static initializers.
|
||||
fprintf(stderr, "%s: %s\n", LogSeverityName(severity), str.c_str());
|
||||
}
|
||||
|
||||
#if defined(ANGLE_PLATFORM_WINDOWS) && \
|
||||
(defined(ANGLE_ENABLE_DEBUG_TRACE_TO_DEBUGGER) || !defined(NDEBUG))
|
||||
#if !defined(ANGLE_ENABLE_DEBUG_TRACE_TO_DEBUGGER)
|
||||
if (severity == LOG_ERR)
|
||||
#endif // !defined(ANGLE_ENABLE_DEBUG_TRACE_TO_DEBUGGER)
|
||||
{
|
||||
OutputDebugStringA(str.c_str());
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(ANGLE_ENABLE_DEBUG_TRACE)
|
||||
#if defined(NDEBUG)
|
||||
if (severity == LOG_EVENT || severity == LOG_WARN)
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endif // defined(NDEBUG)
|
||||
static std::ofstream file(TRACE_OUTPUT_FILE, std::ofstream::app);
|
||||
if (file)
|
||||
{
|
||||
file << LogSeverityName(severity) << ": " << str << std::endl;
|
||||
file.flush();
|
||||
}
|
||||
#endif // defined(ANGLE_ENABLE_DEBUG_TRACE)
|
||||
}
|
||||
|
||||
LogSeverity LogMessage::getSeverity() const
|
||||
{
|
||||
return mSeverity;
|
||||
}
|
||||
|
||||
std::string LogMessage::getMessage() const
|
||||
{
|
||||
return mStream.str();
|
||||
}
|
||||
|
||||
#if defined(ANGLE_PLATFORM_WINDOWS)
|
||||
std::ostream &operator<<(std::ostream &os, const FmtHR &fmt)
|
||||
{
|
||||
os << "HRESULT: ";
|
||||
return FmtHexInt(os, fmt.mHR);
|
||||
}
|
||||
|
||||
std::ostream &operator<<(std::ostream &os, const FmtErr &fmt)
|
||||
{
|
||||
os << "error: ";
|
||||
return FmtHexInt(os, fmt.mErr);
|
||||
}
|
||||
|
||||
#endif // defined(ANGLE_PLATFORM_WINDOWS)
|
||||
|
||||
} // namespace gl
|
||||
|
268
src/3rdparty/angle/src/common/debug.h
vendored
268
src/3rdparty/angle/src/common/debug.h
vendored
@ -11,6 +11,10 @@
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <ios>
|
||||
#include <iomanip>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
#include "common/angleutils.h"
|
||||
@ -22,17 +26,6 @@
|
||||
namespace gl
|
||||
{
|
||||
|
||||
enum MessageType
|
||||
{
|
||||
MESSAGE_TRACE,
|
||||
MESSAGE_FIXME,
|
||||
MESSAGE_ERR,
|
||||
MESSAGE_EVENT,
|
||||
};
|
||||
|
||||
// Outputs text to the debugging log, or the debugging window
|
||||
void trace(bool traceInDebugOnly, MessageType messageType, const char *format, ...);
|
||||
|
||||
// Pairs a D3D begin event with an end event.
|
||||
class ScopedPerfEventHelper : angle::NonCopyable
|
||||
{
|
||||
@ -41,50 +34,177 @@ class ScopedPerfEventHelper : angle::NonCopyable
|
||||
~ScopedPerfEventHelper();
|
||||
};
|
||||
|
||||
using LogSeverity = int;
|
||||
// Note: the log severities are used to index into the array of names,
|
||||
// see g_logSeverityNames.
|
||||
constexpr LogSeverity LOG_EVENT = 0;
|
||||
constexpr LogSeverity LOG_WARN = 1;
|
||||
constexpr LogSeverity LOG_ERR = 2;
|
||||
constexpr LogSeverity LOG_NUM_SEVERITIES = 3;
|
||||
|
||||
void Trace(LogSeverity severity, const char *message);
|
||||
|
||||
// This class more or less represents a particular log message. You
|
||||
// create an instance of LogMessage and then stream stuff to it.
|
||||
// When you finish streaming to it, ~LogMessage is called and the
|
||||
// full message gets streamed to the appropriate destination.
|
||||
//
|
||||
// You shouldn't actually use LogMessage's constructor to log things,
|
||||
// though. You should use the ERR() and WARN() macros.
|
||||
class LogMessage : angle::NonCopyable
|
||||
{
|
||||
public:
|
||||
// Used for ANGLE_LOG(severity).
|
||||
LogMessage(const char *function, int line, LogSeverity severity);
|
||||
~LogMessage();
|
||||
std::ostream &stream() { return mStream; }
|
||||
|
||||
LogSeverity getSeverity() const;
|
||||
std::string getMessage() const;
|
||||
|
||||
private:
|
||||
const char *mFunction;
|
||||
const int mLine;
|
||||
const LogSeverity mSeverity;
|
||||
|
||||
std::ostringstream mStream;
|
||||
};
|
||||
|
||||
// Wraps the D3D9/D3D11 debug annotation functions.
|
||||
// Also handles redirecting logging destination.
|
||||
class DebugAnnotator : angle::NonCopyable
|
||||
{
|
||||
public:
|
||||
DebugAnnotator() { };
|
||||
DebugAnnotator(){};
|
||||
virtual ~DebugAnnotator() { };
|
||||
virtual void beginEvent(const wchar_t *eventName) = 0;
|
||||
virtual void endEvent() = 0;
|
||||
virtual void setMarker(const wchar_t *markerName) = 0;
|
||||
virtual bool getStatus() = 0;
|
||||
// Log Message Handler that gets passed every log message,
|
||||
// when debug annotations are initialized,
|
||||
// replacing default handling by LogMessage.
|
||||
virtual void logMessage(const LogMessage &msg) const = 0;
|
||||
};
|
||||
|
||||
void InitializeDebugAnnotations(DebugAnnotator *debugAnnotator);
|
||||
void UninitializeDebugAnnotations();
|
||||
bool DebugAnnotationsActive();
|
||||
bool DebugAnnotationsInitialized();
|
||||
|
||||
namespace priv
|
||||
{
|
||||
// This class is used to explicitly ignore values in the conditional logging macros. This avoids
|
||||
// compiler warnings like "value computed is not used" and "statement has no effect".
|
||||
class LogMessageVoidify
|
||||
{
|
||||
public:
|
||||
LogMessageVoidify() {}
|
||||
// This has to be an operator with a precedence lower than << but higher than ?:
|
||||
void operator&(std::ostream &) {}
|
||||
};
|
||||
|
||||
// Used by ANGLE_LOG_IS_ON to lazy-evaluate stream arguments.
|
||||
bool ShouldCreatePlatformLogMessage(LogSeverity severity);
|
||||
|
||||
template <int N, typename T>
|
||||
std::ostream &FmtHex(std::ostream &os, T value)
|
||||
{
|
||||
os << "0x";
|
||||
|
||||
std::ios_base::fmtflags oldFlags = os.flags();
|
||||
std::streamsize oldWidth = os.width();
|
||||
std::ostream::char_type oldFill = os.fill();
|
||||
|
||||
os << std::hex << std::uppercase << std::setw(N) << std::setfill('0') << value;
|
||||
|
||||
os.flags(oldFlags);
|
||||
os.width(oldWidth);
|
||||
os.fill(oldFill);
|
||||
|
||||
return os;
|
||||
}
|
||||
} // namespace priv
|
||||
|
||||
#if defined(ANGLE_PLATFORM_WINDOWS)
|
||||
class FmtHR
|
||||
{
|
||||
public:
|
||||
explicit FmtHR(HRESULT hresult) : mHR(hresult) {}
|
||||
private:
|
||||
HRESULT mHR;
|
||||
friend std::ostream &operator<<(std::ostream &os, const FmtHR &fmt);
|
||||
};
|
||||
|
||||
class FmtErr
|
||||
{
|
||||
public:
|
||||
explicit FmtErr(DWORD err) : mErr(err) {}
|
||||
|
||||
private:
|
||||
DWORD mErr;
|
||||
friend std::ostream &operator<<(std::ostream &os, const FmtErr &fmt);
|
||||
};
|
||||
#endif // defined(ANGLE_PLATFORM_WINDOWS)
|
||||
|
||||
template <typename T>
|
||||
std::ostream &FmtHexShort(std::ostream &os, T value)
|
||||
{
|
||||
return priv::FmtHex<4>(os, value);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
std::ostream &FmtHexInt(std::ostream &os, T value)
|
||||
{
|
||||
return priv::FmtHex<8>(os, value);
|
||||
}
|
||||
|
||||
// A few definitions of macros that don't generate much code. These are used
|
||||
// by ANGLE_LOG(). Since these are used all over our code, it's
|
||||
// better to have compact code for these operations.
|
||||
#define COMPACT_ANGLE_LOG_EX_EVENT(ClassName, ...) \
|
||||
::gl::ClassName(__FUNCTION__, __LINE__, ::gl::LOG_EVENT, ##__VA_ARGS__)
|
||||
#define COMPACT_ANGLE_LOG_EX_WARN(ClassName, ...) \
|
||||
::gl::ClassName(__FUNCTION__, __LINE__, ::gl::LOG_WARN, ##__VA_ARGS__)
|
||||
#define COMPACT_ANGLE_LOG_EX_ERR(ClassName, ...) \
|
||||
::gl::ClassName(__FUNCTION__, __LINE__, ::gl::LOG_ERR, ##__VA_ARGS__)
|
||||
|
||||
#define COMPACT_ANGLE_LOG_EVENT COMPACT_ANGLE_LOG_EX_EVENT(LogMessage)
|
||||
#define COMPACT_ANGLE_LOG_WARN COMPACT_ANGLE_LOG_EX_WARN(LogMessage)
|
||||
#define COMPACT_ANGLE_LOG_ERR COMPACT_ANGLE_LOG_EX_ERR(LogMessage)
|
||||
|
||||
#define ANGLE_LOG_IS_ON(severity) (::gl::priv::ShouldCreatePlatformLogMessage(::gl::LOG_##severity))
|
||||
|
||||
// Helper macro which avoids evaluating the arguments to a stream if the condition doesn't hold.
|
||||
// Condition is evaluated once and only once.
|
||||
#define ANGLE_LAZY_STREAM(stream, condition) \
|
||||
!(condition) ? static_cast<void>(0) : ::gl::priv::LogMessageVoidify() & (stream)
|
||||
|
||||
// We use the preprocessor's merging operator, "##", so that, e.g.,
|
||||
// ANGLE_LOG(EVENT) becomes the token COMPACT_ANGLE_LOG_EVENT. There's some funny
|
||||
// subtle difference between ostream member streaming functions (e.g.,
|
||||
// ostream::operator<<(int) and ostream non-member streaming functions
|
||||
// (e.g., ::operator<<(ostream&, string&): it turns out that it's
|
||||
// impossible to stream something like a string directly to an unnamed
|
||||
// ostream. We employ a neat hack by calling the stream() member
|
||||
// function of LogMessage which seems to avoid the problem.
|
||||
#define ANGLE_LOG_STREAM(severity) COMPACT_ANGLE_LOG_##severity.stream()
|
||||
|
||||
#define ANGLE_LOG(severity) ANGLE_LAZY_STREAM(ANGLE_LOG_STREAM(severity), ANGLE_LOG_IS_ON(severity))
|
||||
|
||||
} // namespace gl
|
||||
|
||||
#if defined(ANGLE_ENABLE_DEBUG_TRACE) || defined(ANGLE_ENABLE_DEBUG_ANNOTATIONS)
|
||||
#define ANGLE_TRACE_ENABLED
|
||||
#endif
|
||||
|
||||
#define ANGLE_EMPTY_STATEMENT for (;;) break
|
||||
|
||||
// A macro to output a trace of a function call and its arguments to the debugging log
|
||||
#if defined(ANGLE_TRACE_ENABLED)
|
||||
#define TRACE(message, ...) gl::trace(true, gl::MESSAGE_TRACE, "trace: %s(%d): " message "\n", __FUNCTION__, __LINE__, ##__VA_ARGS__)
|
||||
#else
|
||||
#define TRACE(message, ...) (void(0))
|
||||
#if !defined(NDEBUG) || defined(ANGLE_ENABLE_RELEASE_ASSERTS)
|
||||
#define ANGLE_ENABLE_ASSERTS
|
||||
#endif
|
||||
|
||||
// A macro to output a function call and its arguments to the debugging log, to denote an item in need of fixing.
|
||||
#if defined(ANGLE_TRACE_ENABLED)
|
||||
#define FIXME(message, ...) gl::trace(false, gl::MESSAGE_FIXME, "fixme: %s(%d): " message "\n", __FUNCTION__, __LINE__, ##__VA_ARGS__)
|
||||
#else
|
||||
#define FIXME(message, ...) (void(0))
|
||||
#endif
|
||||
|
||||
// A macro to output a function call and its arguments to the debugging log, in case of error.
|
||||
#if defined(ANGLE_TRACE_ENABLED)
|
||||
#define ERR(message, ...) gl::trace(false, gl::MESSAGE_ERR, "err: %s(%d): " message "\n", __FUNCTION__, __LINE__, ##__VA_ARGS__)
|
||||
#else
|
||||
#define ERR(message, ...) (void(0))
|
||||
#endif
|
||||
#define WARN() ANGLE_LOG(WARN)
|
||||
#define ERR() ANGLE_LOG(ERR)
|
||||
|
||||
// A macro to log a performance event around a scope.
|
||||
#if defined(ANGLE_TRACE_ENABLED)
|
||||
@ -97,54 +217,70 @@ bool DebugAnnotationsActive();
|
||||
#define EVENT(message, ...) (void(0))
|
||||
#endif
|
||||
|
||||
#if defined(ANGLE_TRACE_ENABLED)
|
||||
#undef ANGLE_TRACE_ENABLED
|
||||
#if defined(COMPILER_GCC) || defined(__clang__)
|
||||
#define ANGLE_CRASH() __builtin_trap()
|
||||
#else
|
||||
#define ANGLE_CRASH() ((void)(*(volatile char *)0 = 0))
|
||||
#endif
|
||||
|
||||
// A macro asserting a condition and outputting failures to the debug log
|
||||
#if !defined(NDEBUG)
|
||||
#define ASSERT(expression) { \
|
||||
if(!(expression)) \
|
||||
ERR("\t! Assert failed in %s(%d): %s\n", __FUNCTION__, __LINE__, #expression); \
|
||||
assert(expression); \
|
||||
} ANGLE_EMPTY_STATEMENT
|
||||
#define UNUSED_ASSERTION_VARIABLE(variable)
|
||||
#define ANGLE_ASSERT_IMPL(expression) assert(expression)
|
||||
#else
|
||||
#define ASSERT(expression) (void(0))
|
||||
#define UNUSED_ASSERTION_VARIABLE(variable) ((void)variable)
|
||||
#endif
|
||||
// TODO(jmadill): Detect if debugger is attached and break.
|
||||
#define ANGLE_ASSERT_IMPL(expression) ANGLE_CRASH()
|
||||
#endif // !defined(NDEBUG)
|
||||
|
||||
// A macro asserting a condition and outputting failures to the debug log
|
||||
#if defined(ANGLE_ENABLE_ASSERTS)
|
||||
#define ASSERT(expression) \
|
||||
(expression ? static_cast<void>(0) : ((ERR() << "\t! Assert failed in " << __FUNCTION__ << "(" \
|
||||
<< __LINE__ << "): " << #expression), \
|
||||
ANGLE_ASSERT_IMPL(expression)))
|
||||
#else
|
||||
// These are just dummy values.
|
||||
#define COMPACT_ANGLE_LOG_EX_ASSERT(ClassName, ...) \
|
||||
COMPACT_ANGLE_LOG_EX_EVENT(ClassName, ##__VA_ARGS__)
|
||||
#define COMPACT_ANGLE_LOG_ASSERT COMPACT_ANGLE_LOG_EVENT
|
||||
namespace gl
|
||||
{
|
||||
constexpr LogSeverity LOG_ASSERT = LOG_EVENT;
|
||||
} // namespace gl
|
||||
|
||||
#define ASSERT(condition) \
|
||||
ANGLE_LAZY_STREAM(ANGLE_LOG_STREAM(ASSERT), false ? !(condition) : false) \
|
||||
<< "Check failed: " #condition ". "
|
||||
#endif // defined(ANGLE_ENABLE_ASSERTS)
|
||||
|
||||
#define UNUSED_VARIABLE(variable) ((void)variable)
|
||||
|
||||
// A macro to indicate unimplemented functionality
|
||||
|
||||
#if defined (ANGLE_TEST_CONFIG)
|
||||
#ifndef NOASSERT_UNIMPLEMENTED
|
||||
#define NOASSERT_UNIMPLEMENTED 1
|
||||
#endif
|
||||
|
||||
// Define NOASSERT_UNIMPLEMENTED to non zero to skip the assert fail in the unimplemented checks
|
||||
// This will allow us to test with some automated test suites (eg dEQP) without crashing
|
||||
#ifndef NOASSERT_UNIMPLEMENTED
|
||||
#define NOASSERT_UNIMPLEMENTED 0
|
||||
#endif
|
||||
|
||||
#if !defined(NDEBUG)
|
||||
#define UNIMPLEMENTED() { \
|
||||
FIXME("\t! Unimplemented: %s(%d)\n", __FUNCTION__, __LINE__); \
|
||||
assert(NOASSERT_UNIMPLEMENTED); \
|
||||
} ANGLE_EMPTY_STATEMENT
|
||||
#else
|
||||
#define UNIMPLEMENTED() FIXME("\t! Unimplemented: %s(%d)\n", __FUNCTION__, __LINE__)
|
||||
#endif
|
||||
#if defined(ANGLE_TRACE_ENABLED) || defined(ANGLE_ENABLE_ASSERTS)
|
||||
#define UNIMPLEMENTED() \
|
||||
{ \
|
||||
ERR() << "\t! Unimplemented: " << __FUNCTION__ << "(" << __FILE__ << ":" << __LINE__ \
|
||||
<< ")"; \
|
||||
ASSERT(NOASSERT_UNIMPLEMENTED); \
|
||||
} \
|
||||
ANGLE_EMPTY_STATEMENT
|
||||
|
||||
// A macro for code which is not expected to be reached under valid assumptions
|
||||
#if !defined(NDEBUG)
|
||||
#define UNREACHABLE() { \
|
||||
ERR("\t! Unreachable reached: %s(%d)\n", __FUNCTION__, __LINE__); \
|
||||
assert(false); \
|
||||
} ANGLE_EMPTY_STATEMENT
|
||||
#define UNREACHABLE() \
|
||||
((ERR() << "\t! Unreachable reached: " << __FUNCTION__ << "(" << __FILE__ << ":" << __LINE__ \
|
||||
<< ")"), \
|
||||
ASSERT(false))
|
||||
#else
|
||||
#define UNREACHABLE() ERR("\t! Unreachable reached: %s(%d)\n", __FUNCTION__, __LINE__)
|
||||
#endif
|
||||
#define UNIMPLEMENTED() \
|
||||
{ \
|
||||
ASSERT(NOASSERT_UNIMPLEMENTED); \
|
||||
} \
|
||||
ANGLE_EMPTY_STATEMENT
|
||||
|
||||
// A macro for code which is not expected to be reached under valid assumptions
|
||||
#define UNREACHABLE() ASSERT(false)
|
||||
#endif // defined(ANGLE_TRACE_ENABLED) || defined(ANGLE_ENABLE_ASSERTS)
|
||||
|
||||
#endif // COMMON_DEBUG_H_
|
||||
|
37
src/3rdparty/angle/src/common/event_tracer.cpp
vendored
37
src/3rdparty/angle/src/common/event_tracer.cpp
vendored
@ -11,10 +11,11 @@ namespace angle
|
||||
|
||||
const unsigned char *GetTraceCategoryEnabledFlag(const char *name)
|
||||
{
|
||||
angle::Platform *platform = ANGLEPlatformCurrent();
|
||||
auto *platform = ANGLEPlatformCurrent();
|
||||
ASSERT(platform);
|
||||
|
||||
const unsigned char *categoryEnabledFlag = platform->getTraceCategoryEnabledFlag(name);
|
||||
const unsigned char *categoryEnabledFlag =
|
||||
platform->getTraceCategoryEnabledFlag(platform, name);
|
||||
if (categoryEnabledFlag != nullptr)
|
||||
{
|
||||
return categoryEnabledFlag;
|
||||
@ -24,33 +25,31 @@ const unsigned char *GetTraceCategoryEnabledFlag(const char *name)
|
||||
return &disabled;
|
||||
}
|
||||
|
||||
Platform::TraceEventHandle AddTraceEvent(char phase, const unsigned char* categoryGroupEnabled, const char* name, unsigned long long id,
|
||||
int numArgs, const char** argNames, const unsigned char* argTypes,
|
||||
const unsigned long long* argValues, unsigned char flags)
|
||||
angle::TraceEventHandle AddTraceEvent(char phase,
|
||||
const unsigned char *categoryGroupEnabled,
|
||||
const char *name,
|
||||
unsigned long long id,
|
||||
int numArgs,
|
||||
const char **argNames,
|
||||
const unsigned char *argTypes,
|
||||
const unsigned long long *argValues,
|
||||
unsigned char flags)
|
||||
{
|
||||
angle::Platform *platform = ANGLEPlatformCurrent();
|
||||
auto *platform = ANGLEPlatformCurrent();
|
||||
ASSERT(platform);
|
||||
|
||||
double timestamp = platform->monotonicallyIncreasingTime();
|
||||
double timestamp = platform->monotonicallyIncreasingTime(platform);
|
||||
|
||||
if (timestamp != 0)
|
||||
{
|
||||
angle::Platform::TraceEventHandle handle =
|
||||
platform->addTraceEvent(phase,
|
||||
categoryGroupEnabled,
|
||||
name,
|
||||
id,
|
||||
timestamp,
|
||||
numArgs,
|
||||
argNames,
|
||||
argTypes,
|
||||
argValues,
|
||||
flags);
|
||||
angle::TraceEventHandle handle =
|
||||
platform->addTraceEvent(platform, phase, categoryGroupEnabled, name, id, timestamp,
|
||||
numArgs, argNames, argTypes, argValues, flags);
|
||||
ASSERT(handle != 0);
|
||||
return handle;
|
||||
}
|
||||
|
||||
return static_cast<Platform::TraceEventHandle>(0);
|
||||
return static_cast<angle::TraceEventHandle>(0);
|
||||
}
|
||||
|
||||
} // namespace angle
|
||||
|
14
src/3rdparty/angle/src/common/event_tracer.h
vendored
14
src/3rdparty/angle/src/common/event_tracer.h
vendored
@ -12,11 +12,15 @@ namespace angle
|
||||
{
|
||||
|
||||
const unsigned char *GetTraceCategoryEnabledFlag(const char* name);
|
||||
Platform::TraceEventHandle AddTraceEvent(char phase, const unsigned char* categoryGroupEnabled, const char* name,
|
||||
unsigned long long id, int numArgs, const char** argNames,
|
||||
const unsigned char* argTypes, const unsigned long long* argValues,
|
||||
unsigned char flags);
|
||||
|
||||
angle::TraceEventHandle AddTraceEvent(char phase,
|
||||
const unsigned char *categoryGroupEnabled,
|
||||
const char *name,
|
||||
unsigned long long id,
|
||||
int numArgs,
|
||||
const char **argNames,
|
||||
const unsigned char *argTypes,
|
||||
const unsigned long long *argValues,
|
||||
unsigned char flags);
|
||||
}
|
||||
|
||||
#endif // COMMON_EVENT_TRACER_H_
|
||||
|
20
src/3rdparty/angle/src/common/mathutil.cpp
vendored
20
src/3rdparty/angle/src/common/mathutil.cpp
vendored
@ -14,6 +14,9 @@
|
||||
namespace gl
|
||||
{
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
struct RGB9E5Data
|
||||
{
|
||||
unsigned int R : 9;
|
||||
@ -23,17 +26,20 @@ struct RGB9E5Data
|
||||
};
|
||||
|
||||
// B is the exponent bias (15)
|
||||
static const int g_sharedexp_bias = 15;
|
||||
constexpr int g_sharedexp_bias = 15;
|
||||
|
||||
// N is the number of mantissa bits per component (9)
|
||||
static const int g_sharedexp_mantissabits = 9;
|
||||
constexpr int g_sharedexp_mantissabits = 9;
|
||||
|
||||
// Emax is the maximum allowed biased exponent value (31)
|
||||
static const int g_sharedexp_maxexponent = 31;
|
||||
constexpr int g_sharedexp_maxexponent = 31;
|
||||
|
||||
static const float g_sharedexp_max = ((pow(2.0f, g_sharedexp_mantissabits) - 1) /
|
||||
pow(2.0f, g_sharedexp_mantissabits)) *
|
||||
pow(2.0f, g_sharedexp_maxexponent - g_sharedexp_bias);
|
||||
constexpr float g_sharedexp_max =
|
||||
((static_cast<float>(1 << g_sharedexp_mantissabits) - 1) /
|
||||
static_cast<float>(1 << g_sharedexp_mantissabits)) *
|
||||
static_cast<float>(1 << (g_sharedexp_maxexponent - g_sharedexp_bias));
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
unsigned int convertRGBFloatsTo999E5(float red, float green, float blue)
|
||||
{
|
||||
@ -64,4 +70,4 @@ void convert999E5toRGBFloats(unsigned int input, float *red, float *green, float
|
||||
*blue = inputData->B * pow(2.0f, (int)inputData->E - g_sharedexp_bias - g_sharedexp_mantissabits);
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace gl
|
||||
|
577
src/3rdparty/angle/src/common/mathutil.h
vendored
577
src/3rdparty/angle/src/common/mathutil.h
vendored
@ -9,9 +9,6 @@
|
||||
#ifndef COMMON_MATHUTIL_H_
|
||||
#define COMMON_MATHUTIL_H_
|
||||
|
||||
#include "common/debug.h"
|
||||
#include "common/platform.h"
|
||||
|
||||
#include <limits>
|
||||
#include <algorithm>
|
||||
#include <math.h>
|
||||
@ -19,25 +16,27 @@
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <anglebase/numerics/safe_math.h>
|
||||
|
||||
#include "common/debug.h"
|
||||
#include "common/platform.h"
|
||||
|
||||
namespace angle
|
||||
{
|
||||
using base::CheckedNumeric;
|
||||
using base::IsValueInRangeForNumericType;
|
||||
}
|
||||
|
||||
namespace gl
|
||||
{
|
||||
|
||||
const unsigned int Float32One = 0x3F800000;
|
||||
const unsigned short Float16One = 0x3C00;
|
||||
|
||||
struct Vector4
|
||||
{
|
||||
Vector4() {}
|
||||
Vector4(float x, float y, float z, float w) : x(x), y(y), z(z), w(w) {}
|
||||
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
float w;
|
||||
};
|
||||
|
||||
inline bool isPow2(int x)
|
||||
template<typename T>
|
||||
inline bool isPow2(T x)
|
||||
{
|
||||
static_assert(std::is_integral<T>::value, "isPow2 must be called on an integer type.");
|
||||
return (x & (x - 1)) == 0 && (x != 0);
|
||||
}
|
||||
|
||||
@ -61,37 +60,52 @@ inline unsigned int ceilPow2(unsigned int x)
|
||||
return x;
|
||||
}
|
||||
|
||||
inline int clampToInt(unsigned int x)
|
||||
{
|
||||
return static_cast<int>(std::min(x, static_cast<unsigned int>(std::numeric_limits<int>::max())));
|
||||
}
|
||||
|
||||
template <typename DestT, typename SrcT>
|
||||
inline DestT clampCast(SrcT value)
|
||||
{
|
||||
static const DestT destLo = std::numeric_limits<DestT>::min();
|
||||
static const DestT destHi = std::numeric_limits<DestT>::max();
|
||||
static const SrcT srcLo = static_cast<SrcT>(destLo);
|
||||
static const SrcT srcHi = static_cast<SrcT>(destHi);
|
||||
// For floating-point types with denormalization, min returns the minimum positive normalized
|
||||
// value. To find the value that has no values less than it, use numeric_limits::lowest.
|
||||
constexpr const long double destLo =
|
||||
static_cast<long double>(std::numeric_limits<DestT>::lowest());
|
||||
constexpr const long double destHi =
|
||||
static_cast<long double>(std::numeric_limits<DestT>::max());
|
||||
constexpr const long double srcLo =
|
||||
static_cast<long double>(std::numeric_limits<SrcT>::lowest());
|
||||
constexpr long double srcHi = static_cast<long double>(std::numeric_limits<SrcT>::max());
|
||||
|
||||
// When value is outside of or equal to the limits for DestT we use the DestT limit directly.
|
||||
// This avoids undefined behaviors due to loss of precision when converting from floats to
|
||||
// integers:
|
||||
// destHi for ints is 2147483647 but the closest float number is around 2147483648, so when
|
||||
// doing a conversion from float to int we run into an UB because the float is outside of the
|
||||
// range representable by the int.
|
||||
if (value <= srcLo)
|
||||
if (destHi < srcHi)
|
||||
{
|
||||
return destLo;
|
||||
DestT destMax = std::numeric_limits<DestT>::max();
|
||||
if (value >= static_cast<SrcT>(destMax))
|
||||
{
|
||||
return destMax;
|
||||
}
|
||||
}
|
||||
else if (value >= srcHi)
|
||||
|
||||
if (destLo > srcLo)
|
||||
{
|
||||
return destHi;
|
||||
}
|
||||
else
|
||||
{
|
||||
return static_cast<DestT>(value);
|
||||
DestT destLow = std::numeric_limits<DestT>::lowest();
|
||||
if (value <= static_cast<SrcT>(destLow))
|
||||
{
|
||||
return destLow;
|
||||
}
|
||||
}
|
||||
|
||||
return static_cast<DestT>(value);
|
||||
}
|
||||
|
||||
// Specialize clampCast for bool->int conversion to avoid MSVS 2015 performance warning when the max
|
||||
// value is casted to the source type.
|
||||
template <>
|
||||
inline unsigned int clampCast(bool value)
|
||||
{
|
||||
return static_cast<unsigned int>(value);
|
||||
}
|
||||
|
||||
template <>
|
||||
inline int clampCast(bool value)
|
||||
{
|
||||
return static_cast<int>(value);
|
||||
}
|
||||
|
||||
template<typename T, typename MIN, typename MAX>
|
||||
@ -127,7 +141,7 @@ inline unsigned int unorm(float x)
|
||||
|
||||
inline bool supportsSSE2()
|
||||
{
|
||||
#if defined(ANGLE_PLATFORM_WINDOWS) && !defined(_M_ARM)
|
||||
#if defined(ANGLE_USE_SSE)
|
||||
static bool checked = false;
|
||||
static bool supports = false;
|
||||
|
||||
@ -136,21 +150,22 @@ inline bool supportsSSE2()
|
||||
return supports;
|
||||
}
|
||||
|
||||
int info[4];
|
||||
__cpuid(info, 0);
|
||||
|
||||
if (info[0] >= 1)
|
||||
#if defined(ANGLE_PLATFORM_WINDOWS) && !defined(_M_ARM)
|
||||
{
|
||||
__cpuid(info, 1);
|
||||
int info[4];
|
||||
__cpuid(info, 0);
|
||||
|
||||
supports = (info[3] >> 26) & 1;
|
||||
if (info[0] >= 1)
|
||||
{
|
||||
__cpuid(info, 1);
|
||||
|
||||
supports = (info[3] >> 26) & 1;
|
||||
}
|
||||
}
|
||||
|
||||
#endif // defined(ANGLE_PLATFORM_WINDOWS) && !defined(_M_ARM)
|
||||
checked = true;
|
||||
|
||||
return supports;
|
||||
#else
|
||||
UNIMPLEMENTED();
|
||||
#else // defined(ANGLE_USE_SSE)
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
@ -467,6 +482,43 @@ inline T shiftData(T input)
|
||||
return (input & mask) << inputBitStart;
|
||||
}
|
||||
|
||||
inline unsigned int CountLeadingZeros(uint32_t x)
|
||||
{
|
||||
// Use binary search to find the amount of leading zeros.
|
||||
unsigned int zeros = 32u;
|
||||
uint32_t y;
|
||||
|
||||
y = x >> 16u;
|
||||
if (y != 0)
|
||||
{
|
||||
zeros = zeros - 16u;
|
||||
x = y;
|
||||
}
|
||||
y = x >> 8u;
|
||||
if (y != 0)
|
||||
{
|
||||
zeros = zeros - 8u;
|
||||
x = y;
|
||||
}
|
||||
y = x >> 4u;
|
||||
if (y != 0)
|
||||
{
|
||||
zeros = zeros - 4u;
|
||||
x = y;
|
||||
}
|
||||
y = x >> 2u;
|
||||
if (y != 0)
|
||||
{
|
||||
zeros = zeros - 2u;
|
||||
x = y;
|
||||
}
|
||||
y = x >> 1u;
|
||||
if (y != 0)
|
||||
{
|
||||
return zeros - 2u;
|
||||
}
|
||||
return zeros - x;
|
||||
}
|
||||
|
||||
inline unsigned char average(unsigned char a, unsigned char b)
|
||||
{
|
||||
@ -520,38 +572,65 @@ inline unsigned int averageFloat10(unsigned int a, unsigned int b)
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
struct Range
|
||||
class Range
|
||||
{
|
||||
public:
|
||||
Range() {}
|
||||
Range(T lo, T hi) : start(lo), end(hi) { ASSERT(lo <= hi); }
|
||||
Range(T lo, T hi) : mLow(lo), mHigh(hi) {}
|
||||
|
||||
T start;
|
||||
T end;
|
||||
|
||||
T length() const { return end - start; }
|
||||
T length() const { return (empty() ? 0 : (mHigh - mLow)); }
|
||||
|
||||
bool intersects(Range<T> other)
|
||||
{
|
||||
if (start <= other.start)
|
||||
if (mLow <= other.mLow)
|
||||
{
|
||||
return other.start < end;
|
||||
return other.mLow < mHigh;
|
||||
}
|
||||
else
|
||||
{
|
||||
return start < other.end;
|
||||
return mLow < other.mHigh;
|
||||
}
|
||||
}
|
||||
|
||||
// Assumes that end is non-inclusive.. for example, extending to 5 will make "end" 6.
|
||||
void extend(T value)
|
||||
{
|
||||
start = value > start ? value : start;
|
||||
end = value < end ? value : end;
|
||||
mLow = value < mLow ? value : mLow;
|
||||
mHigh = value >= mHigh ? (value + 1) : mHigh;
|
||||
}
|
||||
|
||||
bool empty() const
|
||||
bool empty() const { return mHigh <= mLow; }
|
||||
|
||||
bool contains(T value) const { return value >= mLow && value < mHigh; }
|
||||
|
||||
class Iterator final
|
||||
{
|
||||
return end <= start;
|
||||
}
|
||||
public:
|
||||
Iterator(T value) : mCurrent(value) {}
|
||||
|
||||
Iterator &operator++()
|
||||
{
|
||||
mCurrent++;
|
||||
return *this;
|
||||
}
|
||||
bool operator==(const Iterator &other) const { return mCurrent == other.mCurrent; }
|
||||
bool operator!=(const Iterator &other) const { return mCurrent != other.mCurrent; }
|
||||
T operator*() const { return mCurrent; }
|
||||
|
||||
private:
|
||||
T mCurrent;
|
||||
};
|
||||
|
||||
Iterator begin() const { return Iterator(mLow); }
|
||||
|
||||
Iterator end() const { return Iterator(mHigh); }
|
||||
|
||||
T low() const { return mLow; }
|
||||
T high() const { return mHigh; }
|
||||
|
||||
private:
|
||||
T mLow;
|
||||
T mHigh;
|
||||
};
|
||||
|
||||
typedef Range<int> RangeI;
|
||||
@ -577,6 +656,22 @@ struct IndexRange
|
||||
size_t vertexIndexCount;
|
||||
};
|
||||
|
||||
// Combine a floating-point value representing a mantissa (x) and an integer exponent (exp) into a
|
||||
// floating-point value. As in GLSL ldexp() built-in.
|
||||
inline float Ldexp(float x, int exp)
|
||||
{
|
||||
if (exp > 128)
|
||||
{
|
||||
return std::numeric_limits<float>::infinity();
|
||||
}
|
||||
if (exp < -126)
|
||||
{
|
||||
return 0.0f;
|
||||
}
|
||||
double result = static_cast<double>(x) * std::pow(2.0, static_cast<double>(exp));
|
||||
return static_cast<float>(result);
|
||||
}
|
||||
|
||||
// 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;
|
||||
@ -632,6 +727,86 @@ inline void unpackUnorm2x16(uint32_t u, float *f1, float *f2)
|
||||
*f2 = static_cast<float>(mostSignificantBits) / 65535.0f;
|
||||
}
|
||||
|
||||
// Helper functions intended to be used only here.
|
||||
namespace priv
|
||||
{
|
||||
|
||||
inline uint8_t ToPackedUnorm8(float f)
|
||||
{
|
||||
return static_cast<uint8_t>(roundf(clamp(f, 0.0f, 1.0f) * 255.0f));
|
||||
}
|
||||
|
||||
inline int8_t ToPackedSnorm8(float f)
|
||||
{
|
||||
return static_cast<int8_t>(roundf(clamp(f, -1.0f, 1.0f) * 127.0f));
|
||||
}
|
||||
|
||||
} // namespace priv
|
||||
|
||||
// Packs 4 normalized unsigned floating-point values to a single 32-bit unsigned integer. Works
|
||||
// similarly to packUnorm2x16. The floats are clamped to the range 0.0 to 1.0, and written to the
|
||||
// unsigned integer starting from the least significant bits.
|
||||
inline uint32_t PackUnorm4x8(float f1, float f2, float f3, float f4)
|
||||
{
|
||||
uint8_t bits[4];
|
||||
bits[0] = priv::ToPackedUnorm8(f1);
|
||||
bits[1] = priv::ToPackedUnorm8(f2);
|
||||
bits[2] = priv::ToPackedUnorm8(f3);
|
||||
bits[3] = priv::ToPackedUnorm8(f4);
|
||||
uint32_t result = 0u;
|
||||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
int shift = i * 8;
|
||||
result |= (static_cast<uint32_t>(bits[i]) << shift);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// Unpacks 4 normalized unsigned floating-point values from a single 32-bit unsigned integer into f.
|
||||
// Works similarly to unpackUnorm2x16. The floats are unpacked starting from the least significant
|
||||
// bits.
|
||||
inline void UnpackUnorm4x8(uint32_t u, float *f)
|
||||
{
|
||||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
int shift = i * 8;
|
||||
uint8_t bits = static_cast<uint8_t>((u >> shift) & 0xFF);
|
||||
f[i] = static_cast<float>(bits) / 255.0f;
|
||||
}
|
||||
}
|
||||
|
||||
// Packs 4 normalized signed floating-point values to a single 32-bit unsigned integer. The floats
|
||||
// are clamped to the range -1.0 to 1.0, and written to the unsigned integer starting from the least
|
||||
// significant bits.
|
||||
inline uint32_t PackSnorm4x8(float f1, float f2, float f3, float f4)
|
||||
{
|
||||
int8_t bits[4];
|
||||
bits[0] = priv::ToPackedSnorm8(f1);
|
||||
bits[1] = priv::ToPackedSnorm8(f2);
|
||||
bits[2] = priv::ToPackedSnorm8(f3);
|
||||
bits[3] = priv::ToPackedSnorm8(f4);
|
||||
uint32_t result = 0u;
|
||||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
int shift = i * 8;
|
||||
result |= ((static_cast<uint32_t>(bits[i]) & 0xFF) << shift);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// Unpacks 4 normalized signed floating-point values from a single 32-bit unsigned integer into f.
|
||||
// Works similarly to unpackSnorm2x16. The floats are unpacked starting from the least significant
|
||||
// bits, and clamped to the range -1.0 to 1.0.
|
||||
inline void UnpackSnorm4x8(uint32_t u, float *f)
|
||||
{
|
||||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
int shift = i * 8;
|
||||
int8_t bits = static_cast<int8_t>((u >> shift) & 0xFF);
|
||||
f[i] = clamp(static_cast<float>(bits) / 127.0f, -1.0f, 1.0f);
|
||||
}
|
||||
}
|
||||
|
||||
// Returns an unsigned integer obtained by converting the two floating-point values to the 16-bit
|
||||
// floating-point representation found in the OpenGL ES Specification, and then packing these
|
||||
// two 16-bit integers into a 32-bit unsigned integer.
|
||||
@ -658,6 +833,179 @@ inline void unpackHalf2x16(uint32_t u, float *f1, float *f2)
|
||||
*f2 = float16ToFloat32(mostSignificantBits);
|
||||
}
|
||||
|
||||
inline uint8_t sRGBToLinear(uint8_t srgbValue)
|
||||
{
|
||||
float value = srgbValue / 255.0f;
|
||||
if (value <= 0.04045f)
|
||||
{
|
||||
value = value / 12.92f;
|
||||
}
|
||||
else
|
||||
{
|
||||
value = std::pow((value + 0.055f) / 1.055f, 2.4f);
|
||||
}
|
||||
return static_cast<uint8_t>(clamp(value * 255.0f + 0.5f, 0.0f, 255.0f));
|
||||
}
|
||||
|
||||
inline uint8_t linearToSRGB(uint8_t linearValue)
|
||||
{
|
||||
float value = linearValue / 255.0f;
|
||||
if (value <= 0.0f)
|
||||
{
|
||||
value = 0.0f;
|
||||
}
|
||||
else if (value < 0.0031308f)
|
||||
{
|
||||
value = value * 12.92f;
|
||||
}
|
||||
else if (value < 1.0f)
|
||||
{
|
||||
value = std::pow(value, 0.41666f) * 1.055f - 0.055f;
|
||||
}
|
||||
else
|
||||
{
|
||||
value = 1.0f;
|
||||
}
|
||||
return static_cast<uint8_t>(clamp(value * 255.0f + 0.5f, 0.0f, 255.0f));
|
||||
}
|
||||
|
||||
// Reverse the order of the bits.
|
||||
inline uint32_t BitfieldReverse(uint32_t value)
|
||||
{
|
||||
// TODO(oetuaho@nvidia.com): Optimize this if needed. There don't seem to be compiler intrinsics
|
||||
// for this, and right now it's not used in performance-critical paths.
|
||||
uint32_t result = 0u;
|
||||
for (size_t j = 0u; j < 32u; ++j)
|
||||
{
|
||||
result |= (((value >> j) & 1u) << (31u - j));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// Count the 1 bits.
|
||||
#if defined(ANGLE_PLATFORM_WINDOWS)
|
||||
#if defined(_M_ARM)
|
||||
inline int BitCount(uint32_t bits)
|
||||
{
|
||||
bits = bits - ((bits >> 1) & 0x55555555);
|
||||
bits = (bits & 0x33333333) + ((bits >> 2) & 0x33333333);
|
||||
return (((bits + (bits >> 4)) & 0x0F0F0F0F) * 0x01010101) >> 24;
|
||||
}
|
||||
#else // _M_ARM
|
||||
inline int BitCount(uint32_t bits)
|
||||
{
|
||||
return static_cast<int>(__popcnt(bits));
|
||||
}
|
||||
#if defined(ANGLE_IS_64_BIT_CPU)
|
||||
inline int BitCount(uint64_t bits)
|
||||
{
|
||||
return static_cast<int>(__popcnt64(bits));
|
||||
}
|
||||
#endif // !_M_ARM
|
||||
#endif // defined(ANGLE_IS_64_BIT_CPU)
|
||||
#endif // defined(ANGLE_PLATFORM_WINDOWS)
|
||||
|
||||
#if defined(ANGLE_PLATFORM_POSIX)
|
||||
inline int BitCount(uint32_t bits)
|
||||
{
|
||||
return __builtin_popcount(bits);
|
||||
}
|
||||
|
||||
#if defined(ANGLE_IS_64_BIT_CPU)
|
||||
inline int BitCount(uint64_t bits)
|
||||
{
|
||||
return __builtin_popcountll(bits);
|
||||
}
|
||||
#endif // defined(ANGLE_IS_64_BIT_CPU)
|
||||
#endif // defined(ANGLE_PLATFORM_POSIX)
|
||||
|
||||
#if defined(ANGLE_PLATFORM_WINDOWS)
|
||||
// Return the index of the least significant bit set. Indexing is such that bit 0 is the least
|
||||
// significant bit. Implemented for different bit widths on different platforms.
|
||||
inline unsigned long ScanForward(uint32_t bits)
|
||||
{
|
||||
ASSERT(bits != 0u);
|
||||
unsigned long firstBitIndex = 0ul;
|
||||
unsigned char ret = _BitScanForward(&firstBitIndex, bits);
|
||||
ASSERT(ret != 0u);
|
||||
return firstBitIndex;
|
||||
}
|
||||
|
||||
#if defined(ANGLE_IS_64_BIT_CPU)
|
||||
inline unsigned long ScanForward(uint64_t bits)
|
||||
{
|
||||
ASSERT(bits != 0u);
|
||||
unsigned long firstBitIndex = 0ul;
|
||||
unsigned char ret = _BitScanForward64(&firstBitIndex, bits);
|
||||
ASSERT(ret != 0u);
|
||||
return firstBitIndex;
|
||||
}
|
||||
#endif // defined(ANGLE_IS_64_BIT_CPU)
|
||||
#endif // defined(ANGLE_PLATFORM_WINDOWS)
|
||||
|
||||
#if defined(ANGLE_PLATFORM_POSIX)
|
||||
inline unsigned long ScanForward(uint32_t bits)
|
||||
{
|
||||
ASSERT(bits != 0u);
|
||||
return static_cast<unsigned long>(__builtin_ctz(bits));
|
||||
}
|
||||
|
||||
#if defined(ANGLE_IS_64_BIT_CPU)
|
||||
inline unsigned long ScanForward(uint64_t bits)
|
||||
{
|
||||
ASSERT(bits != 0u);
|
||||
return static_cast<unsigned long>(__builtin_ctzll(bits));
|
||||
}
|
||||
#endif // defined(ANGLE_IS_64_BIT_CPU)
|
||||
#endif // defined(ANGLE_PLATFORM_POSIX)
|
||||
|
||||
// Return the index of the most significant bit set. Indexing is such that bit 0 is the least
|
||||
// significant bit.
|
||||
inline unsigned long ScanReverse(unsigned long bits)
|
||||
{
|
||||
ASSERT(bits != 0u);
|
||||
#if defined(ANGLE_PLATFORM_WINDOWS)
|
||||
unsigned long lastBitIndex = 0ul;
|
||||
unsigned char ret = _BitScanReverse(&lastBitIndex, bits);
|
||||
ASSERT(ret != 0u);
|
||||
return lastBitIndex;
|
||||
#elif defined(ANGLE_PLATFORM_POSIX)
|
||||
return static_cast<unsigned long>(sizeof(unsigned long) * CHAR_BIT - 1 - __builtin_clzl(bits));
|
||||
#else
|
||||
#error Please implement bit-scan-reverse for your platform!
|
||||
#endif
|
||||
}
|
||||
|
||||
// Returns -1 on 0, otherwise the index of the least significant 1 bit as in GLSL.
|
||||
template <typename T>
|
||||
int FindLSB(T bits)
|
||||
{
|
||||
static_assert(std::is_integral<T>::value, "must be integral type.");
|
||||
if (bits == 0u)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return static_cast<int>(ScanForward(bits));
|
||||
}
|
||||
}
|
||||
|
||||
// Returns -1 on 0, otherwise the index of the most significant 1 bit as in GLSL.
|
||||
template <typename T>
|
||||
int FindMSB(T bits)
|
||||
{
|
||||
static_assert(std::is_integral<T>::value, "must be integral type.");
|
||||
if (bits == 0u)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return static_cast<int>(ScanReverse(bits));
|
||||
}
|
||||
}
|
||||
|
||||
// Returns whether the argument is Not a Number.
|
||||
// IEEE 754 single precision NaN representation: Exponent(8 bits) - 255, Mantissa(23 bits) - non-zero.
|
||||
inline bool isNaN(float f)
|
||||
@ -676,15 +1024,92 @@ inline bool isInf(float f)
|
||||
return ((bitCast<uint32_t>(f) & 0x7f800000u) == 0x7f800000u) && !(bitCast<uint32_t>(f) & 0x7fffffu);
|
||||
}
|
||||
|
||||
namespace priv
|
||||
{
|
||||
template <unsigned int N, unsigned int R>
|
||||
struct iSquareRoot
|
||||
{
|
||||
static constexpr unsigned int solve()
|
||||
{
|
||||
return (R * R > N)
|
||||
? 0
|
||||
: ((R * R == N) ? R : static_cast<unsigned int>(iSquareRoot<N, R + 1>::value));
|
||||
}
|
||||
enum Result
|
||||
{
|
||||
value = iSquareRoot::solve()
|
||||
};
|
||||
};
|
||||
|
||||
template <unsigned int N>
|
||||
struct iSquareRoot<N, N>
|
||||
{
|
||||
enum result
|
||||
{
|
||||
value = N
|
||||
};
|
||||
};
|
||||
|
||||
} // namespace priv
|
||||
|
||||
template <unsigned int N>
|
||||
constexpr unsigned int iSquareRoot()
|
||||
{
|
||||
return priv::iSquareRoot<N, 1>::value;
|
||||
}
|
||||
|
||||
// Sum, difference and multiplication operations for signed ints that wrap on 32-bit overflow.
|
||||
//
|
||||
// Unsigned types are defined to do arithmetic modulo 2^n in C++. For signed types, overflow
|
||||
// behavior is undefined.
|
||||
|
||||
template <typename T>
|
||||
inline T WrappingSum(T lhs, T rhs)
|
||||
{
|
||||
uint32_t lhsUnsigned = static_cast<uint32_t>(lhs);
|
||||
uint32_t rhsUnsigned = static_cast<uint32_t>(rhs);
|
||||
return static_cast<T>(lhsUnsigned + rhsUnsigned);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline T WrappingDiff(T lhs, T rhs)
|
||||
{
|
||||
uint32_t lhsUnsigned = static_cast<uint32_t>(lhs);
|
||||
uint32_t rhsUnsigned = static_cast<uint32_t>(rhs);
|
||||
return static_cast<T>(lhsUnsigned - rhsUnsigned);
|
||||
}
|
||||
|
||||
inline int32_t WrappingMul(int32_t lhs, int32_t rhs)
|
||||
{
|
||||
int64_t lhsWide = static_cast<int64_t>(lhs);
|
||||
int64_t rhsWide = static_cast<int64_t>(rhs);
|
||||
// The multiplication is guaranteed not to overflow.
|
||||
int64_t resultWide = lhsWide * rhsWide;
|
||||
// Implement the desired wrapping behavior by masking out the high-order 32 bits.
|
||||
resultWide = resultWide & 0xffffffffll;
|
||||
// Casting to a narrower signed type is fine since the casted value is representable in the
|
||||
// narrower type.
|
||||
return static_cast<int32_t>(resultWide);
|
||||
}
|
||||
|
||||
} // namespace gl
|
||||
|
||||
namespace rx
|
||||
{
|
||||
|
||||
template <typename T>
|
||||
T roundUp(const T value, const T alignment)
|
||||
{
|
||||
return value + alignment - 1 - (value - 1) % alignment;
|
||||
auto temp = value + alignment - static_cast<T>(1);
|
||||
return temp - temp % alignment;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
angle::CheckedNumeric<T> CheckedRoundUp(const T value, const T alignment)
|
||||
{
|
||||
angle::CheckedNumeric<T> checkedValue(value);
|
||||
angle::CheckedNumeric<T> checkedAlignment(alignment);
|
||||
return roundUp(checkedValue, checkedAlignment);
|
||||
}
|
||||
|
||||
inline unsigned int UnsignedCeilDivide(unsigned int value, unsigned int divisor)
|
||||
@ -693,26 +1118,6 @@ inline unsigned int UnsignedCeilDivide(unsigned int value, unsigned int divisor)
|
||||
return (divided + ((value % divisor == 0) ? 0 : 1));
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline bool IsUnsignedAdditionSafe(T lhs, T rhs)
|
||||
{
|
||||
static_assert(!std::numeric_limits<T>::is_signed, "T must be unsigned.");
|
||||
return (rhs <= std::numeric_limits<T>::max() - lhs);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline bool IsUnsignedMultiplicationSafe(T lhs, T rhs)
|
||||
{
|
||||
static_assert(!std::numeric_limits<T>::is_signed, "T must be unsigned.");
|
||||
return (lhs == T(0) || rhs == T(0) || (rhs <= std::numeric_limits<T>::max() / lhs));
|
||||
}
|
||||
|
||||
template <class SmallIntT, class BigIntT>
|
||||
inline bool IsIntegerCastSafe(BigIntT bigValue)
|
||||
{
|
||||
return (static_cast<BigIntT>(static_cast<SmallIntT>(bigValue)) == bigValue);
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
|
||||
#define ANGLE_ROTL(x,y) _rotl(x,y)
|
||||
@ -730,8 +1135,8 @@ inline uint16_t RotR16(uint16_t x, int8_t r)
|
||||
return (x >> r) | (x << (16 - r));
|
||||
}
|
||||
|
||||
#define ANGLE_ROTL(x,y) RotL(x,y)
|
||||
#define ANGLE_ROTR16(x,y) RotR16(x,y)
|
||||
#define ANGLE_ROTL(x, y) ::rx::RotL(x, y)
|
||||
#define ANGLE_ROTR16(x, y) ::rx::RotR16(x, y)
|
||||
|
||||
#endif // namespace rx
|
||||
|
||||
|
37
src/3rdparty/angle/src/common/matrix_utils.h
vendored
37
src/3rdparty/angle/src/common/matrix_utils.h
vendored
@ -16,6 +16,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include "common/debug.h"
|
||||
#include "common/mathutil.h"
|
||||
|
||||
namespace angle
|
||||
{
|
||||
@ -337,6 +338,42 @@ class Matrix
|
||||
return result;
|
||||
}
|
||||
|
||||
void setToIdentity()
|
||||
{
|
||||
ASSERT(rows() == columns());
|
||||
|
||||
const auto one = T(1);
|
||||
const auto zero = T(0);
|
||||
|
||||
for (auto &e : mElements)
|
||||
e = zero;
|
||||
|
||||
for (unsigned int i = 0; i < rows(); ++i)
|
||||
{
|
||||
const auto pos = i * columns() + (i % columns());
|
||||
mElements[pos] = one;
|
||||
}
|
||||
}
|
||||
|
||||
template <unsigned int Size>
|
||||
static void setToIdentity(T(&matrix)[Size])
|
||||
{
|
||||
static_assert(gl::iSquareRoot<Size>() != 0, "Matrix is not square.");
|
||||
|
||||
const auto cols = gl::iSquareRoot<Size>();
|
||||
const auto one = T(1);
|
||||
const auto zero = T(0);
|
||||
|
||||
for (auto &e : matrix)
|
||||
e = zero;
|
||||
|
||||
for (unsigned int i = 0; i < cols; ++i)
|
||||
{
|
||||
const auto pos = i * cols + (i % cols);
|
||||
matrix[pos] = one;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
std::vector<T> mElements;
|
||||
unsigned int mRows;
|
||||
|
47
src/3rdparty/angle/src/common/platform.h
vendored
47
src/3rdparty/angle/src/common/platform.h
vendored
@ -27,7 +27,9 @@
|
||||
defined(__sun) || \
|
||||
defined(__GLIBC__) || \
|
||||
defined(__GNU__) || \
|
||||
defined(__QNX__)
|
||||
defined(__QNX__) || \
|
||||
defined(__Fuchsia__) || \
|
||||
defined(__HAIKU__)
|
||||
# define ANGLE_PLATFORM_POSIX 1
|
||||
#else
|
||||
# error Unsupported platform.
|
||||
@ -57,28 +59,22 @@
|
||||
# endif
|
||||
|
||||
# if defined(ANGLE_ENABLE_D3D11)
|
||||
# include <d3d10_1.h>
|
||||
# include <d3d11.h>
|
||||
# include <dxgi.h>
|
||||
# if defined(__MINGW32__) && !defined(__d3d11sdklayers_h__)
|
||||
# define ANGLE_MINGW32_COMPAT
|
||||
# endif
|
||||
# if defined(_MSC_VER) && _MSC_VER >= 1800
|
||||
# define ANGLE_ENABLE_D3D11_1
|
||||
# endif
|
||||
# if defined(ANGLE_ENABLE_D3D11_1)
|
||||
# include <d3d11_1.h>
|
||||
# include <dxgi1_2.h>
|
||||
# endif
|
||||
# include <d3dcompiler.h>
|
||||
#include <d3d10_1.h>
|
||||
#include <d3d11.h>
|
||||
#include <d3d11_3.h>
|
||||
#include <d3dcompiler.h>
|
||||
#include <dxgi.h>
|
||||
#include <dxgi1_2.h>
|
||||
# endif
|
||||
|
||||
#if defined(ANGLE_ENABLE_D3D9) || defined(ANGLE_ENABLE_D3D11)
|
||||
#include <wrl.h>
|
||||
#endif
|
||||
|
||||
# if defined(ANGLE_ENABLE_WINDOWS_STORE)
|
||||
# include <dxgi1_3.h>
|
||||
# if defined(_DEBUG)
|
||||
# if WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP
|
||||
# include <DXProgrammableCapture.h>
|
||||
# endif
|
||||
# include <dxgidebug.h>
|
||||
# endif
|
||||
# endif
|
||||
@ -87,8 +83,21 @@
|
||||
# undef far
|
||||
#endif
|
||||
|
||||
#if !defined(_M_ARM) && !defined(ANGLE_PLATFORM_ANDROID)
|
||||
# define ANGLE_USE_SSE
|
||||
#if defined(_MSC_VER) && !defined(_M_ARM)
|
||||
#include <intrin.h>
|
||||
#define ANGLE_USE_SSE
|
||||
#elif defined(__GNUC__) && (defined(__x86_64__) || defined(__i386__)) && !defined(__MINGW32__)
|
||||
#include <x86intrin.h>
|
||||
#define ANGLE_USE_SSE
|
||||
#endif
|
||||
|
||||
// Mips and arm devices need to include stddef for size_t.
|
||||
#if defined(__mips__) || defined(__arm__) || defined(__aarch64__)
|
||||
#include <stddef.h>
|
||||
#endif
|
||||
|
||||
// The MemoryBarrier function name collides with a macro under Windows
|
||||
// We will undef the macro so that the function name does not get replaced
|
||||
#undef MemoryBarrier
|
||||
|
||||
#endif // COMMON_PLATFORM_H_
|
||||
|
77
src/3rdparty/angle/src/common/string_utils.cpp
vendored
77
src/3rdparty/angle/src/common/string_utils.cpp
vendored
@ -9,9 +9,14 @@
|
||||
|
||||
#include "string_utils.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
|
||||
#include "common/platform.h"
|
||||
|
||||
namespace angle
|
||||
{
|
||||
|
||||
@ -133,4 +138,76 @@ bool ReadFileToString(const std::string &path, std::string *stringOut)
|
||||
return !inFile.fail();
|
||||
}
|
||||
|
||||
Optional<std::vector<wchar_t>> WidenString(size_t length, const char *cString)
|
||||
{
|
||||
std::vector<wchar_t> wcstring(length + 1);
|
||||
#if !defined(ANGLE_PLATFORM_WINDOWS)
|
||||
size_t written = mbstowcs(wcstring.data(), cString, length + 1);
|
||||
if (written == 0)
|
||||
{
|
||||
return Optional<std::vector<wchar_t>>::Invalid();
|
||||
}
|
||||
#else
|
||||
size_t convertedChars = 0;
|
||||
errno_t err = mbstowcs_s(&convertedChars, wcstring.data(), length + 1, cString, _TRUNCATE);
|
||||
if (err != 0)
|
||||
{
|
||||
return Optional<std::vector<wchar_t>>::Invalid();
|
||||
}
|
||||
#endif
|
||||
return Optional<std::vector<wchar_t>>(wcstring);
|
||||
}
|
||||
|
||||
bool BeginsWith(const std::string &str, const std::string &prefix)
|
||||
{
|
||||
return strncmp(str.c_str(), prefix.c_str(), prefix.length()) == 0;
|
||||
}
|
||||
|
||||
bool BeginsWith(const std::string &str, const char *prefix)
|
||||
{
|
||||
return strncmp(str.c_str(), prefix, strlen(prefix)) == 0;
|
||||
}
|
||||
|
||||
bool BeginsWith(const char *str, const char *prefix)
|
||||
{
|
||||
return strncmp(str, prefix, strlen(prefix)) == 0;
|
||||
}
|
||||
|
||||
bool BeginsWith(const std::string &str, const std::string &prefix, const size_t prefixLength)
|
||||
{
|
||||
return strncmp(str.c_str(), prefix.c_str(), prefixLength) == 0;
|
||||
}
|
||||
|
||||
bool EndsWith(const std::string &str, const char *suffix)
|
||||
{
|
||||
const auto len = strlen(suffix);
|
||||
if (len > str.size())
|
||||
return false;
|
||||
|
||||
const char *end = str.c_str() + str.size() - len;
|
||||
|
||||
return memcmp(end, suffix, len) == 0;
|
||||
}
|
||||
|
||||
void ToLower(std::string *str)
|
||||
{
|
||||
for (auto &ch : *str)
|
||||
{
|
||||
ch = static_cast<char>(::tolower(ch));
|
||||
}
|
||||
}
|
||||
|
||||
bool ReplaceSubstring(std::string *str,
|
||||
const std::string &substring,
|
||||
const std::string &replacement)
|
||||
{
|
||||
size_t replacePos = str->find(substring);
|
||||
if (replacePos == std::string::npos)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
str->replace(replacePos, substring.size(), replacement);
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace angle
|
||||
|
38
src/3rdparty/angle/src/common/string_utils.h
vendored
38
src/3rdparty/angle/src/common/string_utils.h
vendored
@ -13,6 +13,8 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "common/Optional.h"
|
||||
|
||||
namespace angle
|
||||
{
|
||||
|
||||
@ -44,6 +46,40 @@ bool HexStringToUInt(const std::string &input, unsigned int *uintOut);
|
||||
|
||||
bool ReadFileToString(const std::string &path, std::string *stringOut);
|
||||
|
||||
}
|
||||
Optional<std::vector<wchar_t>> WidenString(size_t length, const char *cString);
|
||||
|
||||
// Check if the string str begins with the given prefix.
|
||||
// The comparison is case sensitive.
|
||||
bool BeginsWith(const std::string &str, const std::string &prefix);
|
||||
|
||||
// Check if the string str begins with the given prefix.
|
||||
// Prefix may not be NULL and needs to be NULL terminated.
|
||||
// The comparison is case sensitive.
|
||||
bool BeginsWith(const std::string &str, const char *prefix);
|
||||
|
||||
// Check if the string str begins with the given prefix.
|
||||
// str and prefix may not be NULL and need to be NULL terminated.
|
||||
// The comparison is case sensitive.
|
||||
bool BeginsWith(const char *str, const char *prefix);
|
||||
|
||||
// Check if the string str begins with the first prefixLength characters of the given prefix.
|
||||
// The length of the prefix string should be greater than or equal to prefixLength.
|
||||
// The comparison is case sensitive.
|
||||
bool BeginsWith(const std::string &str, const std::string &prefix, const size_t prefixLength);
|
||||
|
||||
// Check if the string str ends with the given suffix.
|
||||
// Suffix may not be NUL and needs to be NULL terminated.
|
||||
// The comparison is case sensitive.
|
||||
bool EndsWith(const std::string& str, const char* suffix);
|
||||
|
||||
// Convert to lower-case.
|
||||
void ToLower(std::string *str);
|
||||
|
||||
// Replaces the substring 'substring' in 'str' with 'replacement'. Returns true if successful.
|
||||
bool ReplaceSubstring(std::string *str,
|
||||
const std::string &substring,
|
||||
const std::string &replacement);
|
||||
|
||||
} // namespace angle
|
||||
|
||||
#endif // LIBANGLE_STRING_UTILS_H_
|
||||
|
27
src/3rdparty/angle/src/common/system_utils.h
vendored
Normal file
27
src/3rdparty/angle/src/common/system_utils.h
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
|
||||
// system_utils.h: declaration of OS-specific utility functions
|
||||
|
||||
#ifndef COMMON_SYSTEM_UTILS_H_
|
||||
#define COMMON_SYSTEM_UTILS_H_
|
||||
|
||||
#include "common/angleutils.h"
|
||||
#include "common/Optional.h"
|
||||
|
||||
namespace angle
|
||||
{
|
||||
|
||||
const char *GetExecutablePath();
|
||||
const char *GetExecutableDirectory();
|
||||
const char *GetSharedLibraryExtension();
|
||||
Optional<std::string> GetCWD();
|
||||
bool SetCWD(const char *dirName);
|
||||
bool SetEnvironmentVar(const char *variableName, const char *value);
|
||||
|
||||
} // namespace angle
|
||||
|
||||
#endif // COMMON_SYSTEM_UTILS_H_
|
89
src/3rdparty/angle/src/common/system_utils_linux.cpp
vendored
Normal file
89
src/3rdparty/angle/src/common/system_utils_linux.cpp
vendored
Normal file
@ -0,0 +1,89 @@
|
||||
//
|
||||
// Copyright (c) 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.
|
||||
//
|
||||
|
||||
// system_utils_linux.cpp: Implementation of OS-specific functions for Linux
|
||||
|
||||
#include "system_utils.h"
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <array>
|
||||
|
||||
namespace angle
|
||||
{
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
std::string GetExecutablePathImpl()
|
||||
{
|
||||
// We cannot use lstat to get the size of /proc/self/exe as it always returns 0
|
||||
// so we just use a big buffer and hope the path fits in it.
|
||||
char path[4096];
|
||||
|
||||
ssize_t result = readlink("/proc/self/exe", path, sizeof(path) - 1);
|
||||
if (result < 0 || static_cast<size_t>(result) >= sizeof(path) - 1)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
path[result] = '\0';
|
||||
return path;
|
||||
}
|
||||
|
||||
std::string GetExecutableDirectoryImpl()
|
||||
{
|
||||
std::string executablePath = GetExecutablePath();
|
||||
size_t lastPathSepLoc = executablePath.find_last_of("/");
|
||||
return (lastPathSepLoc != std::string::npos) ? executablePath.substr(0, lastPathSepLoc) : "";
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
const char *GetExecutablePath()
|
||||
{
|
||||
// TODO(jmadill): Make global static string thread-safe.
|
||||
const static std::string &exePath = GetExecutablePathImpl();
|
||||
return exePath.c_str();
|
||||
}
|
||||
|
||||
const char *GetExecutableDirectory()
|
||||
{
|
||||
// TODO(jmadill): Make global static string thread-safe.
|
||||
const static std::string &exeDir = GetExecutableDirectoryImpl();
|
||||
return exeDir.c_str();
|
||||
}
|
||||
|
||||
const char *GetSharedLibraryExtension()
|
||||
{
|
||||
return "so";
|
||||
}
|
||||
|
||||
Optional<std::string> GetCWD()
|
||||
{
|
||||
std::array<char, 4096> pathBuf;
|
||||
char *result = getcwd(pathBuf.data(), pathBuf.size());
|
||||
if (result == nullptr)
|
||||
{
|
||||
return Optional<std::string>::Invalid();
|
||||
}
|
||||
return std::string(pathBuf.data());
|
||||
}
|
||||
|
||||
bool SetCWD(const char *dirName)
|
||||
{
|
||||
return (chdir(dirName) == 0);
|
||||
}
|
||||
|
||||
bool SetEnvironmentVar(const char *variableName, const char *value)
|
||||
{
|
||||
return (setenv(variableName, value, 1) == 0);
|
||||
}
|
||||
|
||||
} // namespace angle
|
94
src/3rdparty/angle/src/common/system_utils_mac.cpp
vendored
Normal file
94
src/3rdparty/angle/src/common/system_utils_mac.cpp
vendored
Normal file
@ -0,0 +1,94 @@
|
||||
//
|
||||
// Copyright (c) 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.
|
||||
//
|
||||
|
||||
// system_utils_osx.cpp: Implementation of OS-specific functions for OSX
|
||||
|
||||
#include "system_utils.h"
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
#include <cstdlib>
|
||||
#include <mach-o/dyld.h>
|
||||
#include <vector>
|
||||
|
||||
#include <array>
|
||||
|
||||
namespace angle
|
||||
{
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
std::string GetExecutablePathImpl()
|
||||
{
|
||||
std::string result;
|
||||
|
||||
uint32_t size = 0;
|
||||
_NSGetExecutablePath(nullptr, &size);
|
||||
|
||||
std::vector<char> buffer;
|
||||
buffer.resize(size + 1);
|
||||
|
||||
_NSGetExecutablePath(buffer.data(), &size);
|
||||
buffer[size] = '\0';
|
||||
|
||||
if (!strrchr(buffer.data(), '/'))
|
||||
{
|
||||
return "";
|
||||
}
|
||||
return buffer.data();
|
||||
}
|
||||
|
||||
std::string GetExecutableDirectoryImpl()
|
||||
{
|
||||
std::string executablePath = GetExecutablePath();
|
||||
size_t lastPathSepLoc = executablePath.find_last_of("/");
|
||||
return (lastPathSepLoc != std::string::npos) ? executablePath.substr(0, lastPathSepLoc) : "";
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
const char *GetExecutablePath()
|
||||
{
|
||||
// TODO(jmadill): Make global static string thread-safe.
|
||||
const static std::string &exePath = GetExecutablePathImpl();
|
||||
return exePath.c_str();
|
||||
}
|
||||
|
||||
const char *GetExecutableDirectory()
|
||||
{
|
||||
// TODO(jmadill): Make global static string thread-safe.
|
||||
const static std::string &exeDir = GetExecutableDirectoryImpl();
|
||||
return exeDir.c_str();
|
||||
}
|
||||
|
||||
const char *GetSharedLibraryExtension()
|
||||
{
|
||||
return "dylib";
|
||||
}
|
||||
|
||||
Optional<std::string> GetCWD()
|
||||
{
|
||||
std::array<char, 4096> pathBuf;
|
||||
char *result = getcwd(pathBuf.data(), pathBuf.size());
|
||||
if (result == nullptr)
|
||||
{
|
||||
return Optional<std::string>::Invalid();
|
||||
}
|
||||
return std::string(pathBuf.data());
|
||||
}
|
||||
|
||||
bool SetCWD(const char *dirName)
|
||||
{
|
||||
return (chdir(dirName) == 0);
|
||||
}
|
||||
|
||||
bool SetEnvironmentVar(const char *variableName, const char *value)
|
||||
{
|
||||
return (setenv(variableName, value, 1) == 0);
|
||||
}
|
||||
|
||||
} // namespace angle
|
79
src/3rdparty/angle/src/common/system_utils_win.cpp
vendored
Normal file
79
src/3rdparty/angle/src/common/system_utils_win.cpp
vendored
Normal file
@ -0,0 +1,79 @@
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
|
||||
// system_utils_win.cpp: Implementation of OS-specific functions for Windows
|
||||
|
||||
#include "system_utils.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <windows.h>
|
||||
#include <array>
|
||||
#include <vector>
|
||||
|
||||
namespace angle
|
||||
{
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
std::string GetExecutablePathImpl()
|
||||
{
|
||||
std::array<char, MAX_PATH> executableFileBuf;
|
||||
DWORD executablePathLen = GetModuleFileNameA(nullptr, executableFileBuf.data(),
|
||||
static_cast<DWORD>(executableFileBuf.size()));
|
||||
return (executablePathLen > 0 ? std::string(executableFileBuf.data()) : "");
|
||||
}
|
||||
|
||||
std::string GetExecutableDirectoryImpl()
|
||||
{
|
||||
std::string executablePath = GetExecutablePath();
|
||||
size_t lastPathSepLoc = executablePath.find_last_of("\\/");
|
||||
return (lastPathSepLoc != std::string::npos) ? executablePath.substr(0, lastPathSepLoc) : "";
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
const char *GetExecutablePath()
|
||||
{
|
||||
// TODO(jmadill): Make global static string thread-safe.
|
||||
const static std::string &exePath = GetExecutablePathImpl();
|
||||
return exePath.c_str();
|
||||
}
|
||||
|
||||
const char *GetExecutableDirectory()
|
||||
{
|
||||
// TODO(jmadill): Make global static string thread-safe.
|
||||
const static std::string &exeDir = GetExecutableDirectoryImpl();
|
||||
return exeDir.c_str();
|
||||
}
|
||||
|
||||
const char *GetSharedLibraryExtension()
|
||||
{
|
||||
return "dll";
|
||||
}
|
||||
|
||||
Optional<std::string> GetCWD()
|
||||
{
|
||||
std::array<char, MAX_PATH> pathBuf;
|
||||
DWORD result = GetCurrentDirectoryA(static_cast<DWORD>(pathBuf.size()), pathBuf.data());
|
||||
if (result == 0)
|
||||
{
|
||||
return Optional<std::string>::Invalid();
|
||||
}
|
||||
return std::string(pathBuf.data());
|
||||
}
|
||||
|
||||
bool SetCWD(const char *dirName)
|
||||
{
|
||||
return (SetCurrentDirectoryA(dirName) == TRUE);
|
||||
}
|
||||
|
||||
bool SetEnvironmentVar(const char *variableName, const char *value)
|
||||
{
|
||||
return (SetEnvironmentVariableA(variableName, value) == TRUE);
|
||||
}
|
||||
|
||||
} // namespace angle
|
27
src/3rdparty/angle/src/common/third_party/base/README.angle
vendored
Normal file
27
src/3rdparty/angle/src/common/third_party/base/README.angle
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
Name: Chromium base:: helper Classes
|
||||
Short Name: base::numerics, base::MRUCachem, base::SHA1
|
||||
Version:
|
||||
URL: https://chromium.googlesource.com/chromium/src/base/+/master
|
||||
SOURCE CODE: Copy the Chromium folder manually into this folder and run git cl format.
|
||||
Date: 24/05/2017
|
||||
Revision: 28b5bbb227d331c01e6ff9b2f8729732135aadc7 (Chromium)
|
||||
Security Critical: no
|
||||
License: Chromium
|
||||
License File: LICENSE in Chromium/src
|
||||
|
||||
Description:
|
||||
base::numerics is a library for doing some simple safe math and conversions.
|
||||
base::MRUCache is a few collections of most-recently-used caching structures.
|
||||
base::SHA1 is a secure hashing algorithm.
|
||||
|
||||
To update the checkout, simply overwrite the folder with Chromium's latest, apply
|
||||
the appropriate namespace, and make sure the paths are correct (anglebase/ instead of
|
||||
base/), and update the header guards and macros.
|
||||
|
||||
Modifications:
|
||||
|
||||
- the file scope is now anglebase/ from base/ to prevent include conflicts.
|
||||
- anglebase/logging.h defines (D)CHECK to be ASSERT to be compatible with ANGLE.
|
||||
- the headers use namespace angle::base instead of base:: to avoid ODR
|
||||
violations when ANGLE code is mixed with Chromium code.
|
||||
- header guards and macros are changed from BASE to ANGLEBASE to prevent conflicts.
|
13
src/3rdparty/angle/src/common/third_party/base/anglebase/base_export.h
vendored
Normal file
13
src/3rdparty/angle/src/common/third_party/base/anglebase/base_export.h
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
//
|
||||
// Copyright 2017 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.
|
||||
//
|
||||
// base_export.h: Compatiblity hacks for importing Chromium's base/SHA1.
|
||||
|
||||
#ifndef ANGLEBASE_BASE_EXPORT_H_
|
||||
#define ANGLEBASE_BASE_EXPORT_H_
|
||||
|
||||
#define ANGLEBASE_EXPORT
|
||||
|
||||
#endif // ANGLEBASE_BASE_EXPORT_H_
|
275
src/3rdparty/angle/src/common/third_party/base/anglebase/containers/mru_cache.h
vendored
Normal file
275
src/3rdparty/angle/src/common/third_party/base/anglebase/containers/mru_cache.h
vendored
Normal file
@ -0,0 +1,275 @@
|
||||
// Copyright (c) 2011 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.
|
||||
|
||||
// This file contains a template for a Most Recently Used cache that allows
|
||||
// constant-time access to items using a key, but easy identification of the
|
||||
// least-recently-used items for removal. Each key can only be associated with
|
||||
// one payload item at a time.
|
||||
//
|
||||
// The key object will be stored twice, so it should support efficient copying.
|
||||
//
|
||||
// NOTE: While all operations are O(1), this code is written for
|
||||
// legibility rather than optimality. If future profiling identifies this as
|
||||
// a bottleneck, there is room for smaller values of 1 in the O(1). :]
|
||||
|
||||
#ifndef ANGLEBASE_CONTAINERS_MRU_CACHE_H_
|
||||
#define ANGLEBASE_CONTAINERS_MRU_CACHE_H_
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <unordered_map>
|
||||
#include <utility>
|
||||
|
||||
#include "anglebase/logging.h"
|
||||
#include "anglebase/macros.h"
|
||||
|
||||
namespace angle
|
||||
{
|
||||
|
||||
namespace base
|
||||
{
|
||||
|
||||
// MRUCacheBase ----------------------------------------------------------------
|
||||
|
||||
// This template is used to standardize map type containers that can be used
|
||||
// by MRUCacheBase. This level of indirection is necessary because of the way
|
||||
// that template template params and default template params interact.
|
||||
template <class KeyType, class ValueType, class CompareType>
|
||||
struct MRUCacheStandardMap
|
||||
{
|
||||
typedef std::map<KeyType, ValueType, CompareType> Type;
|
||||
};
|
||||
|
||||
// Base class for the MRU cache specializations defined below.
|
||||
template <class KeyType,
|
||||
class PayloadType,
|
||||
class HashOrCompareType,
|
||||
template <typename, typename, typename> class MapType = MRUCacheStandardMap>
|
||||
class MRUCacheBase
|
||||
{
|
||||
public:
|
||||
// The payload of the list. This maintains a copy of the key so we can
|
||||
// efficiently delete things given an element of the list.
|
||||
typedef std::pair<KeyType, PayloadType> value_type;
|
||||
|
||||
private:
|
||||
typedef std::list<value_type> PayloadList;
|
||||
typedef
|
||||
typename MapType<KeyType, typename PayloadList::iterator, HashOrCompareType>::Type KeyIndex;
|
||||
|
||||
public:
|
||||
typedef typename PayloadList::size_type size_type;
|
||||
|
||||
typedef typename PayloadList::iterator iterator;
|
||||
typedef typename PayloadList::const_iterator const_iterator;
|
||||
typedef typename PayloadList::reverse_iterator reverse_iterator;
|
||||
typedef typename PayloadList::const_reverse_iterator const_reverse_iterator;
|
||||
|
||||
enum
|
||||
{
|
||||
NO_AUTO_EVICT = 0
|
||||
};
|
||||
|
||||
// The max_size is the size at which the cache will prune its members to when
|
||||
// a new item is inserted. If the caller wants to manager this itself (for
|
||||
// example, maybe it has special work to do when something is evicted), it
|
||||
// can pass NO_AUTO_EVICT to not restrict the cache size.
|
||||
explicit MRUCacheBase(size_type max_size) : max_size_(max_size) {}
|
||||
|
||||
virtual ~MRUCacheBase() {}
|
||||
|
||||
size_type max_size() const { return max_size_; }
|
||||
|
||||
// Inserts a payload item with the given key. If an existing item has
|
||||
// the same key, it is removed prior to insertion. An iterator indicating the
|
||||
// inserted item will be returned (this will always be the front of the list).
|
||||
//
|
||||
// The payload will be forwarded.
|
||||
template <typename Payload>
|
||||
iterator Put(const KeyType &key, Payload &&payload)
|
||||
{
|
||||
// Remove any existing payload with that key.
|
||||
typename KeyIndex::iterator index_iter = index_.find(key);
|
||||
if (index_iter != index_.end())
|
||||
{
|
||||
// Erase the reference to it. The index reference will be replaced in the
|
||||
// code below.
|
||||
Erase(index_iter->second);
|
||||
}
|
||||
else if (max_size_ != NO_AUTO_EVICT)
|
||||
{
|
||||
// New item is being inserted which might make it larger than the maximum
|
||||
// size: kick the oldest thing out if necessary.
|
||||
ShrinkToSize(max_size_ - 1);
|
||||
}
|
||||
|
||||
ordering_.emplace_front(key, std::forward<Payload>(payload));
|
||||
index_.emplace(key, ordering_.begin());
|
||||
return ordering_.begin();
|
||||
}
|
||||
|
||||
// Retrieves the contents of the given key, or end() if not found. This method
|
||||
// has the side effect of moving the requested item to the front of the
|
||||
// recency list.
|
||||
iterator Get(const KeyType &key)
|
||||
{
|
||||
typename KeyIndex::iterator index_iter = index_.find(key);
|
||||
if (index_iter == index_.end())
|
||||
return end();
|
||||
typename PayloadList::iterator iter = index_iter->second;
|
||||
|
||||
// Move the touched item to the front of the recency ordering.
|
||||
ordering_.splice(ordering_.begin(), ordering_, iter);
|
||||
return ordering_.begin();
|
||||
}
|
||||
|
||||
// Retrieves the payload associated with a given key and returns it via
|
||||
// result without affecting the ordering (unlike Get).
|
||||
iterator Peek(const KeyType &key)
|
||||
{
|
||||
typename KeyIndex::const_iterator index_iter = index_.find(key);
|
||||
if (index_iter == index_.end())
|
||||
return end();
|
||||
return index_iter->second;
|
||||
}
|
||||
|
||||
const_iterator Peek(const KeyType &key) const
|
||||
{
|
||||
typename KeyIndex::const_iterator index_iter = index_.find(key);
|
||||
if (index_iter == index_.end())
|
||||
return end();
|
||||
return index_iter->second;
|
||||
}
|
||||
|
||||
// Exchanges the contents of |this| by the contents of the |other|.
|
||||
void Swap(MRUCacheBase &other)
|
||||
{
|
||||
ordering_.swap(other.ordering_);
|
||||
index_.swap(other.index_);
|
||||
std::swap(max_size_, other.max_size_);
|
||||
}
|
||||
|
||||
// Erases the item referenced by the given iterator. An iterator to the item
|
||||
// following it will be returned. The iterator must be valid.
|
||||
iterator Erase(iterator pos)
|
||||
{
|
||||
index_.erase(pos->first);
|
||||
return ordering_.erase(pos);
|
||||
}
|
||||
|
||||
// MRUCache entries are often processed in reverse order, so we add this
|
||||
// convenience function (not typically defined by STL containers).
|
||||
reverse_iterator Erase(reverse_iterator pos)
|
||||
{
|
||||
// We have to actually give it the incremented iterator to delete, since
|
||||
// the forward iterator that base() returns is actually one past the item
|
||||
// being iterated over.
|
||||
return reverse_iterator(Erase((++pos).base()));
|
||||
}
|
||||
|
||||
// Shrinks the cache so it only holds |new_size| items. If |new_size| is
|
||||
// bigger or equal to the current number of items, this will do nothing.
|
||||
void ShrinkToSize(size_type new_size)
|
||||
{
|
||||
for (size_type i = size(); i > new_size; i--)
|
||||
Erase(rbegin());
|
||||
}
|
||||
|
||||
// Deletes everything from the cache.
|
||||
void Clear()
|
||||
{
|
||||
index_.clear();
|
||||
ordering_.clear();
|
||||
}
|
||||
|
||||
// Returns the number of elements in the cache.
|
||||
size_type size() const
|
||||
{
|
||||
// We don't use ordering_.size() for the return value because
|
||||
// (as a linked list) it can be O(n).
|
||||
DCHECK(index_.size() == ordering_.size());
|
||||
return index_.size();
|
||||
}
|
||||
|
||||
// Allows iteration over the list. Forward iteration starts with the most
|
||||
// recent item and works backwards.
|
||||
//
|
||||
// Note that since these iterators are actually iterators over a list, you
|
||||
// can keep them as you insert or delete things (as long as you don't delete
|
||||
// the one you are pointing to) and they will still be valid.
|
||||
iterator begin() { return ordering_.begin(); }
|
||||
const_iterator begin() const { return ordering_.begin(); }
|
||||
iterator end() { return ordering_.end(); }
|
||||
const_iterator end() const { return ordering_.end(); }
|
||||
|
||||
reverse_iterator rbegin() { return ordering_.rbegin(); }
|
||||
const_reverse_iterator rbegin() const { return ordering_.rbegin(); }
|
||||
reverse_iterator rend() { return ordering_.rend(); }
|
||||
const_reverse_iterator rend() const { return ordering_.rend(); }
|
||||
|
||||
bool empty() const { return ordering_.empty(); }
|
||||
|
||||
private:
|
||||
PayloadList ordering_;
|
||||
KeyIndex index_;
|
||||
|
||||
size_type max_size_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(MRUCacheBase);
|
||||
};
|
||||
|
||||
// MRUCache --------------------------------------------------------------------
|
||||
|
||||
// A container that does not do anything to free its data. Use this when storing
|
||||
// value types (as opposed to pointers) in the list.
|
||||
template <class KeyType, class PayloadType, class CompareType = std::less<KeyType>>
|
||||
class MRUCache : public MRUCacheBase<KeyType, PayloadType, CompareType>
|
||||
{
|
||||
private:
|
||||
using ParentType = MRUCacheBase<KeyType, PayloadType, CompareType>;
|
||||
|
||||
public:
|
||||
// See MRUCacheBase, noting the possibility of using NO_AUTO_EVICT.
|
||||
explicit MRUCache(typename ParentType::size_type max_size) : ParentType(max_size) {}
|
||||
virtual ~MRUCache() {}
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(MRUCache);
|
||||
};
|
||||
|
||||
// HashingMRUCache ------------------------------------------------------------
|
||||
|
||||
template <class KeyType, class ValueType, class HashType>
|
||||
struct MRUCacheHashMap
|
||||
{
|
||||
typedef std::unordered_map<KeyType, ValueType, HashType> Type;
|
||||
};
|
||||
|
||||
// This class is similar to MRUCache, except that it uses std::unordered_map as
|
||||
// the map type instead of std::map. Note that your KeyType must be hashable to
|
||||
// use this cache or you need to provide a hashing class.
|
||||
template <class KeyType, class PayloadType, class HashType = std::hash<KeyType>>
|
||||
class HashingMRUCache : public MRUCacheBase<KeyType, PayloadType, HashType, MRUCacheHashMap>
|
||||
{
|
||||
private:
|
||||
using ParentType = MRUCacheBase<KeyType, PayloadType, HashType, MRUCacheHashMap>;
|
||||
|
||||
public:
|
||||
// See MRUCacheBase, noting the possibility of using NO_AUTO_EVICT.
|
||||
explicit HashingMRUCache(typename ParentType::size_type max_size) : ParentType(max_size) {}
|
||||
virtual ~HashingMRUCache() {}
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(HashingMRUCache);
|
||||
};
|
||||
|
||||
} // namespace base
|
||||
|
||||
} // namespace angle
|
||||
|
||||
#endif // ANGLEBASE_CONTAINERS_MRU_CACHE_H_
|
26
src/3rdparty/angle/src/common/third_party/base/anglebase/logging.h
vendored
Normal file
26
src/3rdparty/angle/src/common/third_party/base/anglebase/logging.h
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
//
|
||||
// Copyright 2016 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.
|
||||
//
|
||||
// logging.h: Compatiblity hacks for importing Chromium's base/numerics.
|
||||
|
||||
#ifndef ANGLEBASE_LOGGING_H_
|
||||
#define ANGLEBASE_LOGGING_H_
|
||||
|
||||
#include "common/debug.h"
|
||||
|
||||
#ifndef DCHECK
|
||||
#define DCHECK(X) ASSERT(X)
|
||||
#endif
|
||||
|
||||
#ifndef CHECK
|
||||
#define CHECK(X) ASSERT(X)
|
||||
#endif
|
||||
|
||||
// Unfortunately ANGLE relies on ASSERT being an empty statement, which these libs don't respect.
|
||||
#ifndef NOTREACHED
|
||||
#define NOTREACHED() UNREACHABLE()
|
||||
#endif
|
||||
|
||||
#endif // ANGLEBASE_LOGGING_H_
|
17
src/3rdparty/angle/src/common/third_party/base/anglebase/macros.h
vendored
Normal file
17
src/3rdparty/angle/src/common/third_party/base/anglebase/macros.h
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
//
|
||||
// Copyright 2017 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.
|
||||
//
|
||||
// macros.h: Compatiblity hacks for importing Chromium's MRUCache.
|
||||
|
||||
#ifndef ANGLEBASE_MACROS_H_
|
||||
#define ANGLEBASE_MACROS_H_
|
||||
|
||||
// A macro to disallow the copy constructor and operator= functions.
|
||||
// This should be used in the private: declarations for a class.
|
||||
#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
|
||||
TypeName(const TypeName &) = delete; \
|
||||
void operator=(const TypeName &) = delete
|
||||
|
||||
#endif // ANGLEBASE_MACROS_H_
|
3
src/3rdparty/angle/src/common/third_party/base/anglebase/numerics/OWNERS
vendored
Normal file
3
src/3rdparty/angle/src/common/third_party/base/anglebase/numerics/OWNERS
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
jschuh@chromium.org
|
||||
tsepez@chromium.org
|
||||
|
179
src/3rdparty/angle/src/common/third_party/base/anglebase/numerics/safe_conversions.h
vendored
Normal file
179
src/3rdparty/angle/src/common/third_party/base/anglebase/numerics/safe_conversions.h
vendored
Normal file
@ -0,0 +1,179 @@
|
||||
// Copyright 2014 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.
|
||||
|
||||
#ifndef ANGLEBASE_NUMERICS_SAFE_CONVERSIONS_H_
|
||||
#define ANGLEBASE_NUMERICS_SAFE_CONVERSIONS_H_
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include <limits>
|
||||
#include <type_traits>
|
||||
|
||||
#include "anglebase/logging.h"
|
||||
#include "anglebase/numerics/safe_conversions_impl.h"
|
||||
|
||||
namespace angle
|
||||
{
|
||||
|
||||
namespace base
|
||||
{
|
||||
|
||||
// Convenience function that returns true if the supplied value is in range
|
||||
// for the destination type.
|
||||
template <typename Dst, typename Src>
|
||||
constexpr bool IsValueInRangeForNumericType(Src value)
|
||||
{
|
||||
return internal::DstRangeRelationToSrcRange<Dst>(value) == internal::RANGE_VALID;
|
||||
}
|
||||
|
||||
// Convenience function for determining if a numeric value is negative without
|
||||
// throwing compiler warnings on: unsigned(value) < 0.
|
||||
template <typename T>
|
||||
constexpr typename std::enable_if<std::numeric_limits<T>::is_signed, bool>::type IsValueNegative(
|
||||
T value)
|
||||
{
|
||||
static_assert(std::numeric_limits<T>::is_specialized, "Argument must be numeric.");
|
||||
return value < 0;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
constexpr typename std::enable_if<!std::numeric_limits<T>::is_signed, bool>::type IsValueNegative(T)
|
||||
{
|
||||
static_assert(std::numeric_limits<T>::is_specialized, "Argument must be numeric.");
|
||||
return false;
|
||||
}
|
||||
|
||||
// checked_cast<> is analogous to static_cast<> for numeric types,
|
||||
// except that it CHECKs that the specified numeric conversion will not
|
||||
// overflow or underflow. NaN source will always trigger a CHECK.
|
||||
template <typename Dst, typename Src>
|
||||
inline Dst checked_cast(Src value)
|
||||
{
|
||||
CHECK(IsValueInRangeForNumericType<Dst>(value));
|
||||
return static_cast<Dst>(value);
|
||||
}
|
||||
|
||||
// HandleNaN will cause this class to CHECK(false).
|
||||
struct SaturatedCastNaNBehaviorCheck
|
||||
{
|
||||
template <typename T>
|
||||
static T HandleNaN()
|
||||
{
|
||||
CHECK(false);
|
||||
return T();
|
||||
}
|
||||
};
|
||||
|
||||
// HandleNaN will return 0 in this case.
|
||||
struct SaturatedCastNaNBehaviorReturnZero
|
||||
{
|
||||
template <typename T>
|
||||
static constexpr T HandleNaN()
|
||||
{
|
||||
return T();
|
||||
}
|
||||
};
|
||||
|
||||
namespace internal
|
||||
{
|
||||
// This wrapper is used for C++11 constexpr support by avoiding the declaration
|
||||
// of local variables in the saturated_cast template function.
|
||||
template <typename Dst, class NaNHandler, typename Src>
|
||||
constexpr Dst saturated_cast_impl(const Src value, const RangeConstraint constraint)
|
||||
{
|
||||
return constraint == RANGE_VALID
|
||||
? static_cast<Dst>(value)
|
||||
: (constraint == RANGE_UNDERFLOW
|
||||
? std::numeric_limits<Dst>::min()
|
||||
: (constraint == RANGE_OVERFLOW
|
||||
? std::numeric_limits<Dst>::max()
|
||||
: (constraint == RANGE_INVALID
|
||||
? NaNHandler::template HandleNaN<Dst>()
|
||||
: (NOTREACHED(), static_cast<Dst>(value)))));
|
||||
}
|
||||
} // namespace internal
|
||||
|
||||
// saturated_cast<> is analogous to static_cast<> for numeric types, except
|
||||
// that the specified numeric conversion will saturate rather than overflow or
|
||||
// underflow. NaN assignment to an integral will defer the behavior to a
|
||||
// specified class. By default, it will return 0.
|
||||
template <typename Dst, class NaNHandler = SaturatedCastNaNBehaviorReturnZero, typename Src>
|
||||
constexpr Dst saturated_cast(Src value)
|
||||
{
|
||||
return std::numeric_limits<Dst>::is_iec559
|
||||
? static_cast<Dst>(value) // Floating point optimization.
|
||||
: internal::saturated_cast_impl<Dst, NaNHandler>(
|
||||
value, internal::DstRangeRelationToSrcRange<Dst>(value));
|
||||
}
|
||||
|
||||
// strict_cast<> is analogous to static_cast<> for numeric types, except that
|
||||
// it will cause a compile failure if the destination type is not large enough
|
||||
// to contain any value in the source type. It performs no runtime checking.
|
||||
template <typename Dst, typename Src>
|
||||
constexpr Dst strict_cast(Src value)
|
||||
{
|
||||
static_assert(std::numeric_limits<Src>::is_specialized, "Argument must be numeric.");
|
||||
static_assert(std::numeric_limits<Dst>::is_specialized, "Result must be numeric.");
|
||||
static_assert((internal::StaticDstRangeRelationToSrcRange<Dst, Src>::value ==
|
||||
internal::NUMERIC_RANGE_CONTAINED),
|
||||
"The numeric conversion is out of range for this type. You "
|
||||
"should probably use one of the following conversion "
|
||||
"mechanisms on the value you want to pass:\n"
|
||||
"- base::checked_cast\n"
|
||||
"- base::saturated_cast\n"
|
||||
"- base::CheckedNumeric");
|
||||
|
||||
return static_cast<Dst>(value);
|
||||
}
|
||||
|
||||
// StrictNumeric implements compile time range checking between numeric types by
|
||||
// wrapping assignment operations in a strict_cast. This class is intended to be
|
||||
// used for function arguments and return types, to ensure the destination type
|
||||
// can always contain the source type. This is essentially the same as enforcing
|
||||
// -Wconversion in gcc and C4302 warnings on MSVC, but it can be applied
|
||||
// incrementally at API boundaries, making it easier to convert code so that it
|
||||
// compiles cleanly with truncation warnings enabled.
|
||||
// This template should introduce no runtime overhead, but it also provides no
|
||||
// runtime checking of any of the associated mathematical operations. Use
|
||||
// CheckedNumeric for runtime range checks of the actual value being assigned.
|
||||
template <typename T>
|
||||
class StrictNumeric
|
||||
{
|
||||
public:
|
||||
typedef T type;
|
||||
|
||||
constexpr StrictNumeric() : value_(0) {}
|
||||
|
||||
// Copy constructor.
|
||||
template <typename Src>
|
||||
constexpr StrictNumeric(const StrictNumeric<Src> &rhs) : value_(strict_cast<T>(rhs.value_))
|
||||
{
|
||||
}
|
||||
|
||||
// This is not an explicit constructor because we implicitly upgrade regular
|
||||
// numerics to StrictNumerics to make them easier to use.
|
||||
template <typename Src>
|
||||
constexpr StrictNumeric(Src value) : value_(strict_cast<T>(value))
|
||||
{
|
||||
}
|
||||
|
||||
// The numeric cast operator basically handles all the magic.
|
||||
template <typename Dst>
|
||||
constexpr operator Dst() const
|
||||
{
|
||||
return strict_cast<Dst>(value_);
|
||||
}
|
||||
|
||||
private:
|
||||
const T value_;
|
||||
};
|
||||
|
||||
// Explicitly make a shorter size_t typedef for convenience.
|
||||
typedef StrictNumeric<size_t> SizeT;
|
||||
|
||||
} // namespace base
|
||||
|
||||
} // namespace angle
|
||||
|
||||
#endif // ANGLEBASE_NUMERICS_SAFE_CONVERSIONS_H_
|
274
src/3rdparty/angle/src/common/third_party/base/anglebase/numerics/safe_conversions_impl.h
vendored
Normal file
274
src/3rdparty/angle/src/common/third_party/base/anglebase/numerics/safe_conversions_impl.h
vendored
Normal file
@ -0,0 +1,274 @@
|
||||
// Copyright 2014 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.
|
||||
|
||||
#ifndef ANGLEBASE_NUMERICS_SAFE_CONVERSIONS_IMPL_H_
|
||||
#define ANGLEBASE_NUMERICS_SAFE_CONVERSIONS_IMPL_H_
|
||||
|
||||
#include <limits.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <climits>
|
||||
#include <limits>
|
||||
|
||||
namespace angle
|
||||
{
|
||||
|
||||
namespace base
|
||||
{
|
||||
namespace internal
|
||||
{
|
||||
|
||||
// The std library doesn't provide a binary max_exponent for integers, however
|
||||
// we can compute one by adding one to the number of non-sign bits. This allows
|
||||
// for accurate range comparisons between floating point and integer types.
|
||||
template <typename NumericType>
|
||||
struct MaxExponent
|
||||
{
|
||||
static_assert(std::is_arithmetic<NumericType>::value, "Argument must be numeric.");
|
||||
static const int value =
|
||||
std::numeric_limits<NumericType>::is_iec559
|
||||
? std::numeric_limits<NumericType>::max_exponent
|
||||
: (sizeof(NumericType) * CHAR_BIT + 1 - std::numeric_limits<NumericType>::is_signed);
|
||||
};
|
||||
|
||||
enum IntegerRepresentation
|
||||
{
|
||||
INTEGER_REPRESENTATION_UNSIGNED,
|
||||
INTEGER_REPRESENTATION_SIGNED
|
||||
};
|
||||
|
||||
// A range for a given nunmeric Src type is contained for a given numeric Dst
|
||||
// type if both numeric_limits<Src>::max() <= numeric_limits<Dst>::max() and
|
||||
// numeric_limits<Src>::min() >= numeric_limits<Dst>::min() are true.
|
||||
// We implement this as template specializations rather than simple static
|
||||
// comparisons to ensure type correctness in our comparisons.
|
||||
enum NumericRangeRepresentation
|
||||
{
|
||||
NUMERIC_RANGE_NOT_CONTAINED,
|
||||
NUMERIC_RANGE_CONTAINED
|
||||
};
|
||||
|
||||
// Helper templates to statically determine if our destination type can contain
|
||||
// maximum and minimum values represented by the source type.
|
||||
|
||||
template <typename Dst,
|
||||
typename Src,
|
||||
IntegerRepresentation DstSign = std::numeric_limits<Dst>::is_signed
|
||||
? INTEGER_REPRESENTATION_SIGNED
|
||||
: INTEGER_REPRESENTATION_UNSIGNED,
|
||||
IntegerRepresentation SrcSign = std::numeric_limits<Src>::is_signed
|
||||
? INTEGER_REPRESENTATION_SIGNED
|
||||
: INTEGER_REPRESENTATION_UNSIGNED>
|
||||
struct StaticDstRangeRelationToSrcRange;
|
||||
|
||||
// Same sign: Dst is guaranteed to contain Src only if its range is equal or
|
||||
// larger.
|
||||
template <typename Dst, typename Src, IntegerRepresentation Sign>
|
||||
struct StaticDstRangeRelationToSrcRange<Dst, Src, Sign, Sign>
|
||||
{
|
||||
static const NumericRangeRepresentation value =
|
||||
MaxExponent<Dst>::value >= MaxExponent<Src>::value ? NUMERIC_RANGE_CONTAINED
|
||||
: NUMERIC_RANGE_NOT_CONTAINED;
|
||||
};
|
||||
|
||||
// Unsigned to signed: Dst is guaranteed to contain source only if its range is
|
||||
// larger.
|
||||
template <typename Dst, typename Src>
|
||||
struct StaticDstRangeRelationToSrcRange<Dst,
|
||||
Src,
|
||||
INTEGER_REPRESENTATION_SIGNED,
|
||||
INTEGER_REPRESENTATION_UNSIGNED>
|
||||
{
|
||||
static const NumericRangeRepresentation value =
|
||||
MaxExponent<Dst>::value > MaxExponent<Src>::value ? NUMERIC_RANGE_CONTAINED
|
||||
: NUMERIC_RANGE_NOT_CONTAINED;
|
||||
};
|
||||
|
||||
// Signed to unsigned: Dst cannot be statically determined to contain Src.
|
||||
template <typename Dst, typename Src>
|
||||
struct StaticDstRangeRelationToSrcRange<Dst,
|
||||
Src,
|
||||
INTEGER_REPRESENTATION_UNSIGNED,
|
||||
INTEGER_REPRESENTATION_SIGNED>
|
||||
{
|
||||
static const NumericRangeRepresentation value = NUMERIC_RANGE_NOT_CONTAINED;
|
||||
};
|
||||
|
||||
enum RangeConstraint : unsigned char
|
||||
{
|
||||
RANGE_VALID = 0x0, // Value can be represented by the destination type.
|
||||
RANGE_UNDERFLOW = 0x1, // Value would overflow.
|
||||
RANGE_OVERFLOW = 0x2, // Value would underflow.
|
||||
RANGE_INVALID = RANGE_UNDERFLOW | RANGE_OVERFLOW // Invalid (i.e. NaN).
|
||||
};
|
||||
|
||||
// Helper function for coercing an int back to a RangeContraint.
|
||||
constexpr RangeConstraint GetRangeConstraint(int integer_range_constraint)
|
||||
{
|
||||
// TODO(jschuh): Once we get full C++14 support we want this
|
||||
// assert(integer_range_constraint >= RANGE_VALID &&
|
||||
// integer_range_constraint <= RANGE_INVALID)
|
||||
return static_cast<RangeConstraint>(integer_range_constraint);
|
||||
}
|
||||
|
||||
// This function creates a RangeConstraint from an upper and lower bound
|
||||
// check by taking advantage of the fact that only NaN can be out of range in
|
||||
// both directions at once.
|
||||
constexpr inline RangeConstraint GetRangeConstraint(bool is_in_upper_bound, bool is_in_lower_bound)
|
||||
{
|
||||
return GetRangeConstraint((is_in_upper_bound ? 0 : RANGE_OVERFLOW) |
|
||||
(is_in_lower_bound ? 0 : RANGE_UNDERFLOW));
|
||||
}
|
||||
|
||||
// The following helper template addresses a corner case in range checks for
|
||||
// conversion from a floating-point type to an integral type of smaller range
|
||||
// but larger precision (e.g. float -> unsigned). The problem is as follows:
|
||||
// 1. Integral maximum is always one less than a power of two, so it must be
|
||||
// truncated to fit the mantissa of the floating point. The direction of
|
||||
// rounding is implementation defined, but by default it's always IEEE
|
||||
// floats, which round to nearest and thus result in a value of larger
|
||||
// magnitude than the integral value.
|
||||
// Example: float f = UINT_MAX; // f is 4294967296f but UINT_MAX
|
||||
// // is 4294967295u.
|
||||
// 2. If the floating point value is equal to the promoted integral maximum
|
||||
// value, a range check will erroneously pass.
|
||||
// Example: (4294967296f <= 4294967295u) // This is true due to a precision
|
||||
// // loss in rounding up to float.
|
||||
// 3. When the floating point value is then converted to an integral, the
|
||||
// resulting value is out of range for the target integral type and
|
||||
// thus is implementation defined.
|
||||
// Example: unsigned u = (float)INT_MAX; // u will typically overflow to 0.
|
||||
// To fix this bug we manually truncate the maximum value when the destination
|
||||
// type is an integral of larger precision than the source floating-point type,
|
||||
// such that the resulting maximum is represented exactly as a floating point.
|
||||
template <typename Dst, typename Src>
|
||||
struct NarrowingRange
|
||||
{
|
||||
typedef typename std::numeric_limits<Src> SrcLimits;
|
||||
typedef typename std::numeric_limits<Dst> DstLimits;
|
||||
// The following logic avoids warnings where the max function is
|
||||
// instantiated with invalid values for a bit shift (even though
|
||||
// such a function can never be called).
|
||||
static const int shift = (MaxExponent<Src>::value > MaxExponent<Dst>::value &&
|
||||
SrcLimits::digits < DstLimits::digits &&
|
||||
SrcLimits::is_iec559 &&
|
||||
DstLimits::is_integer)
|
||||
? (DstLimits::digits - SrcLimits::digits)
|
||||
: 0;
|
||||
|
||||
static constexpr Dst max()
|
||||
{
|
||||
// We use UINTMAX_C below to avoid compiler warnings about shifting floating
|
||||
// points. Since it's a compile time calculation, it shouldn't have any
|
||||
// performance impact.
|
||||
return DstLimits::max() - static_cast<Dst>((UINTMAX_C(1) << shift) - 1);
|
||||
}
|
||||
|
||||
static constexpr Dst min()
|
||||
{
|
||||
return std::numeric_limits<Dst>::is_iec559 ? -DstLimits::max() : DstLimits::min();
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Dst,
|
||||
typename Src,
|
||||
IntegerRepresentation DstSign = std::numeric_limits<Dst>::is_signed
|
||||
? INTEGER_REPRESENTATION_SIGNED
|
||||
: INTEGER_REPRESENTATION_UNSIGNED,
|
||||
IntegerRepresentation SrcSign = std::numeric_limits<Src>::is_signed
|
||||
? INTEGER_REPRESENTATION_SIGNED
|
||||
: INTEGER_REPRESENTATION_UNSIGNED,
|
||||
NumericRangeRepresentation DstRange = StaticDstRangeRelationToSrcRange<Dst, Src>::value>
|
||||
struct DstRangeRelationToSrcRangeImpl;
|
||||
|
||||
// The following templates are for ranges that must be verified at runtime. We
|
||||
// split it into checks based on signedness to avoid confusing casts and
|
||||
// compiler warnings on signed an unsigned comparisons.
|
||||
|
||||
// Dst range is statically determined to contain Src: Nothing to check.
|
||||
template <typename Dst, typename Src, IntegerRepresentation DstSign, IntegerRepresentation SrcSign>
|
||||
struct DstRangeRelationToSrcRangeImpl<Dst, Src, DstSign, SrcSign, NUMERIC_RANGE_CONTAINED>
|
||||
{
|
||||
static constexpr RangeConstraint Check(Src value) { return RANGE_VALID; }
|
||||
};
|
||||
|
||||
// Signed to signed narrowing: Both the upper and lower boundaries may be
|
||||
// exceeded.
|
||||
template <typename Dst, typename Src>
|
||||
struct DstRangeRelationToSrcRangeImpl<Dst,
|
||||
Src,
|
||||
INTEGER_REPRESENTATION_SIGNED,
|
||||
INTEGER_REPRESENTATION_SIGNED,
|
||||
NUMERIC_RANGE_NOT_CONTAINED>
|
||||
{
|
||||
static constexpr RangeConstraint Check(Src value)
|
||||
{
|
||||
return GetRangeConstraint((value <= NarrowingRange<Dst, Src>::max()),
|
||||
(value >= NarrowingRange<Dst, Src>::min()));
|
||||
}
|
||||
};
|
||||
|
||||
// Unsigned to unsigned narrowing: Only the upper boundary can be exceeded.
|
||||
template <typename Dst, typename Src>
|
||||
struct DstRangeRelationToSrcRangeImpl<Dst,
|
||||
Src,
|
||||
INTEGER_REPRESENTATION_UNSIGNED,
|
||||
INTEGER_REPRESENTATION_UNSIGNED,
|
||||
NUMERIC_RANGE_NOT_CONTAINED>
|
||||
{
|
||||
static constexpr RangeConstraint Check(Src value)
|
||||
{
|
||||
return GetRangeConstraint(value <= NarrowingRange<Dst, Src>::max(), true);
|
||||
}
|
||||
};
|
||||
|
||||
// Unsigned to signed: The upper boundary may be exceeded.
|
||||
template <typename Dst, typename Src>
|
||||
struct DstRangeRelationToSrcRangeImpl<Dst,
|
||||
Src,
|
||||
INTEGER_REPRESENTATION_SIGNED,
|
||||
INTEGER_REPRESENTATION_UNSIGNED,
|
||||
NUMERIC_RANGE_NOT_CONTAINED>
|
||||
{
|
||||
static constexpr RangeConstraint Check(Src value)
|
||||
{
|
||||
return sizeof(Dst) > sizeof(Src)
|
||||
? RANGE_VALID
|
||||
: GetRangeConstraint(value <= static_cast<Src>(NarrowingRange<Dst, Src>::max()),
|
||||
true);
|
||||
}
|
||||
};
|
||||
|
||||
// Signed to unsigned: The upper boundary may be exceeded for a narrower Dst,
|
||||
// and any negative value exceeds the lower boundary.
|
||||
template <typename Dst, typename Src>
|
||||
struct DstRangeRelationToSrcRangeImpl<Dst,
|
||||
Src,
|
||||
INTEGER_REPRESENTATION_UNSIGNED,
|
||||
INTEGER_REPRESENTATION_SIGNED,
|
||||
NUMERIC_RANGE_NOT_CONTAINED>
|
||||
{
|
||||
static constexpr RangeConstraint Check(Src value)
|
||||
{
|
||||
return (MaxExponent<Dst>::value >= MaxExponent<Src>::value)
|
||||
? GetRangeConstraint(true, value >= static_cast<Src>(0))
|
||||
: GetRangeConstraint(value <= static_cast<Src>(NarrowingRange<Dst, Src>::max()),
|
||||
value >= static_cast<Src>(0));
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Dst, typename Src>
|
||||
constexpr RangeConstraint DstRangeRelationToSrcRange(Src value)
|
||||
{
|
||||
static_assert(std::numeric_limits<Src>::is_specialized, "Argument must be numeric.");
|
||||
static_assert(std::numeric_limits<Dst>::is_specialized, "Result must be numeric.");
|
||||
return DstRangeRelationToSrcRangeImpl<Dst, Src>::Check(value);
|
||||
}
|
||||
|
||||
} // namespace internal
|
||||
} // namespace base
|
||||
|
||||
} // namespace angle
|
||||
|
||||
#endif // ANGLEBASE_NUMERICS_SAFE_CONVERSIONS_IMPL_H_
|
329
src/3rdparty/angle/src/common/third_party/base/anglebase/numerics/safe_math.h
vendored
Normal file
329
src/3rdparty/angle/src/common/third_party/base/anglebase/numerics/safe_math.h
vendored
Normal file
@ -0,0 +1,329 @@
|
||||
// Copyright 2014 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.
|
||||
|
||||
#ifndef ANGLEBASE_NUMERICS_SAFE_MATH_H_
|
||||
#define ANGLEBASE_NUMERICS_SAFE_MATH_H_
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include <limits>
|
||||
#include <type_traits>
|
||||
|
||||
#include "anglebase/logging.h"
|
||||
#include "anglebase/numerics/safe_math_impl.h"
|
||||
|
||||
namespace angle
|
||||
{
|
||||
|
||||
namespace base
|
||||
{
|
||||
|
||||
namespace internal
|
||||
{
|
||||
|
||||
// CheckedNumeric implements all the logic and operators for detecting integer
|
||||
// boundary conditions such as overflow, underflow, and invalid conversions.
|
||||
// The CheckedNumeric type implicitly converts from floating point and integer
|
||||
// data types, and contains overloads for basic arithmetic operations (i.e.: +,
|
||||
// -, *, /, %).
|
||||
//
|
||||
// The following methods convert from CheckedNumeric to standard numeric values:
|
||||
// IsValid() - Returns true if the underlying numeric value is valid (i.e. has
|
||||
// has not wrapped and is not the result of an invalid conversion).
|
||||
// ValueOrDie() - Returns the underlying value. If the state is not valid this
|
||||
// call will crash on a CHECK.
|
||||
// ValueOrDefault() - Returns the current value, or the supplied default if the
|
||||
// state is not valid.
|
||||
// ValueFloating() - Returns the underlying floating point value (valid only
|
||||
// only for floating point CheckedNumeric types).
|
||||
//
|
||||
// Bitwise operations are explicitly not supported, because correct
|
||||
// handling of some cases (e.g. sign manipulation) is ambiguous. Comparison
|
||||
// operations are explicitly not supported because they could result in a crash
|
||||
// on a CHECK condition. You should use patterns like the following for these
|
||||
// operations:
|
||||
// Bitwise operation:
|
||||
// CheckedNumeric<int> checked_int = untrusted_input_value;
|
||||
// int x = checked_int.ValueOrDefault(0) | kFlagValues;
|
||||
// Comparison:
|
||||
// CheckedNumeric<size_t> checked_size = untrusted_input_value;
|
||||
// checked_size += HEADER LENGTH;
|
||||
// if (checked_size.IsValid() && checked_size.ValueOrDie() < buffer_size)
|
||||
// Do stuff...
|
||||
template <typename T>
|
||||
class CheckedNumeric
|
||||
{
|
||||
static_assert(std::is_arithmetic<T>::value, "CheckedNumeric<T>: T must be a numeric type.");
|
||||
|
||||
public:
|
||||
typedef T type;
|
||||
|
||||
CheckedNumeric() {}
|
||||
|
||||
// Copy constructor.
|
||||
template <typename Src>
|
||||
CheckedNumeric(const CheckedNumeric<Src> &rhs) : state_(rhs.ValueUnsafe(), rhs.validity())
|
||||
{
|
||||
}
|
||||
|
||||
template <typename Src>
|
||||
CheckedNumeric(Src value, RangeConstraint validity) : state_(value, validity)
|
||||
{
|
||||
}
|
||||
|
||||
// This is not an explicit constructor because we implicitly upgrade regular
|
||||
// numerics to CheckedNumerics to make them easier to use.
|
||||
template <typename Src>
|
||||
CheckedNumeric(Src value) // NOLINT(runtime/explicit)
|
||||
: state_(value)
|
||||
{
|
||||
static_assert(std::numeric_limits<Src>::is_specialized, "Argument must be numeric.");
|
||||
}
|
||||
|
||||
// This is not an explicit constructor because we want a seamless conversion
|
||||
// from StrictNumeric types.
|
||||
template <typename Src>
|
||||
CheckedNumeric(StrictNumeric<Src> value) // NOLINT(runtime/explicit)
|
||||
: state_(static_cast<Src>(value))
|
||||
{
|
||||
}
|
||||
|
||||
// IsValid() is the public API to test if a CheckedNumeric is currently valid.
|
||||
bool IsValid() const { return validity() == RANGE_VALID; }
|
||||
|
||||
// ValueOrDie() The primary accessor for the underlying value. If the current
|
||||
// state is not valid it will CHECK and crash.
|
||||
T ValueOrDie() const
|
||||
{
|
||||
CHECK(IsValid());
|
||||
return state_.value();
|
||||
}
|
||||
|
||||
// ValueOrDefault(T default_value) A convenience method that returns the
|
||||
// current value if the state is valid, and the supplied default_value for
|
||||
// any other state.
|
||||
T ValueOrDefault(T default_value) const { return IsValid() ? state_.value() : default_value; }
|
||||
|
||||
// ValueFloating() - Since floating point values include their validity state,
|
||||
// we provide an easy method for extracting them directly, without a risk of
|
||||
// crashing on a CHECK.
|
||||
T ValueFloating() const
|
||||
{
|
||||
static_assert(std::numeric_limits<T>::is_iec559, "Argument must be float.");
|
||||
return CheckedNumeric<T>::cast(*this).ValueUnsafe();
|
||||
}
|
||||
|
||||
// validity() - DO NOT USE THIS IN EXTERNAL CODE - It is public right now for
|
||||
// tests and to avoid a big matrix of friend operator overloads. But the
|
||||
// values it returns are likely to change in the future.
|
||||
// Returns: current validity state (i.e. valid, overflow, underflow, nan).
|
||||
// TODO(jschuh): crbug.com/332611 Figure out and implement semantics for
|
||||
// saturation/wrapping so we can expose this state consistently and implement
|
||||
// saturated arithmetic.
|
||||
RangeConstraint validity() const { return state_.validity(); }
|
||||
|
||||
// ValueUnsafe() - DO NOT USE THIS IN EXTERNAL CODE - It is public right now
|
||||
// for tests and to avoid a big matrix of friend operator overloads. But the
|
||||
// values it returns are likely to change in the future.
|
||||
// Returns: the raw numeric value, regardless of the current state.
|
||||
// TODO(jschuh): crbug.com/332611 Figure out and implement semantics for
|
||||
// saturation/wrapping so we can expose this state consistently and implement
|
||||
// saturated arithmetic.
|
||||
T ValueUnsafe() const { return state_.value(); }
|
||||
|
||||
// Prototypes for the supported arithmetic operator overloads.
|
||||
template <typename Src>
|
||||
CheckedNumeric &operator+=(Src rhs);
|
||||
template <typename Src>
|
||||
CheckedNumeric &operator-=(Src rhs);
|
||||
template <typename Src>
|
||||
CheckedNumeric &operator*=(Src rhs);
|
||||
template <typename Src>
|
||||
CheckedNumeric &operator/=(Src rhs);
|
||||
template <typename Src>
|
||||
CheckedNumeric &operator%=(Src rhs);
|
||||
|
||||
CheckedNumeric operator-() const
|
||||
{
|
||||
RangeConstraint validity;
|
||||
T value = CheckedNeg(state_.value(), &validity);
|
||||
// Negation is always valid for floating point.
|
||||
if (std::numeric_limits<T>::is_iec559)
|
||||
return CheckedNumeric<T>(value);
|
||||
|
||||
validity = GetRangeConstraint(state_.validity() | validity);
|
||||
return CheckedNumeric<T>(value, validity);
|
||||
}
|
||||
|
||||
CheckedNumeric Abs() const
|
||||
{
|
||||
RangeConstraint validity;
|
||||
T value = CheckedAbs(state_.value(), &validity);
|
||||
// Absolute value is always valid for floating point.
|
||||
if (std::numeric_limits<T>::is_iec559)
|
||||
return CheckedNumeric<T>(value);
|
||||
|
||||
validity = GetRangeConstraint(state_.validity() | validity);
|
||||
return CheckedNumeric<T>(value, validity);
|
||||
}
|
||||
|
||||
// This function is available only for integral types. It returns an unsigned
|
||||
// integer of the same width as the source type, containing the absolute value
|
||||
// of the source, and properly handling signed min.
|
||||
CheckedNumeric<typename UnsignedOrFloatForSize<T>::type> UnsignedAbs() const
|
||||
{
|
||||
return CheckedNumeric<typename UnsignedOrFloatForSize<T>::type>(
|
||||
CheckedUnsignedAbs(state_.value()), state_.validity());
|
||||
}
|
||||
|
||||
CheckedNumeric &operator++()
|
||||
{
|
||||
*this += 1;
|
||||
return *this;
|
||||
}
|
||||
|
||||
CheckedNumeric operator++(int)
|
||||
{
|
||||
CheckedNumeric value = *this;
|
||||
*this += 1;
|
||||
return value;
|
||||
}
|
||||
|
||||
CheckedNumeric &operator--()
|
||||
{
|
||||
*this -= 1;
|
||||
return *this;
|
||||
}
|
||||
|
||||
CheckedNumeric operator--(int)
|
||||
{
|
||||
CheckedNumeric value = *this;
|
||||
*this -= 1;
|
||||
return value;
|
||||
}
|
||||
|
||||
// These static methods behave like a convenience cast operator targeting
|
||||
// the desired CheckedNumeric type. As an optimization, a reference is
|
||||
// returned when Src is the same type as T.
|
||||
template <typename Src>
|
||||
static CheckedNumeric<T> cast(
|
||||
Src u,
|
||||
typename std::enable_if<std::numeric_limits<Src>::is_specialized, int>::type = 0)
|
||||
{
|
||||
return u;
|
||||
}
|
||||
|
||||
template <typename Src>
|
||||
static CheckedNumeric<T> cast(
|
||||
const CheckedNumeric<Src> &u,
|
||||
typename std::enable_if<!std::is_same<Src, T>::value, int>::type = 0)
|
||||
{
|
||||
return u;
|
||||
}
|
||||
|
||||
static const CheckedNumeric<T> &cast(const CheckedNumeric<T> &u) { return u; }
|
||||
|
||||
private:
|
||||
template <typename NumericType>
|
||||
struct UnderlyingType
|
||||
{
|
||||
using type = NumericType;
|
||||
};
|
||||
|
||||
template <typename NumericType>
|
||||
struct UnderlyingType<CheckedNumeric<NumericType>>
|
||||
{
|
||||
using type = NumericType;
|
||||
};
|
||||
|
||||
CheckedNumericState<T> state_;
|
||||
};
|
||||
|
||||
// This is the boilerplate for the standard arithmetic operator overloads. A
|
||||
// macro isn't the prettiest solution, but it beats rewriting these five times.
|
||||
// Some details worth noting are:
|
||||
// * We apply the standard arithmetic promotions.
|
||||
// * We skip range checks for floating points.
|
||||
// * We skip range checks for destination integers with sufficient range.
|
||||
// TODO(jschuh): extract these out into templates.
|
||||
#define ANGLEBASE_NUMERIC_ARITHMETIC_OPERATORS(NAME, OP, COMPOUND_OP) \
|
||||
/* Binary arithmetic operator for CheckedNumerics of the same type. */ \
|
||||
template <typename T> \
|
||||
CheckedNumeric<typename ArithmeticPromotion<T>::type> operator OP( \
|
||||
const CheckedNumeric<T> &lhs, const CheckedNumeric<T> &rhs) \
|
||||
{ \
|
||||
typedef typename ArithmeticPromotion<T>::type Promotion; \
|
||||
/* Floating point always takes the fast path */ \
|
||||
if (std::numeric_limits<T>::is_iec559) \
|
||||
return CheckedNumeric<T>(lhs.ValueUnsafe() OP rhs.ValueUnsafe()); \
|
||||
if (IsIntegerArithmeticSafe<Promotion, T, T>::value) \
|
||||
return CheckedNumeric<Promotion>(lhs.ValueUnsafe() OP rhs.ValueUnsafe(), \
|
||||
GetRangeConstraint(rhs.validity() | lhs.validity())); \
|
||||
RangeConstraint validity = RANGE_VALID; \
|
||||
T result = \
|
||||
static_cast<T>(Checked##NAME(static_cast<Promotion>(lhs.ValueUnsafe()), \
|
||||
static_cast<Promotion>(rhs.ValueUnsafe()), &validity)); \
|
||||
return CheckedNumeric<Promotion>( \
|
||||
result, GetRangeConstraint(validity | lhs.validity() | rhs.validity())); \
|
||||
} \
|
||||
/* Assignment arithmetic operator implementation from CheckedNumeric. */ \
|
||||
template <typename T> \
|
||||
template <typename Src> \
|
||||
CheckedNumeric<T> &CheckedNumeric<T>::operator COMPOUND_OP(Src rhs) \
|
||||
{ \
|
||||
*this = CheckedNumeric<T>::cast(*this) \
|
||||
OP CheckedNumeric<typename UnderlyingType<Src>::type>::cast(rhs); \
|
||||
return *this; \
|
||||
} \
|
||||
/* Binary arithmetic operator for CheckedNumeric of different type. */ \
|
||||
template <typename T, typename Src> \
|
||||
CheckedNumeric<typename ArithmeticPromotion<T, Src>::type> operator OP( \
|
||||
const CheckedNumeric<Src> &lhs, const CheckedNumeric<T> &rhs) \
|
||||
{ \
|
||||
typedef typename ArithmeticPromotion<T, Src>::type Promotion; \
|
||||
if (IsIntegerArithmeticSafe<Promotion, T, Src>::value) \
|
||||
return CheckedNumeric<Promotion>(lhs.ValueUnsafe() OP rhs.ValueUnsafe(), \
|
||||
GetRangeConstraint(rhs.validity() | lhs.validity())); \
|
||||
return CheckedNumeric<Promotion>::cast(lhs) OP CheckedNumeric<Promotion>::cast(rhs); \
|
||||
} \
|
||||
/* Binary arithmetic operator for left CheckedNumeric and right numeric. */ \
|
||||
template <typename T, typename Src, \
|
||||
typename std::enable_if<std::is_arithmetic<Src>::value>::type * = nullptr> \
|
||||
CheckedNumeric<typename ArithmeticPromotion<T, Src>::type> operator OP( \
|
||||
const CheckedNumeric<T> &lhs, Src rhs) \
|
||||
{ \
|
||||
typedef typename ArithmeticPromotion<T, Src>::type Promotion; \
|
||||
if (IsIntegerArithmeticSafe<Promotion, T, Src>::value) \
|
||||
return CheckedNumeric<Promotion>(lhs.ValueUnsafe() OP rhs, lhs.validity()); \
|
||||
return CheckedNumeric<Promotion>::cast(lhs) OP CheckedNumeric<Promotion>::cast(rhs); \
|
||||
} \
|
||||
/* Binary arithmetic operator for left numeric and right CheckedNumeric. */ \
|
||||
template <typename T, typename Src, \
|
||||
typename std::enable_if<std::is_arithmetic<Src>::value>::type * = nullptr> \
|
||||
CheckedNumeric<typename ArithmeticPromotion<T, Src>::type> operator OP( \
|
||||
Src lhs, const CheckedNumeric<T> &rhs) \
|
||||
{ \
|
||||
typedef typename ArithmeticPromotion<T, Src>::type Promotion; \
|
||||
if (IsIntegerArithmeticSafe<Promotion, T, Src>::value) \
|
||||
return CheckedNumeric<Promotion>(lhs OP rhs.ValueUnsafe(), rhs.validity()); \
|
||||
return CheckedNumeric<Promotion>::cast(lhs) OP CheckedNumeric<Promotion>::cast(rhs); \
|
||||
}
|
||||
|
||||
ANGLEBASE_NUMERIC_ARITHMETIC_OPERATORS(Add, +, +=)
|
||||
ANGLEBASE_NUMERIC_ARITHMETIC_OPERATORS(Sub, -, -=)
|
||||
ANGLEBASE_NUMERIC_ARITHMETIC_OPERATORS(Mul, *, *=)
|
||||
ANGLEBASE_NUMERIC_ARITHMETIC_OPERATORS(Div, /, /=)
|
||||
ANGLEBASE_NUMERIC_ARITHMETIC_OPERATORS(Mod, %, %=)
|
||||
|
||||
#undef ANGLEBASE_NUMERIC_ARITHMETIC_OPERATORS
|
||||
|
||||
} // namespace internal
|
||||
|
||||
using internal::CheckedNumeric;
|
||||
|
||||
} // namespace base
|
||||
|
||||
} // namespace angle
|
||||
|
||||
#endif // ANGLEBASE_NUMERICS_SAFE_MATH_H_
|
575
src/3rdparty/angle/src/common/third_party/base/anglebase/numerics/safe_math_impl.h
vendored
Normal file
575
src/3rdparty/angle/src/common/third_party/base/anglebase/numerics/safe_math_impl.h
vendored
Normal file
@ -0,0 +1,575 @@
|
||||
// Copyright 2014 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.
|
||||
|
||||
#ifndef ANGLEBASE_NUMERICS_SAFE_MATH_IMPL_H_
|
||||
#define ANGLEBASE_NUMERICS_SAFE_MATH_IMPL_H_
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <climits>
|
||||
#include <cmath>
|
||||
#include <cstdlib>
|
||||
#include <limits>
|
||||
#include <type_traits>
|
||||
|
||||
#include "anglebase/numerics/safe_conversions.h"
|
||||
|
||||
namespace angle
|
||||
{
|
||||
|
||||
namespace base
|
||||
{
|
||||
namespace internal
|
||||
{
|
||||
|
||||
// Everything from here up to the floating point operations is portable C++,
|
||||
// but it may not be fast. This code could be split based on
|
||||
// platform/architecture and replaced with potentially faster implementations.
|
||||
|
||||
// Integer promotion templates used by the portable checked integer arithmetic.
|
||||
template <size_t Size, bool IsSigned>
|
||||
struct IntegerForSizeAndSign;
|
||||
template <>
|
||||
struct IntegerForSizeAndSign<1, true>
|
||||
{
|
||||
typedef int8_t type;
|
||||
};
|
||||
template <>
|
||||
struct IntegerForSizeAndSign<1, false>
|
||||
{
|
||||
typedef uint8_t type;
|
||||
};
|
||||
template <>
|
||||
struct IntegerForSizeAndSign<2, true>
|
||||
{
|
||||
typedef int16_t type;
|
||||
};
|
||||
template <>
|
||||
struct IntegerForSizeAndSign<2, false>
|
||||
{
|
||||
typedef uint16_t type;
|
||||
};
|
||||
template <>
|
||||
struct IntegerForSizeAndSign<4, true>
|
||||
{
|
||||
typedef int32_t type;
|
||||
};
|
||||
template <>
|
||||
struct IntegerForSizeAndSign<4, false>
|
||||
{
|
||||
typedef uint32_t type;
|
||||
};
|
||||
template <>
|
||||
struct IntegerForSizeAndSign<8, true>
|
||||
{
|
||||
typedef int64_t type;
|
||||
};
|
||||
template <>
|
||||
struct IntegerForSizeAndSign<8, false>
|
||||
{
|
||||
typedef uint64_t type;
|
||||
};
|
||||
|
||||
// WARNING: We have no IntegerForSizeAndSign<16, *>. If we ever add one to
|
||||
// support 128-bit math, then the ArithmeticPromotion template below will need
|
||||
// to be updated (or more likely replaced with a decltype expression).
|
||||
|
||||
template <typename Integer>
|
||||
struct UnsignedIntegerForSize
|
||||
{
|
||||
typedef
|
||||
typename std::enable_if<std::numeric_limits<Integer>::is_integer,
|
||||
typename IntegerForSizeAndSign<sizeof(Integer), false>::type>::type
|
||||
type;
|
||||
};
|
||||
|
||||
template <typename Integer>
|
||||
struct SignedIntegerForSize
|
||||
{
|
||||
typedef
|
||||
typename std::enable_if<std::numeric_limits<Integer>::is_integer,
|
||||
typename IntegerForSizeAndSign<sizeof(Integer), true>::type>::type
|
||||
type;
|
||||
};
|
||||
|
||||
template <typename Integer>
|
||||
struct TwiceWiderInteger
|
||||
{
|
||||
typedef typename std::enable_if<
|
||||
std::numeric_limits<Integer>::is_integer,
|
||||
typename IntegerForSizeAndSign<sizeof(Integer) * 2,
|
||||
std::numeric_limits<Integer>::is_signed>::type>::type type;
|
||||
};
|
||||
|
||||
template <typename Integer>
|
||||
struct PositionOfSignBit
|
||||
{
|
||||
static const typename std::enable_if<std::numeric_limits<Integer>::is_integer, size_t>::type
|
||||
value = CHAR_BIT * sizeof(Integer) - 1;
|
||||
};
|
||||
|
||||
// This is used for UnsignedAbs, where we need to support floating-point
|
||||
// template instantiations even though we don't actually support the operations.
|
||||
// However, there is no corresponding implementation of e.g. CheckedUnsignedAbs,
|
||||
// so the float versions will not compile.
|
||||
template <typename Numeric,
|
||||
bool IsInteger = std::numeric_limits<Numeric>::is_integer,
|
||||
bool IsFloat = std::numeric_limits<Numeric>::is_iec559>
|
||||
struct UnsignedOrFloatForSize;
|
||||
|
||||
template <typename Numeric>
|
||||
struct UnsignedOrFloatForSize<Numeric, true, false>
|
||||
{
|
||||
typedef typename UnsignedIntegerForSize<Numeric>::type type;
|
||||
};
|
||||
|
||||
template <typename Numeric>
|
||||
struct UnsignedOrFloatForSize<Numeric, false, true>
|
||||
{
|
||||
typedef Numeric type;
|
||||
};
|
||||
|
||||
// Helper templates for integer manipulations.
|
||||
|
||||
template <typename T>
|
||||
constexpr bool HasSignBit(T x)
|
||||
{
|
||||
// Cast to unsigned since right shift on signed is undefined.
|
||||
return !!(static_cast<typename UnsignedIntegerForSize<T>::type>(x) >>
|
||||
PositionOfSignBit<T>::value);
|
||||
}
|
||||
|
||||
// This wrapper undoes the standard integer promotions.
|
||||
template <typename T>
|
||||
constexpr T BinaryComplement(T x)
|
||||
{
|
||||
return static_cast<T>(~x);
|
||||
}
|
||||
|
||||
// Here are the actual portable checked integer math implementations.
|
||||
// TODO(jschuh): Break this code out from the enable_if pattern and find a clean
|
||||
// way to coalesce things into the CheckedNumericState specializations below.
|
||||
|
||||
template <typename T>
|
||||
typename std::enable_if<std::numeric_limits<T>::is_integer, T>::type
|
||||
CheckedAdd(T x, T y, RangeConstraint *validity)
|
||||
{
|
||||
// Since the value of x+y is undefined if we have a signed type, we compute
|
||||
// it using the unsigned type of the same size.
|
||||
typedef typename UnsignedIntegerForSize<T>::type UnsignedDst;
|
||||
UnsignedDst ux = static_cast<UnsignedDst>(x);
|
||||
UnsignedDst uy = static_cast<UnsignedDst>(y);
|
||||
UnsignedDst uresult = static_cast<UnsignedDst>(ux + uy);
|
||||
// Addition is valid if the sign of (x + y) is equal to either that of x or
|
||||
// that of y.
|
||||
if (std::numeric_limits<T>::is_signed)
|
||||
{
|
||||
if (HasSignBit(BinaryComplement(static_cast<UnsignedDst>((uresult ^ ux) & (uresult ^ uy)))))
|
||||
{
|
||||
*validity = RANGE_VALID;
|
||||
}
|
||||
else
|
||||
{ // Direction of wrap is inverse of result sign.
|
||||
*validity = HasSignBit(uresult) ? RANGE_OVERFLOW : RANGE_UNDERFLOW;
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // Unsigned is either valid or overflow.
|
||||
*validity = BinaryComplement(x) >= y ? RANGE_VALID : RANGE_OVERFLOW;
|
||||
}
|
||||
return static_cast<T>(uresult);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
typename std::enable_if<std::numeric_limits<T>::is_integer, T>::type
|
||||
CheckedSub(T x, T y, RangeConstraint *validity)
|
||||
{
|
||||
// Since the value of x+y is undefined if we have a signed type, we compute
|
||||
// it using the unsigned type of the same size.
|
||||
typedef typename UnsignedIntegerForSize<T>::type UnsignedDst;
|
||||
UnsignedDst ux = static_cast<UnsignedDst>(x);
|
||||
UnsignedDst uy = static_cast<UnsignedDst>(y);
|
||||
UnsignedDst uresult = static_cast<UnsignedDst>(ux - uy);
|
||||
// Subtraction is valid if either x and y have same sign, or (x-y) and x have
|
||||
// the same sign.
|
||||
if (std::numeric_limits<T>::is_signed)
|
||||
{
|
||||
if (HasSignBit(BinaryComplement(static_cast<UnsignedDst>((uresult ^ ux) & (ux ^ uy)))))
|
||||
{
|
||||
*validity = RANGE_VALID;
|
||||
}
|
||||
else
|
||||
{ // Direction of wrap is inverse of result sign.
|
||||
*validity = HasSignBit(uresult) ? RANGE_OVERFLOW : RANGE_UNDERFLOW;
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // Unsigned is either valid or underflow.
|
||||
*validity = x >= y ? RANGE_VALID : RANGE_UNDERFLOW;
|
||||
}
|
||||
return static_cast<T>(uresult);
|
||||
}
|
||||
|
||||
// Integer multiplication is a bit complicated. In the fast case we just
|
||||
// we just promote to a twice wider type, and range check the result. In the
|
||||
// slow case we need to manually check that the result won't be truncated by
|
||||
// checking with division against the appropriate bound.
|
||||
template <typename T>
|
||||
typename std::enable_if<std::numeric_limits<T>::is_integer && sizeof(T) * 2 <= sizeof(uintmax_t),
|
||||
T>::type
|
||||
CheckedMul(T x, T y, RangeConstraint *validity)
|
||||
{
|
||||
typedef typename TwiceWiderInteger<T>::type IntermediateType;
|
||||
IntermediateType tmp = static_cast<IntermediateType>(x) * static_cast<IntermediateType>(y);
|
||||
*validity = DstRangeRelationToSrcRange<T>(tmp);
|
||||
return static_cast<T>(tmp);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
typename std::enable_if<std::numeric_limits<T>::is_integer && std::numeric_limits<T>::is_signed &&
|
||||
(sizeof(T) * 2 > sizeof(uintmax_t)),
|
||||
T>::type
|
||||
CheckedMul(T x, T y, RangeConstraint *validity)
|
||||
{
|
||||
// If either side is zero then the result will be zero.
|
||||
if (!x || !y)
|
||||
{
|
||||
*validity = RANGE_VALID;
|
||||
return static_cast<T>(0);
|
||||
}
|
||||
else if (x > 0)
|
||||
{
|
||||
if (y > 0)
|
||||
*validity = x <= std::numeric_limits<T>::max() / y ? RANGE_VALID : RANGE_OVERFLOW;
|
||||
else
|
||||
*validity = y >= std::numeric_limits<T>::min() / x ? RANGE_VALID : RANGE_UNDERFLOW;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (y > 0)
|
||||
*validity = x >= std::numeric_limits<T>::min() / y ? RANGE_VALID : RANGE_UNDERFLOW;
|
||||
else
|
||||
*validity = y >= std::numeric_limits<T>::max() / x ? RANGE_VALID : RANGE_OVERFLOW;
|
||||
}
|
||||
|
||||
return static_cast<T>(x * y);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
typename std::enable_if<std::numeric_limits<T>::is_integer && !std::numeric_limits<T>::is_signed &&
|
||||
(sizeof(T) * 2 > sizeof(uintmax_t)),
|
||||
T>::type
|
||||
CheckedMul(T x, T y, RangeConstraint *validity)
|
||||
{
|
||||
*validity = (y == 0 || x <= std::numeric_limits<T>::max() / y) ? RANGE_VALID : RANGE_OVERFLOW;
|
||||
return static_cast<T>(x * y);
|
||||
}
|
||||
|
||||
// Division just requires a check for an invalid negation on signed min/-1.
|
||||
template <typename T>
|
||||
T CheckedDiv(T x,
|
||||
T y,
|
||||
RangeConstraint *validity,
|
||||
typename std::enable_if<std::numeric_limits<T>::is_integer, int>::type = 0)
|
||||
{
|
||||
if (std::numeric_limits<T>::is_signed && x == std::numeric_limits<T>::min() &&
|
||||
y == static_cast<T>(-1))
|
||||
{
|
||||
*validity = RANGE_OVERFLOW;
|
||||
return std::numeric_limits<T>::min();
|
||||
}
|
||||
|
||||
*validity = RANGE_VALID;
|
||||
return static_cast<T>(x / y);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
typename std::enable_if<std::numeric_limits<T>::is_integer && std::numeric_limits<T>::is_signed,
|
||||
T>::type
|
||||
CheckedMod(T x, T y, RangeConstraint *validity)
|
||||
{
|
||||
*validity = y > 0 ? RANGE_VALID : RANGE_INVALID;
|
||||
return static_cast<T>(x % y);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
typename std::enable_if<std::numeric_limits<T>::is_integer && !std::numeric_limits<T>::is_signed,
|
||||
T>::type
|
||||
CheckedMod(T x, T y, RangeConstraint *validity)
|
||||
{
|
||||
*validity = RANGE_VALID;
|
||||
return static_cast<T>(x % y);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
typename std::enable_if<std::numeric_limits<T>::is_integer && std::numeric_limits<T>::is_signed,
|
||||
T>::type
|
||||
CheckedNeg(T value, RangeConstraint *validity)
|
||||
{
|
||||
*validity = value != std::numeric_limits<T>::min() ? RANGE_VALID : RANGE_OVERFLOW;
|
||||
// The negation of signed min is min, so catch that one.
|
||||
return static_cast<T>(-value);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
typename std::enable_if<std::numeric_limits<T>::is_integer && !std::numeric_limits<T>::is_signed,
|
||||
T>::type
|
||||
CheckedNeg(T value, RangeConstraint *validity)
|
||||
{
|
||||
// The only legal unsigned negation is zero.
|
||||
*validity = value ? RANGE_UNDERFLOW : RANGE_VALID;
|
||||
return static_cast<T>(-static_cast<typename SignedIntegerForSize<T>::type>(value));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
typename std::enable_if<std::numeric_limits<T>::is_integer && std::numeric_limits<T>::is_signed,
|
||||
T>::type
|
||||
CheckedAbs(T value, RangeConstraint *validity)
|
||||
{
|
||||
*validity = value != std::numeric_limits<T>::min() ? RANGE_VALID : RANGE_OVERFLOW;
|
||||
return static_cast<T>(std::abs(value));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
typename std::enable_if<std::numeric_limits<T>::is_integer && !std::numeric_limits<T>::is_signed,
|
||||
T>::type
|
||||
CheckedAbs(T value, RangeConstraint *validity)
|
||||
{
|
||||
// T is unsigned, so |value| must already be positive.
|
||||
*validity = RANGE_VALID;
|
||||
return value;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
typename std::enable_if<std::numeric_limits<T>::is_integer && std::numeric_limits<T>::is_signed,
|
||||
typename UnsignedIntegerForSize<T>::type>::type
|
||||
CheckedUnsignedAbs(T value)
|
||||
{
|
||||
typedef typename UnsignedIntegerForSize<T>::type UnsignedT;
|
||||
return value == std::numeric_limits<T>::min()
|
||||
? static_cast<UnsignedT>(std::numeric_limits<T>::max()) + 1
|
||||
: static_cast<UnsignedT>(std::abs(value));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
typename std::enable_if<std::numeric_limits<T>::is_integer && !std::numeric_limits<T>::is_signed,
|
||||
T>::type
|
||||
CheckedUnsignedAbs(T value)
|
||||
{
|
||||
// T is unsigned, so |value| must already be positive.
|
||||
return static_cast<T>(value);
|
||||
}
|
||||
|
||||
// These are the floating point stubs that the compiler needs to see. Only the
|
||||
// negation operation is ever called.
|
||||
#define ANGLEBASE_FLOAT_ARITHMETIC_STUBS(NAME) \
|
||||
template <typename T> \
|
||||
typename std::enable_if<std::numeric_limits<T>::is_iec559, T>::type Checked##NAME( \
|
||||
T, T, RangeConstraint *) \
|
||||
{ \
|
||||
NOTREACHED(); \
|
||||
return static_cast<T>(0); \
|
||||
}
|
||||
|
||||
ANGLEBASE_FLOAT_ARITHMETIC_STUBS(Add)
|
||||
ANGLEBASE_FLOAT_ARITHMETIC_STUBS(Sub)
|
||||
ANGLEBASE_FLOAT_ARITHMETIC_STUBS(Mul)
|
||||
ANGLEBASE_FLOAT_ARITHMETIC_STUBS(Div)
|
||||
ANGLEBASE_FLOAT_ARITHMETIC_STUBS(Mod)
|
||||
|
||||
#undef ANGLEBASE_FLOAT_ARITHMETIC_STUBS
|
||||
|
||||
template <typename T>
|
||||
typename std::enable_if<std::numeric_limits<T>::is_iec559, T>::type CheckedNeg(T value,
|
||||
RangeConstraint *)
|
||||
{
|
||||
return static_cast<T>(-value);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
typename std::enable_if<std::numeric_limits<T>::is_iec559, T>::type CheckedAbs(T value,
|
||||
RangeConstraint *)
|
||||
{
|
||||
return static_cast<T>(std::abs(value));
|
||||
}
|
||||
|
||||
// Floats carry around their validity state with them, but integers do not. So,
|
||||
// we wrap the underlying value in a specialization in order to hide that detail
|
||||
// and expose an interface via accessors.
|
||||
enum NumericRepresentation
|
||||
{
|
||||
NUMERIC_INTEGER,
|
||||
NUMERIC_FLOATING,
|
||||
NUMERIC_UNKNOWN
|
||||
};
|
||||
|
||||
template <typename NumericType>
|
||||
struct GetNumericRepresentation
|
||||
{
|
||||
static const NumericRepresentation value =
|
||||
std::numeric_limits<NumericType>::is_integer
|
||||
? NUMERIC_INTEGER
|
||||
: (std::numeric_limits<NumericType>::is_iec559 ? NUMERIC_FLOATING : NUMERIC_UNKNOWN);
|
||||
};
|
||||
|
||||
template <typename T, NumericRepresentation type = GetNumericRepresentation<T>::value>
|
||||
class CheckedNumericState
|
||||
{
|
||||
};
|
||||
|
||||
// Integrals require quite a bit of additional housekeeping to manage state.
|
||||
template <typename T>
|
||||
class CheckedNumericState<T, NUMERIC_INTEGER>
|
||||
{
|
||||
private:
|
||||
T value_;
|
||||
RangeConstraint validity_ : CHAR_BIT; // Actually requires only two bits.
|
||||
|
||||
public:
|
||||
template <typename Src, NumericRepresentation type>
|
||||
friend class CheckedNumericState;
|
||||
|
||||
CheckedNumericState() : value_(0), validity_(RANGE_VALID) {}
|
||||
|
||||
template <typename Src>
|
||||
CheckedNumericState(Src value, RangeConstraint validity)
|
||||
: value_(static_cast<T>(value)),
|
||||
validity_(GetRangeConstraint(validity | DstRangeRelationToSrcRange<T>(value)))
|
||||
{
|
||||
static_assert(std::numeric_limits<Src>::is_specialized, "Argument must be numeric.");
|
||||
}
|
||||
|
||||
// Copy constructor.
|
||||
template <typename Src>
|
||||
CheckedNumericState(const CheckedNumericState<Src> &rhs)
|
||||
: value_(static_cast<T>(rhs.value())),
|
||||
validity_(GetRangeConstraint(rhs.validity() | DstRangeRelationToSrcRange<T>(rhs.value())))
|
||||
{
|
||||
}
|
||||
|
||||
template <typename Src>
|
||||
explicit CheckedNumericState(
|
||||
Src value,
|
||||
typename std::enable_if<std::numeric_limits<Src>::is_specialized, int>::type = 0)
|
||||
: value_(static_cast<T>(value)), validity_(DstRangeRelationToSrcRange<T>(value))
|
||||
{
|
||||
}
|
||||
|
||||
RangeConstraint validity() const { return validity_; }
|
||||
T value() const { return value_; }
|
||||
};
|
||||
|
||||
// Floating points maintain their own validity, but need translation wrappers.
|
||||
template <typename T>
|
||||
class CheckedNumericState<T, NUMERIC_FLOATING>
|
||||
{
|
||||
private:
|
||||
T value_;
|
||||
|
||||
public:
|
||||
template <typename Src, NumericRepresentation type>
|
||||
friend class CheckedNumericState;
|
||||
|
||||
CheckedNumericState() : value_(0.0) {}
|
||||
|
||||
template <typename Src>
|
||||
CheckedNumericState(
|
||||
Src value,
|
||||
RangeConstraint validity,
|
||||
typename std::enable_if<std::numeric_limits<Src>::is_integer, int>::type = 0)
|
||||
{
|
||||
switch (DstRangeRelationToSrcRange<T>(value))
|
||||
{
|
||||
case RANGE_VALID:
|
||||
value_ = static_cast<T>(value);
|
||||
break;
|
||||
|
||||
case RANGE_UNDERFLOW:
|
||||
value_ = -std::numeric_limits<T>::infinity();
|
||||
break;
|
||||
|
||||
case RANGE_OVERFLOW:
|
||||
value_ = std::numeric_limits<T>::infinity();
|
||||
break;
|
||||
|
||||
case RANGE_INVALID:
|
||||
value_ = std::numeric_limits<T>::quiet_NaN();
|
||||
break;
|
||||
|
||||
default:
|
||||
NOTREACHED();
|
||||
}
|
||||
}
|
||||
|
||||
template <typename Src>
|
||||
explicit CheckedNumericState(
|
||||
Src value,
|
||||
typename std::enable_if<std::numeric_limits<Src>::is_specialized, int>::type = 0)
|
||||
: value_(static_cast<T>(value))
|
||||
{
|
||||
}
|
||||
|
||||
// Copy constructor.
|
||||
template <typename Src>
|
||||
CheckedNumericState(const CheckedNumericState<Src> &rhs) : value_(static_cast<T>(rhs.value()))
|
||||
{
|
||||
}
|
||||
|
||||
RangeConstraint validity() const
|
||||
{
|
||||
return GetRangeConstraint(value_ <= std::numeric_limits<T>::max(),
|
||||
value_ >= -std::numeric_limits<T>::max());
|
||||
}
|
||||
T value() const { return value_; }
|
||||
};
|
||||
|
||||
// For integers less than 128-bit and floats 32-bit or larger, we have the type
|
||||
// with the larger maximum exponent take precedence.
|
||||
enum ArithmeticPromotionCategory
|
||||
{
|
||||
LEFT_PROMOTION,
|
||||
RIGHT_PROMOTION
|
||||
};
|
||||
|
||||
template <typename Lhs,
|
||||
typename Rhs = Lhs,
|
||||
ArithmeticPromotionCategory Promotion =
|
||||
(MaxExponent<Lhs>::value > MaxExponent<Rhs>::value) ? LEFT_PROMOTION
|
||||
: RIGHT_PROMOTION>
|
||||
struct ArithmeticPromotion;
|
||||
|
||||
template <typename Lhs, typename Rhs>
|
||||
struct ArithmeticPromotion<Lhs, Rhs, LEFT_PROMOTION>
|
||||
{
|
||||
typedef Lhs type;
|
||||
};
|
||||
|
||||
template <typename Lhs, typename Rhs>
|
||||
struct ArithmeticPromotion<Lhs, Rhs, RIGHT_PROMOTION>
|
||||
{
|
||||
typedef Rhs type;
|
||||
};
|
||||
|
||||
// We can statically check if operations on the provided types can wrap, so we
|
||||
// can skip the checked operations if they're not needed. So, for an integer we
|
||||
// care if the destination type preserves the sign and is twice the width of
|
||||
// the source.
|
||||
template <typename T, typename Lhs, typename Rhs>
|
||||
struct IsIntegerArithmeticSafe
|
||||
{
|
||||
static const bool value =
|
||||
!std::numeric_limits<T>::is_iec559 &&
|
||||
StaticDstRangeRelationToSrcRange<T, Lhs>::value == NUMERIC_RANGE_CONTAINED &&
|
||||
sizeof(T) >= (2 * sizeof(Lhs)) &&
|
||||
StaticDstRangeRelationToSrcRange<T, Rhs>::value != NUMERIC_RANGE_CONTAINED &&
|
||||
sizeof(T) >= (2 * sizeof(Rhs));
|
||||
};
|
||||
|
||||
} // namespace internal
|
||||
} // namespace base
|
||||
|
||||
} // namespace angle
|
||||
|
||||
#endif // ANGLEBASE_NUMERICS_SAFE_MATH_IMPL_H_
|
771
src/3rdparty/angle/src/common/third_party/base/anglebase/numerics/safe_numerics_unittest.cc
vendored
Normal file
771
src/3rdparty/angle/src/common/third_party/base/anglebase/numerics/safe_numerics_unittest.cc
vendored
Normal file
@ -0,0 +1,771 @@
|
||||
// Copyright 2013 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.
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <limits>
|
||||
#include <type_traits>
|
||||
|
||||
#include "base/compiler_specific.h"
|
||||
#include "base/numerics/safe_conversions.h"
|
||||
#include "base/numerics/safe_math.h"
|
||||
#include "build/build_config.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
|
||||
#if defined(COMPILER_MSVC) && defined(ARCH_CPU_32_BITS)
|
||||
#include <mmintrin.h>
|
||||
#endif
|
||||
|
||||
using std::numeric_limits;
|
||||
using base::CheckedNumeric;
|
||||
using base::checked_cast;
|
||||
using base::IsValueInRangeForNumericType;
|
||||
using base::IsValueNegative;
|
||||
using base::SizeT;
|
||||
using base::StrictNumeric;
|
||||
using base::saturated_cast;
|
||||
using base::strict_cast;
|
||||
using base::internal::MaxExponent;
|
||||
using base::internal::RANGE_VALID;
|
||||
using base::internal::RANGE_INVALID;
|
||||
using base::internal::RANGE_OVERFLOW;
|
||||
using base::internal::RANGE_UNDERFLOW;
|
||||
using base::internal::SignedIntegerForSize;
|
||||
|
||||
// These tests deliberately cause arithmetic overflows. If the compiler is
|
||||
// aggressive enough, it can const fold these overflows. Disable warnings about
|
||||
// overflows for const expressions.
|
||||
#if defined(OS_WIN)
|
||||
#pragma warning(disable : 4756)
|
||||
#endif
|
||||
|
||||
// This is a helper function for finding the maximum value in Src that can be
|
||||
// wholy represented as the destination floating-point type.
|
||||
template <typename Dst, typename Src>
|
||||
Dst GetMaxConvertibleToFloat()
|
||||
{
|
||||
typedef numeric_limits<Dst> DstLimits;
|
||||
typedef numeric_limits<Src> SrcLimits;
|
||||
static_assert(SrcLimits::is_specialized, "Source must be numeric.");
|
||||
static_assert(DstLimits::is_specialized, "Destination must be numeric.");
|
||||
CHECK(DstLimits::is_iec559);
|
||||
|
||||
if (SrcLimits::digits <= DstLimits::digits &&
|
||||
MaxExponent<Src>::value <= MaxExponent<Dst>::value)
|
||||
return SrcLimits::max();
|
||||
Src max = SrcLimits::max() / 2 + (SrcLimits::is_integer ? 1 : 0);
|
||||
while (max != static_cast<Src>(static_cast<Dst>(max)))
|
||||
{
|
||||
max /= 2;
|
||||
}
|
||||
return static_cast<Dst>(max);
|
||||
}
|
||||
|
||||
// Helper macros to wrap displaying the conversion types and line numbers.
|
||||
#define TEST_EXPECTED_VALIDITY(expected, actual) \
|
||||
EXPECT_EQ(expected, CheckedNumeric<Dst>(actual).IsValid()) \
|
||||
<< "Result test: Value " << +(actual).ValueUnsafe() << " as " << dst << " on line " \
|
||||
<< line;
|
||||
|
||||
#define TEST_EXPECTED_SUCCESS(actual) TEST_EXPECTED_VALIDITY(true, actual)
|
||||
#define TEST_EXPECTED_FAILURE(actual) TEST_EXPECTED_VALIDITY(false, actual)
|
||||
|
||||
#define TEST_EXPECTED_VALUE(expected, actual) \
|
||||
EXPECT_EQ(static_cast<Dst>(expected), CheckedNumeric<Dst>(actual).ValueUnsafe()) \
|
||||
<< "Result test: Value " << +((actual).ValueUnsafe()) << " as " << dst << " on line " \
|
||||
<< line;
|
||||
|
||||
// Signed integer arithmetic.
|
||||
template <typename Dst>
|
||||
static void TestSpecializedArithmetic(
|
||||
const char *dst,
|
||||
int line,
|
||||
typename std::enable_if<numeric_limits<Dst>::is_integer && numeric_limits<Dst>::is_signed,
|
||||
int>::type = 0)
|
||||
{
|
||||
typedef numeric_limits<Dst> DstLimits;
|
||||
TEST_EXPECTED_FAILURE(-CheckedNumeric<Dst>(DstLimits::min()));
|
||||
TEST_EXPECTED_FAILURE(CheckedNumeric<Dst>(DstLimits::min()).Abs());
|
||||
TEST_EXPECTED_VALUE(1, CheckedNumeric<Dst>(-1).Abs());
|
||||
|
||||
TEST_EXPECTED_SUCCESS(CheckedNumeric<Dst>(DstLimits::max()) + -1);
|
||||
TEST_EXPECTED_FAILURE(CheckedNumeric<Dst>(DstLimits::min()) + -1);
|
||||
TEST_EXPECTED_FAILURE(CheckedNumeric<Dst>(-DstLimits::max()) + -DstLimits::max());
|
||||
|
||||
TEST_EXPECTED_FAILURE(CheckedNumeric<Dst>(DstLimits::min()) - 1);
|
||||
TEST_EXPECTED_SUCCESS(CheckedNumeric<Dst>(DstLimits::min()) - -1);
|
||||
TEST_EXPECTED_FAILURE(CheckedNumeric<Dst>(DstLimits::max()) - -DstLimits::max());
|
||||
TEST_EXPECTED_FAILURE(CheckedNumeric<Dst>(-DstLimits::max()) - DstLimits::max());
|
||||
|
||||
TEST_EXPECTED_FAILURE(CheckedNumeric<Dst>(DstLimits::min()) * 2);
|
||||
|
||||
TEST_EXPECTED_FAILURE(CheckedNumeric<Dst>(DstLimits::min()) / -1);
|
||||
TEST_EXPECTED_VALUE(0, CheckedNumeric<Dst>(-1) / 2);
|
||||
|
||||
// Modulus is legal only for integers.
|
||||
TEST_EXPECTED_VALUE(0, CheckedNumeric<Dst>() % 1);
|
||||
TEST_EXPECTED_VALUE(0, CheckedNumeric<Dst>(1) % 1);
|
||||
TEST_EXPECTED_VALUE(-1, CheckedNumeric<Dst>(-1) % 2);
|
||||
TEST_EXPECTED_FAILURE(CheckedNumeric<Dst>(-1) % -2);
|
||||
TEST_EXPECTED_VALUE(0, CheckedNumeric<Dst>(DstLimits::min()) % 2);
|
||||
TEST_EXPECTED_VALUE(1, CheckedNumeric<Dst>(DstLimits::max()) % 2);
|
||||
// Test all the different modulus combinations.
|
||||
TEST_EXPECTED_VALUE(0, CheckedNumeric<Dst>(1) % CheckedNumeric<Dst>(1));
|
||||
TEST_EXPECTED_VALUE(0, 1 % CheckedNumeric<Dst>(1));
|
||||
TEST_EXPECTED_VALUE(0, CheckedNumeric<Dst>(1) % 1);
|
||||
CheckedNumeric<Dst> checked_dst = 1;
|
||||
TEST_EXPECTED_VALUE(0, checked_dst %= 1);
|
||||
}
|
||||
|
||||
// Unsigned integer arithmetic.
|
||||
template <typename Dst>
|
||||
static void TestSpecializedArithmetic(
|
||||
const char *dst,
|
||||
int line,
|
||||
typename std::enable_if<numeric_limits<Dst>::is_integer && !numeric_limits<Dst>::is_signed,
|
||||
int>::type = 0)
|
||||
{
|
||||
typedef numeric_limits<Dst> DstLimits;
|
||||
TEST_EXPECTED_SUCCESS(-CheckedNumeric<Dst>(DstLimits::min()));
|
||||
TEST_EXPECTED_SUCCESS(CheckedNumeric<Dst>(DstLimits::min()).Abs());
|
||||
TEST_EXPECTED_FAILURE(CheckedNumeric<Dst>(DstLimits::min()) + -1);
|
||||
TEST_EXPECTED_FAILURE(CheckedNumeric<Dst>(DstLimits::min()) - 1);
|
||||
TEST_EXPECTED_VALUE(0, CheckedNumeric<Dst>(DstLimits::min()) * 2);
|
||||
TEST_EXPECTED_VALUE(0, CheckedNumeric<Dst>(1) / 2);
|
||||
TEST_EXPECTED_SUCCESS(CheckedNumeric<Dst>(DstLimits::min()).UnsignedAbs());
|
||||
TEST_EXPECTED_SUCCESS(CheckedNumeric<typename SignedIntegerForSize<Dst>::type>(
|
||||
std::numeric_limits<typename SignedIntegerForSize<Dst>::type>::min())
|
||||
.UnsignedAbs());
|
||||
|
||||
// Modulus is legal only for integers.
|
||||
TEST_EXPECTED_VALUE(0, CheckedNumeric<Dst>() % 1);
|
||||
TEST_EXPECTED_VALUE(0, CheckedNumeric<Dst>(1) % 1);
|
||||
TEST_EXPECTED_VALUE(1, CheckedNumeric<Dst>(1) % 2);
|
||||
TEST_EXPECTED_VALUE(0, CheckedNumeric<Dst>(DstLimits::min()) % 2);
|
||||
TEST_EXPECTED_VALUE(1, CheckedNumeric<Dst>(DstLimits::max()) % 2);
|
||||
// Test all the different modulus combinations.
|
||||
TEST_EXPECTED_VALUE(0, CheckedNumeric<Dst>(1) % CheckedNumeric<Dst>(1));
|
||||
TEST_EXPECTED_VALUE(0, 1 % CheckedNumeric<Dst>(1));
|
||||
TEST_EXPECTED_VALUE(0, CheckedNumeric<Dst>(1) % 1);
|
||||
CheckedNumeric<Dst> checked_dst = 1;
|
||||
TEST_EXPECTED_VALUE(0, checked_dst %= 1);
|
||||
}
|
||||
|
||||
// Floating point arithmetic.
|
||||
template <typename Dst>
|
||||
void TestSpecializedArithmetic(
|
||||
const char *dst,
|
||||
int line,
|
||||
typename std::enable_if<numeric_limits<Dst>::is_iec559, int>::type = 0)
|
||||
{
|
||||
typedef numeric_limits<Dst> DstLimits;
|
||||
TEST_EXPECTED_SUCCESS(-CheckedNumeric<Dst>(DstLimits::min()));
|
||||
|
||||
TEST_EXPECTED_SUCCESS(CheckedNumeric<Dst>(DstLimits::min()).Abs());
|
||||
TEST_EXPECTED_VALUE(1, CheckedNumeric<Dst>(-1).Abs());
|
||||
|
||||
TEST_EXPECTED_SUCCESS(CheckedNumeric<Dst>(DstLimits::min()) + -1);
|
||||
TEST_EXPECTED_SUCCESS(CheckedNumeric<Dst>(DstLimits::max()) + 1);
|
||||
TEST_EXPECTED_FAILURE(CheckedNumeric<Dst>(-DstLimits::max()) + -DstLimits::max());
|
||||
|
||||
TEST_EXPECTED_FAILURE(CheckedNumeric<Dst>(DstLimits::max()) - -DstLimits::max());
|
||||
TEST_EXPECTED_FAILURE(CheckedNumeric<Dst>(-DstLimits::max()) - DstLimits::max());
|
||||
|
||||
TEST_EXPECTED_SUCCESS(CheckedNumeric<Dst>(DstLimits::min()) * 2);
|
||||
|
||||
TEST_EXPECTED_VALUE(-0.5, CheckedNumeric<Dst>(-1.0) / 2);
|
||||
EXPECT_EQ(static_cast<Dst>(1.0), CheckedNumeric<Dst>(1.0).ValueFloating());
|
||||
}
|
||||
|
||||
// Generic arithmetic tests.
|
||||
template <typename Dst>
|
||||
static void TestArithmetic(const char *dst, int line)
|
||||
{
|
||||
typedef numeric_limits<Dst> DstLimits;
|
||||
|
||||
EXPECT_EQ(true, CheckedNumeric<Dst>().IsValid());
|
||||
EXPECT_EQ(
|
||||
false,
|
||||
CheckedNumeric<Dst>(CheckedNumeric<Dst>(DstLimits::max()) * DstLimits::max()).IsValid());
|
||||
EXPECT_EQ(static_cast<Dst>(0), CheckedNumeric<Dst>().ValueOrDie());
|
||||
EXPECT_EQ(static_cast<Dst>(0), CheckedNumeric<Dst>().ValueOrDefault(1));
|
||||
EXPECT_EQ(static_cast<Dst>(1),
|
||||
CheckedNumeric<Dst>(CheckedNumeric<Dst>(DstLimits::max()) * DstLimits::max())
|
||||
.ValueOrDefault(1));
|
||||
|
||||
// Test the operator combinations.
|
||||
TEST_EXPECTED_VALUE(2, CheckedNumeric<Dst>(1) + CheckedNumeric<Dst>(1));
|
||||
TEST_EXPECTED_VALUE(0, CheckedNumeric<Dst>(1) - CheckedNumeric<Dst>(1));
|
||||
TEST_EXPECTED_VALUE(1, CheckedNumeric<Dst>(1) * CheckedNumeric<Dst>(1));
|
||||
TEST_EXPECTED_VALUE(1, CheckedNumeric<Dst>(1) / CheckedNumeric<Dst>(1));
|
||||
TEST_EXPECTED_VALUE(2, 1 + CheckedNumeric<Dst>(1));
|
||||
TEST_EXPECTED_VALUE(0, 1 - CheckedNumeric<Dst>(1));
|
||||
TEST_EXPECTED_VALUE(1, 1 * CheckedNumeric<Dst>(1));
|
||||
TEST_EXPECTED_VALUE(1, 1 / CheckedNumeric<Dst>(1));
|
||||
TEST_EXPECTED_VALUE(2, CheckedNumeric<Dst>(1) + 1);
|
||||
TEST_EXPECTED_VALUE(0, CheckedNumeric<Dst>(1) - 1);
|
||||
TEST_EXPECTED_VALUE(1, CheckedNumeric<Dst>(1) * 1);
|
||||
TEST_EXPECTED_VALUE(1, CheckedNumeric<Dst>(1) / 1);
|
||||
CheckedNumeric<Dst> checked_dst = 1;
|
||||
TEST_EXPECTED_VALUE(2, checked_dst += 1);
|
||||
checked_dst = 1;
|
||||
TEST_EXPECTED_VALUE(0, checked_dst -= 1);
|
||||
checked_dst = 1;
|
||||
TEST_EXPECTED_VALUE(1, checked_dst *= 1);
|
||||
checked_dst = 1;
|
||||
TEST_EXPECTED_VALUE(1, checked_dst /= 1);
|
||||
|
||||
// Generic negation.
|
||||
TEST_EXPECTED_VALUE(0, -CheckedNumeric<Dst>());
|
||||
TEST_EXPECTED_VALUE(-1, -CheckedNumeric<Dst>(1));
|
||||
TEST_EXPECTED_VALUE(1, -CheckedNumeric<Dst>(-1));
|
||||
TEST_EXPECTED_VALUE(static_cast<Dst>(DstLimits::max() * -1),
|
||||
-CheckedNumeric<Dst>(DstLimits::max()));
|
||||
|
||||
// Generic absolute value.
|
||||
TEST_EXPECTED_VALUE(0, CheckedNumeric<Dst>().Abs());
|
||||
TEST_EXPECTED_VALUE(1, CheckedNumeric<Dst>(1).Abs());
|
||||
TEST_EXPECTED_VALUE(DstLimits::max(), CheckedNumeric<Dst>(DstLimits::max()).Abs());
|
||||
|
||||
// Generic addition.
|
||||
TEST_EXPECTED_VALUE(1, (CheckedNumeric<Dst>() + 1));
|
||||
TEST_EXPECTED_VALUE(2, (CheckedNumeric<Dst>(1) + 1));
|
||||
TEST_EXPECTED_VALUE(0, (CheckedNumeric<Dst>(-1) + 1));
|
||||
TEST_EXPECTED_SUCCESS(CheckedNumeric<Dst>(DstLimits::min()) + 1);
|
||||
TEST_EXPECTED_FAILURE(CheckedNumeric<Dst>(DstLimits::max()) + DstLimits::max());
|
||||
|
||||
// Generic subtraction.
|
||||
TEST_EXPECTED_VALUE(-1, (CheckedNumeric<Dst>() - 1));
|
||||
TEST_EXPECTED_VALUE(0, (CheckedNumeric<Dst>(1) - 1));
|
||||
TEST_EXPECTED_VALUE(-2, (CheckedNumeric<Dst>(-1) - 1));
|
||||
TEST_EXPECTED_SUCCESS(CheckedNumeric<Dst>(DstLimits::max()) - 1);
|
||||
|
||||
// Generic multiplication.
|
||||
TEST_EXPECTED_VALUE(0, (CheckedNumeric<Dst>() * 1));
|
||||
TEST_EXPECTED_VALUE(1, (CheckedNumeric<Dst>(1) * 1));
|
||||
TEST_EXPECTED_VALUE(-2, (CheckedNumeric<Dst>(-1) * 2));
|
||||
TEST_EXPECTED_VALUE(0, (CheckedNumeric<Dst>(0) * 0));
|
||||
TEST_EXPECTED_VALUE(0, (CheckedNumeric<Dst>(-1) * 0));
|
||||
TEST_EXPECTED_VALUE(0, (CheckedNumeric<Dst>(0) * -1));
|
||||
TEST_EXPECTED_FAILURE(CheckedNumeric<Dst>(DstLimits::max()) * DstLimits::max());
|
||||
|
||||
// Generic division.
|
||||
TEST_EXPECTED_VALUE(0, CheckedNumeric<Dst>() / 1);
|
||||
TEST_EXPECTED_VALUE(1, CheckedNumeric<Dst>(1) / 1);
|
||||
TEST_EXPECTED_VALUE(DstLimits::min() / 2, CheckedNumeric<Dst>(DstLimits::min()) / 2);
|
||||
TEST_EXPECTED_VALUE(DstLimits::max() / 2, CheckedNumeric<Dst>(DstLimits::max()) / 2);
|
||||
|
||||
TestSpecializedArithmetic<Dst>(dst, line);
|
||||
}
|
||||
|
||||
// Helper macro to wrap displaying the conversion types and line numbers.
|
||||
#define TEST_ARITHMETIC(Dst) TestArithmetic<Dst>(#Dst, __LINE__)
|
||||
|
||||
TEST(SafeNumerics, SignedIntegerMath)
|
||||
{
|
||||
TEST_ARITHMETIC(int8_t);
|
||||
TEST_ARITHMETIC(int);
|
||||
TEST_ARITHMETIC(intptr_t);
|
||||
TEST_ARITHMETIC(intmax_t);
|
||||
}
|
||||
|
||||
TEST(SafeNumerics, UnsignedIntegerMath)
|
||||
{
|
||||
TEST_ARITHMETIC(uint8_t);
|
||||
TEST_ARITHMETIC(unsigned int);
|
||||
TEST_ARITHMETIC(uintptr_t);
|
||||
TEST_ARITHMETIC(uintmax_t);
|
||||
}
|
||||
|
||||
TEST(SafeNumerics, FloatingPointMath)
|
||||
{
|
||||
TEST_ARITHMETIC(float);
|
||||
TEST_ARITHMETIC(double);
|
||||
}
|
||||
|
||||
// Enumerates the five different conversions types we need to test.
|
||||
enum NumericConversionType
|
||||
{
|
||||
SIGN_PRESERVING_VALUE_PRESERVING,
|
||||
SIGN_PRESERVING_NARROW,
|
||||
SIGN_TO_UNSIGN_WIDEN_OR_EQUAL,
|
||||
SIGN_TO_UNSIGN_NARROW,
|
||||
UNSIGN_TO_SIGN_NARROW_OR_EQUAL,
|
||||
};
|
||||
|
||||
// Template covering the different conversion tests.
|
||||
template <typename Dst, typename Src, NumericConversionType conversion>
|
||||
struct TestNumericConversion
|
||||
{
|
||||
};
|
||||
|
||||
// EXPECT_EQ wrappers providing specific detail on test failures.
|
||||
#define TEST_EXPECTED_RANGE(expected, actual) \
|
||||
EXPECT_EQ(expected, base::internal::DstRangeRelationToSrcRange<Dst>(actual)) \
|
||||
<< "Conversion test: " << src << " value " << actual << " to " << dst << " on line " \
|
||||
<< line;
|
||||
|
||||
template <typename Dst, typename Src>
|
||||
struct TestNumericConversion<Dst, Src, SIGN_PRESERVING_VALUE_PRESERVING>
|
||||
{
|
||||
static void Test(const char *dst, const char *src, int line)
|
||||
{
|
||||
typedef numeric_limits<Src> SrcLimits;
|
||||
typedef numeric_limits<Dst> DstLimits;
|
||||
// Integral to floating.
|
||||
static_assert(
|
||||
(DstLimits::is_iec559 && SrcLimits::is_integer) ||
|
||||
// Not floating to integral and...
|
||||
(!(DstLimits::is_integer && SrcLimits::is_iec559) &&
|
||||
// Same sign, same numeric, source is narrower or same.
|
||||
((SrcLimits::is_signed == DstLimits::is_signed && sizeof(Dst) >= sizeof(Src)) ||
|
||||
// Or signed destination and source is smaller
|
||||
(DstLimits::is_signed && sizeof(Dst) > sizeof(Src)))),
|
||||
"Comparison must be sign preserving and value preserving");
|
||||
|
||||
const CheckedNumeric<Dst> checked_dst = SrcLimits::max();
|
||||
TEST_EXPECTED_SUCCESS(checked_dst);
|
||||
if (MaxExponent<Dst>::value > MaxExponent<Src>::value)
|
||||
{
|
||||
if (MaxExponent<Dst>::value >= MaxExponent<Src>::value * 2 - 1)
|
||||
{
|
||||
// At least twice larger type.
|
||||
TEST_EXPECTED_SUCCESS(SrcLimits::max() * checked_dst);
|
||||
}
|
||||
else
|
||||
{ // Larger, but not at least twice as large.
|
||||
TEST_EXPECTED_FAILURE(SrcLimits::max() * checked_dst);
|
||||
TEST_EXPECTED_SUCCESS(checked_dst + 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // Same width type.
|
||||
TEST_EXPECTED_FAILURE(checked_dst + 1);
|
||||
}
|
||||
|
||||
TEST_EXPECTED_RANGE(RANGE_VALID, SrcLimits::max());
|
||||
TEST_EXPECTED_RANGE(RANGE_VALID, static_cast<Src>(1));
|
||||
if (SrcLimits::is_iec559)
|
||||
{
|
||||
TEST_EXPECTED_RANGE(RANGE_VALID, SrcLimits::max() * static_cast<Src>(-1));
|
||||
TEST_EXPECTED_RANGE(RANGE_OVERFLOW, SrcLimits::infinity());
|
||||
TEST_EXPECTED_RANGE(RANGE_UNDERFLOW, SrcLimits::infinity() * -1);
|
||||
TEST_EXPECTED_RANGE(RANGE_INVALID, SrcLimits::quiet_NaN());
|
||||
}
|
||||
else if (numeric_limits<Src>::is_signed)
|
||||
{
|
||||
TEST_EXPECTED_RANGE(RANGE_VALID, static_cast<Src>(-1));
|
||||
TEST_EXPECTED_RANGE(RANGE_VALID, SrcLimits::min());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Dst, typename Src>
|
||||
struct TestNumericConversion<Dst, Src, SIGN_PRESERVING_NARROW>
|
||||
{
|
||||
static void Test(const char *dst, const char *src, int line)
|
||||
{
|
||||
typedef numeric_limits<Src> SrcLimits;
|
||||
typedef numeric_limits<Dst> DstLimits;
|
||||
static_assert(SrcLimits::is_signed == DstLimits::is_signed,
|
||||
"Destination and source sign must be the same");
|
||||
static_assert(sizeof(Dst) < sizeof(Src) || (DstLimits::is_integer && SrcLimits::is_iec559),
|
||||
"Destination must be narrower than source");
|
||||
|
||||
const CheckedNumeric<Dst> checked_dst;
|
||||
TEST_EXPECTED_FAILURE(checked_dst + SrcLimits::max());
|
||||
TEST_EXPECTED_VALUE(1, checked_dst + static_cast<Src>(1));
|
||||
TEST_EXPECTED_FAILURE(checked_dst - SrcLimits::max());
|
||||
|
||||
TEST_EXPECTED_RANGE(RANGE_OVERFLOW, SrcLimits::max());
|
||||
TEST_EXPECTED_RANGE(RANGE_VALID, static_cast<Src>(1));
|
||||
if (SrcLimits::is_iec559)
|
||||
{
|
||||
TEST_EXPECTED_RANGE(RANGE_UNDERFLOW, SrcLimits::max() * -1);
|
||||
TEST_EXPECTED_RANGE(RANGE_VALID, static_cast<Src>(-1));
|
||||
TEST_EXPECTED_RANGE(RANGE_OVERFLOW, SrcLimits::infinity());
|
||||
TEST_EXPECTED_RANGE(RANGE_UNDERFLOW, SrcLimits::infinity() * -1);
|
||||
TEST_EXPECTED_RANGE(RANGE_INVALID, SrcLimits::quiet_NaN());
|
||||
if (DstLimits::is_integer)
|
||||
{
|
||||
if (SrcLimits::digits < DstLimits::digits)
|
||||
{
|
||||
TEST_EXPECTED_RANGE(RANGE_OVERFLOW, static_cast<Src>(DstLimits::max()));
|
||||
}
|
||||
else
|
||||
{
|
||||
TEST_EXPECTED_RANGE(RANGE_VALID, static_cast<Src>(DstLimits::max()));
|
||||
}
|
||||
TEST_EXPECTED_RANGE(RANGE_VALID,
|
||||
static_cast<Src>(GetMaxConvertibleToFloat<Src, Dst>()));
|
||||
TEST_EXPECTED_RANGE(RANGE_VALID, static_cast<Src>(DstLimits::min()));
|
||||
}
|
||||
}
|
||||
else if (SrcLimits::is_signed)
|
||||
{
|
||||
TEST_EXPECTED_VALUE(-1, checked_dst - static_cast<Src>(1));
|
||||
TEST_EXPECTED_RANGE(RANGE_UNDERFLOW, SrcLimits::min());
|
||||
TEST_EXPECTED_RANGE(RANGE_VALID, static_cast<Src>(-1));
|
||||
}
|
||||
else
|
||||
{
|
||||
TEST_EXPECTED_FAILURE(checked_dst - static_cast<Src>(1));
|
||||
TEST_EXPECTED_RANGE(RANGE_VALID, SrcLimits::min());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Dst, typename Src>
|
||||
struct TestNumericConversion<Dst, Src, SIGN_TO_UNSIGN_WIDEN_OR_EQUAL>
|
||||
{
|
||||
static void Test(const char *dst, const char *src, int line)
|
||||
{
|
||||
typedef numeric_limits<Src> SrcLimits;
|
||||
typedef numeric_limits<Dst> DstLimits;
|
||||
static_assert(sizeof(Dst) >= sizeof(Src),
|
||||
"Destination must be equal or wider than source.");
|
||||
static_assert(SrcLimits::is_signed, "Source must be signed");
|
||||
static_assert(!DstLimits::is_signed, "Destination must be unsigned");
|
||||
|
||||
const CheckedNumeric<Dst> checked_dst;
|
||||
TEST_EXPECTED_VALUE(SrcLimits::max(), checked_dst + SrcLimits::max());
|
||||
TEST_EXPECTED_FAILURE(checked_dst + static_cast<Src>(-1));
|
||||
TEST_EXPECTED_FAILURE(checked_dst + -SrcLimits::max());
|
||||
|
||||
TEST_EXPECTED_RANGE(RANGE_UNDERFLOW, SrcLimits::min());
|
||||
TEST_EXPECTED_RANGE(RANGE_VALID, SrcLimits::max());
|
||||
TEST_EXPECTED_RANGE(RANGE_VALID, static_cast<Src>(1));
|
||||
TEST_EXPECTED_RANGE(RANGE_UNDERFLOW, static_cast<Src>(-1));
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Dst, typename Src>
|
||||
struct TestNumericConversion<Dst, Src, SIGN_TO_UNSIGN_NARROW>
|
||||
{
|
||||
static void Test(const char *dst, const char *src, int line)
|
||||
{
|
||||
typedef numeric_limits<Src> SrcLimits;
|
||||
typedef numeric_limits<Dst> DstLimits;
|
||||
static_assert(
|
||||
(DstLimits::is_integer && SrcLimits::is_iec559) || (sizeof(Dst) < sizeof(Src)),
|
||||
"Destination must be narrower than source.");
|
||||
static_assert(SrcLimits::is_signed, "Source must be signed.");
|
||||
static_assert(!DstLimits::is_signed, "Destination must be unsigned.");
|
||||
|
||||
const CheckedNumeric<Dst> checked_dst;
|
||||
TEST_EXPECTED_VALUE(1, checked_dst + static_cast<Src>(1));
|
||||
TEST_EXPECTED_FAILURE(checked_dst + SrcLimits::max());
|
||||
TEST_EXPECTED_FAILURE(checked_dst + static_cast<Src>(-1));
|
||||
TEST_EXPECTED_FAILURE(checked_dst + -SrcLimits::max());
|
||||
|
||||
TEST_EXPECTED_RANGE(RANGE_OVERFLOW, SrcLimits::max());
|
||||
TEST_EXPECTED_RANGE(RANGE_VALID, static_cast<Src>(1));
|
||||
TEST_EXPECTED_RANGE(RANGE_UNDERFLOW, static_cast<Src>(-1));
|
||||
if (SrcLimits::is_iec559)
|
||||
{
|
||||
TEST_EXPECTED_RANGE(RANGE_UNDERFLOW, SrcLimits::max() * -1);
|
||||
TEST_EXPECTED_RANGE(RANGE_OVERFLOW, SrcLimits::infinity());
|
||||
TEST_EXPECTED_RANGE(RANGE_UNDERFLOW, SrcLimits::infinity() * -1);
|
||||
TEST_EXPECTED_RANGE(RANGE_INVALID, SrcLimits::quiet_NaN());
|
||||
if (DstLimits::is_integer)
|
||||
{
|
||||
if (SrcLimits::digits < DstLimits::digits)
|
||||
{
|
||||
TEST_EXPECTED_RANGE(RANGE_OVERFLOW, static_cast<Src>(DstLimits::max()));
|
||||
}
|
||||
else
|
||||
{
|
||||
TEST_EXPECTED_RANGE(RANGE_VALID, static_cast<Src>(DstLimits::max()));
|
||||
}
|
||||
TEST_EXPECTED_RANGE(RANGE_VALID,
|
||||
static_cast<Src>(GetMaxConvertibleToFloat<Src, Dst>()));
|
||||
TEST_EXPECTED_RANGE(RANGE_VALID, static_cast<Src>(DstLimits::min()));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
TEST_EXPECTED_RANGE(RANGE_UNDERFLOW, SrcLimits::min());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Dst, typename Src>
|
||||
struct TestNumericConversion<Dst, Src, UNSIGN_TO_SIGN_NARROW_OR_EQUAL>
|
||||
{
|
||||
static void Test(const char *dst, const char *src, int line)
|
||||
{
|
||||
typedef numeric_limits<Src> SrcLimits;
|
||||
typedef numeric_limits<Dst> DstLimits;
|
||||
static_assert(sizeof(Dst) <= sizeof(Src),
|
||||
"Destination must be narrower or equal to source.");
|
||||
static_assert(!SrcLimits::is_signed, "Source must be unsigned.");
|
||||
static_assert(DstLimits::is_signed, "Destination must be signed.");
|
||||
|
||||
const CheckedNumeric<Dst> checked_dst;
|
||||
TEST_EXPECTED_VALUE(1, checked_dst + static_cast<Src>(1));
|
||||
TEST_EXPECTED_FAILURE(checked_dst + SrcLimits::max());
|
||||
TEST_EXPECTED_VALUE(SrcLimits::min(), checked_dst + SrcLimits::min());
|
||||
|
||||
TEST_EXPECTED_RANGE(RANGE_VALID, SrcLimits::min());
|
||||
TEST_EXPECTED_RANGE(RANGE_OVERFLOW, SrcLimits::max());
|
||||
TEST_EXPECTED_RANGE(RANGE_VALID, static_cast<Src>(1));
|
||||
}
|
||||
};
|
||||
|
||||
// Helper macro to wrap displaying the conversion types and line numbers
|
||||
#define TEST_NUMERIC_CONVERSION(d, s, t) TestNumericConversion<d, s, t>::Test(#d, #s, __LINE__)
|
||||
|
||||
TEST(SafeNumerics, IntMinOperations)
|
||||
{
|
||||
TEST_NUMERIC_CONVERSION(int8_t, int8_t, SIGN_PRESERVING_VALUE_PRESERVING);
|
||||
TEST_NUMERIC_CONVERSION(uint8_t, uint8_t, SIGN_PRESERVING_VALUE_PRESERVING);
|
||||
|
||||
TEST_NUMERIC_CONVERSION(int8_t, int, SIGN_PRESERVING_NARROW);
|
||||
TEST_NUMERIC_CONVERSION(uint8_t, unsigned int, SIGN_PRESERVING_NARROW);
|
||||
TEST_NUMERIC_CONVERSION(int8_t, float, SIGN_PRESERVING_NARROW);
|
||||
|
||||
TEST_NUMERIC_CONVERSION(uint8_t, int8_t, SIGN_TO_UNSIGN_WIDEN_OR_EQUAL);
|
||||
|
||||
TEST_NUMERIC_CONVERSION(uint8_t, int, SIGN_TO_UNSIGN_NARROW);
|
||||
TEST_NUMERIC_CONVERSION(uint8_t, intmax_t, SIGN_TO_UNSIGN_NARROW);
|
||||
TEST_NUMERIC_CONVERSION(uint8_t, float, SIGN_TO_UNSIGN_NARROW);
|
||||
|
||||
TEST_NUMERIC_CONVERSION(int8_t, unsigned int, UNSIGN_TO_SIGN_NARROW_OR_EQUAL);
|
||||
TEST_NUMERIC_CONVERSION(int8_t, uintmax_t, UNSIGN_TO_SIGN_NARROW_OR_EQUAL);
|
||||
}
|
||||
|
||||
TEST(SafeNumerics, IntOperations)
|
||||
{
|
||||
TEST_NUMERIC_CONVERSION(int, int, SIGN_PRESERVING_VALUE_PRESERVING);
|
||||
TEST_NUMERIC_CONVERSION(unsigned int, unsigned int, SIGN_PRESERVING_VALUE_PRESERVING);
|
||||
TEST_NUMERIC_CONVERSION(int, int8_t, SIGN_PRESERVING_VALUE_PRESERVING);
|
||||
TEST_NUMERIC_CONVERSION(unsigned int, uint8_t, SIGN_PRESERVING_VALUE_PRESERVING);
|
||||
TEST_NUMERIC_CONVERSION(int, uint8_t, SIGN_PRESERVING_VALUE_PRESERVING);
|
||||
|
||||
TEST_NUMERIC_CONVERSION(int, intmax_t, SIGN_PRESERVING_NARROW);
|
||||
TEST_NUMERIC_CONVERSION(unsigned int, uintmax_t, SIGN_PRESERVING_NARROW);
|
||||
TEST_NUMERIC_CONVERSION(int, float, SIGN_PRESERVING_NARROW);
|
||||
TEST_NUMERIC_CONVERSION(int, double, SIGN_PRESERVING_NARROW);
|
||||
|
||||
TEST_NUMERIC_CONVERSION(unsigned int, int, SIGN_TO_UNSIGN_WIDEN_OR_EQUAL);
|
||||
TEST_NUMERIC_CONVERSION(unsigned int, int8_t, SIGN_TO_UNSIGN_WIDEN_OR_EQUAL);
|
||||
|
||||
TEST_NUMERIC_CONVERSION(unsigned int, intmax_t, SIGN_TO_UNSIGN_NARROW);
|
||||
TEST_NUMERIC_CONVERSION(unsigned int, float, SIGN_TO_UNSIGN_NARROW);
|
||||
TEST_NUMERIC_CONVERSION(unsigned int, double, SIGN_TO_UNSIGN_NARROW);
|
||||
|
||||
TEST_NUMERIC_CONVERSION(int, unsigned int, UNSIGN_TO_SIGN_NARROW_OR_EQUAL);
|
||||
TEST_NUMERIC_CONVERSION(int, uintmax_t, UNSIGN_TO_SIGN_NARROW_OR_EQUAL);
|
||||
}
|
||||
|
||||
TEST(SafeNumerics, IntMaxOperations)
|
||||
{
|
||||
TEST_NUMERIC_CONVERSION(intmax_t, intmax_t, SIGN_PRESERVING_VALUE_PRESERVING);
|
||||
TEST_NUMERIC_CONVERSION(uintmax_t, uintmax_t, SIGN_PRESERVING_VALUE_PRESERVING);
|
||||
TEST_NUMERIC_CONVERSION(intmax_t, int, SIGN_PRESERVING_VALUE_PRESERVING);
|
||||
TEST_NUMERIC_CONVERSION(uintmax_t, unsigned int, SIGN_PRESERVING_VALUE_PRESERVING);
|
||||
TEST_NUMERIC_CONVERSION(intmax_t, unsigned int, SIGN_PRESERVING_VALUE_PRESERVING);
|
||||
TEST_NUMERIC_CONVERSION(intmax_t, uint8_t, SIGN_PRESERVING_VALUE_PRESERVING);
|
||||
|
||||
TEST_NUMERIC_CONVERSION(intmax_t, float, SIGN_PRESERVING_NARROW);
|
||||
TEST_NUMERIC_CONVERSION(intmax_t, double, SIGN_PRESERVING_NARROW);
|
||||
|
||||
TEST_NUMERIC_CONVERSION(uintmax_t, int, SIGN_TO_UNSIGN_WIDEN_OR_EQUAL);
|
||||
TEST_NUMERIC_CONVERSION(uintmax_t, int8_t, SIGN_TO_UNSIGN_WIDEN_OR_EQUAL);
|
||||
|
||||
TEST_NUMERIC_CONVERSION(uintmax_t, float, SIGN_TO_UNSIGN_NARROW);
|
||||
TEST_NUMERIC_CONVERSION(uintmax_t, double, SIGN_TO_UNSIGN_NARROW);
|
||||
|
||||
TEST_NUMERIC_CONVERSION(intmax_t, uintmax_t, UNSIGN_TO_SIGN_NARROW_OR_EQUAL);
|
||||
}
|
||||
|
||||
TEST(SafeNumerics, FloatOperations)
|
||||
{
|
||||
TEST_NUMERIC_CONVERSION(float, intmax_t, SIGN_PRESERVING_VALUE_PRESERVING);
|
||||
TEST_NUMERIC_CONVERSION(float, uintmax_t, SIGN_PRESERVING_VALUE_PRESERVING);
|
||||
TEST_NUMERIC_CONVERSION(float, int, SIGN_PRESERVING_VALUE_PRESERVING);
|
||||
TEST_NUMERIC_CONVERSION(float, unsigned int, SIGN_PRESERVING_VALUE_PRESERVING);
|
||||
|
||||
TEST_NUMERIC_CONVERSION(float, double, SIGN_PRESERVING_NARROW);
|
||||
}
|
||||
|
||||
TEST(SafeNumerics, DoubleOperations)
|
||||
{
|
||||
TEST_NUMERIC_CONVERSION(double, intmax_t, SIGN_PRESERVING_VALUE_PRESERVING);
|
||||
TEST_NUMERIC_CONVERSION(double, uintmax_t, SIGN_PRESERVING_VALUE_PRESERVING);
|
||||
TEST_NUMERIC_CONVERSION(double, int, SIGN_PRESERVING_VALUE_PRESERVING);
|
||||
TEST_NUMERIC_CONVERSION(double, unsigned int, SIGN_PRESERVING_VALUE_PRESERVING);
|
||||
}
|
||||
|
||||
TEST(SafeNumerics, SizeTOperations)
|
||||
{
|
||||
TEST_NUMERIC_CONVERSION(size_t, int, SIGN_TO_UNSIGN_WIDEN_OR_EQUAL);
|
||||
TEST_NUMERIC_CONVERSION(int, size_t, UNSIGN_TO_SIGN_NARROW_OR_EQUAL);
|
||||
}
|
||||
|
||||
TEST(SafeNumerics, CastTests)
|
||||
{
|
||||
// MSVC catches and warns that we're forcing saturation in these tests.
|
||||
// Since that's intentional, we need to shut this warning off.
|
||||
#if defined(COMPILER_MSVC)
|
||||
#pragma warning(disable : 4756)
|
||||
#endif
|
||||
|
||||
int small_positive = 1;
|
||||
int small_negative = -1;
|
||||
double double_small = 1.0;
|
||||
double double_large = numeric_limits<double>::max();
|
||||
double double_infinity = numeric_limits<float>::infinity();
|
||||
double double_large_int = numeric_limits<int>::max();
|
||||
double double_small_int = numeric_limits<int>::min();
|
||||
|
||||
// Just test that the casts compile, since the other tests cover logic.
|
||||
EXPECT_EQ(0, checked_cast<int>(static_cast<size_t>(0)));
|
||||
EXPECT_EQ(0, strict_cast<int>(static_cast<char>(0)));
|
||||
EXPECT_EQ(0, strict_cast<int>(static_cast<unsigned char>(0)));
|
||||
EXPECT_EQ(0U, strict_cast<unsigned>(static_cast<unsigned char>(0)));
|
||||
EXPECT_EQ(1ULL, static_cast<uint64_t>(StrictNumeric<size_t>(1U)));
|
||||
EXPECT_EQ(1ULL, static_cast<uint64_t>(SizeT(1U)));
|
||||
EXPECT_EQ(1U, static_cast<size_t>(StrictNumeric<unsigned>(1U)));
|
||||
|
||||
EXPECT_TRUE(CheckedNumeric<uint64_t>(StrictNumeric<unsigned>(1U)).IsValid());
|
||||
EXPECT_TRUE(CheckedNumeric<int>(StrictNumeric<unsigned>(1U)).IsValid());
|
||||
EXPECT_FALSE(CheckedNumeric<unsigned>(StrictNumeric<int>(-1)).IsValid());
|
||||
|
||||
EXPECT_TRUE(IsValueNegative(-1));
|
||||
EXPECT_TRUE(IsValueNegative(numeric_limits<int>::min()));
|
||||
EXPECT_FALSE(IsValueNegative(numeric_limits<unsigned>::min()));
|
||||
EXPECT_TRUE(IsValueNegative(-numeric_limits<double>::max()));
|
||||
EXPECT_FALSE(IsValueNegative(0));
|
||||
EXPECT_FALSE(IsValueNegative(1));
|
||||
EXPECT_FALSE(IsValueNegative(0u));
|
||||
EXPECT_FALSE(IsValueNegative(1u));
|
||||
EXPECT_FALSE(IsValueNegative(numeric_limits<int>::max()));
|
||||
EXPECT_FALSE(IsValueNegative(numeric_limits<unsigned>::max()));
|
||||
EXPECT_FALSE(IsValueNegative(numeric_limits<double>::max()));
|
||||
|
||||
// These casts and coercions will fail to compile:
|
||||
// EXPECT_EQ(0, strict_cast<int>(static_cast<size_t>(0)));
|
||||
// EXPECT_EQ(0, strict_cast<size_t>(static_cast<int>(0)));
|
||||
// EXPECT_EQ(1ULL, StrictNumeric<size_t>(1));
|
||||
// EXPECT_EQ(1, StrictNumeric<size_t>(1U));
|
||||
|
||||
// Test various saturation corner cases.
|
||||
EXPECT_EQ(saturated_cast<int>(small_negative), static_cast<int>(small_negative));
|
||||
EXPECT_EQ(saturated_cast<int>(small_positive), static_cast<int>(small_positive));
|
||||
EXPECT_EQ(saturated_cast<unsigned>(small_negative), static_cast<unsigned>(0));
|
||||
EXPECT_EQ(saturated_cast<int>(double_small), static_cast<int>(double_small));
|
||||
EXPECT_EQ(saturated_cast<int>(double_large), numeric_limits<int>::max());
|
||||
EXPECT_EQ(saturated_cast<float>(double_large), double_infinity);
|
||||
EXPECT_EQ(saturated_cast<float>(-double_large), -double_infinity);
|
||||
EXPECT_EQ(numeric_limits<int>::min(), saturated_cast<int>(double_small_int));
|
||||
EXPECT_EQ(numeric_limits<int>::max(), saturated_cast<int>(double_large_int));
|
||||
|
||||
float not_a_number =
|
||||
std::numeric_limits<float>::infinity() - std::numeric_limits<float>::infinity();
|
||||
EXPECT_TRUE(std::isnan(not_a_number));
|
||||
EXPECT_EQ(0, saturated_cast<int>(not_a_number));
|
||||
}
|
||||
|
||||
#if GTEST_HAS_DEATH_TEST
|
||||
|
||||
TEST(SafeNumerics, SaturatedCastChecks)
|
||||
{
|
||||
float not_a_number =
|
||||
std::numeric_limits<float>::infinity() - std::numeric_limits<float>::infinity();
|
||||
EXPECT_TRUE(std::isnan(not_a_number));
|
||||
EXPECT_DEATH((saturated_cast<int, base::SaturatedCastNaNBehaviorCheck>(not_a_number)), "");
|
||||
}
|
||||
|
||||
#endif // GTEST_HAS_DEATH_TEST
|
||||
|
||||
TEST(SafeNumerics, IsValueInRangeForNumericType)
|
||||
{
|
||||
EXPECT_TRUE(IsValueInRangeForNumericType<uint32_t>(0));
|
||||
EXPECT_TRUE(IsValueInRangeForNumericType<uint32_t>(1));
|
||||
EXPECT_TRUE(IsValueInRangeForNumericType<uint32_t>(2));
|
||||
EXPECT_FALSE(IsValueInRangeForNumericType<uint32_t>(-1));
|
||||
EXPECT_TRUE(IsValueInRangeForNumericType<uint32_t>(0xffffffffu));
|
||||
EXPECT_TRUE(IsValueInRangeForNumericType<uint32_t>(UINT64_C(0xffffffff)));
|
||||
EXPECT_FALSE(IsValueInRangeForNumericType<uint32_t>(UINT64_C(0x100000000)));
|
||||
EXPECT_FALSE(IsValueInRangeForNumericType<uint32_t>(UINT64_C(0x100000001)));
|
||||
EXPECT_FALSE(IsValueInRangeForNumericType<uint32_t>(std::numeric_limits<int32_t>::min()));
|
||||
EXPECT_FALSE(IsValueInRangeForNumericType<uint32_t>(std::numeric_limits<int64_t>::min()));
|
||||
|
||||
EXPECT_TRUE(IsValueInRangeForNumericType<int32_t>(0));
|
||||
EXPECT_TRUE(IsValueInRangeForNumericType<int32_t>(1));
|
||||
EXPECT_TRUE(IsValueInRangeForNumericType<int32_t>(2));
|
||||
EXPECT_TRUE(IsValueInRangeForNumericType<int32_t>(-1));
|
||||
EXPECT_TRUE(IsValueInRangeForNumericType<int32_t>(0x7fffffff));
|
||||
EXPECT_TRUE(IsValueInRangeForNumericType<int32_t>(0x7fffffffu));
|
||||
EXPECT_FALSE(IsValueInRangeForNumericType<int32_t>(0x80000000u));
|
||||
EXPECT_FALSE(IsValueInRangeForNumericType<int32_t>(0xffffffffu));
|
||||
EXPECT_FALSE(IsValueInRangeForNumericType<int32_t>(INT64_C(0x80000000)));
|
||||
EXPECT_FALSE(IsValueInRangeForNumericType<int32_t>(INT64_C(0xffffffff)));
|
||||
EXPECT_FALSE(IsValueInRangeForNumericType<int32_t>(INT64_C(0x100000000)));
|
||||
EXPECT_TRUE(IsValueInRangeForNumericType<int32_t>(std::numeric_limits<int32_t>::min()));
|
||||
EXPECT_TRUE(IsValueInRangeForNumericType<int32_t>(
|
||||
static_cast<int64_t>(std::numeric_limits<int32_t>::min())));
|
||||
EXPECT_FALSE(IsValueInRangeForNumericType<int32_t>(
|
||||
static_cast<int64_t>(std::numeric_limits<int32_t>::min()) - 1));
|
||||
EXPECT_FALSE(IsValueInRangeForNumericType<int32_t>(std::numeric_limits<int64_t>::min()));
|
||||
|
||||
EXPECT_TRUE(IsValueInRangeForNumericType<uint64_t>(0));
|
||||
EXPECT_TRUE(IsValueInRangeForNumericType<uint64_t>(1));
|
||||
EXPECT_TRUE(IsValueInRangeForNumericType<uint64_t>(2));
|
||||
EXPECT_FALSE(IsValueInRangeForNumericType<uint64_t>(-1));
|
||||
EXPECT_TRUE(IsValueInRangeForNumericType<uint64_t>(0xffffffffu));
|
||||
EXPECT_TRUE(IsValueInRangeForNumericType<uint64_t>(UINT64_C(0xffffffff)));
|
||||
EXPECT_TRUE(IsValueInRangeForNumericType<uint64_t>(UINT64_C(0x100000000)));
|
||||
EXPECT_TRUE(IsValueInRangeForNumericType<uint64_t>(UINT64_C(0x100000001)));
|
||||
EXPECT_FALSE(IsValueInRangeForNumericType<uint64_t>(std::numeric_limits<int32_t>::min()));
|
||||
EXPECT_FALSE(IsValueInRangeForNumericType<uint64_t>(INT64_C(-1)));
|
||||
EXPECT_FALSE(IsValueInRangeForNumericType<uint64_t>(std::numeric_limits<int64_t>::min()));
|
||||
|
||||
EXPECT_TRUE(IsValueInRangeForNumericType<int64_t>(0));
|
||||
EXPECT_TRUE(IsValueInRangeForNumericType<int64_t>(1));
|
||||
EXPECT_TRUE(IsValueInRangeForNumericType<int64_t>(2));
|
||||
EXPECT_TRUE(IsValueInRangeForNumericType<int64_t>(-1));
|
||||
EXPECT_TRUE(IsValueInRangeForNumericType<int64_t>(0x7fffffff));
|
||||
EXPECT_TRUE(IsValueInRangeForNumericType<int64_t>(0x7fffffffu));
|
||||
EXPECT_TRUE(IsValueInRangeForNumericType<int64_t>(0x80000000u));
|
||||
EXPECT_TRUE(IsValueInRangeForNumericType<int64_t>(0xffffffffu));
|
||||
EXPECT_TRUE(IsValueInRangeForNumericType<int64_t>(INT64_C(0x80000000)));
|
||||
EXPECT_TRUE(IsValueInRangeForNumericType<int64_t>(INT64_C(0xffffffff)));
|
||||
EXPECT_TRUE(IsValueInRangeForNumericType<int64_t>(INT64_C(0x100000000)));
|
||||
EXPECT_TRUE(IsValueInRangeForNumericType<int64_t>(INT64_C(0x7fffffffffffffff)));
|
||||
EXPECT_TRUE(IsValueInRangeForNumericType<int64_t>(UINT64_C(0x7fffffffffffffff)));
|
||||
EXPECT_FALSE(IsValueInRangeForNumericType<int64_t>(UINT64_C(0x8000000000000000)));
|
||||
EXPECT_FALSE(IsValueInRangeForNumericType<int64_t>(UINT64_C(0xffffffffffffffff)));
|
||||
EXPECT_TRUE(IsValueInRangeForNumericType<int64_t>(std::numeric_limits<int32_t>::min()));
|
||||
EXPECT_TRUE(IsValueInRangeForNumericType<int64_t>(
|
||||
static_cast<int64_t>(std::numeric_limits<int32_t>::min())));
|
||||
EXPECT_TRUE(IsValueInRangeForNumericType<int64_t>(std::numeric_limits<int64_t>::min()));
|
||||
}
|
||||
|
||||
TEST(SafeNumerics, CompoundNumericOperations)
|
||||
{
|
||||
CheckedNumeric<int> a = 1;
|
||||
CheckedNumeric<int> b = 2;
|
||||
CheckedNumeric<int> c = 3;
|
||||
CheckedNumeric<int> d = 4;
|
||||
a += b;
|
||||
EXPECT_EQ(3, a.ValueOrDie());
|
||||
a -= c;
|
||||
EXPECT_EQ(0, a.ValueOrDie());
|
||||
d /= b;
|
||||
EXPECT_EQ(2, d.ValueOrDie());
|
||||
d *= d;
|
||||
EXPECT_EQ(4, d.ValueOrDie());
|
||||
|
||||
CheckedNumeric<int> too_large = std::numeric_limits<int>::max();
|
||||
EXPECT_TRUE(too_large.IsValid());
|
||||
too_large += d;
|
||||
EXPECT_FALSE(too_large.IsValid());
|
||||
too_large -= d;
|
||||
EXPECT_FALSE(too_large.IsValid());
|
||||
too_large /= d;
|
||||
EXPECT_FALSE(too_large.IsValid());
|
||||
}
|
245
src/3rdparty/angle/src/common/third_party/base/anglebase/sha1.cc
vendored
Normal file
245
src/3rdparty/angle/src/common/third_party/base/anglebase/sha1.cc
vendored
Normal file
@ -0,0 +1,245 @@
|
||||
// Copyright (c) 2011 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.
|
||||
|
||||
#include "anglebase/sha1.h"
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "anglebase/sys_byteorder.h"
|
||||
|
||||
namespace angle
|
||||
{
|
||||
|
||||
namespace base
|
||||
{
|
||||
|
||||
// Implementation of SHA-1. Only handles data in byte-sized blocks,
|
||||
// which simplifies the code a fair bit.
|
||||
|
||||
// Identifier names follow notation in FIPS PUB 180-3, where you'll
|
||||
// also find a description of the algorithm:
|
||||
// http://csrc.nist.gov/publications/fips/fips180-3/fips180-3_final.pdf
|
||||
|
||||
// Usage example:
|
||||
//
|
||||
// SecureHashAlgorithm sha;
|
||||
// while(there is data to hash)
|
||||
// sha.Update(moredata, size of data);
|
||||
// sha.Final();
|
||||
// memcpy(somewhere, sha.Digest(), 20);
|
||||
//
|
||||
// to reuse the instance of sha, call sha.Init();
|
||||
|
||||
// TODO(jhawkins): Replace this implementation with a per-platform
|
||||
// implementation using each platform's crypto library. See
|
||||
// http://crbug.com/47218
|
||||
|
||||
class SecureHashAlgorithm
|
||||
{
|
||||
public:
|
||||
SecureHashAlgorithm() { Init(); }
|
||||
|
||||
static const int kDigestSizeBytes;
|
||||
|
||||
void Init();
|
||||
void Update(const void *data, size_t nbytes);
|
||||
void Final();
|
||||
|
||||
// 20 bytes of message digest.
|
||||
const unsigned char *Digest() const { return reinterpret_cast<const unsigned char *>(H); }
|
||||
|
||||
private:
|
||||
void Pad();
|
||||
void Process();
|
||||
|
||||
uint32_t A, B, C, D, E;
|
||||
|
||||
uint32_t H[5];
|
||||
|
||||
union {
|
||||
uint32_t W[80];
|
||||
uint8_t M[64];
|
||||
};
|
||||
|
||||
uint32_t cursor;
|
||||
uint64_t l;
|
||||
};
|
||||
|
||||
static inline uint32_t f(uint32_t t, uint32_t B, uint32_t C, uint32_t D)
|
||||
{
|
||||
if (t < 20)
|
||||
{
|
||||
return (B & C) | ((~B) & D);
|
||||
}
|
||||
else if (t < 40)
|
||||
{
|
||||
return B ^ C ^ D;
|
||||
}
|
||||
else if (t < 60)
|
||||
{
|
||||
return (B & C) | (B & D) | (C & D);
|
||||
}
|
||||
else
|
||||
{
|
||||
return B ^ C ^ D;
|
||||
}
|
||||
}
|
||||
|
||||
static inline uint32_t S(uint32_t n, uint32_t X)
|
||||
{
|
||||
return (X << n) | (X >> (32 - n));
|
||||
}
|
||||
|
||||
static inline uint32_t K(uint32_t t)
|
||||
{
|
||||
if (t < 20)
|
||||
{
|
||||
return 0x5a827999;
|
||||
}
|
||||
else if (t < 40)
|
||||
{
|
||||
return 0x6ed9eba1;
|
||||
}
|
||||
else if (t < 60)
|
||||
{
|
||||
return 0x8f1bbcdc;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0xca62c1d6;
|
||||
}
|
||||
}
|
||||
|
||||
const int SecureHashAlgorithm::kDigestSizeBytes = 20;
|
||||
|
||||
void SecureHashAlgorithm::Init()
|
||||
{
|
||||
A = 0;
|
||||
B = 0;
|
||||
C = 0;
|
||||
D = 0;
|
||||
E = 0;
|
||||
cursor = 0;
|
||||
l = 0;
|
||||
H[0] = 0x67452301;
|
||||
H[1] = 0xefcdab89;
|
||||
H[2] = 0x98badcfe;
|
||||
H[3] = 0x10325476;
|
||||
H[4] = 0xc3d2e1f0;
|
||||
}
|
||||
|
||||
void SecureHashAlgorithm::Final()
|
||||
{
|
||||
Pad();
|
||||
Process();
|
||||
|
||||
for (int t = 0; t < 5; ++t)
|
||||
H[t] = ByteSwap(H[t]);
|
||||
}
|
||||
|
||||
void SecureHashAlgorithm::Update(const void *data, size_t nbytes)
|
||||
{
|
||||
const uint8_t *d = reinterpret_cast<const uint8_t *>(data);
|
||||
while (nbytes--)
|
||||
{
|
||||
M[cursor++] = *d++;
|
||||
if (cursor >= 64)
|
||||
Process();
|
||||
l += 8;
|
||||
}
|
||||
}
|
||||
|
||||
void SecureHashAlgorithm::Pad()
|
||||
{
|
||||
M[cursor++] = 0x80;
|
||||
|
||||
if (cursor > 64 - 8)
|
||||
{
|
||||
// pad out to next block
|
||||
while (cursor < 64)
|
||||
M[cursor++] = 0;
|
||||
|
||||
Process();
|
||||
}
|
||||
|
||||
while (cursor < 64 - 8)
|
||||
M[cursor++] = 0;
|
||||
|
||||
M[cursor++] = (l >> 56) & 0xff;
|
||||
M[cursor++] = (l >> 48) & 0xff;
|
||||
M[cursor++] = (l >> 40) & 0xff;
|
||||
M[cursor++] = (l >> 32) & 0xff;
|
||||
M[cursor++] = (l >> 24) & 0xff;
|
||||
M[cursor++] = (l >> 16) & 0xff;
|
||||
M[cursor++] = (l >> 8) & 0xff;
|
||||
M[cursor++] = l & 0xff;
|
||||
}
|
||||
|
||||
void SecureHashAlgorithm::Process()
|
||||
{
|
||||
uint32_t t;
|
||||
|
||||
// Each a...e corresponds to a section in the FIPS 180-3 algorithm.
|
||||
|
||||
// a.
|
||||
//
|
||||
// W and M are in a union, so no need to memcpy.
|
||||
// memcpy(W, M, sizeof(M));
|
||||
for (t = 0; t < 16; ++t)
|
||||
W[t] = ByteSwap(W[t]);
|
||||
|
||||
// b.
|
||||
for (t = 16; t < 80; ++t)
|
||||
W[t] = S(1, W[t - 3] ^ W[t - 8] ^ W[t - 14] ^ W[t - 16]);
|
||||
|
||||
// c.
|
||||
A = H[0];
|
||||
B = H[1];
|
||||
C = H[2];
|
||||
D = H[3];
|
||||
E = H[4];
|
||||
|
||||
// d.
|
||||
for (t = 0; t < 80; ++t)
|
||||
{
|
||||
uint32_t TEMP = S(5, A) + f(t, B, C, D) + E + W[t] + K(t);
|
||||
E = D;
|
||||
D = C;
|
||||
C = S(30, B);
|
||||
B = A;
|
||||
A = TEMP;
|
||||
}
|
||||
|
||||
// e.
|
||||
H[0] += A;
|
||||
H[1] += B;
|
||||
H[2] += C;
|
||||
H[3] += D;
|
||||
H[4] += E;
|
||||
|
||||
cursor = 0;
|
||||
}
|
||||
|
||||
std::string SHA1HashString(const std::string &str)
|
||||
{
|
||||
char hash[SecureHashAlgorithm::kDigestSizeBytes];
|
||||
SHA1HashBytes(reinterpret_cast<const unsigned char *>(str.c_str()), str.length(),
|
||||
reinterpret_cast<unsigned char *>(hash));
|
||||
return std::string(hash, SecureHashAlgorithm::kDigestSizeBytes);
|
||||
}
|
||||
|
||||
void SHA1HashBytes(const unsigned char *data, size_t len, unsigned char *hash)
|
||||
{
|
||||
SecureHashAlgorithm sha;
|
||||
sha.Update(data, len);
|
||||
sha.Final();
|
||||
|
||||
memcpy(hash, sha.Digest(), SecureHashAlgorithm::kDigestSizeBytes);
|
||||
}
|
||||
|
||||
} // namespace base
|
||||
|
||||
} // namespace angle
|
36
src/3rdparty/angle/src/common/third_party/base/anglebase/sha1.h
vendored
Normal file
36
src/3rdparty/angle/src/common/third_party/base/anglebase/sha1.h
vendored
Normal file
@ -0,0 +1,36 @@
|
||||
// Copyright (c) 2011 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.
|
||||
|
||||
#ifndef ANGLEBASE_SHA1_H_
|
||||
#define ANGLEBASE_SHA1_H_
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "anglebase/base_export.h"
|
||||
|
||||
namespace angle
|
||||
{
|
||||
|
||||
namespace base
|
||||
{
|
||||
|
||||
// These functions perform SHA-1 operations.
|
||||
|
||||
static const size_t kSHA1Length = 20; // Length in bytes of a SHA-1 hash.
|
||||
|
||||
// Computes the SHA-1 hash of the input string |str| and returns the full
|
||||
// hash.
|
||||
ANGLEBASE_EXPORT std::string SHA1HashString(const std::string &str);
|
||||
|
||||
// Computes the SHA-1 hash of the |len| bytes in |data| and puts the hash
|
||||
// in |hash|. |hash| must be kSHA1Length bytes long.
|
||||
ANGLEBASE_EXPORT void SHA1HashBytes(const unsigned char *data, size_t len, unsigned char *hash);
|
||||
|
||||
} // namespace base
|
||||
|
||||
} // namespace angle
|
||||
|
||||
#endif // ANGLEBASE_SHA1_H_
|
49
src/3rdparty/angle/src/common/third_party/base/anglebase/sys_byteorder.h
vendored
Normal file
49
src/3rdparty/angle/src/common/third_party/base/anglebase/sys_byteorder.h
vendored
Normal file
@ -0,0 +1,49 @@
|
||||
//
|
||||
// Copyright 2017 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.
|
||||
//
|
||||
// sys_byteorder.h: Compatiblity hacks for importing Chromium's base/SHA1.
|
||||
|
||||
#ifndef ANGLEBASE_SYS_BYTEORDER_H_
|
||||
#define ANGLEBASE_SYS_BYTEORDER_H_
|
||||
|
||||
namespace angle
|
||||
{
|
||||
|
||||
namespace base
|
||||
{
|
||||
|
||||
// Returns a value with all bytes in |x| swapped, i.e. reverses the endianness.
|
||||
inline uint16_t ByteSwap(uint16_t x)
|
||||
{
|
||||
#if defined(_MSC_VER)
|
||||
return _byteswap_ushort(x);
|
||||
#else
|
||||
return __builtin_bswap16(x);
|
||||
#endif
|
||||
}
|
||||
|
||||
inline uint32_t ByteSwap(uint32_t x)
|
||||
{
|
||||
#if defined(_MSC_VER)
|
||||
return _byteswap_ulong(x);
|
||||
#else
|
||||
return __builtin_bswap32(x);
|
||||
#endif
|
||||
}
|
||||
|
||||
inline uint64_t ByteSwap(uint64_t x)
|
||||
{
|
||||
#if defined(_MSC_VER)
|
||||
return _byteswap_uint64(x);
|
||||
#else
|
||||
return __builtin_bswap64(x);
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace base
|
||||
|
||||
} // namespace angle
|
||||
|
||||
#endif // ANGLEBASE_SYS_BYTEORDER_H_
|
23
src/3rdparty/angle/src/common/third_party/smhasher/LICENSE
vendored
Normal file
23
src/3rdparty/angle/src/common/third_party/smhasher/LICENSE
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
All MurmurHash source files are placed in the public domain.
|
||||
|
||||
The license below applies to all other code in SMHasher:
|
||||
|
||||
Copyright (c) 2011 Google, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
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 Software.
|
||||
|
||||
THE SOFTWARE IS 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 SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
14
src/3rdparty/angle/src/common/third_party/smhasher/README.angle
vendored
Normal file
14
src/3rdparty/angle/src/common/third_party/smhasher/README.angle
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
Name: SMHasher
|
||||
URL: http://code.google.com/p/smhasher/
|
||||
Version: 0
|
||||
Revision: 147
|
||||
License: MIT, Public Domain
|
||||
License File: LICENSE
|
||||
Security Critical: yes
|
||||
|
||||
Description:
|
||||
This is a library containing the MurmurHash3 function, and a hashing function
|
||||
test suite.
|
||||
|
||||
Licenses are MIT (SMHasher) and Public Domain (MurmurHash).
|
||||
|
320
src/3rdparty/angle/src/common/third_party/smhasher/src/PMurHash.cpp
vendored
Normal file
320
src/3rdparty/angle/src/common/third_party/smhasher/src/PMurHash.cpp
vendored
Normal file
@ -0,0 +1,320 @@
|
||||
/*-----------------------------------------------------------------------------
|
||||
* MurmurHash3 was written by Austin Appleby, and is placed in the public
|
||||
* domain.
|
||||
*
|
||||
* This implementation was written by Shane Day, and is also public domain.
|
||||
*
|
||||
* This is a portable ANSI C implementation of MurmurHash3_x86_32 (Murmur3A)
|
||||
* with support for progressive processing.
|
||||
*/
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
|
||||
If you want to understand the MurmurHash algorithm you would be much better
|
||||
off reading the original source. Just point your browser at:
|
||||
http://code.google.com/p/smhasher/source/browse/trunk/MurmurHash3.cpp
|
||||
|
||||
|
||||
What this version provides?
|
||||
|
||||
1. Progressive data feeding. Useful when the entire payload to be hashed
|
||||
does not fit in memory or when the data is streamed through the application.
|
||||
Also useful when hashing a number of strings with a common prefix. A partial
|
||||
hash of a prefix string can be generated and reused for each suffix string.
|
||||
|
||||
2. Portability. Plain old C so that it should compile on any old compiler.
|
||||
Both CPU endian and access-alignment neutral, but avoiding inefficient code
|
||||
when possible depending on CPU capabilities.
|
||||
|
||||
3. Drop in. I personally like nice self contained public domain code, making it
|
||||
easy to pilfer without loads of refactoring to work properly in the existing
|
||||
application code & makefile structure and mucking around with licence files.
|
||||
Just copy PMurHash.h and PMurHash.c and you're ready to go.
|
||||
|
||||
|
||||
How does it work?
|
||||
|
||||
We can only process entire 32 bit chunks of input, except for the very end
|
||||
that may be shorter. So along with the partial hash we need to give back to
|
||||
the caller a carry containing up to 3 bytes that we were unable to process.
|
||||
This carry also needs to record the number of bytes the carry holds. I use
|
||||
the low 2 bits as a count (0..3) and the carry bytes are shifted into the
|
||||
high byte in stream order.
|
||||
|
||||
To handle endianess I simply use a macro that reads a uint32_t and define
|
||||
that macro to be a direct read on little endian machines, a read and swap
|
||||
on big endian machines, or a byte-by-byte read if the endianess is unknown.
|
||||
|
||||
-----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
#include "PMurHash.h"
|
||||
|
||||
/* I used ugly type names in the header to avoid potential conflicts with
|
||||
* application or system typedefs & defines. Since I'm not including any more
|
||||
* headers below here I can rename these so that the code reads like C99 */
|
||||
#undef uint32_t
|
||||
#define uint32_t MH_UINT32
|
||||
#undef uint8_t
|
||||
#define uint8_t MH_UINT8
|
||||
|
||||
/* MSVC warnings we choose to ignore */
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning(disable: 4127) /* conditional expression is constant */
|
||||
#endif
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
* Endianess, misalignment capabilities and util macros
|
||||
*
|
||||
* The following 3 macros are defined in this section. The other macros defined
|
||||
* are only needed to help derive these 3.
|
||||
*
|
||||
* READ_UINT32(x) Read a little endian unsigned 32-bit int
|
||||
* UNALIGNED_SAFE Defined if READ_UINT32 works on non-word boundaries
|
||||
* ROTL32(x,r) Rotate x left by r bits
|
||||
*/
|
||||
|
||||
/* Convention is to define __BYTE_ORDER == to one of these values */
|
||||
#if !defined(__BIG_ENDIAN)
|
||||
#define __BIG_ENDIAN 4321
|
||||
#endif
|
||||
#if !defined(__LITTLE_ENDIAN)
|
||||
#define __LITTLE_ENDIAN 1234
|
||||
#endif
|
||||
|
||||
/* I386 */
|
||||
#if defined(_M_IX86) || defined(__i386__) || defined(__i386) || defined(i386)
|
||||
#define __BYTE_ORDER __LITTLE_ENDIAN
|
||||
#define UNALIGNED_SAFE
|
||||
#endif
|
||||
|
||||
/* gcc 'may' define __LITTLE_ENDIAN__ or __BIG_ENDIAN__ to 1 (Note the trailing __),
|
||||
* or even _LITTLE_ENDIAN or _BIG_ENDIAN (Note the single _ prefix) */
|
||||
#if !defined(__BYTE_ORDER)
|
||||
#if defined(__LITTLE_ENDIAN__) && __LITTLE_ENDIAN__==1 || defined(_LITTLE_ENDIAN) && _LITTLE_ENDIAN==1
|
||||
#define __BYTE_ORDER __LITTLE_ENDIAN
|
||||
#elif defined(__BIG_ENDIAN__) && __BIG_ENDIAN__==1 || defined(_BIG_ENDIAN) && _BIG_ENDIAN==1
|
||||
#define __BYTE_ORDER __BIG_ENDIAN
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* gcc (usually) defines xEL/EB macros for ARM and MIPS endianess */
|
||||
#if !defined(__BYTE_ORDER)
|
||||
#if defined(__ARMEL__) || defined(__MIPSEL__)
|
||||
#define __BYTE_ORDER __LITTLE_ENDIAN
|
||||
#endif
|
||||
#if defined(__ARMEB__) || defined(__MIPSEB__)
|
||||
#define __BYTE_ORDER __BIG_ENDIAN
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Now find best way we can to READ_UINT32 */
|
||||
#if __BYTE_ORDER==__LITTLE_ENDIAN
|
||||
/* CPU endian matches murmurhash algorithm, so read 32-bit word directly */
|
||||
#define READ_UINT32(ptr) (*((uint32_t*)(ptr)))
|
||||
#elif __BYTE_ORDER==__BIG_ENDIAN
|
||||
/* TODO: Add additional cases below where a compiler provided bswap32 is available */
|
||||
#if defined(__GNUC__) && (__GNUC__>4 || (__GNUC__==4 && __GNUC_MINOR__>=3))
|
||||
#define READ_UINT32(ptr) (__builtin_bswap32(*((uint32_t*)(ptr))))
|
||||
#else
|
||||
/* Without a known fast bswap32 we're just as well off doing this */
|
||||
#define READ_UINT32(ptr) (ptr[0]|ptr[1]<<8|ptr[2]<<16|ptr[3]<<24)
|
||||
#define UNALIGNED_SAFE
|
||||
#endif
|
||||
#else
|
||||
/* Unknown endianess so last resort is to read individual bytes */
|
||||
#define READ_UINT32(ptr) (ptr[0]|ptr[1]<<8|ptr[2]<<16|ptr[3]<<24)
|
||||
|
||||
/* Since we're not doing word-reads we can skip the messing about with realignment */
|
||||
#define UNALIGNED_SAFE
|
||||
#endif
|
||||
|
||||
/* Find best way to ROTL32 */
|
||||
#if defined(_MSC_VER)
|
||||
#include <stdlib.h> /* Microsoft put _rotl declaration in here */
|
||||
#define ROTL32(x,r) _rotl(x,r)
|
||||
#else
|
||||
/* gcc recognises this code and generates a rotate instruction for CPUs with one */
|
||||
#define ROTL32(x,r) (((uint32_t)x << r) | ((uint32_t)x >> (32 - r)))
|
||||
#endif
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
* Core murmurhash algorithm macros */
|
||||
|
||||
#define C1 (0xcc9e2d51)
|
||||
#define C2 (0x1b873593)
|
||||
|
||||
/* This is the main processing body of the algorithm. It operates
|
||||
* on each full 32-bits of input. */
|
||||
#define DOBLOCK(h1, k1) do{ \
|
||||
k1 *= C1; \
|
||||
k1 = ROTL32(k1,15); \
|
||||
k1 *= C2; \
|
||||
\
|
||||
h1 ^= k1; \
|
||||
h1 = ROTL32(h1,13); \
|
||||
h1 = h1*5+0xe6546b64; \
|
||||
}while(0)
|
||||
|
||||
|
||||
/* Append unaligned bytes to carry, forcing hash churn if we have 4 bytes */
|
||||
/* cnt=bytes to process, h1=name of h1 var, c=carry, n=bytes in c, ptr/len=payload */
|
||||
#define DOBYTES(cnt, h1, c, n, ptr, len) do{ \
|
||||
int _i = cnt; \
|
||||
while(_i--) { \
|
||||
c = c>>8 | *ptr++<<24; \
|
||||
n++; len--; \
|
||||
if(n==4) { \
|
||||
DOBLOCK(h1, c); \
|
||||
n = 0; \
|
||||
} \
|
||||
} }while(0)
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
namespace angle
|
||||
{
|
||||
/* Main hashing function. Initialise carry to 0 and h1 to 0 or an initial seed
|
||||
* if wanted. Both ph1 and pcarry are required arguments. */
|
||||
void PMurHash32_Process(uint32_t *ph1, uint32_t *pcarry, const void *key, int len)
|
||||
{
|
||||
uint32_t h1 = *ph1;
|
||||
uint32_t c = *pcarry;
|
||||
|
||||
const uint8_t *ptr = (uint8_t*)key;
|
||||
const uint8_t *end;
|
||||
|
||||
/* Extract carry count from low 2 bits of c value */
|
||||
int n = c & 3;
|
||||
|
||||
#if defined(UNALIGNED_SAFE)
|
||||
/* This CPU handles unaligned word access */
|
||||
|
||||
/* Consume any carry bytes */
|
||||
int i = (4-n) & 3;
|
||||
if(i && i <= len) {
|
||||
DOBYTES(i, h1, c, n, ptr, len);
|
||||
}
|
||||
|
||||
/* Process 32-bit chunks */
|
||||
end = ptr + len/4*4;
|
||||
for( ; ptr < end ; ptr+=4) {
|
||||
uint32_t k1 = READ_UINT32(ptr);
|
||||
DOBLOCK(h1, k1);
|
||||
}
|
||||
|
||||
#else /*UNALIGNED_SAFE*/
|
||||
/* This CPU does not handle unaligned word access */
|
||||
|
||||
/* Consume enough so that the next data byte is word aligned */
|
||||
int i = -(long)ptr & 3;
|
||||
if(i && i <= len) {
|
||||
DOBYTES(i, h1, c, n, ptr, len);
|
||||
}
|
||||
|
||||
/* We're now aligned. Process in aligned blocks. Specialise for each possible carry count */
|
||||
end = ptr + len/4*4;
|
||||
switch(n) { /* how many bytes in c */
|
||||
case 0: /* c=[----] w=[3210] b=[3210]=w c'=[----] */
|
||||
for( ; ptr < end ; ptr+=4) {
|
||||
uint32_t k1 = READ_UINT32(ptr);
|
||||
DOBLOCK(h1, k1);
|
||||
}
|
||||
break;
|
||||
case 1: /* c=[0---] w=[4321] b=[3210]=c>>24|w<<8 c'=[4---] */
|
||||
for( ; ptr < end ; ptr+=4) {
|
||||
uint32_t k1 = c>>24;
|
||||
c = READ_UINT32(ptr);
|
||||
k1 |= c<<8;
|
||||
DOBLOCK(h1, k1);
|
||||
}
|
||||
break;
|
||||
case 2: /* c=[10--] w=[5432] b=[3210]=c>>16|w<<16 c'=[54--] */
|
||||
for( ; ptr < end ; ptr+=4) {
|
||||
uint32_t k1 = c>>16;
|
||||
c = READ_UINT32(ptr);
|
||||
k1 |= c<<16;
|
||||
DOBLOCK(h1, k1);
|
||||
}
|
||||
break;
|
||||
case 3: /* c=[210-] w=[6543] b=[3210]=c>>8|w<<24 c'=[654-] */
|
||||
for( ; ptr < end ; ptr+=4) {
|
||||
uint32_t k1 = c>>8;
|
||||
c = READ_UINT32(ptr);
|
||||
k1 |= c<<24;
|
||||
DOBLOCK(h1, k1);
|
||||
}
|
||||
}
|
||||
#endif /*UNALIGNED_SAFE*/
|
||||
|
||||
/* Advance over whole 32-bit chunks, possibly leaving 1..3 bytes */
|
||||
len -= len/4*4;
|
||||
|
||||
/* Append any remaining bytes into carry */
|
||||
DOBYTES(len, h1, c, n, ptr, len);
|
||||
|
||||
/* Copy out new running hash and carry */
|
||||
*ph1 = h1;
|
||||
*pcarry = (c & ~0xff) | n;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
/* Finalize a hash. To match the original Murmur3A the total_length must be provided */
|
||||
uint32_t PMurHash32_Result(uint32_t h, uint32_t carry, uint32_t total_length)
|
||||
{
|
||||
uint32_t k1;
|
||||
int n = carry & 3;
|
||||
if(n) {
|
||||
k1 = carry >> (4-n)*8;
|
||||
k1 *= C1; k1 = ROTL32(k1,15); k1 *= C2; h ^= k1;
|
||||
}
|
||||
h ^= total_length;
|
||||
|
||||
/* fmix */
|
||||
h ^= h >> 16;
|
||||
h *= 0x85ebca6b;
|
||||
h ^= h >> 13;
|
||||
h *= 0xc2b2ae35;
|
||||
h ^= h >> 16;
|
||||
|
||||
return h;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
/* Murmur3A compatable all-at-once */
|
||||
uint32_t PMurHash32(uint32_t seed, const void *key, int len)
|
||||
{
|
||||
uint32_t h1=seed, carry=0;
|
||||
PMurHash32_Process(&h1, &carry, key, len);
|
||||
return PMurHash32_Result(h1, carry, len);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
/* Provide an API suitable for smhasher */
|
||||
void PMurHash32_test(const void *key, int len, uint32_t seed, void *out)
|
||||
{
|
||||
uint32_t h1=seed, carry=0;
|
||||
const uint8_t *ptr = (uint8_t*)key;
|
||||
const uint8_t *end = ptr + len;
|
||||
|
||||
#if 0 /* Exercise the progressive processing */
|
||||
while(ptr < end) {
|
||||
//const uint8_t *mid = ptr + rand()%(end-ptr)+1;
|
||||
const uint8_t *mid = ptr + (rand()&0xF);
|
||||
mid = mid<end?mid:end;
|
||||
PMurHash32_Process(&h1, &carry, ptr, mid-ptr);
|
||||
ptr = mid;
|
||||
}
|
||||
#else
|
||||
PMurHash32_Process(&h1, &carry, ptr, (int)(end-ptr));
|
||||
#endif
|
||||
h1 = PMurHash32_Result(h1, carry, len);
|
||||
*(uint32_t*)out = h1;
|
||||
}
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
59
src/3rdparty/angle/src/common/third_party/smhasher/src/PMurHash.h
vendored
Normal file
59
src/3rdparty/angle/src/common/third_party/smhasher/src/PMurHash.h
vendored
Normal file
@ -0,0 +1,59 @@
|
||||
/*-----------------------------------------------------------------------------
|
||||
* MurmurHash3 was written by Austin Appleby, and is placed in the public
|
||||
* domain.
|
||||
*
|
||||
* This implementation was written by Shane Day, and is also public domain.
|
||||
*
|
||||
* This is a portable ANSI C implementation of MurmurHash3_x86_32 (Murmur3A)
|
||||
* with support for progressive processing.
|
||||
*/
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* Determine what native type to use for uint32_t */
|
||||
|
||||
/* We can't use the name 'uint32_t' here because it will conflict with
|
||||
* any version provided by the system headers or application. */
|
||||
|
||||
/* First look for special cases */
|
||||
#if defined(_MSC_VER)
|
||||
#define MH_UINT32 unsigned long
|
||||
#endif
|
||||
|
||||
/* If the compiler says it's C99 then take its word for it */
|
||||
#if !defined(MH_UINT32) && ( \
|
||||
defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L )
|
||||
#include <stdint.h>
|
||||
#define MH_UINT32 uint32_t
|
||||
#endif
|
||||
|
||||
/* Otherwise try testing against max value macros from limit.h */
|
||||
#if !defined(MH_UINT32)
|
||||
#include <limits.h>
|
||||
#if (USHRT_MAX == 0xffffffffUL)
|
||||
#define MH_UINT32 unsigned short
|
||||
#elif (UINT_MAX == 0xffffffffUL)
|
||||
#define MH_UINT32 unsigned int
|
||||
#elif (ULONG_MAX == 0xffffffffUL)
|
||||
#define MH_UINT32 unsigned long
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(MH_UINT32)
|
||||
#error Unable to determine type name for unsigned 32-bit int
|
||||
#endif
|
||||
|
||||
/* I'm yet to work on a platform where 'unsigned char' is not 8 bits */
|
||||
#define MH_UINT8 unsigned char
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* Prototypes */
|
||||
|
||||
namespace angle
|
||||
{
|
||||
void PMurHash32_Process(MH_UINT32 *ph1, MH_UINT32 *pcarry, const void *key, int len);
|
||||
MH_UINT32 PMurHash32_Result(MH_UINT32 h1, MH_UINT32 carry, MH_UINT32 total_length);
|
||||
MH_UINT32 PMurHash32(MH_UINT32 seed, const void *key, int len);
|
||||
|
||||
void PMurHash32_test(const void *key, int len, MH_UINT32 seed, void *out);
|
||||
}
|
4
src/3rdparty/angle/src/common/tls.cpp
vendored
4
src/3rdparty/angle/src/common/tls.cpp
vendored
@ -56,7 +56,7 @@ TLSIndex CreateTLSIndex()
|
||||
|
||||
#elif defined(ANGLE_PLATFORM_POSIX)
|
||||
// Create global pool key
|
||||
if ((pthread_key_create(&index, NULL)) != 0)
|
||||
if ((pthread_key_create(&index, nullptr)) != 0)
|
||||
{
|
||||
index = TLS_INVALID_INDEX;
|
||||
}
|
||||
@ -133,7 +133,7 @@ void *GetTLSValue(TLSIndex index)
|
||||
assert(index != TLS_INVALID_INDEX && "GetTLSValue(): Invalid TLS Index");
|
||||
if (index == TLS_INVALID_INDEX)
|
||||
{
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
#ifdef ANGLE_PLATFORM_WINDOWS
|
||||
|
275
src/3rdparty/angle/src/common/uniform_type_info_autogen.cpp
vendored
Normal file
275
src/3rdparty/angle/src/common/uniform_type_info_autogen.cpp
vendored
Normal file
@ -0,0 +1,275 @@
|
||||
// GENERATED FILE - DO NOT EDIT.
|
||||
// Generated by gen_uniform_type_table.py.
|
||||
//
|
||||
// Copyright 2017 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.
|
||||
//
|
||||
// Uniform type info table:
|
||||
// Metadata about a particular uniform format, indexed by GL type.
|
||||
|
||||
#include <array>
|
||||
#include "common/utilities.h"
|
||||
|
||||
using namespace angle;
|
||||
|
||||
namespace gl
|
||||
{
|
||||
|
||||
namespace
|
||||
{
|
||||
constexpr std::array<UniformTypeInfo, 59> kInfoTable = {
|
||||
{{GL_NONE, GL_NONE, GL_NONE, GL_NONE, GL_NONE, 0, 0, 0, 0, 0 * 0, 0 * 0, false, false, false},
|
||||
{GL_BOOL, GL_BOOL, GL_NONE, GL_NONE, GL_NONE, 1, 1, 1, sizeof(GLint), sizeof(GLint) * 4,
|
||||
sizeof(GLint) * 1, false, false, false},
|
||||
{GL_BOOL_VEC2, GL_BOOL, GL_NONE, GL_NONE, GL_BOOL_VEC2, 1, 2, 2, sizeof(GLint),
|
||||
sizeof(GLint) * 4, sizeof(GLint) * 2, false, false, false},
|
||||
{GL_BOOL_VEC3, GL_BOOL, GL_NONE, GL_NONE, GL_BOOL_VEC3, 1, 3, 3, sizeof(GLint),
|
||||
sizeof(GLint) * 4, sizeof(GLint) * 3, false, false, false},
|
||||
{GL_BOOL_VEC4, GL_BOOL, GL_NONE, GL_NONE, GL_BOOL_VEC4, 1, 4, 4, sizeof(GLint),
|
||||
sizeof(GLint) * 4, sizeof(GLint) * 4, false, false, false},
|
||||
{GL_FLOAT, GL_FLOAT, GL_NONE, GL_NONE, GL_BOOL, 1, 1, 1, sizeof(GLfloat), sizeof(GLfloat) * 4,
|
||||
sizeof(GLfloat) * 1, false, false, false},
|
||||
{GL_FLOAT_MAT2, GL_FLOAT, GL_NONE, GL_FLOAT_MAT2, GL_NONE, 2, 2, 4, sizeof(GLfloat),
|
||||
sizeof(GLfloat) * 8, sizeof(GLfloat) * 4, false, true, false},
|
||||
{GL_FLOAT_MAT2x3, GL_FLOAT, GL_NONE, GL_FLOAT_MAT3x2, GL_NONE, 3, 2, 6, sizeof(GLfloat),
|
||||
sizeof(GLfloat) * 12, sizeof(GLfloat) * 6, false, true, false},
|
||||
{GL_FLOAT_MAT2x4, GL_FLOAT, GL_NONE, GL_FLOAT_MAT4x2, GL_NONE, 4, 2, 8, sizeof(GLfloat),
|
||||
sizeof(GLfloat) * 16, sizeof(GLfloat) * 8, false, true, false},
|
||||
{GL_FLOAT_MAT3, GL_FLOAT, GL_NONE, GL_FLOAT_MAT3, GL_NONE, 3, 3, 9, sizeof(GLfloat),
|
||||
sizeof(GLfloat) * 12, sizeof(GLfloat) * 9, false, true, false},
|
||||
{GL_FLOAT_MAT3x2, GL_FLOAT, GL_NONE, GL_FLOAT_MAT2x3, GL_NONE, 2, 3, 6, sizeof(GLfloat),
|
||||
sizeof(GLfloat) * 8, sizeof(GLfloat) * 6, false, true, false},
|
||||
{GL_FLOAT_MAT3x4, GL_FLOAT, GL_NONE, GL_FLOAT_MAT4x3, GL_NONE, 4, 3, 12, sizeof(GLfloat),
|
||||
sizeof(GLfloat) * 16, sizeof(GLfloat) * 12, false, true, false},
|
||||
{GL_FLOAT_MAT4, GL_FLOAT, GL_NONE, GL_FLOAT_MAT4, GL_NONE, 4, 4, 16, sizeof(GLfloat),
|
||||
sizeof(GLfloat) * 16, sizeof(GLfloat) * 16, false, true, false},
|
||||
{GL_FLOAT_MAT4x2, GL_FLOAT, GL_NONE, GL_FLOAT_MAT2x4, GL_NONE, 2, 4, 8, sizeof(GLfloat),
|
||||
sizeof(GLfloat) * 8, sizeof(GLfloat) * 8, false, true, false},
|
||||
{GL_FLOAT_MAT4x3, GL_FLOAT, GL_NONE, GL_FLOAT_MAT3x4, GL_NONE, 3, 4, 12, sizeof(GLfloat),
|
||||
sizeof(GLfloat) * 12, sizeof(GLfloat) * 12, false, true, false},
|
||||
{GL_FLOAT_VEC2, GL_FLOAT, GL_NONE, GL_NONE, GL_BOOL_VEC2, 1, 2, 2, sizeof(GLfloat),
|
||||
sizeof(GLfloat) * 4, sizeof(GLfloat) * 2, false, false, false},
|
||||
{GL_FLOAT_VEC3, GL_FLOAT, GL_NONE, GL_NONE, GL_BOOL_VEC3, 1, 3, 3, sizeof(GLfloat),
|
||||
sizeof(GLfloat) * 4, sizeof(GLfloat) * 3, false, false, false},
|
||||
{GL_FLOAT_VEC4, GL_FLOAT, GL_NONE, GL_NONE, GL_BOOL_VEC4, 1, 4, 4, sizeof(GLfloat),
|
||||
sizeof(GLfloat) * 4, sizeof(GLfloat) * 4, false, false, false},
|
||||
{GL_IMAGE_2D, GL_INT, GL_TEXTURE_2D, GL_NONE, GL_NONE, 1, 1, 1, sizeof(GLint),
|
||||
sizeof(GLint) * 4, sizeof(GLint) * 1, false, false, true},
|
||||
{GL_IMAGE_2D_ARRAY, GL_INT, GL_TEXTURE_2D_ARRAY, GL_NONE, GL_NONE, 1, 1, 1, sizeof(GLint),
|
||||
sizeof(GLint) * 4, sizeof(GLint) * 1, false, false, true},
|
||||
{GL_IMAGE_3D, GL_INT, GL_TEXTURE_3D, GL_NONE, GL_NONE, 1, 1, 1, sizeof(GLint),
|
||||
sizeof(GLint) * 4, sizeof(GLint) * 1, false, false, true},
|
||||
{GL_IMAGE_CUBE, GL_INT, GL_TEXTURE_CUBE_MAP, GL_NONE, GL_NONE, 1, 1, 1, sizeof(GLint),
|
||||
sizeof(GLint) * 4, sizeof(GLint) * 1, false, false, true},
|
||||
{GL_INT, GL_INT, GL_NONE, GL_NONE, GL_BOOL, 1, 1, 1, sizeof(GLint), sizeof(GLint) * 4,
|
||||
sizeof(GLint) * 1, false, false, false},
|
||||
{GL_INT_IMAGE_2D, GL_INT, GL_TEXTURE_2D, GL_NONE, GL_NONE, 1, 1, 1, sizeof(GLint),
|
||||
sizeof(GLint) * 4, sizeof(GLint) * 1, false, false, true},
|
||||
{GL_INT_IMAGE_2D_ARRAY, GL_INT, GL_TEXTURE_2D_ARRAY, GL_NONE, GL_NONE, 1, 1, 1, sizeof(GLint),
|
||||
sizeof(GLint) * 4, sizeof(GLint) * 1, false, false, true},
|
||||
{GL_INT_IMAGE_3D, GL_INT, GL_TEXTURE_3D, GL_NONE, GL_NONE, 1, 1, 1, sizeof(GLint),
|
||||
sizeof(GLint) * 4, sizeof(GLint) * 1, false, false, true},
|
||||
{GL_INT_IMAGE_CUBE, GL_INT, GL_TEXTURE_CUBE_MAP, GL_NONE, GL_NONE, 1, 1, 1, sizeof(GLint),
|
||||
sizeof(GLint) * 4, sizeof(GLint) * 1, false, false, true},
|
||||
{GL_INT_SAMPLER_2D, GL_INT, GL_TEXTURE_2D, GL_NONE, GL_NONE, 1, 1, 1, sizeof(GLint),
|
||||
sizeof(GLint) * 4, sizeof(GLint) * 1, true, false, false},
|
||||
{GL_INT_SAMPLER_2D_ARRAY, GL_INT, GL_TEXTURE_2D_ARRAY, GL_NONE, GL_NONE, 1, 1, 1,
|
||||
sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 1, true, false, false},
|
||||
{GL_INT_SAMPLER_2D_MULTISAMPLE, GL_INT, GL_TEXTURE_2D_MULTISAMPLE, GL_NONE, GL_NONE, 1, 1, 1,
|
||||
sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 1, true, false, false},
|
||||
{GL_INT_SAMPLER_3D, GL_INT, GL_TEXTURE_3D, GL_NONE, GL_NONE, 1, 1, 1, sizeof(GLint),
|
||||
sizeof(GLint) * 4, sizeof(GLint) * 1, true, false, false},
|
||||
{GL_INT_SAMPLER_CUBE, GL_INT, GL_TEXTURE_CUBE_MAP, GL_NONE, GL_NONE, 1, 1, 1, sizeof(GLint),
|
||||
sizeof(GLint) * 4, sizeof(GLint) * 1, true, false, false},
|
||||
{GL_INT_VEC2, GL_INT, GL_NONE, GL_NONE, GL_BOOL_VEC2, 1, 2, 2, sizeof(GLint),
|
||||
sizeof(GLint) * 4, sizeof(GLint) * 2, false, false, false},
|
||||
{GL_INT_VEC3, GL_INT, GL_NONE, GL_NONE, GL_BOOL_VEC3, 1, 3, 3, sizeof(GLint),
|
||||
sizeof(GLint) * 4, sizeof(GLint) * 3, false, false, false},
|
||||
{GL_INT_VEC4, GL_INT, GL_NONE, GL_NONE, GL_BOOL_VEC4, 1, 4, 4, sizeof(GLint),
|
||||
sizeof(GLint) * 4, sizeof(GLint) * 4, false, false, false},
|
||||
{GL_SAMPLER_2D, GL_INT, GL_TEXTURE_2D, GL_NONE, GL_NONE, 1, 1, 1, sizeof(GLint),
|
||||
sizeof(GLint) * 4, sizeof(GLint) * 1, true, false, false},
|
||||
{GL_SAMPLER_2D_ARRAY, GL_INT, GL_TEXTURE_2D_ARRAY, GL_NONE, GL_NONE, 1, 1, 1, sizeof(GLint),
|
||||
sizeof(GLint) * 4, sizeof(GLint) * 1, true, false, false},
|
||||
{GL_SAMPLER_2D_ARRAY_SHADOW, GL_INT, GL_TEXTURE_2D_ARRAY, GL_NONE, GL_NONE, 1, 1, 1,
|
||||
sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 1, true, false, false},
|
||||
{GL_SAMPLER_2D_MULTISAMPLE, GL_INT, GL_TEXTURE_2D_MULTISAMPLE, GL_NONE, GL_NONE, 1, 1, 1,
|
||||
sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 1, true, false, false},
|
||||
{GL_SAMPLER_2D_RECT_ANGLE, GL_INT, GL_TEXTURE_2D, GL_NONE, GL_NONE, 1, 1, 1, sizeof(GLint),
|
||||
sizeof(GLint) * 4, sizeof(GLint) * 1, true, false, false},
|
||||
{GL_SAMPLER_2D_SHADOW, GL_INT, GL_TEXTURE_2D, GL_NONE, GL_NONE, 1, 1, 1, sizeof(GLint),
|
||||
sizeof(GLint) * 4, sizeof(GLint) * 1, true, false, false},
|
||||
{GL_SAMPLER_3D, GL_INT, GL_TEXTURE_3D, GL_NONE, GL_NONE, 1, 1, 1, sizeof(GLint),
|
||||
sizeof(GLint) * 4, sizeof(GLint) * 1, true, false, false},
|
||||
{GL_SAMPLER_CUBE, GL_INT, GL_TEXTURE_CUBE_MAP, GL_NONE, GL_NONE, 1, 1, 1, sizeof(GLint),
|
||||
sizeof(GLint) * 4, sizeof(GLint) * 1, true, false, false},
|
||||
{GL_SAMPLER_CUBE_SHADOW, GL_INT, GL_TEXTURE_CUBE_MAP, GL_NONE, GL_NONE, 1, 1, 1, sizeof(GLint),
|
||||
sizeof(GLint) * 4, sizeof(GLint) * 1, true, false, false},
|
||||
{GL_SAMPLER_EXTERNAL_OES, GL_INT, GL_TEXTURE_EXTERNAL_OES, GL_NONE, GL_NONE, 1, 1, 1,
|
||||
sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 1, true, false, false},
|
||||
{GL_UNSIGNED_INT, GL_UNSIGNED_INT, GL_NONE, GL_NONE, GL_BOOL, 1, 1, 1, sizeof(GLuint),
|
||||
sizeof(GLuint) * 4, sizeof(GLuint) * 1, false, false, false},
|
||||
{GL_UNSIGNED_INT_ATOMIC_COUNTER, GL_UNSIGNED_INT, GL_NONE, GL_NONE, GL_NONE, 1, 1, 1,
|
||||
sizeof(GLuint), sizeof(GLuint) * 4, sizeof(GLuint) * 1, false, false, false},
|
||||
{GL_UNSIGNED_INT_IMAGE_2D, GL_UNSIGNED_INT, GL_TEXTURE_2D, GL_NONE, GL_NONE, 1, 1, 1,
|
||||
sizeof(GLuint), sizeof(GLuint) * 4, sizeof(GLuint) * 1, false, false, true},
|
||||
{GL_UNSIGNED_INT_IMAGE_2D_ARRAY, GL_UNSIGNED_INT, GL_TEXTURE_2D_ARRAY, GL_NONE, GL_NONE, 1, 1,
|
||||
1, sizeof(GLuint), sizeof(GLuint) * 4, sizeof(GLuint) * 1, false, false, true},
|
||||
{GL_UNSIGNED_INT_IMAGE_3D, GL_UNSIGNED_INT, GL_TEXTURE_3D, GL_NONE, GL_NONE, 1, 1, 1,
|
||||
sizeof(GLuint), sizeof(GLuint) * 4, sizeof(GLuint) * 1, false, false, true},
|
||||
{GL_UNSIGNED_INT_IMAGE_CUBE, GL_UNSIGNED_INT, GL_TEXTURE_CUBE_MAP, GL_NONE, GL_NONE, 1, 1, 1,
|
||||
sizeof(GLuint), sizeof(GLuint) * 4, sizeof(GLuint) * 1, false, false, true},
|
||||
{GL_UNSIGNED_INT_SAMPLER_2D, GL_UNSIGNED_INT, GL_TEXTURE_2D, GL_NONE, GL_NONE, 1, 1, 1,
|
||||
sizeof(GLuint), sizeof(GLuint) * 4, sizeof(GLuint) * 1, true, false, false},
|
||||
{GL_UNSIGNED_INT_SAMPLER_2D_ARRAY, GL_UNSIGNED_INT, GL_TEXTURE_2D_ARRAY, GL_NONE, GL_NONE, 1,
|
||||
1, 1, sizeof(GLuint), sizeof(GLuint) * 4, sizeof(GLuint) * 1, true, false, false},
|
||||
{GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE, GL_UNSIGNED_INT, GL_TEXTURE_2D_MULTISAMPLE, GL_NONE,
|
||||
GL_NONE, 1, 1, 1, sizeof(GLuint), sizeof(GLuint) * 4, sizeof(GLuint) * 1, true, false, false},
|
||||
{GL_UNSIGNED_INT_SAMPLER_3D, GL_UNSIGNED_INT, GL_TEXTURE_3D, GL_NONE, GL_NONE, 1, 1, 1,
|
||||
sizeof(GLuint), sizeof(GLuint) * 4, sizeof(GLuint) * 1, true, false, false},
|
||||
{GL_UNSIGNED_INT_SAMPLER_CUBE, GL_UNSIGNED_INT, GL_TEXTURE_CUBE_MAP, GL_NONE, GL_NONE, 1, 1, 1,
|
||||
sizeof(GLuint), sizeof(GLuint) * 4, sizeof(GLuint) * 1, true, false, false},
|
||||
{GL_UNSIGNED_INT_VEC2, GL_UNSIGNED_INT, GL_NONE, GL_NONE, GL_BOOL_VEC2, 1, 2, 2,
|
||||
sizeof(GLuint), sizeof(GLuint) * 4, sizeof(GLuint) * 2, false, false, false},
|
||||
{GL_UNSIGNED_INT_VEC3, GL_UNSIGNED_INT, GL_NONE, GL_NONE, GL_BOOL_VEC3, 1, 3, 3,
|
||||
sizeof(GLuint), sizeof(GLuint) * 4, sizeof(GLuint) * 3, false, false, false},
|
||||
{GL_UNSIGNED_INT_VEC4, GL_UNSIGNED_INT, GL_NONE, GL_NONE, GL_BOOL_VEC4, 1, 4, 4,
|
||||
sizeof(GLuint), sizeof(GLuint) * 4, sizeof(GLuint) * 4, false, false, false}}};
|
||||
|
||||
size_t GetTypeInfoIndex(GLenum uniformType)
|
||||
{
|
||||
switch (uniformType)
|
||||
{
|
||||
case GL_NONE:
|
||||
return 0;
|
||||
case GL_BOOL:
|
||||
return 1;
|
||||
case GL_BOOL_VEC2:
|
||||
return 2;
|
||||
case GL_BOOL_VEC3:
|
||||
return 3;
|
||||
case GL_BOOL_VEC4:
|
||||
return 4;
|
||||
case GL_FLOAT:
|
||||
return 5;
|
||||
case GL_FLOAT_MAT2:
|
||||
return 6;
|
||||
case GL_FLOAT_MAT2x3:
|
||||
return 7;
|
||||
case GL_FLOAT_MAT2x4:
|
||||
return 8;
|
||||
case GL_FLOAT_MAT3:
|
||||
return 9;
|
||||
case GL_FLOAT_MAT3x2:
|
||||
return 10;
|
||||
case GL_FLOAT_MAT3x4:
|
||||
return 11;
|
||||
case GL_FLOAT_MAT4:
|
||||
return 12;
|
||||
case GL_FLOAT_MAT4x2:
|
||||
return 13;
|
||||
case GL_FLOAT_MAT4x3:
|
||||
return 14;
|
||||
case GL_FLOAT_VEC2:
|
||||
return 15;
|
||||
case GL_FLOAT_VEC3:
|
||||
return 16;
|
||||
case GL_FLOAT_VEC4:
|
||||
return 17;
|
||||
case GL_IMAGE_2D:
|
||||
return 18;
|
||||
case GL_IMAGE_2D_ARRAY:
|
||||
return 19;
|
||||
case GL_IMAGE_3D:
|
||||
return 20;
|
||||
case GL_IMAGE_CUBE:
|
||||
return 21;
|
||||
case GL_INT:
|
||||
return 22;
|
||||
case GL_INT_IMAGE_2D:
|
||||
return 23;
|
||||
case GL_INT_IMAGE_2D_ARRAY:
|
||||
return 24;
|
||||
case GL_INT_IMAGE_3D:
|
||||
return 25;
|
||||
case GL_INT_IMAGE_CUBE:
|
||||
return 26;
|
||||
case GL_INT_SAMPLER_2D:
|
||||
return 27;
|
||||
case GL_INT_SAMPLER_2D_ARRAY:
|
||||
return 28;
|
||||
case GL_INT_SAMPLER_2D_MULTISAMPLE:
|
||||
return 29;
|
||||
case GL_INT_SAMPLER_3D:
|
||||
return 30;
|
||||
case GL_INT_SAMPLER_CUBE:
|
||||
return 31;
|
||||
case GL_INT_VEC2:
|
||||
return 32;
|
||||
case GL_INT_VEC3:
|
||||
return 33;
|
||||
case GL_INT_VEC4:
|
||||
return 34;
|
||||
case GL_SAMPLER_2D:
|
||||
return 35;
|
||||
case GL_SAMPLER_2D_ARRAY:
|
||||
return 36;
|
||||
case GL_SAMPLER_2D_ARRAY_SHADOW:
|
||||
return 37;
|
||||
case GL_SAMPLER_2D_MULTISAMPLE:
|
||||
return 38;
|
||||
case GL_SAMPLER_2D_RECT_ANGLE:
|
||||
return 39;
|
||||
case GL_SAMPLER_2D_SHADOW:
|
||||
return 40;
|
||||
case GL_SAMPLER_3D:
|
||||
return 41;
|
||||
case GL_SAMPLER_CUBE:
|
||||
return 42;
|
||||
case GL_SAMPLER_CUBE_SHADOW:
|
||||
return 43;
|
||||
case GL_SAMPLER_EXTERNAL_OES:
|
||||
return 44;
|
||||
case GL_UNSIGNED_INT:
|
||||
return 45;
|
||||
case GL_UNSIGNED_INT_ATOMIC_COUNTER:
|
||||
return 46;
|
||||
case GL_UNSIGNED_INT_IMAGE_2D:
|
||||
return 47;
|
||||
case GL_UNSIGNED_INT_IMAGE_2D_ARRAY:
|
||||
return 48;
|
||||
case GL_UNSIGNED_INT_IMAGE_3D:
|
||||
return 49;
|
||||
case GL_UNSIGNED_INT_IMAGE_CUBE:
|
||||
return 50;
|
||||
case GL_UNSIGNED_INT_SAMPLER_2D:
|
||||
return 51;
|
||||
case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY:
|
||||
return 52;
|
||||
case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE:
|
||||
return 53;
|
||||
case GL_UNSIGNED_INT_SAMPLER_3D:
|
||||
return 54;
|
||||
case GL_UNSIGNED_INT_SAMPLER_CUBE:
|
||||
return 55;
|
||||
case GL_UNSIGNED_INT_VEC2:
|
||||
return 56;
|
||||
case GL_UNSIGNED_INT_VEC3:
|
||||
return 57;
|
||||
case GL_UNSIGNED_INT_VEC4:
|
||||
return 58;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
} // anonymous namespace
|
||||
|
||||
const UniformTypeInfo &GetUniformTypeInfo(GLenum uniformType)
|
||||
{
|
||||
ASSERT(kInfoTable[GetTypeInfoIndex(uniformType)].type == uniformType);
|
||||
return kInfoTable[GetTypeInfoIndex(uniformType)];
|
||||
}
|
||||
|
||||
} // namespace gl
|
344
src/3rdparty/angle/src/common/utilities.cpp
vendored
344
src/3rdparty/angle/src/common/utilities.cpp
vendored
@ -124,24 +124,42 @@ GLenum VariableComponentType(GLenum type)
|
||||
return GL_FLOAT;
|
||||
case GL_INT:
|
||||
case GL_SAMPLER_2D:
|
||||
case GL_SAMPLER_2D_RECT_ANGLE:
|
||||
case GL_SAMPLER_3D:
|
||||
case GL_SAMPLER_CUBE:
|
||||
case GL_SAMPLER_2D_ARRAY:
|
||||
case GL_SAMPLER_EXTERNAL_OES:
|
||||
case GL_SAMPLER_2D_MULTISAMPLE:
|
||||
case GL_INT_SAMPLER_2D:
|
||||
case GL_INT_SAMPLER_3D:
|
||||
case GL_INT_SAMPLER_CUBE:
|
||||
case GL_INT_SAMPLER_2D_ARRAY:
|
||||
case GL_INT_SAMPLER_2D_MULTISAMPLE:
|
||||
case GL_UNSIGNED_INT_SAMPLER_2D:
|
||||
case GL_UNSIGNED_INT_SAMPLER_3D:
|
||||
case GL_UNSIGNED_INT_SAMPLER_CUBE:
|
||||
case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY:
|
||||
case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE:
|
||||
case GL_SAMPLER_2D_SHADOW:
|
||||
case GL_SAMPLER_CUBE_SHADOW:
|
||||
case GL_SAMPLER_2D_ARRAY_SHADOW:
|
||||
case GL_INT_VEC2:
|
||||
case GL_INT_VEC3:
|
||||
case GL_INT_VEC4:
|
||||
return GL_INT;
|
||||
case GL_IMAGE_2D:
|
||||
case GL_INT_IMAGE_2D:
|
||||
case GL_UNSIGNED_INT_IMAGE_2D:
|
||||
case GL_IMAGE_3D:
|
||||
case GL_INT_IMAGE_3D:
|
||||
case GL_UNSIGNED_INT_IMAGE_3D:
|
||||
case GL_IMAGE_2D_ARRAY:
|
||||
case GL_INT_IMAGE_2D_ARRAY:
|
||||
case GL_UNSIGNED_INT_IMAGE_2D_ARRAY:
|
||||
case GL_IMAGE_CUBE:
|
||||
case GL_INT_IMAGE_CUBE:
|
||||
case GL_UNSIGNED_INT_IMAGE_CUBE:
|
||||
case GL_UNSIGNED_INT_ATOMIC_COUNTER:
|
||||
return GL_INT;
|
||||
case GL_UNSIGNED_INT:
|
||||
case GL_UNSIGNED_INT_VEC2:
|
||||
case GL_UNSIGNED_INT_VEC3:
|
||||
@ -211,7 +229,6 @@ int VariableRowCount(GLenum type)
|
||||
switch (type)
|
||||
{
|
||||
case GL_NONE:
|
||||
case GL_STRUCT_ANGLEX:
|
||||
return 0;
|
||||
case GL_BOOL:
|
||||
case GL_FLOAT:
|
||||
@ -234,19 +251,35 @@ int VariableRowCount(GLenum type)
|
||||
case GL_SAMPLER_CUBE:
|
||||
case GL_SAMPLER_2D_ARRAY:
|
||||
case GL_SAMPLER_EXTERNAL_OES:
|
||||
case GL_SAMPLER_2D_RECT_ARB:
|
||||
case GL_SAMPLER_2D_RECT_ANGLE:
|
||||
case GL_SAMPLER_2D_MULTISAMPLE:
|
||||
case GL_INT_SAMPLER_2D:
|
||||
case GL_INT_SAMPLER_3D:
|
||||
case GL_INT_SAMPLER_CUBE:
|
||||
case GL_INT_SAMPLER_2D_ARRAY:
|
||||
case GL_INT_SAMPLER_2D_MULTISAMPLE:
|
||||
case GL_UNSIGNED_INT_SAMPLER_2D:
|
||||
case GL_UNSIGNED_INT_SAMPLER_3D:
|
||||
case GL_UNSIGNED_INT_SAMPLER_CUBE:
|
||||
case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY:
|
||||
case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE:
|
||||
case GL_SAMPLER_2D_SHADOW:
|
||||
case GL_SAMPLER_CUBE_SHADOW:
|
||||
case GL_SAMPLER_2D_ARRAY_SHADOW:
|
||||
return 1;
|
||||
case GL_IMAGE_2D:
|
||||
case GL_INT_IMAGE_2D:
|
||||
case GL_UNSIGNED_INT_IMAGE_2D:
|
||||
case GL_IMAGE_2D_ARRAY:
|
||||
case GL_INT_IMAGE_2D_ARRAY:
|
||||
case GL_UNSIGNED_INT_IMAGE_2D_ARRAY:
|
||||
case GL_IMAGE_3D:
|
||||
case GL_INT_IMAGE_3D:
|
||||
case GL_UNSIGNED_INT_IMAGE_3D:
|
||||
case GL_IMAGE_CUBE:
|
||||
case GL_INT_IMAGE_CUBE:
|
||||
case GL_UNSIGNED_INT_IMAGE_CUBE:
|
||||
case GL_UNSIGNED_INT_ATOMIC_COUNTER:
|
||||
return 1;
|
||||
case GL_FLOAT_MAT2:
|
||||
case GL_FLOAT_MAT3x2:
|
||||
case GL_FLOAT_MAT4x2:
|
||||
@ -271,7 +304,6 @@ int VariableColumnCount(GLenum type)
|
||||
switch (type)
|
||||
{
|
||||
case GL_NONE:
|
||||
case GL_STRUCT_ANGLEX:
|
||||
return 0;
|
||||
case GL_BOOL:
|
||||
case GL_FLOAT:
|
||||
@ -281,20 +313,36 @@ int VariableColumnCount(GLenum type)
|
||||
case GL_SAMPLER_3D:
|
||||
case GL_SAMPLER_CUBE:
|
||||
case GL_SAMPLER_2D_ARRAY:
|
||||
case GL_SAMPLER_2D_MULTISAMPLE:
|
||||
case GL_INT_SAMPLER_2D:
|
||||
case GL_INT_SAMPLER_3D:
|
||||
case GL_INT_SAMPLER_CUBE:
|
||||
case GL_INT_SAMPLER_2D_ARRAY:
|
||||
case GL_INT_SAMPLER_2D_MULTISAMPLE:
|
||||
case GL_SAMPLER_EXTERNAL_OES:
|
||||
case GL_SAMPLER_2D_RECT_ARB:
|
||||
case GL_SAMPLER_2D_RECT_ANGLE:
|
||||
case GL_UNSIGNED_INT_SAMPLER_2D:
|
||||
case GL_UNSIGNED_INT_SAMPLER_3D:
|
||||
case GL_UNSIGNED_INT_SAMPLER_CUBE:
|
||||
case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY:
|
||||
case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE:
|
||||
case GL_SAMPLER_2D_SHADOW:
|
||||
case GL_SAMPLER_CUBE_SHADOW:
|
||||
case GL_SAMPLER_2D_ARRAY_SHADOW:
|
||||
return 1;
|
||||
case GL_IMAGE_2D:
|
||||
case GL_INT_IMAGE_2D:
|
||||
case GL_UNSIGNED_INT_IMAGE_2D:
|
||||
case GL_IMAGE_3D:
|
||||
case GL_INT_IMAGE_3D:
|
||||
case GL_UNSIGNED_INT_IMAGE_3D:
|
||||
case GL_IMAGE_2D_ARRAY:
|
||||
case GL_INT_IMAGE_2D_ARRAY:
|
||||
case GL_UNSIGNED_INT_IMAGE_2D_ARRAY:
|
||||
case GL_IMAGE_CUBE:
|
||||
case GL_INT_IMAGE_CUBE:
|
||||
case GL_UNSIGNED_INT_IMAGE_CUBE:
|
||||
case GL_UNSIGNED_INT_ATOMIC_COUNTER:
|
||||
return 1;
|
||||
case GL_BOOL_VEC2:
|
||||
case GL_FLOAT_VEC2:
|
||||
case GL_INT_VEC2:
|
||||
@ -334,14 +382,19 @@ bool IsSamplerType(GLenum type)
|
||||
case GL_SAMPLER_3D:
|
||||
case GL_SAMPLER_CUBE:
|
||||
case GL_SAMPLER_2D_ARRAY:
|
||||
case GL_SAMPLER_EXTERNAL_OES:
|
||||
case GL_SAMPLER_2D_MULTISAMPLE:
|
||||
case GL_SAMPLER_2D_RECT_ANGLE:
|
||||
case GL_INT_SAMPLER_2D:
|
||||
case GL_INT_SAMPLER_3D:
|
||||
case GL_INT_SAMPLER_CUBE:
|
||||
case GL_INT_SAMPLER_2D_ARRAY:
|
||||
case GL_INT_SAMPLER_2D_MULTISAMPLE:
|
||||
case GL_UNSIGNED_INT_SAMPLER_2D:
|
||||
case GL_UNSIGNED_INT_SAMPLER_3D:
|
||||
case GL_UNSIGNED_INT_SAMPLER_CUBE:
|
||||
case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY:
|
||||
case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE:
|
||||
case GL_SAMPLER_2D_SHADOW:
|
||||
case GL_SAMPLER_CUBE_SHADOW:
|
||||
case GL_SAMPLER_2D_ARRAY_SHADOW:
|
||||
@ -351,6 +404,38 @@ bool IsSamplerType(GLenum type)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool IsImageType(GLenum type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case GL_IMAGE_2D:
|
||||
case GL_INT_IMAGE_2D:
|
||||
case GL_UNSIGNED_INT_IMAGE_2D:
|
||||
case GL_IMAGE_3D:
|
||||
case GL_INT_IMAGE_3D:
|
||||
case GL_UNSIGNED_INT_IMAGE_3D:
|
||||
case GL_IMAGE_2D_ARRAY:
|
||||
case GL_INT_IMAGE_2D_ARRAY:
|
||||
case GL_UNSIGNED_INT_IMAGE_2D_ARRAY:
|
||||
case GL_IMAGE_CUBE:
|
||||
case GL_INT_IMAGE_CUBE:
|
||||
case GL_UNSIGNED_INT_IMAGE_CUBE:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool IsAtomicCounterType(GLenum type)
|
||||
{
|
||||
return type == GL_UNSIGNED_INT_ATOMIC_COUNTER;
|
||||
}
|
||||
|
||||
bool IsOpaqueType(GLenum type)
|
||||
{
|
||||
// ESSL 3.10 section 4.1.7 defines opaque types as: samplers, images and atomic counters.
|
||||
return IsImageType(type) || IsSamplerType(type) || IsAtomicCounterType(type);
|
||||
}
|
||||
|
||||
GLenum SamplerTypeToTextureType(GLenum samplerType)
|
||||
{
|
||||
switch (samplerType)
|
||||
@ -361,6 +446,9 @@ GLenum SamplerTypeToTextureType(GLenum samplerType)
|
||||
case GL_SAMPLER_2D_SHADOW:
|
||||
return GL_TEXTURE_2D;
|
||||
|
||||
case GL_SAMPLER_EXTERNAL_OES:
|
||||
return GL_TEXTURE_EXTERNAL_OES;
|
||||
|
||||
case GL_SAMPLER_CUBE:
|
||||
case GL_INT_SAMPLER_CUBE:
|
||||
case GL_UNSIGNED_INT_SAMPLER_CUBE:
|
||||
@ -378,6 +466,14 @@ GLenum SamplerTypeToTextureType(GLenum samplerType)
|
||||
case GL_UNSIGNED_INT_SAMPLER_3D:
|
||||
return GL_TEXTURE_3D;
|
||||
|
||||
case GL_SAMPLER_2D_MULTISAMPLE:
|
||||
case GL_INT_SAMPLER_2D_MULTISAMPLE:
|
||||
case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE:
|
||||
return GL_TEXTURE_2D_MULTISAMPLE;
|
||||
|
||||
case GL_SAMPLER_2D_RECT_ANGLE:
|
||||
return GL_TEXTURE_RECTANGLE_ANGLE;
|
||||
|
||||
default:
|
||||
UNREACHABLE();
|
||||
return 0;
|
||||
@ -531,6 +627,21 @@ bool IsTriangleMode(GLenum drawMode)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool IsIntegerFormat(GLenum unsizedFormat)
|
||||
{
|
||||
switch (unsizedFormat)
|
||||
{
|
||||
case GL_RGBA_INTEGER:
|
||||
case GL_RGB_INTEGER:
|
||||
case GL_RG_INTEGER:
|
||||
case GL_RED_INTEGER:
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// [OpenGL ES SL 3.00.4] Section 11 p. 120
|
||||
// Vertex Outs/Fragment Ins packing priorities
|
||||
int VariableSortOrder(GLenum type)
|
||||
@ -586,21 +697,37 @@ int VariableSortOrder(GLenum type)
|
||||
case GL_SAMPLER_2D:
|
||||
case GL_SAMPLER_CUBE:
|
||||
case GL_SAMPLER_EXTERNAL_OES:
|
||||
case GL_SAMPLER_2D_RECT_ARB:
|
||||
case GL_SAMPLER_2D_RECT_ANGLE:
|
||||
case GL_SAMPLER_2D_ARRAY:
|
||||
case GL_SAMPLER_2D_MULTISAMPLE:
|
||||
case GL_SAMPLER_3D:
|
||||
case GL_INT_SAMPLER_2D:
|
||||
case GL_INT_SAMPLER_3D:
|
||||
case GL_INT_SAMPLER_CUBE:
|
||||
case GL_INT_SAMPLER_2D_ARRAY:
|
||||
case GL_INT_SAMPLER_2D_MULTISAMPLE:
|
||||
case GL_UNSIGNED_INT_SAMPLER_2D:
|
||||
case GL_UNSIGNED_INT_SAMPLER_3D:
|
||||
case GL_UNSIGNED_INT_SAMPLER_CUBE:
|
||||
case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY:
|
||||
case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE:
|
||||
case GL_SAMPLER_2D_SHADOW:
|
||||
case GL_SAMPLER_2D_ARRAY_SHADOW:
|
||||
case GL_SAMPLER_CUBE_SHADOW:
|
||||
return 6;
|
||||
case GL_IMAGE_2D:
|
||||
case GL_INT_IMAGE_2D:
|
||||
case GL_UNSIGNED_INT_IMAGE_2D:
|
||||
case GL_IMAGE_3D:
|
||||
case GL_INT_IMAGE_3D:
|
||||
case GL_UNSIGNED_INT_IMAGE_3D:
|
||||
case GL_IMAGE_2D_ARRAY:
|
||||
case GL_INT_IMAGE_2D_ARRAY:
|
||||
case GL_UNSIGNED_INT_IMAGE_2D_ARRAY:
|
||||
case GL_IMAGE_CUBE:
|
||||
case GL_INT_IMAGE_CUBE:
|
||||
case GL_UNSIGNED_INT_IMAGE_CUBE:
|
||||
case GL_UNSIGNED_INT_ATOMIC_COUNTER:
|
||||
return 6;
|
||||
|
||||
default:
|
||||
UNREACHABLE();
|
||||
@ -608,51 +735,128 @@ int VariableSortOrder(GLenum type)
|
||||
}
|
||||
}
|
||||
|
||||
std::string ParseUniformName(const std::string &name, size_t *outSubscript)
|
||||
std::string ParseResourceName(const std::string &name, std::vector<unsigned int> *outSubscripts)
|
||||
{
|
||||
// Strip any trailing array operator and retrieve the subscript
|
||||
size_t open = name.find_last_of('[');
|
||||
size_t close = name.find_last_of(']');
|
||||
bool hasIndex = (open != std::string::npos) && (close == name.length() - 1);
|
||||
if (!hasIndex)
|
||||
if (outSubscripts)
|
||||
{
|
||||
if (outSubscript)
|
||||
{
|
||||
*outSubscript = GL_INVALID_INDEX;
|
||||
}
|
||||
return name;
|
||||
outSubscripts->clear();
|
||||
}
|
||||
|
||||
if (outSubscript)
|
||||
// Strip any trailing array indexing operators and retrieve the subscripts.
|
||||
size_t baseNameLength = name.length();
|
||||
bool hasIndex = true;
|
||||
while (hasIndex)
|
||||
{
|
||||
int index = atoi(name.substr(open + 1).c_str());
|
||||
if (index >= 0)
|
||||
size_t open = name.find_last_of('[', baseNameLength - 1);
|
||||
size_t close = name.find_last_of(']', baseNameLength - 1);
|
||||
hasIndex = (open != std::string::npos) && (close == baseNameLength - 1);
|
||||
if (hasIndex)
|
||||
{
|
||||
*outSubscript = index;
|
||||
}
|
||||
else
|
||||
{
|
||||
*outSubscript = GL_INVALID_INDEX;
|
||||
baseNameLength = open;
|
||||
if (outSubscripts)
|
||||
{
|
||||
int index = atoi(name.substr(open + 1).c_str());
|
||||
if (index >= 0)
|
||||
{
|
||||
outSubscripts->push_back(index);
|
||||
}
|
||||
else
|
||||
{
|
||||
outSubscripts->push_back(GL_INVALID_INDEX);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return name.substr(0, open);
|
||||
return name.substr(0, baseNameLength);
|
||||
}
|
||||
|
||||
unsigned int ParseAndStripArrayIndex(std::string *name)
|
||||
unsigned int ArraySizeProduct(const std::vector<unsigned int> &arraySizes)
|
||||
{
|
||||
unsigned int subscript = GL_INVALID_INDEX;
|
||||
unsigned int arraySizeProduct = 1u;
|
||||
for (unsigned int arraySize : arraySizes)
|
||||
{
|
||||
arraySizeProduct *= arraySize;
|
||||
}
|
||||
return arraySizeProduct;
|
||||
}
|
||||
|
||||
unsigned int ParseArrayIndex(const std::string &name, size_t *nameLengthWithoutArrayIndexOut)
|
||||
{
|
||||
ASSERT(nameLengthWithoutArrayIndexOut != nullptr);
|
||||
|
||||
// Strip any trailing array operator and retrieve the subscript
|
||||
size_t open = name->find_last_of('[');
|
||||
size_t close = name->find_last_of(']');
|
||||
if (open != std::string::npos && close == name->length() - 1)
|
||||
size_t open = name.find_last_of('[');
|
||||
if (open != std::string::npos && name.back() == ']')
|
||||
{
|
||||
subscript = atoi(name->c_str() + open + 1);
|
||||
name->erase(open);
|
||||
bool indexIsValidDecimalNumber = true;
|
||||
for (size_t i = open + 1; i < name.length() - 1u; ++i)
|
||||
{
|
||||
if (!isdigit(name[i]))
|
||||
{
|
||||
indexIsValidDecimalNumber = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (indexIsValidDecimalNumber)
|
||||
{
|
||||
errno = 0; // reset global error flag.
|
||||
unsigned long subscript =
|
||||
strtoul(name.c_str() + open + 1, /*endptr*/ nullptr, /*radix*/ 10);
|
||||
|
||||
// Check if resulting integer is out-of-range or conversion error.
|
||||
if ((subscript <= static_cast<unsigned long>(UINT_MAX)) &&
|
||||
!(subscript == ULONG_MAX && errno == ERANGE) && !(errno != 0 && subscript == 0))
|
||||
{
|
||||
*nameLengthWithoutArrayIndexOut = open;
|
||||
return static_cast<unsigned int>(subscript);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return subscript;
|
||||
*nameLengthWithoutArrayIndexOut = name.length();
|
||||
return GL_INVALID_INDEX;
|
||||
}
|
||||
|
||||
const char *GetGenericErrorMessage(GLenum error)
|
||||
{
|
||||
switch (error)
|
||||
{
|
||||
case GL_NO_ERROR:
|
||||
return "";
|
||||
case GL_INVALID_ENUM:
|
||||
return "Invalid enum.";
|
||||
case GL_INVALID_VALUE:
|
||||
return "Invalid value.";
|
||||
case GL_INVALID_OPERATION:
|
||||
return "Invalid operation.";
|
||||
case GL_STACK_OVERFLOW:
|
||||
return "Stack overflow.";
|
||||
case GL_STACK_UNDERFLOW:
|
||||
return "Stack underflow.";
|
||||
case GL_OUT_OF_MEMORY:
|
||||
return "Out of memory.";
|
||||
case GL_INVALID_FRAMEBUFFER_OPERATION:
|
||||
return "Invalid framebuffer operation.";
|
||||
default:
|
||||
UNREACHABLE();
|
||||
return "Unknown error.";
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int ElementTypeSize(GLenum elementType)
|
||||
{
|
||||
switch (elementType)
|
||||
{
|
||||
case GL_UNSIGNED_BYTE:
|
||||
return sizeof(GLubyte);
|
||||
case GL_UNSIGNED_SHORT:
|
||||
return sizeof(GLushort);
|
||||
case GL_UNSIGNED_INT:
|
||||
return sizeof(GLuint);
|
||||
default:
|
||||
UNREACHABLE();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace gl
|
||||
@ -710,8 +914,53 @@ bool IsRenderbufferTarget(EGLenum target)
|
||||
{
|
||||
return target == EGL_GL_RENDERBUFFER_KHR;
|
||||
}
|
||||
|
||||
const char *GetGenericErrorMessage(EGLint error)
|
||||
{
|
||||
switch (error)
|
||||
{
|
||||
case EGL_SUCCESS:
|
||||
return "";
|
||||
case EGL_NOT_INITIALIZED:
|
||||
return "Not initialized.";
|
||||
case EGL_BAD_ACCESS:
|
||||
return "Bad access.";
|
||||
case EGL_BAD_ALLOC:
|
||||
return "Bad allocation.";
|
||||
case EGL_BAD_ATTRIBUTE:
|
||||
return "Bad attribute.";
|
||||
case EGL_BAD_CONFIG:
|
||||
return "Bad config.";
|
||||
case EGL_BAD_CONTEXT:
|
||||
return "Bad context.";
|
||||
case EGL_BAD_CURRENT_SURFACE:
|
||||
return "Bad current surface.";
|
||||
case EGL_BAD_DISPLAY:
|
||||
return "Bad display.";
|
||||
case EGL_BAD_MATCH:
|
||||
return "Bad match.";
|
||||
case EGL_BAD_NATIVE_WINDOW:
|
||||
return "Bad native window.";
|
||||
case EGL_BAD_PARAMETER:
|
||||
return "Bad parameter.";
|
||||
case EGL_BAD_SURFACE:
|
||||
return "Bad surface.";
|
||||
case EGL_CONTEXT_LOST:
|
||||
return "Context lost.";
|
||||
case EGL_BAD_STREAM_KHR:
|
||||
return "Bad stream.";
|
||||
case EGL_BAD_STATE_KHR:
|
||||
return "Bad state.";
|
||||
case EGL_BAD_DEVICE_EXT:
|
||||
return "Bad device.";
|
||||
default:
|
||||
UNREACHABLE();
|
||||
return "Unknown error.";
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace egl
|
||||
|
||||
namespace egl_gl
|
||||
{
|
||||
GLenum EGLCubeMapTargetToGLCubeMapTarget(EGLenum eglTarget)
|
||||
@ -748,7 +997,26 @@ GLuint EGLClientBufferToGLObjectHandle(EGLClientBuffer buffer)
|
||||
{
|
||||
return static_cast<GLuint>(reinterpret_cast<uintptr_t>(buffer));
|
||||
}
|
||||
} // namespace egl_gl
|
||||
|
||||
namespace gl_egl
|
||||
{
|
||||
EGLenum GLComponentTypeToEGLColorComponentType(GLenum glComponentType)
|
||||
{
|
||||
switch (glComponentType)
|
||||
{
|
||||
case GL_FLOAT:
|
||||
return EGL_COLOR_COMPONENT_TYPE_FLOAT_EXT;
|
||||
|
||||
case GL_UNSIGNED_NORMALIZED:
|
||||
return EGL_COLOR_COMPONENT_TYPE_FIXED_EXT;
|
||||
|
||||
default:
|
||||
UNREACHABLE();
|
||||
return EGL_NONE;
|
||||
}
|
||||
}
|
||||
} // namespace gl_egl
|
||||
|
||||
#if !defined(ANGLE_ENABLE_WINDOWS_STORE)
|
||||
std::string getTempPath()
|
||||
|
97
src/3rdparty/angle/src/common/utilities.h
vendored
97
src/3rdparty/angle/src/common/utilities.h
vendored
@ -12,9 +12,10 @@
|
||||
#include <EGL/egl.h>
|
||||
#include <EGL/eglext.h>
|
||||
|
||||
#include "angle_gl.h"
|
||||
#include <string>
|
||||
#include <math.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "angle_gl.h"
|
||||
|
||||
#include "common/mathutil.h"
|
||||
|
||||
@ -26,10 +27,12 @@ GLenum VariableComponentType(GLenum type);
|
||||
size_t VariableComponentSize(GLenum type);
|
||||
size_t VariableInternalSize(GLenum type);
|
||||
size_t VariableExternalSize(GLenum type);
|
||||
GLenum VariableBoolVectorType(GLenum type);
|
||||
int VariableRowCount(GLenum type);
|
||||
int VariableColumnCount(GLenum type);
|
||||
bool IsSamplerType(GLenum type);
|
||||
bool IsImageType(GLenum type);
|
||||
bool IsAtomicCounterType(GLenum type);
|
||||
bool IsOpaqueType(GLenum type);
|
||||
GLenum SamplerTypeToTextureType(GLenum samplerType);
|
||||
bool IsMatrixType(GLenum type);
|
||||
GLenum TransposeMatrixType(GLenum type);
|
||||
@ -37,6 +40,7 @@ int VariableRegisterCount(GLenum type);
|
||||
int MatrixRegisterCount(GLenum type, bool isRowMajorMatrix);
|
||||
int MatrixComponentCount(GLenum type, bool isRowMajorMatrix);
|
||||
int VariableSortOrder(GLenum type);
|
||||
GLenum VariableBoolVectorType(GLenum type);
|
||||
|
||||
int AllocateFirstFreeBits(unsigned int *bits, unsigned int allocationSize, unsigned int bitsSize);
|
||||
|
||||
@ -46,9 +50,12 @@ bool IsCubeMapTextureTarget(GLenum target);
|
||||
size_t CubeMapTextureTargetToLayerIndex(GLenum target);
|
||||
GLenum LayerIndexToCubeMapTextureTarget(size_t index);
|
||||
|
||||
// Parse the base uniform name and array index. Returns the base name of the uniform. outSubscript is
|
||||
// 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);
|
||||
// Parse the base resource name and array indices. Returns the base name of the resource.
|
||||
// If the provided name doesn't index an array, the outSubscripts vector will be empty.
|
||||
// If the provided name indexes an array, the outSubscripts vector will contain indices with
|
||||
// outermost array indices in the back. If an array index is invalid, GL_INVALID_INDEX is added to
|
||||
// outSubscripts.
|
||||
std::string ParseResourceName(const std::string &name, std::vector<unsigned int> *outSubscripts);
|
||||
|
||||
// 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.
|
||||
@ -61,14 +68,71 @@ IndexRange ComputeIndexRange(GLenum indexType,
|
||||
GLuint GetPrimitiveRestartIndex(GLenum indexType);
|
||||
|
||||
bool IsTriangleMode(GLenum drawMode);
|
||||
bool IsIntegerFormat(GLenum unsizedFormat);
|
||||
|
||||
// [OpenGL ES 3.0.2] Section 2.3.1 page 14
|
||||
// Data Conversion For State-Setting Commands
|
||||
// Floating-point values are rounded to the nearest integer, instead of truncated, as done by static_cast.
|
||||
template <typename outT> outT iround(GLfloat value) { return static_cast<outT>(value > 0.0f ? floor(value + 0.5f) : ceil(value - 0.5f)); }
|
||||
template <typename outT> outT uiround(GLfloat value) { return static_cast<outT>(value + 0.5f); }
|
||||
// Returns the product of the sizes in the vector, or 1 if the vector is empty. Doesn't currently
|
||||
// perform overflow checks.
|
||||
unsigned int ArraySizeProduct(const std::vector<unsigned int> &arraySizes);
|
||||
|
||||
unsigned int ParseAndStripArrayIndex(std::string *name);
|
||||
// Return the array index at the end of name, and write the length of name before the final array
|
||||
// index into nameLengthWithoutArrayIndexOut. In case name doesn't include an array index, return
|
||||
// GL_INVALID_INDEX and write the length of the original string.
|
||||
unsigned int ParseArrayIndex(const std::string &name, size_t *nameLengthWithoutArrayIndexOut);
|
||||
|
||||
struct UniformTypeInfo final : angle::NonCopyable
|
||||
{
|
||||
constexpr UniformTypeInfo(GLenum type,
|
||||
GLenum componentType,
|
||||
GLenum samplerTextureType,
|
||||
GLenum transposedMatrixType,
|
||||
GLenum boolVectorType,
|
||||
int rowCount,
|
||||
int columnCount,
|
||||
int componentCount,
|
||||
size_t componentSize,
|
||||
size_t internalSize,
|
||||
size_t externalSize,
|
||||
bool isSampler,
|
||||
bool isMatrixType,
|
||||
bool isImageType)
|
||||
: type(type),
|
||||
componentType(componentType),
|
||||
samplerTextureType(samplerTextureType),
|
||||
transposedMatrixType(transposedMatrixType),
|
||||
boolVectorType(boolVectorType),
|
||||
rowCount(rowCount),
|
||||
columnCount(columnCount),
|
||||
componentCount(componentCount),
|
||||
componentSize(componentSize),
|
||||
internalSize(internalSize),
|
||||
externalSize(externalSize),
|
||||
isSampler(isSampler),
|
||||
isMatrixType(isMatrixType),
|
||||
isImageType(isImageType)
|
||||
{
|
||||
}
|
||||
|
||||
GLenum type;
|
||||
GLenum componentType;
|
||||
GLenum samplerTextureType;
|
||||
GLenum transposedMatrixType;
|
||||
GLenum boolVectorType;
|
||||
int rowCount;
|
||||
int columnCount;
|
||||
int componentCount;
|
||||
size_t componentSize;
|
||||
size_t internalSize;
|
||||
size_t externalSize;
|
||||
bool isSampler;
|
||||
bool isMatrixType;
|
||||
bool isImageType;
|
||||
};
|
||||
|
||||
const UniformTypeInfo &GetUniformTypeInfo(GLenum uniformType);
|
||||
|
||||
const char *GetGenericErrorMessage(GLenum error);
|
||||
|
||||
unsigned int ElementTypeSize(GLenum elementType);
|
||||
|
||||
} // namespace gl
|
||||
|
||||
@ -81,7 +145,9 @@ size_t CubeMapTextureTargetToLayerIndex(EGLenum target);
|
||||
EGLenum LayerIndexToCubeMapTextureTarget(size_t index);
|
||||
bool IsTextureTarget(EGLenum target);
|
||||
bool IsRenderbufferTarget(EGLenum target);
|
||||
}
|
||||
|
||||
const char *GetGenericErrorMessage(EGLint error);
|
||||
} // namespace egl
|
||||
|
||||
namespace egl_gl
|
||||
{
|
||||
@ -90,6 +156,11 @@ GLenum EGLImageTargetToGLTextureTarget(EGLenum eglTarget);
|
||||
GLuint EGLClientBufferToGLObjectHandle(EGLClientBuffer buffer);
|
||||
}
|
||||
|
||||
namespace gl_egl
|
||||
{
|
||||
EGLenum GLComponentTypeToEGLColorComponentType(GLenum glComponentType);
|
||||
} // namespace gl_egl
|
||||
|
||||
#if !defined(ANGLE_ENABLE_WINDOWS_STORE)
|
||||
std::string getTempPath();
|
||||
void writeFile(const char* path, const void* data, size_t size);
|
||||
|
523
src/3rdparty/angle/src/common/vector_utils.h
vendored
Normal file
523
src/3rdparty/angle/src/common/vector_utils.h
vendored
Normal file
@ -0,0 +1,523 @@
|
||||
//
|
||||
// Copyright 2016 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.
|
||||
//
|
||||
// vector_utils.h: Utility classes implementing various vector operations
|
||||
|
||||
#ifndef COMMON_VECTOR_UTILS_H_
|
||||
#define COMMON_VECTOR_UTILS_H_
|
||||
|
||||
#include <cmath>
|
||||
#include <cstddef>
|
||||
#include <ostream>
|
||||
#include <type_traits>
|
||||
|
||||
namespace angle
|
||||
{
|
||||
|
||||
template <size_t Dimension, typename Type>
|
||||
class Vector;
|
||||
|
||||
using Vector2 = Vector<2, float>;
|
||||
using Vector3 = Vector<3, float>;
|
||||
using Vector4 = Vector<4, float>;
|
||||
|
||||
using Vector2I = Vector<2, int>;
|
||||
using Vector3I = Vector<3, int>;
|
||||
using Vector4I = Vector<4, int>;
|
||||
|
||||
using Vector2U = Vector<2, unsigned int>;
|
||||
using Vector3U = Vector<3, unsigned int>;
|
||||
using Vector4U = Vector<4, unsigned int>;
|
||||
|
||||
template <size_t Dimension, typename Type>
|
||||
class VectorBase
|
||||
{
|
||||
public:
|
||||
using VectorN = Vector<Dimension, Type>;
|
||||
|
||||
// Constructors
|
||||
VectorBase() = default;
|
||||
explicit VectorBase(Type element);
|
||||
|
||||
template <typename Type2>
|
||||
VectorBase(const VectorBase<Dimension, Type2> &other);
|
||||
|
||||
template <typename Arg1, typename Arg2, typename... Args>
|
||||
VectorBase(const Arg1 &arg1, const Arg2 &arg2, const Args &... args);
|
||||
|
||||
// Access the vector backing storage directly
|
||||
const Type *data() const { return mData; }
|
||||
Type *data() { return mData; }
|
||||
constexpr size_t size() const { return Dimension; }
|
||||
|
||||
// Load or store the pointer from / to raw data
|
||||
static VectorN Load(const Type *source);
|
||||
static void Store(const VectorN &source, Type *destination);
|
||||
|
||||
// Index the vector
|
||||
Type &operator[](size_t i) { return mData[i]; }
|
||||
const Type &operator[](size_t i) const { return mData[i]; }
|
||||
|
||||
// Basic arithmetic operations
|
||||
VectorN operator+() const;
|
||||
VectorN operator-() const;
|
||||
VectorN operator+(const VectorN &other) const;
|
||||
VectorN operator-(const VectorN &other) const;
|
||||
VectorN operator*(const VectorN &other) const;
|
||||
VectorN operator/(const VectorN &other) const;
|
||||
VectorN operator*(Type other) const;
|
||||
VectorN operator/(Type other) const;
|
||||
friend VectorN operator*(Type a, const VectorN &b) { return b * a; }
|
||||
|
||||
// Compound arithmetic operations
|
||||
VectorN &operator+=(const VectorN &other);
|
||||
VectorN &operator-=(const VectorN &other);
|
||||
VectorN &operator*=(const VectorN &other);
|
||||
VectorN &operator/=(const VectorN &other);
|
||||
VectorN &operator*=(Type other);
|
||||
VectorN &operator/=(Type other);
|
||||
|
||||
// Comparison operators
|
||||
bool operator==(const VectorN &other) const;
|
||||
bool operator!=(const VectorN &other) const;
|
||||
|
||||
// Other arithmetic operations
|
||||
Type length() const;
|
||||
Type lengthSquared() const;
|
||||
Type dot(const VectorBase<Dimension, Type> &other) const;
|
||||
VectorN normalized() const;
|
||||
|
||||
protected:
|
||||
template <size_t CurrentIndex, size_t OtherDimension, typename OtherType, typename... Args>
|
||||
void initWithList(const Vector<OtherDimension, OtherType> &arg1, const Args &... args);
|
||||
|
||||
// Some old compilers consider this function an alternative for initWithList(Vector)
|
||||
// when the variant above is more precise. Use SFINAE on the return value to hide
|
||||
// this variant for non-arithmetic types. The return value is still void.
|
||||
template <size_t CurrentIndex, typename OtherType, typename... Args>
|
||||
typename std::enable_if<std::is_arithmetic<OtherType>::value>::type initWithList(
|
||||
OtherType arg1,
|
||||
const Args &... args);
|
||||
|
||||
template <size_t CurrentIndex>
|
||||
void initWithList() const;
|
||||
|
||||
template <size_t Dimension2, typename Type2>
|
||||
friend class VectorBase;
|
||||
|
||||
Type mData[Dimension];
|
||||
};
|
||||
|
||||
template <size_t Dimension, typename Type>
|
||||
std::ostream &operator<<(std::ostream &ostream, const VectorBase<Dimension, Type> &vector);
|
||||
|
||||
template <typename Type>
|
||||
class Vector<2, Type> : public VectorBase<2, Type>
|
||||
{
|
||||
public:
|
||||
// Import the constructors defined in VectorBase
|
||||
using VectorBase<2, Type>::VectorBase;
|
||||
|
||||
// Element shorthands
|
||||
Type &x() { return this->mData[0]; }
|
||||
Type &y() { return this->mData[1]; }
|
||||
|
||||
const Type &x() const { return this->mData[0]; }
|
||||
const Type &y() const { return this->mData[1]; }
|
||||
};
|
||||
|
||||
template <typename Type>
|
||||
std::ostream &operator<<(std::ostream &ostream, const Vector<2, Type> &vector);
|
||||
|
||||
template <typename Type>
|
||||
class Vector<3, Type> : public VectorBase<3, Type>
|
||||
{
|
||||
public:
|
||||
// Import the constructors defined in VectorBase
|
||||
using VectorBase<3, Type>::VectorBase;
|
||||
|
||||
// Additional operations
|
||||
Vector<3, Type> cross(const Vector<3, Type> &other) const;
|
||||
|
||||
// Element shorthands
|
||||
Type &x() { return this->mData[0]; }
|
||||
Type &y() { return this->mData[1]; }
|
||||
Type &z() { return this->mData[2]; }
|
||||
|
||||
const Type &x() const { return this->mData[0]; }
|
||||
const Type &y() const { return this->mData[1]; }
|
||||
const Type &z() const { return this->mData[2]; }
|
||||
};
|
||||
|
||||
template <typename Type>
|
||||
std::ostream &operator<<(std::ostream &ostream, const Vector<3, Type> &vector);
|
||||
|
||||
template <typename Type>
|
||||
class Vector<4, Type> : public VectorBase<4, Type>
|
||||
{
|
||||
public:
|
||||
// Import the constructors defined in VectorBase
|
||||
using VectorBase<4, Type>::VectorBase;
|
||||
|
||||
// Element shorthands
|
||||
Type &x() { return this->mData[0]; }
|
||||
Type &y() { return this->mData[1]; }
|
||||
Type &z() { return this->mData[2]; }
|
||||
Type &w() { return this->mData[3]; }
|
||||
|
||||
const Type &x() const { return this->mData[0]; }
|
||||
const Type &y() const { return this->mData[1]; }
|
||||
const Type &z() const { return this->mData[2]; }
|
||||
const Type &w() const { return this->mData[3]; }
|
||||
};
|
||||
|
||||
template <typename Type>
|
||||
std::ostream &operator<<(std::ostream &ostream, const Vector<4, Type> &vector);
|
||||
|
||||
// Implementation of constructors and misc operations
|
||||
|
||||
template <size_t Dimension, typename Type>
|
||||
VectorBase<Dimension, Type>::VectorBase(Type element)
|
||||
{
|
||||
for (size_t i = 0; i < Dimension; ++i)
|
||||
{
|
||||
mData[i] = element;
|
||||
}
|
||||
}
|
||||
|
||||
template <size_t Dimension, typename Type>
|
||||
template <typename Type2>
|
||||
VectorBase<Dimension, Type>::VectorBase(const VectorBase<Dimension, Type2> &other)
|
||||
{
|
||||
for (size_t i = 0; i < Dimension; ++i)
|
||||
{
|
||||
mData[i] = static_cast<Type>(other.mData[i]);
|
||||
}
|
||||
}
|
||||
|
||||
// Ideally we would like to have only two constructors:
|
||||
// - a scalar constructor that takes Type as a parameter
|
||||
// - a compound constructor
|
||||
// However if we define the compound constructor for when it has a single arguments, then calling
|
||||
// Vector2(0.0) will be ambiguous. To solve this we take advantage of there being a single compound
|
||||
// constructor with a single argument, which is the copy constructor. We end up with three
|
||||
// constructors:
|
||||
// - the scalar constructor
|
||||
// - the copy constructor
|
||||
// - the compound constructor for two or more arguments, hence the arg1, and arg2 here.
|
||||
template <size_t Dimension, typename Type>
|
||||
template <typename Arg1, typename Arg2, typename... Args>
|
||||
VectorBase<Dimension, Type>::VectorBase(const Arg1 &arg1, const Arg2 &arg2, const Args &... args)
|
||||
{
|
||||
initWithList<0>(arg1, arg2, args...);
|
||||
}
|
||||
|
||||
template <size_t Dimension, typename Type>
|
||||
template <size_t CurrentIndex, size_t OtherDimension, typename OtherType, typename... Args>
|
||||
void VectorBase<Dimension, Type>::initWithList(const Vector<OtherDimension, OtherType> &arg1,
|
||||
const Args &... args)
|
||||
{
|
||||
static_assert(CurrentIndex + OtherDimension <= Dimension,
|
||||
"Too much data in the vector constructor.");
|
||||
for (size_t i = 0; i < OtherDimension; ++i)
|
||||
{
|
||||
mData[CurrentIndex + i] = static_cast<Type>(arg1.mData[i]);
|
||||
}
|
||||
initWithList<CurrentIndex + OtherDimension>(args...);
|
||||
}
|
||||
|
||||
template <size_t Dimension, typename Type>
|
||||
template <size_t CurrentIndex, typename OtherType, typename... Args>
|
||||
typename std::enable_if<std::is_arithmetic<OtherType>::value>::type
|
||||
VectorBase<Dimension, Type>::initWithList(OtherType arg1, const Args &... args)
|
||||
{
|
||||
static_assert(CurrentIndex + 1 <= Dimension, "Too much data in the vector constructor.");
|
||||
mData[CurrentIndex] = static_cast<Type>(arg1);
|
||||
initWithList<CurrentIndex + 1>(args...);
|
||||
}
|
||||
|
||||
template <size_t Dimension, typename Type>
|
||||
template <size_t CurrentIndex>
|
||||
void VectorBase<Dimension, Type>::initWithList() const
|
||||
{
|
||||
static_assert(CurrentIndex == Dimension, "Not enough data in the vector constructor.");
|
||||
}
|
||||
|
||||
template <size_t Dimension, typename Type>
|
||||
Vector<Dimension, Type> VectorBase<Dimension, Type>::Load(const Type *source)
|
||||
{
|
||||
Vector<Dimension, Type> result;
|
||||
for (size_t i = 0; i < Dimension; ++i)
|
||||
{
|
||||
result.mData[i] = source[i];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
template <size_t Dimension, typename Type>
|
||||
void VectorBase<Dimension, Type>::Store(const Vector<Dimension, Type> &source, Type *destination)
|
||||
{
|
||||
for (size_t i = 0; i < Dimension; ++i)
|
||||
{
|
||||
destination[i] = source.mData[i];
|
||||
}
|
||||
}
|
||||
|
||||
// Implementation of basic arithmetic operations
|
||||
template <size_t Dimension, typename Type>
|
||||
Vector<Dimension, Type> VectorBase<Dimension, Type>::operator+() const
|
||||
{
|
||||
Vector<Dimension, Type> result;
|
||||
for (size_t i = 0; i < Dimension; ++i)
|
||||
{
|
||||
result.mData[i] = +mData[i];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
template <size_t Dimension, typename Type>
|
||||
Vector<Dimension, Type> VectorBase<Dimension, Type>::operator-() const
|
||||
{
|
||||
Vector<Dimension, Type> result;
|
||||
for (size_t i = 0; i < Dimension; ++i)
|
||||
{
|
||||
result.mData[i] = -mData[i];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
template <size_t Dimension, typename Type>
|
||||
Vector<Dimension, Type> VectorBase<Dimension, Type>::operator+(
|
||||
const Vector<Dimension, Type> &other) const
|
||||
{
|
||||
Vector<Dimension, Type> result;
|
||||
for (size_t i = 0; i < Dimension; ++i)
|
||||
{
|
||||
result.mData[i] = mData[i] + other.mData[i];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
template <size_t Dimension, typename Type>
|
||||
Vector<Dimension, Type> VectorBase<Dimension, Type>::operator-(
|
||||
const Vector<Dimension, Type> &other) const
|
||||
{
|
||||
Vector<Dimension, Type> result;
|
||||
for (size_t i = 0; i < Dimension; ++i)
|
||||
{
|
||||
result.mData[i] = mData[i] - other.mData[i];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
template <size_t Dimension, typename Type>
|
||||
Vector<Dimension, Type> VectorBase<Dimension, Type>::operator*(
|
||||
const Vector<Dimension, Type> &other) const
|
||||
{
|
||||
Vector<Dimension, Type> result;
|
||||
for (size_t i = 0; i < Dimension; ++i)
|
||||
{
|
||||
result.mData[i] = mData[i] * other.mData[i];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
template <size_t Dimension, typename Type>
|
||||
Vector<Dimension, Type> VectorBase<Dimension, Type>::operator/(
|
||||
const Vector<Dimension, Type> &other) const
|
||||
{
|
||||
Vector<Dimension, Type> result;
|
||||
for (size_t i = 0; i < Dimension; ++i)
|
||||
{
|
||||
result.mData[i] = mData[i] / other.mData[i];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
template <size_t Dimension, typename Type>
|
||||
Vector<Dimension, Type> VectorBase<Dimension, Type>::operator*(Type other) const
|
||||
{
|
||||
Vector<Dimension, Type> result;
|
||||
for (size_t i = 0; i < Dimension; ++i)
|
||||
{
|
||||
result.mData[i] = mData[i] * other;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
template <size_t Dimension, typename Type>
|
||||
Vector<Dimension, Type> VectorBase<Dimension, Type>::operator/(Type other) const
|
||||
{
|
||||
Vector<Dimension, Type> result;
|
||||
for (size_t i = 0; i < Dimension; ++i)
|
||||
{
|
||||
result.mData[i] = mData[i] / other;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// Implementation of compound arithmetic operations
|
||||
template <size_t Dimension, typename Type>
|
||||
Vector<Dimension, Type> &VectorBase<Dimension, Type>::operator+=(
|
||||
const Vector<Dimension, Type> &other)
|
||||
{
|
||||
for (size_t i = 0; i < Dimension; ++i)
|
||||
{
|
||||
mData[i] += other.mData[i];
|
||||
}
|
||||
return *reinterpret_cast<Vector<Dimension, Type> *>(this);
|
||||
}
|
||||
|
||||
template <size_t Dimension, typename Type>
|
||||
Vector<Dimension, Type> &VectorBase<Dimension, Type>::operator-=(
|
||||
const Vector<Dimension, Type> &other)
|
||||
{
|
||||
for (size_t i = 0; i < Dimension; ++i)
|
||||
{
|
||||
mData[i] -= other.mData[i];
|
||||
}
|
||||
return *reinterpret_cast<Vector<Dimension, Type> *>(this);
|
||||
}
|
||||
|
||||
template <size_t Dimension, typename Type>
|
||||
Vector<Dimension, Type> &VectorBase<Dimension, Type>::operator*=(
|
||||
const Vector<Dimension, Type> &other)
|
||||
{
|
||||
for (size_t i = 0; i < Dimension; ++i)
|
||||
{
|
||||
mData[i] *= other.mData[i];
|
||||
}
|
||||
return *reinterpret_cast<Vector<Dimension, Type> *>(this);
|
||||
}
|
||||
|
||||
template <size_t Dimension, typename Type>
|
||||
Vector<Dimension, Type> &VectorBase<Dimension, Type>::operator/=(
|
||||
const Vector<Dimension, Type> &other)
|
||||
{
|
||||
for (size_t i = 0; i < Dimension; ++i)
|
||||
{
|
||||
mData[i] /= other.mData[i];
|
||||
}
|
||||
return *reinterpret_cast<Vector<Dimension, Type> *>(this);
|
||||
}
|
||||
|
||||
template <size_t Dimension, typename Type>
|
||||
Vector<Dimension, Type> &VectorBase<Dimension, Type>::operator*=(Type other)
|
||||
{
|
||||
for (size_t i = 0; i < Dimension; ++i)
|
||||
{
|
||||
mData[i] *= other;
|
||||
}
|
||||
return *reinterpret_cast<Vector<Dimension, Type> *>(this);
|
||||
}
|
||||
|
||||
template <size_t Dimension, typename Type>
|
||||
Vector<Dimension, Type> &VectorBase<Dimension, Type>::operator/=(Type other)
|
||||
{
|
||||
for (size_t i = 0; i < Dimension; ++i)
|
||||
{
|
||||
mData[i] /= other;
|
||||
}
|
||||
return *reinterpret_cast<Vector<Dimension, Type> *>(this);
|
||||
}
|
||||
|
||||
// Implementation of comparison operators
|
||||
template <size_t Dimension, typename Type>
|
||||
bool VectorBase<Dimension, Type>::operator==(const Vector<Dimension, Type> &other) const
|
||||
{
|
||||
for (size_t i = 0; i < Dimension; ++i)
|
||||
{
|
||||
if (mData[i] != other.mData[i])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
template <size_t Dimension, typename Type>
|
||||
bool VectorBase<Dimension, Type>::operator!=(const Vector<Dimension, Type> &other) const
|
||||
{
|
||||
return !(*this == other);
|
||||
}
|
||||
|
||||
// Implementation of other arithmetic operations
|
||||
template <size_t Dimension, typename Type>
|
||||
Type VectorBase<Dimension, Type>::length() const
|
||||
{
|
||||
static_assert(std::is_floating_point<Type>::value,
|
||||
"VectorN::length is only defined for floating point vectors");
|
||||
return std::sqrt(lengthSquared());
|
||||
}
|
||||
|
||||
template <size_t Dimension, typename Type>
|
||||
Type VectorBase<Dimension, Type>::lengthSquared() const
|
||||
{
|
||||
return dot(*this);
|
||||
}
|
||||
|
||||
template <size_t Dimension, typename Type>
|
||||
Type VectorBase<Dimension, Type>::dot(const VectorBase<Dimension, Type> &other) const
|
||||
{
|
||||
Type sum = Type();
|
||||
for (size_t i = 0; i < Dimension; ++i)
|
||||
{
|
||||
sum += mData[i] * other.mData[i];
|
||||
}
|
||||
return sum;
|
||||
}
|
||||
|
||||
template <size_t Dimension, typename Type>
|
||||
std::ostream &operator<<(std::ostream &ostream, const VectorBase<Dimension, Type> &vector)
|
||||
{
|
||||
ostream << "[ ";
|
||||
for (size_t elementIdx = 0; elementIdx < Dimension; elementIdx++)
|
||||
{
|
||||
if (elementIdx > 0)
|
||||
{
|
||||
ostream << ", ";
|
||||
}
|
||||
ostream << vector.data()[elementIdx];
|
||||
}
|
||||
ostream << " ]";
|
||||
return ostream;
|
||||
}
|
||||
|
||||
template <size_t Dimension, typename Type>
|
||||
Vector<Dimension, Type> VectorBase<Dimension, Type>::normalized() const
|
||||
{
|
||||
static_assert(std::is_floating_point<Type>::value,
|
||||
"VectorN::normalized is only defined for floating point vectors");
|
||||
return *this / length();
|
||||
}
|
||||
|
||||
template <typename Type>
|
||||
std::ostream &operator<<(std::ostream &ostream, const Vector<2, Type> &vector)
|
||||
{
|
||||
return ostream << static_cast<const VectorBase<2, Type> &>(vector);
|
||||
}
|
||||
|
||||
template <typename Type>
|
||||
Vector<3, Type> Vector<3, Type>::cross(const Vector<3, Type> &other) const
|
||||
{
|
||||
return Vector<3, Type>(y() * other.z() - z() * other.y(), z() * other.x() - x() * other.z(),
|
||||
x() * other.y() - y() * other.x());
|
||||
}
|
||||
|
||||
template <typename Type>
|
||||
std::ostream &operator<<(std::ostream &ostream, const Vector<3, Type> &vector)
|
||||
{
|
||||
return ostream << static_cast<const VectorBase<3, Type> &>(vector);
|
||||
}
|
||||
|
||||
template <typename Type>
|
||||
std::ostream &operator<<(std::ostream &ostream, const Vector<4, Type> &vector)
|
||||
{
|
||||
return ostream << static_cast<const VectorBase<4, Type> &>(vector);
|
||||
}
|
||||
|
||||
} // namespace angle
|
||||
|
||||
#endif // COMMON_VECTOR_UTILS_H_
|
179
src/3rdparty/angle/src/compiler/fuzz/translator_fuzzer.cpp
vendored
Normal file
179
src/3rdparty/angle/src/compiler/fuzz/translator_fuzzer.cpp
vendored
Normal file
@ -0,0 +1,179 @@
|
||||
//
|
||||
// Copyright (c) 2016 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.
|
||||
//
|
||||
|
||||
// translator_fuzzer.cpp: A libfuzzer fuzzer for the shader translator.
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "angle_gl.h"
|
||||
#include "compiler/translator/Compiler.h"
|
||||
#include "compiler/translator/util.h"
|
||||
|
||||
using namespace sh;
|
||||
|
||||
struct TranslatorCacheKey
|
||||
{
|
||||
bool operator==(const TranslatorCacheKey &other) const
|
||||
{
|
||||
return type == other.type && spec == other.spec && output == other.output;
|
||||
}
|
||||
|
||||
uint32_t type = 0;
|
||||
uint32_t spec = 0;
|
||||
uint32_t output = 0;
|
||||
};
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
template <>
|
||||
struct hash<TranslatorCacheKey>
|
||||
{
|
||||
std::size_t operator()(const TranslatorCacheKey &k) const
|
||||
{
|
||||
return (hash<uint32_t>()(k.type) << 1) ^ (hash<uint32_t>()(k.spec) >> 1) ^
|
||||
hash<uint32_t>()(k.output);
|
||||
}
|
||||
};
|
||||
} // namespace std
|
||||
|
||||
struct TCompilerDeleter
|
||||
{
|
||||
void operator()(TCompiler *compiler) const { DeleteCompiler(compiler); }
|
||||
};
|
||||
|
||||
using UniqueTCompiler = std::unique_ptr<TCompiler, TCompilerDeleter>;
|
||||
|
||||
static std::unordered_map<TranslatorCacheKey, UniqueTCompiler> translators;
|
||||
|
||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
|
||||
{
|
||||
// Reserve some size for future compile options
|
||||
const size_t kHeaderSize = 128;
|
||||
|
||||
if (size <= kHeaderSize)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Make sure the rest of data will be a valid C string so that we don't have to copy it.
|
||||
if (data[size - 1] != 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t type = *reinterpret_cast<const uint32_t *>(data);
|
||||
uint32_t spec = *reinterpret_cast<const uint32_t *>(data + 4);
|
||||
uint32_t output = *reinterpret_cast<const uint32_t *>(data + 8);
|
||||
uint64_t options = *reinterpret_cast<const uint64_t *>(data + 12);
|
||||
|
||||
if (type != GL_FRAGMENT_SHADER && type != GL_VERTEX_SHADER)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (spec != SH_GLES2_SPEC && type != SH_WEBGL_SPEC && spec != SH_GLES3_SPEC &&
|
||||
spec != SH_WEBGL2_SPEC)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
ShShaderOutput shaderOutput = static_cast<ShShaderOutput>(output);
|
||||
if (!(IsOutputGLSL(shaderOutput) || IsOutputESSL(shaderOutput)) &&
|
||||
(options & SH_SELECT_VIEW_IN_NV_GLSL_VERTEX_SHADER) != 0u)
|
||||
{
|
||||
// This compiler option is only available in ESSL and GLSL.
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::vector<uint32_t> validOutputs;
|
||||
validOutputs.push_back(SH_ESSL_OUTPUT);
|
||||
validOutputs.push_back(SH_GLSL_COMPATIBILITY_OUTPUT);
|
||||
validOutputs.push_back(SH_GLSL_130_OUTPUT);
|
||||
validOutputs.push_back(SH_GLSL_140_OUTPUT);
|
||||
validOutputs.push_back(SH_GLSL_150_CORE_OUTPUT);
|
||||
validOutputs.push_back(SH_GLSL_330_CORE_OUTPUT);
|
||||
validOutputs.push_back(SH_GLSL_400_CORE_OUTPUT);
|
||||
validOutputs.push_back(SH_GLSL_410_CORE_OUTPUT);
|
||||
validOutputs.push_back(SH_GLSL_420_CORE_OUTPUT);
|
||||
validOutputs.push_back(SH_GLSL_430_CORE_OUTPUT);
|
||||
validOutputs.push_back(SH_GLSL_440_CORE_OUTPUT);
|
||||
validOutputs.push_back(SH_GLSL_450_CORE_OUTPUT);
|
||||
validOutputs.push_back(SH_HLSL_3_0_OUTPUT);
|
||||
validOutputs.push_back(SH_HLSL_4_1_OUTPUT);
|
||||
validOutputs.push_back(SH_HLSL_4_0_FL9_3_OUTPUT);
|
||||
bool found = false;
|
||||
for (auto valid : validOutputs)
|
||||
{
|
||||
found = found || (valid == output);
|
||||
}
|
||||
if (!found)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
size -= kHeaderSize;
|
||||
data += kHeaderSize;
|
||||
|
||||
if (!sh::Initialize())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
TranslatorCacheKey key;
|
||||
key.type = type;
|
||||
key.spec = spec;
|
||||
key.output = output;
|
||||
|
||||
if (translators.find(key) == translators.end())
|
||||
{
|
||||
UniqueTCompiler translator(
|
||||
ConstructCompiler(type, static_cast<ShShaderSpec>(spec), shaderOutput));
|
||||
|
||||
if (translator == nullptr)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
ShBuiltInResources resources;
|
||||
sh::InitBuiltInResources(&resources);
|
||||
|
||||
// Enable all the extensions to have more coverage
|
||||
resources.OES_standard_derivatives = 1;
|
||||
resources.OES_EGL_image_external = 1;
|
||||
resources.OES_EGL_image_external_essl3 = 1;
|
||||
resources.NV_EGL_stream_consumer_external = 1;
|
||||
resources.ARB_texture_rectangle = 1;
|
||||
resources.EXT_blend_func_extended = 1;
|
||||
resources.EXT_draw_buffers = 1;
|
||||
resources.EXT_frag_depth = 1;
|
||||
resources.EXT_shader_texture_lod = 1;
|
||||
resources.WEBGL_debug_shader_precision = 1;
|
||||
resources.EXT_shader_framebuffer_fetch = 1;
|
||||
resources.NV_shader_framebuffer_fetch = 1;
|
||||
resources.ARM_shader_framebuffer_fetch = 1;
|
||||
resources.EXT_YUV_target = 1;
|
||||
resources.MaxDualSourceDrawBuffers = 1;
|
||||
|
||||
if (!translator->Init(resources))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
translators[key] = std::move(translator);
|
||||
}
|
||||
|
||||
auto &translator = translators[key];
|
||||
|
||||
const char *shaderStrings[] = {reinterpret_cast<const char *>(data)};
|
||||
translator->compile(shaderStrings, 1, options);
|
||||
|
||||
return 0;
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user