Bug 1297924 - Update ANGLE to chromium/2845. r=jgilbert

MozReview-Commit-ID: 2H0PBFFgmDp

--HG--
rename : gfx/angle/src/libANGLE/renderer/copyimage.cpp => gfx/angle/src/image_util/copyimage.cpp
rename : gfx/angle/src/libANGLE/renderer/copyimage.h => gfx/angle/src/image_util/copyimage.h
rename : gfx/angle/src/libANGLE/renderer/copyimage.inl => gfx/angle/src/image_util/copyimage.inl
rename : gfx/angle/src/libANGLE/renderer/d3d/generatemip.inl => gfx/angle/src/image_util/generatemip.inl
rename : gfx/angle/src/libANGLE/renderer/d3d/loadimage.inl => gfx/angle/src/image_util/loadimage.inl
rename : gfx/angle/src/libANGLE/renderer/d3d/loadimage_etc.cpp => gfx/angle/src/image_util/loadimage_etc.cpp
rename : gfx/angle/src/tests/gl_tests/CompressedTextureTest.cpp => gfx/angle/src/tests/gl_tests/DXT1CompressedTextureTest.cpp
This commit is contained in:
Morris Tseng 2016-09-08 16:28:30 +08:00
parent d619d6d908
commit c2a42c52bd
1113 changed files with 35447 additions and 17165 deletions

3
gfx/angle/AUTHORS Normal file → Executable file
View File

@ -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.
@ -45,3 +45,4 @@ Maks Naumov
Jinyoung Hur
Sebastian Bergstein
James Ross-Gowan
Nickolay Artamonov

122
gfx/angle/BUILD.gn Normal file → Executable file
View File

@ -4,8 +4,16 @@
# import the use_x11 variable
import("//build/config/dcheck_always_on.gni")
import("//build/config/linux/pkg_config.gni")
import("//build/config/ui.gni")
import("//third_party/angle/build/angle_common.gni")
import("//ui/ozone/ozone.gni")
if (ozone_platform_gbm) {
pkg_config("libdrm") {
packages = [ "libdrm" ]
}
}
angle_git_is_present = exec_script("src/commit_id.py",
[
@ -40,6 +48,16 @@ config("internal_config") {
]
}
config("extra_warnings") {
# Enable more default warnings on Windows.
if (is_win) {
cflags = [
"/we4244", # Conversion: possible loss of data.
"/we4456", # Variable shadowing.
]
}
}
if (is_win) {
copy("copy_compiler_dll") {
sources = [
@ -51,10 +69,7 @@ if (is_win) {
}
}
angle_undefine_configs = [
"//build/config/compiler:chromium_code",
"//build/config/compiler:default_include_dirs",
]
angle_undefine_configs = [ "//build/config/compiler:default_include_dirs" ]
component("translator") {
sources = [
@ -65,10 +80,7 @@ component("translator") {
defines = [ "ANGLE_TRANSLATOR_IMPLEMENTATION" ]
configs -= angle_undefine_configs
configs += [
":internal_config",
"//build/config/compiler:no_chromium_code",
]
configs += [ ":internal_config" ]
public_deps = [
":translator_lib",
@ -97,10 +109,7 @@ static_library("preprocessor") {
sources = rebase_path(compiler_gypi.angle_preprocessor_sources, ".", "src")
configs -= angle_undefine_configs
configs += [
":internal_config",
"//build/config/compiler:no_chromium_code",
]
configs += [ ":internal_config" ]
}
config("translator_static_config") {
@ -130,8 +139,8 @@ static_library("angle_common") {
configs += [
":angle_common_config",
":debug_annotations_config",
":extra_warnings",
":internal_config",
"//build/config/compiler:no_chromium_code",
]
public_deps = [
@ -143,6 +152,26 @@ static_library("angle_common") {
]
}
config("angle_image_util_config") {
include_dirs = [
"include",
"src",
]
}
static_library("angle_image_util") {
sources = rebase_path(gles_gypi.libangle_image_util_sources, ".", "src")
configs -= angle_undefine_configs
configs += [ ":internal_config" ]
public_configs = [ ":angle_image_util_config" ]
public_deps = [
":angle_common",
]
}
static_library("translator_lib") {
sources = rebase_path(compiler_gypi.angle_translator_lib_sources, ".", "src")
defines = []
@ -168,7 +197,6 @@ static_library("translator_lib") {
configs += [
":internal_config",
":translator_static_config",
"//build/config/compiler:no_chromium_code",
]
public_configs = [ ":external_config" ]
@ -180,6 +208,12 @@ static_library("translator_lib") {
public_deps = [
":angle_common",
]
if (is_win) {
# Necessary to suppress some system header xtree warnigns in Release.
# For some reason this warning doesn't get triggered in Chromium
cflags = [ "/wd4718" ]
}
}
static_library("translator_static") {
@ -193,10 +227,7 @@ static_library("translator_static") {
}
configs -= angle_undefine_configs
configs += [
":internal_config",
"//build/config/compiler:no_chromium_code",
]
configs += [ ":internal_config" ]
public_configs = [ ":translator_static_config" ]
public_deps = [
@ -285,6 +316,7 @@ static_library("libANGLE") {
":angle_common",
]
deps = [
":angle_image_util",
":commit_id",
":includes",
":translator_static",
@ -343,6 +375,14 @@ static_library("libANGLE") {
"log",
]
}
if (ozone_platform_gbm) {
configs += [ ":libdrm" ]
defines += [ "ANGLE_USE_OZONE" ]
deps += [ "//third_party/minigbm" ]
sources += rebase_path(gles_gypi.libangle_gl_egl_sources, ".", "src")
sources += rebase_path(gles_gypi.libangle_gl_egl_dl_sources, ".", "src")
sources += rebase_path(gles_gypi.libangle_gl_ozone_sources, ".", "src")
}
}
if (angle_enable_vulkan) {
@ -354,12 +394,13 @@ static_library("libANGLE") {
}
configs -= angle_undefine_configs
configs += [
":commit_id_config",
":debug_annotations_config",
":extra_warnings",
":libANGLE_config",
":internal_config",
"//build/config/compiler:no_chromium_code",
]
if (is_win) {
@ -369,6 +410,17 @@ static_library("libANGLE") {
}
}
config("shared_library_public_config") {
if (is_mac && !is_component_build) {
# Executable targets that depend on the shared libraries below need to have
# the rpath setup in non-component build configurations.
ldflags = [
"-rpath",
"@executable_path/",
]
}
}
shared_library("libGLESv2") {
sources = rebase_path(gles_gypi.libglesv2_sources, ".", "src")
@ -377,13 +429,20 @@ shared_library("libGLESv2") {
[ "/DEF:" + rebase_path("src/libGLESv2/libGLESv2.def", root_build_dir) ]
}
if (is_mac && !is_component_build) {
ldflags = [
"-install_name",
"@rpath/${target_name}.dylib",
]
public_configs = [ ":shared_library_public_config" ]
}
configs -= angle_undefine_configs
configs += [
":internal_config",
":commit_id_config",
":debug_annotations_config",
":libANGLE_config",
"//build/config/compiler:no_chromium_code",
]
defines = [ "LIBGLESV2_IMPLEMENTATION" ]
@ -401,13 +460,21 @@ shared_library("libEGL") {
ldflags = [ "/DEF:" + rebase_path("src/libEGL/libEGL.def", root_build_dir) ]
}
if (is_mac && !is_component_build) {
ldflags = [
"-install_name",
"@rpath/${target_name}.dylib",
]
public_configs = [ ":shared_library_public_config" ]
}
configs -= angle_undefine_configs
configs += [
":internal_config",
":commit_id_config",
":debug_annotations_config",
":extra_warnings",
":internal_config",
":libANGLE_config",
"//build/config/compiler:no_chromium_code",
]
defines = [ "LIBEGL_IMPLEMENTATION" ]
@ -425,7 +492,7 @@ util_gypi = exec_script("//build/gypi_to_gn.py",
config("angle_util_config") {
include_dirs = [ "util" ]
if (is_linux) {
if (is_linux && use_x11) {
libs = [ "X11" ]
}
}
@ -464,12 +531,19 @@ static_library("angle_util") {
]
}
if (use_ozone) {
sources += rebase_path(util_gypi.util_ozone_sources, ".", "util")
}
defines = [
"GL_GLEXT_PROTOTYPES",
"EGL_EGLEXT_PROTOTYPES",
]
configs += [ ":debug_annotations_config" ]
configs += [
":debug_annotations_config",
":extra_warnings",
]
public_configs = [
":angle_util_config",

2
gfx/angle/CONTRIBUTORS Normal file → Executable file
View File

@ -104,10 +104,12 @@ NVIDIA Corporation
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

0
gfx/angle/DEPS Normal file → Executable file
View File

0
gfx/angle/DEPS.chromium Normal file → Executable file
View File

0
gfx/angle/LICENSE Normal file → Executable file
View File

0
gfx/angle/Makefile.in Normal file → Executable file
View File

0
gfx/angle/README.chromium Normal file → Executable file
View File

47
gfx/angle/README.md Normal file → Executable file
View File

@ -1,26 +1,43 @@
# ANGLE - Almost Native Graphics Layer Engine
The goal of ANGLE is to allow users of multiple operating systems to seamlessly run WebGL and other OpenGL ES content by translating OpenGL ES API calls to one of the hardware-supported APIs available for that platform. ANGLE currently provides translation from OpenGL ES 2.0 to desktop OpenGL, Direct3D 9, and Direct3D 11. Support for translation from OpenGL ES 3.0 to all of these APIs is nearing completion, and future plans include enabling validated ES-to-ES support.
The goal of ANGLE is to allow users of multiple operating systems to seamlessly run WebGL and other
OpenGL ES content by translating OpenGL ES API calls to one of the hardware-supported APIs available
for that platform. ANGLE currently provides translation from OpenGL ES 2.0 and 3.0 to desktop
OpenGL, OpenGL ES, Direct3D 9, and Direct3D 11. Support for translation from OpenGL ES to Vulkan is
underway, and future plans include compute shader support (ES 3.1) and MacOS support.
| | Direct3D 9 | Direct3D 11 | Desktop GL | GL ES |
|----------------|:-------------:|:-------------------:|:------------------:|:---------:|
| OpenGL ES 2.0 | complete | complete | complete | planned |
| OpenGL ES 3.0 | | nearing completion | nearing completion | planned |
[Level of OpenGL ES support via backing renderers]
### Level of OpenGL ES support via backing renderers
| | Direct3D 9 | Direct3D 11 | Desktop GL | GL ES | Vulkan |
|----------------|:-------------:|:----------------:|:--------------:|:-------------:|:-------------:|
| OpenGL ES 2.0 | complete | complete | complete | complete | in progress |
| OpenGL ES 3.0 | | complete | complete | in progress | not started |
| OpenGL ES 3.1 | | not started | in progress | in progress | not started |
| | Direct3D 9 | Direct3D 11 | Desktop GL |
|------------:|:--------------:|:--------------:|:-------------:|
| Windows | * | * | * |
| Linux | | | * |
| Mac OS X | | | in progress |
[Platform support via backing renderers]
### Platform support via backing renderers
ANGLE v1.0.772 was certified compliant by passing the ES 2.0.3 conformance tests in October 2011. ANGLE also provides an implementation of the EGL 1.4 specification.
| | Direct3D 9 | Direct3D 11 | Desktop GL | GL ES | Vulkan |
|------------:|:--------------:|:--------------:|:-------------:|:-----------:|:-----------:|
| Windows | complete | complete | complete | complete | in progress |
| Linux | | | complete | | planned |
| Mac OS X | | | in progress | | |
| Chrome OS | | | | complete | planned |
| Android | | | | complete | planned |
ANGLE is used as the default WebGL backend for both Google Chrome and Mozilla Firefox on Windows platforms. Chrome uses ANGLE for all graphics rendering on Windows, including the accelerated Canvas2D implementation and the Native Client sandbox environment.
ANGLE v1.0.772 was certified compliant by passing the ES 2.0.3 conformance tests in October 2011.
ANGLE also provides an implementation of the EGL 1.4 specification.
Portions of the ANGLE shader compiler are used as a shader validator and translator by WebGL implementations across multiple platforms. It is used on Mac OS X, Linux, and in mobile variants of the browsers. Having one shader validator helps to ensure that a consistent set of GLSL ES shaders are accepted across browsers and platforms. The shader translator can be used to translate shaders to other shading languages, and to optionally apply shader modifications to work around bugs or quirks in the native graphics drivers. The translator targets Desktop GLSL, Direct3D HLSL, and even ESSL for native GLES2 platforms.
ANGLE is used as the default WebGL backend for both Google Chrome and Mozilla Firefox on Windows
platforms. Chrome uses ANGLE for all graphics rendering on Windows, including the accelerated
Canvas2D implementation and the Native Client sandbox environment.
Portions of the ANGLE shader compiler are used as a shader validator and translator by WebGL
implementations across multiple platforms. It is used on Mac OS X, Linux, and in mobile variants of
the browsers. Having one shader validator helps to ensure that a consistent set of GLSL ES shaders
are accepted across browsers and platforms. The shader translator can be used to translate shaders
to other shading languages, and to optionally apply shader modifications to work around bugs or
quirks in the native graphics drivers. The translator targets Desktop GLSL, Direct3D HLSL, and even
ESSL for native GLES2 platforms.
## Sources

0
gfx/angle/README.mozilla Normal file → Executable file
View File

0
gfx/angle/include/EGL/egl.h Normal file → Executable file
View File

0
gfx/angle/include/EGL/eglext.h Normal file → Executable file
View File

0
gfx/angle/include/EGL/eglplatform.h Normal file → Executable file
View File

0
gfx/angle/include/GLES2/gl2.h Normal file → Executable file
View File

165
gfx/angle/include/GLES2/gl2ext.h Normal file → Executable file
View File

@ -918,6 +918,68 @@ typedef void(GL_APIENTRYP PFNGLSTENCILTHENCOVERSTROKEPATHCHROMIUMPROC)(GLuint pa
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);
@ -947,6 +1009,67 @@ 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 */
@ -1138,6 +1261,48 @@ GL_APICALL void GL_APIENTRY glGetSyncivAPPLE (GLsync sync, GLenum pname, GLsizei
#define GL_ARM_shader_framebuffer_fetch_depth_stencil 1
#endif /* GL_ARM_shader_framebuffer_fetch_depth_stencil */
#ifndef GL_CHROMIUM_copy_texture
#define GL_CHROMIUM_copy_texture 1
typedef void(GL_APIENTRYP PFNGLCOPYTEXTURECHROMIUMPROC)(GLuint sourceId,
GLuint destId,
GLint internalFormat,
GLenum destType,
GLboolean unpackFlipY,
GLboolean unpackPremultiplyAlpha,
GLboolean unpackUnmultiplyAlpha);
typedef void(GL_APIENTRYP PFNGLCOPYSUBTEXTURECHROMIUMPROC)(GLuint sourceId,
GLuint destId,
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,
GLuint destId,
GLint internalFormat,
GLenum destType,
GLboolean unpackFlipY,
GLboolean unpackPremultiplyAlpha,
GLboolean unpackUnmultiplyAlpha);
GL_APICALL void GL_APIENTRY glCopySubTextureCHROMIUM(GLuint sourceId,
GLuint destId,
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_sync_query
#define GL_CHROMIUM_sync_query 1
#define GL_COMMANDS_COMPLETED_CHROMIUM 0x84F7

0
gfx/angle/include/GLES2/gl2platform.h Normal file → Executable file
View File

0
gfx/angle/include/GLES3/gl3.h Normal file → Executable file
View File

0
gfx/angle/include/GLES3/gl31.h Normal file → Executable file
View File

0
gfx/angle/include/GLES3/gl32.h Normal file → Executable file
View File

0
gfx/angle/include/GLES3/gl3platform.h Normal file → Executable file
View File

304
gfx/angle/include/GLSLANG/ShaderLang.h Normal file → Executable file
View File

@ -27,6 +27,7 @@
#include "KHR/khrplatform.h"
#include <array>
#include <map>
#include <string>
#include <vector>
@ -48,36 +49,39 @@ typedef unsigned int GLenum;
// Version number for shader translation API.
// It is incremented every time the API changes.
#define ANGLE_SH_VERSION 146
#define ANGLE_SH_VERSION 155
typedef enum {
SH_GLES2_SPEC = 0x8B40,
SH_WEBGL_SPEC = 0x8B41,
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
SH_GLES3_1_SPEC,
SH_WEBGL3_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
} ShShaderSpec;
typedef enum
@ -113,101 +117,120 @@ typedef enum
// 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,
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,
// This is needed only as a workaround for certain OpenGL driver bugs.
SH_EMULATE_BUILT_IN_FUNCTIONS = 0x0100,
// This is needed only as a workaround for certain OpenGL driver bugs.
SH_EMULATE_BUILT_IN_FUNCTIONS = 0x0100,
// 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 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 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,
// 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,
// 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,
// 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 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,
// 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,
// This flag limits the complexity of an expression.
SH_LIMIT_EXPRESSION_COMPLEXITY = 0x2000,
// This flag limits the complexity of an expression.
SH_LIMIT_EXPRESSION_COMPLEXITY = 0x2000,
// This flag limits the depth of the call stack.
SH_LIMIT_CALL_STACK_DEPTH = 0x4000,
// This flag limits the depth of the call stack.
SH_LIMIT_CALL_STACK_DEPTH = 0x4000,
// 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 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 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 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 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 initializes output variables to 0 at the beginning of main().
// It is to avoid undefined behaviors.
SH_INIT_OUTPUT_VARIABLES = 0x20000,
// TODO(zmo): obsolete, remove after ANGLE roll into Chromium.
SH_INIT_VARYINGS_WITHOUT_STATIC_USE = 0x20000,
// 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 scalarizes vec/ivec/bvec/mat constructor args.
// It is intended as a workaround for Linux/Mac driver bugs.
SH_SCALARIZE_VEC_AND_MAT_CONSTRUCTOR_ARGS = 0x40000,
// This flag overwrites a struct name with a unique prefix.
// It is intended as a workaround for drivers that do not handle
// struct scopes correctly, including all Mac drivers and Linux AMD.
SH_REGENERATE_STRUCT_NAMES = 0x80000,
// 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 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 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 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 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 works around bugs in Mac drivers related to do-while by
// transforming them into an other construct.
SH_REWRITE_DO_WHILE_LOOPS = 0x400000,
// 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,
// 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.
SH_EXPAND_SELECT_HLSL_INTEGER_POW_EXPRESSIONS = 0x800000,
// Flatten "#pragma STDGL invariant(all)" into the declarations of
// varying variables and built-in GLSL variables. This compiler
// option is enabled automatically when needed.
SH_FLATTEN_PRAGMA_STDGL_INVARIANT_ALL = 0x1000000,
// 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.
SH_HLSL_GET_DIMENSIONS_IGNORES_BASE_LEVEL = 0x2000000,
// This flag works around an issue in translating GLSL function texelFetchOffset on
// INTEL drivers. It works by translating texelFetchOffset into texelFetch.
SH_REWRITE_TEXELFETCHOFFSET_TO_TEXELFETCH = 0x4000000,
} ShCompileOptions;
// Defines alternate strategies for implementing array index clamping.
@ -310,6 +333,68 @@ typedef struct
// The maximum number of parameters a function can have when SH_LIMIT_EXPRESSION_COMPLEXITY is
// turned on.
int MaxFunctionParameters;
// GLES 3.1 constants
// 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 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;
} ShBuiltInResources;
//
@ -425,6 +510,7 @@ COMPILER_EXPORT const std::vector<sh::Varying> *ShGetVaryings(const ShHandle han
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);
COMPILER_EXPORT sh::WorkGroupSize ShGetComputeShaderLocalGroupSize(const ShHandle handle);
typedef struct
{
@ -438,12 +524,10 @@ typedef struct
// 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.
// variables: an array of variables.
COMPILER_EXPORT bool ShCheckVariablesWithinPackingLimits(
int maxVectors,
ShVariableInfo *varInfoArray,
size_t varInfoArraySize);
const std::vector<sh::ShaderVariable> &variables);
// Gives the compiler-assigned register for an interface block.
// The method writes the value to the output variable "indexOut".

31
gfx/angle/include/GLSLANG/ShaderVars.h Normal file → Executable file
View File

@ -10,9 +10,9 @@
#ifndef GLSLANG_SHADERVARS_H_
#define GLSLANG_SHADERVARS_H_
#include <algorithm>
#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
@ -203,6 +203,9 @@ struct COMPILER_EXPORT InterfaceBlock
// Fields from blocks with non-empty instance names are prefixed with the block name.
std::string fieldPrefix() const;
// Decide whether two interface blocks are the same at shader link time.
bool isSameInterfaceBlockAtLinkTime(const InterfaceBlock &other) const;
std::string name;
std::string mappedName;
std::string instanceName;
@ -213,6 +216,32 @@ struct COMPILER_EXPORT InterfaceBlock
std::vector<InterfaceBlockField> fields;
};
struct COMPILER_EXPORT WorkGroupSize
{
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;
int localSizeQualifiers[3];
};
} // namespace sh
#endif // GLSLANG_SHADERVARS_H_

0
gfx/angle/include/KHR/khrplatform.h Normal file → Executable file
View File

0
gfx/angle/include/angle_gl.h Normal file → Executable file
View File

0
gfx/angle/include/angle_windowsstore.h Normal file → Executable file
View File

0
gfx/angle/include/export.h Normal file → Executable file
View File

0
gfx/angle/include/platform/Platform.h Normal file → Executable file
View File

8
gfx/angle/moz.build Normal file → Executable file
View File

@ -28,6 +28,7 @@ UNIFIED_SOURCES += [
'src/compiler/preprocessor/Preprocessor.cpp',
'src/compiler/preprocessor/Token.cpp',
'src/compiler/preprocessor/Tokenizer.cpp',
'src/compiler/translator/AddDefaultReturnStatements.cpp',
'src/compiler/translator/ArrayReturnValueToOutParameter.cpp',
'src/compiler/translator/ASTMetadataHLSL.cpp',
'src/compiler/translator/blocklayout.cpp',
@ -47,6 +48,7 @@ UNIFIED_SOURCES += [
'src/compiler/translator/Diagnostics.cpp',
'src/compiler/translator/DirectiveHandler.cpp',
'src/compiler/translator/EmulatePrecision.cpp',
'src/compiler/translator/ExpandIntegerPowExpressions.cpp',
'src/compiler/translator/ExtensionGLSL.cpp',
'src/compiler/translator/FlagStd140Structs.cpp',
'src/compiler/translator/ForLoopUnroll.cpp',
@ -57,6 +59,7 @@ UNIFIED_SOURCES += [
'src/compiler/translator/InitializeVariables.cpp',
'src/compiler/translator/Intermediate.cpp',
'src/compiler/translator/IntermNode.cpp',
'src/compiler/translator/IntermNodePatternMatcher.cpp',
'src/compiler/translator/intermOut.cpp',
'src/compiler/translator/IntermTraverse.cpp',
'src/compiler/translator/LoopInfo.cpp',
@ -75,6 +78,7 @@ UNIFIED_SOURCES += [
'src/compiler/translator/RemoveSwitchFallThrough.cpp',
'src/compiler/translator/RewriteDoWhile.cpp',
'src/compiler/translator/RewriteElseBlocks.cpp',
'src/compiler/translator/RewriteTexelFetchOffset.cpp',
'src/compiler/translator/ScalarizeVecAndMatConstructorArgs.cpp',
'src/compiler/translator/SearchSymbol.cpp',
'src/compiler/translator/SeparateArrayInitialization.cpp',
@ -82,6 +86,8 @@ UNIFIED_SOURCES += [
'src/compiler/translator/SeparateExpressionsReturningArrays.cpp',
'src/compiler/translator/ShaderLang.cpp',
'src/compiler/translator/ShaderVars.cpp',
'src/compiler/translator/SimplifyLoopConditions.cpp',
'src/compiler/translator/SplitSequenceOperator.cpp',
'src/compiler/translator/StructureHLSL.cpp',
'src/compiler/translator/SymbolTable.cpp',
'src/compiler/translator/TextureFunctionHLSL.cpp',
@ -107,6 +113,7 @@ UNIFIED_SOURCES += [
'src/third_party/compiler/ArrayBoundsClamper.cpp',
]
SOURCES += [
'src/compiler/translator/EmulateGLFragColorBroadcast.cpp',
'src/compiler/translator/glslang_lex.cpp',
'src/compiler/translator/glslang_tab.cpp',
]
@ -164,7 +171,6 @@ DEFINES['ANGLE_ENABLE_ESSL'] = "1"
DEFINES['ANGLE_ENABLE_KEYEDMUTEX'] = "1"
EXPORTS.angle += [ 'include/GLSLANG/ShaderLang.h', 'include/GLSLANG/ShaderVars.h', 'include/platform/Platform.h' ]
EXPORTS.angle.KHR += [ 'include/KHR/khrplatform.h' ]
LOCAL_INCLUDES += [ 'include', 'src', 'src/common/third_party/numerics' ]

27
gfx/angle/src/angle.gyp Normal file → Executable file
View File

@ -142,6 +142,33 @@
],
},
{
'target_name': 'angle_image_util',
'type': 'static_library',
'includes': [ '../build/common_defines.gypi', ],
'sources':
[
'<@(libangle_image_util_sources)',
],
'include_dirs':
[
'.',
'../include',
],
'dependencies':
[
'angle_common',
],
'direct_dependent_settings':
{
'include_dirs':
[
'<(angle_path)/include',
'<(angle_path)/src',
],
},
},
{
'target_name': 'copy_scripts',
'type': 'none',

0
gfx/angle/src/commit.h Normal file → Executable file
View File

0
gfx/angle/src/commit_id.py Normal file → Executable file
View File

0
gfx/angle/src/common/BitSetIterator.h Normal file → Executable file
View File

0
gfx/angle/src/common/BitSetIterator_unittest.cpp Normal file → Executable file
View File

53
gfx/angle/src/common/Color.h Executable file
View 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
gfx/angle/src/common/Color.inl Executable file
View 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

0
gfx/angle/src/common/Float16ToFloat32.cpp Normal file → Executable file
View File

0
gfx/angle/src/common/Float16ToFloat32.py Normal file → Executable file
View File

0
gfx/angle/src/common/MemoryBuffer.cpp Normal file → Executable file
View File

0
gfx/angle/src/common/MemoryBuffer.h Normal file → Executable file
View File

0
gfx/angle/src/common/Optional.h Normal file → Executable file
View File

0
gfx/angle/src/common/Optional_unittest.cpp Normal file → Executable file
View File

0
gfx/angle/src/common/angleutils.cpp Normal file → Executable file
View File

7
gfx/angle/src/common/angleutils.h Normal file → Executable file
View File

@ -34,10 +34,10 @@ class NonCopyable
};
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;
}
@ -62,7 +62,7 @@ void SafeRelease(T& resource)
}
template <typename T>
void SafeDelete(T*& resource)
void SafeDelete(T *&resource)
{
delete resource;
resource = NULL;
@ -161,6 +161,7 @@ std::string FormatString(const char *fmt, ...);
#define snprintf _snprintf
#endif
#define GL_BGR565_ANGLEX 0x6ABB
#define GL_BGRA4_ANGLEX 0x6ABC
#define GL_BGR5_A1_ANGLEX 0x6ABD
#define GL_INT_64_ANGLEX 0x6ABE

0
gfx/angle/src/common/debug.cpp Normal file → Executable file
View File

0
gfx/angle/src/common/debug.h Normal file → Executable file
View File

0
gfx/angle/src/common/event_tracer.cpp Normal file → Executable file
View File

0
gfx/angle/src/common/event_tracer.h Normal file → Executable file
View File

0
gfx/angle/src/common/mathutil.cpp Normal file → Executable file
View File

27
gfx/angle/src/common/mathutil.h Normal file → Executable file
View File

@ -135,7 +135,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;
@ -144,21 +144,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
}
@ -798,8 +799,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

0
gfx/angle/src/common/mathutil_unittest.cpp Normal file → Executable file
View File

0
gfx/angle/src/common/matrix_utils.h Normal file → Executable file
View File

0
gfx/angle/src/common/matrix_utils_unittest.cpp Normal file → Executable file
View File

12
gfx/angle/src/common/platform.h Normal file → Executable file
View File

@ -77,8 +77,16 @@
# 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__))
#include <x86intrin.h>
#define ANGLE_USE_SSE
#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_

24
gfx/angle/src/common/string_utils.cpp Normal file → Executable file
View File

@ -9,6 +9,9 @@
#include "string_utils.h"
#include <algorithm>
#include <stdlib.h>
#include <string.h>
#include <fstream>
#include <sstream>
@ -155,4 +158,25 @@ Optional<std::vector<wchar_t>> WidenString(size_t length, const char *cString)
return Optional<std::vector<wchar_t>>(wcstring);
}
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 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;
}
} // namespace angle

15
gfx/angle/src/common/string_utils.h Normal file → Executable file
View File

@ -47,6 +47,21 @@ 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.
// 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 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);
}
#endif // LIBANGLE_STRING_UTILS_H_

22
gfx/angle/src/common/string_utils_unittest.cpp Normal file → Executable file
View File

@ -138,4 +138,26 @@ TEST(StringUtilsTest, HexStringToUIntBasic)
// Note: ReadFileToString is harder to test
TEST(StringUtilsTest, BeginsEndsWith)
{
ASSERT_FALSE(BeginsWith("foo", "bar"));
ASSERT_FALSE(BeginsWith("", "foo"));
ASSERT_FALSE(BeginsWith("foo", "foobar"));
ASSERT_TRUE(BeginsWith("foobar", "foo"));
ASSERT_TRUE(BeginsWith("foobar", ""));
ASSERT_TRUE(BeginsWith("foo", "foo"));
ASSERT_TRUE(BeginsWith("", ""));
ASSERT_FALSE(EndsWith("foo", "bar"));
ASSERT_FALSE(EndsWith("", "bar"));
ASSERT_FALSE(EndsWith("foo", "foobar"));
ASSERT_TRUE(EndsWith("foobar", "bar"));
ASSERT_TRUE(EndsWith("foobar", ""));
ASSERT_TRUE(EndsWith("bar", "bar"));
ASSERT_TRUE(EndsWith("", ""));
}
}

0
gfx/angle/src/common/third_party/numerics/README.angle vendored Normal file → Executable file
View File

0
gfx/angle/src/common/third_party/numerics/base/logging.h vendored Normal file → Executable file
View File

0
gfx/angle/src/common/third_party/numerics/base/numerics/OWNERS vendored Normal file → Executable file
View File

View File

View File

0
gfx/angle/src/common/third_party/numerics/base/numerics/safe_math.h vendored Normal file → Executable file
View File

View File

View File

0
gfx/angle/src/common/tls.cpp Normal file → Executable file
View File

0
gfx/angle/src/common/tls.h Normal file → Executable file
View File

0
gfx/angle/src/common/utilities.cpp Normal file → Executable file
View File

0
gfx/angle/src/common/utilities.h Normal file → Executable file
View File

0
gfx/angle/src/common/utilities_unittest.cpp Normal file → Executable file
View File

0
gfx/angle/src/common/version.h Normal file → Executable file
View File

14
gfx/angle/src/compiler.gypi Normal file → Executable file
View File

@ -40,8 +40,12 @@
'compiler/translator/Diagnostics.h',
'compiler/translator/DirectiveHandler.cpp',
'compiler/translator/DirectiveHandler.h',
'compiler/translator/EmulateGLFragColorBroadcast.cpp',
'compiler/translator/EmulateGLFragColorBroadcast.h',
'compiler/translator/EmulatePrecision.cpp',
'compiler/translator/EmulatePrecision.h',
'compiler/translator/ExpandIntegerPowExpressions.cpp',
'compiler/translator/ExpandIntegerPowExpressions.h',
'compiler/translator/ExtensionBehavior.h',
'compiler/translator/FlagStd140Structs.cpp',
'compiler/translator/FlagStd140Structs.h',
@ -85,6 +89,8 @@
'compiler/translator/RemovePow.h',
'compiler/translator/RewriteDoWhile.cpp',
'compiler/translator/RewriteDoWhile.h',
'compiler/translator/RewriteTexelFetchOffset.cpp',
'compiler/translator/RewriteTexelFetchOffset.h',
'compiler/translator/RenameFunction.h',
'compiler/translator/ScalarizeVecAndMatConstructorArgs.cpp',
'compiler/translator/ScalarizeVecAndMatConstructorArgs.h',
@ -160,6 +166,8 @@
],
'angle_translator_lib_hlsl_sources':
[
'compiler/translator/AddDefaultReturnStatements.cpp',
'compiler/translator/AddDefaultReturnStatements.h',
'compiler/translator/ArrayReturnValueToOutParameter.cpp',
'compiler/translator/ArrayReturnValueToOutParameter.h',
'compiler/translator/ASTMetadataHLSL.cpp',
@ -168,6 +176,8 @@
'compiler/translator/blocklayoutHLSL.h',
'compiler/translator/BuiltInFunctionEmulatorHLSL.cpp',
'compiler/translator/BuiltInFunctionEmulatorHLSL.h',
'compiler/translator/IntermNodePatternMatcher.cpp',
'compiler/translator/IntermNodePatternMatcher.h',
'compiler/translator/OutputHLSL.cpp',
'compiler/translator/OutputHLSL.h',
'compiler/translator/RemoveDynamicIndexing.cpp',
@ -182,6 +192,10 @@
'compiler/translator/SeparateDeclarations.h',
'compiler/translator/SeparateExpressionsReturningArrays.cpp',
'compiler/translator/SeparateExpressionsReturningArrays.h',
'compiler/translator/SimplifyLoopConditions.cpp',
'compiler/translator/SimplifyLoopConditions.h',
'compiler/translator/SplitSequenceOperator.cpp',
'compiler/translator/SplitSequenceOperator.h',
'compiler/translator/StructureHLSL.cpp',
'compiler/translator/StructureHLSL.h',
'compiler/translator/TextureFunctionHLSL.cpp',

View File

View File

@ -115,6 +115,8 @@ std::string Diagnostics::message(ID id)
return "invalid line directive";
case PP_NON_PP_TOKEN_BEFORE_EXTENSION_ESSL3:
return "extension directive must occur before any non-preprocessor tokens in ESSL3";
case PP_UNDEFINED_SHIFT:
return "shift exponent is negative or undefined";
// Errors end.
// Warnings begin.
case PP_EOF_IN_DIRECTIVE:

1
gfx/angle/src/compiler/preprocessor/DiagnosticsBase.h Normal file → Executable file
View File

@ -65,6 +65,7 @@ class Diagnostics
PP_INVALID_FILE_NUMBER,
PP_INVALID_LINE_DIRECTIVE,
PP_NON_PP_TOKEN_BEFORE_EXTENSION_ESSL3,
PP_UNDEFINED_SHIFT,
PP_ERROR_END,
PP_WARNING_BEGIN,

View File

View File

69
gfx/angle/src/compiler/preprocessor/DirectiveParser.cpp Normal file → Executable file
View File

@ -118,8 +118,8 @@ void skipUntilEOD(pp::Lexer *lexer, pp::Token *token)
bool isMacroNameReserved(const std::string &name)
{
// Names prefixed with "GL_" are reserved.
return (name.substr(0, 3) == "GL_");
// Names prefixed with "GL_" and the name "defined" are reserved.
return name == "defined" || (name.substr(0, 3) == "GL_");
}
bool hasDoubleUnderscores(const std::string &name)
@ -139,6 +139,66 @@ bool isMacroPredefined(const std::string &name,
namespace pp
{
class DefinedParser : public Lexer
{
public:
DefinedParser(Lexer *lexer, const MacroSet *macroSet, Diagnostics *diagnostics)
: mLexer(lexer), mMacroSet(macroSet), mDiagnostics(diagnostics)
{
}
protected:
void lex(Token *token) override
{
const char kDefined[] = "defined";
mLexer->lex(token);
if (token->type != Token::IDENTIFIER)
return;
if (token->text != kDefined)
return;
bool paren = false;
mLexer->lex(token);
if (token->type == '(')
{
paren = true;
mLexer->lex(token);
}
if (token->type != Token::IDENTIFIER)
{
mDiagnostics->report(Diagnostics::PP_UNEXPECTED_TOKEN, token->location, token->text);
skipUntilEOD(mLexer, token);
return;
}
MacroSet::const_iterator iter = mMacroSet->find(token->text);
std::string expression = iter != mMacroSet->end() ? "1" : "0";
if (paren)
{
mLexer->lex(token);
if (token->type != ')')
{
mDiagnostics->report(Diagnostics::PP_UNEXPECTED_TOKEN, token->location,
token->text);
skipUntilEOD(mLexer, token);
return;
}
}
// We have a valid defined operator.
// Convert the current token into a CONST_INT token.
token->type = Token::CONST_INT;
token->text = expression;
}
private:
Lexer *mLexer;
const MacroSet *mMacroSet;
Diagnostics *mDiagnostics;
};
DirectiveParser::DirectiveParser(Tokenizer *tokenizer,
MacroSet *macroSet,
Diagnostics *diagnostics,
@ -776,7 +836,7 @@ void DirectiveParser::parseLine(Token *token)
bool parsedFileNumber = false;
int line = 0, file = 0;
MacroExpander macroExpander(mTokenizer, mMacroSet, mDiagnostics, false);
MacroExpander macroExpander(mTokenizer, mMacroSet, mDiagnostics);
// Lex the first token after "#line" so we can check it for EOD.
macroExpander.lex(token);
@ -885,7 +945,8 @@ int DirectiveParser::parseExpressionIf(Token *token)
assert((getDirective(token) == DIRECTIVE_IF) ||
(getDirective(token) == DIRECTIVE_ELIF));
MacroExpander macroExpander(mTokenizer, mMacroSet, mDiagnostics, true);
DefinedParser definedParser(mTokenizer, mMacroSet, mDiagnostics);
MacroExpander macroExpander(&definedParser, mMacroSet, mDiagnostics);
ExpressionParser expressionParser(&macroExpander, mDiagnostics);
int expression = 0;

0
gfx/angle/src/compiler/preprocessor/DirectiveParser.h Normal file → Executable file
View File

View File

@ -498,12 +498,9 @@ static const yytype_uint8 yytranslate[] =
#if YYDEBUG
/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] =
{
0, 110, 110, 117, 118, 129, 129, 150, 150, 171,
174, 177, 180, 183, 186, 189, 192, 195, 198, 201,
204, 207, 210, 230, 250, 253, 256, 259, 262, 265
};
static const yytype_uint16 yyrline[] = {0, 110, 110, 117, 118, 129, 129, 150, 150, 171,
174, 177, 180, 183, 186, 189, 192, 195, 198, 218,
238, 241, 244, 264, 284, 287, 290, 293, 296, 299};
#endif
#if YYDEBUG || YYERROR_VERBOSE || 0
@ -1495,7 +1492,23 @@ yyreduce:
case 18:
{
(yyval) = (yyvsp[-2]) >> (yyvsp[0]);
if ((yyvsp[0]) < 0)
{
if (!context->isIgnoringErrors())
{
std::ostringstream stream;
stream << (yyvsp[-2]) << " >> " << (yyvsp[0]);
std::string text = stream.str();
context->diagnostics->report(pp::Diagnostics::PP_UNDEFINED_SHIFT,
context->token->location, text.c_str());
*(context->valid) = false;
}
(yyval) = static_cast<YYSTYPE>(0);
}
else
{
(yyval) = (yyvsp[-2]) >> (yyvsp[0]);
}
}
break;
@ -1503,7 +1516,23 @@ yyreduce:
case 19:
{
(yyval) = (yyvsp[-2]) << (yyvsp[0]);
if ((yyvsp[0]) < 0)
{
if (!context->isIgnoringErrors())
{
std::ostringstream stream;
stream << (yyvsp[-2]) << " << " << (yyvsp[0]);
std::string text = stream.str();
context->diagnostics->report(pp::Diagnostics::PP_UNDEFINED_SHIFT,
context->token->location, text.c_str());
*(context->valid) = false;
}
(yyval) = static_cast<YYSTYPE>(0);
}
else
{
(yyval) = (yyvsp[-2]) << (yyvsp[0]);
}
}
break;

0
gfx/angle/src/compiler/preprocessor/ExpressionParser.h Normal file → Executable file
View File

38
gfx/angle/src/compiler/preprocessor/ExpressionParser.y Normal file → Executable file
View File

@ -196,10 +196,44 @@ expression
$$ = $1 < $3;
}
| expression TOK_OP_RIGHT expression {
$$ = $1 >> $3;
if ($3 < 0)
{
if (!context->isIgnoringErrors())
{
std::ostringstream stream;
stream << $1 << " >> " << $3;
std::string text = stream.str();
context->diagnostics->report(pp::Diagnostics::PP_UNDEFINED_SHIFT,
context->token->location,
text.c_str());
*(context->valid) = false;
}
$$ = static_cast<YYSTYPE>(0);
}
else
{
$$ = $1 >> $3;
}
}
| expression TOK_OP_LEFT expression {
$$ = $1 << $3;
if ($3 < 0)
{
if (!context->isIgnoringErrors())
{
std::ostringstream stream;
stream << $1 << " << " << $3;
std::string text = stream.str();
context->diagnostics->report(pp::Diagnostics::PP_UNDEFINED_SHIFT,
context->token->location,
text.c_str());
*(context->valid) = false;
}
$$ = static_cast<YYSTYPE>(0);
}
else
{
$$ = $1 << $3;
}
}
| expression '-' expression {
$$ = $1 - $3;

0
gfx/angle/src/compiler/preprocessor/Input.cpp Normal file → Executable file
View File

0
gfx/angle/src/compiler/preprocessor/Input.h Normal file → Executable file
View File

0
gfx/angle/src/compiler/preprocessor/Lexer.cpp Normal file → Executable file
View File

0
gfx/angle/src/compiler/preprocessor/Lexer.h Normal file → Executable file
View File

0
gfx/angle/src/compiler/preprocessor/Macro.cpp Normal file → Executable file
View File

0
gfx/angle/src/compiler/preprocessor/Macro.h Normal file → Executable file
View File

52
gfx/angle/src/compiler/preprocessor/MacroExpander.cpp Normal file → Executable file
View File

@ -46,11 +46,8 @@ class TokenLexer : public Lexer
TokenVector::const_iterator mIter;
};
MacroExpander::MacroExpander(Lexer *lexer,
MacroSet *macroSet,
Diagnostics *diagnostics,
bool parseDefined)
: mLexer(lexer), mMacroSet(macroSet), mDiagnostics(diagnostics), mParseDefined(parseDefined)
MacroExpander::MacroExpander(Lexer *lexer, MacroSet *macroSet, Diagnostics *diagnostics)
: mLexer(lexer), mMacroSet(macroSet), mDiagnostics(diagnostics)
{
}
@ -66,54 +63,11 @@ void MacroExpander::lex(Token *token)
{
while (true)
{
const char kDefined[] = "defined";
getToken(token);
if (token->type != Token::IDENTIFIER)
break;
// Defined operator is parsed here since it may be generated by macro expansion.
// Defined operator produced by macro expansion has undefined behavior according to C++
// spec, which the GLSL spec references (see C++14 draft spec section 16.1.4), but this
// behavior is needed for passing dEQP tests, which enforce stricter compatibility between
// implementations.
if (mParseDefined && token->text == kDefined)
{
bool paren = false;
getToken(token);
if (token->type == '(')
{
paren = true;
getToken(token);
}
if (token->type != Token::IDENTIFIER)
{
mDiagnostics->report(Diagnostics::PP_UNEXPECTED_TOKEN, token->location,
token->text);
break;
}
auto iter = mMacroSet->find(token->text);
std::string expression = iter != mMacroSet->end() ? "1" : "0";
if (paren)
{
getToken(token);
if (token->type != ')')
{
mDiagnostics->report(Diagnostics::PP_UNEXPECTED_TOKEN, token->location,
token->text);
break;
}
}
// We have a valid defined operator.
// Convert the current token into a CONST_INT token.
token->type = Token::CONST_INT;
token->text = expression;
break;
}
if (token->expansionDisabled())
break;
@ -367,7 +321,7 @@ bool MacroExpander::collectMacroArgs(const Macro &macro,
{
MacroArg &arg = args->at(i);
TokenLexer lexer(&arg);
MacroExpander expander(&lexer, mMacroSet, mDiagnostics, mParseDefined);
MacroExpander expander(&lexer, mMacroSet, mDiagnostics);
arg.clear();
expander.lex(&token);

3
gfx/angle/src/compiler/preprocessor/MacroExpander.h Normal file → Executable file
View File

@ -24,7 +24,7 @@ struct SourceLocation;
class MacroExpander : public Lexer
{
public:
MacroExpander(Lexer *lexer, MacroSet *macroSet, Diagnostics *diagnostics, bool parseDefined);
MacroExpander(Lexer *lexer, MacroSet *macroSet, Diagnostics *diagnostics);
~MacroExpander() override;
void lex(Token *token) override;
@ -81,7 +81,6 @@ class MacroExpander : public Lexer
Lexer *mLexer;
MacroSet *mMacroSet;
Diagnostics *mDiagnostics;
bool mParseDefined;
std::unique_ptr<Token> mReserveToken;
std::vector<MacroContext *> mContextStack;

2
gfx/angle/src/compiler/preprocessor/Preprocessor.cpp Normal file → Executable file
View File

@ -30,7 +30,7 @@ struct PreprocessorImpl
: diagnostics(diag),
tokenizer(diag),
directiveParser(&tokenizer, &macroSet, diag, directiveHandler),
macroExpander(&directiveParser, &macroSet, diag, false)
macroExpander(&directiveParser, &macroSet, diag)
{
}
};

0
gfx/angle/src/compiler/preprocessor/Preprocessor.h Normal file → Executable file
View File

0
gfx/angle/src/compiler/preprocessor/SourceLocation.h Normal file → Executable file
View File

0
gfx/angle/src/compiler/preprocessor/Token.cpp Normal file → Executable file
View File

0
gfx/angle/src/compiler/preprocessor/Token.h Normal file → Executable file
View File

0
gfx/angle/src/compiler/preprocessor/Tokenizer.cpp Normal file → Executable file
View File

0
gfx/angle/src/compiler/preprocessor/Tokenizer.h Normal file → Executable file
View File

0
gfx/angle/src/compiler/preprocessor/Tokenizer.l Normal file → Executable file
View File

0
gfx/angle/src/compiler/preprocessor/generate_parser.sh Normal file → Executable file
View File

0
gfx/angle/src/compiler/preprocessor/numeric_lex.h Normal file → Executable file
View File

0
gfx/angle/src/compiler/preprocessor/pp_utils.h Normal file → Executable file
View File

Some files were not shown because too many files have changed in this diff Show More